2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
22 #include <dali/public-api/dali-core.h>
23 #include <dali-test-suite-utils.h>
28 void utc_dali_animation_startuP(void)
30 test_return_value = TET_UNDEF;
33 void utc_dali_animation_cleanuP(void)
35 test_return_value = TET_PASS;
41 static const float ROTATION_EPSILON = 0.0001f;
42 static const float VECTOR4_EPSILON = 0.0001f;
44 // Functor to test whether a Finish signal is emitted
45 struct AnimationFinishCheck
47 AnimationFinishCheck(bool& signalReceived)
48 : mSignalReceived(signalReceived)
52 void operator()(Animation& animation)
54 mSignalReceived = true;
59 mSignalReceived = false;
62 void CheckSignalReceived()
66 tet_printf("Expected Finish signal was not received\n");
75 void CheckSignalNotReceived()
79 tet_printf("Unexpected Finish signal was received\n");
88 bool& mSignalReceived; // owned by individual tests
93 int UtcDaliAnimationConstructorP(void)
95 TestApplication application;
99 DALI_TEST_CHECK( !animation );
103 int UtcDaliAnimationNewP(void)
105 TestApplication application;
107 Animation animation = Animation::New( 1.0f );
109 DALI_TEST_CHECK(animation);
113 int UtcDaliAnimationNewN(void)
115 TestApplication application;
117 Animation animation = Animation::New( -1.0f );
119 DALI_TEST_CHECK(animation);
120 DALI_TEST_EQUALS(animation.GetDuration(), 0.0f, TEST_LOCATION);
124 int UtcDaliAnimationDownCastP(void)
126 TestApplication application;
128 tet_infoline("Testing Dali::Animation::DownCast()");
130 float durationSeconds(1.0f);
131 Animation animation = Animation::New(durationSeconds);
133 BaseHandle object(animation);
135 Animation animation2 = Animation::DownCast(object);
136 DALI_TEST_CHECK(animation2);
138 Animation animation3 = DownCast< Animation >(object);
139 DALI_TEST_CHECK(animation3);
143 int UtcDaliAnimationDownCastN(void)
145 TestApplication application;
147 BaseHandle unInitializedObject;
149 Animation animation1 = Animation::DownCast( unInitializedObject );
150 DALI_TEST_CHECK( !animation1 );
152 Animation animation2 = DownCast< Animation >( unInitializedObject );
153 DALI_TEST_CHECK( !animation2 );
157 int UtcDaliAnimationCopyConstructorP(void)
159 TestApplication application;
161 // Initialize an object, ref count == 1
162 Animation animation = Animation::New( 1.0f );
164 Animation copy( animation );
165 DALI_TEST_CHECK( copy );
167 DALI_TEST_CHECK( copy.GetDuration() == animation.GetDuration() );
171 int UtcDaliAnimationAssignmentOperatorP(void)
173 TestApplication application;
175 Animation animation = Animation::New( 1.0f );
177 Animation copy = animation;
178 DALI_TEST_CHECK( copy );
180 DALI_TEST_CHECK( animation == copy );
182 DALI_TEST_CHECK( copy.GetDuration() == animation.GetDuration() );
186 int UtcDaliAnimationSetDurationP(void)
188 TestApplication application;
190 Actor actor = Actor::New();
191 Stage::GetCurrent().Add(actor);
193 // Build the animation
194 float durationSeconds(1.0f);
195 Animation animation = Animation::New(durationSeconds);
196 DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
198 // Start the animation
199 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
200 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
203 bool signalReceived(false);
204 AnimationFinishCheck finishCheck(signalReceived);
205 animation.FinishedSignal().Connect(&application, finishCheck);
207 application.SendNotification();
208 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
210 // We didn't expect the animation to finish yet
211 application.SendNotification();
212 finishCheck.CheckSignalNotReceived();
214 application.Render(2u/*just beyond the animation duration*/);
216 // We did expect the animation to finish
217 application.SendNotification();
218 finishCheck.CheckSignalReceived();
219 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
221 // Restart the animation, with a different duration
223 actor.SetPosition(Vector3::ZERO);
224 durationSeconds = 3.5f;
225 animation.SetDuration(durationSeconds);
226 DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
229 application.SendNotification();
230 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
232 // We didn't expect the animation to finish yet
233 application.SendNotification();
234 finishCheck.CheckSignalNotReceived();
236 application.Render(2u/*just beyond the animation duration*/);
238 // We did expect the animation to finish
239 application.SendNotification();
240 finishCheck.CheckSignalReceived();
241 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
243 // Check that nothing has changed after a couple of buffer swaps
244 application.Render(0);
245 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
246 application.Render(0);
247 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
251 int UtcDaliAnimationSetDurationN(void)
253 TestApplication application;
255 Animation animation = Animation::New( 1.0f );
256 DALI_TEST_EQUALS( animation.GetDuration(), 1.0f, TEST_LOCATION );
258 animation.SetDuration( -1.0f );
259 DALI_TEST_EQUALS( animation.GetDuration(), 0.0f, TEST_LOCATION );
263 int UtcDaliAnimationGetDurationP(void)
265 TestApplication application;
267 Animation animation = Animation::New(1.0f);
268 DALI_TEST_EQUALS(animation.GetDuration(), 1.0f, TEST_LOCATION);
270 animation.SetDuration(2.0f);
271 DALI_TEST_EQUALS(animation.GetDuration(), 2.0f, TEST_LOCATION);
275 int UtcDaliAnimationSetLoopingP(void)
277 TestApplication application;
279 Actor actor = Actor::New();
280 Stage::GetCurrent().Add(actor);
282 // Build the animation
283 float durationSeconds(1.0f);
284 Animation animation = Animation::New(durationSeconds);
285 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
286 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
288 // Start the animation
289 animation.SetLooping(true);
290 DALI_TEST_CHECK(animation.IsLooping());
293 bool signalReceived(false);
294 AnimationFinishCheck finishCheck(signalReceived);
295 animation.FinishedSignal().Connect(&application, finishCheck);
297 application.SendNotification();
300 float intervalSeconds = 0.25f;
301 float progress = 0.0f;
302 for (int iterations = 0; iterations < 5;)
304 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
306 progress += intervalSeconds;
307 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
309 if (progress >= 1.0f)
311 progress = progress - 1.0f;
316 // We didn't expect the animation to finish yet
317 application.SendNotification();
318 finishCheck.CheckSignalNotReceived();
320 animation.SetLooping(false);
321 DALI_TEST_CHECK(!animation.IsLooping());
323 application.SendNotification();
324 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
326 // We did expect the animation to finish
327 application.SendNotification();
328 finishCheck.CheckSignalReceived();
329 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
331 // Check that nothing has changed after a couple of buffer swaps
332 application.Render(0);
333 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
334 application.Render(0);
335 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
339 int UtcDaliAnimationSetLoopCountP(void)
341 TestApplication application;
343 Actor actor = Actor::New();
344 Stage::GetCurrent().Add(actor);
346 // Build the animation
347 float durationSeconds(1.0f);
348 Animation animation = Animation::New(durationSeconds);
349 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
350 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
352 // Start the animation
353 animation.SetLoopCount(3);
354 DALI_TEST_CHECK(animation.IsLooping());
357 bool signalReceived(false);
358 AnimationFinishCheck finishCheck(signalReceived);
359 animation.FinishedSignal().Connect(&application, finishCheck);
361 application.Render(0);
362 application.SendNotification();
363 application.Render(0);
364 application.SendNotification();
365 application.Render(0);
366 application.SendNotification();
367 application.Render(0);
368 application.SendNotification();
371 float intervalSeconds = 3.0f;
373 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
374 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
376 application.Render(0);
377 application.SendNotification();
378 application.Render(0);
379 application.SendNotification();
380 application.Render(0);
381 application.SendNotification();
382 application.Render(0);
383 application.SendNotification();
384 finishCheck.CheckSignalNotReceived();
386 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
388 application.SendNotification();
389 finishCheck.CheckSignalReceived();
390 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
394 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
395 application.SendNotification();
396 finishCheck.CheckSignalNotReceived();
398 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
399 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
400 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
401 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
402 application.SendNotification();
403 finishCheck.CheckSignalNotReceived();
408 int UtcDaliAnimationSetLoopCountP2(void)
410 TestApplication application;
413 // switching between forever and loop count
416 Actor actor = Actor::New();
417 Stage::GetCurrent().Add(actor);
419 // Build the animation
420 float durationSeconds(1.0f);
421 Animation animation = Animation::New(durationSeconds);
422 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
423 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
424 animation.SetEndAction(Animation::Discard);
426 // Start the animation
427 animation.SetLoopCount(3);
428 DALI_TEST_CHECK(animation.IsLooping());
431 bool signalReceived(false);
432 AnimationFinishCheck finishCheck(signalReceived);
433 animation.FinishedSignal().Connect(&application, finishCheck);
435 float intervalSeconds = 3.0f;
437 application.SendNotification();
438 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
439 application.SendNotification();
440 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
441 application.SendNotification();
442 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
443 application.SendNotification();
445 application.SendNotification();
446 finishCheck.CheckSignalReceived();
451 animation.SetLooping(true);
452 DALI_TEST_CHECK(animation.IsLooping());
454 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
455 application.SendNotification();
456 finishCheck.CheckSignalNotReceived();
458 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
459 application.SendNotification();
460 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
461 application.SendNotification();
462 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
463 application.SendNotification();
464 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
465 application.SendNotification();
466 application.SendNotification();
467 finishCheck.CheckSignalNotReceived();
472 animation.SetLoopCount(3);
473 DALI_TEST_CHECK(animation.IsLooping());
476 application.SendNotification();
477 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
478 application.SendNotification();
479 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
480 application.SendNotification();
481 finishCheck.CheckSignalNotReceived();
483 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
484 application.SendNotification();
485 finishCheck.CheckSignalReceived();
490 animation.SetLooping(true);
491 DALI_TEST_CHECK(animation.IsLooping());
493 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
494 application.SendNotification();
495 finishCheck.CheckSignalNotReceived();
497 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
498 application.SendNotification();
499 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
500 application.SendNotification();
501 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
502 application.SendNotification();
503 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
504 application.SendNotification();
505 finishCheck.CheckSignalNotReceived();
510 animation.SetLoopCount(3);
511 DALI_TEST_CHECK(animation.IsLooping());
513 application.SendNotification();
514 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
515 application.SendNotification();
516 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
517 application.SendNotification();
518 finishCheck.CheckSignalNotReceived();
520 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
521 application.SendNotification();
522 finishCheck.CheckSignalNotReceived(); // we never hit play
530 int UtcDaliAnimationSetLoopCountP3(void)
532 TestApplication application;
535 // switching between forever and loop count
537 Actor actor = Actor::New();
538 Stage::GetCurrent().Add(actor);
540 // Build the animation
541 float durationSeconds(1.0f);
542 Animation animation = Animation::New(durationSeconds);
543 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
544 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
545 animation.SetEndAction(Animation::Discard);
547 float intervalSeconds = 3.0f;
549 bool signalReceived(false);
550 AnimationFinishCheck finishCheck(signalReceived);
551 animation.FinishedSignal().Connect(&application, finishCheck);
554 animation.SetLooping(true);
555 DALI_TEST_CHECK(animation.IsLooping());
557 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
558 application.SendNotification();
559 finishCheck.CheckSignalNotReceived();
561 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
562 application.SendNotification();
563 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
564 application.SendNotification();
565 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
566 application.SendNotification();
567 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
568 application.SendNotification();
569 finishCheck.CheckSignalNotReceived();
574 animation.SetLoopCount(3);
575 DALI_TEST_CHECK(animation.IsLooping());
577 application.SendNotification();
578 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
579 application.SendNotification();
580 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
581 application.SendNotification();
582 finishCheck.CheckSignalNotReceived();
584 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
585 application.SendNotification();
586 finishCheck.CheckSignalNotReceived(); // we never hit play
594 int UtcDaliAnimationSetLoopCountP4(void)
596 TestApplication application;
601 Actor actor = Actor::New();
602 Stage::GetCurrent().Add(actor);
604 // Build the animation
605 float durationSeconds(1.0f);
606 Animation animation = Animation::New(durationSeconds);
607 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
608 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
609 animation.SetEndAction(Animation::Bake);
611 float intervalSeconds = 3.0f;
613 bool signalReceived(false);
614 AnimationFinishCheck finishCheck(signalReceived);
615 animation.FinishedSignal().Connect(&application, finishCheck);
617 animation.SetLoopCount(1);
619 DALI_TEST_CHECK(!animation.IsLooping());
621 application.SendNotification();
622 finishCheck.CheckSignalNotReceived();
623 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
624 application.SendNotification();
625 finishCheck.CheckSignalReceived();
627 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
628 actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f) );
632 animation.Play(); // again
633 DALI_TEST_CHECK(!animation.IsLooping());
635 application.SendNotification();
636 finishCheck.CheckSignalNotReceived();
637 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
638 application.SendNotification();
639 finishCheck.CheckSignalReceived();
641 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
646 int UtcDaliAnimationGetLoopCountP(void)
648 TestApplication application;
650 Actor actor = Actor::New();
651 Stage::GetCurrent().Add(actor);
653 // Build the animation
654 float durationSeconds(1.0f);
655 Animation animation = Animation::New(durationSeconds);
656 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
657 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
659 DALI_TEST_CHECK(1 == animation.GetLoopCount());
661 // Start the animation
662 animation.SetLoopCount(3);
663 DALI_TEST_CHECK(animation.IsLooping());
664 DALI_TEST_CHECK(3 == animation.GetLoopCount());
668 application.Render(0);
669 application.SendNotification();
672 float intervalSeconds = 3.0f;
674 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
675 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
677 application.Render(0);
678 application.SendNotification();
680 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
681 application.SendNotification();
683 animation.SetLoopCount(0);
684 DALI_TEST_CHECK(animation.IsLooping());
685 DALI_TEST_CHECK(0 == animation.GetLoopCount());
687 animation.SetLoopCount(1);
688 DALI_TEST_CHECK(!animation.IsLooping());
689 DALI_TEST_CHECK(1 == animation.GetLoopCount());
695 int UtcDaliAnimationGetCurrentLoopP(void)
697 TestApplication application;
699 Actor actor = Actor::New();
700 Stage::GetCurrent().Add(actor);
702 // Build the animation
703 float durationSeconds(1.0f);
704 Animation animation = Animation::New(durationSeconds);
705 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
706 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
708 // Start the animation
709 animation.SetLoopCount(3);
710 DALI_TEST_CHECK(animation.IsLooping());
711 DALI_TEST_CHECK(0 == animation.GetCurrentLoop());
714 bool signalReceived(false);
715 AnimationFinishCheck finishCheck(signalReceived);
716 animation.FinishedSignal().Connect(&application, finishCheck);
718 application.SendNotification();
721 float intervalSeconds = 3.0f;
723 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
724 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
726 application.SendNotification();
727 finishCheck.CheckSignalNotReceived();
728 DALI_TEST_CHECK(2 == animation.GetCurrentLoop());
730 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
732 application.SendNotification();
733 finishCheck.CheckSignalReceived();
734 DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
735 DALI_TEST_CHECK(animation.GetLoopCount() == animation.GetCurrentLoop());
739 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
740 application.SendNotification();
741 finishCheck.CheckSignalNotReceived();
742 DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
744 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
745 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
746 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
747 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
748 application.SendNotification();
749 finishCheck.CheckSignalNotReceived();
750 DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
755 int UtcDaliAnimationIsLoopingP(void)
757 TestApplication application;
759 Animation animation = Animation::New(1.0f);
760 DALI_TEST_CHECK(!animation.IsLooping());
762 animation.SetLooping(true);
763 DALI_TEST_CHECK(animation.IsLooping());
767 int UtcDaliAnimationSetEndActioN(void)
769 TestApplication application;
771 Actor actor = Actor::New();
772 Stage::GetCurrent().Add(actor);
774 // Build the animation
775 float durationSeconds(1.0f);
776 Animation animation = Animation::New(durationSeconds);
777 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
779 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
780 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
782 // Start the animation
785 bool signalReceived(false);
786 AnimationFinishCheck finishCheck(signalReceived);
787 animation.FinishedSignal().Connect(&application, finishCheck);
789 application.SendNotification();
790 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
792 // We did expect the animation to finish
793 application.SendNotification();
794 finishCheck.CheckSignalReceived();
795 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
797 // Go back to the start
798 actor.SetPosition(Vector3::ZERO);
799 application.SendNotification();
800 application.Render(0);
801 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
803 // Test BakeFinal, animate again, for half the duration
805 animation.SetEndAction(Animation::BakeFinal);
806 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
809 application.SendNotification();
810 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f*0.5f) /*half of the animation duration*/);
812 // Stop the animation early
815 // We did NOT expect the animation to finish
816 application.SendNotification();
817 finishCheck.CheckSignalNotReceived();
818 DALI_TEST_EQUALS( targetPosition * 0.5f, actor.GetCurrentPosition(), VECTOR4_EPSILON, TEST_LOCATION );
820 // The position should be same with target position in the next frame
821 application.Render(0);
822 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
824 // Go back to the start
825 actor.SetPosition(Vector3::ZERO);
826 application.SendNotification();
827 application.Render(0);
828 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
830 // Test EndAction::Discard, animate again, but don't bake this time
832 animation.SetEndAction(Animation::Discard);
833 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
836 application.SendNotification();
837 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
839 // We did expect the animation to finish
840 application.SendNotification();
841 finishCheck.CheckSignalReceived();
842 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
844 // The position should be discarded in the next frame
845 application.Render(0);
846 DALI_TEST_EQUALS( Vector3::ZERO/*discarded*/, actor.GetCurrentPosition(), TEST_LOCATION );
848 // Check that nothing has changed after a couple of buffer swaps
849 application.Render(0);
850 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
851 application.Render(0);
852 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
856 int UtcDaliAnimationGetEndActionP(void)
858 TestApplication application;
860 Animation animation = Animation::New(1.0f);
861 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
863 animation.SetEndAction(Animation::Discard);
864 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
866 animation.SetEndAction(Animation::BakeFinal);
867 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
872 int UtcDaliAnimationSetDisconnectActionP(void)
874 TestApplication application;
875 Stage stage( Stage::GetCurrent() );
877 // Default: BakeFinal
879 Actor actor = Actor::New();
882 // Build the animation
883 float durationSeconds(1.0f);
884 Animation animation = Animation::New(durationSeconds);
885 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal);
887 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
888 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
890 // Start the animation
893 application.SendNotification();
894 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
898 application.SendNotification();
899 application.Render();
901 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
906 Actor actor = Actor::New();
909 // Build the animation
910 float durationSeconds(1.0f);
911 Animation animation = Animation::New(durationSeconds);
912 animation.SetDisconnectAction( Animation::Bake );
914 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
915 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
917 // Start the animation
920 application.SendNotification();
921 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
925 application.SendNotification();
926 application.Render();
928 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition*0.5f, TEST_LOCATION );
933 Actor actor = Actor::New();
936 // Build the animation
937 float durationSeconds(1.0f);
938 Animation animation = Animation::New(durationSeconds);
939 animation.SetDisconnectAction( Animation::Discard );
941 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
942 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
944 // Start the animation
947 application.SendNotification();
948 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
952 application.SendNotification();
953 application.Render();
955 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
958 // Don't play the animation: disconnect action should not be applied
960 Actor actor = Actor::New();
963 // Build the animation
964 float durationSeconds(1.0f);
965 Animation animation = Animation::New(durationSeconds);
967 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
968 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
970 application.SendNotification();
971 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
975 application.SendNotification();
976 application.Render();
978 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
984 int UtcDaliAnimationGetDisconnectActionP(void)
986 TestApplication application;
987 Animation animation = Animation::New(1.0f);
988 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal); // default!
990 animation.SetDisconnectAction(Animation::Discard);
991 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Discard);
993 animation.SetDisconnectAction(Animation::Bake);
994 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Bake);
999 int UtcDaliAnimationSetDefaultAlphaFunctionP(void)
1001 TestApplication application;
1003 Animation animation = Animation::New(1.0f);
1004 AlphaFunction func = animation.GetDefaultAlphaFunction();
1005 DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1007 animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1008 AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1009 DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1013 int UtcDaliAnimationGetDefaultAlphaFunctionP(void)
1015 TestApplication application;
1017 Animation animation = Animation::New(1.0f);
1018 AlphaFunction func = animation.GetDefaultAlphaFunction();
1020 // Test that the default is linear
1021 DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1023 animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1024 AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1025 DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1030 int UtcDaliAnimationSetCurrentProgressP(void)
1032 TestApplication application;
1034 Actor actor = Actor::New();
1035 Stage::GetCurrent().Add(actor);
1037 // Build the animation
1038 Animation animation = Animation::New(0.0f);
1041 float durationSeconds(1.0f);
1042 animation.SetDuration(durationSeconds);
1044 bool signalReceived(false);
1045 AnimationFinishCheck finishCheck(signalReceived);
1046 animation.FinishedSignal().Connect(&application, finishCheck);
1047 application.SendNotification();
1049 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1050 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1052 // Start the animation from 40% progress
1053 animation.SetCurrentProgress( 0.4f );
1056 application.SendNotification();
1057 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1059 // We didn't expect the animation to finish yet
1060 application.SendNotification();
1061 finishCheck.CheckSignalNotReceived();
1062 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1063 DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
1065 animation.Play(); // Test that calling play has no effect, when animation is already playing
1066 application.SendNotification();
1068 //Set the progress to 70%
1069 animation.SetCurrentProgress( 0.7f );
1070 application.SendNotification();
1071 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 80% progress */);
1072 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1074 application.SendNotification();
1075 finishCheck.CheckSignalNotReceived();
1076 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1077 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1079 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1080 // We did expect the animation to finish
1081 application.SendNotification();
1082 finishCheck.CheckSignalReceived();
1083 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1085 // Check that nothing has changed after a couple of buffer swaps
1086 application.Render(0);
1087 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1088 application.Render(0);
1089 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1093 int UtcDaliAnimationSetCurrentProgressN(void)
1095 TestApplication application;
1097 Actor actor = Actor::New();
1098 Stage::GetCurrent().Add(actor);
1100 // Build the animation
1101 Animation animation = Animation::New(0.0f);
1104 float durationSeconds(1.0f);
1105 animation.SetDuration(durationSeconds);
1107 bool signalReceived(false);
1108 AnimationFinishCheck finishCheck(signalReceived);
1109 animation.FinishedSignal().Connect(&application, finishCheck);
1110 application.SendNotification();
1112 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1113 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1115 //Trying to set the current cursor outside the range [0..1] is ignored
1116 animation.SetCurrentProgress( -1.0f);
1117 application.SendNotification();
1118 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1120 animation.SetCurrentProgress( 100.0f);
1121 application.SendNotification();
1122 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1126 int UtcDaliAnimationGetCurrentProgressP(void)
1128 TestApplication application;
1130 Actor actor = Actor::New();
1131 Stage::GetCurrent().Add(actor);
1133 // Build the animation
1134 Animation animation = Animation::New(0.0f);
1137 //Test GetCurrentProgress return 0.0 as the duration is 0.0
1138 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1140 animation.SetCurrentProgress( 0.5f );
1141 application.SendNotification();
1142 application.Render(static_cast<unsigned int>(100.0f));
1144 //Progress should still be 0.0
1145 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1148 float durationSeconds(1.0f);
1149 animation.SetDuration(durationSeconds);
1150 application.SendNotification();
1152 bool signalReceived(false);
1153 AnimationFinishCheck finishCheck(signalReceived);
1154 animation.FinishedSignal().Connect(&application, finishCheck);
1155 application.SendNotification();
1157 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1158 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1160 // Start the animation from 40% progress
1161 animation.SetCurrentProgress( 0.4f );
1164 application.SendNotification();
1165 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1167 // We didn't expect the animation to finish yet
1168 application.SendNotification();
1169 finishCheck.CheckSignalNotReceived();
1170 DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
1172 animation.Play(); // Test that calling play has no effect, when animation is already playing
1173 application.SendNotification();
1175 //Set the progress to 70%
1176 animation.SetCurrentProgress( 0.7f );
1177 application.SendNotification();
1178 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 80% progress */);
1179 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1181 application.SendNotification();
1182 finishCheck.CheckSignalNotReceived();
1183 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1185 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1186 // We did expect the animation to finish
1187 application.SendNotification();
1188 finishCheck.CheckSignalReceived();
1192 int UtcDaliAnimationSetSpeedFactorP1(void)
1194 TestApplication application;
1196 tet_printf("Testing that setting a speed factor of 2 takes half the time\n");
1198 Actor actor = Actor::New();
1199 Stage::GetCurrent().Add(actor);
1201 // Build the animation
1202 float durationSeconds(1.0f);
1203 Animation animation = Animation::New(durationSeconds);
1205 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1206 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1208 KeyFrames keyframes = KeyFrames::New();
1209 keyframes.Add( 0.0f, initialPosition);
1210 keyframes.Add( 1.0f, targetPosition );
1211 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1213 //Set speed to be x2
1214 animation.SetSpeedFactor(2.0f);
1216 // Start the animation
1219 bool signalReceived(false);
1220 AnimationFinishCheck finishCheck(signalReceived);
1221 animation.FinishedSignal().Connect(&application, finishCheck);
1223 application.SendNotification();
1224 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1226 // We didn't expect the animation to finish yet
1227 application.SendNotification();
1228 finishCheck.CheckSignalNotReceived();
1229 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1231 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1233 // We didn't expect the animation to finish yet
1234 application.SendNotification();
1235 finishCheck.CheckSignalNotReceived();
1236 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1238 application.Render(static_cast<unsigned int>(durationSeconds*100.0f) + 1u/*just beyond half the duration*/);
1240 // We did expect the animation to finish
1241 application.SendNotification();
1242 finishCheck.CheckSignalReceived();
1243 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1245 // Check that nothing has changed after a couple of buffer swaps
1246 application.Render(0);
1247 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1248 application.Render(0);
1249 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1254 int UtcDaliAnimationSetSpeedFactorP2(void)
1256 TestApplication application;
1258 Actor actor = Actor::New();
1259 Stage::GetCurrent().Add(actor);
1261 // Build the animation
1262 float durationSeconds(1.0f);
1263 Animation animation = Animation::New(durationSeconds);
1265 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1266 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1268 KeyFrames keyframes = KeyFrames::New();
1269 keyframes.Add( 0.0f, initialPosition);
1270 keyframes.Add( 1.0f, targetPosition );
1271 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1273 tet_printf("Test -1 speed factor. Animation will play in reverse at normal speed\n");
1274 animation.SetSpeedFactor( -1.0f );
1276 // Start the animation
1279 bool signalReceived(false);
1280 AnimationFinishCheck finishCheck(signalReceived);
1281 animation.FinishedSignal().Connect(&application, finishCheck);
1283 application.SendNotification();
1284 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1286 // We didn't expect the animation to finish yet
1287 application.SendNotification();
1288 finishCheck.CheckSignalNotReceived();
1289 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1291 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1293 // We didn't expect the animation to finish yet
1294 application.SendNotification();
1295 finishCheck.CheckSignalNotReceived();
1296 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1298 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1300 // We didn't expect the animation to finish yet
1301 application.SendNotification();
1302 finishCheck.CheckSignalNotReceived();
1303 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1305 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1307 // We didn't expect the animation to finish yet
1308 application.SendNotification();
1309 finishCheck.CheckSignalNotReceived();
1310 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1312 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1314 // We did expect the animation to finish
1315 application.SendNotification();
1316 finishCheck.CheckSignalReceived();
1317 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
1319 // Check that nothing has changed after a couple of buffer swaps
1320 application.Render(0);
1321 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1322 application.Render(0);
1323 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1328 int UtcDaliAnimationSetSpeedFactorP3(void)
1330 TestApplication application;
1332 Actor actor = Actor::New();
1333 Stage::GetCurrent().Add(actor);
1335 // Build the animation
1336 float durationSeconds(1.0f);
1337 Animation animation = Animation::New(durationSeconds);
1339 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1340 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1342 KeyFrames keyframes = KeyFrames::New();
1343 keyframes.Add( 0.0f, initialPosition);
1344 keyframes.Add( 1.0f, targetPosition );
1345 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1347 bool signalReceived(false);
1348 AnimationFinishCheck finishCheck(signalReceived);
1349 animation.FinishedSignal().Connect(&application, finishCheck);
1351 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1353 //Set speed to be half of normal speed
1354 animation.SetSpeedFactor( 0.5f );
1356 // Start the animation
1359 application.SendNotification();
1360 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1362 // We didn't expect the animation to finish yet
1363 application.SendNotification();
1364 finishCheck.CheckSignalNotReceived();
1365 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), TEST_LOCATION );
1367 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1369 // We didn't expect the animation to finish yet
1370 application.SendNotification();
1371 finishCheck.CheckSignalNotReceived();
1372 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1374 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
1376 // We didn't expect the animation to finish yet
1377 application.SendNotification();
1378 finishCheck.CheckSignalNotReceived();
1379 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.3f), TEST_LOCATION );
1381 application.SendNotification();
1382 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1384 // We didn't expect the animation to finish yet
1385 application.SendNotification();
1386 finishCheck.CheckSignalNotReceived();
1387 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1389 application.Render(static_cast<unsigned int>(durationSeconds*1200.0f) + 1u/*just beyond the animation duration*/);
1391 // We did expect the animation to finish
1392 application.SendNotification();
1393 finishCheck.CheckSignalReceived();
1394 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1396 // Check that nothing has changed after a couple of buffer swaps
1397 application.Render(0);
1398 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1399 application.Render(0);
1400 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1405 int UtcDaliAnimationSetSpeedFactorP4(void)
1407 TestApplication application;
1409 Actor actor = Actor::New();
1410 Stage::GetCurrent().Add(actor);
1412 // Build the animation
1413 float durationSeconds(1.0f);
1414 Animation animation = Animation::New(durationSeconds);
1416 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1417 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1419 KeyFrames keyframes = KeyFrames::New();
1420 keyframes.Add( 0.0f, initialPosition);
1421 keyframes.Add( 1.0f, targetPosition );
1422 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1424 bool signalReceived(false);
1425 AnimationFinishCheck finishCheck(signalReceived);
1426 animation.FinishedSignal().Connect(&application, finishCheck);
1428 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1430 tet_printf("Set speed to be half of normal speed\n");
1431 tet_printf("SetSpeedFactor(0.5f)\n");
1432 animation.SetSpeedFactor( 0.5f );
1434 // Start the animation
1437 application.SendNotification();
1438 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1440 // We didn't expect the animation to finish yet
1441 application.SendNotification();
1442 finishCheck.CheckSignalNotReceived();
1443 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), TEST_LOCATION );
1445 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1447 // We didn't expect the animation to finish yet
1448 application.SendNotification();
1449 finishCheck.CheckSignalNotReceived();
1450 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1452 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
1454 // We didn't expect the animation to finish yet
1455 application.SendNotification();
1456 finishCheck.CheckSignalNotReceived();
1457 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.3f), TEST_LOCATION );
1459 tet_printf("Reverse direction of animation whilst playing\n");
1460 tet_printf("SetSpeedFactor(-0.5f)\n");
1461 animation.SetSpeedFactor(-0.5f);
1463 application.SendNotification();
1464 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1466 // We didn't expect the animation to finish yet
1467 application.SendNotification();
1468 finishCheck.CheckSignalNotReceived();
1469 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1471 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1473 // We didn't expect the animation to finish yet
1474 application.SendNotification();
1475 finishCheck.CheckSignalNotReceived();
1476 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), 0.0001, TEST_LOCATION );
1478 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1480 // We did expect the animation to finish
1481 application.SendNotification();
1482 finishCheck.CheckSignalReceived();
1483 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
1485 // Check that nothing has changed after a couple of buffer swaps
1486 application.Render(0);
1487 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1488 application.Render(0);
1489 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1493 int UtcDaliAnimationSetSpeedFactorAndRange(void)
1495 TestApplication application;
1497 const unsigned int NUM_FRAMES(15);
1505 float expected[NUM_FRAMES];
1508 TestData testData[] = {
1510 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1511 /* |----------PlayRange---------------| */
1513 { 0.0f, 1.0f, // TimePeriod
1514 0.0f, 100.0f, // POS
1515 {/**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1516 /**/ 30.0f, 40.0f, 50.0f, 60.0f, /* Reverse direction */
1527 // ACTOR 1 - Across start of range
1528 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1529 /* |----------PlayRange---------------| */
1531 { 0.2f, 0.5f, // TimePeriod
1532 20.0f, 50.0f, // POS
1533 {/**/ 30.0f, 40.0f, 50.0f, 50.0f, 50.0f, /* Loop */
1534 /**/ 30.0f, 40.0f, 50.0f, 50.0f, /* Reverse direction @ frame #9 */
1544 // ACTOR 2 - Across end of range
1545 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1546 /* |----------PlayRange---------------| */
1548 {/**/ 0.5f, 0.9f, // TimePeriod
1549 /**/ 50.0f, 90.0f, // POS
1550 { /**/ 50.0f, 50.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1551 /**/ 50.0f, 50.0f, 50.0f, 60.0f,/* Reverse direction @ frame #9 */
1560 // ACTOR 3 - Before beginning of range
1561 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1562 /* |----------PlayRange---------------| */
1564 {/**/ 0.1f, 0.25f, // TimePeriod
1565 /**/ 10.0f, 25.0f, // POS
1567 /**/ 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f
1572 // ACTOR 4 - After end of range
1573 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1574 /* |----------PlayRange---------------| */
1576 {/**/ 0.85f, 1.0f, // TimePeriod
1577 /**/ 85.0f, 100.0f, // POS
1579 /**/ 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f
1583 // Actor 5 - Middle of range
1584 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1585 /* |----------PlayRange---------------| */
1587 {/**/ 0.4f, 0.65f, // Time Period
1588 /**/ 40.0f, 65.0f, // Position
1589 { /**/ 40.0f, 40.0f, 50.0f, 60.0f, 65.0f,
1590 /**/ 40.0f, 40.0f, 50.0f, 60.0f, // Reverse
1601 const size_t NUM_ENTRIES(sizeof(testData)/sizeof(TestData));
1603 // Build the animation
1604 float durationSeconds(1.0f);
1605 Animation animation = Animation::New(durationSeconds);
1606 bool signalReceived(false);
1607 AnimationFinishCheck finishCheck(signalReceived);
1608 animation.FinishedSignal().Connect(&application, finishCheck);
1610 std::vector<Dali::Actor> actors;
1612 for( unsigned int actorIndex = 0; actorIndex < NUM_ENTRIES; ++actorIndex )
1614 Actor actor = Actor::New();
1615 actor.SetPosition( Vector3( testData[actorIndex].startX, 0, 0 ) );
1616 actors.push_back(actor);
1617 Stage::GetCurrent().Add(actor);
1619 if( actorIndex == 0 || actorIndex == NUM_ENTRIES-1 )
1621 KeyFrames keyframes = KeyFrames::New();
1622 keyframes.Add( testData[actorIndex].startTime, Vector3(testData[actorIndex].startX, 0, 0));
1623 keyframes.Add( testData[actorIndex].endTime, Vector3(testData[actorIndex].endX, 0, 0));
1624 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1628 animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( testData[actorIndex].endX, 0, 0 ), TimePeriod( testData[actorIndex].startTime, testData[actorIndex].endTime - testData[actorIndex].startTime) );
1632 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1633 tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1634 tet_printf("SetSpeedFactor(0.5f)\n");
1635 animation.SetSpeedFactor( 0.5f );
1636 animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1637 animation.SetLooping(true);
1639 // Start the animation
1641 application.SendNotification();
1642 application.Render(0); // Frame 0 tests initial values
1644 for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1646 unsigned int actorIndex = 0u;
1647 for( actorIndex = 0u; actorIndex < NUM_ENTRIES; ++actorIndex )
1649 DALI_TEST_EQUALS( actors[actorIndex].GetCurrentPosition().x, testData[actorIndex].expected[frame], 0.001, TEST_LOCATION );
1650 if( ! Equals(actors[actorIndex].GetCurrentPosition().x, testData[actorIndex].expected[frame]) )
1652 tet_printf("Failed at frame %u, actorIndex %u\n", frame, actorIndex );
1658 tet_printf("Reverse direction of animation whilst playing after frame 8\n");
1659 tet_printf("SetSpeedFactor(-0.5f)\n");
1660 animation.SetSpeedFactor(-0.5f);
1661 application.SendNotification();
1663 application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1665 // We didn't expect the animation to finish yet
1666 application.SendNotification();
1667 finishCheck.CheckSignalNotReceived();
1673 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount01(void)
1675 TestApplication application;
1677 const unsigned int NUM_FRAMES(15);
1685 float expected[NUM_FRAMES];
1690 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1691 /* |----------PlayRange---------------| */
1692 { 0.0f, 1.0f, // TimePeriod
1693 0.0f, 100.0f, // POS
1694 {/**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1695 /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,
1696 /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,
1702 // Build the animation
1703 float durationSeconds(1.0f);
1704 Animation animation = Animation::New(durationSeconds);
1705 bool signalReceived(false);
1706 AnimationFinishCheck finishCheck(signalReceived);
1707 animation.FinishedSignal().Connect(&application, finishCheck);
1709 std::vector<Dali::Actor> actors;
1711 Actor actor = Actor::New();
1712 actor.SetPosition( Vector3( testData.startX, 0, 0 ) );
1713 actors.push_back(actor);
1714 Stage::GetCurrent().Add(actor);
1716 KeyFrames keyframes = KeyFrames::New();
1717 keyframes.Add( testData.startTime, Vector3(testData.startX, 0, 0));
1718 keyframes.Add( testData.endTime, Vector3(testData.endX, 0, 0));
1719 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1721 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1722 tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1723 tet_printf("SetSpeedFactor(0.5f)\n");
1724 tet_printf("SetLoopCount(3)\n");
1725 animation.SetSpeedFactor( 0.5f );
1726 animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1727 animation.SetLoopCount(3);
1729 // Start the animation
1731 application.SendNotification();
1732 application.Render(0); // Frame 0 tests initial values
1734 for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1736 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, testData.expected[frame], 0.001, TEST_LOCATION );
1738 application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1740 if( frame < NUM_FRAMES-1 )
1742 // We didn't expect the animation to finish yet
1743 application.SendNotification();
1744 finishCheck.CheckSignalNotReceived();
1748 // We did expect the animation to finish
1749 application.SendNotification();
1750 finishCheck.CheckSignalReceived();
1751 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 80.0f, 0.001, TEST_LOCATION );
1756 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount02(void)
1758 TestApplication application;
1760 const unsigned int NUM_FRAMES(15);
1768 float expected[NUM_FRAMES];
1773 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1774 /* |----------PlayRange---------------| */
1775 { 0.0f, 1.0f, // TimePeriod
1776 0.0f, 100.0f, // POS
1777 {/**/ 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1778 /**/ 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1779 /**/ 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1784 // Build the animation
1785 float durationSeconds(1.0f);
1786 Animation animation = Animation::New(durationSeconds);
1787 bool signalReceived(false);
1788 AnimationFinishCheck finishCheck(signalReceived);
1789 animation.FinishedSignal().Connect(&application, finishCheck);
1791 std::vector<Dali::Actor> actors;
1793 Actor actor = Actor::New();
1794 actor.SetPosition( Vector3( testData.startX, 0, 0 ) );
1795 actors.push_back(actor);
1796 Stage::GetCurrent().Add(actor);
1798 KeyFrames keyframes = KeyFrames::New();
1799 keyframes.Add( testData.startTime, Vector3(testData.startX, 0, 0));
1800 keyframes.Add( testData.endTime, Vector3(testData.endX, 0, 0));
1801 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1803 tet_printf("Test reverse half speed factor. Animation will take twice the duration\n");
1804 tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1805 tet_printf("SetSpeedFactor(-0.5f)\n");
1806 tet_printf("SetLoopCount(3)\n");
1807 animation.SetSpeedFactor( -0.5f );
1808 animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1809 animation.SetLoopCount(3);
1811 // Start the animation
1813 application.SendNotification();
1814 application.Render(0); // Frame 0 tests initial values
1816 for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1818 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, testData.expected[frame], 0.001, TEST_LOCATION );
1820 application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1822 if( frame < NUM_FRAMES-1 )
1824 // We didn't expect the animation to finish yet
1825 application.SendNotification();
1826 finishCheck.CheckSignalNotReceived();
1830 // We did expect the animation to finish
1831 application.SendNotification();
1832 finishCheck.CheckSignalReceived();
1833 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 30.0f, 0.001, TEST_LOCATION );
1839 int UtcDaliAnimationGetSpeedFactorP(void)
1841 TestApplication application;
1843 Animation animation = Animation::New(1.0f);
1844 animation.SetSpeedFactor(0.5f);
1845 DALI_TEST_EQUALS(animation.GetSpeedFactor(), 0.5f, TEST_LOCATION);
1847 animation.SetSpeedFactor(-2.5f);
1848 DALI_TEST_EQUALS(animation.GetSpeedFactor(), -2.5f, TEST_LOCATION);
1852 int UtcDaliAnimationSetPlayRangeP(void)
1854 TestApplication application;
1856 Actor actor = Actor::New();
1857 Stage::GetCurrent().Add( actor );
1859 // Build the animation
1860 float durationSeconds( 1.0f );
1861 Animation animation = Animation::New( durationSeconds );
1863 bool signalReceived( false );
1864 AnimationFinishCheck finishCheck( signalReceived );
1865 animation.FinishedSignal().Connect( &application, finishCheck );
1866 application.SendNotification();
1868 // Set range between 0.4 and 0.8
1869 animation.SetPlayRange( Vector2( 0.4f, 0.9f ) );
1870 application.SendNotification();
1871 DALI_TEST_EQUALS( Vector2( 0.4f, 0.9f ), animation.GetPlayRange(), TEST_LOCATION );
1873 Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
1874 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR );
1876 // Start the animation from 40% progress
1879 application.SendNotification();
1880 application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 60% progress */ );
1882 // We didn't expect the animation to finish yet
1883 application.SendNotification();
1884 finishCheck.CheckSignalNotReceived();
1885 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.6f ), TEST_LOCATION );
1887 application.SendNotification();
1888 application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 80% progress */ );
1890 application.SendNotification();
1891 finishCheck.CheckSignalNotReceived();
1892 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.8f ), TEST_LOCATION );
1894 application.SendNotification();
1895 application.Render( static_cast< unsigned int >( durationSeconds*100.0f ) + 1u/*just beyond the animation duration*/ );
1897 // We did expect the animation to finish
1898 application.SendNotification();
1899 finishCheck.CheckSignalReceived();
1900 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.9f ), TEST_LOCATION );
1904 int UtcDaliAnimationSetPlayRangeN(void)
1906 TestApplication application;
1908 Actor actor = Actor::New();
1909 Stage::GetCurrent().Add(actor);
1911 // Build the animation
1912 Animation animation = Animation::New(0);
1913 application.SendNotification();
1915 //PlayRange out of bounds
1916 animation.SetPlayRange( Vector2(-1.0f,1.0f) );
1917 application.SendNotification();
1918 DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
1919 animation.SetPlayRange( Vector2(0.0f,2.0f) );
1920 application.SendNotification();
1921 DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
1923 //If playRange is not in the correct order it has to be ordered
1924 animation.SetPlayRange( Vector2(0.8f,0.2f) );
1925 application.SendNotification();
1926 DALI_TEST_EQUALS( Vector2(0.2f,0.8f), animation.GetPlayRange(), TEST_LOCATION );
1931 int UtcDaliAnimationGetPlayRangeP(void)
1933 TestApplication application;
1935 Actor actor = Actor::New();
1936 Stage::GetCurrent().Add( actor );
1938 // Build the animation
1939 Animation animation = Animation::New( 1.0f );
1940 application.SendNotification();
1942 //If PlayRange not specified it should be 0.0-1.0 by default
1943 DALI_TEST_EQUALS( Vector2( 0.0f,1.0f ), animation.GetPlayRange(), TEST_LOCATION );
1945 // Set range between 0.4 and 0.8
1946 animation.SetPlayRange( Vector2( 0.4f, 0.8f ) );
1947 application.SendNotification();
1948 DALI_TEST_EQUALS( Vector2( 0.4f, 0.8f ), animation.GetPlayRange(), TEST_LOCATION );
1953 int UtcDaliAnimationPlayP(void)
1955 TestApplication application;
1957 Actor actor = Actor::New();
1958 Stage::GetCurrent().Add(actor);
1960 // Build the animation
1961 float durationSeconds(1.0f);
1962 Animation animation = Animation::New(durationSeconds);
1963 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1964 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1966 // Start the animation
1969 bool signalReceived(false);
1970 AnimationFinishCheck finishCheck(signalReceived);
1971 animation.FinishedSignal().Connect(&application, finishCheck);
1973 application.SendNotification();
1974 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1976 // We didn't expect the animation to finish yet
1977 application.SendNotification();
1978 finishCheck.CheckSignalNotReceived();
1979 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1981 animation.Play(); // Test that calling play has no effect, when animation is already playing
1982 application.SendNotification();
1983 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1985 // We didn't expect the animation to finish yet
1986 application.SendNotification();
1987 finishCheck.CheckSignalNotReceived();
1988 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1990 animation.Play(); // Test that calling play has no effect, when animation is already playing
1991 application.SendNotification();
1992 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1994 // We didn't expect the animation to finish yet
1995 application.SendNotification();
1996 finishCheck.CheckSignalNotReceived();
1997 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1999 animation.Play(); // Test that calling play has no effect, when animation is already playing
2000 application.SendNotification();
2001 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2003 // We didn't expect the animation to finish yet
2004 application.SendNotification();
2005 finishCheck.CheckSignalNotReceived();
2006 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2008 animation.Play(); // Test that calling play has no effect, when animation is already playing
2009 application.SendNotification();
2010 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2012 // We did expect the animation to finish
2013 application.SendNotification();
2014 finishCheck.CheckSignalReceived();
2015 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2017 // Check that nothing has changed after a couple of buffer swaps
2018 application.Render(0);
2019 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2020 application.Render(0);
2021 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2025 int UtcDaliAnimationPlayOffStageP(void)
2027 // Test that an animation can be played, when the actor is off-stage.
2028 // When the actor is added to the stage, it should appear at the current position
2029 // i.e. where it would have been anyway, if on-stage from the beginning.
2031 TestApplication application;
2033 Actor actor = Actor::New();
2034 Vector3 basePosition(Vector3::ZERO);
2035 DALI_TEST_EQUALS( actor.GetCurrentPosition(), basePosition, TEST_LOCATION );
2036 // Not added to the stage!
2038 // Build the animation
2039 float durationSeconds(1.0f);
2040 Animation animation = Animation::New(durationSeconds);
2041 animation.SetDisconnectAction( Animation::Discard );
2042 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2043 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2045 // Start the animation
2048 bool signalReceived(false);
2049 AnimationFinishCheck finishCheck(signalReceived);
2050 animation.FinishedSignal().Connect(&application, finishCheck);
2052 application.SendNotification();
2053 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2055 // We didn't expect the animation to finish yet
2056 application.SendNotification();
2057 finishCheck.CheckSignalNotReceived();
2058 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*off-stage*/, TEST_LOCATION );
2061 Stage::GetCurrent().Add(actor);
2063 application.SendNotification();
2064 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2066 // We didn't expect the animation to finish yet
2067 application.SendNotification();
2068 finishCheck.CheckSignalNotReceived();
2069 Vector3 expectedPosition(basePosition + (targetPosition - basePosition)*0.4f);
2070 DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition/*on-stage*/, TEST_LOCATION );
2072 // Remove from the stage
2073 Stage::GetCurrent().Remove(actor);
2075 application.SendNotification();
2076 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2078 // We didn't expect the animation to finish yet
2079 application.SendNotification();
2080 finishCheck.CheckSignalNotReceived();
2081 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*back to start position*/, TEST_LOCATION );
2084 Stage::GetCurrent().Add(actor);
2086 application.SendNotification();
2087 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2089 // We didn't expect the animation to finish yet
2090 application.SendNotification();
2091 finishCheck.CheckSignalNotReceived();
2092 expectedPosition = Vector3(basePosition + (targetPosition - basePosition)*0.8f);
2093 DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition, TEST_LOCATION );
2095 application.SendNotification();
2096 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2098 // We did expect the animation to finish
2099 application.SendNotification();
2100 finishCheck.CheckSignalReceived();
2101 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2103 // Check that nothing has changed after a couple of buffer swaps
2104 application.Render(0);
2105 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2106 application.Render(0);
2107 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2111 int UtcDaliAnimationPlayDiscardHandleP(void)
2113 TestApplication application;
2115 Actor actor = Actor::New();
2116 Stage::GetCurrent().Add(actor);
2118 // Build the animation
2119 float durationSeconds(1.0f);
2120 Animation animation = Animation::New(durationSeconds);
2121 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2122 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2124 bool signalReceived(false);
2125 AnimationFinishCheck finishCheck(signalReceived);
2126 animation.FinishedSignal().Connect(&application, finishCheck);
2128 // Start the animation
2131 // This is a test of the "Fire and Forget" behaviour
2132 // Discard the animation handle!
2134 DALI_TEST_CHECK( !animation );
2136 application.SendNotification();
2137 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2139 // We didn't expect the animation to finish yet
2140 application.SendNotification();
2141 finishCheck.CheckSignalNotReceived();
2142 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2144 application.SendNotification();
2145 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2147 // We didn't expect the animation to finish yet
2148 application.SendNotification();
2149 finishCheck.CheckSignalNotReceived();
2150 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
2152 application.SendNotification();
2153 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2155 // We didn't expect the animation to finish yet
2156 application.SendNotification();
2157 finishCheck.CheckSignalNotReceived();
2158 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2160 application.SendNotification();
2161 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2163 // We didn't expect the animation to finish yet
2164 application.SendNotification();
2165 finishCheck.CheckSignalNotReceived();
2166 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2168 application.SendNotification();
2169 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2171 // We did expect the animation to finish
2172 application.SendNotification();
2173 finishCheck.CheckSignalReceived();
2174 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2176 // Check that nothing has changed after a couple of buffer swaps
2177 application.Render(0);
2178 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2179 application.Render(0);
2180 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2184 int UtcDaliAnimationPlayStopDiscardHandleP(void)
2186 TestApplication application;
2188 Actor actor = Actor::New();
2189 Stage::GetCurrent().Add(actor);
2191 // Build the animation
2192 float durationSeconds(1.0f);
2193 Animation animation = Animation::New(durationSeconds);
2194 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2195 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2197 // Start the animation
2200 bool signalReceived(false);
2201 AnimationFinishCheck finishCheck(signalReceived);
2202 animation.FinishedSignal().Connect(&application, finishCheck);
2204 application.SendNotification();
2205 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2207 // We didn't expect the animation to finish yet
2208 application.SendNotification();
2209 finishCheck.CheckSignalNotReceived();
2210 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2212 // This is a test of the "Fire and Forget" behaviour
2213 // Stop the animation, and Discard the animation handle!
2216 DALI_TEST_CHECK( !animation );
2218 application.SendNotification();
2219 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2221 // We expect the animation to finish at 20% progress
2222 application.SendNotification();
2223 finishCheck.CheckSignalReceived();
2224 finishCheck.Reset();
2225 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2227 application.SendNotification();
2228 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2230 // Check that nothing has changed
2231 application.SendNotification();
2232 finishCheck.CheckSignalNotReceived();
2233 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2235 application.SendNotification();
2236 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2238 // Check that nothing has changed
2239 application.SendNotification();
2240 finishCheck.CheckSignalNotReceived();
2241 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2243 application.SendNotification();
2244 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 100% progress */);
2246 // Check that nothing has changed
2247 application.SendNotification();
2248 finishCheck.CheckSignalNotReceived();
2249 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2253 int UtcDaliAnimationPlayRangeP(void)
2255 TestApplication application;
2257 Actor actor = Actor::New();
2258 Stage::GetCurrent().Add(actor);
2260 // Build the animation
2261 float durationSeconds(1.0f);
2262 Animation animation = Animation::New(durationSeconds);
2263 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2264 KeyFrames keyframes = KeyFrames::New();
2265 keyframes.Add( 0.0f , Vector3(0.0f,0.0f,0.0f ) );
2266 keyframes.Add( 1.0f , Vector3(100.0f,100.0f,100.0f ) );
2268 animation.AnimateBetween( Property( actor, Actor::Property::POSITION), keyframes );
2270 // Set range between 0.4 and 0.8
2271 animation.SetPlayRange( Vector2(0.4f,0.8f) );
2274 bool signalReceived(false);
2275 AnimationFinishCheck finishCheck(signalReceived);
2276 animation.FinishedSignal().Connect(&application, finishCheck);
2278 //Test that setting progress outside the range doesn't work
2279 animation.SetCurrentProgress( 0.9f );
2280 application.SendNotification();
2281 application.Render(0);
2282 DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
2283 animation.SetCurrentProgress( 0.2f );
2284 application.SendNotification();
2285 application.Render(0);
2286 DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
2288 application.SendNotification();
2289 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2291 // We didn't expect the animation to finish yet
2292 application.SendNotification();
2293 finishCheck.CheckSignalNotReceived();
2294 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2296 animation.Play(); // Test that calling play has no effect, when animation is already playing
2297 application.SendNotification();
2298 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/* 80% progress */);
2300 // We did expect the animation to finish
2301 application.SendNotification();
2302 finishCheck.CheckSignalReceived();
2303 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2305 // Check that nothing has changed after a couple of buffer swaps
2306 application.Render(0);
2307 DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentPosition(), TEST_LOCATION );
2308 application.Render(0);
2309 DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentPosition(), TEST_LOCATION );
2312 //Loop inside the range
2313 finishCheck.Reset();
2314 animation.SetLooping( true );
2316 application.SendNotification();
2317 float intervalSeconds = 0.1f;
2318 float progress = 0.4f;
2319 for (int iterations = 0; iterations < 10; ++iterations )
2321 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
2323 progress += intervalSeconds;
2324 if (progress > 0.8f)
2326 progress = progress - 0.4f;
2329 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
2332 // We didn't expect the animation to finish yet
2333 application.SendNotification();
2334 finishCheck.CheckSignalNotReceived();
2337 //Test change range on the fly
2338 animation.SetPlayRange( Vector2( 0.2f, 0.9f ) );
2339 application.SendNotification();
2341 for (int iterations = 0; iterations < 10; ++iterations )
2343 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
2345 progress += intervalSeconds;
2346 if (progress > 0.9f)
2348 progress = progress - 0.7f;
2351 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
2357 int UtcDaliAnimationPlayFromP(void)
2359 TestApplication application;
2361 Actor actor = Actor::New();
2362 Stage::GetCurrent().Add(actor);
2364 // Build the animation
2365 float durationSeconds(1.0f);
2366 Animation animation = Animation::New(durationSeconds);
2367 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2368 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2370 // Start the animation from 40% progress
2371 animation.PlayFrom( 0.4f );
2373 bool signalReceived(false);
2374 AnimationFinishCheck finishCheck(signalReceived);
2375 animation.FinishedSignal().Connect(&application, finishCheck);
2377 application.SendNotification();
2378 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2380 // We didn't expect the animation to finish yet
2381 application.SendNotification();
2382 finishCheck.CheckSignalNotReceived();
2383 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2385 animation.Play(); // Test that calling play has no effect, when animation is already playing
2386 application.SendNotification();
2387 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2389 // We didn't expect the animation to finish yet
2390 application.SendNotification();
2391 finishCheck.CheckSignalNotReceived();
2392 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2394 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2395 // We did expect the animation to finish
2396 application.SendNotification();
2397 finishCheck.CheckSignalReceived();
2398 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2400 // Check that nothing has changed after a couple of buffer swaps
2401 application.Render(0);
2402 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2403 application.Render(0);
2404 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2408 int UtcDaliAnimationPlayFromN(void)
2410 TestApplication application;
2412 Actor actor = Actor::New();
2413 Stage::GetCurrent().Add(actor);
2415 // Build the animation
2416 float durationSeconds(1.0f);
2417 Animation animation = Animation::New(durationSeconds);
2418 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2419 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2421 //PlayFrom with an argument outside the range [0..1] will be ignored
2422 animation.PlayFrom(-1.0f);
2423 application.SendNotification();
2424 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
2426 animation.PlayFrom(100.0f);
2427 application.SendNotification();
2428 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
2432 int UtcDaliAnimationPauseP(void)
2434 TestApplication application;
2436 Actor actor = Actor::New();
2437 Stage::GetCurrent().Add(actor);
2439 // Build the animation
2440 float durationSeconds(1.0f);
2441 Animation animation = Animation::New(durationSeconds);
2442 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2443 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2445 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2447 // Start the animation
2450 bool signalReceived(false);
2451 AnimationFinishCheck finishCheck(signalReceived);
2452 animation.FinishedSignal().Connect(&application, finishCheck);
2454 application.SendNotification();
2455 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2457 // We didn't expect the animation to finish yet
2458 application.SendNotification();
2459 finishCheck.CheckSignalNotReceived();
2460 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2462 // Pause the animation
2464 application.SendNotification();
2467 for (int i=0; i<5; ++i)
2469 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2471 // We didn't expect the animation to finish yet
2472 application.SendNotification();
2473 finishCheck.CheckSignalNotReceived();
2474 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
2479 application.SendNotification();
2480 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2482 // We didn't expect the animation to finish yet
2483 application.SendNotification();
2484 finishCheck.CheckSignalNotReceived();
2486 application.SendNotification();
2487 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2489 // We did expect the animation to finish
2490 application.SendNotification();
2491 finishCheck.CheckSignalReceived();
2492 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2494 // Check that nothing has changed after a couple of buffer swaps
2495 application.Render(0);
2496 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2497 application.Render(0);
2498 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2503 int UtcDaliAnimationGetStateP(void)
2505 TestApplication application;
2507 Actor actor = Actor::New();
2508 Stage::GetCurrent().Add(actor);
2510 // Build the animation
2511 float durationSeconds(1.0f);
2512 Animation animation = Animation::New(durationSeconds);
2513 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2514 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2515 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2517 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2519 // Start the animation
2522 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2524 bool signalReceived(false);
2525 AnimationFinishCheck finishCheck(signalReceived);
2526 animation.FinishedSignal().Connect(&application, finishCheck);
2528 application.SendNotification();
2529 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2531 // We didn't expect the animation to finish yet
2532 application.SendNotification();
2533 finishCheck.CheckSignalNotReceived();
2534 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2535 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2537 // Pause the animation
2539 DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
2540 application.SendNotification();
2541 application.Render(0.f);
2544 for (int i=0; i<5; ++i)
2546 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2548 // We didn't expect the animation to finish yet
2549 application.SendNotification();
2550 finishCheck.CheckSignalNotReceived();
2551 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
2552 DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
2556 finishCheck.Reset();
2558 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2559 application.SendNotification();
2560 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2561 // We didn't expect the animation to finish yet
2562 application.SendNotification();
2563 finishCheck.CheckSignalNotReceived();
2564 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2566 application.SendNotification();
2567 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2569 // We did expect the animation to finish
2570 application.SendNotification();
2571 finishCheck.CheckSignalReceived();
2572 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2573 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2575 // Check that nothing has changed after a couple of buffer swaps
2576 application.Render(0);
2577 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2578 application.Render(0);
2579 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2580 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2583 finishCheck.Reset();
2585 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2586 application.SendNotification();
2587 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2588 application.SendNotification();
2589 finishCheck.CheckSignalNotReceived();
2590 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2596 int UtcDaliAnimationStopP(void)
2598 TestApplication application;
2600 Actor actor = Actor::New();
2601 Stage::GetCurrent().Add(actor);
2603 // Build the animation
2604 float durationSeconds(1.0f);
2605 Animation animation = Animation::New(durationSeconds);
2606 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2607 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2609 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2611 // Start the animation
2614 bool signalReceived(false);
2615 AnimationFinishCheck finishCheck(signalReceived);
2616 animation.FinishedSignal().Connect(&application, finishCheck);
2618 application.SendNotification();
2619 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2621 // We didn't expect the animation to finish yet
2622 application.SendNotification();
2623 finishCheck.CheckSignalNotReceived();
2624 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2626 // Stop the animation
2628 application.SendNotification();
2631 for (int i=0; i<5; ++i)
2633 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2635 // We did expect the animation to finish
2636 application.SendNotification();
2637 finishCheck.CheckSignalReceived();
2638 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when stopped */, TEST_LOCATION );
2643 int UtcDaliAnimationStopSetPositionP(void)
2645 // Test that Animation::Stop & Actor::SetPosition can be used in conjunction
2646 // i.e. to check that the animation does not interfere with the position set.
2648 TestApplication application;
2650 Actor actor = Actor::New();
2651 Stage::GetCurrent().Add(actor);
2653 // Build the animation
2654 float durationSeconds(1.0f);
2655 Animation animation = Animation::New(durationSeconds);
2656 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2657 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2659 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2661 // Start the animation
2664 bool signalReceived(false);
2665 AnimationFinishCheck finishCheck(signalReceived);
2666 animation.FinishedSignal().Connect(&application, finishCheck);
2668 application.SendNotification();
2669 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2671 // We didn't expect the animation to finish yet
2672 application.SendNotification();
2673 finishCheck.CheckSignalNotReceived();
2674 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2676 // Stop the animation
2678 Vector3 positionSet(2.0f, 3.0f, 4.0f);
2679 actor.SetPosition(positionSet);
2680 application.SendNotification();
2683 for (int i=0; i<5; ++i)
2685 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2687 // We did expect the animation to finish
2688 application.SendNotification();
2689 finishCheck.CheckSignalReceived();
2690 DALI_TEST_EQUALS( actor.GetCurrentPosition(), positionSet/*Animation should not interfere with this*/, TEST_LOCATION );
2695 int UtcDaliAnimationClearP(void)
2697 TestApplication application;
2699 Actor actor = Actor::New();
2700 Stage::GetCurrent().Add(actor);
2702 // Build the animation
2703 float durationSeconds(1.0f);
2704 Animation animation = Animation::New(durationSeconds);
2705 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2706 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2708 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2710 // Start the animation
2713 bool signalReceived(false);
2714 AnimationFinishCheck finishCheck(signalReceived);
2715 animation.FinishedSignal().Connect(&application, finishCheck);
2717 application.SendNotification();
2718 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2720 // We didn't expect the animation to finish yet
2721 application.SendNotification();
2722 finishCheck.CheckSignalNotReceived();
2723 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2725 // Clear the animation
2727 application.SendNotification();
2729 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2731 // We don't expect the animation to finish now
2732 application.SendNotification();
2733 finishCheck.CheckSignalNotReceived();
2734 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress since the animator was destroyed */, TEST_LOCATION );
2736 // Restart as a scale animation; this should not move the actor's position
2737 finishCheck.Reset();
2738 actor.SetPosition(Vector3::ZERO);
2739 Vector3 targetScale(3.0f, 3.0f, 3.0f);
2740 animation.AnimateTo( Property( actor, Actor::Property::SCALE ), targetScale, AlphaFunction::LINEAR );
2743 application.SendNotification();
2744 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2746 // We didn't expect the animation to finish yet
2747 application.SendNotification();
2748 finishCheck.CheckSignalNotReceived();
2749 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
2750 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION );
2752 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2754 // We did expect the animation to finish
2755 application.SendNotification();
2756 finishCheck.CheckSignalReceived();
2757 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
2758 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
2762 int UtcDaliAnimationFinishedSignalP(void)
2764 TestApplication application;
2766 // Start the empty animation
2767 float durationSeconds(1.0f);
2768 Animation animation = Animation::New(durationSeconds);
2771 bool signalReceived(false);
2772 AnimationFinishCheck finishCheck(signalReceived);
2773 animation.FinishedSignal().Connect(&application, finishCheck);
2775 application.SendNotification();
2776 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*beyond the animation duration*/);
2778 // We did expect the animation to finish
2779 application.SendNotification();
2780 finishCheck.CheckSignalReceived();
2784 int UtcDaliAnimationAnimateByBooleanP(void)
2786 TestApplication application;
2788 Actor actor = Actor::New();
2790 // Register a boolean property
2791 bool startValue(false);
2792 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2793 Stage::GetCurrent().Add(actor);
2794 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2796 // Build the animation
2797 float durationSeconds(2.0f);
2798 Animation animation = Animation::New(durationSeconds);
2799 const bool relativeValue(true);
2800 const bool finalValue( false || relativeValue );
2801 animation.AnimateBy(Property(actor, index), relativeValue);
2803 // Start the animation
2806 bool signalReceived(false);
2807 AnimationFinishCheck finishCheck(signalReceived);
2808 animation.FinishedSignal().Connect(&application, finishCheck);
2810 application.SendNotification();
2811 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2813 // We didn't expect the animation to finish yet
2814 application.SendNotification();
2815 finishCheck.CheckSignalNotReceived();
2816 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2818 application.SendNotification();
2819 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2821 // We did expect the animation to finish
2822 application.SendNotification();
2823 finishCheck.CheckSignalReceived();
2824 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2826 // Check that nothing has changed after a couple of buffer swaps
2827 application.Render(0);
2828 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2829 application.Render(0);
2830 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2832 // Repeat with relative value "false" - this should be an NOOP
2833 animation = Animation::New(durationSeconds);
2834 bool noOpValue(false);
2835 animation.AnimateBy(Property(actor, index), noOpValue);
2837 // Start the animation
2840 finishCheck.Reset();
2841 animation.FinishedSignal().Connect(&application, finishCheck);
2843 application.SendNotification();
2844 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2846 // We didn't expect the animation to finish yet
2847 application.SendNotification();
2848 finishCheck.CheckSignalNotReceived();
2849 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2851 application.SendNotification();
2852 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2854 // We did expect the animation to finish
2855 application.SendNotification();
2856 finishCheck.CheckSignalReceived();
2857 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2859 // Check that nothing has changed after a couple of buffer swaps
2860 application.Render(0);
2861 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2862 application.Render(0);
2863 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2867 int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void)
2869 TestApplication application;
2871 Actor actor = Actor::New();
2873 // Register a boolean property
2874 bool startValue(false);
2875 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2876 Stage::GetCurrent().Add(actor);
2877 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2879 // Build the animation
2880 float durationSeconds(2.0f);
2881 Animation animation = Animation::New(durationSeconds);
2882 bool relativeValue(true);
2883 bool finalValue( false || relativeValue );
2884 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN);
2886 // Start the animation
2889 bool signalReceived(false);
2890 AnimationFinishCheck finishCheck(signalReceived);
2891 animation.FinishedSignal().Connect(&application, finishCheck);
2893 application.SendNotification();
2894 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2896 // We didn't expect the animation to finish yet
2897 application.SendNotification();
2898 finishCheck.CheckSignalNotReceived();
2899 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2901 application.SendNotification();
2902 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2904 // We did expect the animation to finish
2905 application.SendNotification();
2906 finishCheck.CheckSignalReceived();
2907 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2909 // Check that nothing has changed after a couple of buffer swaps
2910 application.Render(0);
2911 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2912 application.Render(0);
2913 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2915 // Repeat with relative value "false" - this should be an NOOP
2916 animation = Animation::New(durationSeconds);
2917 bool noOpValue(false);
2918 animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunction::EASE_IN);
2920 // Start the animation
2923 finishCheck.Reset();
2924 animation.FinishedSignal().Connect(&application, finishCheck);
2926 application.SendNotification();
2927 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2929 // We didn't expect the animation to finish yet
2930 application.SendNotification();
2931 finishCheck.CheckSignalNotReceived();
2932 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2934 application.SendNotification();
2935 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2937 // We did expect the animation to finish
2938 application.SendNotification();
2939 finishCheck.CheckSignalReceived();
2940 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2944 int UtcDaliAnimationAnimateByBooleanTimePeriodP(void)
2946 TestApplication application;
2948 Actor actor = Actor::New();
2950 // Register a boolean property
2951 bool startValue(false);
2952 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2953 Stage::GetCurrent().Add(actor);
2954 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2956 // Build the animation
2957 float durationSeconds(2.0f);
2958 Animation animation = Animation::New(durationSeconds);
2959 bool relativeValue(true);
2960 bool finalValue( false || relativeValue );
2961 float animatorDurationSeconds(durationSeconds * 0.5f);
2962 animation.AnimateBy( Property(actor, index),
2964 TimePeriod( animatorDurationSeconds ) );
2966 // Start the animation
2969 bool signalReceived(false);
2970 AnimationFinishCheck finishCheck(signalReceived);
2971 animation.FinishedSignal().Connect(&application, finishCheck);
2973 application.SendNotification();
2974 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
2976 // We didn't expect the animation to finish yet
2977 application.SendNotification();
2978 finishCheck.CheckSignalNotReceived();
2979 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2981 application.SendNotification();
2982 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
2984 // We didn't expect the animation to finish yet...
2985 application.SendNotification();
2986 finishCheck.CheckSignalNotReceived();
2988 // ...however we should have reached the final value
2989 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2991 application.SendNotification();
2992 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
2994 // We did expect the animation to finish
2995 application.SendNotification();
2996 finishCheck.CheckSignalReceived();
2997 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2999 // Check that nothing has changed after a couple of buffer swaps
3000 application.Render(0);
3001 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3002 application.Render(0);
3003 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3007 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void)
3009 TestApplication application;
3011 Actor actor = Actor::New();
3013 // Register a boolean property
3014 bool startValue(false);
3015 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3016 Stage::GetCurrent().Add(actor);
3017 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3019 // Build the animation
3020 float durationSeconds(2.0f);
3021 Animation animation = Animation::New(durationSeconds);
3022 bool relativeValue(true);
3023 bool finalValue( false || relativeValue );
3024 float animatorDurationSeconds(durationSeconds * 0.5f);
3025 animation.AnimateBy( Property(actor, index),
3027 AlphaFunction::EASE_IN_OUT,
3028 TimePeriod( animatorDurationSeconds ) );
3030 // Start the animation
3033 bool signalReceived(false);
3034 AnimationFinishCheck finishCheck(signalReceived);
3035 animation.FinishedSignal().Connect(&application, finishCheck);
3037 application.SendNotification();
3038 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
3040 // We didn't expect the animation to finish yet
3041 application.SendNotification();
3042 finishCheck.CheckSignalNotReceived();
3043 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3045 application.SendNotification();
3046 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
3048 // We didn't expect the animation to finish yet...
3049 application.SendNotification();
3050 finishCheck.CheckSignalNotReceived();
3052 // ...however we should have reached the final value
3053 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3055 application.SendNotification();
3056 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
3058 // We did expect the animation to finish
3059 application.SendNotification();
3060 finishCheck.CheckSignalReceived();
3061 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3063 // Check that nothing has changed after a couple of buffer swaps
3064 application.Render(0);
3065 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3066 application.Render(0);
3067 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3071 int UtcDaliAnimationAnimateByFloatP(void)
3073 TestApplication application;
3075 Actor actor = Actor::New();
3077 // Register a float property
3078 float startValue(10.0f);
3079 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3080 Stage::GetCurrent().Add(actor);
3081 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3083 // Build the animation
3084 float durationSeconds(2.0f);
3085 Animation animation = Animation::New(durationSeconds);
3086 float targetValue(50.0f);
3087 float relativeValue(targetValue - startValue);
3088 animation.AnimateBy(Property(actor, index), relativeValue);
3090 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3092 // Start the animation
3095 bool signalReceived(false);
3096 AnimationFinishCheck finishCheck(signalReceived);
3097 animation.FinishedSignal().Connect(&application, finishCheck);
3099 application.SendNotification();
3100 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3102 // We didn't expect the animation to finish yet
3103 application.SendNotification();
3104 finishCheck.CheckSignalNotReceived();
3105 DALI_TEST_EQUALS( actor.GetProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION );
3107 application.SendNotification();
3108 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3110 // We did expect the animation to finish
3111 application.SendNotification();
3112 finishCheck.CheckSignalReceived();
3113 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3115 // Check that nothing has changed after a couple of buffer swaps
3116 application.Render(0);
3117 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3118 application.Render(0);
3119 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3123 int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void)
3125 TestApplication application;
3127 Actor actor = Actor::New();
3129 // Register a float property
3130 float startValue(10.0f);
3131 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3132 Stage::GetCurrent().Add(actor);
3133 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3135 // Build the animation
3136 float durationSeconds(1.0f);
3137 Animation animation = Animation::New(durationSeconds);
3138 float targetValue(90.0f);
3139 float relativeValue(targetValue - startValue);
3140 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3142 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3144 // Start the animation
3147 bool signalReceived(false);
3148 AnimationFinishCheck finishCheck(signalReceived);
3149 animation.FinishedSignal().Connect(&application, finishCheck);
3151 application.SendNotification();
3152 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3154 // We didn't expect the animation to finish yet
3155 application.SendNotification();
3156 finishCheck.CheckSignalNotReceived();
3158 // The position should have moved more, than with a linear alpha function
3159 float current(actor.GetProperty<float>(index));
3160 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3162 application.SendNotification();
3163 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3165 // We did expect the animation to finish
3166 application.SendNotification();
3167 finishCheck.CheckSignalReceived();
3168 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3170 // Check that nothing has changed after a couple of buffer swaps
3171 application.Render(0);
3172 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3173 application.Render(0);
3174 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3178 int UtcDaliAnimationAnimateByFloatTimePeriodP(void)
3180 TestApplication application;
3182 Actor actor = Actor::New();
3184 // Register a float property
3185 float startValue(10.0f);
3186 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3187 Stage::GetCurrent().Add(actor);
3188 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3190 // Build the animation
3191 float durationSeconds(1.0f);
3192 Animation animation = Animation::New(durationSeconds);
3193 float targetValue(30.0f);
3194 float relativeValue(targetValue - startValue);
3196 animation.AnimateBy(Property(actor, index),
3198 TimePeriod(delay, durationSeconds - delay));
3200 // Start the animation
3203 bool signalReceived(false);
3204 AnimationFinishCheck finishCheck(signalReceived);
3205 animation.FinishedSignal().Connect(&application, finishCheck);
3207 application.SendNotification();
3208 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3210 // We didn't expect the animation to finish yet
3211 application.SendNotification();
3212 finishCheck.CheckSignalNotReceived();
3213 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3215 application.SendNotification();
3216 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3218 // We didn't expect the animation to finish yet
3219 application.SendNotification();
3220 finishCheck.CheckSignalNotReceived();
3221 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3223 application.SendNotification();
3224 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3226 // We did expect the animation to finish
3227 application.SendNotification();
3228 finishCheck.CheckSignalReceived();
3229 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3231 // Check that nothing has changed after a couple of buffer swaps
3232 application.Render(0);
3233 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3234 application.Render(0);
3235 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3239 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void)
3241 TestApplication application;
3243 Actor actor = Actor::New();
3245 // Register a float property
3246 float startValue(10.0f);
3247 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3248 Stage::GetCurrent().Add(actor);
3249 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3251 // Build the animation
3252 float durationSeconds(1.0f);
3253 Animation animation = Animation::New(durationSeconds);
3254 float targetValue(30.0f);
3255 float relativeValue(targetValue - startValue);
3257 animation.AnimateBy(Property(actor, index),
3259 AlphaFunction::LINEAR,
3260 TimePeriod(delay, durationSeconds - delay));
3262 // Start the animation
3265 bool signalReceived(false);
3266 AnimationFinishCheck finishCheck(signalReceived);
3267 animation.FinishedSignal().Connect(&application, finishCheck);
3269 application.SendNotification();
3270 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3272 // We didn't expect the animation to finish yet
3273 application.SendNotification();
3274 finishCheck.CheckSignalNotReceived();
3275 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3277 application.SendNotification();
3278 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3280 // We didn't expect the animation to finish yet
3281 application.SendNotification();
3282 finishCheck.CheckSignalNotReceived();
3283 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3285 application.SendNotification();
3286 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3288 // We did expect the animation to finish
3289 application.SendNotification();
3290 finishCheck.CheckSignalReceived();
3291 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3293 // Check that nothing has changed after a couple of buffer swaps
3294 application.Render(0);
3295 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3296 application.Render(0);
3297 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3301 int UtcDaliAnimationAnimateByIntegerP(void)
3303 TestApplication application;
3305 Actor actor = Actor::New();
3307 // Register an integer property
3309 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3310 Stage::GetCurrent().Add(actor);
3311 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3313 // Build the animation
3314 float durationSeconds(2.0f);
3315 Animation animation = Animation::New(durationSeconds);
3316 int targetValue(50);
3317 int relativeValue(targetValue - startValue);
3318 animation.AnimateBy(Property(actor, index), relativeValue);
3320 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3322 // Start the animation
3325 bool signalReceived(false);
3326 AnimationFinishCheck finishCheck(signalReceived);
3327 animation.FinishedSignal().Connect(&application, finishCheck);
3329 application.SendNotification();
3330 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3332 // We didn't expect the animation to finish yet
3333 application.SendNotification();
3334 finishCheck.CheckSignalNotReceived();
3335 DALI_TEST_EQUALS( actor.GetProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION );
3337 application.SendNotification();
3338 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3340 // We did expect the animation to finish
3341 application.SendNotification();
3342 finishCheck.CheckSignalReceived();
3343 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3345 // Check that nothing has changed after a couple of buffer swaps
3346 application.Render(0);
3347 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3348 application.Render(0);
3349 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3353 int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void)
3355 TestApplication application;
3357 Actor actor = Actor::New();
3359 // Register an integer property
3361 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3362 Stage::GetCurrent().Add(actor);
3363 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3365 // Build the animation
3366 float durationSeconds(1.0f);
3367 Animation animation = Animation::New(durationSeconds);
3368 int targetValue(90);
3369 int relativeValue(targetValue - startValue);
3370 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3372 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3374 // Start the animation
3377 bool signalReceived(false);
3378 AnimationFinishCheck finishCheck(signalReceived);
3379 animation.FinishedSignal().Connect(&application, finishCheck);
3381 application.SendNotification();
3382 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3384 // We didn't expect the animation to finish yet
3385 application.SendNotification();
3386 finishCheck.CheckSignalNotReceived();
3388 // The position should have moved more, than with a linear alpha function
3389 int current(actor.GetProperty<int>(index));
3390 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3392 application.SendNotification();
3393 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3395 // We did expect the animation to finish
3396 application.SendNotification();
3397 finishCheck.CheckSignalReceived();
3398 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3400 // Check that nothing has changed after a couple of buffer swaps
3401 application.Render(0);
3402 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3403 application.Render(0);
3404 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3408 int UtcDaliAnimationAnimateByIntegerTimePeriodP(void)
3410 TestApplication application;
3412 Actor actor = Actor::New();
3414 // Register an integer property
3416 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3417 Stage::GetCurrent().Add(actor);
3418 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3420 // Build the animation
3421 float durationSeconds(1.0f);
3422 Animation animation = Animation::New(durationSeconds);
3423 int targetValue(30);
3424 int relativeValue(targetValue - startValue);
3426 animation.AnimateBy(Property(actor, index),
3428 TimePeriod(delay, durationSeconds - delay));
3430 // Start the animation
3433 bool signalReceived(false);
3434 AnimationFinishCheck finishCheck(signalReceived);
3435 animation.FinishedSignal().Connect(&application, finishCheck);
3437 application.SendNotification();
3438 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3440 // We didn't expect the animation to finish yet
3441 application.SendNotification();
3442 finishCheck.CheckSignalNotReceived();
3443 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3445 application.SendNotification();
3446 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3448 // We didn't expect the animation to finish yet
3449 application.SendNotification();
3450 finishCheck.CheckSignalNotReceived();
3451 DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3453 application.SendNotification();
3454 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3456 // We did expect the animation to finish
3457 application.SendNotification();
3458 finishCheck.CheckSignalReceived();
3459 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3461 // Check that nothing has changed after a couple of buffer swaps
3462 application.Render(0);
3463 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3464 application.Render(0);
3465 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3469 int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void)
3471 TestApplication application;
3473 Actor actor = Actor::New();
3475 // Register an integer property
3477 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3478 Stage::GetCurrent().Add(actor);
3479 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3481 // Build the animation
3482 float durationSeconds(1.0f);
3483 Animation animation = Animation::New(durationSeconds);
3484 int targetValue(30);
3485 int relativeValue(targetValue - startValue);
3487 animation.AnimateBy(Property(actor, index),
3489 AlphaFunction::LINEAR,
3490 TimePeriod(delay, durationSeconds - delay));
3492 // Start the animation
3495 bool signalReceived(false);
3496 AnimationFinishCheck finishCheck(signalReceived);
3497 animation.FinishedSignal().Connect(&application, finishCheck);
3499 application.SendNotification();
3500 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3502 // We didn't expect the animation to finish yet
3503 application.SendNotification();
3504 finishCheck.CheckSignalNotReceived();
3505 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3507 application.SendNotification();
3508 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3510 // We didn't expect the animation to finish yet
3511 application.SendNotification();
3512 finishCheck.CheckSignalNotReceived();
3513 DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3515 application.SendNotification();
3516 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3518 // We did expect the animation to finish
3519 application.SendNotification();
3520 finishCheck.CheckSignalReceived();
3521 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3523 // Check that nothing has changed after a couple of buffer swaps
3524 application.Render(0);
3525 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3526 application.Render(0);
3527 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3531 int UtcDaliAnimationAnimateByVector2P(void)
3533 TestApplication application;
3535 Actor actor = Actor::New();
3537 // Register a Vector2 property
3538 Vector2 startValue(10.0f, 10.0f);
3539 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3540 Stage::GetCurrent().Add(actor);
3541 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3543 // Build the animation
3544 float durationSeconds(2.0f);
3545 Animation animation = Animation::New(durationSeconds);
3546 Vector2 targetValue(60.0f, 60.0f);
3547 Vector2 relativeValue(targetValue - startValue);
3548 animation.AnimateBy(Property(actor, index), relativeValue);
3550 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3552 // Start the animation
3555 bool signalReceived(false);
3556 AnimationFinishCheck finishCheck(signalReceived);
3557 animation.FinishedSignal().Connect(&application, finishCheck);
3559 application.SendNotification();
3560 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3562 // We didn't expect the animation to finish yet
3563 application.SendNotification();
3564 finishCheck.CheckSignalNotReceived();
3565 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION );
3567 application.SendNotification();
3568 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3570 // We did expect the animation to finish
3571 application.SendNotification();
3572 finishCheck.CheckSignalReceived();
3573 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3575 // Check that nothing has changed after a couple of buffer swaps
3576 application.Render(0);
3577 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3578 application.Render(0);
3579 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3583 int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void)
3585 TestApplication application;
3587 Actor actor = Actor::New();
3589 // Register a Vector2 property
3590 Vector2 startValue(100.0f, 100.0f);
3591 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3592 Stage::GetCurrent().Add(actor);
3593 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3595 // Build the animation
3596 float durationSeconds(1.0f);
3597 Animation animation = Animation::New(durationSeconds);
3598 Vector2 targetValue(20.0f, 20.0f);
3599 Vector2 relativeValue(targetValue - startValue);
3600 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3602 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3604 // Start the animation
3607 bool signalReceived(false);
3608 AnimationFinishCheck finishCheck(signalReceived);
3609 animation.FinishedSignal().Connect(&application, finishCheck);
3611 application.SendNotification();
3612 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3614 // We didn't expect the animation to finish yet
3615 application.SendNotification();
3616 finishCheck.CheckSignalNotReceived();
3618 // The position should have moved more, than with a linear alpha function
3619 Vector2 current(actor.GetProperty<Vector2>(index));
3620 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3621 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3623 application.SendNotification();
3624 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3626 // We did expect the animation to finish
3627 application.SendNotification();
3628 finishCheck.CheckSignalReceived();
3629 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3631 // Check that nothing has changed after a couple of buffer swaps
3632 application.Render(0);
3633 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3634 application.Render(0);
3635 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3639 int UtcDaliAnimationAnimateByVector2TimePeriodP(void)
3641 TestApplication application;
3643 Actor actor = Actor::New();
3645 // Register a Vector2 property
3646 Vector2 startValue(10.0f, 10.0f);
3647 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3648 Stage::GetCurrent().Add(actor);
3649 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3651 // Build the animation
3652 float durationSeconds(1.0f);
3653 Animation animation = Animation::New(durationSeconds);
3654 Vector2 targetValue(30.0f, 30.0f);
3655 Vector2 relativeValue(targetValue - startValue);
3657 animation.AnimateBy(Property(actor, index),
3659 TimePeriod(delay, durationSeconds - delay));
3661 // Start the animation
3664 bool signalReceived(false);
3665 AnimationFinishCheck finishCheck(signalReceived);
3666 animation.FinishedSignal().Connect(&application, finishCheck);
3668 application.SendNotification();
3669 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3671 // We didn't expect the animation to finish yet
3672 application.SendNotification();
3673 finishCheck.CheckSignalNotReceived();
3674 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3676 application.SendNotification();
3677 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3679 // We didn't expect the animation to finish yet
3680 application.SendNotification();
3681 finishCheck.CheckSignalNotReceived();
3682 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3684 application.SendNotification();
3685 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3687 // We did expect the animation to finish
3688 application.SendNotification();
3689 finishCheck.CheckSignalReceived();
3690 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3692 // Check that nothing has changed after a couple of buffer swaps
3693 application.Render(0);
3694 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3695 application.Render(0);
3696 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3700 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void)
3702 TestApplication application;
3704 Actor actor = Actor::New();
3706 // Register a Vector2 property
3707 Vector2 startValue(5.0f, 5.0f);
3708 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3709 Stage::GetCurrent().Add(actor);
3710 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3712 // Build the animation
3713 float durationSeconds(1.0f);
3714 Animation animation = Animation::New(durationSeconds);
3715 Vector2 targetValue(10.0f, 10.0f);
3716 Vector2 relativeValue(targetValue - startValue);
3718 animation.AnimateBy(Property(actor, index),
3720 AlphaFunction::LINEAR,
3721 TimePeriod(delay, durationSeconds - delay));
3723 // Start the animation
3726 bool signalReceived(false);
3727 AnimationFinishCheck finishCheck(signalReceived);
3728 animation.FinishedSignal().Connect(&application, finishCheck);
3730 application.SendNotification();
3731 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3733 // We didn't expect the animation to finish yet
3734 application.SendNotification();
3735 finishCheck.CheckSignalNotReceived();
3736 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3738 application.SendNotification();
3739 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3741 // We didn't expect the animation to finish yet
3742 application.SendNotification();
3743 finishCheck.CheckSignalNotReceived();
3744 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3746 application.SendNotification();
3747 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3749 // We did expect the animation to finish
3750 application.SendNotification();
3751 finishCheck.CheckSignalReceived();
3752 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3754 // Check that nothing has changed after a couple of buffer swaps
3755 application.Render(0);
3756 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3757 application.Render(0);
3758 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3762 int UtcDaliAnimationAnimateByVector3P(void)
3764 TestApplication application;
3766 Actor actor = Actor::New();
3768 // Register a Vector3 property
3769 Vector3 startValue(10.0f, 10.0f, 10.0f);
3770 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3771 Stage::GetCurrent().Add(actor);
3772 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3774 // Build the animation
3775 float durationSeconds(2.0f);
3776 Animation animation = Animation::New(durationSeconds);
3777 Vector3 targetValue(60.0f, 60.0f, 60.0f);
3778 Vector3 relativeValue(targetValue - startValue);
3779 animation.AnimateBy(Property(actor, index), relativeValue);
3781 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3783 // Start the animation
3786 bool signalReceived(false);
3787 AnimationFinishCheck finishCheck(signalReceived);
3788 animation.FinishedSignal().Connect(&application, finishCheck);
3790 application.SendNotification();
3791 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3793 // We didn't expect the animation to finish yet
3794 application.SendNotification();
3795 finishCheck.CheckSignalNotReceived();
3796 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION );
3798 application.SendNotification();
3799 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3801 // We did expect the animation to finish
3802 application.SendNotification();
3803 finishCheck.CheckSignalReceived();
3804 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3806 // Check that nothing has changed after a couple of buffer swaps
3807 application.Render(0);
3808 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3809 application.Render(0);
3810 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3814 int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void)
3816 TestApplication application;
3818 Actor actor = Actor::New();
3820 // Register a Vector3 property
3821 Vector3 startValue(100.0f, 100.0f, 100.0f);
3822 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3823 Stage::GetCurrent().Add(actor);
3824 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3826 // Build the animation
3827 float durationSeconds(1.0f);
3828 Animation animation = Animation::New(durationSeconds);
3829 Vector3 targetValue(20.0f, 20.0f, 20.0f);
3830 Vector3 relativeValue(targetValue - startValue);
3831 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3833 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3835 // Start the animation
3838 bool signalReceived(false);
3839 AnimationFinishCheck finishCheck(signalReceived);
3840 animation.FinishedSignal().Connect(&application, finishCheck);
3842 application.SendNotification();
3843 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3845 // We didn't expect the animation to finish yet
3846 application.SendNotification();
3847 finishCheck.CheckSignalNotReceived();
3849 // The position should have moved more, than with a linear alpha function
3850 Vector3 current(actor.GetProperty<Vector3>(index));
3851 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3852 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3853 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
3855 application.SendNotification();
3856 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3858 // We did expect the animation to finish
3859 application.SendNotification();
3860 finishCheck.CheckSignalReceived();
3861 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3863 // Check that nothing has changed after a couple of buffer swaps
3864 application.Render(0);
3865 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3866 application.Render(0);
3867 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3871 int UtcDaliAnimationAnimateByVector3TimePeriodP(void)
3873 TestApplication application;
3875 Actor actor = Actor::New();
3877 // Register a Vector3 property
3878 Vector3 startValue(10.0f, 10.0f, 10.0f);
3879 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3880 Stage::GetCurrent().Add(actor);
3881 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3883 // Build the animation
3884 float durationSeconds(1.0f);
3885 Animation animation = Animation::New(durationSeconds);
3886 Vector3 targetValue(30.0f, 30.0f, 30.0f);
3887 Vector3 relativeValue(targetValue - startValue);
3889 animation.AnimateBy(Property(actor, index),
3891 TimePeriod(delay, durationSeconds - delay));
3893 // Start the animation
3896 bool signalReceived(false);
3897 AnimationFinishCheck finishCheck(signalReceived);
3898 animation.FinishedSignal().Connect(&application, finishCheck);
3900 application.SendNotification();
3901 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3903 // We didn't expect the animation to finish yet
3904 application.SendNotification();
3905 finishCheck.CheckSignalNotReceived();
3906 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3908 application.SendNotification();
3909 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3911 // We didn't expect the animation to finish yet
3912 application.SendNotification();
3913 finishCheck.CheckSignalNotReceived();
3914 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3916 application.SendNotification();
3917 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3919 // We did expect the animation to finish
3920 application.SendNotification();
3921 finishCheck.CheckSignalReceived();
3922 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3924 // Check that nothing has changed after a couple of buffer swaps
3925 application.Render(0);
3926 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3927 application.Render(0);
3928 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3932 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void)
3934 TestApplication application;
3936 Actor actor = Actor::New();
3938 // Register a Vector3 property
3939 Vector3 startValue(5.0f, 5.0f, 5.0f);
3940 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3941 Stage::GetCurrent().Add(actor);
3942 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3944 // Build the animation
3945 float durationSeconds(1.0f);
3946 Animation animation = Animation::New(durationSeconds);
3947 Vector3 targetValue(10.0f, 10.0f, 10.0f);
3948 Vector3 relativeValue(targetValue - startValue);
3950 animation.AnimateBy(Property(actor, index),
3952 AlphaFunction::LINEAR,
3953 TimePeriod(delay, durationSeconds - delay));
3955 // Start the animation
3958 bool signalReceived(false);
3959 AnimationFinishCheck finishCheck(signalReceived);
3960 animation.FinishedSignal().Connect(&application, finishCheck);
3962 application.SendNotification();
3963 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3965 // We didn't expect the animation to finish yet
3966 application.SendNotification();
3967 finishCheck.CheckSignalNotReceived();
3968 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3970 application.SendNotification();
3971 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3973 // We didn't expect the animation to finish yet
3974 application.SendNotification();
3975 finishCheck.CheckSignalNotReceived();
3976 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3978 application.SendNotification();
3979 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3981 // We did expect the animation to finish
3982 application.SendNotification();
3983 finishCheck.CheckSignalReceived();
3984 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3986 // Check that nothing has changed after a couple of buffer swaps
3987 application.Render(0);
3988 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3989 application.Render(0);
3990 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3994 int UtcDaliAnimationAnimateByVector4P(void)
3996 TestApplication application;
3998 Actor actor = Actor::New();
4000 // Register a Vector4 property
4001 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4002 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4003 Stage::GetCurrent().Add(actor);
4004 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4006 // Build the animation
4007 float durationSeconds(2.0f);
4008 Animation animation = Animation::New(durationSeconds);
4009 Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f);
4010 Vector4 relativeValue(targetValue - startValue);
4011 animation.AnimateBy(Property(actor, index), relativeValue);
4013 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4015 // Start the animation
4018 bool signalReceived(false);
4019 AnimationFinishCheck finishCheck(signalReceived);
4020 animation.FinishedSignal().Connect(&application, finishCheck);
4022 application.SendNotification();
4023 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4025 // We didn't expect the animation to finish yet
4026 application.SendNotification();
4027 finishCheck.CheckSignalNotReceived();
4028 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION );
4030 application.SendNotification();
4031 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4033 // We did expect the animation to finish
4034 application.SendNotification();
4035 finishCheck.CheckSignalReceived();
4036 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4038 // Check that nothing has changed after a couple of buffer swaps
4039 application.Render(0);
4040 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4041 application.Render(0);
4042 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4046 int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void)
4048 TestApplication application;
4050 Actor actor = Actor::New();
4052 // Register a Vector4 property
4053 Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f);
4054 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4055 Stage::GetCurrent().Add(actor);
4056 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4058 // Build the animation
4059 float durationSeconds(1.0f);
4060 Animation animation = Animation::New(durationSeconds);
4061 Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
4062 Vector4 relativeValue(targetValue - startValue);
4063 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4065 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4067 // Start the animation
4070 bool signalReceived(false);
4071 AnimationFinishCheck finishCheck(signalReceived);
4072 animation.FinishedSignal().Connect(&application, finishCheck);
4074 application.SendNotification();
4075 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4077 // We didn't expect the animation to finish yet
4078 application.SendNotification();
4079 finishCheck.CheckSignalNotReceived();
4081 // The position should have moved more, than with a linear alpha function
4082 Vector4 current(actor.GetProperty<Vector4>(index));
4083 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
4084 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
4085 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
4086 DALI_TEST_CHECK( current.w < ninetyFivePercentProgress.w );
4088 application.SendNotification();
4089 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4091 // We did expect the animation to finish
4092 application.SendNotification();
4093 finishCheck.CheckSignalReceived();
4094 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4096 // Check that nothing has changed after a couple of buffer swaps
4097 application.Render(0);
4098 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4099 application.Render(0);
4100 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4104 int UtcDaliAnimationAnimateByVector4TimePeriodP(void)
4106 TestApplication application;
4108 Actor actor = Actor::New();
4110 // Register a Vector4 property
4111 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4112 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4113 Stage::GetCurrent().Add(actor);
4114 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4116 // Build the animation
4117 float durationSeconds(1.0f);
4118 Animation animation = Animation::New(durationSeconds);
4119 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
4120 Vector4 relativeValue(targetValue - startValue);
4122 animation.AnimateBy(Property(actor, index),
4124 TimePeriod(delay, durationSeconds - delay));
4126 // Start the animation
4129 bool signalReceived(false);
4130 AnimationFinishCheck finishCheck(signalReceived);
4131 animation.FinishedSignal().Connect(&application, finishCheck);
4133 application.SendNotification();
4134 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4136 // We didn't expect the animation to finish yet
4137 application.SendNotification();
4138 finishCheck.CheckSignalNotReceived();
4139 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4141 application.SendNotification();
4142 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4144 // We didn't expect the animation to finish yet
4145 application.SendNotification();
4146 finishCheck.CheckSignalNotReceived();
4147 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
4149 application.SendNotification();
4150 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4152 // We did expect the animation to finish
4153 application.SendNotification();
4154 finishCheck.CheckSignalReceived();
4155 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4157 // Check that nothing has changed after a couple of buffer swaps
4158 application.Render(0);
4159 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4160 application.Render(0);
4161 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4165 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void)
4167 TestApplication application;
4169 Actor actor = Actor::New();
4171 // Register a Vector4 property
4172 Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f);
4173 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4174 Stage::GetCurrent().Add(actor);
4175 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4177 // Build the animation
4178 float durationSeconds(1.0f);
4179 Animation animation = Animation::New(durationSeconds);
4180 Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f);
4181 Vector4 relativeValue(targetValue - startValue);
4183 animation.AnimateBy(Property(actor, index),
4185 AlphaFunction::LINEAR,
4186 TimePeriod(delay, durationSeconds - delay));
4188 // Start the animation
4191 bool signalReceived(false);
4192 AnimationFinishCheck finishCheck(signalReceived);
4193 animation.FinishedSignal().Connect(&application, finishCheck);
4195 application.SendNotification();
4196 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4198 // We didn't expect the animation to finish yet
4199 application.SendNotification();
4200 finishCheck.CheckSignalNotReceived();
4201 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4203 application.SendNotification();
4204 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4206 // We didn't expect the animation to finish yet
4207 application.SendNotification();
4208 finishCheck.CheckSignalNotReceived();
4209 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
4211 application.SendNotification();
4212 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4214 // We did expect the animation to finish
4215 application.SendNotification();
4216 finishCheck.CheckSignalReceived();
4217 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4219 // Check that nothing has changed after a couple of buffer swaps
4220 application.Render(0);
4221 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4222 application.Render(0);
4223 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4227 int UtcDaliAnimationAnimateByActorPositionP(void)
4229 TestApplication application;
4231 Actor actor = Actor::New();
4232 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4233 actor.SetPosition(startPosition);
4234 Stage::GetCurrent().Add(actor);
4235 application.SendNotification();
4236 application.Render(0);
4237 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4239 // Build the animation
4240 float durationSeconds(1.0f);
4241 Animation animation = Animation::New(durationSeconds);
4242 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4243 Vector3 relativePosition(targetPosition - startPosition);
4244 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition);
4246 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4248 // Start the animation
4251 bool signalReceived(false);
4252 AnimationFinishCheck finishCheck(signalReceived);
4253 animation.FinishedSignal().Connect(&application, finishCheck);
4255 application.SendNotification();
4256 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4258 // We didn't expect the animation to finish yet
4259 application.SendNotification();
4260 finishCheck.CheckSignalNotReceived();
4261 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ninetyFivePercentProgress, TEST_LOCATION );
4263 application.SendNotification();
4264 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4266 // We did expect the animation to finish
4267 application.SendNotification();
4268 finishCheck.CheckSignalReceived();
4269 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4271 // Check that nothing has changed after a couple of buffer swaps
4272 application.Render(0);
4273 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4274 application.Render(0);
4275 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4279 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
4281 TestApplication application;
4283 Actor actor = Actor::New();
4284 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4285 actor.SetPosition(startPosition);
4286 Stage::GetCurrent().Add(actor);
4287 application.SendNotification();
4288 application.Render(0);
4289 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4291 // Build the animation
4292 float durationSeconds(1.0f);
4293 Animation animation = Animation::New(durationSeconds);
4294 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4295 Vector3 relativePosition(targetPosition - startPosition);
4296 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
4298 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4300 // Start the animation
4303 bool signalReceived(false);
4304 AnimationFinishCheck finishCheck(signalReceived);
4305 animation.FinishedSignal().Connect(&application, finishCheck);
4307 application.SendNotification();
4308 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4310 // We didn't expect the animation to finish yet
4311 application.SendNotification();
4312 finishCheck.CheckSignalNotReceived();
4314 // The position should have moved more, than with a linear alpha function
4315 Vector3 current(actor.GetCurrentPosition());
4316 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
4317 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
4318 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
4320 application.SendNotification();
4321 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4323 // We did expect the animation to finish
4324 application.SendNotification();
4325 finishCheck.CheckSignalReceived();
4326 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4328 // Check that nothing has changed after a couple of buffer swaps
4329 application.Render(0);
4330 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4331 application.Render(0);
4332 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4336 int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void)
4338 TestApplication application;
4340 Actor actor = Actor::New();
4341 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4342 actor.SetPosition(startPosition);
4343 Stage::GetCurrent().Add(actor);
4344 application.SendNotification();
4345 application.Render(0);
4346 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4348 // Build the animation
4349 float durationSeconds(1.0f);
4350 Animation animation = Animation::New(durationSeconds);
4351 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4352 Vector3 relativePosition(targetPosition - startPosition);
4354 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4356 TimePeriod(delay, durationSeconds - delay));
4358 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4360 // Start the animation
4363 bool signalReceived(false);
4364 AnimationFinishCheck finishCheck(signalReceived);
4365 animation.FinishedSignal().Connect(&application, finishCheck);
4367 application.SendNotification();
4368 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4370 // We didn't expect the animation to finish yet
4371 application.SendNotification();
4372 finishCheck.CheckSignalNotReceived();
4373 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4375 application.SendNotification();
4376 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4378 // We did expect the animation to finish
4379 application.SendNotification();
4380 finishCheck.CheckSignalReceived();
4381 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4383 // Check that nothing has changed after a couple of buffer swaps
4384 application.Render(0);
4385 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4386 application.Render(0);
4387 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4391 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void)
4393 TestApplication application;
4395 Actor actor = Actor::New();
4396 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4397 actor.SetPosition(startPosition);
4398 Stage::GetCurrent().Add(actor);
4399 application.SendNotification();
4400 application.Render(0);
4401 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4403 // Build the animation
4404 float durationSeconds(1.0f);
4405 Animation animation = Animation::New(durationSeconds);
4406 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4407 Vector3 relativePosition(targetPosition - startPosition);
4409 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4411 AlphaFunction::LINEAR,
4412 TimePeriod(delay, durationSeconds - delay));
4414 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4416 // Start the animation
4419 bool signalReceived(false);
4420 AnimationFinishCheck finishCheck(signalReceived);
4421 animation.FinishedSignal().Connect(&application, finishCheck);
4423 application.SendNotification();
4424 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4426 // We didn't expect the animation to finish yet
4427 application.SendNotification();
4428 finishCheck.CheckSignalNotReceived();
4429 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4431 application.SendNotification();
4432 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4434 // We did expect the animation to finish
4435 application.SendNotification();
4436 finishCheck.CheckSignalReceived();
4437 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4439 // Check that nothing has changed after a couple of buffer swaps
4440 application.Render(0);
4441 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4442 application.Render(0);
4443 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4447 int UtcDaliAnimationAnimateByActorOrientationP1(void)
4449 TestApplication application;
4451 Actor actor = Actor::New();
4452 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4453 Stage::GetCurrent().Add(actor);
4454 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4456 // Build the animation
4457 float durationSeconds(1.0f);
4458 Animation animation = Animation::New(durationSeconds);
4459 Degree relativeRotationDegrees(360.0f);
4460 Radian relativeRotationRadians(relativeRotationDegrees);
4461 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ) );
4463 // Start the animation
4466 bool signalReceived(false);
4467 AnimationFinishCheck finishCheck(signalReceived);
4468 animation.FinishedSignal().Connect(&application, finishCheck);
4470 application.SendNotification();
4471 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4473 // We didn't expect the animation to finish yet
4474 application.SendNotification();
4475 finishCheck.CheckSignalNotReceived();
4476 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4478 application.SendNotification();
4479 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4481 // We didn't expect the animation to finish yet
4482 application.SendNotification();
4483 finishCheck.CheckSignalNotReceived();
4484 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4486 application.SendNotification();
4487 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4489 // We didn't expect the animation to finish yet
4490 application.SendNotification();
4491 finishCheck.CheckSignalNotReceived();
4492 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4494 application.SendNotification();
4495 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4497 // We did expect the animation to finish
4498 application.SendNotification();
4499 finishCheck.CheckSignalReceived();
4500 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4504 int UtcDaliAnimationAnimateByActorOrientationP2(void)
4506 TestApplication application;
4508 tet_printf("Testing that rotation angle > 360 performs full rotations\n");
4510 Actor actor = Actor::New();
4511 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
4512 Stage::GetCurrent().Add(actor);
4513 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4515 // Build the animation
4516 float durationSeconds(1.0f);
4517 Animation animation = Animation::New(durationSeconds);
4518 Degree relativeRotationDegrees(710.0f);
4519 Radian relativeRotationRadians(relativeRotationDegrees);
4521 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), AngleAxis( relativeRotationRadians, Vector3::ZAXIS ) );
4523 // Start the animation
4526 bool signalReceived(false);
4527 AnimationFinishCheck finishCheck(signalReceived);
4528 animation.FinishedSignal().Connect(&application, finishCheck);
4530 application.SendNotification();
4531 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4533 // We didn't expect the animation to finish yet
4534 application.SendNotification();
4535 finishCheck.CheckSignalNotReceived();
4536 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4538 application.SendNotification();
4539 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4541 // We didn't expect the animation to finish yet
4542 application.SendNotification();
4543 finishCheck.CheckSignalNotReceived();
4544 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4546 application.SendNotification();
4547 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4549 // We didn't expect the animation to finish yet
4550 application.SendNotification();
4551 finishCheck.CheckSignalNotReceived();
4552 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4554 application.SendNotification();
4555 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4557 // We did expect the animation to finish
4558 application.SendNotification();
4559 finishCheck.CheckSignalReceived();
4560 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4565 int UtcDaliAnimationAnimateByActorOrientationP3(void)
4567 TestApplication application;
4569 tet_printf("Testing that rotation angle > 360 performs partial rotations when cast to Quaternion\n");
4571 Actor actor = Actor::New();
4572 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
4573 Stage::GetCurrent().Add(actor);
4574 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4576 // Build the animation
4577 float durationSeconds(1.0f);
4578 Animation animation = Animation::New(durationSeconds);
4579 Degree relativeRotationDegrees(730.0f);
4580 Radian relativeRotationRadians(relativeRotationDegrees);
4582 Radian actualRotationRadians( Degree(10.0f) );
4584 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::ZAXIS ) );
4586 // Start the animation
4589 bool signalReceived(false);
4590 AnimationFinishCheck finishCheck(signalReceived);
4591 animation.FinishedSignal().Connect(&application, finishCheck);
4593 application.SendNotification();
4594 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4596 // We didn't expect the animation to finish yet
4597 application.SendNotification();
4598 finishCheck.CheckSignalNotReceived();
4599 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4601 application.SendNotification();
4602 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4604 // We didn't expect the animation to finish yet
4605 application.SendNotification();
4606 finishCheck.CheckSignalNotReceived();
4607 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4609 application.SendNotification();
4610 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4612 // We didn't expect the animation to finish yet
4613 application.SendNotification();
4614 finishCheck.CheckSignalNotReceived();
4615 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4617 application.SendNotification();
4618 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4620 // We did expect the animation to finish
4621 application.SendNotification();
4622 finishCheck.CheckSignalReceived();
4623 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4624 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4629 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
4631 TestApplication application;
4633 Actor actor = Actor::New();
4634 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4635 Stage::GetCurrent().Add(actor);
4636 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4638 // Build the animation
4639 float durationSeconds(1.0f);
4640 Animation animation = Animation::New(durationSeconds);
4641 Degree relativeRotationDegrees(360.0f);
4642 Radian relativeRotationRadians(relativeRotationDegrees);
4643 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ), AlphaFunction::EASE_IN );
4645 // Start the animation
4648 bool signalReceived(false);
4649 AnimationFinishCheck finishCheck(signalReceived);
4650 animation.FinishedSignal().Connect(&application, finishCheck);
4652 application.SendNotification();
4653 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4655 // We didn't expect the animation to finish yet
4656 application.SendNotification();
4657 finishCheck.CheckSignalNotReceived();
4658 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4660 application.SendNotification();
4661 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4663 // We didn't expect the animation to finish yet
4664 application.SendNotification();
4665 finishCheck.CheckSignalNotReceived();
4666 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4668 application.SendNotification();
4669 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4671 // We didn't expect the animation to finish yet
4672 application.SendNotification();
4673 finishCheck.CheckSignalNotReceived();
4674 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4676 application.SendNotification();
4677 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4679 // We did expect the animation to finish
4680 application.SendNotification();
4681 finishCheck.CheckSignalReceived();
4682 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4686 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void)
4688 TestApplication application;
4690 Actor actor = Actor::New();
4691 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4692 Stage::GetCurrent().Add(actor);
4693 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4695 // Build the animation
4696 float durationSeconds(1.0f);
4697 Animation animation = Animation::New(durationSeconds);
4698 Degree relativeRotationDegrees(360.0f);
4699 Radian relativeRotationRadians(relativeRotationDegrees);
4701 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ),
4702 AlphaFunction::EASE_IN, TimePeriod( delay, durationSeconds - delay ) );
4704 // Start the animation
4707 bool signalReceived(false);
4708 AnimationFinishCheck finishCheck(signalReceived);
4709 animation.FinishedSignal().Connect(&application, finishCheck);
4711 application.SendNotification();
4712 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4714 // We didn't expect the animation to finish yet
4715 application.SendNotification();
4716 finishCheck.CheckSignalNotReceived();
4717 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
4718 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4720 application.SendNotification();
4721 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4723 // We didn't expect the animation to finish yet
4724 application.SendNotification();
4725 finishCheck.CheckSignalNotReceived();
4726 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
4727 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4729 application.SendNotification();
4730 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4732 // We didn't expect the animation to finish yet
4733 application.SendNotification();
4734 finishCheck.CheckSignalNotReceived();
4735 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
4736 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4738 application.SendNotification();
4739 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4741 // We did expect the animation to finish
4742 application.SendNotification();
4743 finishCheck.CheckSignalReceived();
4744 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4748 int UtcDaliAnimationAnimateByActorScaleP(void)
4750 TestApplication application;
4752 Actor actor = Actor::New();
4753 Stage::GetCurrent().Add(actor);
4754 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4756 // Build the animation
4757 float durationSeconds(1.0f);
4758 Animation animation = Animation::New(durationSeconds);
4759 Vector3 targetScale(2.0f, 2.0f, 2.0f);
4760 Vector3 relativeScale(targetScale - Vector3::ONE);
4761 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), Vector3( relativeScale.x, relativeScale.y, relativeScale.z ) );
4763 Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale*0.99f);
4765 // Start the animation
4768 bool signalReceived(false);
4769 AnimationFinishCheck finishCheck(signalReceived);
4770 animation.FinishedSignal().Connect(&application, finishCheck);
4772 application.SendNotification();
4773 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4775 // We didn't expect the animation to finish yet
4776 application.SendNotification();
4777 finishCheck.CheckSignalNotReceived();
4778 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
4780 application.SendNotification();
4781 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4783 // We did expect the animation to finish
4784 application.SendNotification();
4785 finishCheck.CheckSignalReceived();
4786 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4789 finishCheck.Reset();
4790 actor.SetScale(Vector3::ONE);
4791 application.SendNotification();
4792 application.Render(0);
4793 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4795 // Repeat with a different (ease-in) alpha function
4796 animation = Animation::New(durationSeconds);
4797 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::EASE_IN );
4798 animation.FinishedSignal().Connect(&application, finishCheck);
4801 application.SendNotification();
4802 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4804 // We didn't expect the animation to finish yet
4805 application.SendNotification();
4806 finishCheck.CheckSignalNotReceived();
4808 // The scale should have grown less, than with a linear alpha function
4809 Vector3 current(actor.GetCurrentScale());
4810 DALI_TEST_CHECK( current.x > 1.0f );
4811 DALI_TEST_CHECK( current.y > 1.0f );
4812 DALI_TEST_CHECK( current.z > 1.0f );
4813 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
4814 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
4815 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
4817 application.SendNotification();
4818 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4820 // We did expect the animation to finish
4821 application.SendNotification();
4822 finishCheck.CheckSignalReceived();
4823 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4826 finishCheck.Reset();
4827 actor.SetScale(Vector3::ONE);
4828 application.SendNotification();
4829 application.Render(0);
4830 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4832 // Repeat with a delay
4834 animation = Animation::New(durationSeconds);
4835 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
4836 animation.FinishedSignal().Connect(&application, finishCheck);
4839 application.SendNotification();
4840 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4842 // We didn't expect the animation to finish yet
4843 application.SendNotification();
4844 finishCheck.CheckSignalNotReceived();
4845 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4847 application.SendNotification();
4848 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4850 // We did expect the animation to finish
4851 application.SendNotification();
4852 finishCheck.CheckSignalReceived();
4853 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4857 int UtcDaliAnimationAnimateToBooleanP(void)
4859 TestApplication application;
4861 Actor actor = Actor::New();
4863 // Register a boolean property
4864 const bool startValue(false);
4865 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4866 Stage::GetCurrent().Add(actor);
4867 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4869 // Build the animation
4870 float durationSeconds(2.0f);
4871 Animation animation = Animation::New(durationSeconds);
4872 const bool targetValue( !startValue );
4873 animation.AnimateTo(Property(actor, index), targetValue);
4875 // Start the animation
4878 bool signalReceived(false);
4879 AnimationFinishCheck finishCheck(signalReceived);
4880 animation.FinishedSignal().Connect(&application, finishCheck);
4882 application.SendNotification();
4883 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4885 // We didn't expect the animation to finish yet
4886 application.SendNotification();
4887 finishCheck.CheckSignalNotReceived();
4888 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4890 application.SendNotification();
4891 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4893 // We did expect the animation to finish
4894 application.SendNotification();
4895 finishCheck.CheckSignalReceived();
4896 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4898 // Check that nothing has changed after a couple of buffer swaps
4899 application.Render(0);
4900 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4901 application.Render(0);
4902 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4904 // Repeat with target value "false"
4905 animation = Animation::New(durationSeconds);
4906 const bool finalValue( !targetValue );
4907 animation.AnimateTo(Property(actor, index), finalValue);
4909 // Start the animation
4912 finishCheck.Reset();
4913 animation.FinishedSignal().Connect(&application, finishCheck);
4915 application.SendNotification();
4916 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4918 // We didn't expect the animation to finish yet
4919 application.SendNotification();
4920 finishCheck.CheckSignalNotReceived();
4921 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4923 application.SendNotification();
4924 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4926 // We did expect the animation to finish
4927 application.SendNotification();
4928 finishCheck.CheckSignalReceived();
4929 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4931 // Check that nothing has changed after a couple of buffer swaps
4932 application.Render(0);
4933 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4934 application.Render(0);
4935 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4939 int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void)
4941 TestApplication application;
4943 Actor actor = Actor::New();
4945 // Register a boolean property
4946 const bool startValue(false);
4947 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4948 Stage::GetCurrent().Add(actor);
4949 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4951 // Build the animation
4952 float durationSeconds(2.0f);
4953 Animation animation = Animation::New(durationSeconds);
4954 const bool targetValue( !startValue );
4955 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
4957 // Start the animation
4960 bool signalReceived(false);
4961 AnimationFinishCheck finishCheck(signalReceived);
4962 animation.FinishedSignal().Connect(&application, finishCheck);
4964 application.SendNotification();
4965 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4967 // We didn't expect the animation to finish yet
4968 application.SendNotification();
4969 finishCheck.CheckSignalNotReceived();
4970 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4972 application.SendNotification();
4973 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4975 // We did expect the animation to finish
4976 application.SendNotification();
4977 finishCheck.CheckSignalReceived();
4978 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4980 // Check that nothing has changed after a couple of buffer swaps
4981 application.Render(0);
4982 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4983 application.Render(0);
4984 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4986 // Repeat with target value "false"
4987 animation = Animation::New(durationSeconds);
4988 const bool finalValue( !targetValue );
4989 animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
4991 // Start the animation
4994 finishCheck.Reset();
4995 animation.FinishedSignal().Connect(&application, finishCheck);
4997 application.SendNotification();
4998 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5000 // We didn't expect the animation to finish yet
5001 application.SendNotification();
5002 finishCheck.CheckSignalNotReceived();
5003 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
5005 application.SendNotification();
5006 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5008 // We did expect the animation to finish
5009 application.SendNotification();
5010 finishCheck.CheckSignalReceived();
5011 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
5013 // Check that nothing has changed after a couple of buffer swaps
5014 application.Render(0);
5015 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
5016 application.Render(0);
5017 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
5021 int UtcDaliAnimationAnimateToBooleanTimePeriodP(void)
5023 TestApplication application;
5025 Actor actor = Actor::New();
5027 // Register a boolean property
5028 bool startValue(false);
5029 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5030 Stage::GetCurrent().Add(actor);
5031 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5033 // Build the animation
5034 float durationSeconds(2.0f);
5035 Animation animation = Animation::New(durationSeconds);
5036 bool finalValue( !startValue );
5037 float animatorDurationSeconds(durationSeconds * 0.5f);
5038 animation.AnimateTo( Property(actor, index),
5040 TimePeriod( animatorDurationSeconds ) );
5042 // Start the animation
5045 bool signalReceived(false);
5046 AnimationFinishCheck finishCheck(signalReceived);
5047 animation.FinishedSignal().Connect(&application, finishCheck);
5049 application.SendNotification();
5050 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5052 // We didn't expect the animation to finish yet
5053 application.SendNotification();
5054 finishCheck.CheckSignalNotReceived();
5055 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5057 application.SendNotification();
5058 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5060 // We didn't expect the animation to finish yet...
5061 application.SendNotification();
5062 finishCheck.CheckSignalNotReceived();
5064 // ...however we should have reached the final value
5065 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
5067 application.SendNotification();
5068 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5070 // We did expect the animation to finish
5071 application.SendNotification();
5072 finishCheck.CheckSignalReceived();
5073 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
5075 // Check that nothing has changed after a couple of buffer swaps
5076 application.Render(0);
5077 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
5078 application.Render(0);
5079 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
5083 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void)
5085 TestApplication application;
5087 Actor actor = Actor::New();
5089 // Register a boolean property
5090 bool startValue(false);
5091 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5092 Stage::GetCurrent().Add(actor);
5093 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5095 // Build the animation
5096 float durationSeconds(2.0f);
5097 Animation animation = Animation::New(durationSeconds);
5098 bool finalValue( !startValue );
5099 float animatorDurationSeconds(durationSeconds * 0.5f);
5100 animation.AnimateTo( Property(actor, index),
5102 AlphaFunction::LINEAR,
5103 TimePeriod( animatorDurationSeconds ) );
5105 // Start the animation
5108 bool signalReceived(false);
5109 AnimationFinishCheck finishCheck(signalReceived);
5110 animation.FinishedSignal().Connect(&application, finishCheck);
5112 application.SendNotification();
5113 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5115 // We didn't expect the animation to finish yet
5116 application.SendNotification();
5117 finishCheck.CheckSignalNotReceived();
5118 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5120 application.SendNotification();
5121 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5123 // We didn't expect the animation to finish yet...
5124 application.SendNotification();
5125 finishCheck.CheckSignalNotReceived();
5127 // ...however we should have reached the final value
5128 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
5130 application.SendNotification();
5131 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5133 // We did expect the animation to finish
5134 application.SendNotification();
5135 finishCheck.CheckSignalReceived();
5136 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
5138 // Check that nothing has changed after a couple of buffer swaps
5139 application.Render(0);
5140 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
5141 application.Render(0);
5142 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
5146 int UtcDaliAnimationAnimateToFloatP(void)
5148 TestApplication application;
5150 Actor actor = Actor::New();
5152 // Register a float property
5153 float startValue(10.0f);
5154 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5155 Stage::GetCurrent().Add(actor);
5156 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5158 // Build the animation
5159 float durationSeconds(2.0f);
5160 Animation animation = Animation::New(durationSeconds);
5161 float targetValue(50.0f);
5162 float relativeValue(targetValue - startValue);
5163 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5165 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5167 // Start the animation
5170 bool signalReceived(false);
5171 AnimationFinishCheck finishCheck(signalReceived);
5172 animation.FinishedSignal().Connect(&application, finishCheck);
5174 application.SendNotification();
5175 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5177 // We didn't expect the animation to finish yet
5178 application.SendNotification();
5179 finishCheck.CheckSignalNotReceived();
5180 DALI_TEST_EQUALS( actor.GetProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION );
5182 application.SendNotification();
5183 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5185 // We did expect the animation to finish
5186 application.SendNotification();
5187 finishCheck.CheckSignalReceived();
5188 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
5192 int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void)
5194 TestApplication application;
5196 Actor actor = Actor::New();
5198 // Register a float property
5199 float startValue(10.0f);
5200 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5201 Stage::GetCurrent().Add(actor);
5202 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5204 // Build the animation
5205 float durationSeconds(1.0f);
5206 Animation animation = Animation::New(durationSeconds);
5207 float targetValue(90.0f);
5208 float relativeValue(targetValue - startValue);
5209 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5211 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5213 // Start the animation
5216 bool signalReceived(false);
5217 AnimationFinishCheck finishCheck(signalReceived);
5218 animation.FinishedSignal().Connect(&application, finishCheck);
5220 application.SendNotification();
5221 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5223 // We didn't expect the animation to finish yet
5224 application.SendNotification();
5225 finishCheck.CheckSignalNotReceived();
5227 // The position should have moved more, than with a linear alpha function
5228 float current(actor.GetProperty<float>(index));
5229 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
5231 application.SendNotification();
5232 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5234 // We did expect the animation to finish
5235 application.SendNotification();
5236 finishCheck.CheckSignalReceived();
5237 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
5241 int UtcDaliAnimationAnimateToFloatTimePeriodP(void)
5243 TestApplication application;
5245 Actor actor = Actor::New();
5247 // Register a float property
5248 float startValue(10.0f);
5249 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5250 Stage::GetCurrent().Add(actor);
5251 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5253 // Build the animation
5254 float durationSeconds(1.0f);
5255 Animation animation = Animation::New(durationSeconds);
5256 float targetValue(30.0f);
5257 float relativeValue(targetValue - startValue);
5259 animation.AnimateTo(Property(actor, index),
5261 TimePeriod(delay, durationSeconds - delay));
5263 // Start the animation
5266 bool signalReceived(false);
5267 AnimationFinishCheck finishCheck(signalReceived);
5268 animation.FinishedSignal().Connect(&application, finishCheck);
5270 application.SendNotification();
5271 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5273 // We didn't expect the animation to finish yet
5274 application.SendNotification();
5275 finishCheck.CheckSignalNotReceived();
5276 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5278 application.SendNotification();
5279 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5281 // We didn't expect the animation to finish yet
5282 application.SendNotification();
5283 finishCheck.CheckSignalNotReceived();
5284 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5286 application.SendNotification();
5287 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5289 // We did expect the animation to finish
5290 application.SendNotification();
5291 finishCheck.CheckSignalReceived();
5292 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
5296 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void)
5298 TestApplication application;
5300 Actor actor = Actor::New();
5302 // Register a float property
5303 float startValue(10.0f);
5304 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5305 Stage::GetCurrent().Add(actor);
5306 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5308 // Build the animation
5309 float durationSeconds(1.0f);
5310 Animation animation = Animation::New(durationSeconds);
5311 float targetValue(30.0f);
5312 float relativeValue(targetValue - startValue);
5314 animation.AnimateTo(Property(actor, index),
5316 AlphaFunction::LINEAR,
5317 TimePeriod(delay, durationSeconds - delay));
5319 // Start the animation
5322 bool signalReceived(false);
5323 AnimationFinishCheck finishCheck(signalReceived);
5324 animation.FinishedSignal().Connect(&application, finishCheck);
5326 application.SendNotification();
5327 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5329 // We didn't expect the animation to finish yet
5330 application.SendNotification();
5331 finishCheck.CheckSignalNotReceived();
5332 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5334 application.SendNotification();
5335 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5337 // We didn't expect the animation to finish yet
5338 application.SendNotification();
5339 finishCheck.CheckSignalNotReceived();
5340 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5342 application.SendNotification();
5343 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5345 // We did expect the animation to finish
5346 application.SendNotification();
5347 finishCheck.CheckSignalReceived();
5348 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
5352 int UtcDaliAnimationAnimateToIntegerP(void)
5354 TestApplication application;
5356 Actor actor = Actor::New();
5358 // Register an integer property
5360 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5361 Stage::GetCurrent().Add(actor);
5362 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5364 // Build the animation
5365 float durationSeconds(2.0f);
5366 Animation animation = Animation::New(durationSeconds);
5367 int targetValue(50);
5368 int relativeValue(targetValue - startValue);
5369 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5371 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
5373 // Start the animation
5376 bool signalReceived(false);
5377 AnimationFinishCheck finishCheck(signalReceived);
5378 animation.FinishedSignal().Connect(&application, finishCheck);
5380 application.SendNotification();
5381 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5383 // We didn't expect the animation to finish yet
5384 application.SendNotification();
5385 finishCheck.CheckSignalNotReceived();
5386 DALI_TEST_EQUALS( actor.GetProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION );
5388 application.SendNotification();
5389 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5391 // We did expect the animation to finish
5392 application.SendNotification();
5393 finishCheck.CheckSignalReceived();
5394 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
5398 int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void)
5400 TestApplication application;
5402 Actor actor = Actor::New();
5404 // Register an integer property
5406 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5407 Stage::GetCurrent().Add(actor);
5408 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5410 // Build the animation
5411 float durationSeconds(1.0f);
5412 Animation animation = Animation::New(durationSeconds);
5413 int targetValue(90);
5414 int relativeValue(targetValue - startValue);
5415 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5417 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
5419 // Start the animation
5422 bool signalReceived(false);
5423 AnimationFinishCheck finishCheck(signalReceived);
5424 animation.FinishedSignal().Connect(&application, finishCheck);
5426 application.SendNotification();
5427 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5429 // We didn't expect the animation to finish yet
5430 application.SendNotification();
5431 finishCheck.CheckSignalNotReceived();
5433 // The position should have moved more, than with a linear alpha function
5434 int current(actor.GetProperty<int>(index));
5435 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
5437 application.SendNotification();
5438 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5440 // We did expect the animation to finish
5441 application.SendNotification();
5442 finishCheck.CheckSignalReceived();
5443 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
5447 int UtcDaliAnimationAnimateToIntegerTimePeriodP(void)
5449 TestApplication application;
5451 Actor actor = Actor::New();
5453 // Register an integer property
5455 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5456 Stage::GetCurrent().Add(actor);
5457 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5459 // Build the animation
5460 float durationSeconds(1.0f);
5461 Animation animation = Animation::New(durationSeconds);
5462 int targetValue(30);
5463 int relativeValue(targetValue - startValue);
5465 animation.AnimateTo(Property(actor, index),
5467 TimePeriod(delay, durationSeconds - delay));
5469 // Start the animation
5472 bool signalReceived(false);
5473 AnimationFinishCheck finishCheck(signalReceived);
5474 animation.FinishedSignal().Connect(&application, finishCheck);
5476 application.SendNotification();
5477 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5479 // We didn't expect the animation to finish yet
5480 application.SendNotification();
5481 finishCheck.CheckSignalNotReceived();
5482 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5484 application.SendNotification();
5485 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5487 // We didn't expect the animation to finish yet
5488 application.SendNotification();
5489 finishCheck.CheckSignalNotReceived();
5490 DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
5492 application.SendNotification();
5493 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5495 // We did expect the animation to finish
5496 application.SendNotification();
5497 finishCheck.CheckSignalReceived();
5498 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
5502 int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void)
5504 TestApplication application;
5506 Actor actor = Actor::New();
5508 // Register an integer property
5510 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5511 Stage::GetCurrent().Add(actor);
5512 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5514 // Build the animation
5515 float durationSeconds(1.0f);
5516 Animation animation = Animation::New(durationSeconds);
5517 int targetValue(30);
5518 int relativeValue(targetValue - startValue);
5520 animation.AnimateTo(Property(actor, index),
5522 AlphaFunction::LINEAR,
5523 TimePeriod(delay, durationSeconds - delay));
5525 // Start the animation
5528 bool signalReceived(false);
5529 AnimationFinishCheck finishCheck(signalReceived);
5530 animation.FinishedSignal().Connect(&application, finishCheck);
5532 application.SendNotification();
5533 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5535 // We didn't expect the animation to finish yet
5536 application.SendNotification();
5537 finishCheck.CheckSignalNotReceived();
5538 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5540 application.SendNotification();
5541 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5543 // We didn't expect the animation to finish yet
5544 application.SendNotification();
5545 finishCheck.CheckSignalNotReceived();
5546 DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
5548 application.SendNotification();
5549 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5551 // We did expect the animation to finish
5552 application.SendNotification();
5553 finishCheck.CheckSignalReceived();
5554 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
5558 int UtcDaliAnimationAnimateToVector2P(void)
5560 TestApplication application;
5562 Actor actor = Actor::New();
5564 // Register a Vector2 property
5565 Vector2 startValue(-50.0f, -50.0f);
5566 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5567 Stage::GetCurrent().Add(actor);
5568 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
5570 // Build the animation
5571 float durationSeconds(2.0f);
5572 Animation animation = Animation::New(durationSeconds);
5573 Vector2 targetValue(50.0f, 50.0f);
5574 Vector2 relativeValue(targetValue - startValue);
5575 animation.AnimateTo(Property(actor, index), targetValue);
5577 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5579 // Start the animation
5582 bool signalReceived(false);
5583 AnimationFinishCheck finishCheck(signalReceived);
5584 animation.FinishedSignal().Connect(&application, finishCheck);
5586 application.SendNotification();
5587 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5589 // We didn't expect the animation to finish yet
5590 application.SendNotification();
5591 finishCheck.CheckSignalNotReceived();
5592 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION );
5594 application.SendNotification();
5595 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5597 // We did expect the animation to finish
5598 application.SendNotification();
5599 finishCheck.CheckSignalReceived();
5600 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
5604 int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void)
5606 TestApplication application;
5608 Actor actor = Actor::New();
5610 // Register a Vector2 property
5611 Vector2 startValue(1000.0f, 1000.0f);
5612 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5613 Stage::GetCurrent().Add(actor);
5614 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
5616 // Build the animation
5617 float durationSeconds(1.0f);
5618 Animation animation = Animation::New(durationSeconds);
5619 Vector2 targetValue(9000.0f, 9000.0f);
5620 Vector2 relativeValue(targetValue - startValue);
5621 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
5623 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5625 // Start the animation
5628 bool signalReceived(false);
5629 AnimationFinishCheck finishCheck(signalReceived);
5630 animation.FinishedSignal().Connect(&application, finishCheck);
5632 application.SendNotification();
5633 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5635 // We didn't expect the animation to finish yet
5636 application.SendNotification();
5637 finishCheck.CheckSignalNotReceived();
5639 // The position should have moved more, than with a linear alpha function
5640 Vector2 current(actor.GetProperty<Vector2>(index));
5641 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
5642 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
5644 application.SendNotification();
5645 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5647 // We did expect the animation to finish
5648 application.SendNotification();
5649 finishCheck.CheckSignalReceived();
5650 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
5654 int UtcDaliAnimationAnimateToVector2TimePeriodP(void)
5656 TestApplication application;
5658 Actor actor = Actor::New();
5660 // Register a Vector2 property
5661 Vector2 startValue(10.0f, 10.0f);
5662 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5663 Stage::GetCurrent().Add(actor);
5664 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
5666 // Build the animation
5667 float durationSeconds(1.0f);
5668 Animation animation = Animation::New(durationSeconds);
5669 Vector2 targetValue(-10.0f, 20.0f);
5670 Vector2 relativeValue(targetValue - startValue);
5672 animation.AnimateTo(Property(actor, index),
5674 TimePeriod(delay, durationSeconds - delay));
5676 // Start the animation
5679 bool signalReceived(false);
5680 AnimationFinishCheck finishCheck(signalReceived);
5681 animation.FinishedSignal().Connect(&application, finishCheck);
5683 application.SendNotification();
5684 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5686 // We didn't expect the animation to finish yet
5687 application.SendNotification();
5688 finishCheck.CheckSignalNotReceived();
5689 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
5691 application.SendNotification();
5692 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5694 // We didn't expect the animation to finish yet
5695 application.SendNotification();
5696 finishCheck.CheckSignalNotReceived();
5697 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5699 application.SendNotification();
5700 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5702 // We did expect the animation to finish
5703 application.SendNotification();
5704 finishCheck.CheckSignalReceived();
5705 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
5709 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void)
5711 TestApplication application;
5713 Actor actor = Actor::New();
5715 // Register a Vector2 property
5716 Vector2 startValue(10.0f, 10.0f);
5717 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5718 Stage::GetCurrent().Add(actor);
5719 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
5721 // Build the animation
5722 float durationSeconds(1.0f);
5723 Animation animation = Animation::New(durationSeconds);
5724 Vector2 targetValue(30.0f, 30.0f);
5725 Vector2 relativeValue(targetValue - startValue);
5727 animation.AnimateTo(Property(actor, index),
5729 AlphaFunction::LINEAR,
5730 TimePeriod(delay, durationSeconds - delay));
5732 // Start the animation
5735 bool signalReceived(false);
5736 AnimationFinishCheck finishCheck(signalReceived);
5737 animation.FinishedSignal().Connect(&application, finishCheck);
5739 application.SendNotification();
5740 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5742 // We didn't expect the animation to finish yet
5743 application.SendNotification();
5744 finishCheck.CheckSignalNotReceived();
5745 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
5747 application.SendNotification();
5748 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5750 // We didn't expect the animation to finish yet
5751 application.SendNotification();
5752 finishCheck.CheckSignalNotReceived();
5753 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5755 application.SendNotification();
5756 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5758 // We did expect the animation to finish
5759 application.SendNotification();
5760 finishCheck.CheckSignalReceived();
5761 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
5765 int UtcDaliAnimationAnimateToVector3P(void)
5767 TestApplication application;
5769 Actor actor = Actor::New();
5771 // Register a Vector3 property
5772 Vector3 startValue(-50.0f, -50.0f, -50.0f);
5773 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5774 Stage::GetCurrent().Add(actor);
5775 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5777 // Build the animation
5778 float durationSeconds(2.0f);
5779 Animation animation = Animation::New(durationSeconds);
5780 Vector3 targetValue(50.0f, 50.0f, 50.0f);
5781 Vector3 relativeValue(targetValue - startValue);
5782 animation.AnimateTo(Property(actor, index), targetValue);
5784 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5786 // Start the animation
5789 bool signalReceived(false);
5790 AnimationFinishCheck finishCheck(signalReceived);
5791 animation.FinishedSignal().Connect(&application, finishCheck);
5793 application.SendNotification();
5794 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5796 // We didn't expect the animation to finish yet
5797 application.SendNotification();
5798 finishCheck.CheckSignalNotReceived();
5799 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION );
5801 application.SendNotification();
5802 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5804 // We did expect the animation to finish
5805 application.SendNotification();
5806 finishCheck.CheckSignalReceived();
5807 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
5811 int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void)
5813 TestApplication application;
5815 Actor actor = Actor::New();
5817 // Register a Vector3 property
5818 Vector3 startValue(1000.0f, 1000.0f, 1000.0f);
5819 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5820 Stage::GetCurrent().Add(actor);
5821 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5823 // Build the animation
5824 float durationSeconds(1.0f);
5825 Animation animation = Animation::New(durationSeconds);
5826 Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
5827 Vector3 relativeValue(targetValue - startValue);
5828 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5830 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5832 // Start the animation
5835 bool signalReceived(false);
5836 AnimationFinishCheck finishCheck(signalReceived);
5837 animation.FinishedSignal().Connect(&application, finishCheck);
5839 application.SendNotification();
5840 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5842 // We didn't expect the animation to finish yet
5843 application.SendNotification();
5844 finishCheck.CheckSignalNotReceived();
5846 // The position should have moved more, than with a linear alpha function
5847 Vector3 current(actor.GetProperty<Vector3>(index));
5848 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
5849 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
5850 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
5852 application.SendNotification();
5853 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5855 // We did expect the animation to finish
5856 application.SendNotification();
5857 finishCheck.CheckSignalReceived();
5858 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
5862 int UtcDaliAnimationAnimateToVector3TimePeriodP(void)
5864 TestApplication application;
5866 Actor actor = Actor::New();
5868 // Register a Vector3 property
5869 Vector3 startValue(10.0f, 10.0f, 10.0f);
5870 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5871 Stage::GetCurrent().Add(actor);
5872 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5874 // Build the animation
5875 float durationSeconds(1.0f);
5876 Animation animation = Animation::New(durationSeconds);
5877 Vector3 targetValue(-10.0f, 20.0f, 100.0f);
5878 Vector3 relativeValue(targetValue - startValue);
5880 animation.AnimateTo(Property(actor, index),
5882 TimePeriod(delay, durationSeconds - delay));
5884 // Start the animation
5887 bool signalReceived(false);
5888 AnimationFinishCheck finishCheck(signalReceived);
5889 animation.FinishedSignal().Connect(&application, finishCheck);
5891 application.SendNotification();
5892 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5894 // We didn't expect the animation to finish yet
5895 application.SendNotification();
5896 finishCheck.CheckSignalNotReceived();
5897 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5899 application.SendNotification();
5900 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5902 // We didn't expect the animation to finish yet
5903 application.SendNotification();
5904 finishCheck.CheckSignalNotReceived();
5905 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5907 application.SendNotification();
5908 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5910 // We did expect the animation to finish
5911 application.SendNotification();
5912 finishCheck.CheckSignalReceived();
5913 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
5917 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void)
5919 TestApplication application;
5921 Actor actor = Actor::New();
5923 // Register a Vector3 property
5924 Vector3 startValue(10.0f, 10.0f, 10.0f);
5925 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5926 Stage::GetCurrent().Add(actor);
5927 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5929 // Build the animation
5930 float durationSeconds(1.0f);
5931 Animation animation = Animation::New(durationSeconds);
5932 Vector3 targetValue(30.0f, 30.0f, 30.0f);
5933 Vector3 relativeValue(targetValue - startValue);
5935 animation.AnimateTo(Property(actor, "testProperty"),
5937 AlphaFunction::LINEAR,
5938 TimePeriod(delay, durationSeconds - delay));
5940 // Start the animation
5943 bool signalReceived(false);
5944 AnimationFinishCheck finishCheck(signalReceived);
5945 animation.FinishedSignal().Connect(&application, finishCheck);
5947 application.SendNotification();
5948 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5950 // We didn't expect the animation to finish yet
5951 application.SendNotification();
5952 finishCheck.CheckSignalNotReceived();
5953 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5955 application.SendNotification();
5956 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5958 // We didn't expect the animation to finish yet
5959 application.SendNotification();
5960 finishCheck.CheckSignalNotReceived();
5961 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5963 application.SendNotification();
5964 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5966 // We did expect the animation to finish
5967 application.SendNotification();
5968 finishCheck.CheckSignalReceived();
5969 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
5973 int UtcDaliAnimationAnimateToVector3ComponentP(void)
5975 TestApplication application;
5977 Actor actor = Actor::New();
5979 // Register a Vector3 property
5980 Vector3 startValue(10.0f, 10.0f, 10.0f);
5981 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5982 Stage::GetCurrent().Add(actor);
5983 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5985 // Build the animation
5986 float durationSeconds(1.0f);
5987 Animation animation = Animation::New(durationSeconds);
5988 Vector3 targetValue(30.0f, 30.0f, 10.0f);
5989 Vector3 relativeValue(targetValue - startValue);
5991 animation.AnimateTo(Property(actor, "testProperty", 0),
5993 AlphaFunction::LINEAR,
5994 TimePeriod(delay, durationSeconds - delay));
5995 animation.AnimateTo(Property(actor, index, 1),
5997 AlphaFunction::LINEAR,
5998 TimePeriod(delay, durationSeconds - delay));
6000 // Start the animation
6003 bool signalReceived(false);
6004 AnimationFinishCheck finishCheck(signalReceived);
6005 animation.FinishedSignal().Connect(&application, finishCheck);
6007 application.SendNotification();
6008 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6010 // We didn't expect the animation to finish yet
6011 application.SendNotification();
6012 finishCheck.CheckSignalNotReceived();
6013 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6015 application.SendNotification();
6016 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6018 // We didn't expect the animation to finish yet
6019 application.SendNotification();
6020 finishCheck.CheckSignalNotReceived();
6021 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
6023 application.SendNotification();
6024 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6026 // We did expect the animation to finish
6027 application.SendNotification();
6028 finishCheck.CheckSignalReceived();
6029 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
6033 int UtcDaliAnimationAnimateToVector4P(void)
6035 TestApplication application;
6037 Actor actor = Actor::New();
6039 // Register a Vector4 property
6040 Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f);
6041 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6042 Stage::GetCurrent().Add(actor);
6043 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6045 // Build the animation
6046 float durationSeconds(2.0f);
6047 Animation animation = Animation::New(durationSeconds);
6048 Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f);
6049 Vector4 relativeValue(targetValue - startValue);
6050 animation.AnimateTo(Property(actor, index), targetValue);
6052 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6054 // Start the animation
6057 bool signalReceived(false);
6058 AnimationFinishCheck finishCheck(signalReceived);
6059 animation.FinishedSignal().Connect(&application, finishCheck);
6061 application.SendNotification();
6062 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6064 // We didn't expect the animation to finish yet
6065 application.SendNotification();
6066 finishCheck.CheckSignalNotReceived();
6067 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION );
6069 application.SendNotification();
6070 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6072 // We did expect the animation to finish
6073 application.SendNotification();
6074 finishCheck.CheckSignalReceived();
6075 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
6079 int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void)
6081 TestApplication application;
6083 Actor actor = Actor::New();
6085 // Register a Vector4 property
6086 Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
6087 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6088 Stage::GetCurrent().Add(actor);
6089 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6091 // Build the animation
6092 float durationSeconds(1.0f);
6093 Animation animation = Animation::New(durationSeconds);
6094 Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
6095 Vector4 relativeValue(targetValue - startValue);
6096 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6098 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6100 // Start the animation
6103 bool signalReceived(false);
6104 AnimationFinishCheck finishCheck(signalReceived);
6105 animation.FinishedSignal().Connect(&application, finishCheck);
6107 application.SendNotification();
6108 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6110 // We didn't expect the animation to finish yet
6111 application.SendNotification();
6112 finishCheck.CheckSignalNotReceived();
6114 // The position should have moved more, than with a linear alpha function
6115 Vector4 current(actor.GetProperty<Vector4>(index));
6116 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6117 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6118 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
6119 DALI_TEST_CHECK( current.w > ninetyFivePercentProgress.w );
6121 application.SendNotification();
6122 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6124 // We did expect the animation to finish
6125 application.SendNotification();
6126 finishCheck.CheckSignalReceived();
6127 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
6131 int UtcDaliAnimationAnimateToVector4TimePeriodP(void)
6133 TestApplication application;
6135 Actor actor = Actor::New();
6137 // Register a Vector4 property
6138 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6139 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6140 Stage::GetCurrent().Add(actor);
6141 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6143 // Build the animation
6144 float durationSeconds(1.0f);
6145 Animation animation = Animation::New(durationSeconds);
6146 Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
6147 Vector4 relativeValue(targetValue - startValue);
6149 animation.AnimateTo(Property(actor, index),
6151 TimePeriod(delay, durationSeconds - delay));
6153 // Start the animation
6156 bool signalReceived(false);
6157 AnimationFinishCheck finishCheck(signalReceived);
6158 animation.FinishedSignal().Connect(&application, finishCheck);
6160 application.SendNotification();
6161 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6163 // We didn't expect the animation to finish yet
6164 application.SendNotification();
6165 finishCheck.CheckSignalNotReceived();
6166 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6168 application.SendNotification();
6169 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6171 // We didn't expect the animation to finish yet
6172 application.SendNotification();
6173 finishCheck.CheckSignalNotReceived();
6174 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), VECTOR4_EPSILON, TEST_LOCATION );
6176 application.SendNotification();
6177 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6179 // We did expect the animation to finish
6180 application.SendNotification();
6181 finishCheck.CheckSignalReceived();
6182 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, VECTOR4_EPSILON, TEST_LOCATION );
6186 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void)
6188 TestApplication application;
6190 Actor actor = Actor::New();
6192 // Register a Vector4 property
6193 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6194 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6195 Stage::GetCurrent().Add(actor);
6196 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6198 // Build the animation
6199 float durationSeconds(1.0f);
6200 Animation animation = Animation::New(durationSeconds);
6201 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
6202 Vector4 relativeValue(targetValue - startValue);
6204 animation.AnimateTo(Property(actor, index),
6206 AlphaFunction::LINEAR,
6207 TimePeriod(delay, durationSeconds - delay));
6209 // Start the animation
6212 bool signalReceived(false);
6213 AnimationFinishCheck finishCheck(signalReceived);
6214 animation.FinishedSignal().Connect(&application, finishCheck);
6216 application.SendNotification();
6217 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6219 // We didn't expect the animation to finish yet
6220 application.SendNotification();
6221 finishCheck.CheckSignalNotReceived();
6222 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6224 application.SendNotification();
6225 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6227 // We didn't expect the animation to finish yet
6228 application.SendNotification();
6229 finishCheck.CheckSignalNotReceived();
6230 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
6232 application.SendNotification();
6233 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6235 // We did expect the animation to finish
6236 application.SendNotification();
6237 finishCheck.CheckSignalReceived();
6238 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
6242 int UtcDaliAnimationAnimateToActorParentOriginP(void)
6244 TestApplication application;
6246 Actor actor = Actor::New();
6247 Stage::GetCurrent().Add(actor);
6248 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_LEFT, TEST_LOCATION );
6250 // Build the animation
6251 float durationSeconds(1.0f);
6252 Animation animation = Animation::New(durationSeconds);
6253 Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
6257 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin );
6259 catch (Dali::DaliException& e)
6261 DALI_TEST_PRINT_ASSERT( e );
6262 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6267 int UtcDaliAnimationAnimateToActorParentOriginXP(void)
6269 TestApplication application;
6271 Actor actor = Actor::New();
6272 Stage::GetCurrent().Add(actor);
6273 float startValue(0.0f);
6274 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().x, startValue, TEST_LOCATION );
6275 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION );
6277 // Build the animation
6278 float durationSeconds(1.0f);
6279 Animation animation = Animation::New(durationSeconds);
6280 float targetX(1.0f);
6284 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX );
6286 catch (Dali::DaliException& e)
6288 DALI_TEST_PRINT_ASSERT( e );
6289 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6294 int UtcDaliAnimationAnimateToActorParentOriginYP(void)
6296 TestApplication application;
6298 Actor actor = Actor::New();
6299 Stage::GetCurrent().Add(actor);
6300 float startValue(0.0f);
6301 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().y, startValue, TEST_LOCATION );
6302 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION );
6304 // Build the animation
6305 float durationSeconds(1.0f);
6306 Animation animation = Animation::New(durationSeconds);
6307 float targetY(1.0f);
6311 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY );
6313 catch (Dali::DaliException& e)
6315 DALI_TEST_PRINT_ASSERT( e );
6316 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6321 int UtcDaliAnimationAnimateToActorParentOriginZP(void)
6323 TestApplication application;
6325 Actor actor = Actor::New();
6326 Stage::GetCurrent().Add(actor);
6327 float startValue(0.5f);
6328 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().z, startValue, TEST_LOCATION );
6329 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION );
6331 // Build the animation
6332 float durationSeconds(1.0f);
6333 Animation animation = Animation::New(durationSeconds);
6334 float targetZ(1.0f);
6338 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ );
6340 catch (Dali::DaliException& e)
6342 DALI_TEST_PRINT_ASSERT( e );
6343 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6348 int UtcDaliAnimationAnimateToActorAnchorPointP(void)
6350 TestApplication application;
6352 Actor actor = Actor::New();
6353 Stage::GetCurrent().Add(actor);
6354 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), AnchorPoint::CENTER, TEST_LOCATION );
6356 // Build the animation
6357 float durationSeconds(1.0f);
6358 Animation animation = Animation::New(durationSeconds);
6359 Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT);
6363 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
6365 catch (Dali::DaliException& e)
6367 DALI_TEST_PRINT_ASSERT( e );
6368 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6373 int UtcDaliAnimationAnimateToActorAnchorPointXP(void)
6375 TestApplication application;
6377 Actor actor = Actor::New();
6378 Stage::GetCurrent().Add(actor);
6379 float startValue(0.5f);
6380 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().x, startValue, TEST_LOCATION );
6381 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION );
6383 // Build the animation
6384 float durationSeconds(1.0f);
6385 Animation animation = Animation::New(durationSeconds);
6386 float targetX(1.0f);
6390 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_X), targetX );
6392 catch (Dali::DaliException& e)
6394 DALI_TEST_PRINT_ASSERT( e );
6395 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6400 int UtcDaliAnimationAnimateToActorAnchorPointYP(void)
6402 TestApplication application;
6404 Actor actor = Actor::New();
6405 Stage::GetCurrent().Add(actor);
6406 float startValue(0.5f);
6407 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().y, startValue, TEST_LOCATION );
6408 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION );
6410 // Build the animation
6411 float durationSeconds(1.0f);
6412 Animation animation = Animation::New(durationSeconds);
6413 float targetY(0.0f);
6417 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY );
6419 catch (Dali::DaliException& e)
6421 DALI_TEST_PRINT_ASSERT( e );
6422 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6427 int UtcDaliAnimationAnimateToActorAnchorPointZP(void)
6429 TestApplication application;
6431 Actor actor = Actor::New();
6432 Stage::GetCurrent().Add(actor);
6433 float startValue(0.5f);
6434 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().z, startValue, TEST_LOCATION );
6435 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION );
6437 // Build the animation
6438 float durationSeconds(1.0f);
6439 Animation animation = Animation::New(durationSeconds);
6440 float targetZ(100.0f);
6444 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ );
6446 catch (Dali::DaliException& e)
6448 DALI_TEST_PRINT_ASSERT( e );
6449 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6454 int UtcDaliAnimationAnimateToActorSizeP(void)
6456 TestApplication application;
6458 Actor actor = Actor::New();
6459 Stage::GetCurrent().Add(actor);
6460 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6462 // Build the animation
6463 float durationSeconds(1.0f);
6464 Animation animation = Animation::New(durationSeconds);
6465 Vector3 targetSize(100.0f, 100.0f, 100.0f);
6466 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize );
6468 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
6470 // Start the animation
6473 bool signalReceived(false);
6474 AnimationFinishCheck finishCheck(signalReceived);
6475 animation.FinishedSignal().Connect(&application, finishCheck);
6477 application.SendNotification();
6478 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6480 // We didn't expect the animation to finish yet
6481 application.SendNotification();
6482 finishCheck.CheckSignalNotReceived();
6483 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
6485 application.SendNotification();
6486 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6488 // We did expect the animation to finish
6489 application.SendNotification();
6490 finishCheck.CheckSignalReceived();
6491 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6494 finishCheck.Reset();
6495 actor.SetSize(Vector3::ZERO);
6496 application.SendNotification();
6497 application.Render(0);
6498 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6500 // Repeat with a different (ease-in) alpha function
6501 animation = Animation::New(durationSeconds);
6502 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
6503 animation.FinishedSignal().Connect(&application, finishCheck);
6506 application.SendNotification();
6507 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6509 // We didn't expect the animation to finish yet
6510 application.SendNotification();
6511 finishCheck.CheckSignalNotReceived();
6513 // The size should have travelled less, than with a linear alpha function
6514 Vector3 current(actor.GetCurrentSize());
6515 DALI_TEST_CHECK( current.x > 0.0f );
6516 DALI_TEST_CHECK( current.y > 0.0f );
6517 DALI_TEST_CHECK( current.z > 0.0f );
6518 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
6519 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
6520 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
6522 application.SendNotification();
6523 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6525 // We did expect the animation to finish
6526 application.SendNotification();
6527 finishCheck.CheckSignalReceived();
6528 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6531 finishCheck.Reset();
6532 actor.SetSize(Vector3::ZERO);
6533 application.SendNotification();
6534 application.Render(0);
6535 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6537 // Repeat with a delay
6539 animation = Animation::New(durationSeconds);
6540 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
6541 animation.FinishedSignal().Connect(&application, finishCheck);
6544 application.SendNotification();
6545 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6547 // We didn't expect the animation to finish yet
6548 application.SendNotification();
6549 finishCheck.CheckSignalNotReceived();
6550 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6552 application.SendNotification();
6553 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6555 // We did expect the animation to finish
6556 application.SendNotification();
6557 finishCheck.CheckSignalReceived();
6558 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6562 int UtcDaliAnimationAnimateToActorSizeWidthP(void)
6564 TestApplication application;
6566 Actor actor = Actor::New();
6567 Stage::GetCurrent().Add(actor);
6568 float startValue(0.0f);
6569 DALI_TEST_EQUALS( actor.GetCurrentSize().width, startValue, TEST_LOCATION );
6570 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION );
6572 // Build the animation
6573 float durationSeconds(1.0f);
6574 Animation animation = Animation::New(durationSeconds);
6575 float targetWidth(10.0f);
6576 animation.AnimateTo( Property(actor, Actor::Property::SIZE_WIDTH), targetWidth );
6578 float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f);
6580 // Start the animation
6583 bool signalReceived(false);
6584 AnimationFinishCheck finishCheck(signalReceived);
6585 animation.FinishedSignal().Connect(&application, finishCheck);
6587 application.SendNotification();
6588 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6590 // We didn't expect the animation to finish yet
6591 application.SendNotification();
6592 finishCheck.CheckSignalNotReceived();
6593 DALI_TEST_EQUALS( actor.GetCurrentSize().width, fiftyPercentProgress, TEST_LOCATION );
6595 application.SendNotification();
6596 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6598 // We did expect the animation to finish
6599 application.SendNotification();
6600 finishCheck.CheckSignalReceived();
6601 DALI_TEST_EQUALS( actor.GetCurrentSize().width, targetWidth, TEST_LOCATION );
6602 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION );
6606 int UtcDaliAnimationAnimateToActorSizeHeightP(void)
6608 TestApplication application;
6610 Actor actor = Actor::New();
6611 Stage::GetCurrent().Add(actor);
6612 float startValue(0.0f);
6613 DALI_TEST_EQUALS( actor.GetCurrentSize().height, startValue, TEST_LOCATION );
6614 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION );
6616 // Build the animation
6617 float durationSeconds(1.0f);
6618 Animation animation = Animation::New(durationSeconds);
6619 float targetHeight(-10.0f);
6620 animation.AnimateTo( Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight );
6622 float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f);
6624 // Start the animation
6627 bool signalReceived(false);
6628 AnimationFinishCheck finishCheck(signalReceived);
6629 animation.FinishedSignal().Connect(&application, finishCheck);
6631 application.SendNotification();
6632 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6634 // We didn't expect the animation to finish yet
6635 application.SendNotification();
6636 finishCheck.CheckSignalNotReceived();
6637 DALI_TEST_EQUALS( actor.GetCurrentSize().height, fiftyPercentProgress, TEST_LOCATION );
6639 application.SendNotification();
6640 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6642 // We did expect the animation to finish
6643 application.SendNotification();
6644 finishCheck.CheckSignalReceived();
6645 DALI_TEST_EQUALS( actor.GetCurrentSize().height, targetHeight, TEST_LOCATION );
6646 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION );
6650 int UtcDaliAnimationAnimateToActorSizeDepthP(void)
6652 TestApplication application;
6654 Actor actor = Actor::New();
6655 Stage::GetCurrent().Add(actor);
6656 float startValue(0.0f);
6657 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, startValue, TEST_LOCATION );
6658 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION );
6660 // Build the animation
6661 float durationSeconds(1.0f);
6662 Animation animation = Animation::New(durationSeconds);
6663 float targetDepth(-10.0f);
6664 animation.AnimateTo( Property(actor, Actor::Property::SIZE_DEPTH), targetDepth );
6666 float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f);
6668 // Start the animation
6671 bool signalReceived(false);
6672 AnimationFinishCheck finishCheck(signalReceived);
6673 animation.FinishedSignal().Connect(&application, finishCheck);
6675 application.SendNotification();
6676 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6678 // We didn't expect the animation to finish yet
6679 application.SendNotification();
6680 finishCheck.CheckSignalNotReceived();
6681 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, fiftyPercentProgress, TEST_LOCATION );
6683 application.SendNotification();
6684 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6686 // We did expect the animation to finish
6687 application.SendNotification();
6688 finishCheck.CheckSignalReceived();
6689 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, targetDepth, TEST_LOCATION );
6690 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION );
6694 int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void)
6696 TestApplication application;
6698 Actor actor = Actor::New();
6699 Stage::GetCurrent().Add(actor);
6700 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6702 // Build the animation
6703 float durationSeconds(1.0f);
6704 Animation animation = Animation::New(durationSeconds);
6705 Vector3 targetSize(100.0f, 100.0f, 100.0f);
6706 animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetSize );
6708 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
6710 // Start the animation
6713 bool signalReceived(false);
6714 AnimationFinishCheck finishCheck(signalReceived);
6715 animation.FinishedSignal().Connect(&application, finishCheck);
6717 application.SendNotification();
6718 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6720 // We didn't expect the animation to finish yet
6721 application.SendNotification();
6722 finishCheck.CheckSignalNotReceived();
6723 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
6725 application.SendNotification();
6726 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6728 // We did expect the animation to finish
6729 application.SendNotification();
6730 finishCheck.CheckSignalReceived();
6731 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6734 finishCheck.Reset();
6735 actor.SetSize(Vector3::ZERO);
6736 application.SendNotification();
6737 application.Render(0);
6738 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6740 // Repeat with a different (ease-in) alpha function
6741 animation = Animation::New(durationSeconds);
6742 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::EASE_IN );
6743 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::EASE_IN );
6744 animation.FinishedSignal().Connect(&application, finishCheck);
6747 application.SendNotification();
6748 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6750 // We didn't expect the animation to finish yet
6751 application.SendNotification();
6752 finishCheck.CheckSignalNotReceived();
6754 // The size should have travelled less, than with a linear alpha function
6755 Vector3 current(actor.GetCurrentSize());
6756 DALI_TEST_CHECK( current.x > 0.0f );
6757 DALI_TEST_CHECK( current.y > 0.0f );
6758 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
6759 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
6761 application.SendNotification();
6762 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6764 // We did expect the animation to finish
6765 application.SendNotification();
6766 finishCheck.CheckSignalReceived();
6767 DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
6768 DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
6771 finishCheck.Reset();
6772 actor.SetSize(Vector3::ZERO);
6773 application.SendNotification();
6774 application.Render(0);
6775 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6777 // Repeat with a delay
6779 animation = Animation::New(durationSeconds);
6780 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
6781 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
6782 animation.FinishedSignal().Connect(&application, finishCheck);
6785 application.SendNotification();
6786 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6788 // We didn't expect the animation to finish yet
6789 application.SendNotification();
6790 finishCheck.CheckSignalNotReceived();
6791 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6793 application.SendNotification();
6794 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6796 // We did expect the animation to finish
6797 application.SendNotification();
6798 finishCheck.CheckSignalReceived();
6799 DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
6800 DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
6804 int UtcDaliAnimationAnimateToActorPositionP(void)
6806 TestApplication application;
6808 Actor actor = Actor::New();
6809 Stage::GetCurrent().Add(actor);
6810 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6812 // Build the animation
6813 float durationSeconds(1.0f);
6814 Animation animation = Animation::New(durationSeconds);
6815 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6816 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
6818 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6820 // Start the animation
6823 bool signalReceived(false);
6824 AnimationFinishCheck finishCheck(signalReceived);
6825 animation.FinishedSignal().Connect(&application, finishCheck);
6827 application.SendNotification();
6828 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
6830 // We didn't expect the animation to finish yet
6831 application.SendNotification();
6832 finishCheck.CheckSignalNotReceived();
6833 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
6835 application.SendNotification();
6836 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6838 // We did expect the animation to finish
6839 application.SendNotification();
6840 finishCheck.CheckSignalReceived();
6841 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6845 int UtcDaliAnimationAnimateToActorPositionXP(void)
6847 TestApplication application;
6849 Actor actor = Actor::New();
6850 Stage::GetCurrent().Add(actor);
6851 float startValue(0.0f);
6852 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, startValue, TEST_LOCATION );
6853 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6854 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6855 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6857 // Build the animation
6858 float durationSeconds(1.0f);
6859 Animation animation = Animation::New(durationSeconds);
6860 float targetX(1.0f);
6861 animation.AnimateTo( Property(actor, Actor::Property::POSITION_X), targetX );
6863 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
6865 // Start the animation
6868 bool signalReceived(false);
6869 AnimationFinishCheck finishCheck(signalReceived);
6870 animation.FinishedSignal().Connect(&application, finishCheck);
6872 application.SendNotification();
6873 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6875 // We didn't expect the animation to finish yet
6876 application.SendNotification();
6877 finishCheck.CheckSignalNotReceived();
6878 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, fiftyPercentProgress, 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.GetCurrentPosition().x, targetX, TEST_LOCATION );
6887 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION );
6888 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6889 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6893 int UtcDaliAnimationAnimateToActorPositionYP(void)
6895 TestApplication application;
6897 Actor actor = Actor::New();
6898 Stage::GetCurrent().Add(actor);
6899 float startValue(0.0f);
6900 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, startValue, TEST_LOCATION );
6901 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6902 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6903 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6905 // Build the animation
6906 float durationSeconds(1.0f);
6907 Animation animation = Animation::New(durationSeconds);
6908 float targetY(10.0f);
6909 animation.AnimateTo( Property(actor, Actor::Property::POSITION_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.GetCurrentPosition().y, fiftyPercentProgress, TEST_LOCATION );
6928 application.SendNotification();
6929 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6931 // We did expect the animation to finish
6932 application.SendNotification();
6933 finishCheck.CheckSignalReceived();
6934 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, targetY, TEST_LOCATION );
6935 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6936 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION );
6937 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6941 int UtcDaliAnimationAnimateToActorPositionZP(void)
6943 TestApplication application;
6945 Actor actor = Actor::New();
6946 Stage::GetCurrent().Add(actor);
6947 float startValue(0.0f);
6948 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, startValue, TEST_LOCATION );
6949 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6950 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6951 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6953 // Build the animation
6954 float durationSeconds(1.0f);
6955 Animation animation = Animation::New(durationSeconds);
6956 float targetZ(-5.0f);
6957 animation.AnimateTo( Property(actor, Actor::Property::POSITION_Z), targetZ );
6959 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
6961 // Start the animation
6964 bool signalReceived(false);
6965 AnimationFinishCheck finishCheck(signalReceived);
6966 animation.FinishedSignal().Connect(&application, finishCheck);
6968 application.SendNotification();
6969 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6971 // We didn't expect the animation to finish yet
6972 application.SendNotification();
6973 finishCheck.CheckSignalNotReceived();
6974 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, fiftyPercentProgress, TEST_LOCATION );
6976 application.SendNotification();
6977 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6979 // We did expect the animation to finish
6980 application.SendNotification();
6981 finishCheck.CheckSignalReceived();
6982 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, targetZ, TEST_LOCATION );
6983 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6984 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6985 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION );
6989 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void)
6991 TestApplication application;
6993 Actor actor = Actor::New();
6994 Stage::GetCurrent().Add(actor);
6995 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6997 // Build the animation
6998 float durationSeconds(1.0f);
6999 Animation animation = Animation::New(durationSeconds);
7000 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7001 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
7003 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7005 // Start the animation
7008 bool signalReceived(false);
7009 AnimationFinishCheck finishCheck(signalReceived);
7010 animation.FinishedSignal().Connect(&application, finishCheck);
7012 application.SendNotification();
7013 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
7015 // We didn't expect the animation to finish yet
7016 application.SendNotification();
7017 finishCheck.CheckSignalNotReceived();
7019 // The position should have moved less, than with a linear alpha function
7020 Vector3 current(actor.GetCurrentPosition());
7021 DALI_TEST_CHECK( current.x > Vector3::ZERO.x );
7022 DALI_TEST_CHECK( current.y > Vector3::ZERO.y );
7023 DALI_TEST_CHECK( current.z > Vector3::ZERO.z );
7024 DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x );
7025 DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y );
7026 DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z );
7028 application.SendNotification();
7029 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7031 // We did expect the animation to finish
7032 application.SendNotification();
7033 finishCheck.CheckSignalReceived();
7034 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7038 int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void)
7040 TestApplication application;
7042 Actor actor = Actor::New();
7043 Stage::GetCurrent().Add(actor);
7044 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7046 // Build the animation
7047 float durationSeconds(1.0f);
7048 Animation animation = Animation::New(durationSeconds);
7049 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7051 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7053 TimePeriod( delay, durationSeconds - delay ) );
7055 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7057 // Start the animation
7060 bool signalReceived(false);
7061 AnimationFinishCheck finishCheck(signalReceived);
7062 animation.FinishedSignal().Connect(&application, finishCheck);
7064 application.SendNotification();
7065 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7067 // We didn't expect the animation to finish yet
7068 application.SendNotification();
7069 finishCheck.CheckSignalNotReceived();
7070 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7072 application.SendNotification();
7073 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7075 // We didn't expect the animation to finish yet
7076 application.SendNotification();
7077 finishCheck.CheckSignalNotReceived();
7078 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7080 application.SendNotification();
7081 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7083 // We did expect the animation to finish
7084 application.SendNotification();
7085 finishCheck.CheckSignalReceived();
7086 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7090 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void)
7092 TestApplication application;
7094 Actor actor = Actor::New();
7095 Stage::GetCurrent().Add(actor);
7096 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7098 // Build the animation
7099 float durationSeconds(1.0f);
7100 Animation animation = Animation::New(durationSeconds);
7101 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7103 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7105 AlphaFunction::LINEAR,
7106 TimePeriod( delay, durationSeconds - delay ) );
7108 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7110 // Start the animation
7113 bool signalReceived(false);
7114 AnimationFinishCheck finishCheck(signalReceived);
7115 animation.FinishedSignal().Connect(&application, finishCheck);
7117 application.SendNotification();
7118 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7120 // We didn't expect the animation to finish yet
7121 application.SendNotification();
7122 finishCheck.CheckSignalNotReceived();
7123 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7125 application.SendNotification();
7126 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7128 // We didn't expect the animation to finish yet
7129 application.SendNotification();
7130 finishCheck.CheckSignalNotReceived();
7131 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7133 application.SendNotification();
7134 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7136 // We did expect the animation to finish
7137 application.SendNotification();
7138 finishCheck.CheckSignalReceived();
7139 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7143 int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void)
7145 TestApplication application;
7147 Actor actor = Actor::New();
7148 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7149 Stage::GetCurrent().Add(actor);
7150 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7152 // Build the animation
7153 float durationSeconds(1.0f);
7154 Animation animation = Animation::New(durationSeconds);
7155 Degree targetRotationDegrees(90.0f);
7156 Radian targetRotationRadians(targetRotationDegrees);
7157 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS) );
7159 // Start the animation
7162 bool signalReceived(false);
7163 AnimationFinishCheck finishCheck(signalReceived);
7164 animation.FinishedSignal().Connect(&application, finishCheck);
7166 application.SendNotification();
7167 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7169 // We didn't expect the animation to finish yet
7170 application.SendNotification();
7171 finishCheck.CheckSignalNotReceived();
7172 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7174 application.SendNotification();
7175 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7177 // We didn't expect the animation to finish yet
7178 application.SendNotification();
7179 finishCheck.CheckSignalNotReceived();
7180 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7182 application.SendNotification();
7183 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7185 // We didn't expect the animation to finish yet
7186 application.SendNotification();
7187 finishCheck.CheckSignalNotReceived();
7188 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7190 application.SendNotification();
7191 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7193 // We did expect the animation to finish
7194 application.SendNotification();
7195 finishCheck.CheckSignalReceived();
7196 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7200 int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void)
7202 TestApplication application;
7204 Actor actor = Actor::New();
7205 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7206 Stage::GetCurrent().Add(actor);
7207 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7209 // Build the animation
7210 float durationSeconds(1.0f);
7211 Animation animation = Animation::New(durationSeconds);
7212 Degree targetRotationDegrees(90.0f);
7213 Radian targetRotationRadians(targetRotationDegrees);
7214 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
7215 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), targetRotation );
7217 // Start the animation
7220 bool signalReceived(false);
7221 AnimationFinishCheck finishCheck(signalReceived);
7222 animation.FinishedSignal().Connect(&application, finishCheck);
7224 application.SendNotification();
7225 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7227 // We didn't expect the animation to finish yet
7228 application.SendNotification();
7229 finishCheck.CheckSignalNotReceived();
7230 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7232 application.SendNotification();
7233 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7235 // We didn't expect the animation to finish yet
7236 application.SendNotification();
7237 finishCheck.CheckSignalNotReceived();
7238 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7240 application.SendNotification();
7241 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7243 // We didn't expect the animation to finish yet
7244 application.SendNotification();
7245 finishCheck.CheckSignalNotReceived();
7246 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7248 application.SendNotification();
7249 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7251 // We did expect the animation to finish
7252 application.SendNotification();
7253 finishCheck.CheckSignalReceived();
7254 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7258 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void)
7260 TestApplication application;
7262 Actor actor = Actor::New();
7263 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7264 Stage::GetCurrent().Add(actor);
7265 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7267 // Build the animation
7268 float durationSeconds(1.0f);
7269 Animation animation = Animation::New(durationSeconds);
7270 Degree targetRotationDegrees(90.0f);
7271 Radian targetRotationRadians(targetRotationDegrees);
7272 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
7274 // Start the animation
7277 bool signalReceived(false);
7278 AnimationFinishCheck finishCheck(signalReceived);
7279 animation.FinishedSignal().Connect(&application, finishCheck);
7281 application.SendNotification();
7282 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7284 // We didn't expect the animation to finish yet
7285 application.SendNotification();
7286 finishCheck.CheckSignalNotReceived();
7287 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7289 application.SendNotification();
7290 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7292 // We didn't expect the animation to finish yet
7293 application.SendNotification();
7294 finishCheck.CheckSignalNotReceived();
7295 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7297 application.SendNotification();
7298 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7300 // We didn't expect the animation to finish yet
7301 application.SendNotification();
7302 finishCheck.CheckSignalNotReceived();
7303 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7305 application.SendNotification();
7306 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7308 // We did expect the animation to finish
7309 application.SendNotification();
7310 finishCheck.CheckSignalReceived();
7311 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7315 int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void)
7317 TestApplication application;
7319 Actor actor = Actor::New();
7320 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7321 Stage::GetCurrent().Add(actor);
7322 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7324 // Build the animation
7325 float durationSeconds(1.0f);
7326 Animation animation = Animation::New(durationSeconds);
7327 Degree targetRotationDegrees(90.0f);
7328 Radian targetRotationRadians(targetRotationDegrees);
7330 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
7332 // Start the animation
7335 bool signalReceived(false);
7336 AnimationFinishCheck finishCheck(signalReceived);
7337 animation.FinishedSignal().Connect(&application, finishCheck);
7339 application.SendNotification();
7340 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7342 // We didn't expect the animation to finish yet
7343 application.SendNotification();
7344 finishCheck.CheckSignalNotReceived();
7345 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7346 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7348 application.SendNotification();
7349 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7351 // We didn't expect the animation to finish yet
7352 application.SendNotification();
7353 finishCheck.CheckSignalNotReceived();
7354 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7355 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7357 application.SendNotification();
7358 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7360 // We didn't expect the animation to finish yet
7361 application.SendNotification();
7362 finishCheck.CheckSignalNotReceived();
7363 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7364 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7366 application.SendNotification();
7367 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7369 // We did expect the animation to finish
7370 application.SendNotification();
7371 finishCheck.CheckSignalReceived();
7372 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7376 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void)
7378 TestApplication application;
7380 Actor actor = Actor::New();
7381 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7382 Stage::GetCurrent().Add(actor);
7383 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7385 // Build the animation
7386 float durationSeconds(1.0f);
7387 Animation animation = Animation::New(durationSeconds);
7388 Degree targetRotationDegrees(90.0f);
7389 Radian targetRotationRadians(targetRotationDegrees);
7391 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
7393 // Start the animation
7396 bool signalReceived(false);
7397 AnimationFinishCheck finishCheck(signalReceived);
7398 animation.FinishedSignal().Connect(&application, finishCheck);
7400 application.SendNotification();
7401 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7403 // We didn't expect the animation to finish yet
7404 application.SendNotification();
7405 finishCheck.CheckSignalNotReceived();
7406 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7407 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7409 application.SendNotification();
7410 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7412 // We didn't expect the animation to finish yet
7413 application.SendNotification();
7414 finishCheck.CheckSignalNotReceived();
7415 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7416 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7418 application.SendNotification();
7419 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7421 // We didn't expect the animation to finish yet
7422 application.SendNotification();
7423 finishCheck.CheckSignalNotReceived();
7424 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7425 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7427 application.SendNotification();
7428 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7430 // We did expect the animation to finish
7431 application.SendNotification();
7432 finishCheck.CheckSignalReceived();
7433 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7437 int UtcDaliAnimationAnimateToActorScaleP(void)
7439 TestApplication application;
7441 Actor actor = Actor::New();
7442 Stage::GetCurrent().Add(actor);
7443 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7445 // Build the animation
7446 float durationSeconds(1.0f);
7447 Animation animation = Animation::New(durationSeconds);
7448 Vector3 targetScale(2.0f, 2.0f, 2.0f);
7449 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale );
7451 Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f);
7453 // Start the animation
7456 bool signalReceived(false);
7457 AnimationFinishCheck finishCheck(signalReceived);
7458 animation.FinishedSignal().Connect(&application, finishCheck);
7460 application.SendNotification();
7461 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7463 // We didn't expect the animation to finish yet
7464 application.SendNotification();
7465 finishCheck.CheckSignalNotReceived();
7466 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
7468 application.SendNotification();
7469 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7471 // We did expect the animation to finish
7472 application.SendNotification();
7473 finishCheck.CheckSignalReceived();
7474 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7477 finishCheck.Reset();
7478 actor.SetScale(Vector3::ONE);
7479 application.SendNotification();
7480 application.Render(0);
7481 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7483 // Repeat with a different (ease-in) alpha function
7484 animation = Animation::New(durationSeconds);
7485 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
7486 animation.FinishedSignal().Connect(&application, finishCheck);
7489 application.SendNotification();
7490 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7492 // We didn't expect the animation to finish yet
7493 application.SendNotification();
7494 finishCheck.CheckSignalNotReceived();
7496 // The scale should have grown less, than with a linear alpha function
7497 Vector3 current(actor.GetCurrentScale());
7498 DALI_TEST_CHECK( current.x > 1.0f );
7499 DALI_TEST_CHECK( current.y > 1.0f );
7500 DALI_TEST_CHECK( current.z > 1.0f );
7501 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
7502 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
7503 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
7505 application.SendNotification();
7506 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7508 // We did expect the animation to finish
7509 application.SendNotification();
7510 finishCheck.CheckSignalReceived();
7511 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7514 finishCheck.Reset();
7515 actor.SetScale(Vector3::ONE);
7516 application.SendNotification();
7517 application.Render(0);
7518 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7520 // Repeat with a delay
7522 animation = Animation::New(durationSeconds);
7523 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7524 animation.FinishedSignal().Connect(&application, finishCheck);
7527 application.SendNotification();
7528 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7530 // We didn't expect the animation to finish yet
7531 application.SendNotification();
7532 finishCheck.CheckSignalNotReceived();
7533 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7535 application.SendNotification();
7536 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7538 // We did expect the animation to finish
7539 application.SendNotification();
7540 finishCheck.CheckSignalReceived();
7541 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7545 int UtcDaliAnimationAnimateToActorScaleXP(void)
7547 TestApplication application;
7549 Actor actor = Actor::New();
7550 Stage::GetCurrent().Add(actor);
7551 float startValue(1.0f);
7552 DALI_TEST_EQUALS( actor.GetCurrentScale().x, startValue, TEST_LOCATION );
7553 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7554 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7555 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7557 // Build the animation
7558 float durationSeconds(1.0f);
7559 Animation animation = Animation::New(durationSeconds);
7560 float targetX(10.0f);
7561 animation.AnimateTo( Property(actor, Actor::Property::SCALE_X), targetX );
7563 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
7565 // Start the animation
7568 bool signalReceived(false);
7569 AnimationFinishCheck finishCheck(signalReceived);
7570 animation.FinishedSignal().Connect(&application, finishCheck);
7572 application.SendNotification();
7573 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7575 // We didn't expect the animation to finish yet
7576 application.SendNotification();
7577 finishCheck.CheckSignalNotReceived();
7578 DALI_TEST_EQUALS( actor.GetCurrentScale().x, fiftyPercentProgress, TEST_LOCATION );
7579 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), fiftyPercentProgress, TEST_LOCATION );
7580 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7581 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7583 application.SendNotification();
7584 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7586 // We did expect the animation to finish
7587 application.SendNotification();
7588 finishCheck.CheckSignalReceived();
7589 DALI_TEST_EQUALS( actor.GetCurrentScale().x, targetX, TEST_LOCATION );
7590 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), targetX, TEST_LOCATION );
7591 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7592 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7596 int UtcDaliAnimationAnimateToActorScaleYP(void)
7598 TestApplication application;
7600 Actor actor = Actor::New();
7601 Stage::GetCurrent().Add(actor);
7602 float startValue(1.0f);
7603 DALI_TEST_EQUALS( actor.GetCurrentScale().y, startValue, TEST_LOCATION );
7604 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7605 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7606 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7608 // Build the animation
7609 float durationSeconds(1.0f);
7610 Animation animation = Animation::New(durationSeconds);
7611 float targetY(1000.0f);
7612 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Y), targetY );
7614 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
7616 // Start the animation
7619 bool signalReceived(false);
7620 AnimationFinishCheck finishCheck(signalReceived);
7621 animation.FinishedSignal().Connect(&application, finishCheck);
7623 application.SendNotification();
7624 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7626 // We didn't expect the animation to finish yet
7627 application.SendNotification();
7628 finishCheck.CheckSignalNotReceived();
7629 DALI_TEST_EQUALS( actor.GetCurrentScale().y, fiftyPercentProgress, TEST_LOCATION );
7630 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7631 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), fiftyPercentProgress, TEST_LOCATION );
7632 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7634 application.SendNotification();
7635 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7637 // We did expect the animation to finish
7638 application.SendNotification();
7639 finishCheck.CheckSignalReceived();
7640 DALI_TEST_EQUALS( actor.GetCurrentScale().y, targetY, TEST_LOCATION );
7641 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7642 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), targetY, TEST_LOCATION );
7643 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7647 int UtcDaliAnimationAnimateToActorScaleZP(void)
7649 TestApplication application;
7651 Actor actor = Actor::New();
7652 Stage::GetCurrent().Add(actor);
7653 float startValue(1.0f);
7654 DALI_TEST_EQUALS( actor.GetCurrentScale().z, startValue, TEST_LOCATION );
7655 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7656 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7657 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7659 // Build the animation
7660 float durationSeconds(1.0f);
7661 Animation animation = Animation::New(durationSeconds);
7662 float targetZ(-1000.0f);
7663 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Z), targetZ );
7665 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
7667 // Start the animation
7670 bool signalReceived(false);
7671 AnimationFinishCheck finishCheck(signalReceived);
7672 animation.FinishedSignal().Connect(&application, finishCheck);
7674 application.SendNotification();
7675 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7677 // We didn't expect the animation to finish yet
7678 application.SendNotification();
7679 finishCheck.CheckSignalNotReceived();
7680 DALI_TEST_EQUALS( actor.GetCurrentScale().z, fiftyPercentProgress, TEST_LOCATION );
7681 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7682 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7683 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), fiftyPercentProgress, TEST_LOCATION );
7685 application.SendNotification();
7686 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7688 // We did expect the animation to finish
7689 application.SendNotification();
7690 finishCheck.CheckSignalReceived();
7691 DALI_TEST_EQUALS( actor.GetCurrentScale().z, targetZ, TEST_LOCATION );
7692 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7693 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7694 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), targetZ, TEST_LOCATION );
7698 int UtcDaliAnimationAnimateToActorColorP(void)
7700 TestApplication application;
7702 Actor actor = Actor::New();
7703 Stage::GetCurrent().Add(actor);
7704 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7706 // Build the animation
7707 float durationSeconds(1.0f);
7708 Animation animation = Animation::New(durationSeconds);
7709 Vector4 targetColor(Color::RED);
7710 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor );
7712 Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
7713 Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
7715 // Start the animation
7718 bool signalReceived(false);
7719 AnimationFinishCheck finishCheck(signalReceived);
7720 animation.FinishedSignal().Connect(&application, finishCheck);
7722 application.SendNotification();
7723 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7725 // We didn't expect the animation to finish yet
7726 application.SendNotification();
7727 finishCheck.CheckSignalNotReceived();
7728 DALI_TEST_EQUALS( actor.GetCurrentColor(), tenPercentProgress, TEST_LOCATION );
7730 application.SendNotification();
7731 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7733 // We did expect the animation to finish
7734 application.SendNotification();
7735 finishCheck.CheckSignalReceived();
7736 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7739 finishCheck.Reset();
7740 actor.SetColor(Color::WHITE);
7741 application.SendNotification();
7742 application.Render(0);
7743 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7745 // Repeat with a different (ease-in) alpha function
7746 animation = Animation::New(durationSeconds);
7747 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
7748 animation.FinishedSignal().Connect(&application, finishCheck);
7751 application.SendNotification();
7752 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7754 // We didn't expect the animation to finish yet
7755 application.SendNotification();
7756 finishCheck.CheckSignalNotReceived();
7758 // The color should have changed less, than with a linear alpha function
7759 Vector4 current(actor.GetCurrentColor());
7760 DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change
7761 DALI_TEST_CHECK( current.y < 1.0f );
7762 DALI_TEST_CHECK( current.y > tenPercentProgress.y );
7763 DALI_TEST_CHECK( current.z < 1.0f );
7764 DALI_TEST_CHECK( current.z > tenPercentProgress.z );
7765 DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
7767 application.SendNotification();
7768 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7770 // We did expect the animation to finish
7771 application.SendNotification();
7772 finishCheck.CheckSignalReceived();
7773 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7776 finishCheck.Reset();
7777 actor.SetColor(Color::WHITE);
7778 application.SendNotification();
7779 application.Render(0);
7780 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7782 // Repeat with a shorter animator duration
7783 float animatorDuration = 0.5f;
7784 animation = Animation::New(durationSeconds);
7785 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
7786 animation.FinishedSignal().Connect(&application, finishCheck);
7789 application.SendNotification();
7790 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
7792 // We didn't expect the animation to finish yet
7793 application.SendNotification();
7794 finishCheck.CheckSignalNotReceived();
7795 DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION );
7797 application.SendNotification();
7798 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
7800 // We didn't expect the animation to finish yet
7801 application.SendNotification();
7802 finishCheck.CheckSignalNotReceived();
7803 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7805 application.SendNotification();
7806 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7808 // We did expect the animation to finish
7809 application.SendNotification();
7810 finishCheck.CheckSignalReceived();
7811 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7815 int UtcDaliAnimationAnimateToActorColorRedP(void)
7817 TestApplication application;
7819 Actor actor = Actor::New();
7820 Stage::GetCurrent().Add(actor);
7821 float startValue(1.0f);
7822 DALI_TEST_EQUALS( actor.GetCurrentColor().r, startValue, TEST_LOCATION );
7823 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7824 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7825 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7826 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7828 // Build the animation
7829 float durationSeconds(1.0f);
7830 Animation animation = Animation::New(durationSeconds);
7831 float targetRed(0.5f);
7832 animation.AnimateTo( Property(actor, Actor::Property::COLOR_RED), targetRed );
7834 float fiftyPercentProgress(startValue + (targetRed - startValue)*0.5f);
7836 // Start the animation
7839 bool signalReceived(false);
7840 AnimationFinishCheck finishCheck(signalReceived);
7841 animation.FinishedSignal().Connect(&application, finishCheck);
7843 application.SendNotification();
7844 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7846 // We didn't expect the animation to finish yet
7847 application.SendNotification();
7848 finishCheck.CheckSignalNotReceived();
7849 DALI_TEST_EQUALS( actor.GetCurrentColor().r, fiftyPercentProgress, TEST_LOCATION );
7850 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION );
7851 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7852 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7853 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7855 application.SendNotification();
7856 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7858 // We did expect the animation to finish
7859 application.SendNotification();
7860 finishCheck.CheckSignalReceived();
7861 DALI_TEST_EQUALS( actor.GetCurrentColor().r, targetRed, TEST_LOCATION );
7862 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), targetRed, TEST_LOCATION );
7863 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7864 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7865 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7869 int UtcDaliAnimationAnimateToActorColorGreenP(void)
7871 TestApplication application;
7873 Actor actor = Actor::New();
7874 Stage::GetCurrent().Add(actor);
7875 float startValue(1.0f);
7876 DALI_TEST_EQUALS( actor.GetCurrentColor().g, startValue, TEST_LOCATION );
7877 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7878 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7879 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7880 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7882 // Build the animation
7883 float durationSeconds(1.0f);
7884 Animation animation = Animation::New(durationSeconds);
7885 float targetGreen(0.5f);
7886 animation.AnimateTo( Property(actor, Actor::Property::COLOR_GREEN), targetGreen );
7888 float fiftyPercentProgress(startValue + (targetGreen - startValue)*0.5f);
7890 // Start the animation
7893 bool signalReceived(false);
7894 AnimationFinishCheck finishCheck(signalReceived);
7895 animation.FinishedSignal().Connect(&application, finishCheck);
7897 application.SendNotification();
7898 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7900 // We didn't expect the animation to finish yet
7901 application.SendNotification();
7902 finishCheck.CheckSignalNotReceived();
7903 DALI_TEST_EQUALS( actor.GetCurrentColor().g, fiftyPercentProgress, TEST_LOCATION );
7904 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7905 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION );
7906 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7907 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7909 application.SendNotification();
7910 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7912 // We did expect the animation to finish
7913 application.SendNotification();
7914 finishCheck.CheckSignalReceived();
7915 DALI_TEST_EQUALS( actor.GetCurrentColor().g, targetGreen, TEST_LOCATION );
7916 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7917 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION );
7918 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7919 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7923 int UtcDaliAnimationAnimateToActorColorBlueP(void)
7925 TestApplication application;
7927 Actor actor = Actor::New();
7928 Stage::GetCurrent().Add(actor);
7929 float startValue(1.0f);
7930 DALI_TEST_EQUALS( actor.GetCurrentColor().b, startValue, TEST_LOCATION );
7931 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7932 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7933 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7934 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7936 // Build the animation
7937 float durationSeconds(1.0f);
7938 Animation animation = Animation::New(durationSeconds);
7939 float targetBlue(0.5f);
7940 animation.AnimateTo( Property(actor, Actor::Property::COLOR_BLUE), targetBlue );
7942 float fiftyPercentProgress(startValue + (targetBlue - startValue)*0.5f);
7944 // Start the animation
7947 bool signalReceived(false);
7948 AnimationFinishCheck finishCheck(signalReceived);
7949 animation.FinishedSignal().Connect(&application, finishCheck);
7951 application.SendNotification();
7952 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7954 // We didn't expect the animation to finish yet
7955 application.SendNotification();
7956 finishCheck.CheckSignalNotReceived();
7957 DALI_TEST_EQUALS( actor.GetCurrentColor().b, fiftyPercentProgress, TEST_LOCATION );
7958 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7959 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7960 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), fiftyPercentProgress, TEST_LOCATION );
7961 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7963 application.SendNotification();
7964 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7966 // We did expect the animation to finish
7967 application.SendNotification();
7968 finishCheck.CheckSignalReceived();
7969 DALI_TEST_EQUALS( actor.GetCurrentColor().b, targetBlue, TEST_LOCATION );
7970 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7971 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7972 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetBlue, TEST_LOCATION );
7973 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7977 int UtcDaliAnimationAnimateToActorColorAlphaP(void)
7979 TestApplication application;
7981 Actor actor = Actor::New();
7982 Stage::GetCurrent().Add(actor);
7983 float startValue(1.0f);
7984 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7985 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7986 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7987 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7988 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7990 // Build the animation
7991 float durationSeconds(1.0f);
7992 Animation animation = Animation::New(durationSeconds);
7993 float targetAlpha(0.5f);
7994 animation.AnimateTo( Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha );
7996 float fiftyPercentProgress(startValue + (targetAlpha - startValue)*0.5f);
7998 // Start the animation
8001 bool signalReceived(false);
8002 AnimationFinishCheck finishCheck(signalReceived);
8003 animation.FinishedSignal().Connect(&application, finishCheck);
8005 application.SendNotification();
8006 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8008 // We didn't expect the animation to finish yet
8009 application.SendNotification();
8010 finishCheck.CheckSignalNotReceived();
8011 DALI_TEST_EQUALS( actor.GetCurrentColor().a, fiftyPercentProgress, TEST_LOCATION );
8012 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8013 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8014 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8015 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), fiftyPercentProgress, TEST_LOCATION );
8017 application.SendNotification();
8018 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8020 // We did expect the animation to finish
8021 application.SendNotification();
8022 finishCheck.CheckSignalReceived();
8023 DALI_TEST_EQUALS( actor.GetCurrentColor().a, targetAlpha, TEST_LOCATION );
8024 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8025 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8026 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8027 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetAlpha, TEST_LOCATION );
8031 int UtcDaliAnimationKeyFrames01P(void)
8033 TestApplication application;
8035 KeyFrames keyFrames = KeyFrames::New();
8036 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8038 keyFrames.Add(0.0f, 0.1f);
8040 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8042 KeyFrames keyFrames2( keyFrames);
8043 DALI_TEST_CHECK( keyFrames2 );
8044 DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
8046 KeyFrames keyFrames3 = KeyFrames::New();
8047 keyFrames3.Add(0.6f, true);
8048 DALI_TEST_CHECK( keyFrames3 );
8049 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
8051 keyFrames3 = keyFrames;
8052 DALI_TEST_CHECK( keyFrames3 );
8053 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
8058 int UtcDaliAnimationKeyFrames02P(void)
8060 TestApplication application;
8062 KeyFrames keyFrames = KeyFrames::New();
8063 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8065 keyFrames.Add(0.0f, 0.1f);
8066 keyFrames.Add(0.2f, 0.5f);
8067 keyFrames.Add(0.4f, 0.0f);
8068 keyFrames.Add(0.6f, 1.0f);
8069 keyFrames.Add(0.8f, 0.7f);
8070 keyFrames.Add(1.0f, 0.9f);
8072 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8076 keyFrames.Add(1.9f, false);
8078 catch (Dali::DaliException& e)
8080 DALI_TEST_PRINT_ASSERT( e );
8081 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8086 int UtcDaliAnimationKeyFrames03P(void)
8088 TestApplication application;
8090 KeyFrames keyFrames = KeyFrames::New();
8091 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8093 keyFrames.Add(0.0f, true);
8094 keyFrames.Add(0.2f, false);
8095 keyFrames.Add(0.4f, false);
8096 keyFrames.Add(0.6f, true);
8097 keyFrames.Add(0.8f, true);
8098 keyFrames.Add(1.0f, false);
8100 DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
8104 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8106 catch (Dali::DaliException& e)
8108 DALI_TEST_PRINT_ASSERT( e );
8109 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8114 int UtcDaliAnimationKeyFrames04P(void)
8116 TestApplication application;
8118 KeyFrames keyFrames = KeyFrames::New();
8119 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8121 keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
8122 keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
8123 keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
8124 keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
8125 keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
8126 keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
8128 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
8132 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8134 catch (Dali::DaliException& e)
8136 DALI_TEST_PRINT_ASSERT( e );
8137 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8142 int UtcDaliAnimationKeyFrames05P(void)
8144 TestApplication application;
8146 KeyFrames keyFrames = KeyFrames::New();
8147 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8149 keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
8150 keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
8151 keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
8152 keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
8153 keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
8154 keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
8156 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
8160 keyFrames.Add(0.7f, 1.0f);
8162 catch (Dali::DaliException& e)
8164 DALI_TEST_PRINT_ASSERT( e );
8165 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8170 int UtcDaliAnimationKeyFrames06P(void)
8172 TestApplication application;
8174 KeyFrames keyFrames = KeyFrames::New();
8175 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8177 keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
8178 keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8179 keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
8180 keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
8181 keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
8182 keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
8184 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
8188 keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
8190 catch (Dali::DaliException& e)
8192 DALI_TEST_PRINT_ASSERT( e );
8193 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8198 int UtcDaliAnimationKeyFrames07P(void)
8200 TestApplication application;
8202 KeyFrames keyFrames = KeyFrames::New();
8203 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8205 keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
8206 keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
8207 keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
8208 keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
8209 keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
8210 keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
8212 DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
8216 keyFrames.Add(0.7f, 1.1f);
8218 catch (Dali::DaliException& e)
8220 DALI_TEST_PRINT_ASSERT( e );
8221 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8226 int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
8228 TestApplication application;
8230 float startValue(1.0f);
8231 Actor actor = Actor::New();
8232 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8233 Stage::GetCurrent().Add(actor);
8235 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8236 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8237 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8238 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8239 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8241 // Build the animation
8242 float durationSeconds(1.0f);
8243 Animation animation = Animation::New(durationSeconds);
8245 KeyFrames keyFrames = KeyFrames::New();
8246 keyFrames.Add(0.0f, 0.1f);
8247 keyFrames.Add(0.2f, 0.5f);
8248 keyFrames.Add(0.4f, 0.0f);
8249 keyFrames.Add(0.6f, 1.0f);
8250 keyFrames.Add(0.8f, 0.7f);
8251 keyFrames.Add(1.0f, 0.9f);
8253 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames );
8255 // Start the animation
8258 bool signalReceived(false);
8259 AnimationFinishCheck finishCheck(signalReceived);
8260 animation.FinishedSignal().Connect(&application, finishCheck);
8261 application.SendNotification();
8262 application.Render(0);
8263 application.SendNotification();
8264 finishCheck.CheckSignalNotReceived();
8265 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
8267 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8268 application.SendNotification();
8269 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8270 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8271 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8272 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION );
8273 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.3f, 0.01f, TEST_LOCATION );
8275 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
8276 application.SendNotification();
8277 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8278 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8279 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8280 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION );
8281 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.25f, 0.01f, TEST_LOCATION );
8283 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
8284 application.SendNotification();
8285 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8286 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8287 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8288 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
8289 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
8291 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
8292 application.SendNotification();
8293 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8294 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8295 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8296 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
8297 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
8299 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
8300 application.SendNotification();
8301 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8302 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8303 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8304 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION );
8305 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.8f, 0.01f, TEST_LOCATION );
8307 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
8308 application.SendNotification();
8309 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8310 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8311 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8312 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
8313 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
8315 // We did expect the animation to finish
8317 finishCheck.CheckSignalReceived();
8321 int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
8323 TestApplication application;
8325 float startValue(1.0f);
8326 Actor actor = Actor::New();
8327 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8328 Stage::GetCurrent().Add(actor);
8330 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8331 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8332 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8333 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8334 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8336 // Build the animation
8337 float durationSeconds(1.0f);
8338 Animation animation = Animation::New(durationSeconds);
8340 KeyFrames keyFrames = KeyFrames::New();
8341 keyFrames.Add(0.0f, 0.1f);
8342 keyFrames.Add(0.2f, 0.5f);
8343 keyFrames.Add(0.4f, 0.0f);
8344 keyFrames.Add(0.6f, 1.0f);
8345 keyFrames.Add(0.8f, 0.7f);
8346 keyFrames.Add(1.0f, 0.9f);
8348 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::Cubic );
8350 // Start the animation
8353 bool signalReceived(false);
8354 AnimationFinishCheck finishCheck(signalReceived);
8355 animation.FinishedSignal().Connect(&application, finishCheck);
8356 application.SendNotification();
8357 application.Render(0);
8358 application.SendNotification();
8359 finishCheck.CheckSignalNotReceived();
8360 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
8362 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8363 application.SendNotification();
8364 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8365 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8366 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8367 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.36f, 0.01f, TEST_LOCATION );
8368 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.36f, 0.01f, TEST_LOCATION );
8370 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
8371 application.SendNotification();
8372 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8373 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8374 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8375 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.21f, 0.01f, TEST_LOCATION );
8376 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.21f, 0.01f, TEST_LOCATION );
8378 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
8379 application.SendNotification();
8380 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8381 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8382 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8383 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
8384 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
8386 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
8387 application.SendNotification();
8388 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8389 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8390 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8391 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
8392 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
8394 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
8395 application.SendNotification();
8396 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8397 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8398 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8399 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.76f, 0.01f, TEST_LOCATION );
8400 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.76f, 0.01f, TEST_LOCATION );
8402 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
8403 application.SendNotification();
8404 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8405 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8406 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8407 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
8408 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
8410 // We did expect the animation to finish
8412 finishCheck.CheckSignalReceived();
8416 int UtcDaliAnimationAnimateBetweenActorColorP(void)
8418 TestApplication application;
8420 float startValue(1.0f);
8421 Actor actor = Actor::New();
8422 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8423 Stage::GetCurrent().Add(actor);
8425 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8426 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8427 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8428 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8429 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8431 // Build the animation
8432 float durationSeconds(1.0f);
8433 Animation animation = Animation::New(durationSeconds);
8435 KeyFrames keyFrames = KeyFrames::New();
8436 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8437 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8438 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8440 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames );
8442 // Start the animation
8445 bool signalReceived(false);
8446 AnimationFinishCheck finishCheck(signalReceived);
8447 animation.FinishedSignal().Connect(&application, finishCheck);
8448 application.SendNotification();
8449 application.Render(0);
8450 application.SendNotification();
8451 finishCheck.CheckSignalNotReceived();
8452 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8453 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8454 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8455 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8457 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8458 application.SendNotification();
8459 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
8460 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
8461 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
8462 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
8464 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8465 application.SendNotification();
8466 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8467 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8468 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8469 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8471 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8472 application.SendNotification();
8473 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
8474 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
8475 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
8476 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
8478 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8479 application.SendNotification();
8480 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8481 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8482 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8483 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8485 // We did expect the animation to finish
8487 finishCheck.CheckSignalReceived();
8491 int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
8493 TestApplication application;
8495 float startValue(1.0f);
8496 Actor actor = Actor::New();
8497 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8498 Stage::GetCurrent().Add(actor);
8500 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8501 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8502 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8503 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8504 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8506 // Build the animation
8507 float durationSeconds(1.0f);
8508 Animation animation = Animation::New(durationSeconds);
8510 KeyFrames keyFrames = KeyFrames::New();
8511 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8512 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8513 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8515 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, Animation::Cubic );
8517 // Start the animation
8520 bool signalReceived(false);
8521 AnimationFinishCheck finishCheck(signalReceived);
8522 animation.FinishedSignal().Connect(&application, finishCheck);
8523 application.SendNotification();
8524 application.Render(0);
8525 application.SendNotification();
8526 finishCheck.CheckSignalNotReceived();
8527 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8528 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8529 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8530 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8532 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8533 application.SendNotification();
8534 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION );
8535 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
8536 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION );
8537 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
8539 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8540 application.SendNotification();
8541 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8542 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8543 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8544 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8546 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8547 application.SendNotification();
8548 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION );
8549 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
8550 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION );
8551 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
8553 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8554 application.SendNotification();
8555 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8556 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8557 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8558 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8560 // We did expect the animation to finish
8562 finishCheck.CheckSignalReceived();
8566 int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
8568 TestApplication application;
8570 Actor actor = Actor::New();
8571 AngleAxis aa(Degree(90), Vector3::XAXIS);
8572 actor.SetOrientation(aa.angle, aa.axis);
8573 Stage::GetCurrent().Add(actor);
8575 application.SendNotification();
8576 application.Render(0);
8578 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
8580 // Build the animation
8581 float durationSeconds(1.0f);
8582 Animation animation = Animation::New(durationSeconds);
8584 KeyFrames keyFrames = KeyFrames::New();
8585 keyFrames.Add(0.0f, false);
8586 keyFrames.Add(0.2f, true);
8587 keyFrames.Add(0.4f, true);
8588 keyFrames.Add(0.8f, false);
8589 keyFrames.Add(1.0f, true);
8591 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames );
8593 // Start the animation
8596 bool signalReceived(false);
8597 AnimationFinishCheck finishCheck(signalReceived);
8598 animation.FinishedSignal().Connect(&application, finishCheck);
8599 application.SendNotification();
8600 application.SendNotification();
8601 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8602 application.SendNotification();
8603 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8604 application.SendNotification();
8606 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
8607 finishCheck.CheckSignalReceived();
8611 int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
8613 TestApplication application;
8615 Actor actor = Actor::New();
8616 AngleAxis aa(Degree(90), Vector3::XAXIS);
8617 actor.SetOrientation(aa.angle, aa.axis);
8618 Stage::GetCurrent().Add(actor);
8620 application.SendNotification();
8621 application.Render(0);
8623 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
8625 // Build the animation
8626 float durationSeconds(1.0f);
8627 Animation animation = Animation::New(durationSeconds);
8629 KeyFrames keyFrames = KeyFrames::New();
8630 keyFrames.Add(0.0f, false);
8631 keyFrames.Add(0.2f, true);
8632 keyFrames.Add(0.4f, true);
8633 keyFrames.Add(0.8f, false);
8634 keyFrames.Add(1.0f, true);
8636 //Cubic interpolation for boolean values should be ignored
8637 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::Cubic );
8639 // Start the animation
8642 bool signalReceived(false);
8643 AnimationFinishCheck finishCheck(signalReceived);
8644 animation.FinishedSignal().Connect(&application, finishCheck);
8645 application.SendNotification();
8646 application.SendNotification();
8647 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8648 application.SendNotification();
8649 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8650 application.SendNotification();
8652 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
8653 finishCheck.CheckSignalReceived();
8657 int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
8659 TestApplication application;
8661 Actor actor = Actor::New();
8662 AngleAxis aa(Degree(90), Vector3::XAXIS);
8663 actor.SetOrientation(aa.angle, aa.axis);
8664 Stage::GetCurrent().Add(actor);
8666 application.SendNotification();
8667 application.Render(0);
8668 Quaternion start(Radian(aa.angle), aa.axis);
8669 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8671 // Build the animation
8672 float durationSeconds(1.0f);
8673 Animation animation = Animation::New(durationSeconds);
8675 KeyFrames keyFrames = KeyFrames::New();
8676 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
8678 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
8680 // Start the animation
8683 bool signalReceived(false);
8684 AnimationFinishCheck finishCheck(signalReceived);
8685 animation.FinishedSignal().Connect(&application, finishCheck);
8686 application.SendNotification();
8687 application.SendNotification();
8688 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8689 application.SendNotification();
8690 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8691 application.SendNotification();
8693 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
8695 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8696 finishCheck.CheckSignalReceived();
8700 int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
8702 TestApplication application;
8704 Actor actor = Actor::New();
8705 AngleAxis aa(Degree(90), Vector3::XAXIS);
8706 actor.SetOrientation(aa.angle, aa.axis);
8707 application.SendNotification();
8708 application.Render(0);
8709 Stage::GetCurrent().Add(actor);
8711 Quaternion start(Radian(aa.angle), aa.axis);
8712 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8714 // Build the animation
8715 float durationSeconds(1.0f);
8716 Animation animation = Animation::New(durationSeconds);
8718 KeyFrames keyFrames = KeyFrames::New();
8719 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
8720 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
8721 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
8723 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
8725 // Start the animation
8728 bool signalReceived(false);
8729 AnimationFinishCheck finishCheck(signalReceived);
8730 animation.FinishedSignal().Connect(&application, finishCheck);
8731 application.SendNotification();
8732 application.Render(0);
8733 application.SendNotification();
8734 finishCheck.CheckSignalNotReceived();
8736 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
8737 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8739 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8740 application.SendNotification();
8741 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
8742 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8744 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8745 application.SendNotification();
8746 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
8747 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8749 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8750 application.SendNotification();
8751 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f) );
8752 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8754 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8755 application.SendNotification();
8756 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
8757 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8759 // We did expect the animation to finish
8761 finishCheck.CheckSignalReceived();
8765 int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
8767 TestApplication application;
8769 Actor actor = Actor::New();
8770 AngleAxis aa(Degree(90), Vector3::XAXIS);
8771 actor.SetOrientation(aa.angle, aa.axis);
8772 Stage::GetCurrent().Add(actor);
8774 application.SendNotification();
8775 application.Render(0);
8776 Quaternion start(Radian(aa.angle), aa.axis);
8777 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8779 // Build the animation
8780 float durationSeconds(1.0f);
8781 Animation animation = Animation::New(durationSeconds);
8783 KeyFrames keyFrames = KeyFrames::New();
8784 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
8786 //Cubic interpolation should be ignored for quaternions
8787 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
8789 // Start the animation
8792 bool signalReceived(false);
8793 AnimationFinishCheck finishCheck(signalReceived);
8794 animation.FinishedSignal().Connect(&application, finishCheck);
8795 application.SendNotification();
8796 application.SendNotification();
8797 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8798 application.SendNotification();
8799 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8800 application.SendNotification();
8802 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
8804 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8805 finishCheck.CheckSignalReceived();
8809 int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
8811 TestApplication application;
8813 Actor actor = Actor::New();
8814 AngleAxis aa(Degree(90), Vector3::XAXIS);
8815 actor.SetOrientation(aa.angle, aa.axis);
8816 application.SendNotification();
8817 application.Render(0);
8818 Stage::GetCurrent().Add(actor);
8820 Quaternion start(Radian(aa.angle), aa.axis);
8821 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8823 // Build the animation
8824 float durationSeconds(1.0f);
8825 Animation animation = Animation::New(durationSeconds);
8827 KeyFrames keyFrames = KeyFrames::New();
8828 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
8829 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
8830 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
8832 //Cubic interpolation should be ignored for quaternions
8833 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
8835 // Start the animation
8838 bool signalReceived(false);
8839 AnimationFinishCheck finishCheck(signalReceived);
8840 animation.FinishedSignal().Connect(&application, finishCheck);
8841 application.SendNotification();
8842 application.Render(0);
8843 application.SendNotification();
8844 finishCheck.CheckSignalNotReceived();
8846 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
8847 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8849 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8850 application.SendNotification();
8851 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
8852 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8854 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8855 application.SendNotification();
8856 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
8857 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8859 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8860 application.SendNotification();
8861 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f ) );
8862 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8864 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8865 application.SendNotification();
8866 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
8867 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8869 // We did expect the animation to finish
8871 finishCheck.CheckSignalReceived();
8875 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
8877 TestApplication application;
8879 float startValue(1.0f);
8880 Actor actor = Actor::New();
8881 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8882 Stage::GetCurrent().Add(actor);
8884 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8885 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8886 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8887 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8888 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8890 // Build the animation
8891 float durationSeconds(1.0f);
8892 Animation animation = Animation::New(durationSeconds);
8894 KeyFrames keyFrames = KeyFrames::New();
8895 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8896 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8897 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8899 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR );
8901 // Start the animation
8904 bool signalReceived(false);
8905 AnimationFinishCheck finishCheck(signalReceived);
8906 animation.FinishedSignal().Connect(&application, finishCheck);
8907 application.SendNotification();
8908 application.Render(0);
8909 application.SendNotification();
8910 finishCheck.CheckSignalNotReceived();
8911 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8912 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8913 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8914 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8916 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8917 application.SendNotification();
8918 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
8919 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
8920 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
8921 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
8923 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8924 application.SendNotification();
8925 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8926 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8927 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8928 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8930 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8931 application.SendNotification();
8932 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
8933 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
8934 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
8935 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
8937 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8938 application.SendNotification();
8939 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8940 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8941 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8942 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8944 // We did expect the animation to finish
8946 finishCheck.CheckSignalReceived();
8950 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
8952 TestApplication application;
8954 float startValue(1.0f);
8955 Actor actor = Actor::New();
8956 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8957 Stage::GetCurrent().Add(actor);
8959 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8960 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8961 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8962 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8963 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8965 // Build the animation
8966 float durationSeconds(1.0f);
8967 Animation animation = Animation::New(durationSeconds);
8969 KeyFrames keyFrames = KeyFrames::New();
8970 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8971 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8972 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8974 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::Cubic );
8976 // Start the animation
8979 bool signalReceived(false);
8980 AnimationFinishCheck finishCheck(signalReceived);
8981 animation.FinishedSignal().Connect(&application, finishCheck);
8982 application.SendNotification();
8983 application.Render(0);
8984 application.SendNotification();
8985 finishCheck.CheckSignalNotReceived();
8986 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8987 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8988 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8989 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8991 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8992 application.SendNotification();
8993 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION );
8994 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
8995 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION );
8996 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
8998 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8999 application.SendNotification();
9000 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
9001 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
9002 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
9003 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
9005 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9006 application.SendNotification();
9007 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION );
9008 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
9009 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION );
9010 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
9012 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9013 application.SendNotification();
9014 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
9015 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
9016 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
9017 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
9019 // We did expect the animation to finish
9021 finishCheck.CheckSignalReceived();
9025 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void)
9027 TestApplication application;
9029 float startValue(1.0f);
9030 Actor actor = Actor::New();
9031 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9032 Stage::GetCurrent().Add(actor);
9034 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9035 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9036 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9037 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9038 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9040 // Build the animation
9041 float durationSeconds(1.0f);
9043 Animation animation = Animation::New(durationSeconds);
9045 KeyFrames keyFrames = KeyFrames::New();
9046 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9047 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9048 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9050 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ) );
9052 // Start the animation
9055 bool signalReceived(false);
9056 AnimationFinishCheck finishCheck(signalReceived);
9057 animation.FinishedSignal().Connect(&application, finishCheck);
9058 application.SendNotification();
9060 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9061 application.SendNotification();
9062 finishCheck.CheckSignalNotReceived();
9063 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
9064 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
9065 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
9066 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
9068 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9069 application.SendNotification();
9070 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
9071 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
9072 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
9073 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
9075 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9076 application.SendNotification();
9077 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
9078 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
9079 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
9080 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
9082 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9083 application.SendNotification();
9084 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
9085 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
9086 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
9087 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
9089 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9090 application.SendNotification();
9091 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
9092 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
9093 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
9094 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
9096 // We did expect the animation to finish
9098 finishCheck.CheckSignalReceived();
9102 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
9104 TestApplication application;
9106 float startValue(1.0f);
9107 Actor actor = Actor::New();
9108 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9109 Stage::GetCurrent().Add(actor);
9111 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9112 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9113 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9114 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9115 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9117 // Build the animation
9118 float durationSeconds(1.0f);
9120 Animation animation = Animation::New(durationSeconds);
9122 KeyFrames keyFrames = KeyFrames::New();
9123 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9124 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9125 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9127 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
9129 // Start the animation
9132 bool signalReceived(false);
9133 AnimationFinishCheck finishCheck(signalReceived);
9134 animation.FinishedSignal().Connect(&application, finishCheck);
9135 application.SendNotification();
9137 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9138 application.SendNotification();
9139 finishCheck.CheckSignalNotReceived();
9140 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
9141 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
9142 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
9143 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
9145 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9146 application.SendNotification();
9147 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION );
9148 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
9149 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION );
9150 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
9152 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9153 application.SendNotification();
9154 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
9155 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
9156 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
9157 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
9159 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9160 application.SendNotification();
9161 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION );
9162 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
9163 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION );
9164 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
9166 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9167 application.SendNotification();
9168 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
9169 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
9170 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
9171 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
9173 // We did expect the animation to finish
9175 finishCheck.CheckSignalReceived();
9179 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
9181 TestApplication application;
9183 float startValue(1.0f);
9185 Actor actor = Actor::New();
9186 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9187 Stage::GetCurrent().Add(actor);
9189 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9190 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9191 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9192 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9193 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9195 // Build the animation
9196 float durationSeconds(1.0f);
9197 Animation animation = Animation::New(durationSeconds);
9199 KeyFrames keyFrames = KeyFrames::New();
9200 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9201 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9202 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9204 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
9206 // Start the animation
9209 bool signalReceived(false);
9210 AnimationFinishCheck finishCheck(signalReceived);
9211 animation.FinishedSignal().Connect(&application, finishCheck);
9212 application.SendNotification();
9214 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9215 application.SendNotification();
9216 finishCheck.CheckSignalNotReceived();
9217 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
9218 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
9219 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
9220 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
9222 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9223 application.SendNotification();
9224 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
9225 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
9226 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
9227 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
9229 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9230 application.SendNotification();
9231 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
9232 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
9233 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
9234 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
9236 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9237 application.SendNotification();
9238 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
9239 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
9240 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
9241 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
9243 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9244 application.SendNotification();
9245 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
9246 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
9247 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
9248 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
9250 // We did expect the animation to finish
9252 finishCheck.CheckSignalReceived();
9256 int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void)
9258 TestApplication application;
9260 float startValue(1.0f);
9261 Actor actor = Actor::New();
9262 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9263 Stage::GetCurrent().Add(actor);
9265 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9266 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9267 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9268 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9269 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9271 // Build the animation
9272 float durationSeconds(1.0f);
9274 Animation animation = Animation::New(durationSeconds);
9276 KeyFrames keyFrames = KeyFrames::New();
9277 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9278 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9279 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9281 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
9283 // Start the animation
9286 bool signalReceived(false);
9287 AnimationFinishCheck finishCheck(signalReceived);
9288 animation.FinishedSignal().Connect(&application, finishCheck);
9289 application.SendNotification();
9291 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9292 application.SendNotification();
9293 finishCheck.CheckSignalNotReceived();
9294 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
9295 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
9296 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
9297 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
9299 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9300 application.SendNotification();
9301 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION );
9302 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
9303 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION );
9304 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
9306 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9307 application.SendNotification();
9308 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
9309 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
9310 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
9311 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
9313 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9314 application.SendNotification();
9315 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION );
9316 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
9317 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION );
9318 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
9320 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9321 application.SendNotification();
9322 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
9323 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
9324 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
9325 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
9327 // We did expect the animation to finish
9329 finishCheck.CheckSignalReceived();
9333 int UtcDaliAnimationAnimateP(void)
9335 TestApplication application;
9337 Actor actor = Actor::New();
9338 Stage::GetCurrent().Add(actor);
9341 Vector3 position0( 30.0, 80.0, 0.0);
9342 Vector3 position1( 70.0, 120.0, 0.0);
9343 Vector3 position2( 100.0, 100.0, 0.0);
9345 Dali::Path path = Dali::Path::New();
9346 path.AddPoint(position0);
9347 path.AddPoint(position1);
9348 path.AddPoint(position2);
9350 //Control points for first segment
9351 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9352 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9354 //Control points for second segment
9355 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9356 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9358 // Build the animation
9359 float durationSeconds( 1.0f );
9360 Animation animation = Animation::New(durationSeconds);
9361 animation.Animate(actor, path, Vector3::XAXIS);
9363 // Start the animation
9366 bool signalReceived(false);
9367 AnimationFinishCheck finishCheck(signalReceived);
9368 animation.FinishedSignal().Connect(&application, finishCheck);
9369 application.SendNotification();
9370 application.Render(0);
9371 application.SendNotification();
9372 finishCheck.CheckSignalNotReceived();
9373 Vector3 position, tangent;
9374 Quaternion rotation;
9375 path.Sample( 0.0f, position, tangent );
9376 rotation = Quaternion( Vector3::XAXIS, tangent );
9377 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9378 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9380 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9381 application.SendNotification();
9382 path.Sample( 0.25f, position, tangent );
9383 rotation = Quaternion( Vector3::XAXIS, tangent );
9384 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9385 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9387 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9388 application.SendNotification();
9389 path.Sample( 0.5f, position, tangent );
9390 rotation = Quaternion( Vector3::XAXIS, tangent );
9391 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9392 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9394 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9395 application.SendNotification();
9396 path.Sample( 0.75f, position, tangent );
9397 rotation = Quaternion( Vector3::XAXIS, tangent );
9398 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9399 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9401 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9402 application.SendNotification();
9403 path.Sample( 1.0f, position, tangent );
9404 rotation = Quaternion( Vector3::XAXIS, tangent );
9405 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9406 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9408 finishCheck.CheckSignalReceived();
9412 int UtcDaliAnimationAnimateAlphaFunctionP(void)
9414 TestApplication application;
9416 Actor actor = Actor::New();
9417 Stage::GetCurrent().Add(actor);
9420 Vector3 position0( 30.0, 80.0, 0.0);
9421 Vector3 position1( 70.0, 120.0, 0.0);
9422 Vector3 position2( 100.0, 100.0, 0.0);
9424 Dali::Path path = Dali::Path::New();
9425 path.AddPoint(position0);
9426 path.AddPoint(position1);
9427 path.AddPoint(position2);
9429 //Control points for first segment
9430 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9431 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9433 //Control points for second segment
9434 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9435 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9437 // Build the animation
9438 float durationSeconds( 1.0f );
9439 Animation animation = Animation::New(durationSeconds);
9440 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
9442 // Start the animation
9445 bool signalReceived(false);
9446 AnimationFinishCheck finishCheck(signalReceived);
9447 animation.FinishedSignal().Connect(&application, finishCheck);
9448 application.SendNotification();
9449 application.Render(0);
9450 application.SendNotification();
9451 finishCheck.CheckSignalNotReceived();
9452 Vector3 position, tangent;
9453 Quaternion rotation;
9454 path.Sample( 0.0f, position, tangent );
9455 rotation = Quaternion( Vector3::XAXIS, tangent );
9456 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9457 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9459 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9460 application.SendNotification();
9461 path.Sample( 0.25f, position, tangent );
9462 rotation = Quaternion( Vector3::XAXIS, tangent );
9463 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9464 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9466 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9467 application.SendNotification();
9468 path.Sample( 0.5f, position, tangent );
9469 rotation = Quaternion( Vector3::XAXIS, tangent );
9470 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9471 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9473 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9474 application.SendNotification();
9475 path.Sample( 0.75f, position, tangent );
9476 rotation = Quaternion( Vector3::XAXIS, tangent );
9477 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9478 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9480 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9481 application.SendNotification();
9482 path.Sample( 1.0f, position, tangent );
9483 rotation = Quaternion( Vector3::XAXIS, tangent );
9484 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9485 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9487 finishCheck.CheckSignalReceived();
9491 int UtcDaliAnimationAnimateTimePeriodP(void)
9493 TestApplication application;
9495 Actor actor = Actor::New();
9496 Stage::GetCurrent().Add(actor);
9499 Vector3 position0( 30.0, 80.0, 0.0);
9500 Vector3 position1( 70.0, 120.0, 0.0);
9501 Vector3 position2( 100.0, 100.0, 0.0);
9503 Dali::Path path = Dali::Path::New();
9504 path.AddPoint(position0);
9505 path.AddPoint(position1);
9506 path.AddPoint(position2);
9508 //Control points for first segment
9509 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9510 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9512 //Control points for second segment
9513 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9514 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9516 // Build the animation
9517 float durationSeconds( 1.0f );
9518 Animation animation = Animation::New(durationSeconds);
9519 animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
9521 // Start the animation
9524 bool signalReceived(false);
9525 AnimationFinishCheck finishCheck(signalReceived);
9526 animation.FinishedSignal().Connect(&application, finishCheck);
9527 application.SendNotification();
9528 application.Render(0);
9529 application.SendNotification();
9530 finishCheck.CheckSignalNotReceived();
9531 Vector3 position, tangent;
9532 Quaternion rotation;
9533 path.Sample( 0.0f, position, tangent );
9534 rotation = Quaternion( Vector3::XAXIS, tangent );
9535 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9536 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9538 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9539 application.SendNotification();
9540 path.Sample( 0.25f, position, tangent );
9541 rotation = Quaternion( Vector3::XAXIS, tangent );
9542 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9543 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9545 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9546 application.SendNotification();
9547 path.Sample( 0.5f, position, tangent );
9548 rotation = Quaternion( Vector3::XAXIS, tangent );
9549 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9550 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9552 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9553 application.SendNotification();
9554 path.Sample( 0.75f, position, tangent );
9555 rotation = Quaternion( Vector3::XAXIS, tangent );
9556 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9557 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9559 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9560 application.SendNotification();
9561 path.Sample( 1.0f, position, tangent );
9562 rotation = Quaternion( Vector3::XAXIS, tangent );
9563 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9564 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9566 finishCheck.CheckSignalReceived();
9570 int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
9572 TestApplication application;
9574 Actor actor = Actor::New();
9575 Stage::GetCurrent().Add(actor);
9578 Vector3 position0( 30.0, 80.0, 0.0);
9579 Vector3 position1( 70.0, 120.0, 0.0);
9580 Vector3 position2( 100.0, 100.0, 0.0);
9582 Dali::Path path = Dali::Path::New();
9583 path.AddPoint(position0);
9584 path.AddPoint(position1);
9585 path.AddPoint(position2);
9587 //Control points for first segment
9588 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9589 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9591 //Control points for second segment
9592 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9593 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9595 // Build the animation
9596 float durationSeconds( 1.0f );
9597 Animation animation = Animation::New(durationSeconds);
9598 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
9600 // Start the animation
9603 bool signalReceived(false);
9604 AnimationFinishCheck finishCheck(signalReceived);
9605 animation.FinishedSignal().Connect(&application, finishCheck);
9606 application.SendNotification();
9607 application.Render(0);
9608 application.SendNotification();
9609 finishCheck.CheckSignalNotReceived();
9610 Vector3 position, tangent;
9611 Quaternion rotation;
9612 path.Sample( 0.0f, position, tangent );
9613 rotation = Quaternion( Vector3::XAXIS, tangent );
9614 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9615 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9617 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9618 application.SendNotification();
9619 path.Sample( 0.25f, position, tangent );
9620 rotation = Quaternion( Vector3::XAXIS, tangent );
9621 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9622 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9624 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9625 application.SendNotification();
9626 path.Sample( 0.5f, position, tangent );
9627 rotation = Quaternion( Vector3::XAXIS, tangent );
9628 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9629 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9631 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9632 application.SendNotification();
9633 path.Sample( 0.75f, position, tangent );
9634 rotation = Quaternion( Vector3::XAXIS, tangent );
9635 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9636 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9638 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9639 application.SendNotification();
9640 path.Sample( 1.0f, position, tangent );
9641 rotation = Quaternion( Vector3::XAXIS, tangent );
9642 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9643 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9645 finishCheck.CheckSignalReceived();
9649 int UtcDaliAnimationShowP(void)
9651 TestApplication application;
9653 Actor actor = Actor::New();
9654 actor.SetVisible(false);
9655 application.SendNotification();
9656 application.Render(0);
9657 DALI_TEST_CHECK( !actor.IsVisible() );
9658 Stage::GetCurrent().Add(actor);
9660 // Start the animation
9661 float durationSeconds(10.0f);
9662 Animation animation = Animation::New(durationSeconds);
9663 animation.Show(actor, durationSeconds*0.5f);
9666 bool signalReceived(false);
9667 AnimationFinishCheck finishCheck(signalReceived);
9668 animation.FinishedSignal().Connect(&application, finishCheck);
9670 application.SendNotification();
9671 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
9673 // We didn't expect the animation to finish yet
9674 application.SendNotification();
9675 finishCheck.CheckSignalNotReceived();
9676 DALI_TEST_CHECK( !actor.IsVisible() );
9678 application.SendNotification();
9679 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be shown now*/);
9681 // We didn't expect the animation to finish yet
9682 application.SendNotification();
9683 finishCheck.CheckSignalNotReceived();
9684 DALI_TEST_CHECK( actor.IsVisible() );
9686 application.SendNotification();
9687 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
9689 // We did expect the animation to finish
9690 application.SendNotification();
9691 finishCheck.CheckSignalReceived();
9692 DALI_TEST_CHECK( actor.IsVisible() );
9696 int UtcDaliAnimationHideP(void)
9698 TestApplication application;
9700 Actor actor = Actor::New();
9701 DALI_TEST_CHECK( actor.IsVisible() );
9702 Stage::GetCurrent().Add(actor);
9704 // Start the animation
9705 float durationSeconds(10.0f);
9706 Animation animation = Animation::New(durationSeconds);
9707 animation.Hide(actor, durationSeconds*0.5f);
9710 bool signalReceived(false);
9711 AnimationFinishCheck finishCheck(signalReceived);
9712 animation.FinishedSignal().Connect(&application, finishCheck);
9714 application.SendNotification();
9715 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
9717 // We didn't expect the animation to finish yet
9718 application.SendNotification();
9719 finishCheck.CheckSignalNotReceived();
9720 DALI_TEST_CHECK( actor.IsVisible() );
9722 application.SendNotification();
9723 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be hidden now*/);
9725 // We didn't expect the animation to finish yet
9726 application.SendNotification();
9727 finishCheck.CheckSignalNotReceived();
9728 DALI_TEST_CHECK( !actor.IsVisible() );
9730 application.SendNotification();
9731 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
9733 // We did expect the animation to finish
9734 application.SendNotification();
9735 finishCheck.CheckSignalReceived();
9736 DALI_TEST_CHECK( !actor.IsVisible() );
9740 int UtcDaliAnimationShowHideAtEndP(void)
9742 // Test that show/hide delay can be the same as animation duration
9743 // i.e. to show/hide at the end of the animation
9745 TestApplication application;
9747 Actor actor = Actor::New();
9748 DALI_TEST_CHECK( actor.IsVisible() );
9749 Stage::GetCurrent().Add(actor);
9751 // Start Hide animation
9752 float durationSeconds(10.0f);
9753 Animation animation = Animation::New(durationSeconds);
9754 animation.Hide(actor, durationSeconds/*Hide at end*/);
9757 bool signalReceived(false);
9758 AnimationFinishCheck finishCheck(signalReceived);
9759 animation.FinishedSignal().Connect(&application, finishCheck);
9761 application.SendNotification();
9762 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
9764 // We did expect the animation to finish
9765 application.SendNotification();
9766 finishCheck.CheckSignalReceived();
9767 DALI_TEST_CHECK( !actor.IsVisible() );
9769 // Start Show animation
9770 animation = Animation::New(durationSeconds);
9771 animation.Show(actor, durationSeconds/*Show at end*/);
9772 animation.FinishedSignal().Connect(&application, finishCheck);
9775 application.SendNotification();
9776 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
9778 // We did expect the animation to finish
9779 application.SendNotification();
9780 finishCheck.CheckSignalReceived();
9781 DALI_TEST_CHECK( actor.IsVisible() );
9785 int UtcDaliKeyFramesCreateDestroyP(void)
9787 tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
9789 KeyFrames* keyFrames = new KeyFrames;
9791 DALI_TEST_CHECK( true );
9795 int UtcDaliKeyFramesDownCastP(void)
9797 TestApplication application;
9798 tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
9800 KeyFrames keyFrames = KeyFrames::New();
9801 BaseHandle object(keyFrames);
9803 KeyFrames keyFrames2 = KeyFrames::DownCast(object);
9804 DALI_TEST_CHECK(keyFrames2);
9806 KeyFrames keyFrames3 = DownCast< KeyFrames >(object);
9807 DALI_TEST_CHECK(keyFrames3);
9809 BaseHandle unInitializedObject;
9810 KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
9811 DALI_TEST_CHECK(!keyFrames4);
9813 KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject);
9814 DALI_TEST_CHECK(!keyFrames5);
9818 int UtcDaliAnimationCreateDestroyP(void)
9820 TestApplication application;
9821 Animation* animation = new Animation;
9822 DALI_TEST_CHECK( animation );
9827 struct UpdateManagerTestConstraint
9829 UpdateManagerTestConstraint(TestApplication& application)
9830 : mApplication(application)
9834 void operator()( Vector3& current, const PropertyInputContainer& /* inputs */)
9836 mApplication.SendNotification(); // Process events
9839 TestApplication& mApplication;
9842 int UtcDaliAnimationUpdateManagerP(void)
9844 TestApplication application;
9846 Actor actor = Actor::New();
9847 Stage::GetCurrent().Add( actor );
9849 // Build the animation
9850 Animation animation = Animation::New( 0.0f );
9852 bool signalReceived = false;
9853 AnimationFinishCheck finishCheck( signalReceived );
9854 animation.FinishedSignal().Connect( &application, finishCheck );
9856 Vector3 startValue(1.0f, 1.0f, 1.0f);
9857 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
9858 Constraint constraint = Constraint::New<Vector3>( actor, index, UpdateManagerTestConstraint( application ) );
9861 // Apply animation to actor
9862 animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunction::LINEAR );
9866 application.SendNotification();
9867 application.UpdateOnly( 16 );
9869 finishCheck.CheckSignalNotReceived();
9871 application.SendNotification(); // Process events
9873 finishCheck.CheckSignalReceived();
9878 int UtcDaliAnimationSignalOrderP(void)
9880 TestApplication application;
9882 Actor actor = Actor::New();
9883 Stage::GetCurrent().Add( actor );
9885 // Build the animations
9886 Animation animation1 = Animation::New( 0.0f ); // finishes first frame
9887 Animation animation2 = Animation::New( 0.02f ); // finishes in 20 ms
9889 bool signal1Received = false;
9890 animation1.FinishedSignal().Connect( &application, AnimationFinishCheck( signal1Received ) );
9892 bool signal2Received = false;
9893 animation2.FinishedSignal().Connect( &application, AnimationFinishCheck( signal2Received ) );
9895 // Apply animations to actor
9896 animation1.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 3.0f, 2.0f, 1.0f ), AlphaFunction::LINEAR );
9898 animation2.AnimateTo( Property(actor, Actor::Property::SIZE ), Vector3( 10.0f, 20.0f, 30.0f ), AlphaFunction::LINEAR );
9901 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
9902 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
9904 application.SendNotification();
9905 application.UpdateOnly( 10 ); // 10ms progress
9907 // no notifications yet
9908 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
9909 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
9911 application.SendNotification();
9914 DALI_TEST_EQUALS( signal1Received, true, TEST_LOCATION );
9915 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
9916 signal1Received = false;
9918 // 1st animation is complete now, do another update with no ProcessEvents in between
9919 application.UpdateOnly( 20 ); // 20ms progress
9922 application.SendNotification();
9924 // 2nd should complete now
9925 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
9926 DALI_TEST_EQUALS( signal2Received, true, TEST_LOCATION );
9931 int UtcDaliAnimationExtendDurationP(void)
9933 TestApplication application;
9935 Actor actor = Actor::New();
9937 // Register a float property
9938 float startValue(10.0f);
9939 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
9940 Stage::GetCurrent().Add(actor);
9941 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
9943 // Build the animation
9944 float initialDurationSeconds(1.0f);
9945 float animatorDelay = 5.0f;
9946 float animatorDurationSeconds(5.0f);
9947 float extendedDurationSeconds(animatorDelay+animatorDurationSeconds);
9948 Animation animation = Animation::New(initialDurationSeconds);
9949 float targetValue(30.0f);
9950 float relativeValue(targetValue - startValue);
9952 animation.AnimateTo(Property(actor, index),
9954 TimePeriod(animatorDelay, animatorDurationSeconds));
9956 // The duration should have been extended
9957 DALI_TEST_EQUALS( animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION );
9959 // Start the animation
9962 bool signalReceived(false);
9963 AnimationFinishCheck finishCheck(signalReceived);
9964 animation.FinishedSignal().Connect(&application, finishCheck);
9966 application.SendNotification();
9967 application.Render(static_cast<unsigned int>(extendedDurationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
9969 // We didn't expect the animation to finish yet
9970 application.SendNotification();
9971 finishCheck.CheckSignalNotReceived();
9972 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
9974 application.SendNotification();
9975 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
9977 // We didn't expect the animation to finish yet
9978 application.SendNotification();
9979 finishCheck.CheckSignalNotReceived();
9980 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
9982 application.SendNotification();
9983 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
9985 // We did expect the animation to finish
9986 application.SendNotification();
9987 finishCheck.CheckSignalReceived();
9988 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
9992 int UtcDaliAnimationCustomIntProperty(void)
9994 TestApplication application;
9996 Actor actor = Actor::New();
9997 Stage::GetCurrent().Add(actor);
10000 Property::Index index = actor.RegisterProperty("anIndex", startValue);
10001 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10003 // Build the animation
10004 float durationSeconds(1.0f);
10005 Animation animation = Animation::New(durationSeconds);
10006 animation.AnimateTo( Property(actor, index), 20 );
10008 // Start the animation
10011 bool signalReceived(false);
10012 AnimationFinishCheck finishCheck(signalReceived);
10013 animation.FinishedSignal().Connect(&application, finishCheck);
10015 application.SendNotification();
10016 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
10018 // We didn't expect the animation to finish yet
10019 application.SendNotification();
10020 finishCheck.CheckSignalNotReceived();
10021 DALI_TEST_EQUALS( actor.GetProperty<int>(index), 10, TEST_LOCATION );
10023 application.SendNotification();
10024 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10026 // We did expect the animation to finish
10027 application.SendNotification();
10028 finishCheck.CheckSignalReceived();
10029 DALI_TEST_EQUALS( actor.GetProperty<int>(index), 20, TEST_LOCATION );