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 UtcDaliAnimationSetSpeedFactorP(void)
1194 TestApplication application;
1196 Actor actor = Actor::New();
1197 Stage::GetCurrent().Add(actor);
1199 // Build the animation
1200 float durationSeconds(1.0f);
1201 Animation animation = Animation::New(durationSeconds);
1203 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1204 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1206 KeyFrames keyframes = KeyFrames::New();
1207 keyframes.Add( 0.0f, initialPosition);
1208 keyframes.Add( 1.0f, targetPosition );
1209 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1211 //Set speed to be x2
1212 animation.SetSpeedFactor(2.0f);
1214 // Start the animation
1217 bool signalReceived(false);
1218 AnimationFinishCheck finishCheck(signalReceived);
1219 animation.FinishedSignal().Connect(&application, finishCheck);
1221 application.SendNotification();
1222 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1224 // We didn't expect the animation to finish yet
1225 application.SendNotification();
1226 finishCheck.CheckSignalNotReceived();
1227 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1229 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1231 // We didn't expect the animation to finish yet
1232 application.SendNotification();
1233 finishCheck.CheckSignalNotReceived();
1234 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1236 application.Render(static_cast<unsigned int>(durationSeconds*100.0f) + 1u/*just beyond half the duration*/);
1238 // We did expect the animation to finish
1239 application.SendNotification();
1240 finishCheck.CheckSignalReceived();
1241 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1243 // Check that nothing has changed after a couple of buffer swaps
1244 application.Render(0);
1245 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1246 application.Render(0);
1247 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1249 finishCheck.Reset();
1251 //Test -1 speed factor. Animation will play in reverse at normal speed
1252 animation.SetSpeedFactor( -1.0f );
1254 // Start the animation
1257 application.SendNotification();
1258 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1260 // We didn't expect the animation to finish yet
1261 application.SendNotification();
1262 finishCheck.CheckSignalNotReceived();
1263 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1265 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1267 // We didn't expect the animation to finish yet
1268 application.SendNotification();
1269 finishCheck.CheckSignalNotReceived();
1270 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1272 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1274 // We didn't expect the animation to finish yet
1275 application.SendNotification();
1276 finishCheck.CheckSignalNotReceived();
1277 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1279 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1281 // We didn't expect the animation to finish yet
1282 application.SendNotification();
1283 finishCheck.CheckSignalNotReceived();
1284 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1286 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1288 // We did expect the animation to finish
1289 application.SendNotification();
1290 finishCheck.CheckSignalReceived();
1291 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
1293 // Check that nothing has changed after a couple of buffer swaps
1294 application.Render(0);
1295 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1296 application.Render(0);
1297 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1299 //Test change speed factor on the fly
1300 finishCheck.Reset();
1302 //Set speed to be half of normal speed
1303 animation.SetSpeedFactor( 0.5f );
1305 // Start the animation
1308 application.SendNotification();
1309 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1311 // We didn't expect the animation to finish yet
1312 application.SendNotification();
1313 finishCheck.CheckSignalNotReceived();
1314 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), TEST_LOCATION );
1316 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1318 // We didn't expect the animation to finish yet
1319 application.SendNotification();
1320 finishCheck.CheckSignalNotReceived();
1321 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1323 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
1325 // We didn't expect the animation to finish yet
1326 application.SendNotification();
1327 finishCheck.CheckSignalNotReceived();
1328 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.3f), TEST_LOCATION );
1330 //Change speed factor while animation still playing.
1331 animation.SetSpeedFactor(-1.0f);
1332 application.SendNotification();
1333 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1335 // We didn't expect the animation to finish yet
1336 application.SendNotification();
1337 finishCheck.CheckSignalNotReceived();
1338 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), TEST_LOCATION );
1340 application.Render(static_cast<unsigned int>(durationSeconds*100.0f) + 1u/*just beyond the animation duration*/);
1342 // We did expect the animation to finish
1343 application.SendNotification();
1344 finishCheck.CheckSignalReceived();
1345 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
1347 // Check that nothing has changed after a couple of buffer swaps
1348 application.Render(0);
1349 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1350 application.Render(0);
1351 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1355 int UtcDaliAnimationGetSpeedFactorP(void)
1357 TestApplication application;
1359 Animation animation = Animation::New(1.0f);
1360 animation.SetSpeedFactor(0.5f);
1361 DALI_TEST_EQUALS(animation.GetSpeedFactor(), 0.5f, TEST_LOCATION);
1363 animation.SetSpeedFactor(-2.5f);
1364 DALI_TEST_EQUALS(animation.GetSpeedFactor(), -2.5f, TEST_LOCATION);
1368 int UtcDaliAnimationSetPlayRangeP(void)
1370 TestApplication application;
1372 Actor actor = Actor::New();
1373 Stage::GetCurrent().Add( actor );
1375 // Build the animation
1376 float durationSeconds( 1.0f );
1377 Animation animation = Animation::New( durationSeconds );
1379 bool signalReceived( false );
1380 AnimationFinishCheck finishCheck( signalReceived );
1381 animation.FinishedSignal().Connect( &application, finishCheck );
1382 application.SendNotification();
1384 // Set range between 0.4 and 0.8
1385 animation.SetPlayRange( Vector2( 0.4f, 0.9f ) );
1386 application.SendNotification();
1387 DALI_TEST_EQUALS( Vector2( 0.4f, 0.9f ), animation.GetPlayRange(), TEST_LOCATION );
1389 Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
1390 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR );
1392 // Start the animation from 40% progress
1395 application.SendNotification();
1396 application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 60% progress */ );
1398 // We didn't expect the animation to finish yet
1399 application.SendNotification();
1400 finishCheck.CheckSignalNotReceived();
1401 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.6f ), TEST_LOCATION );
1403 application.SendNotification();
1404 application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 80% progress */ );
1406 application.SendNotification();
1407 finishCheck.CheckSignalNotReceived();
1408 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.8f ), TEST_LOCATION );
1410 application.SendNotification();
1411 application.Render( static_cast< unsigned int >( durationSeconds*100.0f ) + 1u/*just beyond the animation duration*/ );
1413 // We did expect the animation to finish
1414 application.SendNotification();
1415 finishCheck.CheckSignalReceived();
1416 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.9f ), TEST_LOCATION );
1420 int UtcDaliAnimationSetPlayRangeN(void)
1422 TestApplication application;
1424 Actor actor = Actor::New();
1425 Stage::GetCurrent().Add(actor);
1427 // Build the animation
1428 Animation animation = Animation::New(0);
1429 application.SendNotification();
1431 //PlayRange out of bounds
1432 animation.SetPlayRange( Vector2(-1.0f,1.0f) );
1433 application.SendNotification();
1434 DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
1435 animation.SetPlayRange( Vector2(0.0f,2.0f) );
1436 application.SendNotification();
1437 DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
1439 //If playRange is not in the correct order it has to be ordered
1440 animation.SetPlayRange( Vector2(0.8f,0.2f) );
1441 application.SendNotification();
1442 DALI_TEST_EQUALS( Vector2(0.2f,0.8f), animation.GetPlayRange(), TEST_LOCATION );
1447 int UtcDaliAnimationGetPlayRangeP(void)
1449 TestApplication application;
1451 Actor actor = Actor::New();
1452 Stage::GetCurrent().Add( actor );
1454 // Build the animation
1455 Animation animation = Animation::New( 1.0f );
1456 application.SendNotification();
1458 //If PlayRange not specified it should be 0.0-1.0 by default
1459 DALI_TEST_EQUALS( Vector2( 0.0f,1.0f ), animation.GetPlayRange(), TEST_LOCATION );
1461 // Set range between 0.4 and 0.8
1462 animation.SetPlayRange( Vector2( 0.4f, 0.8f ) );
1463 application.SendNotification();
1464 DALI_TEST_EQUALS( Vector2( 0.4f, 0.8f ), animation.GetPlayRange(), TEST_LOCATION );
1469 int UtcDaliAnimationPlayP(void)
1471 TestApplication application;
1473 Actor actor = Actor::New();
1474 Stage::GetCurrent().Add(actor);
1476 // Build the animation
1477 float durationSeconds(1.0f);
1478 Animation animation = Animation::New(durationSeconds);
1479 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1480 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1482 // Start the animation
1485 bool signalReceived(false);
1486 AnimationFinishCheck finishCheck(signalReceived);
1487 animation.FinishedSignal().Connect(&application, finishCheck);
1489 application.SendNotification();
1490 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1492 // We didn't expect the animation to finish yet
1493 application.SendNotification();
1494 finishCheck.CheckSignalNotReceived();
1495 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1497 animation.Play(); // Test that calling play has no effect, when animation is already playing
1498 application.SendNotification();
1499 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1501 // We didn't expect the animation to finish yet
1502 application.SendNotification();
1503 finishCheck.CheckSignalNotReceived();
1504 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1506 animation.Play(); // Test that calling play has no effect, when animation is already playing
1507 application.SendNotification();
1508 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1510 // We didn't expect the animation to finish yet
1511 application.SendNotification();
1512 finishCheck.CheckSignalNotReceived();
1513 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1515 animation.Play(); // Test that calling play has no effect, when animation is already playing
1516 application.SendNotification();
1517 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1519 // We didn't expect the animation to finish yet
1520 application.SendNotification();
1521 finishCheck.CheckSignalNotReceived();
1522 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1524 animation.Play(); // Test that calling play has no effect, when animation is already playing
1525 application.SendNotification();
1526 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1528 // We did expect the animation to finish
1529 application.SendNotification();
1530 finishCheck.CheckSignalReceived();
1531 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1533 // Check that nothing has changed after a couple of buffer swaps
1534 application.Render(0);
1535 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1536 application.Render(0);
1537 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1541 int UtcDaliAnimationPlayOffStageP(void)
1543 // Test that an animation can be played, when the actor is off-stage.
1544 // When the actor is added to the stage, it should appear at the current position
1545 // i.e. where it would have been anyway, if on-stage from the beginning.
1547 TestApplication application;
1549 Actor actor = Actor::New();
1550 Vector3 basePosition(Vector3::ZERO);
1551 DALI_TEST_EQUALS( actor.GetCurrentPosition(), basePosition, TEST_LOCATION );
1552 // Not added to the stage!
1554 // Build the animation
1555 float durationSeconds(1.0f);
1556 Animation animation = Animation::New(durationSeconds);
1557 animation.SetDisconnectAction( Animation::Discard );
1558 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1559 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1561 // Start the animation
1564 bool signalReceived(false);
1565 AnimationFinishCheck finishCheck(signalReceived);
1566 animation.FinishedSignal().Connect(&application, finishCheck);
1568 application.SendNotification();
1569 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1571 // We didn't expect the animation to finish yet
1572 application.SendNotification();
1573 finishCheck.CheckSignalNotReceived();
1574 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*off-stage*/, TEST_LOCATION );
1577 Stage::GetCurrent().Add(actor);
1579 application.SendNotification();
1580 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1582 // We didn't expect the animation to finish yet
1583 application.SendNotification();
1584 finishCheck.CheckSignalNotReceived();
1585 Vector3 expectedPosition(basePosition + (targetPosition - basePosition)*0.4f);
1586 DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition/*on-stage*/, TEST_LOCATION );
1588 // Remove from the stage
1589 Stage::GetCurrent().Remove(actor);
1591 application.SendNotification();
1592 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1594 // We didn't expect the animation to finish yet
1595 application.SendNotification();
1596 finishCheck.CheckSignalNotReceived();
1597 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*back to start position*/, TEST_LOCATION );
1600 Stage::GetCurrent().Add(actor);
1602 application.SendNotification();
1603 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1605 // We didn't expect the animation to finish yet
1606 application.SendNotification();
1607 finishCheck.CheckSignalNotReceived();
1608 expectedPosition = Vector3(basePosition + (targetPosition - basePosition)*0.8f);
1609 DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition, TEST_LOCATION );
1611 application.SendNotification();
1612 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1614 // We did expect the animation to finish
1615 application.SendNotification();
1616 finishCheck.CheckSignalReceived();
1617 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1619 // Check that nothing has changed after a couple of buffer swaps
1620 application.Render(0);
1621 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1622 application.Render(0);
1623 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1627 int UtcDaliAnimationPlayDiscardHandleP(void)
1629 TestApplication application;
1631 Actor actor = Actor::New();
1632 Stage::GetCurrent().Add(actor);
1634 // Build the animation
1635 float durationSeconds(1.0f);
1636 Animation animation = Animation::New(durationSeconds);
1637 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1638 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1640 bool signalReceived(false);
1641 AnimationFinishCheck finishCheck(signalReceived);
1642 animation.FinishedSignal().Connect(&application, finishCheck);
1644 // Start the animation
1647 // This is a test of the "Fire and Forget" behaviour
1648 // Discard the animation handle!
1650 DALI_TEST_CHECK( !animation );
1652 application.SendNotification();
1653 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1655 // We didn't expect the animation to finish yet
1656 application.SendNotification();
1657 finishCheck.CheckSignalNotReceived();
1658 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1660 application.SendNotification();
1661 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1663 // We didn't expect the animation to finish yet
1664 application.SendNotification();
1665 finishCheck.CheckSignalNotReceived();
1666 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1668 application.SendNotification();
1669 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1671 // We didn't expect the animation to finish yet
1672 application.SendNotification();
1673 finishCheck.CheckSignalNotReceived();
1674 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1676 application.SendNotification();
1677 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1679 // We didn't expect the animation to finish yet
1680 application.SendNotification();
1681 finishCheck.CheckSignalNotReceived();
1682 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1684 application.SendNotification();
1685 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1687 // We did expect the animation to finish
1688 application.SendNotification();
1689 finishCheck.CheckSignalReceived();
1690 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1692 // Check that nothing has changed after a couple of buffer swaps
1693 application.Render(0);
1694 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1695 application.Render(0);
1696 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1700 int UtcDaliAnimationPlayStopDiscardHandleP(void)
1702 TestApplication application;
1704 Actor actor = Actor::New();
1705 Stage::GetCurrent().Add(actor);
1707 // Build the animation
1708 float durationSeconds(1.0f);
1709 Animation animation = Animation::New(durationSeconds);
1710 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1711 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1713 // Start the animation
1716 bool signalReceived(false);
1717 AnimationFinishCheck finishCheck(signalReceived);
1718 animation.FinishedSignal().Connect(&application, finishCheck);
1720 application.SendNotification();
1721 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1723 // We didn't expect the animation to finish yet
1724 application.SendNotification();
1725 finishCheck.CheckSignalNotReceived();
1726 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1728 // This is a test of the "Fire and Forget" behaviour
1729 // Stop the animation, and Discard the animation handle!
1732 DALI_TEST_CHECK( !animation );
1734 application.SendNotification();
1735 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1737 // We expect the animation to finish at 20% progress
1738 application.SendNotification();
1739 finishCheck.CheckSignalReceived();
1740 finishCheck.Reset();
1741 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1743 application.SendNotification();
1744 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1746 // Check that nothing has changed
1747 application.SendNotification();
1748 finishCheck.CheckSignalNotReceived();
1749 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1751 application.SendNotification();
1752 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1754 // Check that nothing has changed
1755 application.SendNotification();
1756 finishCheck.CheckSignalNotReceived();
1757 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1759 application.SendNotification();
1760 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 100% progress */);
1762 // Check that nothing has changed
1763 application.SendNotification();
1764 finishCheck.CheckSignalNotReceived();
1765 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1769 int UtcDaliAnimationPlayRangeP(void)
1771 TestApplication application;
1773 Actor actor = Actor::New();
1774 Stage::GetCurrent().Add(actor);
1776 // Build the animation
1777 float durationSeconds(1.0f);
1778 Animation animation = Animation::New(durationSeconds);
1779 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1780 KeyFrames keyframes = KeyFrames::New();
1781 keyframes.Add( 0.0f , Vector3(0.0f,0.0f,0.0f ) );
1782 keyframes.Add( 1.0f , Vector3(100.0f,100.0f,100.0f ) );
1784 animation.AnimateBetween( Property( actor, Actor::Property::POSITION), keyframes );
1786 // Set range between 0.4 and 0.8
1787 animation.SetPlayRange( Vector2(0.4f,0.8f) );
1790 bool signalReceived(false);
1791 AnimationFinishCheck finishCheck(signalReceived);
1792 animation.FinishedSignal().Connect(&application, finishCheck);
1794 //Test that setting progress outside the range doesn't work
1795 animation.SetCurrentProgress( 0.9f );
1796 application.SendNotification();
1797 application.Render(0);
1798 DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
1799 animation.SetCurrentProgress( 0.2f );
1800 application.SendNotification();
1801 application.Render(0);
1802 DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
1804 application.SendNotification();
1805 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1807 // We didn't expect the animation to finish yet
1808 application.SendNotification();
1809 finishCheck.CheckSignalNotReceived();
1810 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1812 animation.Play(); // Test that calling play has no effect, when animation is already playing
1813 application.SendNotification();
1814 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/* 80% progress */);
1816 // We did expect the animation to finish
1817 application.SendNotification();
1818 finishCheck.CheckSignalReceived();
1819 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1821 // Check that nothing has changed after a couple of buffer swaps
1822 application.Render(0);
1823 DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentPosition(), TEST_LOCATION );
1824 application.Render(0);
1825 DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentPosition(), TEST_LOCATION );
1828 //Loop inside the range
1829 finishCheck.Reset();
1830 animation.SetLooping( true );
1832 application.SendNotification();
1833 float intervalSeconds = 0.1f;
1834 float progress = 0.4f;
1835 for (int iterations = 0; iterations < 10; ++iterations )
1837 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
1839 progress += intervalSeconds;
1840 if (progress > 0.8f)
1842 progress = progress - 0.4f;
1845 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
1848 // We didn't expect the animation to finish yet
1849 application.SendNotification();
1850 finishCheck.CheckSignalNotReceived();
1853 //Test change range on the fly
1854 animation.SetPlayRange( Vector2( 0.2f, 0.9f ) );
1855 application.SendNotification();
1857 for (int iterations = 0; iterations < 10; ++iterations )
1859 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
1861 progress += intervalSeconds;
1862 if (progress > 0.9f)
1864 progress = progress - 0.7f;
1867 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
1873 int UtcDaliAnimationPlayFromP(void)
1875 TestApplication application;
1877 Actor actor = Actor::New();
1878 Stage::GetCurrent().Add(actor);
1880 // Build the animation
1881 float durationSeconds(1.0f);
1882 Animation animation = Animation::New(durationSeconds);
1883 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1884 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1886 // Start the animation from 40% progress
1887 animation.PlayFrom( 0.4f );
1889 bool signalReceived(false);
1890 AnimationFinishCheck finishCheck(signalReceived);
1891 animation.FinishedSignal().Connect(&application, finishCheck);
1893 application.SendNotification();
1894 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1896 // We didn't expect the animation to finish yet
1897 application.SendNotification();
1898 finishCheck.CheckSignalNotReceived();
1899 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1901 animation.Play(); // Test that calling play has no effect, when animation is already playing
1902 application.SendNotification();
1903 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1905 // We didn't expect the animation to finish yet
1906 application.SendNotification();
1907 finishCheck.CheckSignalNotReceived();
1908 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1910 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1911 // We did expect the animation to finish
1912 application.SendNotification();
1913 finishCheck.CheckSignalReceived();
1914 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1916 // Check that nothing has changed after a couple of buffer swaps
1917 application.Render(0);
1918 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1919 application.Render(0);
1920 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1924 int UtcDaliAnimationPlayFromN(void)
1926 TestApplication application;
1928 Actor actor = Actor::New();
1929 Stage::GetCurrent().Add(actor);
1931 // Build the animation
1932 float durationSeconds(1.0f);
1933 Animation animation = Animation::New(durationSeconds);
1934 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1935 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1937 //PlayFrom with an argument outside the range [0..1] will be ignored
1938 animation.PlayFrom(-1.0f);
1939 application.SendNotification();
1940 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1942 animation.PlayFrom(100.0f);
1943 application.SendNotification();
1944 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1948 int UtcDaliAnimationPauseP(void)
1950 TestApplication application;
1952 Actor actor = Actor::New();
1953 Stage::GetCurrent().Add(actor);
1955 // Build the animation
1956 float durationSeconds(1.0f);
1957 Animation animation = Animation::New(durationSeconds);
1958 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1959 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1961 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
1963 // Start the animation
1966 bool signalReceived(false);
1967 AnimationFinishCheck finishCheck(signalReceived);
1968 animation.FinishedSignal().Connect(&application, finishCheck);
1970 application.SendNotification();
1971 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
1973 // We didn't expect the animation to finish yet
1974 application.SendNotification();
1975 finishCheck.CheckSignalNotReceived();
1976 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
1978 // Pause the animation
1980 application.SendNotification();
1983 for (int i=0; i<5; ++i)
1985 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
1987 // We didn't expect the animation to finish yet
1988 application.SendNotification();
1989 finishCheck.CheckSignalNotReceived();
1990 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
1995 application.SendNotification();
1996 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
1998 // We didn't expect the animation to finish yet
1999 application.SendNotification();
2000 finishCheck.CheckSignalNotReceived();
2002 application.SendNotification();
2003 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2005 // We did expect the animation to finish
2006 application.SendNotification();
2007 finishCheck.CheckSignalReceived();
2008 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2010 // Check that nothing has changed after a couple of buffer swaps
2011 application.Render(0);
2012 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2013 application.Render(0);
2014 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2018 int UtcDaliAnimationStoP(void)
2020 TestApplication application;
2022 Actor actor = Actor::New();
2023 Stage::GetCurrent().Add(actor);
2025 // Build the animation
2026 float durationSeconds(1.0f);
2027 Animation animation = Animation::New(durationSeconds);
2028 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2029 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2031 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2033 // Start the animation
2036 bool signalReceived(false);
2037 AnimationFinishCheck finishCheck(signalReceived);
2038 animation.FinishedSignal().Connect(&application, finishCheck);
2040 application.SendNotification();
2041 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2043 // We didn't expect the animation to finish yet
2044 application.SendNotification();
2045 finishCheck.CheckSignalNotReceived();
2046 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2048 // Stop the animation
2050 application.SendNotification();
2053 for (int i=0; i<5; ++i)
2055 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2057 // We did expect the animation to finish
2058 application.SendNotification();
2059 finishCheck.CheckSignalReceived();
2060 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when stopped */, TEST_LOCATION );
2065 int UtcDaliAnimationStopSetPositionP(void)
2067 // Test that Animation::Stop & Actor::SetPosition can be used in conjunction
2068 // i.e. to check that the animation does not interfere with the position set.
2070 TestApplication application;
2072 Actor actor = Actor::New();
2073 Stage::GetCurrent().Add(actor);
2075 // Build the animation
2076 float durationSeconds(1.0f);
2077 Animation animation = Animation::New(durationSeconds);
2078 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2079 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2081 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2083 // Start the animation
2086 bool signalReceived(false);
2087 AnimationFinishCheck finishCheck(signalReceived);
2088 animation.FinishedSignal().Connect(&application, finishCheck);
2090 application.SendNotification();
2091 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2093 // We didn't expect the animation to finish yet
2094 application.SendNotification();
2095 finishCheck.CheckSignalNotReceived();
2096 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2098 // Stop the animation
2100 Vector3 positionSet(2.0f, 3.0f, 4.0f);
2101 actor.SetPosition(positionSet);
2102 application.SendNotification();
2105 for (int i=0; i<5; ++i)
2107 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2109 // We did expect the animation to finish
2110 application.SendNotification();
2111 finishCheck.CheckSignalReceived();
2112 DALI_TEST_EQUALS( actor.GetCurrentPosition(), positionSet/*Animation should not interfere with this*/, TEST_LOCATION );
2117 int UtcDaliAnimationClearP(void)
2119 TestApplication application;
2121 Actor actor = Actor::New();
2122 Stage::GetCurrent().Add(actor);
2124 // Build the animation
2125 float durationSeconds(1.0f);
2126 Animation animation = Animation::New(durationSeconds);
2127 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2128 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2130 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2132 // Start the animation
2135 bool signalReceived(false);
2136 AnimationFinishCheck finishCheck(signalReceived);
2137 animation.FinishedSignal().Connect(&application, finishCheck);
2139 application.SendNotification();
2140 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2142 // We didn't expect the animation to finish yet
2143 application.SendNotification();
2144 finishCheck.CheckSignalNotReceived();
2145 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2147 // Clear the animation
2149 application.SendNotification();
2151 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2153 // We don't expect the animation to finish now
2154 application.SendNotification();
2155 finishCheck.CheckSignalNotReceived();
2156 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress since the animator was destroyed */, TEST_LOCATION );
2158 // Restart as a scale animation; this should not move the actor's position
2159 finishCheck.Reset();
2160 actor.SetPosition(Vector3::ZERO);
2161 Vector3 targetScale(3.0f, 3.0f, 3.0f);
2162 animation.AnimateTo( Property( actor, Actor::Property::SCALE ), targetScale, AlphaFunction::LINEAR );
2165 application.SendNotification();
2166 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2168 // We didn't expect the animation to finish yet
2169 application.SendNotification();
2170 finishCheck.CheckSignalNotReceived();
2171 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
2172 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION );
2174 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2176 // We did expect the animation to finish
2177 application.SendNotification();
2178 finishCheck.CheckSignalReceived();
2179 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
2180 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
2184 int UtcDaliAnimationFinishedSignalP(void)
2186 TestApplication application;
2188 // Start the empty animation
2189 float durationSeconds(1.0f);
2190 Animation animation = Animation::New(durationSeconds);
2193 bool signalReceived(false);
2194 AnimationFinishCheck finishCheck(signalReceived);
2195 animation.FinishedSignal().Connect(&application, finishCheck);
2197 application.SendNotification();
2198 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*beyond the animation duration*/);
2200 // We did expect the animation to finish
2201 application.SendNotification();
2202 finishCheck.CheckSignalReceived();
2206 int UtcDaliAnimationAnimateByBooleanP(void)
2208 TestApplication application;
2210 Actor actor = Actor::New();
2212 // Register a boolean property
2213 bool startValue(false);
2214 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2215 Stage::GetCurrent().Add(actor);
2216 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2218 // Build the animation
2219 float durationSeconds(2.0f);
2220 Animation animation = Animation::New(durationSeconds);
2221 const bool relativeValue(true);
2222 const bool finalValue( false || relativeValue );
2223 animation.AnimateBy(Property(actor, index), relativeValue);
2225 // Start the animation
2228 bool signalReceived(false);
2229 AnimationFinishCheck finishCheck(signalReceived);
2230 animation.FinishedSignal().Connect(&application, finishCheck);
2232 application.SendNotification();
2233 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2235 // We didn't expect the animation to finish yet
2236 application.SendNotification();
2237 finishCheck.CheckSignalNotReceived();
2238 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2240 application.SendNotification();
2241 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2243 // We did expect the animation to finish
2244 application.SendNotification();
2245 finishCheck.CheckSignalReceived();
2246 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2248 // Check that nothing has changed after a couple of buffer swaps
2249 application.Render(0);
2250 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2251 application.Render(0);
2252 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2254 // Repeat with relative value "false" - this should be an NOOP
2255 animation = Animation::New(durationSeconds);
2256 bool noOpValue(false);
2257 animation.AnimateBy(Property(actor, index), noOpValue);
2259 // Start the animation
2262 finishCheck.Reset();
2263 animation.FinishedSignal().Connect(&application, finishCheck);
2265 application.SendNotification();
2266 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2268 // We didn't expect the animation to finish yet
2269 application.SendNotification();
2270 finishCheck.CheckSignalNotReceived();
2271 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2273 application.SendNotification();
2274 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2276 // We did expect the animation to finish
2277 application.SendNotification();
2278 finishCheck.CheckSignalReceived();
2279 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2281 // Check that nothing has changed after a couple of buffer swaps
2282 application.Render(0);
2283 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2284 application.Render(0);
2285 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2289 int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void)
2291 TestApplication application;
2293 Actor actor = Actor::New();
2295 // Register a boolean property
2296 bool startValue(false);
2297 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2298 Stage::GetCurrent().Add(actor);
2299 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2301 // Build the animation
2302 float durationSeconds(2.0f);
2303 Animation animation = Animation::New(durationSeconds);
2304 bool relativeValue(true);
2305 bool finalValue( false || relativeValue );
2306 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN);
2308 // Start the animation
2311 bool signalReceived(false);
2312 AnimationFinishCheck finishCheck(signalReceived);
2313 animation.FinishedSignal().Connect(&application, finishCheck);
2315 application.SendNotification();
2316 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2318 // We didn't expect the animation to finish yet
2319 application.SendNotification();
2320 finishCheck.CheckSignalNotReceived();
2321 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2323 application.SendNotification();
2324 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2326 // We did expect the animation to finish
2327 application.SendNotification();
2328 finishCheck.CheckSignalReceived();
2329 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2331 // Check that nothing has changed after a couple of buffer swaps
2332 application.Render(0);
2333 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2334 application.Render(0);
2335 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2337 // Repeat with relative value "false" - this should be an NOOP
2338 animation = Animation::New(durationSeconds);
2339 bool noOpValue(false);
2340 animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunction::EASE_IN);
2342 // Start the animation
2345 finishCheck.Reset();
2346 animation.FinishedSignal().Connect(&application, finishCheck);
2348 application.SendNotification();
2349 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2351 // We didn't expect the animation to finish yet
2352 application.SendNotification();
2353 finishCheck.CheckSignalNotReceived();
2354 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2356 application.SendNotification();
2357 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2359 // We did expect the animation to finish
2360 application.SendNotification();
2361 finishCheck.CheckSignalReceived();
2362 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2366 int UtcDaliAnimationAnimateByBooleanTimePeriodP(void)
2368 TestApplication application;
2370 Actor actor = Actor::New();
2372 // Register a boolean property
2373 bool startValue(false);
2374 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2375 Stage::GetCurrent().Add(actor);
2376 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2378 // Build the animation
2379 float durationSeconds(2.0f);
2380 Animation animation = Animation::New(durationSeconds);
2381 bool relativeValue(true);
2382 bool finalValue( false || relativeValue );
2383 float animatorDurationSeconds(durationSeconds * 0.5f);
2384 animation.AnimateBy( Property(actor, index),
2386 TimePeriod( animatorDurationSeconds ) );
2388 // Start the animation
2391 bool signalReceived(false);
2392 AnimationFinishCheck finishCheck(signalReceived);
2393 animation.FinishedSignal().Connect(&application, finishCheck);
2395 application.SendNotification();
2396 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
2398 // We didn't expect the animation to finish yet
2399 application.SendNotification();
2400 finishCheck.CheckSignalNotReceived();
2401 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2403 application.SendNotification();
2404 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
2406 // We didn't expect the animation to finish yet...
2407 application.SendNotification();
2408 finishCheck.CheckSignalNotReceived();
2410 // ...however we should have reached the final value
2411 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2413 application.SendNotification();
2414 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
2416 // We did expect the animation to finish
2417 application.SendNotification();
2418 finishCheck.CheckSignalReceived();
2419 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2421 // Check that nothing has changed after a couple of buffer swaps
2422 application.Render(0);
2423 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2424 application.Render(0);
2425 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2429 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void)
2431 TestApplication application;
2433 Actor actor = Actor::New();
2435 // Register a boolean property
2436 bool startValue(false);
2437 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2438 Stage::GetCurrent().Add(actor);
2439 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2441 // Build the animation
2442 float durationSeconds(2.0f);
2443 Animation animation = Animation::New(durationSeconds);
2444 bool relativeValue(true);
2445 bool finalValue( false || relativeValue );
2446 float animatorDurationSeconds(durationSeconds * 0.5f);
2447 animation.AnimateBy( Property(actor, index),
2449 AlphaFunction::EASE_IN_OUT,
2450 TimePeriod( animatorDurationSeconds ) );
2452 // Start the animation
2455 bool signalReceived(false);
2456 AnimationFinishCheck finishCheck(signalReceived);
2457 animation.FinishedSignal().Connect(&application, finishCheck);
2459 application.SendNotification();
2460 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
2462 // We didn't expect the animation to finish yet
2463 application.SendNotification();
2464 finishCheck.CheckSignalNotReceived();
2465 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2467 application.SendNotification();
2468 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
2470 // We didn't expect the animation to finish yet...
2471 application.SendNotification();
2472 finishCheck.CheckSignalNotReceived();
2474 // ...however we should have reached the final value
2475 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2477 application.SendNotification();
2478 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
2480 // We did expect the animation to finish
2481 application.SendNotification();
2482 finishCheck.CheckSignalReceived();
2483 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2485 // Check that nothing has changed after a couple of buffer swaps
2486 application.Render(0);
2487 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2488 application.Render(0);
2489 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2493 int UtcDaliAnimationAnimateByFloatP(void)
2495 TestApplication application;
2497 Actor actor = Actor::New();
2499 // Register a float property
2500 float startValue(10.0f);
2501 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2502 Stage::GetCurrent().Add(actor);
2503 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2505 // Build the animation
2506 float durationSeconds(2.0f);
2507 Animation animation = Animation::New(durationSeconds);
2508 float targetValue(50.0f);
2509 float relativeValue(targetValue - startValue);
2510 animation.AnimateBy(Property(actor, index), relativeValue);
2512 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2514 // Start the animation
2517 bool signalReceived(false);
2518 AnimationFinishCheck finishCheck(signalReceived);
2519 animation.FinishedSignal().Connect(&application, finishCheck);
2521 application.SendNotification();
2522 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2524 // We didn't expect the animation to finish yet
2525 application.SendNotification();
2526 finishCheck.CheckSignalNotReceived();
2527 DALI_TEST_EQUALS( actor.GetProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION );
2529 application.SendNotification();
2530 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2532 // We did expect the animation to finish
2533 application.SendNotification();
2534 finishCheck.CheckSignalReceived();
2535 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2537 // Check that nothing has changed after a couple of buffer swaps
2538 application.Render(0);
2539 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2540 application.Render(0);
2541 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2545 int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void)
2547 TestApplication application;
2549 Actor actor = Actor::New();
2551 // Register a float property
2552 float startValue(10.0f);
2553 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2554 Stage::GetCurrent().Add(actor);
2555 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2557 // Build the animation
2558 float durationSeconds(1.0f);
2559 Animation animation = Animation::New(durationSeconds);
2560 float targetValue(90.0f);
2561 float relativeValue(targetValue - startValue);
2562 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
2564 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2566 // Start the animation
2569 bool signalReceived(false);
2570 AnimationFinishCheck finishCheck(signalReceived);
2571 animation.FinishedSignal().Connect(&application, finishCheck);
2573 application.SendNotification();
2574 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2576 // We didn't expect the animation to finish yet
2577 application.SendNotification();
2578 finishCheck.CheckSignalNotReceived();
2580 // The position should have moved more, than with a linear alpha function
2581 float current(actor.GetProperty<float>(index));
2582 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
2584 application.SendNotification();
2585 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2587 // We did expect the animation to finish
2588 application.SendNotification();
2589 finishCheck.CheckSignalReceived();
2590 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2592 // Check that nothing has changed after a couple of buffer swaps
2593 application.Render(0);
2594 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2595 application.Render(0);
2596 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2600 int UtcDaliAnimationAnimateByFloatTimePeriodP(void)
2602 TestApplication application;
2604 Actor actor = Actor::New();
2606 // Register a float property
2607 float startValue(10.0f);
2608 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2609 Stage::GetCurrent().Add(actor);
2610 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2612 // Build the animation
2613 float durationSeconds(1.0f);
2614 Animation animation = Animation::New(durationSeconds);
2615 float targetValue(30.0f);
2616 float relativeValue(targetValue - startValue);
2618 animation.AnimateBy(Property(actor, index),
2620 TimePeriod(delay, durationSeconds - delay));
2622 // Start the animation
2625 bool signalReceived(false);
2626 AnimationFinishCheck finishCheck(signalReceived);
2627 animation.FinishedSignal().Connect(&application, finishCheck);
2629 application.SendNotification();
2630 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2632 // We didn't expect the animation to finish yet
2633 application.SendNotification();
2634 finishCheck.CheckSignalNotReceived();
2635 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2637 application.SendNotification();
2638 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2640 // We didn't expect the animation to finish yet
2641 application.SendNotification();
2642 finishCheck.CheckSignalNotReceived();
2643 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2645 application.SendNotification();
2646 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2648 // We did expect the animation to finish
2649 application.SendNotification();
2650 finishCheck.CheckSignalReceived();
2651 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2653 // Check that nothing has changed after a couple of buffer swaps
2654 application.Render(0);
2655 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2656 application.Render(0);
2657 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2661 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void)
2663 TestApplication application;
2665 Actor actor = Actor::New();
2667 // Register a float property
2668 float startValue(10.0f);
2669 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2670 Stage::GetCurrent().Add(actor);
2671 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2673 // Build the animation
2674 float durationSeconds(1.0f);
2675 Animation animation = Animation::New(durationSeconds);
2676 float targetValue(30.0f);
2677 float relativeValue(targetValue - startValue);
2679 animation.AnimateBy(Property(actor, index),
2681 AlphaFunction::LINEAR,
2682 TimePeriod(delay, durationSeconds - delay));
2684 // Start the animation
2687 bool signalReceived(false);
2688 AnimationFinishCheck finishCheck(signalReceived);
2689 animation.FinishedSignal().Connect(&application, finishCheck);
2691 application.SendNotification();
2692 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2694 // We didn't expect the animation to finish yet
2695 application.SendNotification();
2696 finishCheck.CheckSignalNotReceived();
2697 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2699 application.SendNotification();
2700 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2702 // We didn't expect the animation to finish yet
2703 application.SendNotification();
2704 finishCheck.CheckSignalNotReceived();
2705 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2707 application.SendNotification();
2708 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2710 // We did expect the animation to finish
2711 application.SendNotification();
2712 finishCheck.CheckSignalReceived();
2713 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2715 // Check that nothing has changed after a couple of buffer swaps
2716 application.Render(0);
2717 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2718 application.Render(0);
2719 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2723 int UtcDaliAnimationAnimateByIntegerP(void)
2725 TestApplication application;
2727 Actor actor = Actor::New();
2729 // Register an integer property
2731 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2732 Stage::GetCurrent().Add(actor);
2733 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
2735 // Build the animation
2736 float durationSeconds(2.0f);
2737 Animation animation = Animation::New(durationSeconds);
2738 int targetValue(50);
2739 int relativeValue(targetValue - startValue);
2740 animation.AnimateBy(Property(actor, index), relativeValue);
2742 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
2744 // Start the animation
2747 bool signalReceived(false);
2748 AnimationFinishCheck finishCheck(signalReceived);
2749 animation.FinishedSignal().Connect(&application, finishCheck);
2751 application.SendNotification();
2752 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2754 // We didn't expect the animation to finish yet
2755 application.SendNotification();
2756 finishCheck.CheckSignalNotReceived();
2757 DALI_TEST_EQUALS( actor.GetProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION );
2759 application.SendNotification();
2760 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2762 // We did expect the animation to finish
2763 application.SendNotification();
2764 finishCheck.CheckSignalReceived();
2765 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2767 // Check that nothing has changed after a couple of buffer swaps
2768 application.Render(0);
2769 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2770 application.Render(0);
2771 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2775 int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void)
2777 TestApplication application;
2779 Actor actor = Actor::New();
2781 // Register an integer property
2783 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2784 Stage::GetCurrent().Add(actor);
2785 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
2787 // Build the animation
2788 float durationSeconds(1.0f);
2789 Animation animation = Animation::New(durationSeconds);
2790 int targetValue(90);
2791 int relativeValue(targetValue - startValue);
2792 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
2794 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
2796 // Start the animation
2799 bool signalReceived(false);
2800 AnimationFinishCheck finishCheck(signalReceived);
2801 animation.FinishedSignal().Connect(&application, finishCheck);
2803 application.SendNotification();
2804 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2806 // We didn't expect the animation to finish yet
2807 application.SendNotification();
2808 finishCheck.CheckSignalNotReceived();
2810 // The position should have moved more, than with a linear alpha function
2811 int current(actor.GetProperty<int>(index));
2812 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
2814 application.SendNotification();
2815 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2817 // We did expect the animation to finish
2818 application.SendNotification();
2819 finishCheck.CheckSignalReceived();
2820 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2822 // Check that nothing has changed after a couple of buffer swaps
2823 application.Render(0);
2824 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2825 application.Render(0);
2826 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2830 int UtcDaliAnimationAnimateByIntegerTimePeriodP(void)
2832 TestApplication application;
2834 Actor actor = Actor::New();
2836 // Register an integer property
2838 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2839 Stage::GetCurrent().Add(actor);
2840 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
2842 // Build the animation
2843 float durationSeconds(1.0f);
2844 Animation animation = Animation::New(durationSeconds);
2845 int targetValue(30);
2846 int relativeValue(targetValue - startValue);
2848 animation.AnimateBy(Property(actor, index),
2850 TimePeriod(delay, durationSeconds - delay));
2852 // Start the animation
2855 bool signalReceived(false);
2856 AnimationFinishCheck finishCheck(signalReceived);
2857 animation.FinishedSignal().Connect(&application, finishCheck);
2859 application.SendNotification();
2860 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2862 // We didn't expect the animation to finish yet
2863 application.SendNotification();
2864 finishCheck.CheckSignalNotReceived();
2865 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
2867 application.SendNotification();
2868 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2870 // We didn't expect the animation to finish yet
2871 application.SendNotification();
2872 finishCheck.CheckSignalNotReceived();
2873 DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
2875 application.SendNotification();
2876 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2878 // We did expect the animation to finish
2879 application.SendNotification();
2880 finishCheck.CheckSignalReceived();
2881 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2883 // Check that nothing has changed after a couple of buffer swaps
2884 application.Render(0);
2885 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2886 application.Render(0);
2887 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2891 int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void)
2893 TestApplication application;
2895 Actor actor = Actor::New();
2897 // Register an integer property
2899 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2900 Stage::GetCurrent().Add(actor);
2901 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
2903 // Build the animation
2904 float durationSeconds(1.0f);
2905 Animation animation = Animation::New(durationSeconds);
2906 int targetValue(30);
2907 int relativeValue(targetValue - startValue);
2909 animation.AnimateBy(Property(actor, index),
2911 AlphaFunction::LINEAR,
2912 TimePeriod(delay, durationSeconds - delay));
2914 // Start the animation
2917 bool signalReceived(false);
2918 AnimationFinishCheck finishCheck(signalReceived);
2919 animation.FinishedSignal().Connect(&application, finishCheck);
2921 application.SendNotification();
2922 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2924 // We didn't expect the animation to finish yet
2925 application.SendNotification();
2926 finishCheck.CheckSignalNotReceived();
2927 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
2929 application.SendNotification();
2930 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2932 // We didn't expect the animation to finish yet
2933 application.SendNotification();
2934 finishCheck.CheckSignalNotReceived();
2935 DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
2937 application.SendNotification();
2938 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2940 // We did expect the animation to finish
2941 application.SendNotification();
2942 finishCheck.CheckSignalReceived();
2943 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2945 // Check that nothing has changed after a couple of buffer swaps
2946 application.Render(0);
2947 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2948 application.Render(0);
2949 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2953 int UtcDaliAnimationAnimateByVector2P(void)
2955 TestApplication application;
2957 Actor actor = Actor::New();
2959 // Register a Vector2 property
2960 Vector2 startValue(10.0f, 10.0f);
2961 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2962 Stage::GetCurrent().Add(actor);
2963 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
2965 // Build the animation
2966 float durationSeconds(2.0f);
2967 Animation animation = Animation::New(durationSeconds);
2968 Vector2 targetValue(60.0f, 60.0f);
2969 Vector2 relativeValue(targetValue - startValue);
2970 animation.AnimateBy(Property(actor, index), relativeValue);
2972 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2974 // Start the animation
2977 bool signalReceived(false);
2978 AnimationFinishCheck finishCheck(signalReceived);
2979 animation.FinishedSignal().Connect(&application, finishCheck);
2981 application.SendNotification();
2982 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2984 // We didn't expect the animation to finish yet
2985 application.SendNotification();
2986 finishCheck.CheckSignalNotReceived();
2987 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION );
2989 application.SendNotification();
2990 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2992 // We did expect the animation to finish
2993 application.SendNotification();
2994 finishCheck.CheckSignalReceived();
2995 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
2997 // Check that nothing has changed after a couple of buffer swaps
2998 application.Render(0);
2999 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3000 application.Render(0);
3001 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3005 int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void)
3007 TestApplication application;
3009 Actor actor = Actor::New();
3011 // Register a Vector2 property
3012 Vector2 startValue(100.0f, 100.0f);
3013 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3014 Stage::GetCurrent().Add(actor);
3015 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3017 // Build the animation
3018 float durationSeconds(1.0f);
3019 Animation animation = Animation::New(durationSeconds);
3020 Vector2 targetValue(20.0f, 20.0f);
3021 Vector2 relativeValue(targetValue - startValue);
3022 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3024 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3026 // Start the animation
3029 bool signalReceived(false);
3030 AnimationFinishCheck finishCheck(signalReceived);
3031 animation.FinishedSignal().Connect(&application, finishCheck);
3033 application.SendNotification();
3034 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3036 // We didn't expect the animation to finish yet
3037 application.SendNotification();
3038 finishCheck.CheckSignalNotReceived();
3040 // The position should have moved more, than with a linear alpha function
3041 Vector2 current(actor.GetProperty<Vector2>(index));
3042 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3043 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3045 application.SendNotification();
3046 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3048 // We did expect the animation to finish
3049 application.SendNotification();
3050 finishCheck.CheckSignalReceived();
3051 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3053 // Check that nothing has changed after a couple of buffer swaps
3054 application.Render(0);
3055 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3056 application.Render(0);
3057 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3061 int UtcDaliAnimationAnimateByVector2TimePeriodP(void)
3063 TestApplication application;
3065 Actor actor = Actor::New();
3067 // Register a Vector2 property
3068 Vector2 startValue(10.0f, 10.0f);
3069 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3070 Stage::GetCurrent().Add(actor);
3071 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3073 // Build the animation
3074 float durationSeconds(1.0f);
3075 Animation animation = Animation::New(durationSeconds);
3076 Vector2 targetValue(30.0f, 30.0f);
3077 Vector2 relativeValue(targetValue - startValue);
3079 animation.AnimateBy(Property(actor, index),
3081 TimePeriod(delay, durationSeconds - delay));
3083 // Start the animation
3086 bool signalReceived(false);
3087 AnimationFinishCheck finishCheck(signalReceived);
3088 animation.FinishedSignal().Connect(&application, finishCheck);
3090 application.SendNotification();
3091 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3093 // We didn't expect the animation to finish yet
3094 application.SendNotification();
3095 finishCheck.CheckSignalNotReceived();
3096 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3098 application.SendNotification();
3099 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3101 // We didn't expect the animation to finish yet
3102 application.SendNotification();
3103 finishCheck.CheckSignalNotReceived();
3104 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3106 application.SendNotification();
3107 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3109 // We did expect the animation to finish
3110 application.SendNotification();
3111 finishCheck.CheckSignalReceived();
3112 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3114 // Check that nothing has changed after a couple of buffer swaps
3115 application.Render(0);
3116 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3117 application.Render(0);
3118 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3122 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void)
3124 TestApplication application;
3126 Actor actor = Actor::New();
3128 // Register a Vector2 property
3129 Vector2 startValue(5.0f, 5.0f);
3130 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3131 Stage::GetCurrent().Add(actor);
3132 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3134 // Build the animation
3135 float durationSeconds(1.0f);
3136 Animation animation = Animation::New(durationSeconds);
3137 Vector2 targetValue(10.0f, 10.0f);
3138 Vector2 relativeValue(targetValue - startValue);
3140 animation.AnimateBy(Property(actor, index),
3142 AlphaFunction::LINEAR,
3143 TimePeriod(delay, durationSeconds - delay));
3145 // Start the animation
3148 bool signalReceived(false);
3149 AnimationFinishCheck finishCheck(signalReceived);
3150 animation.FinishedSignal().Connect(&application, finishCheck);
3152 application.SendNotification();
3153 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3155 // We didn't expect the animation to finish yet
3156 application.SendNotification();
3157 finishCheck.CheckSignalNotReceived();
3158 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3160 application.SendNotification();
3161 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3163 // We didn't expect the animation to finish yet
3164 application.SendNotification();
3165 finishCheck.CheckSignalNotReceived();
3166 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3168 application.SendNotification();
3169 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3171 // We did expect the animation to finish
3172 application.SendNotification();
3173 finishCheck.CheckSignalReceived();
3174 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3176 // Check that nothing has changed after a couple of buffer swaps
3177 application.Render(0);
3178 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3179 application.Render(0);
3180 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3184 int UtcDaliAnimationAnimateByVector3P(void)
3186 TestApplication application;
3188 Actor actor = Actor::New();
3190 // Register a Vector3 property
3191 Vector3 startValue(10.0f, 10.0f, 10.0f);
3192 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3193 Stage::GetCurrent().Add(actor);
3194 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3196 // Build the animation
3197 float durationSeconds(2.0f);
3198 Animation animation = Animation::New(durationSeconds);
3199 Vector3 targetValue(60.0f, 60.0f, 60.0f);
3200 Vector3 relativeValue(targetValue - startValue);
3201 animation.AnimateBy(Property(actor, index), relativeValue);
3203 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3205 // Start the animation
3208 bool signalReceived(false);
3209 AnimationFinishCheck finishCheck(signalReceived);
3210 animation.FinishedSignal().Connect(&application, finishCheck);
3212 application.SendNotification();
3213 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3215 // We didn't expect the animation to finish yet
3216 application.SendNotification();
3217 finishCheck.CheckSignalNotReceived();
3218 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION );
3220 application.SendNotification();
3221 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3223 // We did expect the animation to finish
3224 application.SendNotification();
3225 finishCheck.CheckSignalReceived();
3226 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3228 // Check that nothing has changed after a couple of buffer swaps
3229 application.Render(0);
3230 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3231 application.Render(0);
3232 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3236 int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void)
3238 TestApplication application;
3240 Actor actor = Actor::New();
3242 // Register a Vector3 property
3243 Vector3 startValue(100.0f, 100.0f, 100.0f);
3244 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3245 Stage::GetCurrent().Add(actor);
3246 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3248 // Build the animation
3249 float durationSeconds(1.0f);
3250 Animation animation = Animation::New(durationSeconds);
3251 Vector3 targetValue(20.0f, 20.0f, 20.0f);
3252 Vector3 relativeValue(targetValue - startValue);
3253 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3255 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3257 // Start the animation
3260 bool signalReceived(false);
3261 AnimationFinishCheck finishCheck(signalReceived);
3262 animation.FinishedSignal().Connect(&application, finishCheck);
3264 application.SendNotification();
3265 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3267 // We didn't expect the animation to finish yet
3268 application.SendNotification();
3269 finishCheck.CheckSignalNotReceived();
3271 // The position should have moved more, than with a linear alpha function
3272 Vector3 current(actor.GetProperty<Vector3>(index));
3273 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3274 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3275 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
3277 application.SendNotification();
3278 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3280 // We did expect the animation to finish
3281 application.SendNotification();
3282 finishCheck.CheckSignalReceived();
3283 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3285 // Check that nothing has changed after a couple of buffer swaps
3286 application.Render(0);
3287 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3288 application.Render(0);
3289 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3293 int UtcDaliAnimationAnimateByVector3TimePeriodP(void)
3295 TestApplication application;
3297 Actor actor = Actor::New();
3299 // Register a Vector3 property
3300 Vector3 startValue(10.0f, 10.0f, 10.0f);
3301 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3302 Stage::GetCurrent().Add(actor);
3303 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3305 // Build the animation
3306 float durationSeconds(1.0f);
3307 Animation animation = Animation::New(durationSeconds);
3308 Vector3 targetValue(30.0f, 30.0f, 30.0f);
3309 Vector3 relativeValue(targetValue - startValue);
3311 animation.AnimateBy(Property(actor, index),
3313 TimePeriod(delay, durationSeconds - delay));
3315 // Start the animation
3318 bool signalReceived(false);
3319 AnimationFinishCheck finishCheck(signalReceived);
3320 animation.FinishedSignal().Connect(&application, finishCheck);
3322 application.SendNotification();
3323 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3325 // We didn't expect the animation to finish yet
3326 application.SendNotification();
3327 finishCheck.CheckSignalNotReceived();
3328 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3330 application.SendNotification();
3331 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3333 // We didn't expect the animation to finish yet
3334 application.SendNotification();
3335 finishCheck.CheckSignalNotReceived();
3336 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3338 application.SendNotification();
3339 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3341 // We did expect the animation to finish
3342 application.SendNotification();
3343 finishCheck.CheckSignalReceived();
3344 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3346 // Check that nothing has changed after a couple of buffer swaps
3347 application.Render(0);
3348 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3349 application.Render(0);
3350 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3354 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void)
3356 TestApplication application;
3358 Actor actor = Actor::New();
3360 // Register a Vector3 property
3361 Vector3 startValue(5.0f, 5.0f, 5.0f);
3362 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3363 Stage::GetCurrent().Add(actor);
3364 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3366 // Build the animation
3367 float durationSeconds(1.0f);
3368 Animation animation = Animation::New(durationSeconds);
3369 Vector3 targetValue(10.0f, 10.0f, 10.0f);
3370 Vector3 relativeValue(targetValue - startValue);
3372 animation.AnimateBy(Property(actor, index),
3374 AlphaFunction::LINEAR,
3375 TimePeriod(delay, durationSeconds - delay));
3377 // Start the animation
3380 bool signalReceived(false);
3381 AnimationFinishCheck finishCheck(signalReceived);
3382 animation.FinishedSignal().Connect(&application, finishCheck);
3384 application.SendNotification();
3385 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3387 // We didn't expect the animation to finish yet
3388 application.SendNotification();
3389 finishCheck.CheckSignalNotReceived();
3390 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3392 application.SendNotification();
3393 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3395 // We didn't expect the animation to finish yet
3396 application.SendNotification();
3397 finishCheck.CheckSignalNotReceived();
3398 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3400 application.SendNotification();
3401 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3403 // We did expect the animation to finish
3404 application.SendNotification();
3405 finishCheck.CheckSignalReceived();
3406 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3408 // Check that nothing has changed after a couple of buffer swaps
3409 application.Render(0);
3410 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3411 application.Render(0);
3412 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3416 int UtcDaliAnimationAnimateByVector4P(void)
3418 TestApplication application;
3420 Actor actor = Actor::New();
3422 // Register a Vector4 property
3423 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
3424 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3425 Stage::GetCurrent().Add(actor);
3426 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3428 // Build the animation
3429 float durationSeconds(2.0f);
3430 Animation animation = Animation::New(durationSeconds);
3431 Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f);
3432 Vector4 relativeValue(targetValue - startValue);
3433 animation.AnimateBy(Property(actor, index), relativeValue);
3435 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3437 // Start the animation
3440 bool signalReceived(false);
3441 AnimationFinishCheck finishCheck(signalReceived);
3442 animation.FinishedSignal().Connect(&application, finishCheck);
3444 application.SendNotification();
3445 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3447 // We didn't expect the animation to finish yet
3448 application.SendNotification();
3449 finishCheck.CheckSignalNotReceived();
3450 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION );
3452 application.SendNotification();
3453 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3455 // We did expect the animation to finish
3456 application.SendNotification();
3457 finishCheck.CheckSignalReceived();
3458 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3460 // Check that nothing has changed after a couple of buffer swaps
3461 application.Render(0);
3462 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3463 application.Render(0);
3464 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3468 int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void)
3470 TestApplication application;
3472 Actor actor = Actor::New();
3474 // Register a Vector4 property
3475 Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f);
3476 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3477 Stage::GetCurrent().Add(actor);
3478 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3480 // Build the animation
3481 float durationSeconds(1.0f);
3482 Animation animation = Animation::New(durationSeconds);
3483 Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
3484 Vector4 relativeValue(targetValue - startValue);
3485 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3487 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3489 // Start the animation
3492 bool signalReceived(false);
3493 AnimationFinishCheck finishCheck(signalReceived);
3494 animation.FinishedSignal().Connect(&application, finishCheck);
3496 application.SendNotification();
3497 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3499 // We didn't expect the animation to finish yet
3500 application.SendNotification();
3501 finishCheck.CheckSignalNotReceived();
3503 // The position should have moved more, than with a linear alpha function
3504 Vector4 current(actor.GetProperty<Vector4>(index));
3505 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3506 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3507 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
3508 DALI_TEST_CHECK( current.w < ninetyFivePercentProgress.w );
3510 application.SendNotification();
3511 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3513 // We did expect the animation to finish
3514 application.SendNotification();
3515 finishCheck.CheckSignalReceived();
3516 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3518 // Check that nothing has changed after a couple of buffer swaps
3519 application.Render(0);
3520 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3521 application.Render(0);
3522 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3526 int UtcDaliAnimationAnimateByVector4TimePeriodP(void)
3528 TestApplication application;
3530 Actor actor = Actor::New();
3532 // Register a Vector4 property
3533 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
3534 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3535 Stage::GetCurrent().Add(actor);
3536 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3538 // Build the animation
3539 float durationSeconds(1.0f);
3540 Animation animation = Animation::New(durationSeconds);
3541 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
3542 Vector4 relativeValue(targetValue - startValue);
3544 animation.AnimateBy(Property(actor, index),
3546 TimePeriod(delay, durationSeconds - delay));
3548 // Start the animation
3551 bool signalReceived(false);
3552 AnimationFinishCheck finishCheck(signalReceived);
3553 animation.FinishedSignal().Connect(&application, finishCheck);
3555 application.SendNotification();
3556 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3558 // We didn't expect the animation to finish yet
3559 application.SendNotification();
3560 finishCheck.CheckSignalNotReceived();
3561 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3563 application.SendNotification();
3564 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3566 // We didn't expect the animation to finish yet
3567 application.SendNotification();
3568 finishCheck.CheckSignalNotReceived();
3569 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3571 application.SendNotification();
3572 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3574 // We did expect the animation to finish
3575 application.SendNotification();
3576 finishCheck.CheckSignalReceived();
3577 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3579 // Check that nothing has changed after a couple of buffer swaps
3580 application.Render(0);
3581 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3582 application.Render(0);
3583 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3587 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void)
3589 TestApplication application;
3591 Actor actor = Actor::New();
3593 // Register a Vector4 property
3594 Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f);
3595 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3596 Stage::GetCurrent().Add(actor);
3597 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3599 // Build the animation
3600 float durationSeconds(1.0f);
3601 Animation animation = Animation::New(durationSeconds);
3602 Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f);
3603 Vector4 relativeValue(targetValue - startValue);
3605 animation.AnimateBy(Property(actor, index),
3607 AlphaFunction::LINEAR,
3608 TimePeriod(delay, durationSeconds - delay));
3610 // Start the animation
3613 bool signalReceived(false);
3614 AnimationFinishCheck finishCheck(signalReceived);
3615 animation.FinishedSignal().Connect(&application, finishCheck);
3617 application.SendNotification();
3618 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3620 // We didn't expect the animation to finish yet
3621 application.SendNotification();
3622 finishCheck.CheckSignalNotReceived();
3623 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3625 application.SendNotification();
3626 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3628 // We didn't expect the animation to finish yet
3629 application.SendNotification();
3630 finishCheck.CheckSignalNotReceived();
3631 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3633 application.SendNotification();
3634 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3636 // We did expect the animation to finish
3637 application.SendNotification();
3638 finishCheck.CheckSignalReceived();
3639 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3641 // Check that nothing has changed after a couple of buffer swaps
3642 application.Render(0);
3643 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3644 application.Render(0);
3645 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3649 int UtcDaliAnimationAnimateByActorPositionP(void)
3651 TestApplication application;
3653 Actor actor = Actor::New();
3654 Vector3 startPosition(10.0f, 10.0f, 10.0f);
3655 actor.SetPosition(startPosition);
3656 Stage::GetCurrent().Add(actor);
3657 application.SendNotification();
3658 application.Render(0);
3659 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
3661 // Build the animation
3662 float durationSeconds(1.0f);
3663 Animation animation = Animation::New(durationSeconds);
3664 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
3665 Vector3 relativePosition(targetPosition - startPosition);
3666 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition);
3668 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
3670 // Start the animation
3673 bool signalReceived(false);
3674 AnimationFinishCheck finishCheck(signalReceived);
3675 animation.FinishedSignal().Connect(&application, finishCheck);
3677 application.SendNotification();
3678 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3680 // We didn't expect the animation to finish yet
3681 application.SendNotification();
3682 finishCheck.CheckSignalNotReceived();
3683 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ninetyFivePercentProgress, TEST_LOCATION );
3685 application.SendNotification();
3686 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3688 // We did expect the animation to finish
3689 application.SendNotification();
3690 finishCheck.CheckSignalReceived();
3691 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3693 // Check that nothing has changed after a couple of buffer swaps
3694 application.Render(0);
3695 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3696 application.Render(0);
3697 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3701 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
3703 TestApplication application;
3705 Actor actor = Actor::New();
3706 Vector3 startPosition(10.0f, 10.0f, 10.0f);
3707 actor.SetPosition(startPosition);
3708 Stage::GetCurrent().Add(actor);
3709 application.SendNotification();
3710 application.Render(0);
3711 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
3713 // Build the animation
3714 float durationSeconds(1.0f);
3715 Animation animation = Animation::New(durationSeconds);
3716 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
3717 Vector3 relativePosition(targetPosition - startPosition);
3718 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
3720 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
3722 // Start the animation
3725 bool signalReceived(false);
3726 AnimationFinishCheck finishCheck(signalReceived);
3727 animation.FinishedSignal().Connect(&application, finishCheck);
3729 application.SendNotification();
3730 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3732 // We didn't expect the animation to finish yet
3733 application.SendNotification();
3734 finishCheck.CheckSignalNotReceived();
3736 // The position should have moved more, than with a linear alpha function
3737 Vector3 current(actor.GetCurrentPosition());
3738 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
3739 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
3740 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
3742 application.SendNotification();
3743 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3745 // We did expect the animation to finish
3746 application.SendNotification();
3747 finishCheck.CheckSignalReceived();
3748 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3750 // Check that nothing has changed after a couple of buffer swaps
3751 application.Render(0);
3752 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3753 application.Render(0);
3754 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3758 int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void)
3760 TestApplication application;
3762 Actor actor = Actor::New();
3763 Vector3 startPosition(10.0f, 10.0f, 10.0f);
3764 actor.SetPosition(startPosition);
3765 Stage::GetCurrent().Add(actor);
3766 application.SendNotification();
3767 application.Render(0);
3768 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
3770 // Build the animation
3771 float durationSeconds(1.0f);
3772 Animation animation = Animation::New(durationSeconds);
3773 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
3774 Vector3 relativePosition(targetPosition - startPosition);
3776 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
3778 TimePeriod(delay, durationSeconds - delay));
3780 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
3782 // Start the animation
3785 bool signalReceived(false);
3786 AnimationFinishCheck finishCheck(signalReceived);
3787 animation.FinishedSignal().Connect(&application, finishCheck);
3789 application.SendNotification();
3790 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3792 // We didn't expect the animation to finish yet
3793 application.SendNotification();
3794 finishCheck.CheckSignalNotReceived();
3795 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
3797 application.SendNotification();
3798 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
3800 // We did expect the animation to finish
3801 application.SendNotification();
3802 finishCheck.CheckSignalReceived();
3803 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3805 // Check that nothing has changed after a couple of buffer swaps
3806 application.Render(0);
3807 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3808 application.Render(0);
3809 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3813 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void)
3815 TestApplication application;
3817 Actor actor = Actor::New();
3818 Vector3 startPosition(10.0f, 10.0f, 10.0f);
3819 actor.SetPosition(startPosition);
3820 Stage::GetCurrent().Add(actor);
3821 application.SendNotification();
3822 application.Render(0);
3823 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
3825 // Build the animation
3826 float durationSeconds(1.0f);
3827 Animation animation = Animation::New(durationSeconds);
3828 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
3829 Vector3 relativePosition(targetPosition - startPosition);
3831 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
3833 AlphaFunction::LINEAR,
3834 TimePeriod(delay, durationSeconds - delay));
3836 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
3838 // Start the animation
3841 bool signalReceived(false);
3842 AnimationFinishCheck finishCheck(signalReceived);
3843 animation.FinishedSignal().Connect(&application, finishCheck);
3845 application.SendNotification();
3846 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3848 // We didn't expect the animation to finish yet
3849 application.SendNotification();
3850 finishCheck.CheckSignalNotReceived();
3851 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
3853 application.SendNotification();
3854 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
3856 // We did expect the animation to finish
3857 application.SendNotification();
3858 finishCheck.CheckSignalReceived();
3859 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3861 // Check that nothing has changed after a couple of buffer swaps
3862 application.Render(0);
3863 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3864 application.Render(0);
3865 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3869 int UtcDaliAnimationAnimateByActorOrientationP(void)
3871 TestApplication application;
3873 Actor actor = Actor::New();
3874 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
3875 Stage::GetCurrent().Add(actor);
3876 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
3878 // Build the animation
3879 float durationSeconds(1.0f);
3880 Animation animation = Animation::New(durationSeconds);
3881 Degree relativeRotationDegrees(360.0f);
3882 Radian relativeRotationRadians(relativeRotationDegrees);
3883 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ) );
3885 // Start the animation
3888 bool signalReceived(false);
3889 AnimationFinishCheck finishCheck(signalReceived);
3890 animation.FinishedSignal().Connect(&application, finishCheck);
3892 application.SendNotification();
3893 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
3895 // We didn't expect the animation to finish yet
3896 application.SendNotification();
3897 finishCheck.CheckSignalNotReceived();
3898 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
3900 application.SendNotification();
3901 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
3903 // We didn't expect the animation to finish yet
3904 application.SendNotification();
3905 finishCheck.CheckSignalNotReceived();
3906 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
3908 application.SendNotification();
3909 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
3911 // We didn't expect the animation to finish yet
3912 application.SendNotification();
3913 finishCheck.CheckSignalNotReceived();
3914 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, 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.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
3926 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
3928 TestApplication application;
3930 Actor actor = Actor::New();
3931 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
3932 Stage::GetCurrent().Add(actor);
3933 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
3935 // Build the animation
3936 float durationSeconds(1.0f);
3937 Animation animation = Animation::New(durationSeconds);
3938 Degree relativeRotationDegrees(360.0f);
3939 Radian relativeRotationRadians(relativeRotationDegrees);
3940 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ), AlphaFunction::EASE_IN );
3942 // Start the animation
3945 bool signalReceived(false);
3946 AnimationFinishCheck finishCheck(signalReceived);
3947 animation.FinishedSignal().Connect(&application, finishCheck);
3949 application.SendNotification();
3950 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
3952 // We didn't expect the animation to finish yet
3953 application.SendNotification();
3954 finishCheck.CheckSignalNotReceived();
3955 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
3957 application.SendNotification();
3958 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
3960 // We didn't expect the animation to finish yet
3961 application.SendNotification();
3962 finishCheck.CheckSignalNotReceived();
3963 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
3965 application.SendNotification();
3966 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
3968 // We didn't expect the animation to finish yet
3969 application.SendNotification();
3970 finishCheck.CheckSignalNotReceived();
3971 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
3973 application.SendNotification();
3974 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3976 // We did expect the animation to finish
3977 application.SendNotification();
3978 finishCheck.CheckSignalReceived();
3979 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
3983 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void)
3985 TestApplication application;
3987 Actor actor = Actor::New();
3988 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
3989 Stage::GetCurrent().Add(actor);
3990 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
3992 // Build the animation
3993 float durationSeconds(1.0f);
3994 Animation animation = Animation::New(durationSeconds);
3995 Degree relativeRotationDegrees(360.0f);
3996 Radian relativeRotationRadians(relativeRotationDegrees);
3998 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ),
3999 AlphaFunction::EASE_IN, TimePeriod( delay, durationSeconds - delay ) );
4001 // Start the animation
4004 bool signalReceived(false);
4005 AnimationFinishCheck finishCheck(signalReceived);
4006 animation.FinishedSignal().Connect(&application, finishCheck);
4008 application.SendNotification();
4009 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4011 // We didn't expect the animation to finish yet
4012 application.SendNotification();
4013 finishCheck.CheckSignalNotReceived();
4014 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
4015 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4017 application.SendNotification();
4018 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4020 // We didn't expect the animation to finish yet
4021 application.SendNotification();
4022 finishCheck.CheckSignalNotReceived();
4023 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
4024 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4026 application.SendNotification();
4027 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4029 // We didn't expect the animation to finish yet
4030 application.SendNotification();
4031 finishCheck.CheckSignalNotReceived();
4032 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
4033 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4035 application.SendNotification();
4036 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4038 // We did expect the animation to finish
4039 application.SendNotification();
4040 finishCheck.CheckSignalReceived();
4041 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4045 int UtcDaliAnimationAnimateByActorScaleP(void)
4047 TestApplication application;
4049 Actor actor = Actor::New();
4050 Stage::GetCurrent().Add(actor);
4051 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4053 // Build the animation
4054 float durationSeconds(1.0f);
4055 Animation animation = Animation::New(durationSeconds);
4056 Vector3 targetScale(2.0f, 2.0f, 2.0f);
4057 Vector3 relativeScale(targetScale - Vector3::ONE);
4058 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), Vector3( relativeScale.x, relativeScale.y, relativeScale.z ) );
4060 Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale*0.99f);
4062 // Start the animation
4065 bool signalReceived(false);
4066 AnimationFinishCheck finishCheck(signalReceived);
4067 animation.FinishedSignal().Connect(&application, finishCheck);
4069 application.SendNotification();
4070 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4072 // We didn't expect the animation to finish yet
4073 application.SendNotification();
4074 finishCheck.CheckSignalNotReceived();
4075 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
4077 application.SendNotification();
4078 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4080 // We did expect the animation to finish
4081 application.SendNotification();
4082 finishCheck.CheckSignalReceived();
4083 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4086 finishCheck.Reset();
4087 actor.SetScale(Vector3::ONE);
4088 application.SendNotification();
4089 application.Render(0);
4090 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4092 // Repeat with a different (ease-in) alpha function
4093 animation = Animation::New(durationSeconds);
4094 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::EASE_IN );
4095 animation.FinishedSignal().Connect(&application, finishCheck);
4098 application.SendNotification();
4099 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4101 // We didn't expect the animation to finish yet
4102 application.SendNotification();
4103 finishCheck.CheckSignalNotReceived();
4105 // The scale should have grown less, than with a linear alpha function
4106 Vector3 current(actor.GetCurrentScale());
4107 DALI_TEST_CHECK( current.x > 1.0f );
4108 DALI_TEST_CHECK( current.y > 1.0f );
4109 DALI_TEST_CHECK( current.z > 1.0f );
4110 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
4111 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
4112 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
4114 application.SendNotification();
4115 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4117 // We did expect the animation to finish
4118 application.SendNotification();
4119 finishCheck.CheckSignalReceived();
4120 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4123 finishCheck.Reset();
4124 actor.SetScale(Vector3::ONE);
4125 application.SendNotification();
4126 application.Render(0);
4127 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4129 // Repeat with a delay
4131 animation = Animation::New(durationSeconds);
4132 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
4133 animation.FinishedSignal().Connect(&application, finishCheck);
4136 application.SendNotification();
4137 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4139 // We didn't expect the animation to finish yet
4140 application.SendNotification();
4141 finishCheck.CheckSignalNotReceived();
4142 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4144 application.SendNotification();
4145 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4147 // We did expect the animation to finish
4148 application.SendNotification();
4149 finishCheck.CheckSignalReceived();
4150 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4154 int UtcDaliAnimationAnimateToBooleanP(void)
4156 TestApplication application;
4158 Actor actor = Actor::New();
4160 // Register a boolean property
4161 const bool startValue(false);
4162 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4163 Stage::GetCurrent().Add(actor);
4164 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4166 // Build the animation
4167 float durationSeconds(2.0f);
4168 Animation animation = Animation::New(durationSeconds);
4169 const bool targetValue( !startValue );
4170 animation.AnimateTo(Property(actor, index), targetValue);
4172 // Start the animation
4175 bool signalReceived(false);
4176 AnimationFinishCheck finishCheck(signalReceived);
4177 animation.FinishedSignal().Connect(&application, finishCheck);
4179 application.SendNotification();
4180 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4182 // We didn't expect the animation to finish yet
4183 application.SendNotification();
4184 finishCheck.CheckSignalNotReceived();
4185 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4187 application.SendNotification();
4188 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4190 // We did expect the animation to finish
4191 application.SendNotification();
4192 finishCheck.CheckSignalReceived();
4193 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4195 // Check that nothing has changed after a couple of buffer swaps
4196 application.Render(0);
4197 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4198 application.Render(0);
4199 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4201 // Repeat with target value "false"
4202 animation = Animation::New(durationSeconds);
4203 const bool finalValue( !targetValue );
4204 animation.AnimateTo(Property(actor, index), finalValue);
4206 // Start the animation
4209 finishCheck.Reset();
4210 animation.FinishedSignal().Connect(&application, finishCheck);
4212 application.SendNotification();
4213 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4215 // We didn't expect the animation to finish yet
4216 application.SendNotification();
4217 finishCheck.CheckSignalNotReceived();
4218 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4220 application.SendNotification();
4221 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4223 // We did expect the animation to finish
4224 application.SendNotification();
4225 finishCheck.CheckSignalReceived();
4226 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4228 // Check that nothing has changed after a couple of buffer swaps
4229 application.Render(0);
4230 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4231 application.Render(0);
4232 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4236 int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void)
4238 TestApplication application;
4240 Actor actor = Actor::New();
4242 // Register a boolean property
4243 const bool startValue(false);
4244 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4245 Stage::GetCurrent().Add(actor);
4246 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4248 // Build the animation
4249 float durationSeconds(2.0f);
4250 Animation animation = Animation::New(durationSeconds);
4251 const bool targetValue( !startValue );
4252 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
4254 // Start the animation
4257 bool signalReceived(false);
4258 AnimationFinishCheck finishCheck(signalReceived);
4259 animation.FinishedSignal().Connect(&application, finishCheck);
4261 application.SendNotification();
4262 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4264 // We didn't expect the animation to finish yet
4265 application.SendNotification();
4266 finishCheck.CheckSignalNotReceived();
4267 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4269 application.SendNotification();
4270 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4272 // We did expect the animation to finish
4273 application.SendNotification();
4274 finishCheck.CheckSignalReceived();
4275 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4277 // Check that nothing has changed after a couple of buffer swaps
4278 application.Render(0);
4279 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4280 application.Render(0);
4281 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4283 // Repeat with target value "false"
4284 animation = Animation::New(durationSeconds);
4285 const bool finalValue( !targetValue );
4286 animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
4288 // Start the animation
4291 finishCheck.Reset();
4292 animation.FinishedSignal().Connect(&application, finishCheck);
4294 application.SendNotification();
4295 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4297 // We didn't expect the animation to finish yet
4298 application.SendNotification();
4299 finishCheck.CheckSignalNotReceived();
4300 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4302 application.SendNotification();
4303 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4305 // We did expect the animation to finish
4306 application.SendNotification();
4307 finishCheck.CheckSignalReceived();
4308 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4310 // Check that nothing has changed after a couple of buffer swaps
4311 application.Render(0);
4312 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4313 application.Render(0);
4314 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4318 int UtcDaliAnimationAnimateToBooleanTimePeriodP(void)
4320 TestApplication application;
4322 Actor actor = Actor::New();
4324 // Register a boolean property
4325 bool startValue(false);
4326 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4327 Stage::GetCurrent().Add(actor);
4328 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4330 // Build the animation
4331 float durationSeconds(2.0f);
4332 Animation animation = Animation::New(durationSeconds);
4333 bool finalValue( !startValue );
4334 float animatorDurationSeconds(durationSeconds * 0.5f);
4335 animation.AnimateTo( Property(actor, index),
4337 TimePeriod( animatorDurationSeconds ) );
4339 // Start the animation
4342 bool signalReceived(false);
4343 AnimationFinishCheck finishCheck(signalReceived);
4344 animation.FinishedSignal().Connect(&application, finishCheck);
4346 application.SendNotification();
4347 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
4349 // We didn't expect the animation to finish yet
4350 application.SendNotification();
4351 finishCheck.CheckSignalNotReceived();
4352 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4354 application.SendNotification();
4355 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
4357 // We didn't expect the animation to finish yet...
4358 application.SendNotification();
4359 finishCheck.CheckSignalNotReceived();
4361 // ...however we should have reached the final value
4362 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4364 application.SendNotification();
4365 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
4367 // We did expect the animation to finish
4368 application.SendNotification();
4369 finishCheck.CheckSignalReceived();
4370 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4372 // Check that nothing has changed after a couple of buffer swaps
4373 application.Render(0);
4374 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4375 application.Render(0);
4376 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4380 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void)
4382 TestApplication application;
4384 Actor actor = Actor::New();
4386 // Register a boolean property
4387 bool startValue(false);
4388 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4389 Stage::GetCurrent().Add(actor);
4390 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4392 // Build the animation
4393 float durationSeconds(2.0f);
4394 Animation animation = Animation::New(durationSeconds);
4395 bool finalValue( !startValue );
4396 float animatorDurationSeconds(durationSeconds * 0.5f);
4397 animation.AnimateTo( Property(actor, index),
4399 AlphaFunction::LINEAR,
4400 TimePeriod( animatorDurationSeconds ) );
4402 // Start the animation
4405 bool signalReceived(false);
4406 AnimationFinishCheck finishCheck(signalReceived);
4407 animation.FinishedSignal().Connect(&application, finishCheck);
4409 application.SendNotification();
4410 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
4412 // We didn't expect the animation to finish yet
4413 application.SendNotification();
4414 finishCheck.CheckSignalNotReceived();
4415 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4417 application.SendNotification();
4418 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
4420 // We didn't expect the animation to finish yet...
4421 application.SendNotification();
4422 finishCheck.CheckSignalNotReceived();
4424 // ...however we should have reached the final value
4425 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4427 application.SendNotification();
4428 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
4430 // We did expect the animation to finish
4431 application.SendNotification();
4432 finishCheck.CheckSignalReceived();
4433 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4435 // Check that nothing has changed after a couple of buffer swaps
4436 application.Render(0);
4437 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4438 application.Render(0);
4439 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4443 int UtcDaliAnimationAnimateToFloatP(void)
4445 TestApplication application;
4447 Actor actor = Actor::New();
4449 // Register a float property
4450 float startValue(10.0f);
4451 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4452 Stage::GetCurrent().Add(actor);
4453 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
4455 // Build the animation
4456 float durationSeconds(2.0f);
4457 Animation animation = Animation::New(durationSeconds);
4458 float targetValue(50.0f);
4459 float relativeValue(targetValue - startValue);
4460 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
4462 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4464 // Start the animation
4467 bool signalReceived(false);
4468 AnimationFinishCheck finishCheck(signalReceived);
4469 animation.FinishedSignal().Connect(&application, finishCheck);
4471 application.SendNotification();
4472 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4474 // We didn't expect the animation to finish yet
4475 application.SendNotification();
4476 finishCheck.CheckSignalNotReceived();
4477 DALI_TEST_EQUALS( actor.GetProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION );
4479 application.SendNotification();
4480 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4482 // We did expect the animation to finish
4483 application.SendNotification();
4484 finishCheck.CheckSignalReceived();
4485 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
4489 int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void)
4491 TestApplication application;
4493 Actor actor = Actor::New();
4495 // Register a float property
4496 float startValue(10.0f);
4497 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4498 Stage::GetCurrent().Add(actor);
4499 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
4501 // Build the animation
4502 float durationSeconds(1.0f);
4503 Animation animation = Animation::New(durationSeconds);
4504 float targetValue(90.0f);
4505 float relativeValue(targetValue - startValue);
4506 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
4508 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4510 // Start the animation
4513 bool signalReceived(false);
4514 AnimationFinishCheck finishCheck(signalReceived);
4515 animation.FinishedSignal().Connect(&application, finishCheck);
4517 application.SendNotification();
4518 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4520 // We didn't expect the animation to finish yet
4521 application.SendNotification();
4522 finishCheck.CheckSignalNotReceived();
4524 // The position should have moved more, than with a linear alpha function
4525 float current(actor.GetProperty<float>(index));
4526 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
4528 application.SendNotification();
4529 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4531 // We did expect the animation to finish
4532 application.SendNotification();
4533 finishCheck.CheckSignalReceived();
4534 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
4538 int UtcDaliAnimationAnimateToFloatTimePeriodP(void)
4540 TestApplication application;
4542 Actor actor = Actor::New();
4544 // Register a float property
4545 float startValue(10.0f);
4546 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4547 Stage::GetCurrent().Add(actor);
4548 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
4550 // Build the animation
4551 float durationSeconds(1.0f);
4552 Animation animation = Animation::New(durationSeconds);
4553 float targetValue(30.0f);
4554 float relativeValue(targetValue - startValue);
4556 animation.AnimateTo(Property(actor, index),
4558 TimePeriod(delay, durationSeconds - delay));
4560 // Start the animation
4563 bool signalReceived(false);
4564 AnimationFinishCheck finishCheck(signalReceived);
4565 animation.FinishedSignal().Connect(&application, finishCheck);
4567 application.SendNotification();
4568 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4570 // We didn't expect the animation to finish yet
4571 application.SendNotification();
4572 finishCheck.CheckSignalNotReceived();
4573 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
4575 application.SendNotification();
4576 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4578 // We didn't expect the animation to finish yet
4579 application.SendNotification();
4580 finishCheck.CheckSignalNotReceived();
4581 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
4583 application.SendNotification();
4584 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4586 // We did expect the animation to finish
4587 application.SendNotification();
4588 finishCheck.CheckSignalReceived();
4589 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
4593 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void)
4595 TestApplication application;
4597 Actor actor = Actor::New();
4599 // Register a float property
4600 float startValue(10.0f);
4601 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4602 Stage::GetCurrent().Add(actor);
4603 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
4605 // Build the animation
4606 float durationSeconds(1.0f);
4607 Animation animation = Animation::New(durationSeconds);
4608 float targetValue(30.0f);
4609 float relativeValue(targetValue - startValue);
4611 animation.AnimateTo(Property(actor, index),
4613 AlphaFunction::LINEAR,
4614 TimePeriod(delay, durationSeconds - delay));
4616 // Start the animation
4619 bool signalReceived(false);
4620 AnimationFinishCheck finishCheck(signalReceived);
4621 animation.FinishedSignal().Connect(&application, finishCheck);
4623 application.SendNotification();
4624 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4626 // We didn't expect the animation to finish yet
4627 application.SendNotification();
4628 finishCheck.CheckSignalNotReceived();
4629 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
4631 application.SendNotification();
4632 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4634 // We didn't expect the animation to finish yet
4635 application.SendNotification();
4636 finishCheck.CheckSignalNotReceived();
4637 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
4639 application.SendNotification();
4640 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4642 // We did expect the animation to finish
4643 application.SendNotification();
4644 finishCheck.CheckSignalReceived();
4645 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
4649 int UtcDaliAnimationAnimateToIntegerP(void)
4651 TestApplication application;
4653 Actor actor = Actor::New();
4655 // Register an integer property
4657 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4658 Stage::GetCurrent().Add(actor);
4659 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
4661 // Build the animation
4662 float durationSeconds(2.0f);
4663 Animation animation = Animation::New(durationSeconds);
4664 int targetValue(50);
4665 int relativeValue(targetValue - startValue);
4666 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
4668 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
4670 // Start the animation
4673 bool signalReceived(false);
4674 AnimationFinishCheck finishCheck(signalReceived);
4675 animation.FinishedSignal().Connect(&application, finishCheck);
4677 application.SendNotification();
4678 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4680 // We didn't expect the animation to finish yet
4681 application.SendNotification();
4682 finishCheck.CheckSignalNotReceived();
4683 DALI_TEST_EQUALS( actor.GetProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION );
4685 application.SendNotification();
4686 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4688 // We did expect the animation to finish
4689 application.SendNotification();
4690 finishCheck.CheckSignalReceived();
4691 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
4695 int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void)
4697 TestApplication application;
4699 Actor actor = Actor::New();
4701 // Register an integer property
4703 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4704 Stage::GetCurrent().Add(actor);
4705 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
4707 // Build the animation
4708 float durationSeconds(1.0f);
4709 Animation animation = Animation::New(durationSeconds);
4710 int targetValue(90);
4711 int relativeValue(targetValue - startValue);
4712 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
4714 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
4716 // Start the animation
4719 bool signalReceived(false);
4720 AnimationFinishCheck finishCheck(signalReceived);
4721 animation.FinishedSignal().Connect(&application, finishCheck);
4723 application.SendNotification();
4724 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4726 // We didn't expect the animation to finish yet
4727 application.SendNotification();
4728 finishCheck.CheckSignalNotReceived();
4730 // The position should have moved more, than with a linear alpha function
4731 int current(actor.GetProperty<int>(index));
4732 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
4734 application.SendNotification();
4735 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4737 // We did expect the animation to finish
4738 application.SendNotification();
4739 finishCheck.CheckSignalReceived();
4740 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
4744 int UtcDaliAnimationAnimateToIntegerTimePeriodP(void)
4746 TestApplication application;
4748 Actor actor = Actor::New();
4750 // Register an integer property
4752 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4753 Stage::GetCurrent().Add(actor);
4754 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
4756 // Build the animation
4757 float durationSeconds(1.0f);
4758 Animation animation = Animation::New(durationSeconds);
4759 int targetValue(30);
4760 int relativeValue(targetValue - startValue);
4762 animation.AnimateTo(Property(actor, index),
4764 TimePeriod(delay, durationSeconds - delay));
4766 // Start the animation
4769 bool signalReceived(false);
4770 AnimationFinishCheck finishCheck(signalReceived);
4771 animation.FinishedSignal().Connect(&application, finishCheck);
4773 application.SendNotification();
4774 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4776 // We didn't expect the animation to finish yet
4777 application.SendNotification();
4778 finishCheck.CheckSignalNotReceived();
4779 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
4781 application.SendNotification();
4782 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4784 // We didn't expect the animation to finish yet
4785 application.SendNotification();
4786 finishCheck.CheckSignalNotReceived();
4787 DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
4789 application.SendNotification();
4790 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4792 // We did expect the animation to finish
4793 application.SendNotification();
4794 finishCheck.CheckSignalReceived();
4795 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
4799 int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void)
4801 TestApplication application;
4803 Actor actor = Actor::New();
4805 // Register an integer property
4807 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4808 Stage::GetCurrent().Add(actor);
4809 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
4811 // Build the animation
4812 float durationSeconds(1.0f);
4813 Animation animation = Animation::New(durationSeconds);
4814 int targetValue(30);
4815 int relativeValue(targetValue - startValue);
4817 animation.AnimateTo(Property(actor, index),
4819 AlphaFunction::LINEAR,
4820 TimePeriod(delay, durationSeconds - delay));
4822 // Start the animation
4825 bool signalReceived(false);
4826 AnimationFinishCheck finishCheck(signalReceived);
4827 animation.FinishedSignal().Connect(&application, finishCheck);
4829 application.SendNotification();
4830 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4832 // We didn't expect the animation to finish yet
4833 application.SendNotification();
4834 finishCheck.CheckSignalNotReceived();
4835 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
4837 application.SendNotification();
4838 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4840 // We didn't expect the animation to finish yet
4841 application.SendNotification();
4842 finishCheck.CheckSignalNotReceived();
4843 DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
4845 application.SendNotification();
4846 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4848 // We did expect the animation to finish
4849 application.SendNotification();
4850 finishCheck.CheckSignalReceived();
4851 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
4855 int UtcDaliAnimationAnimateToVector2P(void)
4857 TestApplication application;
4859 Actor actor = Actor::New();
4861 // Register a Vector2 property
4862 Vector2 startValue(-50.0f, -50.0f);
4863 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4864 Stage::GetCurrent().Add(actor);
4865 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
4867 // Build the animation
4868 float durationSeconds(2.0f);
4869 Animation animation = Animation::New(durationSeconds);
4870 Vector2 targetValue(50.0f, 50.0f);
4871 Vector2 relativeValue(targetValue - startValue);
4872 animation.AnimateTo(Property(actor, index), targetValue);
4874 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4876 // Start the animation
4879 bool signalReceived(false);
4880 AnimationFinishCheck finishCheck(signalReceived);
4881 animation.FinishedSignal().Connect(&application, finishCheck);
4883 application.SendNotification();
4884 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4886 // We didn't expect the animation to finish yet
4887 application.SendNotification();
4888 finishCheck.CheckSignalNotReceived();
4889 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION );
4891 application.SendNotification();
4892 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4894 // We did expect the animation to finish
4895 application.SendNotification();
4896 finishCheck.CheckSignalReceived();
4897 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
4901 int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void)
4903 TestApplication application;
4905 Actor actor = Actor::New();
4907 // Register a Vector2 property
4908 Vector2 startValue(1000.0f, 1000.0f);
4909 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4910 Stage::GetCurrent().Add(actor);
4911 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
4913 // Build the animation
4914 float durationSeconds(1.0f);
4915 Animation animation = Animation::New(durationSeconds);
4916 Vector2 targetValue(9000.0f, 9000.0f);
4917 Vector2 relativeValue(targetValue - startValue);
4918 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
4920 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4922 // Start the animation
4925 bool signalReceived(false);
4926 AnimationFinishCheck finishCheck(signalReceived);
4927 animation.FinishedSignal().Connect(&application, finishCheck);
4929 application.SendNotification();
4930 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4932 // We didn't expect the animation to finish yet
4933 application.SendNotification();
4934 finishCheck.CheckSignalNotReceived();
4936 // The position should have moved more, than with a linear alpha function
4937 Vector2 current(actor.GetProperty<Vector2>(index));
4938 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
4939 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
4941 application.SendNotification();
4942 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4944 // We did expect the animation to finish
4945 application.SendNotification();
4946 finishCheck.CheckSignalReceived();
4947 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
4951 int UtcDaliAnimationAnimateToVector2TimePeriodP(void)
4953 TestApplication application;
4955 Actor actor = Actor::New();
4957 // Register a Vector2 property
4958 Vector2 startValue(10.0f, 10.0f);
4959 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4960 Stage::GetCurrent().Add(actor);
4961 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
4963 // Build the animation
4964 float durationSeconds(1.0f);
4965 Animation animation = Animation::New(durationSeconds);
4966 Vector2 targetValue(-10.0f, 20.0f);
4967 Vector2 relativeValue(targetValue - startValue);
4969 animation.AnimateTo(Property(actor, index),
4971 TimePeriod(delay, durationSeconds - delay));
4973 // Start the animation
4976 bool signalReceived(false);
4977 AnimationFinishCheck finishCheck(signalReceived);
4978 animation.FinishedSignal().Connect(&application, finishCheck);
4980 application.SendNotification();
4981 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4983 // We didn't expect the animation to finish yet
4984 application.SendNotification();
4985 finishCheck.CheckSignalNotReceived();
4986 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
4988 application.SendNotification();
4989 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4991 // We didn't expect the animation to finish yet
4992 application.SendNotification();
4993 finishCheck.CheckSignalNotReceived();
4994 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
4996 application.SendNotification();
4997 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4999 // We did expect the animation to finish
5000 application.SendNotification();
5001 finishCheck.CheckSignalReceived();
5002 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
5006 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void)
5008 TestApplication application;
5010 Actor actor = Actor::New();
5012 // Register a Vector2 property
5013 Vector2 startValue(10.0f, 10.0f);
5014 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5015 Stage::GetCurrent().Add(actor);
5016 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
5018 // Build the animation
5019 float durationSeconds(1.0f);
5020 Animation animation = Animation::New(durationSeconds);
5021 Vector2 targetValue(30.0f, 30.0f);
5022 Vector2 relativeValue(targetValue - startValue);
5024 animation.AnimateTo(Property(actor, index),
5026 AlphaFunction::LINEAR,
5027 TimePeriod(delay, durationSeconds - delay));
5029 // Start the animation
5032 bool signalReceived(false);
5033 AnimationFinishCheck finishCheck(signalReceived);
5034 animation.FinishedSignal().Connect(&application, finishCheck);
5036 application.SendNotification();
5037 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5039 // We didn't expect the animation to finish yet
5040 application.SendNotification();
5041 finishCheck.CheckSignalNotReceived();
5042 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
5044 application.SendNotification();
5045 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5047 // We didn't expect the animation to finish yet
5048 application.SendNotification();
5049 finishCheck.CheckSignalNotReceived();
5050 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5052 application.SendNotification();
5053 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5055 // We did expect the animation to finish
5056 application.SendNotification();
5057 finishCheck.CheckSignalReceived();
5058 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
5062 int UtcDaliAnimationAnimateToVector3P(void)
5064 TestApplication application;
5066 Actor actor = Actor::New();
5068 // Register a Vector3 property
5069 Vector3 startValue(-50.0f, -50.0f, -50.0f);
5070 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5071 Stage::GetCurrent().Add(actor);
5072 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5074 // Build the animation
5075 float durationSeconds(2.0f);
5076 Animation animation = Animation::New(durationSeconds);
5077 Vector3 targetValue(50.0f, 50.0f, 50.0f);
5078 Vector3 relativeValue(targetValue - startValue);
5079 animation.AnimateTo(Property(actor, index), targetValue);
5081 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5083 // Start the animation
5086 bool signalReceived(false);
5087 AnimationFinishCheck finishCheck(signalReceived);
5088 animation.FinishedSignal().Connect(&application, finishCheck);
5090 application.SendNotification();
5091 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5093 // We didn't expect the animation to finish yet
5094 application.SendNotification();
5095 finishCheck.CheckSignalNotReceived();
5096 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION );
5098 application.SendNotification();
5099 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5101 // We did expect the animation to finish
5102 application.SendNotification();
5103 finishCheck.CheckSignalReceived();
5104 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
5108 int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void)
5110 TestApplication application;
5112 Actor actor = Actor::New();
5114 // Register a Vector3 property
5115 Vector3 startValue(1000.0f, 1000.0f, 1000.0f);
5116 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5117 Stage::GetCurrent().Add(actor);
5118 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5120 // Build the animation
5121 float durationSeconds(1.0f);
5122 Animation animation = Animation::New(durationSeconds);
5123 Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
5124 Vector3 relativeValue(targetValue - startValue);
5125 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5127 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5129 // Start the animation
5132 bool signalReceived(false);
5133 AnimationFinishCheck finishCheck(signalReceived);
5134 animation.FinishedSignal().Connect(&application, finishCheck);
5136 application.SendNotification();
5137 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5139 // We didn't expect the animation to finish yet
5140 application.SendNotification();
5141 finishCheck.CheckSignalNotReceived();
5143 // The position should have moved more, than with a linear alpha function
5144 Vector3 current(actor.GetProperty<Vector3>(index));
5145 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
5146 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
5147 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
5149 application.SendNotification();
5150 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5152 // We did expect the animation to finish
5153 application.SendNotification();
5154 finishCheck.CheckSignalReceived();
5155 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
5159 int UtcDaliAnimationAnimateToVector3TimePeriodP(void)
5161 TestApplication application;
5163 Actor actor = Actor::New();
5165 // Register a Vector3 property
5166 Vector3 startValue(10.0f, 10.0f, 10.0f);
5167 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5168 Stage::GetCurrent().Add(actor);
5169 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5171 // Build the animation
5172 float durationSeconds(1.0f);
5173 Animation animation = Animation::New(durationSeconds);
5174 Vector3 targetValue(-10.0f, 20.0f, 100.0f);
5175 Vector3 relativeValue(targetValue - startValue);
5177 animation.AnimateTo(Property(actor, index),
5179 TimePeriod(delay, durationSeconds - delay));
5181 // Start the animation
5184 bool signalReceived(false);
5185 AnimationFinishCheck finishCheck(signalReceived);
5186 animation.FinishedSignal().Connect(&application, finishCheck);
5188 application.SendNotification();
5189 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5191 // We didn't expect the animation to finish yet
5192 application.SendNotification();
5193 finishCheck.CheckSignalNotReceived();
5194 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5196 application.SendNotification();
5197 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5199 // We didn't expect the animation to finish yet
5200 application.SendNotification();
5201 finishCheck.CheckSignalNotReceived();
5202 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5204 application.SendNotification();
5205 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5207 // We did expect the animation to finish
5208 application.SendNotification();
5209 finishCheck.CheckSignalReceived();
5210 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
5214 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void)
5216 TestApplication application;
5218 Actor actor = Actor::New();
5220 // Register a Vector3 property
5221 Vector3 startValue(10.0f, 10.0f, 10.0f);
5222 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5223 Stage::GetCurrent().Add(actor);
5224 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5226 // Build the animation
5227 float durationSeconds(1.0f);
5228 Animation animation = Animation::New(durationSeconds);
5229 Vector3 targetValue(30.0f, 30.0f, 30.0f);
5230 Vector3 relativeValue(targetValue - startValue);
5232 animation.AnimateTo(Property(actor, "testProperty"),
5234 AlphaFunction::LINEAR,
5235 TimePeriod(delay, durationSeconds - delay));
5237 // Start the animation
5240 bool signalReceived(false);
5241 AnimationFinishCheck finishCheck(signalReceived);
5242 animation.FinishedSignal().Connect(&application, finishCheck);
5244 application.SendNotification();
5245 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5247 // We didn't expect the animation to finish yet
5248 application.SendNotification();
5249 finishCheck.CheckSignalNotReceived();
5250 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5252 application.SendNotification();
5253 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5255 // We didn't expect the animation to finish yet
5256 application.SendNotification();
5257 finishCheck.CheckSignalNotReceived();
5258 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5260 application.SendNotification();
5261 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5263 // We did expect the animation to finish
5264 application.SendNotification();
5265 finishCheck.CheckSignalReceived();
5266 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
5270 int UtcDaliAnimationAnimateToVector3ComponentP(void)
5272 TestApplication application;
5274 Actor actor = Actor::New();
5276 // Register a Vector3 property
5277 Vector3 startValue(10.0f, 10.0f, 10.0f);
5278 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5279 Stage::GetCurrent().Add(actor);
5280 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5282 // Build the animation
5283 float durationSeconds(1.0f);
5284 Animation animation = Animation::New(durationSeconds);
5285 Vector3 targetValue(30.0f, 30.0f, 10.0f);
5286 Vector3 relativeValue(targetValue - startValue);
5288 animation.AnimateTo(Property(actor, "testProperty", 0),
5290 AlphaFunction::LINEAR,
5291 TimePeriod(delay, durationSeconds - delay));
5292 animation.AnimateTo(Property(actor, index, 1),
5294 AlphaFunction::LINEAR,
5295 TimePeriod(delay, durationSeconds - delay));
5297 // Start the animation
5300 bool signalReceived(false);
5301 AnimationFinishCheck finishCheck(signalReceived);
5302 animation.FinishedSignal().Connect(&application, finishCheck);
5304 application.SendNotification();
5305 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5307 // We didn't expect the animation to finish yet
5308 application.SendNotification();
5309 finishCheck.CheckSignalNotReceived();
5310 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5312 application.SendNotification();
5313 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5315 // We didn't expect the animation to finish yet
5316 application.SendNotification();
5317 finishCheck.CheckSignalNotReceived();
5318 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5320 application.SendNotification();
5321 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5323 // We did expect the animation to finish
5324 application.SendNotification();
5325 finishCheck.CheckSignalReceived();
5326 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
5330 int UtcDaliAnimationAnimateToVector4P(void)
5332 TestApplication application;
5334 Actor actor = Actor::New();
5336 // Register a Vector4 property
5337 Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f);
5338 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5339 Stage::GetCurrent().Add(actor);
5340 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
5342 // Build the animation
5343 float durationSeconds(2.0f);
5344 Animation animation = Animation::New(durationSeconds);
5345 Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f);
5346 Vector4 relativeValue(targetValue - startValue);
5347 animation.AnimateTo(Property(actor, index), targetValue);
5349 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5351 // Start the animation
5354 bool signalReceived(false);
5355 AnimationFinishCheck finishCheck(signalReceived);
5356 animation.FinishedSignal().Connect(&application, finishCheck);
5358 application.SendNotification();
5359 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5361 // We didn't expect the animation to finish yet
5362 application.SendNotification();
5363 finishCheck.CheckSignalNotReceived();
5364 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION );
5366 application.SendNotification();
5367 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5369 // We did expect the animation to finish
5370 application.SendNotification();
5371 finishCheck.CheckSignalReceived();
5372 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
5376 int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void)
5378 TestApplication application;
5380 Actor actor = Actor::New();
5382 // Register a Vector4 property
5383 Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
5384 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5385 Stage::GetCurrent().Add(actor);
5386 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
5388 // Build the animation
5389 float durationSeconds(1.0f);
5390 Animation animation = Animation::New(durationSeconds);
5391 Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
5392 Vector4 relativeValue(targetValue - startValue);
5393 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5395 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5397 // Start the animation
5400 bool signalReceived(false);
5401 AnimationFinishCheck finishCheck(signalReceived);
5402 animation.FinishedSignal().Connect(&application, finishCheck);
5404 application.SendNotification();
5405 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5407 // We didn't expect the animation to finish yet
5408 application.SendNotification();
5409 finishCheck.CheckSignalNotReceived();
5411 // The position should have moved more, than with a linear alpha function
5412 Vector4 current(actor.GetProperty<Vector4>(index));
5413 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
5414 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
5415 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
5416 DALI_TEST_CHECK( current.w > ninetyFivePercentProgress.w );
5418 application.SendNotification();
5419 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5421 // We did expect the animation to finish
5422 application.SendNotification();
5423 finishCheck.CheckSignalReceived();
5424 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
5428 int UtcDaliAnimationAnimateToVector4TimePeriodP(void)
5430 TestApplication application;
5432 Actor actor = Actor::New();
5434 // Register a Vector4 property
5435 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
5436 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5437 Stage::GetCurrent().Add(actor);
5438 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION );
5440 // Build the animation
5441 float durationSeconds(1.0f);
5442 Animation animation = Animation::New(durationSeconds);
5443 Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
5444 Vector4 relativeValue(targetValue - startValue);
5446 animation.AnimateTo(Property(actor, index),
5448 TimePeriod(delay, durationSeconds - delay));
5450 // Start the animation
5453 bool signalReceived(false);
5454 AnimationFinishCheck finishCheck(signalReceived);
5455 animation.FinishedSignal().Connect(&application, finishCheck);
5457 application.SendNotification();
5458 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5460 // We didn't expect the animation to finish yet
5461 application.SendNotification();
5462 finishCheck.CheckSignalNotReceived();
5463 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION );
5465 application.SendNotification();
5466 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5468 // We didn't expect the animation to finish yet
5469 application.SendNotification();
5470 finishCheck.CheckSignalNotReceived();
5471 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), VECTOR4_EPSILON, TEST_LOCATION );
5473 application.SendNotification();
5474 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5476 // We did expect the animation to finish
5477 application.SendNotification();
5478 finishCheck.CheckSignalReceived();
5479 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, VECTOR4_EPSILON, TEST_LOCATION );
5483 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void)
5485 TestApplication application;
5487 Actor actor = Actor::New();
5489 // Register a Vector4 property
5490 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
5491 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5492 Stage::GetCurrent().Add(actor);
5493 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
5495 // Build the animation
5496 float durationSeconds(1.0f);
5497 Animation animation = Animation::New(durationSeconds);
5498 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
5499 Vector4 relativeValue(targetValue - startValue);
5501 animation.AnimateTo(Property(actor, index),
5503 AlphaFunction::LINEAR,
5504 TimePeriod(delay, durationSeconds - delay));
5506 // Start the animation
5509 bool signalReceived(false);
5510 AnimationFinishCheck finishCheck(signalReceived);
5511 animation.FinishedSignal().Connect(&application, finishCheck);
5513 application.SendNotification();
5514 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5516 // We didn't expect the animation to finish yet
5517 application.SendNotification();
5518 finishCheck.CheckSignalNotReceived();
5519 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
5521 application.SendNotification();
5522 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5524 // We didn't expect the animation to finish yet
5525 application.SendNotification();
5526 finishCheck.CheckSignalNotReceived();
5527 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5529 application.SendNotification();
5530 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5532 // We did expect the animation to finish
5533 application.SendNotification();
5534 finishCheck.CheckSignalReceived();
5535 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
5539 int UtcDaliAnimationAnimateToActorParentOriginP(void)
5541 TestApplication application;
5543 Actor actor = Actor::New();
5544 Stage::GetCurrent().Add(actor);
5545 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_LEFT, TEST_LOCATION );
5547 // Build the animation
5548 float durationSeconds(1.0f);
5549 Animation animation = Animation::New(durationSeconds);
5550 Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
5554 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin );
5556 catch (Dali::DaliException& e)
5558 DALI_TEST_PRINT_ASSERT( e );
5559 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5564 int UtcDaliAnimationAnimateToActorParentOriginXP(void)
5566 TestApplication application;
5568 Actor actor = Actor::New();
5569 Stage::GetCurrent().Add(actor);
5570 float startValue(0.0f);
5571 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().x, startValue, TEST_LOCATION );
5572 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION );
5574 // Build the animation
5575 float durationSeconds(1.0f);
5576 Animation animation = Animation::New(durationSeconds);
5577 float targetX(1.0f);
5581 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX );
5583 catch (Dali::DaliException& e)
5585 DALI_TEST_PRINT_ASSERT( e );
5586 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5591 int UtcDaliAnimationAnimateToActorParentOriginYP(void)
5593 TestApplication application;
5595 Actor actor = Actor::New();
5596 Stage::GetCurrent().Add(actor);
5597 float startValue(0.0f);
5598 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().y, startValue, TEST_LOCATION );
5599 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION );
5601 // Build the animation
5602 float durationSeconds(1.0f);
5603 Animation animation = Animation::New(durationSeconds);
5604 float targetY(1.0f);
5608 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY );
5610 catch (Dali::DaliException& e)
5612 DALI_TEST_PRINT_ASSERT( e );
5613 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5618 int UtcDaliAnimationAnimateToActorParentOriginZP(void)
5620 TestApplication application;
5622 Actor actor = Actor::New();
5623 Stage::GetCurrent().Add(actor);
5624 float startValue(0.5f);
5625 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().z, startValue, TEST_LOCATION );
5626 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION );
5628 // Build the animation
5629 float durationSeconds(1.0f);
5630 Animation animation = Animation::New(durationSeconds);
5631 float targetZ(1.0f);
5635 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ );
5637 catch (Dali::DaliException& e)
5639 DALI_TEST_PRINT_ASSERT( e );
5640 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5645 int UtcDaliAnimationAnimateToActorAnchorPointP(void)
5647 TestApplication application;
5649 Actor actor = Actor::New();
5650 Stage::GetCurrent().Add(actor);
5651 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), AnchorPoint::CENTER, TEST_LOCATION );
5653 // Build the animation
5654 float durationSeconds(1.0f);
5655 Animation animation = Animation::New(durationSeconds);
5656 Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT);
5660 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
5662 catch (Dali::DaliException& e)
5664 DALI_TEST_PRINT_ASSERT( e );
5665 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5670 int UtcDaliAnimationAnimateToActorAnchorPointXP(void)
5672 TestApplication application;
5674 Actor actor = Actor::New();
5675 Stage::GetCurrent().Add(actor);
5676 float startValue(0.5f);
5677 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().x, startValue, TEST_LOCATION );
5678 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION );
5680 // Build the animation
5681 float durationSeconds(1.0f);
5682 Animation animation = Animation::New(durationSeconds);
5683 float targetX(1.0f);
5687 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_X), targetX );
5689 catch (Dali::DaliException& e)
5691 DALI_TEST_PRINT_ASSERT( e );
5692 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5697 int UtcDaliAnimationAnimateToActorAnchorPointYP(void)
5699 TestApplication application;
5701 Actor actor = Actor::New();
5702 Stage::GetCurrent().Add(actor);
5703 float startValue(0.5f);
5704 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().y, startValue, TEST_LOCATION );
5705 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION );
5707 // Build the animation
5708 float durationSeconds(1.0f);
5709 Animation animation = Animation::New(durationSeconds);
5710 float targetY(0.0f);
5714 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY );
5716 catch (Dali::DaliException& e)
5718 DALI_TEST_PRINT_ASSERT( e );
5719 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5724 int UtcDaliAnimationAnimateToActorAnchorPointZP(void)
5726 TestApplication application;
5728 Actor actor = Actor::New();
5729 Stage::GetCurrent().Add(actor);
5730 float startValue(0.5f);
5731 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().z, startValue, TEST_LOCATION );
5732 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION );
5734 // Build the animation
5735 float durationSeconds(1.0f);
5736 Animation animation = Animation::New(durationSeconds);
5737 float targetZ(100.0f);
5741 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ );
5743 catch (Dali::DaliException& e)
5745 DALI_TEST_PRINT_ASSERT( e );
5746 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5751 int UtcDaliAnimationAnimateToActorSizeP(void)
5753 TestApplication application;
5755 Actor actor = Actor::New();
5756 Stage::GetCurrent().Add(actor);
5757 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5759 // Build the animation
5760 float durationSeconds(1.0f);
5761 Animation animation = Animation::New(durationSeconds);
5762 Vector3 targetSize(100.0f, 100.0f, 100.0f);
5763 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize );
5765 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
5767 // Start the animation
5770 bool signalReceived(false);
5771 AnimationFinishCheck finishCheck(signalReceived);
5772 animation.FinishedSignal().Connect(&application, finishCheck);
5774 application.SendNotification();
5775 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
5777 // We didn't expect the animation to finish yet
5778 application.SendNotification();
5779 finishCheck.CheckSignalNotReceived();
5780 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
5782 application.SendNotification();
5783 application.Render(static_cast<unsigned int>(durationSeconds*10.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.GetCurrentSize(), targetSize, TEST_LOCATION );
5791 finishCheck.Reset();
5792 actor.SetSize(Vector3::ZERO);
5793 application.SendNotification();
5794 application.Render(0);
5795 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5797 // Repeat with a different (ease-in) alpha function
5798 animation = Animation::New(durationSeconds);
5799 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
5800 animation.FinishedSignal().Connect(&application, finishCheck);
5803 application.SendNotification();
5804 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
5806 // We didn't expect the animation to finish yet
5807 application.SendNotification();
5808 finishCheck.CheckSignalNotReceived();
5810 // The size should have travelled less, than with a linear alpha function
5811 Vector3 current(actor.GetCurrentSize());
5812 DALI_TEST_CHECK( current.x > 0.0f );
5813 DALI_TEST_CHECK( current.y > 0.0f );
5814 DALI_TEST_CHECK( current.z > 0.0f );
5815 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
5816 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
5817 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
5819 application.SendNotification();
5820 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
5822 // We did expect the animation to finish
5823 application.SendNotification();
5824 finishCheck.CheckSignalReceived();
5825 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
5828 finishCheck.Reset();
5829 actor.SetSize(Vector3::ZERO);
5830 application.SendNotification();
5831 application.Render(0);
5832 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5834 // Repeat with a delay
5836 animation = Animation::New(durationSeconds);
5837 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
5838 animation.FinishedSignal().Connect(&application, finishCheck);
5841 application.SendNotification();
5842 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5844 // We didn't expect the animation to finish yet
5845 application.SendNotification();
5846 finishCheck.CheckSignalNotReceived();
5847 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5849 application.SendNotification();
5850 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5852 // We did expect the animation to finish
5853 application.SendNotification();
5854 finishCheck.CheckSignalReceived();
5855 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
5859 int UtcDaliAnimationAnimateToActorSizeWidthP(void)
5861 TestApplication application;
5863 Actor actor = Actor::New();
5864 Stage::GetCurrent().Add(actor);
5865 float startValue(0.0f);
5866 DALI_TEST_EQUALS( actor.GetCurrentSize().width, startValue, TEST_LOCATION );
5867 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION );
5869 // Build the animation
5870 float durationSeconds(1.0f);
5871 Animation animation = Animation::New(durationSeconds);
5872 float targetWidth(10.0f);
5873 animation.AnimateTo( Property(actor, Actor::Property::SIZE_WIDTH), targetWidth );
5875 float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f);
5877 // Start the animation
5880 bool signalReceived(false);
5881 AnimationFinishCheck finishCheck(signalReceived);
5882 animation.FinishedSignal().Connect(&application, finishCheck);
5884 application.SendNotification();
5885 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5887 // We didn't expect the animation to finish yet
5888 application.SendNotification();
5889 finishCheck.CheckSignalNotReceived();
5890 DALI_TEST_EQUALS( actor.GetCurrentSize().width, fiftyPercentProgress, TEST_LOCATION );
5892 application.SendNotification();
5893 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5895 // We did expect the animation to finish
5896 application.SendNotification();
5897 finishCheck.CheckSignalReceived();
5898 DALI_TEST_EQUALS( actor.GetCurrentSize().width, targetWidth, TEST_LOCATION );
5899 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION );
5903 int UtcDaliAnimationAnimateToActorSizeHeightP(void)
5905 TestApplication application;
5907 Actor actor = Actor::New();
5908 Stage::GetCurrent().Add(actor);
5909 float startValue(0.0f);
5910 DALI_TEST_EQUALS( actor.GetCurrentSize().height, startValue, TEST_LOCATION );
5911 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION );
5913 // Build the animation
5914 float durationSeconds(1.0f);
5915 Animation animation = Animation::New(durationSeconds);
5916 float targetHeight(-10.0f);
5917 animation.AnimateTo( Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight );
5919 float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f);
5921 // Start the animation
5924 bool signalReceived(false);
5925 AnimationFinishCheck finishCheck(signalReceived);
5926 animation.FinishedSignal().Connect(&application, finishCheck);
5928 application.SendNotification();
5929 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5931 // We didn't expect the animation to finish yet
5932 application.SendNotification();
5933 finishCheck.CheckSignalNotReceived();
5934 DALI_TEST_EQUALS( actor.GetCurrentSize().height, fiftyPercentProgress, TEST_LOCATION );
5936 application.SendNotification();
5937 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5939 // We did expect the animation to finish
5940 application.SendNotification();
5941 finishCheck.CheckSignalReceived();
5942 DALI_TEST_EQUALS( actor.GetCurrentSize().height, targetHeight, TEST_LOCATION );
5943 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION );
5947 int UtcDaliAnimationAnimateToActorSizeDepthP(void)
5949 TestApplication application;
5951 Actor actor = Actor::New();
5952 Stage::GetCurrent().Add(actor);
5953 float startValue(0.0f);
5954 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, startValue, TEST_LOCATION );
5955 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION );
5957 // Build the animation
5958 float durationSeconds(1.0f);
5959 Animation animation = Animation::New(durationSeconds);
5960 float targetDepth(-10.0f);
5961 animation.AnimateTo( Property(actor, Actor::Property::SIZE_DEPTH), targetDepth );
5963 float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f);
5965 // Start the animation
5968 bool signalReceived(false);
5969 AnimationFinishCheck finishCheck(signalReceived);
5970 animation.FinishedSignal().Connect(&application, finishCheck);
5972 application.SendNotification();
5973 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5975 // We didn't expect the animation to finish yet
5976 application.SendNotification();
5977 finishCheck.CheckSignalNotReceived();
5978 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, fiftyPercentProgress, TEST_LOCATION );
5980 application.SendNotification();
5981 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5983 // We did expect the animation to finish
5984 application.SendNotification();
5985 finishCheck.CheckSignalReceived();
5986 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, targetDepth, TEST_LOCATION );
5987 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION );
5991 int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void)
5993 TestApplication application;
5995 Actor actor = Actor::New();
5996 Stage::GetCurrent().Add(actor);
5997 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5999 // Build the animation
6000 float durationSeconds(1.0f);
6001 Animation animation = Animation::New(durationSeconds);
6002 Vector3 targetSize(100.0f, 100.0f, 100.0f);
6003 animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetSize );
6005 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
6007 // Start the animation
6010 bool signalReceived(false);
6011 AnimationFinishCheck finishCheck(signalReceived);
6012 animation.FinishedSignal().Connect(&application, finishCheck);
6014 application.SendNotification();
6015 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6017 // We didn't expect the animation to finish yet
6018 application.SendNotification();
6019 finishCheck.CheckSignalNotReceived();
6020 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
6022 application.SendNotification();
6023 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6025 // We did expect the animation to finish
6026 application.SendNotification();
6027 finishCheck.CheckSignalReceived();
6028 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6031 finishCheck.Reset();
6032 actor.SetSize(Vector3::ZERO);
6033 application.SendNotification();
6034 application.Render(0);
6035 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6037 // Repeat with a different (ease-in) alpha function
6038 animation = Animation::New(durationSeconds);
6039 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::EASE_IN );
6040 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::EASE_IN );
6041 animation.FinishedSignal().Connect(&application, finishCheck);
6044 application.SendNotification();
6045 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6047 // We didn't expect the animation to finish yet
6048 application.SendNotification();
6049 finishCheck.CheckSignalNotReceived();
6051 // The size should have travelled less, than with a linear alpha function
6052 Vector3 current(actor.GetCurrentSize());
6053 DALI_TEST_CHECK( current.x > 0.0f );
6054 DALI_TEST_CHECK( current.y > 0.0f );
6055 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
6056 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
6058 application.SendNotification();
6059 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6061 // We did expect the animation to finish
6062 application.SendNotification();
6063 finishCheck.CheckSignalReceived();
6064 DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
6065 DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
6068 finishCheck.Reset();
6069 actor.SetSize(Vector3::ZERO);
6070 application.SendNotification();
6071 application.Render(0);
6072 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6074 // Repeat with a delay
6076 animation = Animation::New(durationSeconds);
6077 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
6078 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
6079 animation.FinishedSignal().Connect(&application, finishCheck);
6082 application.SendNotification();
6083 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6085 // We didn't expect the animation to finish yet
6086 application.SendNotification();
6087 finishCheck.CheckSignalNotReceived();
6088 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6090 application.SendNotification();
6091 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6093 // We did expect the animation to finish
6094 application.SendNotification();
6095 finishCheck.CheckSignalReceived();
6096 DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
6097 DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
6101 int UtcDaliAnimationAnimateToActorPositionP(void)
6103 TestApplication application;
6105 Actor actor = Actor::New();
6106 Stage::GetCurrent().Add(actor);
6107 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6109 // Build the animation
6110 float durationSeconds(1.0f);
6111 Animation animation = Animation::New(durationSeconds);
6112 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6113 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
6115 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6117 // Start the animation
6120 bool signalReceived(false);
6121 AnimationFinishCheck finishCheck(signalReceived);
6122 animation.FinishedSignal().Connect(&application, finishCheck);
6124 application.SendNotification();
6125 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
6127 // We didn't expect the animation to finish yet
6128 application.SendNotification();
6129 finishCheck.CheckSignalNotReceived();
6130 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
6132 application.SendNotification();
6133 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6135 // We did expect the animation to finish
6136 application.SendNotification();
6137 finishCheck.CheckSignalReceived();
6138 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6142 int UtcDaliAnimationAnimateToActorPositionXP(void)
6144 TestApplication application;
6146 Actor actor = Actor::New();
6147 Stage::GetCurrent().Add(actor);
6148 float startValue(0.0f);
6149 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, startValue, TEST_LOCATION );
6150 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6151 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6152 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6154 // Build the animation
6155 float durationSeconds(1.0f);
6156 Animation animation = Animation::New(durationSeconds);
6157 float targetX(1.0f);
6158 animation.AnimateTo( Property(actor, Actor::Property::POSITION_X), targetX );
6160 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
6162 // Start the animation
6165 bool signalReceived(false);
6166 AnimationFinishCheck finishCheck(signalReceived);
6167 animation.FinishedSignal().Connect(&application, finishCheck);
6169 application.SendNotification();
6170 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6172 // We didn't expect the animation to finish yet
6173 application.SendNotification();
6174 finishCheck.CheckSignalNotReceived();
6175 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, fiftyPercentProgress, TEST_LOCATION );
6177 application.SendNotification();
6178 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6180 // We did expect the animation to finish
6181 application.SendNotification();
6182 finishCheck.CheckSignalReceived();
6183 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, targetX, TEST_LOCATION );
6184 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION );
6185 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6186 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6190 int UtcDaliAnimationAnimateToActorPositionYP(void)
6192 TestApplication application;
6194 Actor actor = Actor::New();
6195 Stage::GetCurrent().Add(actor);
6196 float startValue(0.0f);
6197 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, startValue, TEST_LOCATION );
6198 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6199 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6200 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6202 // Build the animation
6203 float durationSeconds(1.0f);
6204 Animation animation = Animation::New(durationSeconds);
6205 float targetY(10.0f);
6206 animation.AnimateTo( Property(actor, Actor::Property::POSITION_Y), targetY );
6208 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
6210 // Start the animation
6213 bool signalReceived(false);
6214 AnimationFinishCheck finishCheck(signalReceived);
6215 animation.FinishedSignal().Connect(&application, finishCheck);
6217 application.SendNotification();
6218 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6220 // We didn't expect the animation to finish yet
6221 application.SendNotification();
6222 finishCheck.CheckSignalNotReceived();
6223 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, fiftyPercentProgress, TEST_LOCATION );
6225 application.SendNotification();
6226 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6228 // We did expect the animation to finish
6229 application.SendNotification();
6230 finishCheck.CheckSignalReceived();
6231 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, targetY, TEST_LOCATION );
6232 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6233 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION );
6234 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6238 int UtcDaliAnimationAnimateToActorPositionZP(void)
6240 TestApplication application;
6242 Actor actor = Actor::New();
6243 Stage::GetCurrent().Add(actor);
6244 float startValue(0.0f);
6245 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, startValue, TEST_LOCATION );
6246 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6247 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6248 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6250 // Build the animation
6251 float durationSeconds(1.0f);
6252 Animation animation = Animation::New(durationSeconds);
6253 float targetZ(-5.0f);
6254 animation.AnimateTo( Property(actor, Actor::Property::POSITION_Z), targetZ );
6256 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
6258 // Start the animation
6261 bool signalReceived(false);
6262 AnimationFinishCheck finishCheck(signalReceived);
6263 animation.FinishedSignal().Connect(&application, finishCheck);
6265 application.SendNotification();
6266 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6268 // We didn't expect the animation to finish yet
6269 application.SendNotification();
6270 finishCheck.CheckSignalNotReceived();
6271 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, fiftyPercentProgress, TEST_LOCATION );
6273 application.SendNotification();
6274 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6276 // We did expect the animation to finish
6277 application.SendNotification();
6278 finishCheck.CheckSignalReceived();
6279 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, targetZ, TEST_LOCATION );
6280 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6281 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6282 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION );
6286 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void)
6288 TestApplication application;
6290 Actor actor = Actor::New();
6291 Stage::GetCurrent().Add(actor);
6292 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6294 // Build the animation
6295 float durationSeconds(1.0f);
6296 Animation animation = Animation::New(durationSeconds);
6297 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6298 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
6300 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6302 // Start the animation
6305 bool signalReceived(false);
6306 AnimationFinishCheck finishCheck(signalReceived);
6307 animation.FinishedSignal().Connect(&application, finishCheck);
6309 application.SendNotification();
6310 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
6312 // We didn't expect the animation to finish yet
6313 application.SendNotification();
6314 finishCheck.CheckSignalNotReceived();
6316 // The position should have moved less, than with a linear alpha function
6317 Vector3 current(actor.GetCurrentPosition());
6318 DALI_TEST_CHECK( current.x > Vector3::ZERO.x );
6319 DALI_TEST_CHECK( current.y > Vector3::ZERO.y );
6320 DALI_TEST_CHECK( current.z > Vector3::ZERO.z );
6321 DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x );
6322 DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y );
6323 DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z );
6325 application.SendNotification();
6326 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6328 // We did expect the animation to finish
6329 application.SendNotification();
6330 finishCheck.CheckSignalReceived();
6331 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6335 int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void)
6337 TestApplication application;
6339 Actor actor = Actor::New();
6340 Stage::GetCurrent().Add(actor);
6341 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6343 // Build the animation
6344 float durationSeconds(1.0f);
6345 Animation animation = Animation::New(durationSeconds);
6346 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6348 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
6350 TimePeriod( delay, durationSeconds - delay ) );
6352 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6354 // Start the animation
6357 bool signalReceived(false);
6358 AnimationFinishCheck finishCheck(signalReceived);
6359 animation.FinishedSignal().Connect(&application, finishCheck);
6361 application.SendNotification();
6362 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6364 // We didn't expect the animation to finish yet
6365 application.SendNotification();
6366 finishCheck.CheckSignalNotReceived();
6367 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6369 application.SendNotification();
6370 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
6372 // We didn't expect the animation to finish yet
6373 application.SendNotification();
6374 finishCheck.CheckSignalNotReceived();
6375 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
6377 application.SendNotification();
6378 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
6380 // We did expect the animation to finish
6381 application.SendNotification();
6382 finishCheck.CheckSignalReceived();
6383 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6387 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void)
6389 TestApplication application;
6391 Actor actor = Actor::New();
6392 Stage::GetCurrent().Add(actor);
6393 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6395 // Build the animation
6396 float durationSeconds(1.0f);
6397 Animation animation = Animation::New(durationSeconds);
6398 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6400 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
6402 AlphaFunction::LINEAR,
6403 TimePeriod( delay, durationSeconds - delay ) );
6405 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6407 // Start the animation
6410 bool signalReceived(false);
6411 AnimationFinishCheck finishCheck(signalReceived);
6412 animation.FinishedSignal().Connect(&application, finishCheck);
6414 application.SendNotification();
6415 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6417 // We didn't expect the animation to finish yet
6418 application.SendNotification();
6419 finishCheck.CheckSignalNotReceived();
6420 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6422 application.SendNotification();
6423 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
6425 // We didn't expect the animation to finish yet
6426 application.SendNotification();
6427 finishCheck.CheckSignalNotReceived();
6428 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
6430 application.SendNotification();
6431 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
6433 // We did expect the animation to finish
6434 application.SendNotification();
6435 finishCheck.CheckSignalReceived();
6436 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6440 int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void)
6442 TestApplication application;
6444 Actor actor = Actor::New();
6445 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
6446 Stage::GetCurrent().Add(actor);
6447 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
6449 // Build the animation
6450 float durationSeconds(1.0f);
6451 Animation animation = Animation::New(durationSeconds);
6452 Degree targetRotationDegrees(90.0f);
6453 Radian targetRotationRadians(targetRotationDegrees);
6454 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS) );
6456 // Start the animation
6459 bool signalReceived(false);
6460 AnimationFinishCheck finishCheck(signalReceived);
6461 animation.FinishedSignal().Connect(&application, finishCheck);
6463 application.SendNotification();
6464 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6466 // We didn't expect the animation to finish yet
6467 application.SendNotification();
6468 finishCheck.CheckSignalNotReceived();
6469 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6471 application.SendNotification();
6472 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6474 // We didn't expect the animation to finish yet
6475 application.SendNotification();
6476 finishCheck.CheckSignalNotReceived();
6477 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6479 application.SendNotification();
6480 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6482 // We didn't expect the animation to finish yet
6483 application.SendNotification();
6484 finishCheck.CheckSignalNotReceived();
6485 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6487 application.SendNotification();
6488 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6490 // We did expect the animation to finish
6491 application.SendNotification();
6492 finishCheck.CheckSignalReceived();
6493 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6497 int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void)
6499 TestApplication application;
6501 Actor actor = Actor::New();
6502 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
6503 Stage::GetCurrent().Add(actor);
6504 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
6506 // Build the animation
6507 float durationSeconds(1.0f);
6508 Animation animation = Animation::New(durationSeconds);
6509 Degree targetRotationDegrees(90.0f);
6510 Radian targetRotationRadians(targetRotationDegrees);
6511 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
6512 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), targetRotation );
6514 // Start the animation
6517 bool signalReceived(false);
6518 AnimationFinishCheck finishCheck(signalReceived);
6519 animation.FinishedSignal().Connect(&application, finishCheck);
6521 application.SendNotification();
6522 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6524 // We didn't expect the animation to finish yet
6525 application.SendNotification();
6526 finishCheck.CheckSignalNotReceived();
6527 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6529 application.SendNotification();
6530 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6532 // We didn't expect the animation to finish yet
6533 application.SendNotification();
6534 finishCheck.CheckSignalNotReceived();
6535 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6537 application.SendNotification();
6538 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6540 // We didn't expect the animation to finish yet
6541 application.SendNotification();
6542 finishCheck.CheckSignalNotReceived();
6543 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6545 application.SendNotification();
6546 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6548 // We did expect the animation to finish
6549 application.SendNotification();
6550 finishCheck.CheckSignalReceived();
6551 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6555 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void)
6557 TestApplication application;
6559 Actor actor = Actor::New();
6560 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
6561 Stage::GetCurrent().Add(actor);
6562 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6564 // Build the animation
6565 float durationSeconds(1.0f);
6566 Animation animation = Animation::New(durationSeconds);
6567 Degree targetRotationDegrees(90.0f);
6568 Radian targetRotationRadians(targetRotationDegrees);
6569 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
6571 // Start the animation
6574 bool signalReceived(false);
6575 AnimationFinishCheck finishCheck(signalReceived);
6576 animation.FinishedSignal().Connect(&application, finishCheck);
6578 application.SendNotification();
6579 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6581 // We didn't expect the animation to finish yet
6582 application.SendNotification();
6583 finishCheck.CheckSignalNotReceived();
6584 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6586 application.SendNotification();
6587 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6589 // We didn't expect the animation to finish yet
6590 application.SendNotification();
6591 finishCheck.CheckSignalNotReceived();
6592 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6594 application.SendNotification();
6595 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6597 // We didn't expect the animation to finish yet
6598 application.SendNotification();
6599 finishCheck.CheckSignalNotReceived();
6600 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6602 application.SendNotification();
6603 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6605 // We did expect the animation to finish
6606 application.SendNotification();
6607 finishCheck.CheckSignalReceived();
6608 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6612 int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void)
6614 TestApplication application;
6616 Actor actor = Actor::New();
6617 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
6618 Stage::GetCurrent().Add(actor);
6619 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
6621 // Build the animation
6622 float durationSeconds(1.0f);
6623 Animation animation = Animation::New(durationSeconds);
6624 Degree targetRotationDegrees(90.0f);
6625 Radian targetRotationRadians(targetRotationDegrees);
6627 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
6629 // Start the animation
6632 bool signalReceived(false);
6633 AnimationFinishCheck finishCheck(signalReceived);
6634 animation.FinishedSignal().Connect(&application, finishCheck);
6636 application.SendNotification();
6637 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6639 // We didn't expect the animation to finish yet
6640 application.SendNotification();
6641 finishCheck.CheckSignalNotReceived();
6642 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
6643 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6645 application.SendNotification();
6646 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6648 // We didn't expect the animation to finish yet
6649 application.SendNotification();
6650 finishCheck.CheckSignalNotReceived();
6651 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
6652 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6654 application.SendNotification();
6655 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6657 // We didn't expect the animation to finish yet
6658 application.SendNotification();
6659 finishCheck.CheckSignalNotReceived();
6660 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
6661 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6663 application.SendNotification();
6664 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6666 // We did expect the animation to finish
6667 application.SendNotification();
6668 finishCheck.CheckSignalReceived();
6669 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6673 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void)
6675 TestApplication application;
6677 Actor actor = Actor::New();
6678 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
6679 Stage::GetCurrent().Add(actor);
6680 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
6682 // Build the animation
6683 float durationSeconds(1.0f);
6684 Animation animation = Animation::New(durationSeconds);
6685 Degree targetRotationDegrees(90.0f);
6686 Radian targetRotationRadians(targetRotationDegrees);
6688 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
6690 // Start the animation
6693 bool signalReceived(false);
6694 AnimationFinishCheck finishCheck(signalReceived);
6695 animation.FinishedSignal().Connect(&application, finishCheck);
6697 application.SendNotification();
6698 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6700 // We didn't expect the animation to finish yet
6701 application.SendNotification();
6702 finishCheck.CheckSignalNotReceived();
6703 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
6704 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6706 application.SendNotification();
6707 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6709 // We didn't expect the animation to finish yet
6710 application.SendNotification();
6711 finishCheck.CheckSignalNotReceived();
6712 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
6713 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6715 application.SendNotification();
6716 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6718 // We didn't expect the animation to finish yet
6719 application.SendNotification();
6720 finishCheck.CheckSignalNotReceived();
6721 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
6722 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6724 application.SendNotification();
6725 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6727 // We did expect the animation to finish
6728 application.SendNotification();
6729 finishCheck.CheckSignalReceived();
6730 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6734 int UtcDaliAnimationAnimateToActorScaleP(void)
6736 TestApplication application;
6738 Actor actor = Actor::New();
6739 Stage::GetCurrent().Add(actor);
6740 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
6742 // Build the animation
6743 float durationSeconds(1.0f);
6744 Animation animation = Animation::New(durationSeconds);
6745 Vector3 targetScale(2.0f, 2.0f, 2.0f);
6746 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale );
6748 Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f);
6750 // Start the animation
6753 bool signalReceived(false);
6754 AnimationFinishCheck finishCheck(signalReceived);
6755 animation.FinishedSignal().Connect(&application, finishCheck);
6757 application.SendNotification();
6758 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6760 // We didn't expect the animation to finish yet
6761 application.SendNotification();
6762 finishCheck.CheckSignalNotReceived();
6763 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
6765 application.SendNotification();
6766 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6768 // We did expect the animation to finish
6769 application.SendNotification();
6770 finishCheck.CheckSignalReceived();
6771 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
6774 finishCheck.Reset();
6775 actor.SetScale(Vector3::ONE);
6776 application.SendNotification();
6777 application.Render(0);
6778 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
6780 // Repeat with a different (ease-in) alpha function
6781 animation = Animation::New(durationSeconds);
6782 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
6783 animation.FinishedSignal().Connect(&application, finishCheck);
6786 application.SendNotification();
6787 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6789 // We didn't expect the animation to finish yet
6790 application.SendNotification();
6791 finishCheck.CheckSignalNotReceived();
6793 // The scale should have grown less, than with a linear alpha function
6794 Vector3 current(actor.GetCurrentScale());
6795 DALI_TEST_CHECK( current.x > 1.0f );
6796 DALI_TEST_CHECK( current.y > 1.0f );
6797 DALI_TEST_CHECK( current.z > 1.0f );
6798 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
6799 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
6800 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
6802 application.SendNotification();
6803 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6805 // We did expect the animation to finish
6806 application.SendNotification();
6807 finishCheck.CheckSignalReceived();
6808 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
6811 finishCheck.Reset();
6812 actor.SetScale(Vector3::ONE);
6813 application.SendNotification();
6814 application.Render(0);
6815 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
6817 // Repeat with a delay
6819 animation = Animation::New(durationSeconds);
6820 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
6821 animation.FinishedSignal().Connect(&application, finishCheck);
6824 application.SendNotification();
6825 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6827 // We didn't expect the animation to finish yet
6828 application.SendNotification();
6829 finishCheck.CheckSignalNotReceived();
6830 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
6832 application.SendNotification();
6833 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6835 // We did expect the animation to finish
6836 application.SendNotification();
6837 finishCheck.CheckSignalReceived();
6838 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
6842 int UtcDaliAnimationAnimateToActorScaleXP(void)
6844 TestApplication application;
6846 Actor actor = Actor::New();
6847 Stage::GetCurrent().Add(actor);
6848 float startValue(1.0f);
6849 DALI_TEST_EQUALS( actor.GetCurrentScale().x, startValue, TEST_LOCATION );
6850 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
6851 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
6852 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
6854 // Build the animation
6855 float durationSeconds(1.0f);
6856 Animation animation = Animation::New(durationSeconds);
6857 float targetX(10.0f);
6858 animation.AnimateTo( Property(actor, Actor::Property::SCALE_X), targetX );
6860 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
6862 // Start the animation
6865 bool signalReceived(false);
6866 AnimationFinishCheck finishCheck(signalReceived);
6867 animation.FinishedSignal().Connect(&application, finishCheck);
6869 application.SendNotification();
6870 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6872 // We didn't expect the animation to finish yet
6873 application.SendNotification();
6874 finishCheck.CheckSignalNotReceived();
6875 DALI_TEST_EQUALS( actor.GetCurrentScale().x, fiftyPercentProgress, TEST_LOCATION );
6876 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), fiftyPercentProgress, TEST_LOCATION );
6877 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
6878 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
6880 application.SendNotification();
6881 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6883 // We did expect the animation to finish
6884 application.SendNotification();
6885 finishCheck.CheckSignalReceived();
6886 DALI_TEST_EQUALS( actor.GetCurrentScale().x, targetX, TEST_LOCATION );
6887 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), targetX, TEST_LOCATION );
6888 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
6889 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
6893 int UtcDaliAnimationAnimateToActorScaleYP(void)
6895 TestApplication application;
6897 Actor actor = Actor::New();
6898 Stage::GetCurrent().Add(actor);
6899 float startValue(1.0f);
6900 DALI_TEST_EQUALS( actor.GetCurrentScale().y, startValue, TEST_LOCATION );
6901 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
6902 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
6903 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
6905 // Build the animation
6906 float durationSeconds(1.0f);
6907 Animation animation = Animation::New(durationSeconds);
6908 float targetY(1000.0f);
6909 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Y), targetY );
6911 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
6913 // Start the animation
6916 bool signalReceived(false);
6917 AnimationFinishCheck finishCheck(signalReceived);
6918 animation.FinishedSignal().Connect(&application, finishCheck);
6920 application.SendNotification();
6921 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6923 // We didn't expect the animation to finish yet
6924 application.SendNotification();
6925 finishCheck.CheckSignalNotReceived();
6926 DALI_TEST_EQUALS( actor.GetCurrentScale().y, fiftyPercentProgress, TEST_LOCATION );
6927 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
6928 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), fiftyPercentProgress, TEST_LOCATION );
6929 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
6931 application.SendNotification();
6932 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6934 // We did expect the animation to finish
6935 application.SendNotification();
6936 finishCheck.CheckSignalReceived();
6937 DALI_TEST_EQUALS( actor.GetCurrentScale().y, targetY, TEST_LOCATION );
6938 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
6939 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), targetY, TEST_LOCATION );
6940 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
6944 int UtcDaliAnimationAnimateToActorScaleZP(void)
6946 TestApplication application;
6948 Actor actor = Actor::New();
6949 Stage::GetCurrent().Add(actor);
6950 float startValue(1.0f);
6951 DALI_TEST_EQUALS( actor.GetCurrentScale().z, startValue, TEST_LOCATION );
6952 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
6953 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
6954 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
6956 // Build the animation
6957 float durationSeconds(1.0f);
6958 Animation animation = Animation::New(durationSeconds);
6959 float targetZ(-1000.0f);
6960 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Z), targetZ );
6962 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
6964 // Start the animation
6967 bool signalReceived(false);
6968 AnimationFinishCheck finishCheck(signalReceived);
6969 animation.FinishedSignal().Connect(&application, finishCheck);
6971 application.SendNotification();
6972 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6974 // We didn't expect the animation to finish yet
6975 application.SendNotification();
6976 finishCheck.CheckSignalNotReceived();
6977 DALI_TEST_EQUALS( actor.GetCurrentScale().z, fiftyPercentProgress, TEST_LOCATION );
6978 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
6979 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
6980 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), fiftyPercentProgress, TEST_LOCATION );
6982 application.SendNotification();
6983 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6985 // We did expect the animation to finish
6986 application.SendNotification();
6987 finishCheck.CheckSignalReceived();
6988 DALI_TEST_EQUALS( actor.GetCurrentScale().z, targetZ, TEST_LOCATION );
6989 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
6990 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
6991 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), targetZ, TEST_LOCATION );
6995 int UtcDaliAnimationAnimateToActorColorP(void)
6997 TestApplication application;
6999 Actor actor = Actor::New();
7000 Stage::GetCurrent().Add(actor);
7001 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7003 // Build the animation
7004 float durationSeconds(1.0f);
7005 Animation animation = Animation::New(durationSeconds);
7006 Vector4 targetColor(Color::RED);
7007 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor );
7009 Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
7010 Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
7012 // Start the animation
7015 bool signalReceived(false);
7016 AnimationFinishCheck finishCheck(signalReceived);
7017 animation.FinishedSignal().Connect(&application, finishCheck);
7019 application.SendNotification();
7020 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7022 // We didn't expect the animation to finish yet
7023 application.SendNotification();
7024 finishCheck.CheckSignalNotReceived();
7025 DALI_TEST_EQUALS( actor.GetCurrentColor(), tenPercentProgress, TEST_LOCATION );
7027 application.SendNotification();
7028 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7030 // We did expect the animation to finish
7031 application.SendNotification();
7032 finishCheck.CheckSignalReceived();
7033 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7036 finishCheck.Reset();
7037 actor.SetColor(Color::WHITE);
7038 application.SendNotification();
7039 application.Render(0);
7040 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7042 // Repeat with a different (ease-in) alpha function
7043 animation = Animation::New(durationSeconds);
7044 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
7045 animation.FinishedSignal().Connect(&application, finishCheck);
7048 application.SendNotification();
7049 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7051 // We didn't expect the animation to finish yet
7052 application.SendNotification();
7053 finishCheck.CheckSignalNotReceived();
7055 // The color should have changed less, than with a linear alpha function
7056 Vector4 current(actor.GetCurrentColor());
7057 DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change
7058 DALI_TEST_CHECK( current.y < 1.0f );
7059 DALI_TEST_CHECK( current.y > tenPercentProgress.y );
7060 DALI_TEST_CHECK( current.z < 1.0f );
7061 DALI_TEST_CHECK( current.z > tenPercentProgress.z );
7062 DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
7064 application.SendNotification();
7065 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7067 // We did expect the animation to finish
7068 application.SendNotification();
7069 finishCheck.CheckSignalReceived();
7070 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7073 finishCheck.Reset();
7074 actor.SetColor(Color::WHITE);
7075 application.SendNotification();
7076 application.Render(0);
7077 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7079 // Repeat with a shorter animator duration
7080 float animatorDuration = 0.5f;
7081 animation = Animation::New(durationSeconds);
7082 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
7083 animation.FinishedSignal().Connect(&application, finishCheck);
7086 application.SendNotification();
7087 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
7089 // We didn't expect the animation to finish yet
7090 application.SendNotification();
7091 finishCheck.CheckSignalNotReceived();
7092 DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION );
7094 application.SendNotification();
7095 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
7097 // We didn't expect the animation to finish yet
7098 application.SendNotification();
7099 finishCheck.CheckSignalNotReceived();
7100 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7102 application.SendNotification();
7103 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7105 // We did expect the animation to finish
7106 application.SendNotification();
7107 finishCheck.CheckSignalReceived();
7108 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7112 int UtcDaliAnimationAnimateToActorColorRedP(void)
7114 TestApplication application;
7116 Actor actor = Actor::New();
7117 Stage::GetCurrent().Add(actor);
7118 float startValue(1.0f);
7119 DALI_TEST_EQUALS( actor.GetCurrentColor().r, startValue, TEST_LOCATION );
7120 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7121 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7122 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7123 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7125 // Build the animation
7126 float durationSeconds(1.0f);
7127 Animation animation = Animation::New(durationSeconds);
7128 float targetRed(0.5f);
7129 animation.AnimateTo( Property(actor, Actor::Property::COLOR_RED), targetRed );
7131 float fiftyPercentProgress(startValue + (targetRed - startValue)*0.5f);
7133 // Start the animation
7136 bool signalReceived(false);
7137 AnimationFinishCheck finishCheck(signalReceived);
7138 animation.FinishedSignal().Connect(&application, finishCheck);
7140 application.SendNotification();
7141 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7143 // We didn't expect the animation to finish yet
7144 application.SendNotification();
7145 finishCheck.CheckSignalNotReceived();
7146 DALI_TEST_EQUALS( actor.GetCurrentColor().r, fiftyPercentProgress, TEST_LOCATION );
7147 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION );
7148 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7149 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7150 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7152 application.SendNotification();
7153 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7155 // We did expect the animation to finish
7156 application.SendNotification();
7157 finishCheck.CheckSignalReceived();
7158 DALI_TEST_EQUALS( actor.GetCurrentColor().r, targetRed, TEST_LOCATION );
7159 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), targetRed, TEST_LOCATION );
7160 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7161 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7162 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7166 int UtcDaliAnimationAnimateToActorColorGreenP(void)
7168 TestApplication application;
7170 Actor actor = Actor::New();
7171 Stage::GetCurrent().Add(actor);
7172 float startValue(1.0f);
7173 DALI_TEST_EQUALS( actor.GetCurrentColor().g, startValue, TEST_LOCATION );
7174 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7175 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7176 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7177 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7179 // Build the animation
7180 float durationSeconds(1.0f);
7181 Animation animation = Animation::New(durationSeconds);
7182 float targetGreen(0.5f);
7183 animation.AnimateTo( Property(actor, Actor::Property::COLOR_GREEN), targetGreen );
7185 float fiftyPercentProgress(startValue + (targetGreen - startValue)*0.5f);
7187 // Start the animation
7190 bool signalReceived(false);
7191 AnimationFinishCheck finishCheck(signalReceived);
7192 animation.FinishedSignal().Connect(&application, finishCheck);
7194 application.SendNotification();
7195 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7197 // We didn't expect the animation to finish yet
7198 application.SendNotification();
7199 finishCheck.CheckSignalNotReceived();
7200 DALI_TEST_EQUALS( actor.GetCurrentColor().g, fiftyPercentProgress, TEST_LOCATION );
7201 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7202 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION );
7203 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7204 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7206 application.SendNotification();
7207 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7209 // We did expect the animation to finish
7210 application.SendNotification();
7211 finishCheck.CheckSignalReceived();
7212 DALI_TEST_EQUALS( actor.GetCurrentColor().g, targetGreen, TEST_LOCATION );
7213 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7214 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION );
7215 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7216 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7220 int UtcDaliAnimationAnimateToActorColorBlueP(void)
7222 TestApplication application;
7224 Actor actor = Actor::New();
7225 Stage::GetCurrent().Add(actor);
7226 float startValue(1.0f);
7227 DALI_TEST_EQUALS( actor.GetCurrentColor().b, startValue, TEST_LOCATION );
7228 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7229 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7230 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7231 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7233 // Build the animation
7234 float durationSeconds(1.0f);
7235 Animation animation = Animation::New(durationSeconds);
7236 float targetBlue(0.5f);
7237 animation.AnimateTo( Property(actor, Actor::Property::COLOR_BLUE), targetBlue );
7239 float fiftyPercentProgress(startValue + (targetBlue - startValue)*0.5f);
7241 // Start the animation
7244 bool signalReceived(false);
7245 AnimationFinishCheck finishCheck(signalReceived);
7246 animation.FinishedSignal().Connect(&application, finishCheck);
7248 application.SendNotification();
7249 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7251 // We didn't expect the animation to finish yet
7252 application.SendNotification();
7253 finishCheck.CheckSignalNotReceived();
7254 DALI_TEST_EQUALS( actor.GetCurrentColor().b, fiftyPercentProgress, TEST_LOCATION );
7255 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7256 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7257 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), fiftyPercentProgress, TEST_LOCATION );
7258 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7260 application.SendNotification();
7261 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7263 // We did expect the animation to finish
7264 application.SendNotification();
7265 finishCheck.CheckSignalReceived();
7266 DALI_TEST_EQUALS( actor.GetCurrentColor().b, targetBlue, TEST_LOCATION );
7267 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7268 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7269 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetBlue, TEST_LOCATION );
7270 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7274 int UtcDaliAnimationAnimateToActorColorAlphaP(void)
7276 TestApplication application;
7278 Actor actor = Actor::New();
7279 Stage::GetCurrent().Add(actor);
7280 float startValue(1.0f);
7281 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7282 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7283 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7284 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7285 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7287 // Build the animation
7288 float durationSeconds(1.0f);
7289 Animation animation = Animation::New(durationSeconds);
7290 float targetAlpha(0.5f);
7291 animation.AnimateTo( Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha );
7293 float fiftyPercentProgress(startValue + (targetAlpha - startValue)*0.5f);
7295 // Start the animation
7298 bool signalReceived(false);
7299 AnimationFinishCheck finishCheck(signalReceived);
7300 animation.FinishedSignal().Connect(&application, finishCheck);
7302 application.SendNotification();
7303 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7305 // We didn't expect the animation to finish yet
7306 application.SendNotification();
7307 finishCheck.CheckSignalNotReceived();
7308 DALI_TEST_EQUALS( actor.GetCurrentColor().a, fiftyPercentProgress, TEST_LOCATION );
7309 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7310 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7311 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7312 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), fiftyPercentProgress, TEST_LOCATION );
7314 application.SendNotification();
7315 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7317 // We did expect the animation to finish
7318 application.SendNotification();
7319 finishCheck.CheckSignalReceived();
7320 DALI_TEST_EQUALS( actor.GetCurrentColor().a, targetAlpha, TEST_LOCATION );
7321 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7322 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7323 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7324 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetAlpha, TEST_LOCATION );
7328 int UtcDaliAnimationKeyFrames01P(void)
7330 TestApplication application;
7332 KeyFrames keyFrames = KeyFrames::New();
7333 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7335 keyFrames.Add(0.0f, 0.1f);
7337 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
7339 KeyFrames keyFrames2( keyFrames);
7340 DALI_TEST_CHECK( keyFrames2 );
7341 DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
7343 KeyFrames keyFrames3 = KeyFrames::New();
7344 keyFrames3.Add(0.6f, true);
7345 DALI_TEST_CHECK( keyFrames3 );
7346 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
7348 keyFrames3 = keyFrames;
7349 DALI_TEST_CHECK( keyFrames3 );
7350 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
7355 int UtcDaliAnimationKeyFrames02P(void)
7357 TestApplication application;
7359 KeyFrames keyFrames = KeyFrames::New();
7360 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7362 keyFrames.Add(0.0f, 0.1f);
7363 keyFrames.Add(0.2f, 0.5f);
7364 keyFrames.Add(0.4f, 0.0f);
7365 keyFrames.Add(0.6f, 1.0f);
7366 keyFrames.Add(0.8f, 0.7f);
7367 keyFrames.Add(1.0f, 0.9f);
7369 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
7373 keyFrames.Add(1.9f, false);
7375 catch (Dali::DaliException& e)
7377 DALI_TEST_PRINT_ASSERT( e );
7378 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
7383 int UtcDaliAnimationKeyFrames03P(void)
7385 TestApplication application;
7387 KeyFrames keyFrames = KeyFrames::New();
7388 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7390 keyFrames.Add(0.0f, true);
7391 keyFrames.Add(0.2f, false);
7392 keyFrames.Add(0.4f, false);
7393 keyFrames.Add(0.6f, true);
7394 keyFrames.Add(0.8f, true);
7395 keyFrames.Add(1.0f, false);
7397 DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
7401 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
7403 catch (Dali::DaliException& e)
7405 DALI_TEST_PRINT_ASSERT( e );
7406 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
7411 int UtcDaliAnimationKeyFrames04P(void)
7413 TestApplication application;
7415 KeyFrames keyFrames = KeyFrames::New();
7416 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7418 keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
7419 keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
7420 keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
7421 keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
7422 keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
7423 keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
7425 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
7429 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
7431 catch (Dali::DaliException& e)
7433 DALI_TEST_PRINT_ASSERT( e );
7434 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
7439 int UtcDaliAnimationKeyFrames05P(void)
7441 TestApplication application;
7443 KeyFrames keyFrames = KeyFrames::New();
7444 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7446 keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
7447 keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
7448 keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
7449 keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
7450 keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
7451 keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
7453 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
7457 keyFrames.Add(0.7f, 1.0f);
7459 catch (Dali::DaliException& e)
7461 DALI_TEST_PRINT_ASSERT( e );
7462 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
7467 int UtcDaliAnimationKeyFrames06P(void)
7469 TestApplication application;
7471 KeyFrames keyFrames = KeyFrames::New();
7472 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7474 keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
7475 keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
7476 keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
7477 keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
7478 keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
7479 keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
7481 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
7485 keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
7487 catch (Dali::DaliException& e)
7489 DALI_TEST_PRINT_ASSERT( e );
7490 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
7495 int UtcDaliAnimationKeyFrames07P(void)
7497 TestApplication application;
7499 KeyFrames keyFrames = KeyFrames::New();
7500 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7502 keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
7503 keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
7504 keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
7505 keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
7506 keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
7507 keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
7509 DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
7513 keyFrames.Add(0.7f, 1.1f);
7515 catch (Dali::DaliException& e)
7517 DALI_TEST_PRINT_ASSERT( e );
7518 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
7523 int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
7525 TestApplication application;
7527 float startValue(1.0f);
7528 Actor actor = Actor::New();
7529 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
7530 Stage::GetCurrent().Add(actor);
7532 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7533 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7534 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7535 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7536 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7538 // Build the animation
7539 float durationSeconds(1.0f);
7540 Animation animation = Animation::New(durationSeconds);
7542 KeyFrames keyFrames = KeyFrames::New();
7543 keyFrames.Add(0.0f, 0.1f);
7544 keyFrames.Add(0.2f, 0.5f);
7545 keyFrames.Add(0.4f, 0.0f);
7546 keyFrames.Add(0.6f, 1.0f);
7547 keyFrames.Add(0.8f, 0.7f);
7548 keyFrames.Add(1.0f, 0.9f);
7550 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames );
7552 // Start the animation
7555 bool signalReceived(false);
7556 AnimationFinishCheck finishCheck(signalReceived);
7557 animation.FinishedSignal().Connect(&application, finishCheck);
7558 application.SendNotification();
7559 application.Render(0);
7560 application.SendNotification();
7561 finishCheck.CheckSignalNotReceived();
7562 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
7564 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7565 application.SendNotification();
7566 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7567 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7568 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7569 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION );
7570 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.3f, 0.01f, TEST_LOCATION );
7572 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
7573 application.SendNotification();
7574 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7575 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7576 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7577 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION );
7578 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.25f, 0.01f, TEST_LOCATION );
7580 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
7581 application.SendNotification();
7582 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7583 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7584 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7585 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
7586 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
7588 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
7589 application.SendNotification();
7590 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7591 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7592 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7593 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
7594 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
7596 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
7597 application.SendNotification();
7598 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7599 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7600 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7601 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION );
7602 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.8f, 0.01f, TEST_LOCATION );
7604 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
7605 application.SendNotification();
7606 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7607 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7608 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7609 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
7610 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
7612 // We did expect the animation to finish
7614 finishCheck.CheckSignalReceived();
7618 int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
7620 TestApplication application;
7622 float startValue(1.0f);
7623 Actor actor = Actor::New();
7624 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
7625 Stage::GetCurrent().Add(actor);
7627 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7628 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7629 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7630 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7631 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7633 // Build the animation
7634 float durationSeconds(1.0f);
7635 Animation animation = Animation::New(durationSeconds);
7637 KeyFrames keyFrames = KeyFrames::New();
7638 keyFrames.Add(0.0f, 0.1f);
7639 keyFrames.Add(0.2f, 0.5f);
7640 keyFrames.Add(0.4f, 0.0f);
7641 keyFrames.Add(0.6f, 1.0f);
7642 keyFrames.Add(0.8f, 0.7f);
7643 keyFrames.Add(1.0f, 0.9f);
7645 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::Cubic );
7647 // Start the animation
7650 bool signalReceived(false);
7651 AnimationFinishCheck finishCheck(signalReceived);
7652 animation.FinishedSignal().Connect(&application, finishCheck);
7653 application.SendNotification();
7654 application.Render(0);
7655 application.SendNotification();
7656 finishCheck.CheckSignalNotReceived();
7657 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
7659 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7660 application.SendNotification();
7661 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7662 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7663 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7664 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.36f, 0.01f, TEST_LOCATION );
7665 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.36f, 0.01f, TEST_LOCATION );
7667 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
7668 application.SendNotification();
7669 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7670 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7671 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7672 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.21f, 0.01f, TEST_LOCATION );
7673 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.21f, 0.01f, TEST_LOCATION );
7675 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
7676 application.SendNotification();
7677 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7678 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7679 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7680 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
7681 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
7683 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
7684 application.SendNotification();
7685 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7686 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7687 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7688 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
7689 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
7691 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
7692 application.SendNotification();
7693 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7694 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7695 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7696 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.76f, 0.01f, TEST_LOCATION );
7697 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.76f, 0.01f, TEST_LOCATION );
7699 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
7700 application.SendNotification();
7701 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7702 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7703 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7704 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
7705 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
7707 // We did expect the animation to finish
7709 finishCheck.CheckSignalReceived();
7713 int UtcDaliAnimationAnimateBetweenActorColorP(void)
7715 TestApplication application;
7717 float startValue(1.0f);
7718 Actor actor = Actor::New();
7719 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
7720 Stage::GetCurrent().Add(actor);
7722 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7723 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7724 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7725 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7726 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7728 // Build the animation
7729 float durationSeconds(1.0f);
7730 Animation animation = Animation::New(durationSeconds);
7732 KeyFrames keyFrames = KeyFrames::New();
7733 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
7734 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
7735 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
7737 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames );
7739 // Start the animation
7742 bool signalReceived(false);
7743 AnimationFinishCheck finishCheck(signalReceived);
7744 animation.FinishedSignal().Connect(&application, finishCheck);
7745 application.SendNotification();
7746 application.Render(0);
7747 application.SendNotification();
7748 finishCheck.CheckSignalNotReceived();
7749 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
7750 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
7751 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
7752 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
7754 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7755 application.SendNotification();
7756 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
7757 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
7758 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
7759 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
7761 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7762 application.SendNotification();
7763 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
7764 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
7765 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
7766 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
7768 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7769 application.SendNotification();
7770 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
7771 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
7772 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
7773 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
7775 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
7776 application.SendNotification();
7777 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
7778 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
7779 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
7780 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
7782 // We did expect the animation to finish
7784 finishCheck.CheckSignalReceived();
7788 int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
7790 TestApplication application;
7792 float startValue(1.0f);
7793 Actor actor = Actor::New();
7794 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
7795 Stage::GetCurrent().Add(actor);
7797 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7798 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7799 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7800 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7801 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7803 // Build the animation
7804 float durationSeconds(1.0f);
7805 Animation animation = Animation::New(durationSeconds);
7807 KeyFrames keyFrames = KeyFrames::New();
7808 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
7809 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
7810 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
7812 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, Animation::Cubic );
7814 // Start the animation
7817 bool signalReceived(false);
7818 AnimationFinishCheck finishCheck(signalReceived);
7819 animation.FinishedSignal().Connect(&application, finishCheck);
7820 application.SendNotification();
7821 application.Render(0);
7822 application.SendNotification();
7823 finishCheck.CheckSignalNotReceived();
7824 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
7825 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
7826 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
7827 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
7829 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7830 application.SendNotification();
7831 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION );
7832 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
7833 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION );
7834 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
7836 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7837 application.SendNotification();
7838 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
7839 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
7840 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
7841 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
7843 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7844 application.SendNotification();
7845 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION );
7846 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
7847 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION );
7848 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
7850 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
7851 application.SendNotification();
7852 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
7853 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
7854 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
7855 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
7857 // We did expect the animation to finish
7859 finishCheck.CheckSignalReceived();
7863 int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
7865 TestApplication application;
7867 Actor actor = Actor::New();
7868 AngleAxis aa(Degree(90), Vector3::XAXIS);
7869 actor.SetOrientation(aa.angle, aa.axis);
7870 Stage::GetCurrent().Add(actor);
7872 application.SendNotification();
7873 application.Render(0);
7875 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
7877 // Build the animation
7878 float durationSeconds(1.0f);
7879 Animation animation = Animation::New(durationSeconds);
7881 KeyFrames keyFrames = KeyFrames::New();
7882 keyFrames.Add(0.0f, false);
7883 keyFrames.Add(0.2f, true);
7884 keyFrames.Add(0.4f, true);
7885 keyFrames.Add(0.8f, false);
7886 keyFrames.Add(1.0f, true);
7888 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames );
7890 // Start the animation
7893 bool signalReceived(false);
7894 AnimationFinishCheck finishCheck(signalReceived);
7895 animation.FinishedSignal().Connect(&application, finishCheck);
7896 application.SendNotification();
7897 application.SendNotification();
7898 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
7899 application.SendNotification();
7900 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
7901 application.SendNotification();
7903 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
7904 finishCheck.CheckSignalReceived();
7908 int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
7910 TestApplication application;
7912 Actor actor = Actor::New();
7913 AngleAxis aa(Degree(90), Vector3::XAXIS);
7914 actor.SetOrientation(aa.angle, aa.axis);
7915 Stage::GetCurrent().Add(actor);
7917 application.SendNotification();
7918 application.Render(0);
7920 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
7922 // Build the animation
7923 float durationSeconds(1.0f);
7924 Animation animation = Animation::New(durationSeconds);
7926 KeyFrames keyFrames = KeyFrames::New();
7927 keyFrames.Add(0.0f, false);
7928 keyFrames.Add(0.2f, true);
7929 keyFrames.Add(0.4f, true);
7930 keyFrames.Add(0.8f, false);
7931 keyFrames.Add(1.0f, true);
7933 //Cubic interpolation for boolean values should be ignored
7934 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::Cubic );
7936 // Start the animation
7939 bool signalReceived(false);
7940 AnimationFinishCheck finishCheck(signalReceived);
7941 animation.FinishedSignal().Connect(&application, finishCheck);
7942 application.SendNotification();
7943 application.SendNotification();
7944 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
7945 application.SendNotification();
7946 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
7947 application.SendNotification();
7949 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
7950 finishCheck.CheckSignalReceived();
7954 int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
7956 TestApplication application;
7958 Actor actor = Actor::New();
7959 AngleAxis aa(Degree(90), Vector3::XAXIS);
7960 actor.SetOrientation(aa.angle, aa.axis);
7961 Stage::GetCurrent().Add(actor);
7963 application.SendNotification();
7964 application.Render(0);
7965 Quaternion start(Radian(aa.angle), aa.axis);
7966 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
7968 // Build the animation
7969 float durationSeconds(1.0f);
7970 Animation animation = Animation::New(durationSeconds);
7972 KeyFrames keyFrames = KeyFrames::New();
7973 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
7975 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
7977 // Start the animation
7980 bool signalReceived(false);
7981 AnimationFinishCheck finishCheck(signalReceived);
7982 animation.FinishedSignal().Connect(&application, finishCheck);
7983 application.SendNotification();
7984 application.SendNotification();
7985 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
7986 application.SendNotification();
7987 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
7988 application.SendNotification();
7990 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
7992 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
7993 finishCheck.CheckSignalReceived();
7997 int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
7999 TestApplication application;
8001 Actor actor = Actor::New();
8002 AngleAxis aa(Degree(90), Vector3::XAXIS);
8003 actor.SetOrientation(aa.angle, aa.axis);
8004 application.SendNotification();
8005 application.Render(0);
8006 Stage::GetCurrent().Add(actor);
8008 Quaternion start(Radian(aa.angle), aa.axis);
8009 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8011 // Build the animation
8012 float durationSeconds(1.0f);
8013 Animation animation = Animation::New(durationSeconds);
8015 KeyFrames keyFrames = KeyFrames::New();
8016 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
8017 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
8018 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
8020 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
8022 // Start the animation
8025 bool signalReceived(false);
8026 AnimationFinishCheck finishCheck(signalReceived);
8027 animation.FinishedSignal().Connect(&application, finishCheck);
8028 application.SendNotification();
8029 application.Render(0);
8030 application.SendNotification();
8031 finishCheck.CheckSignalNotReceived();
8033 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
8034 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8036 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8037 application.SendNotification();
8038 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
8039 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8041 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8042 application.SendNotification();
8043 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
8044 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8046 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8047 application.SendNotification();
8048 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f) );
8049 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8051 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8052 application.SendNotification();
8053 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
8054 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8056 // We did expect the animation to finish
8058 finishCheck.CheckSignalReceived();
8062 int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
8064 TestApplication application;
8066 Actor actor = Actor::New();
8067 AngleAxis aa(Degree(90), Vector3::XAXIS);
8068 actor.SetOrientation(aa.angle, aa.axis);
8069 Stage::GetCurrent().Add(actor);
8071 application.SendNotification();
8072 application.Render(0);
8073 Quaternion start(Radian(aa.angle), aa.axis);
8074 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8076 // Build the animation
8077 float durationSeconds(1.0f);
8078 Animation animation = Animation::New(durationSeconds);
8080 KeyFrames keyFrames = KeyFrames::New();
8081 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
8083 //Cubic interpolation should be ignored for quaternions
8084 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
8086 // Start the animation
8089 bool signalReceived(false);
8090 AnimationFinishCheck finishCheck(signalReceived);
8091 animation.FinishedSignal().Connect(&application, finishCheck);
8092 application.SendNotification();
8093 application.SendNotification();
8094 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8095 application.SendNotification();
8096 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8097 application.SendNotification();
8099 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
8101 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8102 finishCheck.CheckSignalReceived();
8106 int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
8108 TestApplication application;
8110 Actor actor = Actor::New();
8111 AngleAxis aa(Degree(90), Vector3::XAXIS);
8112 actor.SetOrientation(aa.angle, aa.axis);
8113 application.SendNotification();
8114 application.Render(0);
8115 Stage::GetCurrent().Add(actor);
8117 Quaternion start(Radian(aa.angle), aa.axis);
8118 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8120 // Build the animation
8121 float durationSeconds(1.0f);
8122 Animation animation = Animation::New(durationSeconds);
8124 KeyFrames keyFrames = KeyFrames::New();
8125 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
8126 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
8127 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
8129 //Cubic interpolation should be ignored for quaternions
8130 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
8132 // Start the animation
8135 bool signalReceived(false);
8136 AnimationFinishCheck finishCheck(signalReceived);
8137 animation.FinishedSignal().Connect(&application, finishCheck);
8138 application.SendNotification();
8139 application.Render(0);
8140 application.SendNotification();
8141 finishCheck.CheckSignalNotReceived();
8143 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
8144 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8146 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8147 application.SendNotification();
8148 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
8149 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8151 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8152 application.SendNotification();
8153 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
8154 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8156 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8157 application.SendNotification();
8158 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f ) );
8159 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8161 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8162 application.SendNotification();
8163 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
8164 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8166 // We did expect the animation to finish
8168 finishCheck.CheckSignalReceived();
8172 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
8174 TestApplication application;
8176 float startValue(1.0f);
8177 Actor actor = Actor::New();
8178 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8179 Stage::GetCurrent().Add(actor);
8181 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8182 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8183 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8184 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8185 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8187 // Build the animation
8188 float durationSeconds(1.0f);
8189 Animation animation = Animation::New(durationSeconds);
8191 KeyFrames keyFrames = KeyFrames::New();
8192 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8193 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8194 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8196 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR );
8198 // Start the animation
8201 bool signalReceived(false);
8202 AnimationFinishCheck finishCheck(signalReceived);
8203 animation.FinishedSignal().Connect(&application, finishCheck);
8204 application.SendNotification();
8205 application.Render(0);
8206 application.SendNotification();
8207 finishCheck.CheckSignalNotReceived();
8208 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8209 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8210 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8211 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8213 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8214 application.SendNotification();
8215 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
8216 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
8217 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
8218 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
8220 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8221 application.SendNotification();
8222 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8223 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8224 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8225 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8227 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8228 application.SendNotification();
8229 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
8230 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
8231 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
8232 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
8234 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8235 application.SendNotification();
8236 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8237 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8238 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8239 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8241 // We did expect the animation to finish
8243 finishCheck.CheckSignalReceived();
8247 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
8249 TestApplication application;
8251 float startValue(1.0f);
8252 Actor actor = Actor::New();
8253 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8254 Stage::GetCurrent().Add(actor);
8256 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8257 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8258 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8259 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8260 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8262 // Build the animation
8263 float durationSeconds(1.0f);
8264 Animation animation = Animation::New(durationSeconds);
8266 KeyFrames keyFrames = KeyFrames::New();
8267 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8268 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8269 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8271 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::Cubic );
8273 // Start the animation
8276 bool signalReceived(false);
8277 AnimationFinishCheck finishCheck(signalReceived);
8278 animation.FinishedSignal().Connect(&application, finishCheck);
8279 application.SendNotification();
8280 application.Render(0);
8281 application.SendNotification();
8282 finishCheck.CheckSignalNotReceived();
8283 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8284 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8285 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8286 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8288 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8289 application.SendNotification();
8290 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION );
8291 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
8292 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION );
8293 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
8295 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8296 application.SendNotification();
8297 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8298 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8299 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8300 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8302 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8303 application.SendNotification();
8304 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION );
8305 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
8306 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION );
8307 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
8309 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8310 application.SendNotification();
8311 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8312 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8313 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8314 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8316 // We did expect the animation to finish
8318 finishCheck.CheckSignalReceived();
8322 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void)
8324 TestApplication application;
8326 float startValue(1.0f);
8327 Actor actor = Actor::New();
8328 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8329 Stage::GetCurrent().Add(actor);
8331 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8332 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8333 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8334 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8335 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8337 // Build the animation
8338 float durationSeconds(1.0f);
8340 Animation animation = Animation::New(durationSeconds);
8342 KeyFrames keyFrames = KeyFrames::New();
8343 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8344 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8345 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8347 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ) );
8349 // Start the animation
8352 bool signalReceived(false);
8353 AnimationFinishCheck finishCheck(signalReceived);
8354 animation.FinishedSignal().Connect(&application, finishCheck);
8355 application.SendNotification();
8357 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
8358 application.SendNotification();
8359 finishCheck.CheckSignalNotReceived();
8360 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8361 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8362 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8363 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8365 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
8366 application.SendNotification();
8367 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
8368 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
8369 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
8370 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
8372 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
8373 application.SendNotification();
8374 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8375 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8376 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8377 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8379 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
8380 application.SendNotification();
8381 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
8382 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
8383 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
8384 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
8386 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
8387 application.SendNotification();
8388 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8389 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8390 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8391 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8393 // We did expect the animation to finish
8395 finishCheck.CheckSignalReceived();
8399 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
8401 TestApplication application;
8403 float startValue(1.0f);
8404 Actor actor = Actor::New();
8405 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8406 Stage::GetCurrent().Add(actor);
8408 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8409 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8410 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8411 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8412 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8414 // Build the animation
8415 float durationSeconds(1.0f);
8417 Animation animation = Animation::New(durationSeconds);
8419 KeyFrames keyFrames = KeyFrames::New();
8420 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8421 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8422 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8424 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
8426 // Start the animation
8429 bool signalReceived(false);
8430 AnimationFinishCheck finishCheck(signalReceived);
8431 animation.FinishedSignal().Connect(&application, finishCheck);
8432 application.SendNotification();
8434 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
8435 application.SendNotification();
8436 finishCheck.CheckSignalNotReceived();
8437 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8438 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8439 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8440 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8442 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
8443 application.SendNotification();
8444 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION );
8445 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
8446 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION );
8447 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
8449 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
8450 application.SendNotification();
8451 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8452 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8453 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8454 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8456 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
8457 application.SendNotification();
8458 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION );
8459 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
8460 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION );
8461 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
8463 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
8464 application.SendNotification();
8465 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8466 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8467 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8468 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8470 // We did expect the animation to finish
8472 finishCheck.CheckSignalReceived();
8476 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
8478 TestApplication application;
8480 float startValue(1.0f);
8482 Actor actor = Actor::New();
8483 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8484 Stage::GetCurrent().Add(actor);
8486 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8487 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8488 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8489 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8490 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8492 // Build the animation
8493 float durationSeconds(1.0f);
8494 Animation animation = Animation::New(durationSeconds);
8496 KeyFrames keyFrames = KeyFrames::New();
8497 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8498 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8499 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8501 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
8503 // Start the animation
8506 bool signalReceived(false);
8507 AnimationFinishCheck finishCheck(signalReceived);
8508 animation.FinishedSignal().Connect(&application, finishCheck);
8509 application.SendNotification();
8511 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
8512 application.SendNotification();
8513 finishCheck.CheckSignalNotReceived();
8514 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8515 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8516 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8517 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8519 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
8520 application.SendNotification();
8521 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
8522 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
8523 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
8524 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
8526 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
8527 application.SendNotification();
8528 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8529 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8530 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8531 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8533 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
8534 application.SendNotification();
8535 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
8536 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
8537 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
8538 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
8540 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
8541 application.SendNotification();
8542 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8543 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8544 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8545 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8547 // We did expect the animation to finish
8549 finishCheck.CheckSignalReceived();
8553 int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void)
8555 TestApplication application;
8557 float startValue(1.0f);
8558 Actor actor = Actor::New();
8559 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8560 Stage::GetCurrent().Add(actor);
8562 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8563 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8564 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8565 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8566 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8568 // Build the animation
8569 float durationSeconds(1.0f);
8571 Animation animation = Animation::New(durationSeconds);
8573 KeyFrames keyFrames = KeyFrames::New();
8574 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8575 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8576 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8578 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
8580 // Start the animation
8583 bool signalReceived(false);
8584 AnimationFinishCheck finishCheck(signalReceived);
8585 animation.FinishedSignal().Connect(&application, finishCheck);
8586 application.SendNotification();
8588 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
8589 application.SendNotification();
8590 finishCheck.CheckSignalNotReceived();
8591 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8592 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8593 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8594 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8596 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
8597 application.SendNotification();
8598 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION );
8599 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
8600 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION );
8601 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
8603 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
8604 application.SendNotification();
8605 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8606 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8607 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8608 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8610 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
8611 application.SendNotification();
8612 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION );
8613 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
8614 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION );
8615 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
8617 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
8618 application.SendNotification();
8619 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8620 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8621 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8622 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8624 // We did expect the animation to finish
8626 finishCheck.CheckSignalReceived();
8630 int UtcDaliAnimationAnimateP(void)
8632 TestApplication application;
8634 Actor actor = Actor::New();
8635 Stage::GetCurrent().Add(actor);
8638 Vector3 position0( 30.0, 80.0, 0.0);
8639 Vector3 position1( 70.0, 120.0, 0.0);
8640 Vector3 position2( 100.0, 100.0, 0.0);
8642 Dali::Path path = Dali::Path::New();
8643 path.AddPoint(position0);
8644 path.AddPoint(position1);
8645 path.AddPoint(position2);
8647 //Control points for first segment
8648 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
8649 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
8651 //Control points for second segment
8652 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
8653 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
8655 // Build the animation
8656 float durationSeconds( 1.0f );
8657 Animation animation = Animation::New(durationSeconds);
8658 animation.Animate(actor, path, Vector3::XAXIS);
8660 // Start the animation
8663 bool signalReceived(false);
8664 AnimationFinishCheck finishCheck(signalReceived);
8665 animation.FinishedSignal().Connect(&application, finishCheck);
8666 application.SendNotification();
8667 application.Render(0);
8668 application.SendNotification();
8669 finishCheck.CheckSignalNotReceived();
8670 Vector3 position, tangent;
8671 Quaternion rotation;
8672 path.Sample( 0.0f, position, tangent );
8673 rotation = Quaternion( Vector3::XAXIS, tangent );
8674 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8675 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8677 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8678 application.SendNotification();
8679 path.Sample( 0.25f, position, tangent );
8680 rotation = Quaternion( Vector3::XAXIS, tangent );
8681 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8682 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8684 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8685 application.SendNotification();
8686 path.Sample( 0.5f, position, tangent );
8687 rotation = Quaternion( Vector3::XAXIS, tangent );
8688 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8689 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8691 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8692 application.SendNotification();
8693 path.Sample( 0.75f, position, tangent );
8694 rotation = Quaternion( Vector3::XAXIS, tangent );
8695 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8696 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8698 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8699 application.SendNotification();
8700 path.Sample( 1.0f, position, tangent );
8701 rotation = Quaternion( Vector3::XAXIS, tangent );
8702 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8703 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8705 finishCheck.CheckSignalReceived();
8709 int UtcDaliAnimationAnimateAlphaFunctionP(void)
8711 TestApplication application;
8713 Actor actor = Actor::New();
8714 Stage::GetCurrent().Add(actor);
8717 Vector3 position0( 30.0, 80.0, 0.0);
8718 Vector3 position1( 70.0, 120.0, 0.0);
8719 Vector3 position2( 100.0, 100.0, 0.0);
8721 Dali::Path path = Dali::Path::New();
8722 path.AddPoint(position0);
8723 path.AddPoint(position1);
8724 path.AddPoint(position2);
8726 //Control points for first segment
8727 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
8728 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
8730 //Control points for second segment
8731 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
8732 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
8734 // Build the animation
8735 float durationSeconds( 1.0f );
8736 Animation animation = Animation::New(durationSeconds);
8737 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
8739 // Start the animation
8742 bool signalReceived(false);
8743 AnimationFinishCheck finishCheck(signalReceived);
8744 animation.FinishedSignal().Connect(&application, finishCheck);
8745 application.SendNotification();
8746 application.Render(0);
8747 application.SendNotification();
8748 finishCheck.CheckSignalNotReceived();
8749 Vector3 position, tangent;
8750 Quaternion rotation;
8751 path.Sample( 0.0f, position, tangent );
8752 rotation = Quaternion( Vector3::XAXIS, tangent );
8753 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8754 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8756 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8757 application.SendNotification();
8758 path.Sample( 0.25f, position, tangent );
8759 rotation = Quaternion( Vector3::XAXIS, tangent );
8760 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8761 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8763 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8764 application.SendNotification();
8765 path.Sample( 0.5f, position, tangent );
8766 rotation = Quaternion( Vector3::XAXIS, tangent );
8767 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8768 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8770 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8771 application.SendNotification();
8772 path.Sample( 0.75f, position, tangent );
8773 rotation = Quaternion( Vector3::XAXIS, tangent );
8774 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8775 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8777 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8778 application.SendNotification();
8779 path.Sample( 1.0f, position, tangent );
8780 rotation = Quaternion( Vector3::XAXIS, tangent );
8781 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8782 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8784 finishCheck.CheckSignalReceived();
8788 int UtcDaliAnimationAnimateTimePeriodP(void)
8790 TestApplication application;
8792 Actor actor = Actor::New();
8793 Stage::GetCurrent().Add(actor);
8796 Vector3 position0( 30.0, 80.0, 0.0);
8797 Vector3 position1( 70.0, 120.0, 0.0);
8798 Vector3 position2( 100.0, 100.0, 0.0);
8800 Dali::Path path = Dali::Path::New();
8801 path.AddPoint(position0);
8802 path.AddPoint(position1);
8803 path.AddPoint(position2);
8805 //Control points for first segment
8806 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
8807 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
8809 //Control points for second segment
8810 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
8811 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
8813 // Build the animation
8814 float durationSeconds( 1.0f );
8815 Animation animation = Animation::New(durationSeconds);
8816 animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
8818 // Start the animation
8821 bool signalReceived(false);
8822 AnimationFinishCheck finishCheck(signalReceived);
8823 animation.FinishedSignal().Connect(&application, finishCheck);
8824 application.SendNotification();
8825 application.Render(0);
8826 application.SendNotification();
8827 finishCheck.CheckSignalNotReceived();
8828 Vector3 position, tangent;
8829 Quaternion rotation;
8830 path.Sample( 0.0f, position, tangent );
8831 rotation = Quaternion( Vector3::XAXIS, tangent );
8832 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8833 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8835 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8836 application.SendNotification();
8837 path.Sample( 0.25f, position, tangent );
8838 rotation = Quaternion( Vector3::XAXIS, tangent );
8839 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8840 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8842 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8843 application.SendNotification();
8844 path.Sample( 0.5f, position, tangent );
8845 rotation = Quaternion( Vector3::XAXIS, tangent );
8846 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8847 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8849 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8850 application.SendNotification();
8851 path.Sample( 0.75f, position, tangent );
8852 rotation = Quaternion( Vector3::XAXIS, tangent );
8853 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8854 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8856 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8857 application.SendNotification();
8858 path.Sample( 1.0f, position, tangent );
8859 rotation = Quaternion( Vector3::XAXIS, tangent );
8860 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8861 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8863 finishCheck.CheckSignalReceived();
8867 int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
8869 TestApplication application;
8871 Actor actor = Actor::New();
8872 Stage::GetCurrent().Add(actor);
8875 Vector3 position0( 30.0, 80.0, 0.0);
8876 Vector3 position1( 70.0, 120.0, 0.0);
8877 Vector3 position2( 100.0, 100.0, 0.0);
8879 Dali::Path path = Dali::Path::New();
8880 path.AddPoint(position0);
8881 path.AddPoint(position1);
8882 path.AddPoint(position2);
8884 //Control points for first segment
8885 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
8886 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
8888 //Control points for second segment
8889 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
8890 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
8892 // Build the animation
8893 float durationSeconds( 1.0f );
8894 Animation animation = Animation::New(durationSeconds);
8895 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
8897 // Start the animation
8900 bool signalReceived(false);
8901 AnimationFinishCheck finishCheck(signalReceived);
8902 animation.FinishedSignal().Connect(&application, finishCheck);
8903 application.SendNotification();
8904 application.Render(0);
8905 application.SendNotification();
8906 finishCheck.CheckSignalNotReceived();
8907 Vector3 position, tangent;
8908 Quaternion rotation;
8909 path.Sample( 0.0f, position, tangent );
8910 rotation = Quaternion( Vector3::XAXIS, tangent );
8911 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8912 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8914 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8915 application.SendNotification();
8916 path.Sample( 0.25f, position, tangent );
8917 rotation = Quaternion( Vector3::XAXIS, tangent );
8918 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8919 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8921 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8922 application.SendNotification();
8923 path.Sample( 0.5f, position, tangent );
8924 rotation = Quaternion( Vector3::XAXIS, tangent );
8925 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8926 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8928 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8929 application.SendNotification();
8930 path.Sample( 0.75f, position, tangent );
8931 rotation = Quaternion( Vector3::XAXIS, tangent );
8932 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8933 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8935 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8936 application.SendNotification();
8937 path.Sample( 1.0f, position, tangent );
8938 rotation = Quaternion( Vector3::XAXIS, tangent );
8939 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8940 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8942 finishCheck.CheckSignalReceived();
8946 int UtcDaliAnimationShowP(void)
8948 TestApplication application;
8950 Actor actor = Actor::New();
8951 actor.SetVisible(false);
8952 application.SendNotification();
8953 application.Render(0);
8954 DALI_TEST_CHECK( !actor.IsVisible() );
8955 Stage::GetCurrent().Add(actor);
8957 // Start the animation
8958 float durationSeconds(10.0f);
8959 Animation animation = Animation::New(durationSeconds);
8960 animation.Show(actor, durationSeconds*0.5f);
8963 bool signalReceived(false);
8964 AnimationFinishCheck finishCheck(signalReceived);
8965 animation.FinishedSignal().Connect(&application, finishCheck);
8967 application.SendNotification();
8968 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
8970 // We didn't expect the animation to finish yet
8971 application.SendNotification();
8972 finishCheck.CheckSignalNotReceived();
8973 DALI_TEST_CHECK( !actor.IsVisible() );
8975 application.SendNotification();
8976 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be shown now*/);
8978 // We didn't expect the animation to finish yet
8979 application.SendNotification();
8980 finishCheck.CheckSignalNotReceived();
8981 DALI_TEST_CHECK( actor.IsVisible() );
8983 application.SendNotification();
8984 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8986 // We did expect the animation to finish
8987 application.SendNotification();
8988 finishCheck.CheckSignalReceived();
8989 DALI_TEST_CHECK( actor.IsVisible() );
8993 int UtcDaliAnimationHideP(void)
8995 TestApplication application;
8997 Actor actor = Actor::New();
8998 DALI_TEST_CHECK( actor.IsVisible() );
8999 Stage::GetCurrent().Add(actor);
9001 // Start the animation
9002 float durationSeconds(10.0f);
9003 Animation animation = Animation::New(durationSeconds);
9004 animation.Hide(actor, durationSeconds*0.5f);
9007 bool signalReceived(false);
9008 AnimationFinishCheck finishCheck(signalReceived);
9009 animation.FinishedSignal().Connect(&application, finishCheck);
9011 application.SendNotification();
9012 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
9014 // We didn't expect the animation to finish yet
9015 application.SendNotification();
9016 finishCheck.CheckSignalNotReceived();
9017 DALI_TEST_CHECK( actor.IsVisible() );
9019 application.SendNotification();
9020 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be hidden now*/);
9022 // We didn't expect the animation to finish yet
9023 application.SendNotification();
9024 finishCheck.CheckSignalNotReceived();
9025 DALI_TEST_CHECK( !actor.IsVisible() );
9027 application.SendNotification();
9028 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
9030 // We did expect the animation to finish
9031 application.SendNotification();
9032 finishCheck.CheckSignalReceived();
9033 DALI_TEST_CHECK( !actor.IsVisible() );
9037 int UtcDaliAnimationShowHideAtEndP(void)
9039 // Test that show/hide delay can be the same as animation duration
9040 // i.e. to show/hide at the end of the animation
9042 TestApplication application;
9044 Actor actor = Actor::New();
9045 DALI_TEST_CHECK( actor.IsVisible() );
9046 Stage::GetCurrent().Add(actor);
9048 // Start Hide animation
9049 float durationSeconds(10.0f);
9050 Animation animation = Animation::New(durationSeconds);
9051 animation.Hide(actor, durationSeconds/*Hide at end*/);
9054 bool signalReceived(false);
9055 AnimationFinishCheck finishCheck(signalReceived);
9056 animation.FinishedSignal().Connect(&application, finishCheck);
9058 application.SendNotification();
9059 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
9061 // We did expect the animation to finish
9062 application.SendNotification();
9063 finishCheck.CheckSignalReceived();
9064 DALI_TEST_CHECK( !actor.IsVisible() );
9066 // Start Show animation
9067 animation = Animation::New(durationSeconds);
9068 animation.Show(actor, durationSeconds/*Show at end*/);
9069 animation.FinishedSignal().Connect(&application, finishCheck);
9072 application.SendNotification();
9073 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
9075 // We did expect the animation to finish
9076 application.SendNotification();
9077 finishCheck.CheckSignalReceived();
9078 DALI_TEST_CHECK( actor.IsVisible() );
9082 int UtcDaliKeyFramesCreateDestroyP(void)
9084 tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
9086 KeyFrames* keyFrames = new KeyFrames;
9088 DALI_TEST_CHECK( true );
9092 int UtcDaliKeyFramesDownCastP(void)
9094 TestApplication application;
9095 tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
9097 KeyFrames keyFrames = KeyFrames::New();
9098 BaseHandle object(keyFrames);
9100 KeyFrames keyFrames2 = KeyFrames::DownCast(object);
9101 DALI_TEST_CHECK(keyFrames2);
9103 KeyFrames keyFrames3 = DownCast< KeyFrames >(object);
9104 DALI_TEST_CHECK(keyFrames3);
9106 BaseHandle unInitializedObject;
9107 KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
9108 DALI_TEST_CHECK(!keyFrames4);
9110 KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject);
9111 DALI_TEST_CHECK(!keyFrames5);
9115 int UtcDaliAnimationCreateDestroyP(void)
9117 TestApplication application;
9118 Animation* animation = new Animation;
9119 DALI_TEST_CHECK( animation );
9124 struct UpdateManagerTestConstraint
9126 UpdateManagerTestConstraint(TestApplication& application)
9127 : mApplication(application)
9131 void operator()( Vector3& current, const PropertyInputContainer& /* inputs */)
9133 mApplication.SendNotification(); // Process events
9136 TestApplication& mApplication;
9139 int UtcDaliAnimationUpdateManagerP(void)
9141 TestApplication application;
9143 Actor actor = Actor::New();
9144 Stage::GetCurrent().Add( actor );
9146 // Build the animation
9147 Animation animation = Animation::New( 0.0f );
9149 bool signalReceived = false;
9150 AnimationFinishCheck finishCheck( signalReceived );
9151 animation.FinishedSignal().Connect( &application, finishCheck );
9153 Vector3 startValue(1.0f, 1.0f, 1.0f);
9154 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
9155 Constraint constraint = Constraint::New<Vector3>( actor, index, UpdateManagerTestConstraint( application ) );
9158 // Apply animation to actor
9159 animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunction::LINEAR );
9163 application.SendNotification();
9164 application.UpdateOnly( 16 );
9166 finishCheck.CheckSignalNotReceived();
9168 application.SendNotification(); // Process events
9170 finishCheck.CheckSignalReceived();
9175 int UtcDaliAnimationSignalOrderP(void)
9177 TestApplication application;
9179 Actor actor = Actor::New();
9180 Stage::GetCurrent().Add( actor );
9182 // Build the animations
9183 Animation animation1 = Animation::New( 0.0f ); // finishes first frame
9184 Animation animation2 = Animation::New( 0.02f ); // finishes in 20 ms
9186 bool signal1Received = false;
9187 animation1.FinishedSignal().Connect( &application, AnimationFinishCheck( signal1Received ) );
9189 bool signal2Received = false;
9190 animation2.FinishedSignal().Connect( &application, AnimationFinishCheck( signal2Received ) );
9192 // Apply animations to actor
9193 animation1.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 3.0f, 2.0f, 1.0f ), AlphaFunction::LINEAR );
9195 animation2.AnimateTo( Property(actor, Actor::Property::SIZE ), Vector3( 10.0f, 20.0f, 30.0f ), AlphaFunction::LINEAR );
9198 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
9199 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
9201 application.SendNotification();
9202 application.UpdateOnly( 10 ); // 10ms progress
9204 // no notifications yet
9205 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
9206 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
9208 application.SendNotification();
9211 DALI_TEST_EQUALS( signal1Received, true, TEST_LOCATION );
9212 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
9213 signal1Received = false;
9215 // 1st animation is complete now, do another update with no ProcessEvents in between
9216 application.UpdateOnly( 20 ); // 20ms progress
9219 application.SendNotification();
9221 // 2nd should complete now
9222 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
9223 DALI_TEST_EQUALS( signal2Received, true, TEST_LOCATION );
9228 int UtcDaliAnimationExtendDurationP(void)
9230 TestApplication application;
9232 Actor actor = Actor::New();
9234 // Register a float property
9235 float startValue(10.0f);
9236 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
9237 Stage::GetCurrent().Add(actor);
9238 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
9240 // Build the animation
9241 float initialDurationSeconds(1.0f);
9242 float animatorDelay = 5.0f;
9243 float animatorDurationSeconds(5.0f);
9244 float extendedDurationSeconds(animatorDelay+animatorDurationSeconds);
9245 Animation animation = Animation::New(initialDurationSeconds);
9246 float targetValue(30.0f);
9247 float relativeValue(targetValue - startValue);
9249 animation.AnimateTo(Property(actor, index),
9251 TimePeriod(animatorDelay, animatorDurationSeconds));
9253 // The duration should have been extended
9254 DALI_TEST_EQUALS( animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION );
9256 // Start the animation
9259 bool signalReceived(false);
9260 AnimationFinishCheck finishCheck(signalReceived);
9261 animation.FinishedSignal().Connect(&application, finishCheck);
9263 application.SendNotification();
9264 application.Render(static_cast<unsigned int>(extendedDurationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
9266 // We didn't expect the animation to finish yet
9267 application.SendNotification();
9268 finishCheck.CheckSignalNotReceived();
9269 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
9271 application.SendNotification();
9272 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
9274 // We didn't expect the animation to finish yet
9275 application.SendNotification();
9276 finishCheck.CheckSignalNotReceived();
9277 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
9279 application.SendNotification();
9280 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
9282 // We did expect the animation to finish
9283 application.SendNotification();
9284 finishCheck.CheckSignalReceived();
9285 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
9289 int UtcDaliAnimationCustomIntProperty(void)
9291 TestApplication application;
9293 Actor actor = Actor::New();
9294 Stage::GetCurrent().Add(actor);
9297 Property::Index index = actor.RegisterProperty("anIndex", startValue);
9298 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
9300 // Build the animation
9301 float durationSeconds(1.0f);
9302 Animation animation = Animation::New(durationSeconds);
9303 animation.AnimateTo( Property(actor, index), 20 );
9305 // Start the animation
9308 bool signalReceived(false);
9309 AnimationFinishCheck finishCheck(signalReceived);
9310 animation.FinishedSignal().Connect(&application, finishCheck);
9312 application.SendNotification();
9313 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
9315 // We didn't expect the animation to finish yet
9316 application.SendNotification();
9317 finishCheck.CheckSignalNotReceived();
9318 DALI_TEST_EQUALS( actor.GetProperty<int>(index), 10, TEST_LOCATION );
9320 application.SendNotification();
9321 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
9323 // We did expect the animation to finish
9324 application.SendNotification();
9325 finishCheck.CheckSignalReceived();
9326 DALI_TEST_EQUALS( actor.GetProperty<int>(index), 20, TEST_LOCATION );