2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
22 #include <dali/public-api/dali-core.h>
23 #include <dali-test-suite-utils.h>
28 void utc_dali_animation_startuP(void)
30 test_return_value = TET_UNDEF;
33 void utc_dali_animation_cleanuP(void)
35 test_return_value = TET_PASS;
41 static const float ROTATION_EPSILON = 0.0001f;
42 static const float VECTOR4_EPSILON = 0.0001f;
44 // Functor to test whether a Finish signal is emitted
45 struct AnimationFinishCheck
47 AnimationFinishCheck(bool& signalReceived)
48 : mSignalReceived(signalReceived)
52 void operator()(Animation& animation)
54 mSignalReceived = true;
59 mSignalReceived = false;
62 void CheckSignalReceived()
66 tet_printf("Expected Finish signal was not received\n");
75 void CheckSignalNotReceived()
79 tet_printf("Unexpected Finish signal was received\n");
88 bool& mSignalReceived; // owned by individual tests
93 int UtcDaliAnimationConstructorP(void)
95 TestApplication application;
99 DALI_TEST_CHECK( !animation );
103 int UtcDaliAnimationNewP(void)
105 TestApplication application;
107 Animation animation = Animation::New( 1.0f );
109 DALI_TEST_CHECK(animation);
113 int UtcDaliAnimationNewN(void)
115 TestApplication application;
117 Animation animation = Animation::New( -1.0f );
119 DALI_TEST_CHECK(animation);
120 DALI_TEST_EQUALS(animation.GetDuration(), 0.0f, TEST_LOCATION);
124 int UtcDaliAnimationDownCastP(void)
126 TestApplication application;
128 tet_infoline("Testing Dali::Animation::DownCast()");
130 float durationSeconds(1.0f);
131 Animation animation = Animation::New(durationSeconds);
133 BaseHandle object(animation);
135 Animation animation2 = Animation::DownCast(object);
136 DALI_TEST_CHECK(animation2);
138 Animation animation3 = DownCast< Animation >(object);
139 DALI_TEST_CHECK(animation3);
143 int UtcDaliAnimationDownCastN(void)
145 TestApplication application;
147 BaseHandle unInitializedObject;
149 Animation animation1 = Animation::DownCast( unInitializedObject );
150 DALI_TEST_CHECK( !animation1 );
152 Animation animation2 = DownCast< Animation >( unInitializedObject );
153 DALI_TEST_CHECK( !animation2 );
157 int UtcDaliAnimationCopyConstructorP(void)
159 TestApplication application;
161 // Initialize an object, ref count == 1
162 Animation animation = Animation::New( 1.0f );
164 Animation copy( animation );
165 DALI_TEST_CHECK( copy );
167 DALI_TEST_CHECK( copy.GetDuration() == animation.GetDuration() );
171 int UtcDaliAnimationAssignmentOperatorP(void)
173 TestApplication application;
175 Animation animation = Animation::New( 1.0f );
177 Animation copy = animation;
178 DALI_TEST_CHECK( copy );
180 DALI_TEST_CHECK( animation == copy );
182 DALI_TEST_CHECK( copy.GetDuration() == animation.GetDuration() );
186 int UtcDaliAnimationSetDurationP(void)
188 TestApplication application;
190 Actor actor = Actor::New();
191 Stage::GetCurrent().Add(actor);
193 // Build the animation
194 float durationSeconds(1.0f);
195 Animation animation = Animation::New(durationSeconds);
196 DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
198 // Start the animation
199 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
200 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
203 bool signalReceived(false);
204 AnimationFinishCheck finishCheck(signalReceived);
205 animation.FinishedSignal().Connect(&application, finishCheck);
207 application.SendNotification();
208 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
210 // We didn't expect the animation to finish yet
211 application.SendNotification();
212 finishCheck.CheckSignalNotReceived();
214 application.Render(2u/*just beyond the animation duration*/);
216 // We did expect the animation to finish
217 application.SendNotification();
218 finishCheck.CheckSignalReceived();
219 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
221 // Restart the animation, with a different duration
223 actor.SetPosition(Vector3::ZERO);
224 durationSeconds = 3.5f;
225 animation.SetDuration(durationSeconds);
226 DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
229 application.SendNotification();
230 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
232 // We didn't expect the animation to finish yet
233 application.SendNotification();
234 finishCheck.CheckSignalNotReceived();
236 application.Render(2u/*just beyond the animation duration*/);
238 // We did expect the animation to finish
239 application.SendNotification();
240 finishCheck.CheckSignalReceived();
241 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
243 // Check that nothing has changed after a couple of buffer swaps
244 application.Render(0);
245 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
246 application.Render(0);
247 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
251 int UtcDaliAnimationSetDurationN(void)
253 TestApplication application;
255 Animation animation = Animation::New( 1.0f );
256 DALI_TEST_EQUALS( animation.GetDuration(), 1.0f, TEST_LOCATION );
258 animation.SetDuration( -1.0f );
259 DALI_TEST_EQUALS( animation.GetDuration(), 0.0f, TEST_LOCATION );
263 int UtcDaliAnimationGetDurationP(void)
265 TestApplication application;
267 Animation animation = Animation::New(1.0f);
268 DALI_TEST_EQUALS(animation.GetDuration(), 1.0f, TEST_LOCATION);
270 animation.SetDuration(2.0f);
271 DALI_TEST_EQUALS(animation.GetDuration(), 2.0f, TEST_LOCATION);
275 int UtcDaliAnimationSetLoopingP(void)
277 TestApplication application;
279 Actor actor = Actor::New();
280 Stage::GetCurrent().Add(actor);
282 // Build the animation
283 float durationSeconds(1.0f);
284 Animation animation = Animation::New(durationSeconds);
285 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
286 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
288 // Start the animation
289 animation.SetLooping(true);
290 DALI_TEST_CHECK(animation.IsLooping());
293 bool signalReceived(false);
294 AnimationFinishCheck finishCheck(signalReceived);
295 animation.FinishedSignal().Connect(&application, finishCheck);
297 application.SendNotification();
300 float intervalSeconds = 0.25f;
301 float progress = 0.0f;
302 for (int iterations = 0; iterations < 5;)
304 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
306 progress += intervalSeconds;
307 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
309 if (progress >= 1.0f)
311 progress = progress - 1.0f;
316 // We didn't expect the animation to finish yet
317 application.SendNotification();
318 finishCheck.CheckSignalNotReceived();
320 animation.SetLooping(false);
321 DALI_TEST_CHECK(!animation.IsLooping());
323 application.SendNotification();
324 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
326 // We did expect the animation to finish
327 application.SendNotification();
328 finishCheck.CheckSignalReceived();
329 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
331 // Check that nothing has changed after a couple of buffer swaps
332 application.Render(0);
333 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
334 application.Render(0);
335 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
339 int UtcDaliAnimationSetLoopCountP(void)
341 TestApplication application;
343 Actor actor = Actor::New();
344 Stage::GetCurrent().Add(actor);
346 // Build the animation
347 float durationSeconds(1.0f);
348 Animation animation = Animation::New(durationSeconds);
349 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
350 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
352 // Start the animation
353 animation.SetLoopCount(3);
354 DALI_TEST_CHECK(animation.IsLooping());
357 bool signalReceived(false);
358 AnimationFinishCheck finishCheck(signalReceived);
359 animation.FinishedSignal().Connect(&application, finishCheck);
361 application.Render(0);
362 application.SendNotification();
363 application.Render(0);
364 application.SendNotification();
365 application.Render(0);
366 application.SendNotification();
367 application.Render(0);
368 application.SendNotification();
371 float intervalSeconds = 3.0f;
373 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
374 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
376 application.Render(0);
377 application.SendNotification();
378 application.Render(0);
379 application.SendNotification();
380 application.Render(0);
381 application.SendNotification();
382 application.Render(0);
383 application.SendNotification();
384 finishCheck.CheckSignalNotReceived();
386 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
388 application.SendNotification();
389 finishCheck.CheckSignalReceived();
390 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
394 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
395 application.SendNotification();
396 finishCheck.CheckSignalNotReceived();
398 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
399 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
400 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
401 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
402 application.SendNotification();
403 finishCheck.CheckSignalNotReceived();
408 int UtcDaliAnimationSetLoopCountP2(void)
410 TestApplication application;
413 // switching between forever and loop count
416 Actor actor = Actor::New();
417 Stage::GetCurrent().Add(actor);
419 // Build the animation
420 float durationSeconds(1.0f);
421 Animation animation = Animation::New(durationSeconds);
422 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
423 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
424 animation.SetEndAction(Animation::Discard);
426 // Start the animation
427 animation.SetLoopCount(3);
428 DALI_TEST_CHECK(animation.IsLooping());
431 bool signalReceived(false);
432 AnimationFinishCheck finishCheck(signalReceived);
433 animation.FinishedSignal().Connect(&application, finishCheck);
435 float intervalSeconds = 3.0f;
437 application.SendNotification();
438 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
439 application.SendNotification();
440 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
441 application.SendNotification();
442 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
443 application.SendNotification();
445 application.SendNotification();
446 finishCheck.CheckSignalReceived();
451 animation.SetLooping(true);
452 DALI_TEST_CHECK(animation.IsLooping());
454 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
455 application.SendNotification();
456 finishCheck.CheckSignalNotReceived();
458 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
459 application.SendNotification();
460 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
461 application.SendNotification();
462 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
463 application.SendNotification();
464 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
465 application.SendNotification();
466 application.SendNotification();
467 finishCheck.CheckSignalNotReceived();
472 animation.SetLoopCount(3);
473 DALI_TEST_CHECK(animation.IsLooping());
476 application.SendNotification();
477 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
478 application.SendNotification();
479 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
480 application.SendNotification();
481 finishCheck.CheckSignalNotReceived();
483 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
484 application.SendNotification();
485 finishCheck.CheckSignalReceived();
490 animation.SetLooping(true);
491 DALI_TEST_CHECK(animation.IsLooping());
493 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
494 application.SendNotification();
495 finishCheck.CheckSignalNotReceived();
497 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
498 application.SendNotification();
499 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
500 application.SendNotification();
501 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
502 application.SendNotification();
503 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
504 application.SendNotification();
505 finishCheck.CheckSignalNotReceived();
510 animation.SetLoopCount(3);
511 DALI_TEST_CHECK(animation.IsLooping());
513 application.SendNotification();
514 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
515 application.SendNotification();
516 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
517 application.SendNotification();
518 finishCheck.CheckSignalNotReceived();
520 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
521 application.SendNotification();
522 finishCheck.CheckSignalNotReceived(); // we never hit play
530 int UtcDaliAnimationSetLoopCountP3(void)
532 TestApplication application;
535 // switching between forever and loop count
537 Actor actor = Actor::New();
538 Stage::GetCurrent().Add(actor);
540 // Build the animation
541 float durationSeconds(1.0f);
542 Animation animation = Animation::New(durationSeconds);
543 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
544 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
545 animation.SetEndAction(Animation::Discard);
547 float intervalSeconds = 3.0f;
549 bool signalReceived(false);
550 AnimationFinishCheck finishCheck(signalReceived);
551 animation.FinishedSignal().Connect(&application, finishCheck);
554 animation.SetLooping(true);
555 DALI_TEST_CHECK(animation.IsLooping());
557 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
558 application.SendNotification();
559 finishCheck.CheckSignalNotReceived();
561 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
562 application.SendNotification();
563 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
564 application.SendNotification();
565 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
566 application.SendNotification();
567 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
568 application.SendNotification();
569 finishCheck.CheckSignalNotReceived();
574 animation.SetLoopCount(3);
575 DALI_TEST_CHECK(animation.IsLooping());
577 application.SendNotification();
578 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
579 application.SendNotification();
580 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
581 application.SendNotification();
582 finishCheck.CheckSignalNotReceived();
584 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
585 application.SendNotification();
586 finishCheck.CheckSignalNotReceived(); // we never hit play
594 int UtcDaliAnimationSetLoopCountP4(void)
596 TestApplication application;
601 Actor actor = Actor::New();
602 Stage::GetCurrent().Add(actor);
604 // Build the animation
605 float durationSeconds(1.0f);
606 Animation animation = Animation::New(durationSeconds);
607 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
608 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
609 animation.SetEndAction(Animation::Bake);
611 float intervalSeconds = 3.0f;
613 bool signalReceived(false);
614 AnimationFinishCheck finishCheck(signalReceived);
615 animation.FinishedSignal().Connect(&application, finishCheck);
617 animation.SetLoopCount(1);
619 DALI_TEST_CHECK(!animation.IsLooping());
621 application.SendNotification();
622 finishCheck.CheckSignalNotReceived();
623 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
624 application.SendNotification();
625 finishCheck.CheckSignalReceived();
627 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
628 actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f) );
632 animation.Play(); // again
633 DALI_TEST_CHECK(!animation.IsLooping());
635 application.SendNotification();
636 finishCheck.CheckSignalNotReceived();
637 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
638 application.SendNotification();
639 finishCheck.CheckSignalReceived();
641 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
646 int UtcDaliAnimationGetLoopCountP(void)
648 TestApplication application;
650 Actor actor = Actor::New();
651 Stage::GetCurrent().Add(actor);
653 // Build the animation
654 float durationSeconds(1.0f);
655 Animation animation = Animation::New(durationSeconds);
656 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
657 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
659 DALI_TEST_CHECK(1 == animation.GetLoopCount());
661 // Start the animation
662 animation.SetLoopCount(3);
663 DALI_TEST_CHECK(animation.IsLooping());
664 DALI_TEST_CHECK(3 == animation.GetLoopCount());
668 application.Render(0);
669 application.SendNotification();
672 float intervalSeconds = 3.0f;
674 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
675 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
677 application.Render(0);
678 application.SendNotification();
680 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
681 application.SendNotification();
683 animation.SetLoopCount(0);
684 DALI_TEST_CHECK(animation.IsLooping());
685 DALI_TEST_CHECK(0 == animation.GetLoopCount());
687 animation.SetLoopCount(1);
688 DALI_TEST_CHECK(!animation.IsLooping());
689 DALI_TEST_CHECK(1 == animation.GetLoopCount());
695 int UtcDaliAnimationGetCurrentLoopP(void)
697 TestApplication application;
699 Actor actor = Actor::New();
700 Stage::GetCurrent().Add(actor);
702 // Build the animation
703 float durationSeconds(1.0f);
704 Animation animation = Animation::New(durationSeconds);
705 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
706 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
708 // Start the animation
709 animation.SetLoopCount(3);
710 DALI_TEST_CHECK(animation.IsLooping());
711 DALI_TEST_CHECK(0 == animation.GetCurrentLoop());
714 bool signalReceived(false);
715 AnimationFinishCheck finishCheck(signalReceived);
716 animation.FinishedSignal().Connect(&application, finishCheck);
718 application.SendNotification();
721 float intervalSeconds = 3.0f;
723 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
724 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
726 application.SendNotification();
727 finishCheck.CheckSignalNotReceived();
728 DALI_TEST_CHECK(2 == animation.GetCurrentLoop());
730 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
732 application.SendNotification();
733 finishCheck.CheckSignalReceived();
734 DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
735 DALI_TEST_CHECK(animation.GetLoopCount() == animation.GetCurrentLoop());
739 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
740 application.SendNotification();
741 finishCheck.CheckSignalNotReceived();
742 DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
744 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
745 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
746 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
747 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
748 application.SendNotification();
749 finishCheck.CheckSignalNotReceived();
750 DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
755 int UtcDaliAnimationIsLoopingP(void)
757 TestApplication application;
759 Animation animation = Animation::New(1.0f);
760 DALI_TEST_CHECK(!animation.IsLooping());
762 animation.SetLooping(true);
763 DALI_TEST_CHECK(animation.IsLooping());
767 int UtcDaliAnimationSetEndActioN(void)
769 TestApplication application;
771 Actor actor = Actor::New();
772 Stage::GetCurrent().Add(actor);
774 // Build the animation
775 float durationSeconds(1.0f);
776 Animation animation = Animation::New(durationSeconds);
777 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
779 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
780 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
782 // Start the animation
785 bool signalReceived(false);
786 AnimationFinishCheck finishCheck(signalReceived);
787 animation.FinishedSignal().Connect(&application, finishCheck);
789 application.SendNotification();
790 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
792 // We did expect the animation to finish
793 application.SendNotification();
794 finishCheck.CheckSignalReceived();
795 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
797 // Go back to the start
798 actor.SetPosition(Vector3::ZERO);
799 application.SendNotification();
800 application.Render(0);
801 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
803 // Test BakeFinal, animate again, for half the duration
805 animation.SetEndAction(Animation::BakeFinal);
806 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
809 application.SendNotification();
810 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f*0.5f) /*half of the animation duration*/);
812 // Stop the animation early
815 // We did NOT expect the animation to finish
816 application.SendNotification();
817 finishCheck.CheckSignalNotReceived();
818 DALI_TEST_EQUALS( targetPosition * 0.5f, actor.GetCurrentPosition(), VECTOR4_EPSILON, TEST_LOCATION );
820 // The position should be same with target position in the next frame
821 application.Render(0);
822 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
824 // Go back to the start
825 actor.SetPosition(Vector3::ZERO);
826 application.SendNotification();
827 application.Render(0);
828 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
830 // Test EndAction::Discard, animate again, but don't bake this time
832 animation.SetEndAction(Animation::Discard);
833 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
836 application.SendNotification();
837 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
839 // We did expect the animation to finish
840 application.SendNotification();
841 finishCheck.CheckSignalReceived();
842 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
844 // The position should be discarded in the next frame
845 application.Render(0);
846 DALI_TEST_EQUALS( Vector3::ZERO/*discarded*/, actor.GetCurrentPosition(), TEST_LOCATION );
848 // Check that nothing has changed after a couple of buffer swaps
849 application.Render(0);
850 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
851 application.Render(0);
852 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
856 int UtcDaliAnimationGetEndActionP(void)
858 TestApplication application;
860 Animation animation = Animation::New(1.0f);
861 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
863 animation.SetEndAction(Animation::Discard);
864 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
866 animation.SetEndAction(Animation::BakeFinal);
867 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
872 int UtcDaliAnimationSetDisconnectActionP(void)
874 TestApplication application;
875 Stage stage( Stage::GetCurrent() );
877 // Default: BakeFinal
879 Actor actor = Actor::New();
882 // Build the animation
883 float durationSeconds(1.0f);
884 Animation animation = Animation::New(durationSeconds);
885 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal);
887 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
888 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
890 // Start the animation
893 application.SendNotification();
894 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
898 application.SendNotification();
899 application.Render();
901 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
906 Actor actor = Actor::New();
909 // Build the animation
910 float durationSeconds(1.0f);
911 Animation animation = Animation::New(durationSeconds);
912 animation.SetDisconnectAction( Animation::Bake );
914 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
915 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
917 // Start the animation
920 application.SendNotification();
921 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
925 application.SendNotification();
926 application.Render();
928 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition*0.5f, TEST_LOCATION );
933 Actor actor = Actor::New();
936 // Build the animation
937 float durationSeconds(1.0f);
938 Animation animation = Animation::New(durationSeconds);
939 animation.SetDisconnectAction( Animation::Discard );
941 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
942 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
944 // Start the animation
947 application.SendNotification();
948 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
952 application.SendNotification();
953 application.Render();
955 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
958 // Don't play the animation: disconnect action should not be applied
960 Actor actor = Actor::New();
963 // Build the animation
964 float durationSeconds(1.0f);
965 Animation animation = Animation::New(durationSeconds);
967 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
968 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
970 application.SendNotification();
971 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
975 application.SendNotification();
976 application.Render();
978 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
984 int UtcDaliAnimationGetDisconnectActionP(void)
986 TestApplication application;
987 Animation animation = Animation::New(1.0f);
988 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal); // default!
990 animation.SetDisconnectAction(Animation::Discard);
991 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Discard);
993 animation.SetDisconnectAction(Animation::Bake);
994 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Bake);
999 int UtcDaliAnimationSetDefaultAlphaFunctionP(void)
1001 TestApplication application;
1003 Animation animation = Animation::New(1.0f);
1004 AlphaFunction func = animation.GetDefaultAlphaFunction();
1005 DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1007 animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1008 AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1009 DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1013 int UtcDaliAnimationGetDefaultAlphaFunctionP(void)
1015 TestApplication application;
1017 Animation animation = Animation::New(1.0f);
1018 AlphaFunction func = animation.GetDefaultAlphaFunction();
1020 // Test that the default is linear
1021 DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1023 animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1024 AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1025 DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1030 int UtcDaliAnimationSetCurrentProgressP(void)
1032 TestApplication application;
1034 Actor actor = Actor::New();
1035 Stage::GetCurrent().Add(actor);
1037 // Build the animation
1038 Animation animation = Animation::New(0.0f);
1041 float durationSeconds(1.0f);
1042 animation.SetDuration(durationSeconds);
1044 bool signalReceived(false);
1045 AnimationFinishCheck finishCheck(signalReceived);
1046 animation.FinishedSignal().Connect(&application, finishCheck);
1047 application.SendNotification();
1049 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1050 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1052 // Start the animation from 40% progress
1053 animation.SetCurrentProgress( 0.4f );
1056 application.SendNotification();
1057 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1059 // We didn't expect the animation to finish yet
1060 application.SendNotification();
1061 finishCheck.CheckSignalNotReceived();
1062 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1063 DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
1065 animation.Play(); // Test that calling play has no effect, when animation is already playing
1066 application.SendNotification();
1068 //Set the progress to 70%
1069 animation.SetCurrentProgress( 0.7f );
1070 application.SendNotification();
1071 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 80% progress */);
1072 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1074 application.SendNotification();
1075 finishCheck.CheckSignalNotReceived();
1076 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1077 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1079 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1080 // We did expect the animation to finish
1081 application.SendNotification();
1082 finishCheck.CheckSignalReceived();
1083 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1085 // Check that nothing has changed after a couple of buffer swaps
1086 application.Render(0);
1087 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1088 application.Render(0);
1089 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1093 int UtcDaliAnimationSetCurrentProgressN(void)
1095 TestApplication application;
1097 Actor actor = Actor::New();
1098 Stage::GetCurrent().Add(actor);
1100 // Build the animation
1101 Animation animation = Animation::New(0.0f);
1104 float durationSeconds(1.0f);
1105 animation.SetDuration(durationSeconds);
1107 bool signalReceived(false);
1108 AnimationFinishCheck finishCheck(signalReceived);
1109 animation.FinishedSignal().Connect(&application, finishCheck);
1110 application.SendNotification();
1112 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1113 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1115 //Trying to set the current cursor outside the range [0..1] is ignored
1116 animation.SetCurrentProgress( -1.0f);
1117 application.SendNotification();
1118 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1120 animation.SetCurrentProgress( 100.0f);
1121 application.SendNotification();
1122 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1126 int UtcDaliAnimationGetCurrentProgressP(void)
1128 TestApplication application;
1130 Actor actor = Actor::New();
1131 Stage::GetCurrent().Add(actor);
1133 // Build the animation
1134 Animation animation = Animation::New(0.0f);
1137 //Test GetCurrentProgress return 0.0 as the duration is 0.0
1138 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1140 animation.SetCurrentProgress( 0.5f );
1141 application.SendNotification();
1142 application.Render(static_cast<unsigned int>(100.0f));
1144 //Progress should still be 0.0
1145 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1148 float durationSeconds(1.0f);
1149 animation.SetDuration(durationSeconds);
1150 application.SendNotification();
1152 bool signalReceived(false);
1153 AnimationFinishCheck finishCheck(signalReceived);
1154 animation.FinishedSignal().Connect(&application, finishCheck);
1155 application.SendNotification();
1157 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1158 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1160 // Start the animation from 40% progress
1161 animation.SetCurrentProgress( 0.4f );
1164 application.SendNotification();
1165 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1167 // We didn't expect the animation to finish yet
1168 application.SendNotification();
1169 finishCheck.CheckSignalNotReceived();
1170 DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
1172 animation.Play(); // Test that calling play has no effect, when animation is already playing
1173 application.SendNotification();
1175 //Set the progress to 70%
1176 animation.SetCurrentProgress( 0.7f );
1177 application.SendNotification();
1178 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 80% progress */);
1179 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1181 application.SendNotification();
1182 finishCheck.CheckSignalNotReceived();
1183 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1185 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1186 // We did expect the animation to finish
1187 application.SendNotification();
1188 finishCheck.CheckSignalReceived();
1192 int UtcDaliAnimationSetSpeedFactorP(void)
1194 TestApplication application;
1196 Actor actor = Actor::New();
1197 Stage::GetCurrent().Add(actor);
1199 // Build the animation
1200 float durationSeconds(1.0f);
1201 Animation animation = Animation::New(durationSeconds);
1203 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1204 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1206 KeyFrames keyframes = KeyFrames::New();
1207 keyframes.Add( 0.0f, initialPosition);
1208 keyframes.Add( 1.0f, targetPosition );
1209 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1211 //Set speed to be x2
1212 animation.SetSpeedFactor(2.0f);
1214 // Start the animation
1217 bool signalReceived(false);
1218 AnimationFinishCheck finishCheck(signalReceived);
1219 animation.FinishedSignal().Connect(&application, finishCheck);
1221 application.SendNotification();
1222 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1224 // We didn't expect the animation to finish yet
1225 application.SendNotification();
1226 finishCheck.CheckSignalNotReceived();
1227 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1229 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1231 // We didn't expect the animation to finish yet
1232 application.SendNotification();
1233 finishCheck.CheckSignalNotReceived();
1234 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1236 application.Render(static_cast<unsigned int>(durationSeconds*100.0f) + 1u/*just beyond half the duration*/);
1238 // We did expect the animation to finish
1239 application.SendNotification();
1240 finishCheck.CheckSignalReceived();
1241 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1243 // Check that nothing has changed after a couple of buffer swaps
1244 application.Render(0);
1245 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1246 application.Render(0);
1247 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1249 finishCheck.Reset();
1251 //Test -1 speed factor. Animation will play in reverse at normal speed
1252 animation.SetSpeedFactor( -1.0f );
1254 // Start the animation
1257 application.SendNotification();
1258 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1260 // We didn't expect the animation to finish yet
1261 application.SendNotification();
1262 finishCheck.CheckSignalNotReceived();
1263 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1265 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1267 // We didn't expect the animation to finish yet
1268 application.SendNotification();
1269 finishCheck.CheckSignalNotReceived();
1270 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1272 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1274 // We didn't expect the animation to finish yet
1275 application.SendNotification();
1276 finishCheck.CheckSignalNotReceived();
1277 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1279 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1281 // We didn't expect the animation to finish yet
1282 application.SendNotification();
1283 finishCheck.CheckSignalNotReceived();
1284 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1286 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1288 // We did expect the animation to finish
1289 application.SendNotification();
1290 finishCheck.CheckSignalReceived();
1291 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
1293 // Check that nothing has changed after a couple of buffer swaps
1294 application.Render(0);
1295 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1296 application.Render(0);
1297 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1299 //Test change speed factor on the fly
1300 finishCheck.Reset();
1302 //Set speed to be half of normal speed
1303 animation.SetSpeedFactor( 0.5f );
1305 // Start the animation
1308 application.SendNotification();
1309 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1311 // We didn't expect the animation to finish yet
1312 application.SendNotification();
1313 finishCheck.CheckSignalNotReceived();
1314 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), TEST_LOCATION );
1316 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1318 // We didn't expect the animation to finish yet
1319 application.SendNotification();
1320 finishCheck.CheckSignalNotReceived();
1321 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1323 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
1325 // We didn't expect the animation to finish yet
1326 application.SendNotification();
1327 finishCheck.CheckSignalNotReceived();
1328 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.3f), TEST_LOCATION );
1330 //Change speed factor while animation still playing.
1331 animation.SetSpeedFactor(-1.0f);
1332 application.SendNotification();
1333 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1335 // We didn't expect the animation to finish yet
1336 application.SendNotification();
1337 finishCheck.CheckSignalNotReceived();
1338 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), TEST_LOCATION );
1340 application.Render(static_cast<unsigned int>(durationSeconds*100.0f) + 1u/*just beyond the animation duration*/);
1342 // We did expect the animation to finish
1343 application.SendNotification();
1344 finishCheck.CheckSignalReceived();
1345 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
1347 // Check that nothing has changed after a couple of buffer swaps
1348 application.Render(0);
1349 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1350 application.Render(0);
1351 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1355 int UtcDaliAnimationGetSpeedFactorP(void)
1357 TestApplication application;
1359 Animation animation = Animation::New(1.0f);
1360 animation.SetSpeedFactor(0.5f);
1361 DALI_TEST_EQUALS(animation.GetSpeedFactor(), 0.5f, TEST_LOCATION);
1363 animation.SetSpeedFactor(-2.5f);
1364 DALI_TEST_EQUALS(animation.GetSpeedFactor(), -2.5f, TEST_LOCATION);
1368 int UtcDaliAnimationSetPlayRangeP(void)
1370 TestApplication application;
1372 Actor actor = Actor::New();
1373 Stage::GetCurrent().Add( actor );
1375 // Build the animation
1376 float durationSeconds( 1.0f );
1377 Animation animation = Animation::New( durationSeconds );
1379 bool signalReceived( false );
1380 AnimationFinishCheck finishCheck( signalReceived );
1381 animation.FinishedSignal().Connect( &application, finishCheck );
1382 application.SendNotification();
1384 // Set range between 0.4 and 0.8
1385 animation.SetPlayRange( Vector2( 0.4f, 0.9f ) );
1386 application.SendNotification();
1387 DALI_TEST_EQUALS( Vector2( 0.4f, 0.9f ), animation.GetPlayRange(), TEST_LOCATION );
1389 Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
1390 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR );
1392 // Start the animation from 40% progress
1395 application.SendNotification();
1396 application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 60% progress */ );
1398 // We didn't expect the animation to finish yet
1399 application.SendNotification();
1400 finishCheck.CheckSignalNotReceived();
1401 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.6f ), TEST_LOCATION );
1403 application.SendNotification();
1404 application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 80% progress */ );
1406 application.SendNotification();
1407 finishCheck.CheckSignalNotReceived();
1408 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.8f ), TEST_LOCATION );
1410 application.SendNotification();
1411 application.Render( static_cast< unsigned int >( durationSeconds*100.0f ) + 1u/*just beyond the animation duration*/ );
1413 // We did expect the animation to finish
1414 application.SendNotification();
1415 finishCheck.CheckSignalReceived();
1416 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.9f ), TEST_LOCATION );
1420 int UtcDaliAnimationSetPlayRangeN(void)
1422 TestApplication application;
1424 Actor actor = Actor::New();
1425 Stage::GetCurrent().Add(actor);
1427 // Build the animation
1428 Animation animation = Animation::New(0);
1429 application.SendNotification();
1431 //PlayRange out of bounds
1432 animation.SetPlayRange( Vector2(-1.0f,1.0f) );
1433 application.SendNotification();
1434 DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
1435 animation.SetPlayRange( Vector2(0.0f,2.0f) );
1436 application.SendNotification();
1437 DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
1439 //If playRange is not in the correct order it has to be ordered
1440 animation.SetPlayRange( Vector2(0.8f,0.2f) );
1441 application.SendNotification();
1442 DALI_TEST_EQUALS( Vector2(0.2f,0.8f), animation.GetPlayRange(), TEST_LOCATION );
1447 int UtcDaliAnimationGetPlayRangeP(void)
1449 TestApplication application;
1451 Actor actor = Actor::New();
1452 Stage::GetCurrent().Add( actor );
1454 // Build the animation
1455 Animation animation = Animation::New( 1.0f );
1456 application.SendNotification();
1458 //If PlayRange not specified it should be 0.0-1.0 by default
1459 DALI_TEST_EQUALS( Vector2( 0.0f,1.0f ), animation.GetPlayRange(), TEST_LOCATION );
1461 // Set range between 0.4 and 0.8
1462 animation.SetPlayRange( Vector2( 0.4f, 0.8f ) );
1463 application.SendNotification();
1464 DALI_TEST_EQUALS( Vector2( 0.4f, 0.8f ), animation.GetPlayRange(), TEST_LOCATION );
1469 int UtcDaliAnimationPlayP(void)
1471 TestApplication application;
1473 Actor actor = Actor::New();
1474 Stage::GetCurrent().Add(actor);
1476 // Build the animation
1477 float durationSeconds(1.0f);
1478 Animation animation = Animation::New(durationSeconds);
1479 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1480 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1482 // Start the animation
1485 bool signalReceived(false);
1486 AnimationFinishCheck finishCheck(signalReceived);
1487 animation.FinishedSignal().Connect(&application, finishCheck);
1489 application.SendNotification();
1490 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1492 // We didn't expect the animation to finish yet
1493 application.SendNotification();
1494 finishCheck.CheckSignalNotReceived();
1495 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1497 animation.Play(); // Test that calling play has no effect, when animation is already playing
1498 application.SendNotification();
1499 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1501 // We didn't expect the animation to finish yet
1502 application.SendNotification();
1503 finishCheck.CheckSignalNotReceived();
1504 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1506 animation.Play(); // Test that calling play has no effect, when animation is already playing
1507 application.SendNotification();
1508 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1510 // We didn't expect the animation to finish yet
1511 application.SendNotification();
1512 finishCheck.CheckSignalNotReceived();
1513 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1515 animation.Play(); // Test that calling play has no effect, when animation is already playing
1516 application.SendNotification();
1517 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1519 // We didn't expect the animation to finish yet
1520 application.SendNotification();
1521 finishCheck.CheckSignalNotReceived();
1522 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1524 animation.Play(); // Test that calling play has no effect, when animation is already playing
1525 application.SendNotification();
1526 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1528 // We did expect the animation to finish
1529 application.SendNotification();
1530 finishCheck.CheckSignalReceived();
1531 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1533 // Check that nothing has changed after a couple of buffer swaps
1534 application.Render(0);
1535 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1536 application.Render(0);
1537 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1541 int UtcDaliAnimationPlayOffStageP(void)
1543 // Test that an animation can be played, when the actor is off-stage.
1544 // When the actor is added to the stage, it should appear at the current position
1545 // i.e. where it would have been anyway, if on-stage from the beginning.
1547 TestApplication application;
1549 Actor actor = Actor::New();
1550 Vector3 basePosition(Vector3::ZERO);
1551 DALI_TEST_EQUALS( actor.GetCurrentPosition(), basePosition, TEST_LOCATION );
1552 // Not added to the stage!
1554 // Build the animation
1555 float durationSeconds(1.0f);
1556 Animation animation = Animation::New(durationSeconds);
1557 animation.SetDisconnectAction( Animation::Discard );
1558 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1559 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1561 // Start the animation
1564 bool signalReceived(false);
1565 AnimationFinishCheck finishCheck(signalReceived);
1566 animation.FinishedSignal().Connect(&application, finishCheck);
1568 application.SendNotification();
1569 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1571 // We didn't expect the animation to finish yet
1572 application.SendNotification();
1573 finishCheck.CheckSignalNotReceived();
1574 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*off-stage*/, TEST_LOCATION );
1577 Stage::GetCurrent().Add(actor);
1579 application.SendNotification();
1580 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1582 // We didn't expect the animation to finish yet
1583 application.SendNotification();
1584 finishCheck.CheckSignalNotReceived();
1585 Vector3 expectedPosition(basePosition + (targetPosition - basePosition)*0.4f);
1586 DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition/*on-stage*/, TEST_LOCATION );
1588 // Remove from the stage
1589 Stage::GetCurrent().Remove(actor);
1591 application.SendNotification();
1592 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1594 // We didn't expect the animation to finish yet
1595 application.SendNotification();
1596 finishCheck.CheckSignalNotReceived();
1597 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*back to start position*/, TEST_LOCATION );
1600 Stage::GetCurrent().Add(actor);
1602 application.SendNotification();
1603 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1605 // We didn't expect the animation to finish yet
1606 application.SendNotification();
1607 finishCheck.CheckSignalNotReceived();
1608 expectedPosition = Vector3(basePosition + (targetPosition - basePosition)*0.8f);
1609 DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition, TEST_LOCATION );
1611 application.SendNotification();
1612 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1614 // We did expect the animation to finish
1615 application.SendNotification();
1616 finishCheck.CheckSignalReceived();
1617 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1619 // Check that nothing has changed after a couple of buffer swaps
1620 application.Render(0);
1621 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1622 application.Render(0);
1623 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1627 int UtcDaliAnimationPlayDiscardHandleP(void)
1629 TestApplication application;
1631 Actor actor = Actor::New();
1632 Stage::GetCurrent().Add(actor);
1634 // Build the animation
1635 float durationSeconds(1.0f);
1636 Animation animation = Animation::New(durationSeconds);
1637 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1638 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1640 bool signalReceived(false);
1641 AnimationFinishCheck finishCheck(signalReceived);
1642 animation.FinishedSignal().Connect(&application, finishCheck);
1644 // Start the animation
1647 // This is a test of the "Fire and Forget" behaviour
1648 // Discard the animation handle!
1650 DALI_TEST_CHECK( !animation );
1652 application.SendNotification();
1653 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1655 // We didn't expect the animation to finish yet
1656 application.SendNotification();
1657 finishCheck.CheckSignalNotReceived();
1658 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1660 application.SendNotification();
1661 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1663 // We didn't expect the animation to finish yet
1664 application.SendNotification();
1665 finishCheck.CheckSignalNotReceived();
1666 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1668 application.SendNotification();
1669 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1671 // We didn't expect the animation to finish yet
1672 application.SendNotification();
1673 finishCheck.CheckSignalNotReceived();
1674 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1676 application.SendNotification();
1677 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1679 // We didn't expect the animation to finish yet
1680 application.SendNotification();
1681 finishCheck.CheckSignalNotReceived();
1682 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1684 application.SendNotification();
1685 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1687 // We did expect the animation to finish
1688 application.SendNotification();
1689 finishCheck.CheckSignalReceived();
1690 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1692 // Check that nothing has changed after a couple of buffer swaps
1693 application.Render(0);
1694 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1695 application.Render(0);
1696 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1700 int UtcDaliAnimationPlayStopDiscardHandleP(void)
1702 TestApplication application;
1704 Actor actor = Actor::New();
1705 Stage::GetCurrent().Add(actor);
1707 // Build the animation
1708 float durationSeconds(1.0f);
1709 Animation animation = Animation::New(durationSeconds);
1710 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1711 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1713 // Start the animation
1716 bool signalReceived(false);
1717 AnimationFinishCheck finishCheck(signalReceived);
1718 animation.FinishedSignal().Connect(&application, finishCheck);
1720 application.SendNotification();
1721 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1723 // We didn't expect the animation to finish yet
1724 application.SendNotification();
1725 finishCheck.CheckSignalNotReceived();
1726 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1728 // This is a test of the "Fire and Forget" behaviour
1729 // Stop the animation, and Discard the animation handle!
1732 DALI_TEST_CHECK( !animation );
1734 application.SendNotification();
1735 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1737 // We expect the animation to finish at 20% progress
1738 application.SendNotification();
1739 finishCheck.CheckSignalReceived();
1740 finishCheck.Reset();
1741 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1743 application.SendNotification();
1744 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1746 // Check that nothing has changed
1747 application.SendNotification();
1748 finishCheck.CheckSignalNotReceived();
1749 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1751 application.SendNotification();
1752 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1754 // Check that nothing has changed
1755 application.SendNotification();
1756 finishCheck.CheckSignalNotReceived();
1757 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1759 application.SendNotification();
1760 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 100% progress */);
1762 // Check that nothing has changed
1763 application.SendNotification();
1764 finishCheck.CheckSignalNotReceived();
1765 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1769 int UtcDaliAnimationPlayRangeP(void)
1771 TestApplication application;
1773 Actor actor = Actor::New();
1774 Stage::GetCurrent().Add(actor);
1776 // Build the animation
1777 float durationSeconds(1.0f);
1778 Animation animation = Animation::New(durationSeconds);
1779 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1780 KeyFrames keyframes = KeyFrames::New();
1781 keyframes.Add( 0.0f , Vector3(0.0f,0.0f,0.0f ) );
1782 keyframes.Add( 1.0f , Vector3(100.0f,100.0f,100.0f ) );
1784 animation.AnimateBetween( Property( actor, Actor::Property::POSITION), keyframes );
1786 // Set range between 0.4 and 0.8
1787 animation.SetPlayRange( Vector2(0.4f,0.8f) );
1790 bool signalReceived(false);
1791 AnimationFinishCheck finishCheck(signalReceived);
1792 animation.FinishedSignal().Connect(&application, finishCheck);
1794 //Test that setting progress outside the range doesn't work
1795 animation.SetCurrentProgress( 0.9f );
1796 application.SendNotification();
1797 application.Render(0);
1798 DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
1799 animation.SetCurrentProgress( 0.2f );
1800 application.SendNotification();
1801 application.Render(0);
1802 DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
1804 application.SendNotification();
1805 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1807 // We didn't expect the animation to finish yet
1808 application.SendNotification();
1809 finishCheck.CheckSignalNotReceived();
1810 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1812 animation.Play(); // Test that calling play has no effect, when animation is already playing
1813 application.SendNotification();
1814 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/* 80% progress */);
1816 // We did expect the animation to finish
1817 application.SendNotification();
1818 finishCheck.CheckSignalReceived();
1819 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1821 // Check that nothing has changed after a couple of buffer swaps
1822 application.Render(0);
1823 DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentPosition(), TEST_LOCATION );
1824 application.Render(0);
1825 DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentPosition(), TEST_LOCATION );
1828 //Loop inside the range
1829 finishCheck.Reset();
1830 animation.SetLooping( true );
1832 application.SendNotification();
1833 float intervalSeconds = 0.1f;
1834 float progress = 0.4f;
1835 for (int iterations = 0; iterations < 10; ++iterations )
1837 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
1839 progress += intervalSeconds;
1840 if (progress > 0.8f)
1842 progress = progress - 0.4f;
1845 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
1848 // We didn't expect the animation to finish yet
1849 application.SendNotification();
1850 finishCheck.CheckSignalNotReceived();
1853 //Test change range on the fly
1854 animation.SetPlayRange( Vector2( 0.2f, 0.9f ) );
1855 application.SendNotification();
1857 for (int iterations = 0; iterations < 10; ++iterations )
1859 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
1861 progress += intervalSeconds;
1862 if (progress > 0.9f)
1864 progress = progress - 0.7f;
1867 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
1873 int UtcDaliAnimationPlayFromP(void)
1875 TestApplication application;
1877 Actor actor = Actor::New();
1878 Stage::GetCurrent().Add(actor);
1880 // Build the animation
1881 float durationSeconds(1.0f);
1882 Animation animation = Animation::New(durationSeconds);
1883 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1884 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1886 // Start the animation from 40% progress
1887 animation.PlayFrom( 0.4f );
1889 bool signalReceived(false);
1890 AnimationFinishCheck finishCheck(signalReceived);
1891 animation.FinishedSignal().Connect(&application, finishCheck);
1893 application.SendNotification();
1894 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1896 // We didn't expect the animation to finish yet
1897 application.SendNotification();
1898 finishCheck.CheckSignalNotReceived();
1899 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1901 animation.Play(); // Test that calling play has no effect, when animation is already playing
1902 application.SendNotification();
1903 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1905 // We didn't expect the animation to finish yet
1906 application.SendNotification();
1907 finishCheck.CheckSignalNotReceived();
1908 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1910 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1911 // We did expect the animation to finish
1912 application.SendNotification();
1913 finishCheck.CheckSignalReceived();
1914 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1916 // Check that nothing has changed after a couple of buffer swaps
1917 application.Render(0);
1918 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1919 application.Render(0);
1920 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1924 int UtcDaliAnimationPlayFromN(void)
1926 TestApplication application;
1928 Actor actor = Actor::New();
1929 Stage::GetCurrent().Add(actor);
1931 // Build the animation
1932 float durationSeconds(1.0f);
1933 Animation animation = Animation::New(durationSeconds);
1934 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1935 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1937 //PlayFrom with an argument outside the range [0..1] will be ignored
1938 animation.PlayFrom(-1.0f);
1939 application.SendNotification();
1940 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1942 animation.PlayFrom(100.0f);
1943 application.SendNotification();
1944 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1948 int UtcDaliAnimationPauseP(void)
1950 TestApplication application;
1952 Actor actor = Actor::New();
1953 Stage::GetCurrent().Add(actor);
1955 // Build the animation
1956 float durationSeconds(1.0f);
1957 Animation animation = Animation::New(durationSeconds);
1958 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1959 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1961 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
1963 // Start the animation
1966 bool signalReceived(false);
1967 AnimationFinishCheck finishCheck(signalReceived);
1968 animation.FinishedSignal().Connect(&application, finishCheck);
1970 application.SendNotification();
1971 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
1973 // We didn't expect the animation to finish yet
1974 application.SendNotification();
1975 finishCheck.CheckSignalNotReceived();
1976 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
1978 // Pause the animation
1980 application.SendNotification();
1983 for (int i=0; i<5; ++i)
1985 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
1987 // We didn't expect the animation to finish yet
1988 application.SendNotification();
1989 finishCheck.CheckSignalNotReceived();
1990 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
1995 application.SendNotification();
1996 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
1998 // We didn't expect the animation to finish yet
1999 application.SendNotification();
2000 finishCheck.CheckSignalNotReceived();
2002 application.SendNotification();
2003 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2005 // We did expect the animation to finish
2006 application.SendNotification();
2007 finishCheck.CheckSignalReceived();
2008 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2010 // Check that nothing has changed after a couple of buffer swaps
2011 application.Render(0);
2012 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2013 application.Render(0);
2014 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2019 int UtcDaliAnimationGetStateP(void)
2021 TestApplication application;
2023 Actor actor = Actor::New();
2024 Stage::GetCurrent().Add(actor);
2026 // Build the animation
2027 float durationSeconds(1.0f);
2028 Animation animation = Animation::New(durationSeconds);
2029 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2030 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2031 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2033 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2035 // Start the animation
2038 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2040 bool signalReceived(false);
2041 AnimationFinishCheck finishCheck(signalReceived);
2042 animation.FinishedSignal().Connect(&application, finishCheck);
2044 application.SendNotification();
2045 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2047 // We didn't expect the animation to finish yet
2048 application.SendNotification();
2049 finishCheck.CheckSignalNotReceived();
2050 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2051 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2053 // Pause the animation
2055 DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
2056 application.SendNotification();
2057 application.Render(0.f);
2060 for (int i=0; i<5; ++i)
2062 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2064 // We didn't expect the animation to finish yet
2065 application.SendNotification();
2066 finishCheck.CheckSignalNotReceived();
2067 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
2068 DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
2072 finishCheck.Reset();
2074 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2075 application.SendNotification();
2076 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2077 // We didn't expect the animation to finish yet
2078 application.SendNotification();
2079 finishCheck.CheckSignalNotReceived();
2080 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2082 application.SendNotification();
2083 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2085 // We did expect the animation to finish
2086 application.SendNotification();
2087 finishCheck.CheckSignalReceived();
2088 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2089 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2091 // Check that nothing has changed after a couple of buffer swaps
2092 application.Render(0);
2093 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2094 application.Render(0);
2095 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2096 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2099 finishCheck.Reset();
2101 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2102 application.SendNotification();
2103 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2104 application.SendNotification();
2105 finishCheck.CheckSignalNotReceived();
2106 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2112 int UtcDaliAnimationStopP(void)
2114 TestApplication application;
2116 Actor actor = Actor::New();
2117 Stage::GetCurrent().Add(actor);
2119 // Build the animation
2120 float durationSeconds(1.0f);
2121 Animation animation = Animation::New(durationSeconds);
2122 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2123 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2125 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2127 // Start the animation
2130 bool signalReceived(false);
2131 AnimationFinishCheck finishCheck(signalReceived);
2132 animation.FinishedSignal().Connect(&application, finishCheck);
2134 application.SendNotification();
2135 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2137 // We didn't expect the animation to finish yet
2138 application.SendNotification();
2139 finishCheck.CheckSignalNotReceived();
2140 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2142 // Stop the animation
2144 application.SendNotification();
2147 for (int i=0; i<5; ++i)
2149 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2151 // We did expect the animation to finish
2152 application.SendNotification();
2153 finishCheck.CheckSignalReceived();
2154 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when stopped */, TEST_LOCATION );
2159 int UtcDaliAnimationStopSetPositionP(void)
2161 // Test that Animation::Stop & Actor::SetPosition can be used in conjunction
2162 // i.e. to check that the animation does not interfere with the position set.
2164 TestApplication application;
2166 Actor actor = Actor::New();
2167 Stage::GetCurrent().Add(actor);
2169 // Build the animation
2170 float durationSeconds(1.0f);
2171 Animation animation = Animation::New(durationSeconds);
2172 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2173 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2175 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2177 // Start the animation
2180 bool signalReceived(false);
2181 AnimationFinishCheck finishCheck(signalReceived);
2182 animation.FinishedSignal().Connect(&application, finishCheck);
2184 application.SendNotification();
2185 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2187 // We didn't expect the animation to finish yet
2188 application.SendNotification();
2189 finishCheck.CheckSignalNotReceived();
2190 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2192 // Stop the animation
2194 Vector3 positionSet(2.0f, 3.0f, 4.0f);
2195 actor.SetPosition(positionSet);
2196 application.SendNotification();
2199 for (int i=0; i<5; ++i)
2201 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2203 // We did expect the animation to finish
2204 application.SendNotification();
2205 finishCheck.CheckSignalReceived();
2206 DALI_TEST_EQUALS( actor.GetCurrentPosition(), positionSet/*Animation should not interfere with this*/, TEST_LOCATION );
2211 int UtcDaliAnimationClearP(void)
2213 TestApplication application;
2215 Actor actor = Actor::New();
2216 Stage::GetCurrent().Add(actor);
2218 // Build the animation
2219 float durationSeconds(1.0f);
2220 Animation animation = Animation::New(durationSeconds);
2221 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2222 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2224 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2226 // Start the animation
2229 bool signalReceived(false);
2230 AnimationFinishCheck finishCheck(signalReceived);
2231 animation.FinishedSignal().Connect(&application, finishCheck);
2233 application.SendNotification();
2234 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2236 // We didn't expect the animation to finish yet
2237 application.SendNotification();
2238 finishCheck.CheckSignalNotReceived();
2239 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2241 // Clear the animation
2243 application.SendNotification();
2245 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2247 // We don't expect the animation to finish now
2248 application.SendNotification();
2249 finishCheck.CheckSignalNotReceived();
2250 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress since the animator was destroyed */, TEST_LOCATION );
2252 // Restart as a scale animation; this should not move the actor's position
2253 finishCheck.Reset();
2254 actor.SetPosition(Vector3::ZERO);
2255 Vector3 targetScale(3.0f, 3.0f, 3.0f);
2256 animation.AnimateTo( Property( actor, Actor::Property::SCALE ), targetScale, AlphaFunction::LINEAR );
2259 application.SendNotification();
2260 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2262 // We didn't expect the animation to finish yet
2263 application.SendNotification();
2264 finishCheck.CheckSignalNotReceived();
2265 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
2266 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION );
2268 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2270 // We did expect the animation to finish
2271 application.SendNotification();
2272 finishCheck.CheckSignalReceived();
2273 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
2274 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
2278 int UtcDaliAnimationFinishedSignalP(void)
2280 TestApplication application;
2282 // Start the empty animation
2283 float durationSeconds(1.0f);
2284 Animation animation = Animation::New(durationSeconds);
2287 bool signalReceived(false);
2288 AnimationFinishCheck finishCheck(signalReceived);
2289 animation.FinishedSignal().Connect(&application, finishCheck);
2291 application.SendNotification();
2292 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*beyond the animation duration*/);
2294 // We did expect the animation to finish
2295 application.SendNotification();
2296 finishCheck.CheckSignalReceived();
2300 int UtcDaliAnimationAnimateByBooleanP(void)
2302 TestApplication application;
2304 Actor actor = Actor::New();
2306 // Register a boolean property
2307 bool startValue(false);
2308 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2309 Stage::GetCurrent().Add(actor);
2310 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2312 // Build the animation
2313 float durationSeconds(2.0f);
2314 Animation animation = Animation::New(durationSeconds);
2315 const bool relativeValue(true);
2316 const bool finalValue( false || relativeValue );
2317 animation.AnimateBy(Property(actor, index), relativeValue);
2319 // Start the animation
2322 bool signalReceived(false);
2323 AnimationFinishCheck finishCheck(signalReceived);
2324 animation.FinishedSignal().Connect(&application, finishCheck);
2326 application.SendNotification();
2327 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2329 // We didn't expect the animation to finish yet
2330 application.SendNotification();
2331 finishCheck.CheckSignalNotReceived();
2332 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2334 application.SendNotification();
2335 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2337 // We did expect the animation to finish
2338 application.SendNotification();
2339 finishCheck.CheckSignalReceived();
2340 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2342 // Check that nothing has changed after a couple of buffer swaps
2343 application.Render(0);
2344 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2345 application.Render(0);
2346 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2348 // Repeat with relative value "false" - this should be an NOOP
2349 animation = Animation::New(durationSeconds);
2350 bool noOpValue(false);
2351 animation.AnimateBy(Property(actor, index), noOpValue);
2353 // Start the animation
2356 finishCheck.Reset();
2357 animation.FinishedSignal().Connect(&application, finishCheck);
2359 application.SendNotification();
2360 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2362 // We didn't expect the animation to finish yet
2363 application.SendNotification();
2364 finishCheck.CheckSignalNotReceived();
2365 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2367 application.SendNotification();
2368 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2370 // We did expect the animation to finish
2371 application.SendNotification();
2372 finishCheck.CheckSignalReceived();
2373 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2375 // Check that nothing has changed after a couple of buffer swaps
2376 application.Render(0);
2377 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2378 application.Render(0);
2379 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2383 int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void)
2385 TestApplication application;
2387 Actor actor = Actor::New();
2389 // Register a boolean property
2390 bool startValue(false);
2391 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2392 Stage::GetCurrent().Add(actor);
2393 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2395 // Build the animation
2396 float durationSeconds(2.0f);
2397 Animation animation = Animation::New(durationSeconds);
2398 bool relativeValue(true);
2399 bool finalValue( false || relativeValue );
2400 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN);
2402 // Start the animation
2405 bool signalReceived(false);
2406 AnimationFinishCheck finishCheck(signalReceived);
2407 animation.FinishedSignal().Connect(&application, finishCheck);
2409 application.SendNotification();
2410 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2412 // We didn't expect the animation to finish yet
2413 application.SendNotification();
2414 finishCheck.CheckSignalNotReceived();
2415 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2417 application.SendNotification();
2418 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2420 // We did expect the animation to finish
2421 application.SendNotification();
2422 finishCheck.CheckSignalReceived();
2423 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2425 // Check that nothing has changed after a couple of buffer swaps
2426 application.Render(0);
2427 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2428 application.Render(0);
2429 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2431 // Repeat with relative value "false" - this should be an NOOP
2432 animation = Animation::New(durationSeconds);
2433 bool noOpValue(false);
2434 animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunction::EASE_IN);
2436 // Start the animation
2439 finishCheck.Reset();
2440 animation.FinishedSignal().Connect(&application, finishCheck);
2442 application.SendNotification();
2443 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2445 // We didn't expect the animation to finish yet
2446 application.SendNotification();
2447 finishCheck.CheckSignalNotReceived();
2448 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2450 application.SendNotification();
2451 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2453 // We did expect the animation to finish
2454 application.SendNotification();
2455 finishCheck.CheckSignalReceived();
2456 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2460 int UtcDaliAnimationAnimateByBooleanTimePeriodP(void)
2462 TestApplication application;
2464 Actor actor = Actor::New();
2466 // Register a boolean property
2467 bool startValue(false);
2468 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2469 Stage::GetCurrent().Add(actor);
2470 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2472 // Build the animation
2473 float durationSeconds(2.0f);
2474 Animation animation = Animation::New(durationSeconds);
2475 bool relativeValue(true);
2476 bool finalValue( false || relativeValue );
2477 float animatorDurationSeconds(durationSeconds * 0.5f);
2478 animation.AnimateBy( Property(actor, index),
2480 TimePeriod( animatorDurationSeconds ) );
2482 // Start the animation
2485 bool signalReceived(false);
2486 AnimationFinishCheck finishCheck(signalReceived);
2487 animation.FinishedSignal().Connect(&application, finishCheck);
2489 application.SendNotification();
2490 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
2492 // We didn't expect the animation to finish yet
2493 application.SendNotification();
2494 finishCheck.CheckSignalNotReceived();
2495 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2497 application.SendNotification();
2498 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
2500 // We didn't expect the animation to finish yet...
2501 application.SendNotification();
2502 finishCheck.CheckSignalNotReceived();
2504 // ...however we should have reached the final value
2505 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2507 application.SendNotification();
2508 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
2510 // We did expect the animation to finish
2511 application.SendNotification();
2512 finishCheck.CheckSignalReceived();
2513 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2515 // Check that nothing has changed after a couple of buffer swaps
2516 application.Render(0);
2517 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2518 application.Render(0);
2519 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2523 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void)
2525 TestApplication application;
2527 Actor actor = Actor::New();
2529 // Register a boolean property
2530 bool startValue(false);
2531 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2532 Stage::GetCurrent().Add(actor);
2533 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2535 // Build the animation
2536 float durationSeconds(2.0f);
2537 Animation animation = Animation::New(durationSeconds);
2538 bool relativeValue(true);
2539 bool finalValue( false || relativeValue );
2540 float animatorDurationSeconds(durationSeconds * 0.5f);
2541 animation.AnimateBy( Property(actor, index),
2543 AlphaFunction::EASE_IN_OUT,
2544 TimePeriod( animatorDurationSeconds ) );
2546 // Start the animation
2549 bool signalReceived(false);
2550 AnimationFinishCheck finishCheck(signalReceived);
2551 animation.FinishedSignal().Connect(&application, finishCheck);
2553 application.SendNotification();
2554 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
2556 // We didn't expect the animation to finish yet
2557 application.SendNotification();
2558 finishCheck.CheckSignalNotReceived();
2559 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2561 application.SendNotification();
2562 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
2564 // We didn't expect the animation to finish yet...
2565 application.SendNotification();
2566 finishCheck.CheckSignalNotReceived();
2568 // ...however we should have reached the final value
2569 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2571 application.SendNotification();
2572 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
2574 // We did expect the animation to finish
2575 application.SendNotification();
2576 finishCheck.CheckSignalReceived();
2577 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2579 // Check that nothing has changed after a couple of buffer swaps
2580 application.Render(0);
2581 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2582 application.Render(0);
2583 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2587 int UtcDaliAnimationAnimateByFloatP(void)
2589 TestApplication application;
2591 Actor actor = Actor::New();
2593 // Register a float property
2594 float startValue(10.0f);
2595 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2596 Stage::GetCurrent().Add(actor);
2597 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2599 // Build the animation
2600 float durationSeconds(2.0f);
2601 Animation animation = Animation::New(durationSeconds);
2602 float targetValue(50.0f);
2603 float relativeValue(targetValue - startValue);
2604 animation.AnimateBy(Property(actor, index), relativeValue);
2606 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2608 // Start the animation
2611 bool signalReceived(false);
2612 AnimationFinishCheck finishCheck(signalReceived);
2613 animation.FinishedSignal().Connect(&application, finishCheck);
2615 application.SendNotification();
2616 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2618 // We didn't expect the animation to finish yet
2619 application.SendNotification();
2620 finishCheck.CheckSignalNotReceived();
2621 DALI_TEST_EQUALS( actor.GetProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION );
2623 application.SendNotification();
2624 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2626 // We did expect the animation to finish
2627 application.SendNotification();
2628 finishCheck.CheckSignalReceived();
2629 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2631 // Check that nothing has changed after a couple of buffer swaps
2632 application.Render(0);
2633 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2634 application.Render(0);
2635 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2639 int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void)
2641 TestApplication application;
2643 Actor actor = Actor::New();
2645 // Register a float property
2646 float startValue(10.0f);
2647 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2648 Stage::GetCurrent().Add(actor);
2649 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2651 // Build the animation
2652 float durationSeconds(1.0f);
2653 Animation animation = Animation::New(durationSeconds);
2654 float targetValue(90.0f);
2655 float relativeValue(targetValue - startValue);
2656 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
2658 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2660 // Start the animation
2663 bool signalReceived(false);
2664 AnimationFinishCheck finishCheck(signalReceived);
2665 animation.FinishedSignal().Connect(&application, finishCheck);
2667 application.SendNotification();
2668 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2670 // We didn't expect the animation to finish yet
2671 application.SendNotification();
2672 finishCheck.CheckSignalNotReceived();
2674 // The position should have moved more, than with a linear alpha function
2675 float current(actor.GetProperty<float>(index));
2676 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
2678 application.SendNotification();
2679 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2681 // We did expect the animation to finish
2682 application.SendNotification();
2683 finishCheck.CheckSignalReceived();
2684 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2686 // Check that nothing has changed after a couple of buffer swaps
2687 application.Render(0);
2688 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2689 application.Render(0);
2690 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2694 int UtcDaliAnimationAnimateByFloatTimePeriodP(void)
2696 TestApplication application;
2698 Actor actor = Actor::New();
2700 // Register a float property
2701 float startValue(10.0f);
2702 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2703 Stage::GetCurrent().Add(actor);
2704 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2706 // Build the animation
2707 float durationSeconds(1.0f);
2708 Animation animation = Animation::New(durationSeconds);
2709 float targetValue(30.0f);
2710 float relativeValue(targetValue - startValue);
2712 animation.AnimateBy(Property(actor, index),
2714 TimePeriod(delay, durationSeconds - delay));
2716 // Start the animation
2719 bool signalReceived(false);
2720 AnimationFinishCheck finishCheck(signalReceived);
2721 animation.FinishedSignal().Connect(&application, finishCheck);
2723 application.SendNotification();
2724 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2726 // We didn't expect the animation to finish yet
2727 application.SendNotification();
2728 finishCheck.CheckSignalNotReceived();
2729 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2731 application.SendNotification();
2732 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2734 // We didn't expect the animation to finish yet
2735 application.SendNotification();
2736 finishCheck.CheckSignalNotReceived();
2737 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2739 application.SendNotification();
2740 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2742 // We did expect the animation to finish
2743 application.SendNotification();
2744 finishCheck.CheckSignalReceived();
2745 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2747 // Check that nothing has changed after a couple of buffer swaps
2748 application.Render(0);
2749 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2750 application.Render(0);
2751 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2755 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void)
2757 TestApplication application;
2759 Actor actor = Actor::New();
2761 // Register a float property
2762 float startValue(10.0f);
2763 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2764 Stage::GetCurrent().Add(actor);
2765 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2767 // Build the animation
2768 float durationSeconds(1.0f);
2769 Animation animation = Animation::New(durationSeconds);
2770 float targetValue(30.0f);
2771 float relativeValue(targetValue - startValue);
2773 animation.AnimateBy(Property(actor, index),
2775 AlphaFunction::LINEAR,
2776 TimePeriod(delay, durationSeconds - delay));
2778 // Start the animation
2781 bool signalReceived(false);
2782 AnimationFinishCheck finishCheck(signalReceived);
2783 animation.FinishedSignal().Connect(&application, finishCheck);
2785 application.SendNotification();
2786 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2788 // We didn't expect the animation to finish yet
2789 application.SendNotification();
2790 finishCheck.CheckSignalNotReceived();
2791 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2793 application.SendNotification();
2794 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2796 // We didn't expect the animation to finish yet
2797 application.SendNotification();
2798 finishCheck.CheckSignalNotReceived();
2799 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2801 application.SendNotification();
2802 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2804 // We did expect the animation to finish
2805 application.SendNotification();
2806 finishCheck.CheckSignalReceived();
2807 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2809 // Check that nothing has changed after a couple of buffer swaps
2810 application.Render(0);
2811 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2812 application.Render(0);
2813 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2817 int UtcDaliAnimationAnimateByIntegerP(void)
2819 TestApplication application;
2821 Actor actor = Actor::New();
2823 // Register an integer property
2825 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2826 Stage::GetCurrent().Add(actor);
2827 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
2829 // Build the animation
2830 float durationSeconds(2.0f);
2831 Animation animation = Animation::New(durationSeconds);
2832 int targetValue(50);
2833 int relativeValue(targetValue - startValue);
2834 animation.AnimateBy(Property(actor, index), relativeValue);
2836 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
2838 // Start the animation
2841 bool signalReceived(false);
2842 AnimationFinishCheck finishCheck(signalReceived);
2843 animation.FinishedSignal().Connect(&application, finishCheck);
2845 application.SendNotification();
2846 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2848 // We didn't expect the animation to finish yet
2849 application.SendNotification();
2850 finishCheck.CheckSignalNotReceived();
2851 DALI_TEST_EQUALS( actor.GetProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION );
2853 application.SendNotification();
2854 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2856 // We did expect the animation to finish
2857 application.SendNotification();
2858 finishCheck.CheckSignalReceived();
2859 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2861 // Check that nothing has changed after a couple of buffer swaps
2862 application.Render(0);
2863 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2864 application.Render(0);
2865 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2869 int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void)
2871 TestApplication application;
2873 Actor actor = Actor::New();
2875 // Register an integer property
2877 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2878 Stage::GetCurrent().Add(actor);
2879 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
2881 // Build the animation
2882 float durationSeconds(1.0f);
2883 Animation animation = Animation::New(durationSeconds);
2884 int targetValue(90);
2885 int relativeValue(targetValue - startValue);
2886 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
2888 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
2890 // Start the animation
2893 bool signalReceived(false);
2894 AnimationFinishCheck finishCheck(signalReceived);
2895 animation.FinishedSignal().Connect(&application, finishCheck);
2897 application.SendNotification();
2898 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2900 // We didn't expect the animation to finish yet
2901 application.SendNotification();
2902 finishCheck.CheckSignalNotReceived();
2904 // The position should have moved more, than with a linear alpha function
2905 int current(actor.GetProperty<int>(index));
2906 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
2908 application.SendNotification();
2909 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2911 // We did expect the animation to finish
2912 application.SendNotification();
2913 finishCheck.CheckSignalReceived();
2914 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2916 // Check that nothing has changed after a couple of buffer swaps
2917 application.Render(0);
2918 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2919 application.Render(0);
2920 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2924 int UtcDaliAnimationAnimateByIntegerTimePeriodP(void)
2926 TestApplication application;
2928 Actor actor = Actor::New();
2930 // Register an integer property
2932 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2933 Stage::GetCurrent().Add(actor);
2934 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
2936 // Build the animation
2937 float durationSeconds(1.0f);
2938 Animation animation = Animation::New(durationSeconds);
2939 int targetValue(30);
2940 int relativeValue(targetValue - startValue);
2942 animation.AnimateBy(Property(actor, index),
2944 TimePeriod(delay, durationSeconds - delay));
2946 // Start the animation
2949 bool signalReceived(false);
2950 AnimationFinishCheck finishCheck(signalReceived);
2951 animation.FinishedSignal().Connect(&application, finishCheck);
2953 application.SendNotification();
2954 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2956 // We didn't expect the animation to finish yet
2957 application.SendNotification();
2958 finishCheck.CheckSignalNotReceived();
2959 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
2961 application.SendNotification();
2962 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2964 // We didn't expect the animation to finish yet
2965 application.SendNotification();
2966 finishCheck.CheckSignalNotReceived();
2967 DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
2969 application.SendNotification();
2970 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2972 // We did expect the animation to finish
2973 application.SendNotification();
2974 finishCheck.CheckSignalReceived();
2975 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2977 // Check that nothing has changed after a couple of buffer swaps
2978 application.Render(0);
2979 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2980 application.Render(0);
2981 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2985 int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void)
2987 TestApplication application;
2989 Actor actor = Actor::New();
2991 // Register an integer property
2993 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2994 Stage::GetCurrent().Add(actor);
2995 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
2997 // Build the animation
2998 float durationSeconds(1.0f);
2999 Animation animation = Animation::New(durationSeconds);
3000 int targetValue(30);
3001 int relativeValue(targetValue - startValue);
3003 animation.AnimateBy(Property(actor, index),
3005 AlphaFunction::LINEAR,
3006 TimePeriod(delay, durationSeconds - delay));
3008 // Start the animation
3011 bool signalReceived(false);
3012 AnimationFinishCheck finishCheck(signalReceived);
3013 animation.FinishedSignal().Connect(&application, finishCheck);
3015 application.SendNotification();
3016 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3018 // We didn't expect the animation to finish yet
3019 application.SendNotification();
3020 finishCheck.CheckSignalNotReceived();
3021 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3023 application.SendNotification();
3024 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3026 // We didn't expect the animation to finish yet
3027 application.SendNotification();
3028 finishCheck.CheckSignalNotReceived();
3029 DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3031 application.SendNotification();
3032 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3034 // We did expect the animation to finish
3035 application.SendNotification();
3036 finishCheck.CheckSignalReceived();
3037 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3039 // Check that nothing has changed after a couple of buffer swaps
3040 application.Render(0);
3041 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3042 application.Render(0);
3043 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3047 int UtcDaliAnimationAnimateByVector2P(void)
3049 TestApplication application;
3051 Actor actor = Actor::New();
3053 // Register a Vector2 property
3054 Vector2 startValue(10.0f, 10.0f);
3055 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3056 Stage::GetCurrent().Add(actor);
3057 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3059 // Build the animation
3060 float durationSeconds(2.0f);
3061 Animation animation = Animation::New(durationSeconds);
3062 Vector2 targetValue(60.0f, 60.0f);
3063 Vector2 relativeValue(targetValue - startValue);
3064 animation.AnimateBy(Property(actor, index), relativeValue);
3066 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3068 // Start the animation
3071 bool signalReceived(false);
3072 AnimationFinishCheck finishCheck(signalReceived);
3073 animation.FinishedSignal().Connect(&application, finishCheck);
3075 application.SendNotification();
3076 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3078 // We didn't expect the animation to finish yet
3079 application.SendNotification();
3080 finishCheck.CheckSignalNotReceived();
3081 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION );
3083 application.SendNotification();
3084 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3086 // We did expect the animation to finish
3087 application.SendNotification();
3088 finishCheck.CheckSignalReceived();
3089 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3091 // Check that nothing has changed after a couple of buffer swaps
3092 application.Render(0);
3093 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3094 application.Render(0);
3095 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3099 int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void)
3101 TestApplication application;
3103 Actor actor = Actor::New();
3105 // Register a Vector2 property
3106 Vector2 startValue(100.0f, 100.0f);
3107 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3108 Stage::GetCurrent().Add(actor);
3109 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3111 // Build the animation
3112 float durationSeconds(1.0f);
3113 Animation animation = Animation::New(durationSeconds);
3114 Vector2 targetValue(20.0f, 20.0f);
3115 Vector2 relativeValue(targetValue - startValue);
3116 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3118 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3120 // Start the animation
3123 bool signalReceived(false);
3124 AnimationFinishCheck finishCheck(signalReceived);
3125 animation.FinishedSignal().Connect(&application, finishCheck);
3127 application.SendNotification();
3128 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3130 // We didn't expect the animation to finish yet
3131 application.SendNotification();
3132 finishCheck.CheckSignalNotReceived();
3134 // The position should have moved more, than with a linear alpha function
3135 Vector2 current(actor.GetProperty<Vector2>(index));
3136 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3137 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3139 application.SendNotification();
3140 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3142 // We did expect the animation to finish
3143 application.SendNotification();
3144 finishCheck.CheckSignalReceived();
3145 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3147 // Check that nothing has changed after a couple of buffer swaps
3148 application.Render(0);
3149 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3150 application.Render(0);
3151 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3155 int UtcDaliAnimationAnimateByVector2TimePeriodP(void)
3157 TestApplication application;
3159 Actor actor = Actor::New();
3161 // Register a Vector2 property
3162 Vector2 startValue(10.0f, 10.0f);
3163 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3164 Stage::GetCurrent().Add(actor);
3165 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3167 // Build the animation
3168 float durationSeconds(1.0f);
3169 Animation animation = Animation::New(durationSeconds);
3170 Vector2 targetValue(30.0f, 30.0f);
3171 Vector2 relativeValue(targetValue - startValue);
3173 animation.AnimateBy(Property(actor, index),
3175 TimePeriod(delay, durationSeconds - delay));
3177 // Start the animation
3180 bool signalReceived(false);
3181 AnimationFinishCheck finishCheck(signalReceived);
3182 animation.FinishedSignal().Connect(&application, finishCheck);
3184 application.SendNotification();
3185 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3187 // We didn't expect the animation to finish yet
3188 application.SendNotification();
3189 finishCheck.CheckSignalNotReceived();
3190 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3192 application.SendNotification();
3193 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3195 // We didn't expect the animation to finish yet
3196 application.SendNotification();
3197 finishCheck.CheckSignalNotReceived();
3198 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3200 application.SendNotification();
3201 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3203 // We did expect the animation to finish
3204 application.SendNotification();
3205 finishCheck.CheckSignalReceived();
3206 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3208 // Check that nothing has changed after a couple of buffer swaps
3209 application.Render(0);
3210 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3211 application.Render(0);
3212 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3216 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void)
3218 TestApplication application;
3220 Actor actor = Actor::New();
3222 // Register a Vector2 property
3223 Vector2 startValue(5.0f, 5.0f);
3224 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3225 Stage::GetCurrent().Add(actor);
3226 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3228 // Build the animation
3229 float durationSeconds(1.0f);
3230 Animation animation = Animation::New(durationSeconds);
3231 Vector2 targetValue(10.0f, 10.0f);
3232 Vector2 relativeValue(targetValue - startValue);
3234 animation.AnimateBy(Property(actor, index),
3236 AlphaFunction::LINEAR,
3237 TimePeriod(delay, durationSeconds - delay));
3239 // Start the animation
3242 bool signalReceived(false);
3243 AnimationFinishCheck finishCheck(signalReceived);
3244 animation.FinishedSignal().Connect(&application, finishCheck);
3246 application.SendNotification();
3247 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3249 // We didn't expect the animation to finish yet
3250 application.SendNotification();
3251 finishCheck.CheckSignalNotReceived();
3252 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3254 application.SendNotification();
3255 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3257 // We didn't expect the animation to finish yet
3258 application.SendNotification();
3259 finishCheck.CheckSignalNotReceived();
3260 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3262 application.SendNotification();
3263 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3265 // We did expect the animation to finish
3266 application.SendNotification();
3267 finishCheck.CheckSignalReceived();
3268 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3270 // Check that nothing has changed after a couple of buffer swaps
3271 application.Render(0);
3272 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3273 application.Render(0);
3274 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3278 int UtcDaliAnimationAnimateByVector3P(void)
3280 TestApplication application;
3282 Actor actor = Actor::New();
3284 // Register a Vector3 property
3285 Vector3 startValue(10.0f, 10.0f, 10.0f);
3286 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3287 Stage::GetCurrent().Add(actor);
3288 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3290 // Build the animation
3291 float durationSeconds(2.0f);
3292 Animation animation = Animation::New(durationSeconds);
3293 Vector3 targetValue(60.0f, 60.0f, 60.0f);
3294 Vector3 relativeValue(targetValue - startValue);
3295 animation.AnimateBy(Property(actor, index), relativeValue);
3297 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3299 // Start the animation
3302 bool signalReceived(false);
3303 AnimationFinishCheck finishCheck(signalReceived);
3304 animation.FinishedSignal().Connect(&application, finishCheck);
3306 application.SendNotification();
3307 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3309 // We didn't expect the animation to finish yet
3310 application.SendNotification();
3311 finishCheck.CheckSignalNotReceived();
3312 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION );
3314 application.SendNotification();
3315 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3317 // We did expect the animation to finish
3318 application.SendNotification();
3319 finishCheck.CheckSignalReceived();
3320 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3322 // Check that nothing has changed after a couple of buffer swaps
3323 application.Render(0);
3324 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3325 application.Render(0);
3326 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3330 int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void)
3332 TestApplication application;
3334 Actor actor = Actor::New();
3336 // Register a Vector3 property
3337 Vector3 startValue(100.0f, 100.0f, 100.0f);
3338 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3339 Stage::GetCurrent().Add(actor);
3340 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3342 // Build the animation
3343 float durationSeconds(1.0f);
3344 Animation animation = Animation::New(durationSeconds);
3345 Vector3 targetValue(20.0f, 20.0f, 20.0f);
3346 Vector3 relativeValue(targetValue - startValue);
3347 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3349 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3351 // Start the animation
3354 bool signalReceived(false);
3355 AnimationFinishCheck finishCheck(signalReceived);
3356 animation.FinishedSignal().Connect(&application, finishCheck);
3358 application.SendNotification();
3359 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3361 // We didn't expect the animation to finish yet
3362 application.SendNotification();
3363 finishCheck.CheckSignalNotReceived();
3365 // The position should have moved more, than with a linear alpha function
3366 Vector3 current(actor.GetProperty<Vector3>(index));
3367 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3368 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3369 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
3371 application.SendNotification();
3372 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3374 // We did expect the animation to finish
3375 application.SendNotification();
3376 finishCheck.CheckSignalReceived();
3377 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3379 // Check that nothing has changed after a couple of buffer swaps
3380 application.Render(0);
3381 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3382 application.Render(0);
3383 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3387 int UtcDaliAnimationAnimateByVector3TimePeriodP(void)
3389 TestApplication application;
3391 Actor actor = Actor::New();
3393 // Register a Vector3 property
3394 Vector3 startValue(10.0f, 10.0f, 10.0f);
3395 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3396 Stage::GetCurrent().Add(actor);
3397 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3399 // Build the animation
3400 float durationSeconds(1.0f);
3401 Animation animation = Animation::New(durationSeconds);
3402 Vector3 targetValue(30.0f, 30.0f, 30.0f);
3403 Vector3 relativeValue(targetValue - startValue);
3405 animation.AnimateBy(Property(actor, index),
3407 TimePeriod(delay, durationSeconds - delay));
3409 // Start the animation
3412 bool signalReceived(false);
3413 AnimationFinishCheck finishCheck(signalReceived);
3414 animation.FinishedSignal().Connect(&application, finishCheck);
3416 application.SendNotification();
3417 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3419 // We didn't expect the animation to finish yet
3420 application.SendNotification();
3421 finishCheck.CheckSignalNotReceived();
3422 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3424 application.SendNotification();
3425 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3427 // We didn't expect the animation to finish yet
3428 application.SendNotification();
3429 finishCheck.CheckSignalNotReceived();
3430 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3432 application.SendNotification();
3433 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3435 // We did expect the animation to finish
3436 application.SendNotification();
3437 finishCheck.CheckSignalReceived();
3438 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3440 // Check that nothing has changed after a couple of buffer swaps
3441 application.Render(0);
3442 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3443 application.Render(0);
3444 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3448 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void)
3450 TestApplication application;
3452 Actor actor = Actor::New();
3454 // Register a Vector3 property
3455 Vector3 startValue(5.0f, 5.0f, 5.0f);
3456 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3457 Stage::GetCurrent().Add(actor);
3458 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3460 // Build the animation
3461 float durationSeconds(1.0f);
3462 Animation animation = Animation::New(durationSeconds);
3463 Vector3 targetValue(10.0f, 10.0f, 10.0f);
3464 Vector3 relativeValue(targetValue - startValue);
3466 animation.AnimateBy(Property(actor, index),
3468 AlphaFunction::LINEAR,
3469 TimePeriod(delay, durationSeconds - delay));
3471 // Start the animation
3474 bool signalReceived(false);
3475 AnimationFinishCheck finishCheck(signalReceived);
3476 animation.FinishedSignal().Connect(&application, finishCheck);
3478 application.SendNotification();
3479 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3481 // We didn't expect the animation to finish yet
3482 application.SendNotification();
3483 finishCheck.CheckSignalNotReceived();
3484 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3486 application.SendNotification();
3487 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3489 // We didn't expect the animation to finish yet
3490 application.SendNotification();
3491 finishCheck.CheckSignalNotReceived();
3492 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3494 application.SendNotification();
3495 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3497 // We did expect the animation to finish
3498 application.SendNotification();
3499 finishCheck.CheckSignalReceived();
3500 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3502 // Check that nothing has changed after a couple of buffer swaps
3503 application.Render(0);
3504 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3505 application.Render(0);
3506 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3510 int UtcDaliAnimationAnimateByVector4P(void)
3512 TestApplication application;
3514 Actor actor = Actor::New();
3516 // Register a Vector4 property
3517 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
3518 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3519 Stage::GetCurrent().Add(actor);
3520 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3522 // Build the animation
3523 float durationSeconds(2.0f);
3524 Animation animation = Animation::New(durationSeconds);
3525 Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f);
3526 Vector4 relativeValue(targetValue - startValue);
3527 animation.AnimateBy(Property(actor, index), relativeValue);
3529 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3531 // Start the animation
3534 bool signalReceived(false);
3535 AnimationFinishCheck finishCheck(signalReceived);
3536 animation.FinishedSignal().Connect(&application, finishCheck);
3538 application.SendNotification();
3539 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3541 // We didn't expect the animation to finish yet
3542 application.SendNotification();
3543 finishCheck.CheckSignalNotReceived();
3544 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION );
3546 application.SendNotification();
3547 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3549 // We did expect the animation to finish
3550 application.SendNotification();
3551 finishCheck.CheckSignalReceived();
3552 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3554 // Check that nothing has changed after a couple of buffer swaps
3555 application.Render(0);
3556 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3557 application.Render(0);
3558 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3562 int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void)
3564 TestApplication application;
3566 Actor actor = Actor::New();
3568 // Register a Vector4 property
3569 Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f);
3570 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3571 Stage::GetCurrent().Add(actor);
3572 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3574 // Build the animation
3575 float durationSeconds(1.0f);
3576 Animation animation = Animation::New(durationSeconds);
3577 Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
3578 Vector4 relativeValue(targetValue - startValue);
3579 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3581 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3583 // Start the animation
3586 bool signalReceived(false);
3587 AnimationFinishCheck finishCheck(signalReceived);
3588 animation.FinishedSignal().Connect(&application, finishCheck);
3590 application.SendNotification();
3591 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3593 // We didn't expect the animation to finish yet
3594 application.SendNotification();
3595 finishCheck.CheckSignalNotReceived();
3597 // The position should have moved more, than with a linear alpha function
3598 Vector4 current(actor.GetProperty<Vector4>(index));
3599 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3600 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3601 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
3602 DALI_TEST_CHECK( current.w < ninetyFivePercentProgress.w );
3604 application.SendNotification();
3605 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3607 // We did expect the animation to finish
3608 application.SendNotification();
3609 finishCheck.CheckSignalReceived();
3610 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3612 // Check that nothing has changed after a couple of buffer swaps
3613 application.Render(0);
3614 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3615 application.Render(0);
3616 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3620 int UtcDaliAnimationAnimateByVector4TimePeriodP(void)
3622 TestApplication application;
3624 Actor actor = Actor::New();
3626 // Register a Vector4 property
3627 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
3628 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3629 Stage::GetCurrent().Add(actor);
3630 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3632 // Build the animation
3633 float durationSeconds(1.0f);
3634 Animation animation = Animation::New(durationSeconds);
3635 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
3636 Vector4 relativeValue(targetValue - startValue);
3638 animation.AnimateBy(Property(actor, index),
3640 TimePeriod(delay, durationSeconds - delay));
3642 // Start the animation
3645 bool signalReceived(false);
3646 AnimationFinishCheck finishCheck(signalReceived);
3647 animation.FinishedSignal().Connect(&application, finishCheck);
3649 application.SendNotification();
3650 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3652 // We didn't expect the animation to finish yet
3653 application.SendNotification();
3654 finishCheck.CheckSignalNotReceived();
3655 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3657 application.SendNotification();
3658 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3660 // We didn't expect the animation to finish yet
3661 application.SendNotification();
3662 finishCheck.CheckSignalNotReceived();
3663 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3665 application.SendNotification();
3666 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3668 // We did expect the animation to finish
3669 application.SendNotification();
3670 finishCheck.CheckSignalReceived();
3671 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3673 // Check that nothing has changed after a couple of buffer swaps
3674 application.Render(0);
3675 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3676 application.Render(0);
3677 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3681 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void)
3683 TestApplication application;
3685 Actor actor = Actor::New();
3687 // Register a Vector4 property
3688 Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f);
3689 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3690 Stage::GetCurrent().Add(actor);
3691 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3693 // Build the animation
3694 float durationSeconds(1.0f);
3695 Animation animation = Animation::New(durationSeconds);
3696 Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f);
3697 Vector4 relativeValue(targetValue - startValue);
3699 animation.AnimateBy(Property(actor, index),
3701 AlphaFunction::LINEAR,
3702 TimePeriod(delay, durationSeconds - delay));
3704 // Start the animation
3707 bool signalReceived(false);
3708 AnimationFinishCheck finishCheck(signalReceived);
3709 animation.FinishedSignal().Connect(&application, finishCheck);
3711 application.SendNotification();
3712 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3714 // We didn't expect the animation to finish yet
3715 application.SendNotification();
3716 finishCheck.CheckSignalNotReceived();
3717 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3719 application.SendNotification();
3720 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3722 // We didn't expect the animation to finish yet
3723 application.SendNotification();
3724 finishCheck.CheckSignalNotReceived();
3725 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3727 application.SendNotification();
3728 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3730 // We did expect the animation to finish
3731 application.SendNotification();
3732 finishCheck.CheckSignalReceived();
3733 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3735 // Check that nothing has changed after a couple of buffer swaps
3736 application.Render(0);
3737 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3738 application.Render(0);
3739 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3743 int UtcDaliAnimationAnimateByActorPositionP(void)
3745 TestApplication application;
3747 Actor actor = Actor::New();
3748 Vector3 startPosition(10.0f, 10.0f, 10.0f);
3749 actor.SetPosition(startPosition);
3750 Stage::GetCurrent().Add(actor);
3751 application.SendNotification();
3752 application.Render(0);
3753 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
3755 // Build the animation
3756 float durationSeconds(1.0f);
3757 Animation animation = Animation::New(durationSeconds);
3758 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
3759 Vector3 relativePosition(targetPosition - startPosition);
3760 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition);
3762 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
3764 // Start the animation
3767 bool signalReceived(false);
3768 AnimationFinishCheck finishCheck(signalReceived);
3769 animation.FinishedSignal().Connect(&application, finishCheck);
3771 application.SendNotification();
3772 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3774 // We didn't expect the animation to finish yet
3775 application.SendNotification();
3776 finishCheck.CheckSignalNotReceived();
3777 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ninetyFivePercentProgress, TEST_LOCATION );
3779 application.SendNotification();
3780 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3782 // We did expect the animation to finish
3783 application.SendNotification();
3784 finishCheck.CheckSignalReceived();
3785 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3787 // Check that nothing has changed after a couple of buffer swaps
3788 application.Render(0);
3789 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3790 application.Render(0);
3791 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3795 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
3797 TestApplication application;
3799 Actor actor = Actor::New();
3800 Vector3 startPosition(10.0f, 10.0f, 10.0f);
3801 actor.SetPosition(startPosition);
3802 Stage::GetCurrent().Add(actor);
3803 application.SendNotification();
3804 application.Render(0);
3805 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
3807 // Build the animation
3808 float durationSeconds(1.0f);
3809 Animation animation = Animation::New(durationSeconds);
3810 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
3811 Vector3 relativePosition(targetPosition - startPosition);
3812 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
3814 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
3816 // Start the animation
3819 bool signalReceived(false);
3820 AnimationFinishCheck finishCheck(signalReceived);
3821 animation.FinishedSignal().Connect(&application, finishCheck);
3823 application.SendNotification();
3824 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3826 // We didn't expect the animation to finish yet
3827 application.SendNotification();
3828 finishCheck.CheckSignalNotReceived();
3830 // The position should have moved more, than with a linear alpha function
3831 Vector3 current(actor.GetCurrentPosition());
3832 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
3833 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
3834 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
3836 application.SendNotification();
3837 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3839 // We did expect the animation to finish
3840 application.SendNotification();
3841 finishCheck.CheckSignalReceived();
3842 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3844 // Check that nothing has changed after a couple of buffer swaps
3845 application.Render(0);
3846 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3847 application.Render(0);
3848 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3852 int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void)
3854 TestApplication application;
3856 Actor actor = Actor::New();
3857 Vector3 startPosition(10.0f, 10.0f, 10.0f);
3858 actor.SetPosition(startPosition);
3859 Stage::GetCurrent().Add(actor);
3860 application.SendNotification();
3861 application.Render(0);
3862 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
3864 // Build the animation
3865 float durationSeconds(1.0f);
3866 Animation animation = Animation::New(durationSeconds);
3867 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
3868 Vector3 relativePosition(targetPosition - startPosition);
3870 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
3872 TimePeriod(delay, durationSeconds - delay));
3874 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
3876 // Start the animation
3879 bool signalReceived(false);
3880 AnimationFinishCheck finishCheck(signalReceived);
3881 animation.FinishedSignal().Connect(&application, finishCheck);
3883 application.SendNotification();
3884 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3886 // We didn't expect the animation to finish yet
3887 application.SendNotification();
3888 finishCheck.CheckSignalNotReceived();
3889 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
3891 application.SendNotification();
3892 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
3894 // We did expect the animation to finish
3895 application.SendNotification();
3896 finishCheck.CheckSignalReceived();
3897 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3899 // Check that nothing has changed after a couple of buffer swaps
3900 application.Render(0);
3901 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3902 application.Render(0);
3903 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3907 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void)
3909 TestApplication application;
3911 Actor actor = Actor::New();
3912 Vector3 startPosition(10.0f, 10.0f, 10.0f);
3913 actor.SetPosition(startPosition);
3914 Stage::GetCurrent().Add(actor);
3915 application.SendNotification();
3916 application.Render(0);
3917 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
3919 // Build the animation
3920 float durationSeconds(1.0f);
3921 Animation animation = Animation::New(durationSeconds);
3922 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
3923 Vector3 relativePosition(targetPosition - startPosition);
3925 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
3927 AlphaFunction::LINEAR,
3928 TimePeriod(delay, durationSeconds - delay));
3930 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
3932 // Start the animation
3935 bool signalReceived(false);
3936 AnimationFinishCheck finishCheck(signalReceived);
3937 animation.FinishedSignal().Connect(&application, finishCheck);
3939 application.SendNotification();
3940 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3942 // We didn't expect the animation to finish yet
3943 application.SendNotification();
3944 finishCheck.CheckSignalNotReceived();
3945 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
3947 application.SendNotification();
3948 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
3950 // We did expect the animation to finish
3951 application.SendNotification();
3952 finishCheck.CheckSignalReceived();
3953 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3955 // Check that nothing has changed after a couple of buffer swaps
3956 application.Render(0);
3957 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3958 application.Render(0);
3959 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3963 int UtcDaliAnimationAnimateByActorOrientationP(void)
3965 TestApplication application;
3967 Actor actor = Actor::New();
3968 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
3969 Stage::GetCurrent().Add(actor);
3970 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
3972 // Build the animation
3973 float durationSeconds(1.0f);
3974 Animation animation = Animation::New(durationSeconds);
3975 Degree relativeRotationDegrees(360.0f);
3976 Radian relativeRotationRadians(relativeRotationDegrees);
3977 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ) );
3979 // Start the animation
3982 bool signalReceived(false);
3983 AnimationFinishCheck finishCheck(signalReceived);
3984 animation.FinishedSignal().Connect(&application, finishCheck);
3986 application.SendNotification();
3987 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
3989 // We didn't expect the animation to finish yet
3990 application.SendNotification();
3991 finishCheck.CheckSignalNotReceived();
3992 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
3994 application.SendNotification();
3995 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
3997 // We didn't expect the animation to finish yet
3998 application.SendNotification();
3999 finishCheck.CheckSignalNotReceived();
4000 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4002 application.SendNotification();
4003 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4005 // We didn't expect the animation to finish yet
4006 application.SendNotification();
4007 finishCheck.CheckSignalNotReceived();
4008 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4010 application.SendNotification();
4011 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4013 // We did expect the animation to finish
4014 application.SendNotification();
4015 finishCheck.CheckSignalReceived();
4016 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4020 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
4022 TestApplication application;
4024 Actor actor = Actor::New();
4025 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4026 Stage::GetCurrent().Add(actor);
4027 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4029 // Build the animation
4030 float durationSeconds(1.0f);
4031 Animation animation = Animation::New(durationSeconds);
4032 Degree relativeRotationDegrees(360.0f);
4033 Radian relativeRotationRadians(relativeRotationDegrees);
4034 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ), AlphaFunction::EASE_IN );
4036 // Start the animation
4039 bool signalReceived(false);
4040 AnimationFinishCheck finishCheck(signalReceived);
4041 animation.FinishedSignal().Connect(&application, finishCheck);
4043 application.SendNotification();
4044 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4046 // We didn't expect the animation to finish yet
4047 application.SendNotification();
4048 finishCheck.CheckSignalNotReceived();
4049 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4051 application.SendNotification();
4052 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4054 // We didn't expect the animation to finish yet
4055 application.SendNotification();
4056 finishCheck.CheckSignalNotReceived();
4057 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4059 application.SendNotification();
4060 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4062 // We didn't expect the animation to finish yet
4063 application.SendNotification();
4064 finishCheck.CheckSignalNotReceived();
4065 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4067 application.SendNotification();
4068 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4070 // We did expect the animation to finish
4071 application.SendNotification();
4072 finishCheck.CheckSignalReceived();
4073 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4077 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void)
4079 TestApplication application;
4081 Actor actor = Actor::New();
4082 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4083 Stage::GetCurrent().Add(actor);
4084 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4086 // Build the animation
4087 float durationSeconds(1.0f);
4088 Animation animation = Animation::New(durationSeconds);
4089 Degree relativeRotationDegrees(360.0f);
4090 Radian relativeRotationRadians(relativeRotationDegrees);
4092 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ),
4093 AlphaFunction::EASE_IN, TimePeriod( delay, durationSeconds - delay ) );
4095 // Start the animation
4098 bool signalReceived(false);
4099 AnimationFinishCheck finishCheck(signalReceived);
4100 animation.FinishedSignal().Connect(&application, finishCheck);
4102 application.SendNotification();
4103 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4105 // We didn't expect the animation to finish yet
4106 application.SendNotification();
4107 finishCheck.CheckSignalNotReceived();
4108 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
4109 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4111 application.SendNotification();
4112 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4114 // We didn't expect the animation to finish yet
4115 application.SendNotification();
4116 finishCheck.CheckSignalNotReceived();
4117 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
4118 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4120 application.SendNotification();
4121 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4123 // We didn't expect the animation to finish yet
4124 application.SendNotification();
4125 finishCheck.CheckSignalNotReceived();
4126 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
4127 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4129 application.SendNotification();
4130 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4132 // We did expect the animation to finish
4133 application.SendNotification();
4134 finishCheck.CheckSignalReceived();
4135 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4139 int UtcDaliAnimationAnimateByActorScaleP(void)
4141 TestApplication application;
4143 Actor actor = Actor::New();
4144 Stage::GetCurrent().Add(actor);
4145 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4147 // Build the animation
4148 float durationSeconds(1.0f);
4149 Animation animation = Animation::New(durationSeconds);
4150 Vector3 targetScale(2.0f, 2.0f, 2.0f);
4151 Vector3 relativeScale(targetScale - Vector3::ONE);
4152 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), Vector3( relativeScale.x, relativeScale.y, relativeScale.z ) );
4154 Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale*0.99f);
4156 // Start the animation
4159 bool signalReceived(false);
4160 AnimationFinishCheck finishCheck(signalReceived);
4161 animation.FinishedSignal().Connect(&application, finishCheck);
4163 application.SendNotification();
4164 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4166 // We didn't expect the animation to finish yet
4167 application.SendNotification();
4168 finishCheck.CheckSignalNotReceived();
4169 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
4171 application.SendNotification();
4172 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4174 // We did expect the animation to finish
4175 application.SendNotification();
4176 finishCheck.CheckSignalReceived();
4177 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4180 finishCheck.Reset();
4181 actor.SetScale(Vector3::ONE);
4182 application.SendNotification();
4183 application.Render(0);
4184 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4186 // Repeat with a different (ease-in) alpha function
4187 animation = Animation::New(durationSeconds);
4188 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::EASE_IN );
4189 animation.FinishedSignal().Connect(&application, finishCheck);
4192 application.SendNotification();
4193 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4195 // We didn't expect the animation to finish yet
4196 application.SendNotification();
4197 finishCheck.CheckSignalNotReceived();
4199 // The scale should have grown less, than with a linear alpha function
4200 Vector3 current(actor.GetCurrentScale());
4201 DALI_TEST_CHECK( current.x > 1.0f );
4202 DALI_TEST_CHECK( current.y > 1.0f );
4203 DALI_TEST_CHECK( current.z > 1.0f );
4204 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
4205 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
4206 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
4208 application.SendNotification();
4209 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4211 // We did expect the animation to finish
4212 application.SendNotification();
4213 finishCheck.CheckSignalReceived();
4214 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4217 finishCheck.Reset();
4218 actor.SetScale(Vector3::ONE);
4219 application.SendNotification();
4220 application.Render(0);
4221 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4223 // Repeat with a delay
4225 animation = Animation::New(durationSeconds);
4226 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
4227 animation.FinishedSignal().Connect(&application, finishCheck);
4230 application.SendNotification();
4231 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4233 // We didn't expect the animation to finish yet
4234 application.SendNotification();
4235 finishCheck.CheckSignalNotReceived();
4236 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4238 application.SendNotification();
4239 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4241 // We did expect the animation to finish
4242 application.SendNotification();
4243 finishCheck.CheckSignalReceived();
4244 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4248 int UtcDaliAnimationAnimateToBooleanP(void)
4250 TestApplication application;
4252 Actor actor = Actor::New();
4254 // Register a boolean property
4255 const bool startValue(false);
4256 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4257 Stage::GetCurrent().Add(actor);
4258 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4260 // Build the animation
4261 float durationSeconds(2.0f);
4262 Animation animation = Animation::New(durationSeconds);
4263 const bool targetValue( !startValue );
4264 animation.AnimateTo(Property(actor, index), targetValue);
4266 // Start the animation
4269 bool signalReceived(false);
4270 AnimationFinishCheck finishCheck(signalReceived);
4271 animation.FinishedSignal().Connect(&application, finishCheck);
4273 application.SendNotification();
4274 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4276 // We didn't expect the animation to finish yet
4277 application.SendNotification();
4278 finishCheck.CheckSignalNotReceived();
4279 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4281 application.SendNotification();
4282 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4284 // We did expect the animation to finish
4285 application.SendNotification();
4286 finishCheck.CheckSignalReceived();
4287 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4289 // Check that nothing has changed after a couple of buffer swaps
4290 application.Render(0);
4291 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4292 application.Render(0);
4293 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4295 // Repeat with target value "false"
4296 animation = Animation::New(durationSeconds);
4297 const bool finalValue( !targetValue );
4298 animation.AnimateTo(Property(actor, index), finalValue);
4300 // Start the animation
4303 finishCheck.Reset();
4304 animation.FinishedSignal().Connect(&application, finishCheck);
4306 application.SendNotification();
4307 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4309 // We didn't expect the animation to finish yet
4310 application.SendNotification();
4311 finishCheck.CheckSignalNotReceived();
4312 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4314 application.SendNotification();
4315 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4317 // We did expect the animation to finish
4318 application.SendNotification();
4319 finishCheck.CheckSignalReceived();
4320 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4322 // Check that nothing has changed after a couple of buffer swaps
4323 application.Render(0);
4324 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4325 application.Render(0);
4326 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4330 int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void)
4332 TestApplication application;
4334 Actor actor = Actor::New();
4336 // Register a boolean property
4337 const bool startValue(false);
4338 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4339 Stage::GetCurrent().Add(actor);
4340 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4342 // Build the animation
4343 float durationSeconds(2.0f);
4344 Animation animation = Animation::New(durationSeconds);
4345 const bool targetValue( !startValue );
4346 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
4348 // Start the animation
4351 bool signalReceived(false);
4352 AnimationFinishCheck finishCheck(signalReceived);
4353 animation.FinishedSignal().Connect(&application, finishCheck);
4355 application.SendNotification();
4356 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4358 // We didn't expect the animation to finish yet
4359 application.SendNotification();
4360 finishCheck.CheckSignalNotReceived();
4361 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4363 application.SendNotification();
4364 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4366 // We did expect the animation to finish
4367 application.SendNotification();
4368 finishCheck.CheckSignalReceived();
4369 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4371 // Check that nothing has changed after a couple of buffer swaps
4372 application.Render(0);
4373 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4374 application.Render(0);
4375 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4377 // Repeat with target value "false"
4378 animation = Animation::New(durationSeconds);
4379 const bool finalValue( !targetValue );
4380 animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
4382 // Start the animation
4385 finishCheck.Reset();
4386 animation.FinishedSignal().Connect(&application, finishCheck);
4388 application.SendNotification();
4389 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4391 // We didn't expect the animation to finish yet
4392 application.SendNotification();
4393 finishCheck.CheckSignalNotReceived();
4394 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4396 application.SendNotification();
4397 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4399 // We did expect the animation to finish
4400 application.SendNotification();
4401 finishCheck.CheckSignalReceived();
4402 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4404 // Check that nothing has changed after a couple of buffer swaps
4405 application.Render(0);
4406 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4407 application.Render(0);
4408 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4412 int UtcDaliAnimationAnimateToBooleanTimePeriodP(void)
4414 TestApplication application;
4416 Actor actor = Actor::New();
4418 // Register a boolean property
4419 bool startValue(false);
4420 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4421 Stage::GetCurrent().Add(actor);
4422 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4424 // Build the animation
4425 float durationSeconds(2.0f);
4426 Animation animation = Animation::New(durationSeconds);
4427 bool finalValue( !startValue );
4428 float animatorDurationSeconds(durationSeconds * 0.5f);
4429 animation.AnimateTo( Property(actor, index),
4431 TimePeriod( animatorDurationSeconds ) );
4433 // Start the animation
4436 bool signalReceived(false);
4437 AnimationFinishCheck finishCheck(signalReceived);
4438 animation.FinishedSignal().Connect(&application, finishCheck);
4440 application.SendNotification();
4441 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
4443 // We didn't expect the animation to finish yet
4444 application.SendNotification();
4445 finishCheck.CheckSignalNotReceived();
4446 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4448 application.SendNotification();
4449 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
4451 // We didn't expect the animation to finish yet...
4452 application.SendNotification();
4453 finishCheck.CheckSignalNotReceived();
4455 // ...however we should have reached the final value
4456 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4458 application.SendNotification();
4459 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
4461 // We did expect the animation to finish
4462 application.SendNotification();
4463 finishCheck.CheckSignalReceived();
4464 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4466 // Check that nothing has changed after a couple of buffer swaps
4467 application.Render(0);
4468 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4469 application.Render(0);
4470 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4474 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void)
4476 TestApplication application;
4478 Actor actor = Actor::New();
4480 // Register a boolean property
4481 bool startValue(false);
4482 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4483 Stage::GetCurrent().Add(actor);
4484 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4486 // Build the animation
4487 float durationSeconds(2.0f);
4488 Animation animation = Animation::New(durationSeconds);
4489 bool finalValue( !startValue );
4490 float animatorDurationSeconds(durationSeconds * 0.5f);
4491 animation.AnimateTo( Property(actor, index),
4493 AlphaFunction::LINEAR,
4494 TimePeriod( animatorDurationSeconds ) );
4496 // Start the animation
4499 bool signalReceived(false);
4500 AnimationFinishCheck finishCheck(signalReceived);
4501 animation.FinishedSignal().Connect(&application, finishCheck);
4503 application.SendNotification();
4504 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
4506 // We didn't expect the animation to finish yet
4507 application.SendNotification();
4508 finishCheck.CheckSignalNotReceived();
4509 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4511 application.SendNotification();
4512 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
4514 // We didn't expect the animation to finish yet...
4515 application.SendNotification();
4516 finishCheck.CheckSignalNotReceived();
4518 // ...however we should have reached the final value
4519 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4521 application.SendNotification();
4522 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
4524 // We did expect the animation to finish
4525 application.SendNotification();
4526 finishCheck.CheckSignalReceived();
4527 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4529 // Check that nothing has changed after a couple of buffer swaps
4530 application.Render(0);
4531 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4532 application.Render(0);
4533 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4537 int UtcDaliAnimationAnimateToFloatP(void)
4539 TestApplication application;
4541 Actor actor = Actor::New();
4543 // Register a float property
4544 float startValue(10.0f);
4545 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4546 Stage::GetCurrent().Add(actor);
4547 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
4549 // Build the animation
4550 float durationSeconds(2.0f);
4551 Animation animation = Animation::New(durationSeconds);
4552 float targetValue(50.0f);
4553 float relativeValue(targetValue - startValue);
4554 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
4556 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4558 // Start the animation
4561 bool signalReceived(false);
4562 AnimationFinishCheck finishCheck(signalReceived);
4563 animation.FinishedSignal().Connect(&application, finishCheck);
4565 application.SendNotification();
4566 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4568 // We didn't expect the animation to finish yet
4569 application.SendNotification();
4570 finishCheck.CheckSignalNotReceived();
4571 DALI_TEST_EQUALS( actor.GetProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION );
4573 application.SendNotification();
4574 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4576 // We did expect the animation to finish
4577 application.SendNotification();
4578 finishCheck.CheckSignalReceived();
4579 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
4583 int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void)
4585 TestApplication application;
4587 Actor actor = Actor::New();
4589 // Register a float property
4590 float startValue(10.0f);
4591 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4592 Stage::GetCurrent().Add(actor);
4593 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
4595 // Build the animation
4596 float durationSeconds(1.0f);
4597 Animation animation = Animation::New(durationSeconds);
4598 float targetValue(90.0f);
4599 float relativeValue(targetValue - startValue);
4600 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
4602 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4604 // Start the animation
4607 bool signalReceived(false);
4608 AnimationFinishCheck finishCheck(signalReceived);
4609 animation.FinishedSignal().Connect(&application, finishCheck);
4611 application.SendNotification();
4612 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4614 // We didn't expect the animation to finish yet
4615 application.SendNotification();
4616 finishCheck.CheckSignalNotReceived();
4618 // The position should have moved more, than with a linear alpha function
4619 float current(actor.GetProperty<float>(index));
4620 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
4622 application.SendNotification();
4623 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4625 // We did expect the animation to finish
4626 application.SendNotification();
4627 finishCheck.CheckSignalReceived();
4628 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
4632 int UtcDaliAnimationAnimateToFloatTimePeriodP(void)
4634 TestApplication application;
4636 Actor actor = Actor::New();
4638 // Register a float property
4639 float startValue(10.0f);
4640 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4641 Stage::GetCurrent().Add(actor);
4642 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
4644 // Build the animation
4645 float durationSeconds(1.0f);
4646 Animation animation = Animation::New(durationSeconds);
4647 float targetValue(30.0f);
4648 float relativeValue(targetValue - startValue);
4650 animation.AnimateTo(Property(actor, index),
4652 TimePeriod(delay, durationSeconds - delay));
4654 // Start the animation
4657 bool signalReceived(false);
4658 AnimationFinishCheck finishCheck(signalReceived);
4659 animation.FinishedSignal().Connect(&application, finishCheck);
4661 application.SendNotification();
4662 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4664 // We didn't expect the animation to finish yet
4665 application.SendNotification();
4666 finishCheck.CheckSignalNotReceived();
4667 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
4669 application.SendNotification();
4670 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4672 // We didn't expect the animation to finish yet
4673 application.SendNotification();
4674 finishCheck.CheckSignalNotReceived();
4675 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
4677 application.SendNotification();
4678 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4680 // We did expect the animation to finish
4681 application.SendNotification();
4682 finishCheck.CheckSignalReceived();
4683 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
4687 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void)
4689 TestApplication application;
4691 Actor actor = Actor::New();
4693 // Register a float property
4694 float startValue(10.0f);
4695 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4696 Stage::GetCurrent().Add(actor);
4697 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
4699 // Build the animation
4700 float durationSeconds(1.0f);
4701 Animation animation = Animation::New(durationSeconds);
4702 float targetValue(30.0f);
4703 float relativeValue(targetValue - startValue);
4705 animation.AnimateTo(Property(actor, index),
4707 AlphaFunction::LINEAR,
4708 TimePeriod(delay, durationSeconds - delay));
4710 // Start the animation
4713 bool signalReceived(false);
4714 AnimationFinishCheck finishCheck(signalReceived);
4715 animation.FinishedSignal().Connect(&application, finishCheck);
4717 application.SendNotification();
4718 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4720 // We didn't expect the animation to finish yet
4721 application.SendNotification();
4722 finishCheck.CheckSignalNotReceived();
4723 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
4725 application.SendNotification();
4726 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4728 // We didn't expect the animation to finish yet
4729 application.SendNotification();
4730 finishCheck.CheckSignalNotReceived();
4731 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
4733 application.SendNotification();
4734 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4736 // We did expect the animation to finish
4737 application.SendNotification();
4738 finishCheck.CheckSignalReceived();
4739 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
4743 int UtcDaliAnimationAnimateToIntegerP(void)
4745 TestApplication application;
4747 Actor actor = Actor::New();
4749 // Register an integer property
4751 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4752 Stage::GetCurrent().Add(actor);
4753 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
4755 // Build the animation
4756 float durationSeconds(2.0f);
4757 Animation animation = Animation::New(durationSeconds);
4758 int targetValue(50);
4759 int relativeValue(targetValue - startValue);
4760 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
4762 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
4764 // Start the animation
4767 bool signalReceived(false);
4768 AnimationFinishCheck finishCheck(signalReceived);
4769 animation.FinishedSignal().Connect(&application, finishCheck);
4771 application.SendNotification();
4772 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4774 // We didn't expect the animation to finish yet
4775 application.SendNotification();
4776 finishCheck.CheckSignalNotReceived();
4777 DALI_TEST_EQUALS( actor.GetProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION );
4779 application.SendNotification();
4780 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4782 // We did expect the animation to finish
4783 application.SendNotification();
4784 finishCheck.CheckSignalReceived();
4785 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
4789 int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void)
4791 TestApplication application;
4793 Actor actor = Actor::New();
4795 // Register an integer property
4797 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4798 Stage::GetCurrent().Add(actor);
4799 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
4801 // Build the animation
4802 float durationSeconds(1.0f);
4803 Animation animation = Animation::New(durationSeconds);
4804 int targetValue(90);
4805 int relativeValue(targetValue - startValue);
4806 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
4808 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
4810 // Start the animation
4813 bool signalReceived(false);
4814 AnimationFinishCheck finishCheck(signalReceived);
4815 animation.FinishedSignal().Connect(&application, finishCheck);
4817 application.SendNotification();
4818 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4820 // We didn't expect the animation to finish yet
4821 application.SendNotification();
4822 finishCheck.CheckSignalNotReceived();
4824 // The position should have moved more, than with a linear alpha function
4825 int current(actor.GetProperty<int>(index));
4826 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
4828 application.SendNotification();
4829 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4831 // We did expect the animation to finish
4832 application.SendNotification();
4833 finishCheck.CheckSignalReceived();
4834 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
4838 int UtcDaliAnimationAnimateToIntegerTimePeriodP(void)
4840 TestApplication application;
4842 Actor actor = Actor::New();
4844 // Register an integer property
4846 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4847 Stage::GetCurrent().Add(actor);
4848 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
4850 // Build the animation
4851 float durationSeconds(1.0f);
4852 Animation animation = Animation::New(durationSeconds);
4853 int targetValue(30);
4854 int relativeValue(targetValue - startValue);
4856 animation.AnimateTo(Property(actor, index),
4858 TimePeriod(delay, durationSeconds - delay));
4860 // Start the animation
4863 bool signalReceived(false);
4864 AnimationFinishCheck finishCheck(signalReceived);
4865 animation.FinishedSignal().Connect(&application, finishCheck);
4867 application.SendNotification();
4868 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4870 // We didn't expect the animation to finish yet
4871 application.SendNotification();
4872 finishCheck.CheckSignalNotReceived();
4873 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
4875 application.SendNotification();
4876 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4878 // We didn't expect the animation to finish yet
4879 application.SendNotification();
4880 finishCheck.CheckSignalNotReceived();
4881 DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
4883 application.SendNotification();
4884 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4886 // We did expect the animation to finish
4887 application.SendNotification();
4888 finishCheck.CheckSignalReceived();
4889 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
4893 int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void)
4895 TestApplication application;
4897 Actor actor = Actor::New();
4899 // Register an integer property
4901 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4902 Stage::GetCurrent().Add(actor);
4903 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
4905 // Build the animation
4906 float durationSeconds(1.0f);
4907 Animation animation = Animation::New(durationSeconds);
4908 int targetValue(30);
4909 int relativeValue(targetValue - startValue);
4911 animation.AnimateTo(Property(actor, index),
4913 AlphaFunction::LINEAR,
4914 TimePeriod(delay, durationSeconds - delay));
4916 // Start the animation
4919 bool signalReceived(false);
4920 AnimationFinishCheck finishCheck(signalReceived);
4921 animation.FinishedSignal().Connect(&application, finishCheck);
4923 application.SendNotification();
4924 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4926 // We didn't expect the animation to finish yet
4927 application.SendNotification();
4928 finishCheck.CheckSignalNotReceived();
4929 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
4931 application.SendNotification();
4932 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4934 // We didn't expect the animation to finish yet
4935 application.SendNotification();
4936 finishCheck.CheckSignalNotReceived();
4937 DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
4939 application.SendNotification();
4940 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4942 // We did expect the animation to finish
4943 application.SendNotification();
4944 finishCheck.CheckSignalReceived();
4945 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
4949 int UtcDaliAnimationAnimateToVector2P(void)
4951 TestApplication application;
4953 Actor actor = Actor::New();
4955 // Register a Vector2 property
4956 Vector2 startValue(-50.0f, -50.0f);
4957 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4958 Stage::GetCurrent().Add(actor);
4959 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
4961 // Build the animation
4962 float durationSeconds(2.0f);
4963 Animation animation = Animation::New(durationSeconds);
4964 Vector2 targetValue(50.0f, 50.0f);
4965 Vector2 relativeValue(targetValue - startValue);
4966 animation.AnimateTo(Property(actor, index), targetValue);
4968 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4970 // Start the animation
4973 bool signalReceived(false);
4974 AnimationFinishCheck finishCheck(signalReceived);
4975 animation.FinishedSignal().Connect(&application, finishCheck);
4977 application.SendNotification();
4978 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4980 // We didn't expect the animation to finish yet
4981 application.SendNotification();
4982 finishCheck.CheckSignalNotReceived();
4983 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION );
4985 application.SendNotification();
4986 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4988 // We did expect the animation to finish
4989 application.SendNotification();
4990 finishCheck.CheckSignalReceived();
4991 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
4995 int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void)
4997 TestApplication application;
4999 Actor actor = Actor::New();
5001 // Register a Vector2 property
5002 Vector2 startValue(1000.0f, 1000.0f);
5003 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5004 Stage::GetCurrent().Add(actor);
5005 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
5007 // Build the animation
5008 float durationSeconds(1.0f);
5009 Animation animation = Animation::New(durationSeconds);
5010 Vector2 targetValue(9000.0f, 9000.0f);
5011 Vector2 relativeValue(targetValue - startValue);
5012 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
5014 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5016 // Start the animation
5019 bool signalReceived(false);
5020 AnimationFinishCheck finishCheck(signalReceived);
5021 animation.FinishedSignal().Connect(&application, finishCheck);
5023 application.SendNotification();
5024 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5026 // We didn't expect the animation to finish yet
5027 application.SendNotification();
5028 finishCheck.CheckSignalNotReceived();
5030 // The position should have moved more, than with a linear alpha function
5031 Vector2 current(actor.GetProperty<Vector2>(index));
5032 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
5033 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
5035 application.SendNotification();
5036 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5038 // We did expect the animation to finish
5039 application.SendNotification();
5040 finishCheck.CheckSignalReceived();
5041 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
5045 int UtcDaliAnimationAnimateToVector2TimePeriodP(void)
5047 TestApplication application;
5049 Actor actor = Actor::New();
5051 // Register a Vector2 property
5052 Vector2 startValue(10.0f, 10.0f);
5053 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5054 Stage::GetCurrent().Add(actor);
5055 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
5057 // Build the animation
5058 float durationSeconds(1.0f);
5059 Animation animation = Animation::New(durationSeconds);
5060 Vector2 targetValue(-10.0f, 20.0f);
5061 Vector2 relativeValue(targetValue - startValue);
5063 animation.AnimateTo(Property(actor, index),
5065 TimePeriod(delay, durationSeconds - delay));
5067 // Start the animation
5070 bool signalReceived(false);
5071 AnimationFinishCheck finishCheck(signalReceived);
5072 animation.FinishedSignal().Connect(&application, finishCheck);
5074 application.SendNotification();
5075 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5077 // We didn't expect the animation to finish yet
5078 application.SendNotification();
5079 finishCheck.CheckSignalNotReceived();
5080 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
5082 application.SendNotification();
5083 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5085 // We didn't expect the animation to finish yet
5086 application.SendNotification();
5087 finishCheck.CheckSignalNotReceived();
5088 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5090 application.SendNotification();
5091 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5093 // We did expect the animation to finish
5094 application.SendNotification();
5095 finishCheck.CheckSignalReceived();
5096 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
5100 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void)
5102 TestApplication application;
5104 Actor actor = Actor::New();
5106 // Register a Vector2 property
5107 Vector2 startValue(10.0f, 10.0f);
5108 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5109 Stage::GetCurrent().Add(actor);
5110 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
5112 // Build the animation
5113 float durationSeconds(1.0f);
5114 Animation animation = Animation::New(durationSeconds);
5115 Vector2 targetValue(30.0f, 30.0f);
5116 Vector2 relativeValue(targetValue - startValue);
5118 animation.AnimateTo(Property(actor, index),
5120 AlphaFunction::LINEAR,
5121 TimePeriod(delay, durationSeconds - delay));
5123 // Start the animation
5126 bool signalReceived(false);
5127 AnimationFinishCheck finishCheck(signalReceived);
5128 animation.FinishedSignal().Connect(&application, finishCheck);
5130 application.SendNotification();
5131 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5133 // We didn't expect the animation to finish yet
5134 application.SendNotification();
5135 finishCheck.CheckSignalNotReceived();
5136 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
5138 application.SendNotification();
5139 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5141 // We didn't expect the animation to finish yet
5142 application.SendNotification();
5143 finishCheck.CheckSignalNotReceived();
5144 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5146 application.SendNotification();
5147 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5149 // We did expect the animation to finish
5150 application.SendNotification();
5151 finishCheck.CheckSignalReceived();
5152 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
5156 int UtcDaliAnimationAnimateToVector3P(void)
5158 TestApplication application;
5160 Actor actor = Actor::New();
5162 // Register a Vector3 property
5163 Vector3 startValue(-50.0f, -50.0f, -50.0f);
5164 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5165 Stage::GetCurrent().Add(actor);
5166 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5168 // Build the animation
5169 float durationSeconds(2.0f);
5170 Animation animation = Animation::New(durationSeconds);
5171 Vector3 targetValue(50.0f, 50.0f, 50.0f);
5172 Vector3 relativeValue(targetValue - startValue);
5173 animation.AnimateTo(Property(actor, index), targetValue);
5175 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5177 // Start the animation
5180 bool signalReceived(false);
5181 AnimationFinishCheck finishCheck(signalReceived);
5182 animation.FinishedSignal().Connect(&application, finishCheck);
5184 application.SendNotification();
5185 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5187 // We didn't expect the animation to finish yet
5188 application.SendNotification();
5189 finishCheck.CheckSignalNotReceived();
5190 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION );
5192 application.SendNotification();
5193 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5195 // We did expect the animation to finish
5196 application.SendNotification();
5197 finishCheck.CheckSignalReceived();
5198 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
5202 int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void)
5204 TestApplication application;
5206 Actor actor = Actor::New();
5208 // Register a Vector3 property
5209 Vector3 startValue(1000.0f, 1000.0f, 1000.0f);
5210 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5211 Stage::GetCurrent().Add(actor);
5212 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5214 // Build the animation
5215 float durationSeconds(1.0f);
5216 Animation animation = Animation::New(durationSeconds);
5217 Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
5218 Vector3 relativeValue(targetValue - startValue);
5219 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5221 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5223 // Start the animation
5226 bool signalReceived(false);
5227 AnimationFinishCheck finishCheck(signalReceived);
5228 animation.FinishedSignal().Connect(&application, finishCheck);
5230 application.SendNotification();
5231 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5233 // We didn't expect the animation to finish yet
5234 application.SendNotification();
5235 finishCheck.CheckSignalNotReceived();
5237 // The position should have moved more, than with a linear alpha function
5238 Vector3 current(actor.GetProperty<Vector3>(index));
5239 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
5240 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
5241 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
5243 application.SendNotification();
5244 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5246 // We did expect the animation to finish
5247 application.SendNotification();
5248 finishCheck.CheckSignalReceived();
5249 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
5253 int UtcDaliAnimationAnimateToVector3TimePeriodP(void)
5255 TestApplication application;
5257 Actor actor = Actor::New();
5259 // Register a Vector3 property
5260 Vector3 startValue(10.0f, 10.0f, 10.0f);
5261 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5262 Stage::GetCurrent().Add(actor);
5263 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5265 // Build the animation
5266 float durationSeconds(1.0f);
5267 Animation animation = Animation::New(durationSeconds);
5268 Vector3 targetValue(-10.0f, 20.0f, 100.0f);
5269 Vector3 relativeValue(targetValue - startValue);
5271 animation.AnimateTo(Property(actor, index),
5273 TimePeriod(delay, durationSeconds - delay));
5275 // Start the animation
5278 bool signalReceived(false);
5279 AnimationFinishCheck finishCheck(signalReceived);
5280 animation.FinishedSignal().Connect(&application, finishCheck);
5282 application.SendNotification();
5283 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5285 // We didn't expect the animation to finish yet
5286 application.SendNotification();
5287 finishCheck.CheckSignalNotReceived();
5288 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5290 application.SendNotification();
5291 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5293 // We didn't expect the animation to finish yet
5294 application.SendNotification();
5295 finishCheck.CheckSignalNotReceived();
5296 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5298 application.SendNotification();
5299 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5301 // We did expect the animation to finish
5302 application.SendNotification();
5303 finishCheck.CheckSignalReceived();
5304 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
5308 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void)
5310 TestApplication application;
5312 Actor actor = Actor::New();
5314 // Register a Vector3 property
5315 Vector3 startValue(10.0f, 10.0f, 10.0f);
5316 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5317 Stage::GetCurrent().Add(actor);
5318 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5320 // Build the animation
5321 float durationSeconds(1.0f);
5322 Animation animation = Animation::New(durationSeconds);
5323 Vector3 targetValue(30.0f, 30.0f, 30.0f);
5324 Vector3 relativeValue(targetValue - startValue);
5326 animation.AnimateTo(Property(actor, "testProperty"),
5328 AlphaFunction::LINEAR,
5329 TimePeriod(delay, durationSeconds - delay));
5331 // Start the animation
5334 bool signalReceived(false);
5335 AnimationFinishCheck finishCheck(signalReceived);
5336 animation.FinishedSignal().Connect(&application, finishCheck);
5338 application.SendNotification();
5339 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5341 // We didn't expect the animation to finish yet
5342 application.SendNotification();
5343 finishCheck.CheckSignalNotReceived();
5344 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5346 application.SendNotification();
5347 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5349 // We didn't expect the animation to finish yet
5350 application.SendNotification();
5351 finishCheck.CheckSignalNotReceived();
5352 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5354 application.SendNotification();
5355 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5357 // We did expect the animation to finish
5358 application.SendNotification();
5359 finishCheck.CheckSignalReceived();
5360 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
5364 int UtcDaliAnimationAnimateToVector3ComponentP(void)
5366 TestApplication application;
5368 Actor actor = Actor::New();
5370 // Register a Vector3 property
5371 Vector3 startValue(10.0f, 10.0f, 10.0f);
5372 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5373 Stage::GetCurrent().Add(actor);
5374 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5376 // Build the animation
5377 float durationSeconds(1.0f);
5378 Animation animation = Animation::New(durationSeconds);
5379 Vector3 targetValue(30.0f, 30.0f, 10.0f);
5380 Vector3 relativeValue(targetValue - startValue);
5382 animation.AnimateTo(Property(actor, "testProperty", 0),
5384 AlphaFunction::LINEAR,
5385 TimePeriod(delay, durationSeconds - delay));
5386 animation.AnimateTo(Property(actor, index, 1),
5388 AlphaFunction::LINEAR,
5389 TimePeriod(delay, durationSeconds - delay));
5391 // Start the animation
5394 bool signalReceived(false);
5395 AnimationFinishCheck finishCheck(signalReceived);
5396 animation.FinishedSignal().Connect(&application, finishCheck);
5398 application.SendNotification();
5399 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5401 // We didn't expect the animation to finish yet
5402 application.SendNotification();
5403 finishCheck.CheckSignalNotReceived();
5404 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5406 application.SendNotification();
5407 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5409 // We didn't expect the animation to finish yet
5410 application.SendNotification();
5411 finishCheck.CheckSignalNotReceived();
5412 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5414 application.SendNotification();
5415 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5417 // We did expect the animation to finish
5418 application.SendNotification();
5419 finishCheck.CheckSignalReceived();
5420 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
5424 int UtcDaliAnimationAnimateToVector4P(void)
5426 TestApplication application;
5428 Actor actor = Actor::New();
5430 // Register a Vector4 property
5431 Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f);
5432 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5433 Stage::GetCurrent().Add(actor);
5434 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
5436 // Build the animation
5437 float durationSeconds(2.0f);
5438 Animation animation = Animation::New(durationSeconds);
5439 Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f);
5440 Vector4 relativeValue(targetValue - startValue);
5441 animation.AnimateTo(Property(actor, index), targetValue);
5443 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5445 // Start the animation
5448 bool signalReceived(false);
5449 AnimationFinishCheck finishCheck(signalReceived);
5450 animation.FinishedSignal().Connect(&application, finishCheck);
5452 application.SendNotification();
5453 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5455 // We didn't expect the animation to finish yet
5456 application.SendNotification();
5457 finishCheck.CheckSignalNotReceived();
5458 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION );
5460 application.SendNotification();
5461 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5463 // We did expect the animation to finish
5464 application.SendNotification();
5465 finishCheck.CheckSignalReceived();
5466 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
5470 int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void)
5472 TestApplication application;
5474 Actor actor = Actor::New();
5476 // Register a Vector4 property
5477 Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
5478 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5479 Stage::GetCurrent().Add(actor);
5480 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
5482 // Build the animation
5483 float durationSeconds(1.0f);
5484 Animation animation = Animation::New(durationSeconds);
5485 Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
5486 Vector4 relativeValue(targetValue - startValue);
5487 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5489 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5491 // Start the animation
5494 bool signalReceived(false);
5495 AnimationFinishCheck finishCheck(signalReceived);
5496 animation.FinishedSignal().Connect(&application, finishCheck);
5498 application.SendNotification();
5499 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5501 // We didn't expect the animation to finish yet
5502 application.SendNotification();
5503 finishCheck.CheckSignalNotReceived();
5505 // The position should have moved more, than with a linear alpha function
5506 Vector4 current(actor.GetProperty<Vector4>(index));
5507 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
5508 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
5509 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
5510 DALI_TEST_CHECK( current.w > ninetyFivePercentProgress.w );
5512 application.SendNotification();
5513 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5515 // We did expect the animation to finish
5516 application.SendNotification();
5517 finishCheck.CheckSignalReceived();
5518 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
5522 int UtcDaliAnimationAnimateToVector4TimePeriodP(void)
5524 TestApplication application;
5526 Actor actor = Actor::New();
5528 // Register a Vector4 property
5529 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
5530 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5531 Stage::GetCurrent().Add(actor);
5532 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION );
5534 // Build the animation
5535 float durationSeconds(1.0f);
5536 Animation animation = Animation::New(durationSeconds);
5537 Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
5538 Vector4 relativeValue(targetValue - startValue);
5540 animation.AnimateTo(Property(actor, index),
5542 TimePeriod(delay, durationSeconds - delay));
5544 // Start the animation
5547 bool signalReceived(false);
5548 AnimationFinishCheck finishCheck(signalReceived);
5549 animation.FinishedSignal().Connect(&application, finishCheck);
5551 application.SendNotification();
5552 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5554 // We didn't expect the animation to finish yet
5555 application.SendNotification();
5556 finishCheck.CheckSignalNotReceived();
5557 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION );
5559 application.SendNotification();
5560 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5562 // We didn't expect the animation to finish yet
5563 application.SendNotification();
5564 finishCheck.CheckSignalNotReceived();
5565 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), VECTOR4_EPSILON, TEST_LOCATION );
5567 application.SendNotification();
5568 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5570 // We did expect the animation to finish
5571 application.SendNotification();
5572 finishCheck.CheckSignalReceived();
5573 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, VECTOR4_EPSILON, TEST_LOCATION );
5577 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void)
5579 TestApplication application;
5581 Actor actor = Actor::New();
5583 // Register a Vector4 property
5584 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
5585 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5586 Stage::GetCurrent().Add(actor);
5587 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
5589 // Build the animation
5590 float durationSeconds(1.0f);
5591 Animation animation = Animation::New(durationSeconds);
5592 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
5593 Vector4 relativeValue(targetValue - startValue);
5595 animation.AnimateTo(Property(actor, index),
5597 AlphaFunction::LINEAR,
5598 TimePeriod(delay, durationSeconds - delay));
5600 // Start the animation
5603 bool signalReceived(false);
5604 AnimationFinishCheck finishCheck(signalReceived);
5605 animation.FinishedSignal().Connect(&application, finishCheck);
5607 application.SendNotification();
5608 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5610 // We didn't expect the animation to finish yet
5611 application.SendNotification();
5612 finishCheck.CheckSignalNotReceived();
5613 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
5615 application.SendNotification();
5616 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5618 // We didn't expect the animation to finish yet
5619 application.SendNotification();
5620 finishCheck.CheckSignalNotReceived();
5621 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5623 application.SendNotification();
5624 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5626 // We did expect the animation to finish
5627 application.SendNotification();
5628 finishCheck.CheckSignalReceived();
5629 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
5633 int UtcDaliAnimationAnimateToActorParentOriginP(void)
5635 TestApplication application;
5637 Actor actor = Actor::New();
5638 Stage::GetCurrent().Add(actor);
5639 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_LEFT, TEST_LOCATION );
5641 // Build the animation
5642 float durationSeconds(1.0f);
5643 Animation animation = Animation::New(durationSeconds);
5644 Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
5648 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin );
5650 catch (Dali::DaliException& e)
5652 DALI_TEST_PRINT_ASSERT( e );
5653 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5658 int UtcDaliAnimationAnimateToActorParentOriginXP(void)
5660 TestApplication application;
5662 Actor actor = Actor::New();
5663 Stage::GetCurrent().Add(actor);
5664 float startValue(0.0f);
5665 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().x, startValue, TEST_LOCATION );
5666 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION );
5668 // Build the animation
5669 float durationSeconds(1.0f);
5670 Animation animation = Animation::New(durationSeconds);
5671 float targetX(1.0f);
5675 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX );
5677 catch (Dali::DaliException& e)
5679 DALI_TEST_PRINT_ASSERT( e );
5680 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5685 int UtcDaliAnimationAnimateToActorParentOriginYP(void)
5687 TestApplication application;
5689 Actor actor = Actor::New();
5690 Stage::GetCurrent().Add(actor);
5691 float startValue(0.0f);
5692 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().y, startValue, TEST_LOCATION );
5693 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION );
5695 // Build the animation
5696 float durationSeconds(1.0f);
5697 Animation animation = Animation::New(durationSeconds);
5698 float targetY(1.0f);
5702 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY );
5704 catch (Dali::DaliException& e)
5706 DALI_TEST_PRINT_ASSERT( e );
5707 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5712 int UtcDaliAnimationAnimateToActorParentOriginZP(void)
5714 TestApplication application;
5716 Actor actor = Actor::New();
5717 Stage::GetCurrent().Add(actor);
5718 float startValue(0.5f);
5719 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().z, startValue, TEST_LOCATION );
5720 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION );
5722 // Build the animation
5723 float durationSeconds(1.0f);
5724 Animation animation = Animation::New(durationSeconds);
5725 float targetZ(1.0f);
5729 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ );
5731 catch (Dali::DaliException& e)
5733 DALI_TEST_PRINT_ASSERT( e );
5734 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5739 int UtcDaliAnimationAnimateToActorAnchorPointP(void)
5741 TestApplication application;
5743 Actor actor = Actor::New();
5744 Stage::GetCurrent().Add(actor);
5745 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), AnchorPoint::CENTER, TEST_LOCATION );
5747 // Build the animation
5748 float durationSeconds(1.0f);
5749 Animation animation = Animation::New(durationSeconds);
5750 Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT);
5754 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
5756 catch (Dali::DaliException& e)
5758 DALI_TEST_PRINT_ASSERT( e );
5759 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5764 int UtcDaliAnimationAnimateToActorAnchorPointXP(void)
5766 TestApplication application;
5768 Actor actor = Actor::New();
5769 Stage::GetCurrent().Add(actor);
5770 float startValue(0.5f);
5771 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().x, startValue, TEST_LOCATION );
5772 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION );
5774 // Build the animation
5775 float durationSeconds(1.0f);
5776 Animation animation = Animation::New(durationSeconds);
5777 float targetX(1.0f);
5781 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_X), targetX );
5783 catch (Dali::DaliException& e)
5785 DALI_TEST_PRINT_ASSERT( e );
5786 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5791 int UtcDaliAnimationAnimateToActorAnchorPointYP(void)
5793 TestApplication application;
5795 Actor actor = Actor::New();
5796 Stage::GetCurrent().Add(actor);
5797 float startValue(0.5f);
5798 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().y, startValue, TEST_LOCATION );
5799 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION );
5801 // Build the animation
5802 float durationSeconds(1.0f);
5803 Animation animation = Animation::New(durationSeconds);
5804 float targetY(0.0f);
5808 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY );
5810 catch (Dali::DaliException& e)
5812 DALI_TEST_PRINT_ASSERT( e );
5813 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5818 int UtcDaliAnimationAnimateToActorAnchorPointZP(void)
5820 TestApplication application;
5822 Actor actor = Actor::New();
5823 Stage::GetCurrent().Add(actor);
5824 float startValue(0.5f);
5825 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().z, startValue, TEST_LOCATION );
5826 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION );
5828 // Build the animation
5829 float durationSeconds(1.0f);
5830 Animation animation = Animation::New(durationSeconds);
5831 float targetZ(100.0f);
5835 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ );
5837 catch (Dali::DaliException& e)
5839 DALI_TEST_PRINT_ASSERT( e );
5840 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5845 int UtcDaliAnimationAnimateToActorSizeP(void)
5847 TestApplication application;
5849 Actor actor = Actor::New();
5850 Stage::GetCurrent().Add(actor);
5851 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5853 // Build the animation
5854 float durationSeconds(1.0f);
5855 Animation animation = Animation::New(durationSeconds);
5856 Vector3 targetSize(100.0f, 100.0f, 100.0f);
5857 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize );
5859 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
5861 // Start the animation
5864 bool signalReceived(false);
5865 AnimationFinishCheck finishCheck(signalReceived);
5866 animation.FinishedSignal().Connect(&application, finishCheck);
5868 application.SendNotification();
5869 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
5871 // We didn't expect the animation to finish yet
5872 application.SendNotification();
5873 finishCheck.CheckSignalNotReceived();
5874 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
5876 application.SendNotification();
5877 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
5879 // We did expect the animation to finish
5880 application.SendNotification();
5881 finishCheck.CheckSignalReceived();
5882 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
5885 finishCheck.Reset();
5886 actor.SetSize(Vector3::ZERO);
5887 application.SendNotification();
5888 application.Render(0);
5889 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5891 // Repeat with a different (ease-in) alpha function
5892 animation = Animation::New(durationSeconds);
5893 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
5894 animation.FinishedSignal().Connect(&application, finishCheck);
5897 application.SendNotification();
5898 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
5900 // We didn't expect the animation to finish yet
5901 application.SendNotification();
5902 finishCheck.CheckSignalNotReceived();
5904 // The size should have travelled less, than with a linear alpha function
5905 Vector3 current(actor.GetCurrentSize());
5906 DALI_TEST_CHECK( current.x > 0.0f );
5907 DALI_TEST_CHECK( current.y > 0.0f );
5908 DALI_TEST_CHECK( current.z > 0.0f );
5909 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
5910 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
5911 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
5913 application.SendNotification();
5914 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
5916 // We did expect the animation to finish
5917 application.SendNotification();
5918 finishCheck.CheckSignalReceived();
5919 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
5922 finishCheck.Reset();
5923 actor.SetSize(Vector3::ZERO);
5924 application.SendNotification();
5925 application.Render(0);
5926 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5928 // Repeat with a delay
5930 animation = Animation::New(durationSeconds);
5931 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
5932 animation.FinishedSignal().Connect(&application, finishCheck);
5935 application.SendNotification();
5936 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5938 // We didn't expect the animation to finish yet
5939 application.SendNotification();
5940 finishCheck.CheckSignalNotReceived();
5941 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5943 application.SendNotification();
5944 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5946 // We did expect the animation to finish
5947 application.SendNotification();
5948 finishCheck.CheckSignalReceived();
5949 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
5953 int UtcDaliAnimationAnimateToActorSizeWidthP(void)
5955 TestApplication application;
5957 Actor actor = Actor::New();
5958 Stage::GetCurrent().Add(actor);
5959 float startValue(0.0f);
5960 DALI_TEST_EQUALS( actor.GetCurrentSize().width, startValue, TEST_LOCATION );
5961 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION );
5963 // Build the animation
5964 float durationSeconds(1.0f);
5965 Animation animation = Animation::New(durationSeconds);
5966 float targetWidth(10.0f);
5967 animation.AnimateTo( Property(actor, Actor::Property::SIZE_WIDTH), targetWidth );
5969 float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f);
5971 // Start the animation
5974 bool signalReceived(false);
5975 AnimationFinishCheck finishCheck(signalReceived);
5976 animation.FinishedSignal().Connect(&application, finishCheck);
5978 application.SendNotification();
5979 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5981 // We didn't expect the animation to finish yet
5982 application.SendNotification();
5983 finishCheck.CheckSignalNotReceived();
5984 DALI_TEST_EQUALS( actor.GetCurrentSize().width, fiftyPercentProgress, TEST_LOCATION );
5986 application.SendNotification();
5987 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5989 // We did expect the animation to finish
5990 application.SendNotification();
5991 finishCheck.CheckSignalReceived();
5992 DALI_TEST_EQUALS( actor.GetCurrentSize().width, targetWidth, TEST_LOCATION );
5993 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION );
5997 int UtcDaliAnimationAnimateToActorSizeHeightP(void)
5999 TestApplication application;
6001 Actor actor = Actor::New();
6002 Stage::GetCurrent().Add(actor);
6003 float startValue(0.0f);
6004 DALI_TEST_EQUALS( actor.GetCurrentSize().height, startValue, TEST_LOCATION );
6005 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION );
6007 // Build the animation
6008 float durationSeconds(1.0f);
6009 Animation animation = Animation::New(durationSeconds);
6010 float targetHeight(-10.0f);
6011 animation.AnimateTo( Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight );
6013 float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f);
6015 // Start the animation
6018 bool signalReceived(false);
6019 AnimationFinishCheck finishCheck(signalReceived);
6020 animation.FinishedSignal().Connect(&application, finishCheck);
6022 application.SendNotification();
6023 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6025 // We didn't expect the animation to finish yet
6026 application.SendNotification();
6027 finishCheck.CheckSignalNotReceived();
6028 DALI_TEST_EQUALS( actor.GetCurrentSize().height, fiftyPercentProgress, TEST_LOCATION );
6030 application.SendNotification();
6031 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6033 // We did expect the animation to finish
6034 application.SendNotification();
6035 finishCheck.CheckSignalReceived();
6036 DALI_TEST_EQUALS( actor.GetCurrentSize().height, targetHeight, TEST_LOCATION );
6037 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION );
6041 int UtcDaliAnimationAnimateToActorSizeDepthP(void)
6043 TestApplication application;
6045 Actor actor = Actor::New();
6046 Stage::GetCurrent().Add(actor);
6047 float startValue(0.0f);
6048 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, startValue, TEST_LOCATION );
6049 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION );
6051 // Build the animation
6052 float durationSeconds(1.0f);
6053 Animation animation = Animation::New(durationSeconds);
6054 float targetDepth(-10.0f);
6055 animation.AnimateTo( Property(actor, Actor::Property::SIZE_DEPTH), targetDepth );
6057 float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f);
6059 // Start the animation
6062 bool signalReceived(false);
6063 AnimationFinishCheck finishCheck(signalReceived);
6064 animation.FinishedSignal().Connect(&application, finishCheck);
6066 application.SendNotification();
6067 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6069 // We didn't expect the animation to finish yet
6070 application.SendNotification();
6071 finishCheck.CheckSignalNotReceived();
6072 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, fiftyPercentProgress, TEST_LOCATION );
6074 application.SendNotification();
6075 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6077 // We did expect the animation to finish
6078 application.SendNotification();
6079 finishCheck.CheckSignalReceived();
6080 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, targetDepth, TEST_LOCATION );
6081 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION );
6085 int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void)
6087 TestApplication application;
6089 Actor actor = Actor::New();
6090 Stage::GetCurrent().Add(actor);
6091 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6093 // Build the animation
6094 float durationSeconds(1.0f);
6095 Animation animation = Animation::New(durationSeconds);
6096 Vector3 targetSize(100.0f, 100.0f, 100.0f);
6097 animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetSize );
6099 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
6101 // Start the animation
6104 bool signalReceived(false);
6105 AnimationFinishCheck finishCheck(signalReceived);
6106 animation.FinishedSignal().Connect(&application, finishCheck);
6108 application.SendNotification();
6109 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6111 // We didn't expect the animation to finish yet
6112 application.SendNotification();
6113 finishCheck.CheckSignalNotReceived();
6114 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
6116 application.SendNotification();
6117 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6119 // We did expect the animation to finish
6120 application.SendNotification();
6121 finishCheck.CheckSignalReceived();
6122 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6125 finishCheck.Reset();
6126 actor.SetSize(Vector3::ZERO);
6127 application.SendNotification();
6128 application.Render(0);
6129 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6131 // Repeat with a different (ease-in) alpha function
6132 animation = Animation::New(durationSeconds);
6133 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::EASE_IN );
6134 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::EASE_IN );
6135 animation.FinishedSignal().Connect(&application, finishCheck);
6138 application.SendNotification();
6139 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6141 // We didn't expect the animation to finish yet
6142 application.SendNotification();
6143 finishCheck.CheckSignalNotReceived();
6145 // The size should have travelled less, than with a linear alpha function
6146 Vector3 current(actor.GetCurrentSize());
6147 DALI_TEST_CHECK( current.x > 0.0f );
6148 DALI_TEST_CHECK( current.y > 0.0f );
6149 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
6150 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
6152 application.SendNotification();
6153 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6155 // We did expect the animation to finish
6156 application.SendNotification();
6157 finishCheck.CheckSignalReceived();
6158 DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
6159 DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
6162 finishCheck.Reset();
6163 actor.SetSize(Vector3::ZERO);
6164 application.SendNotification();
6165 application.Render(0);
6166 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6168 // Repeat with a delay
6170 animation = Animation::New(durationSeconds);
6171 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
6172 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
6173 animation.FinishedSignal().Connect(&application, finishCheck);
6176 application.SendNotification();
6177 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6179 // We didn't expect the animation to finish yet
6180 application.SendNotification();
6181 finishCheck.CheckSignalNotReceived();
6182 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6184 application.SendNotification();
6185 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6187 // We did expect the animation to finish
6188 application.SendNotification();
6189 finishCheck.CheckSignalReceived();
6190 DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
6191 DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
6195 int UtcDaliAnimationAnimateToActorPositionP(void)
6197 TestApplication application;
6199 Actor actor = Actor::New();
6200 Stage::GetCurrent().Add(actor);
6201 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6203 // Build the animation
6204 float durationSeconds(1.0f);
6205 Animation animation = Animation::New(durationSeconds);
6206 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6207 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
6209 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6211 // Start the animation
6214 bool signalReceived(false);
6215 AnimationFinishCheck finishCheck(signalReceived);
6216 animation.FinishedSignal().Connect(&application, finishCheck);
6218 application.SendNotification();
6219 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
6221 // We didn't expect the animation to finish yet
6222 application.SendNotification();
6223 finishCheck.CheckSignalNotReceived();
6224 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
6226 application.SendNotification();
6227 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6229 // We did expect the animation to finish
6230 application.SendNotification();
6231 finishCheck.CheckSignalReceived();
6232 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6236 int UtcDaliAnimationAnimateToActorPositionXP(void)
6238 TestApplication application;
6240 Actor actor = Actor::New();
6241 Stage::GetCurrent().Add(actor);
6242 float startValue(0.0f);
6243 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, startValue, TEST_LOCATION );
6244 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6245 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6246 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6248 // Build the animation
6249 float durationSeconds(1.0f);
6250 Animation animation = Animation::New(durationSeconds);
6251 float targetX(1.0f);
6252 animation.AnimateTo( Property(actor, Actor::Property::POSITION_X), targetX );
6254 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
6256 // Start the animation
6259 bool signalReceived(false);
6260 AnimationFinishCheck finishCheck(signalReceived);
6261 animation.FinishedSignal().Connect(&application, finishCheck);
6263 application.SendNotification();
6264 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6266 // We didn't expect the animation to finish yet
6267 application.SendNotification();
6268 finishCheck.CheckSignalNotReceived();
6269 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, fiftyPercentProgress, TEST_LOCATION );
6271 application.SendNotification();
6272 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6274 // We did expect the animation to finish
6275 application.SendNotification();
6276 finishCheck.CheckSignalReceived();
6277 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, targetX, TEST_LOCATION );
6278 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION );
6279 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6280 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6284 int UtcDaliAnimationAnimateToActorPositionYP(void)
6286 TestApplication application;
6288 Actor actor = Actor::New();
6289 Stage::GetCurrent().Add(actor);
6290 float startValue(0.0f);
6291 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, startValue, TEST_LOCATION );
6292 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6293 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6294 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6296 // Build the animation
6297 float durationSeconds(1.0f);
6298 Animation animation = Animation::New(durationSeconds);
6299 float targetY(10.0f);
6300 animation.AnimateTo( Property(actor, Actor::Property::POSITION_Y), targetY );
6302 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
6304 // Start the animation
6307 bool signalReceived(false);
6308 AnimationFinishCheck finishCheck(signalReceived);
6309 animation.FinishedSignal().Connect(&application, finishCheck);
6311 application.SendNotification();
6312 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6314 // We didn't expect the animation to finish yet
6315 application.SendNotification();
6316 finishCheck.CheckSignalNotReceived();
6317 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, fiftyPercentProgress, TEST_LOCATION );
6319 application.SendNotification();
6320 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6322 // We did expect the animation to finish
6323 application.SendNotification();
6324 finishCheck.CheckSignalReceived();
6325 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, targetY, TEST_LOCATION );
6326 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6327 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION );
6328 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6332 int UtcDaliAnimationAnimateToActorPositionZP(void)
6334 TestApplication application;
6336 Actor actor = Actor::New();
6337 Stage::GetCurrent().Add(actor);
6338 float startValue(0.0f);
6339 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, startValue, TEST_LOCATION );
6340 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6341 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6342 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6344 // Build the animation
6345 float durationSeconds(1.0f);
6346 Animation animation = Animation::New(durationSeconds);
6347 float targetZ(-5.0f);
6348 animation.AnimateTo( Property(actor, Actor::Property::POSITION_Z), targetZ );
6350 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
6352 // Start the animation
6355 bool signalReceived(false);
6356 AnimationFinishCheck finishCheck(signalReceived);
6357 animation.FinishedSignal().Connect(&application, finishCheck);
6359 application.SendNotification();
6360 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6362 // We didn't expect the animation to finish yet
6363 application.SendNotification();
6364 finishCheck.CheckSignalNotReceived();
6365 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, fiftyPercentProgress, TEST_LOCATION );
6367 application.SendNotification();
6368 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6370 // We did expect the animation to finish
6371 application.SendNotification();
6372 finishCheck.CheckSignalReceived();
6373 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, targetZ, TEST_LOCATION );
6374 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6375 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6376 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION );
6380 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void)
6382 TestApplication application;
6384 Actor actor = Actor::New();
6385 Stage::GetCurrent().Add(actor);
6386 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6388 // Build the animation
6389 float durationSeconds(1.0f);
6390 Animation animation = Animation::New(durationSeconds);
6391 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6392 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
6394 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6396 // Start the animation
6399 bool signalReceived(false);
6400 AnimationFinishCheck finishCheck(signalReceived);
6401 animation.FinishedSignal().Connect(&application, finishCheck);
6403 application.SendNotification();
6404 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
6406 // We didn't expect the animation to finish yet
6407 application.SendNotification();
6408 finishCheck.CheckSignalNotReceived();
6410 // The position should have moved less, than with a linear alpha function
6411 Vector3 current(actor.GetCurrentPosition());
6412 DALI_TEST_CHECK( current.x > Vector3::ZERO.x );
6413 DALI_TEST_CHECK( current.y > Vector3::ZERO.y );
6414 DALI_TEST_CHECK( current.z > Vector3::ZERO.z );
6415 DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x );
6416 DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y );
6417 DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z );
6419 application.SendNotification();
6420 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6422 // We did expect the animation to finish
6423 application.SendNotification();
6424 finishCheck.CheckSignalReceived();
6425 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6429 int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void)
6431 TestApplication application;
6433 Actor actor = Actor::New();
6434 Stage::GetCurrent().Add(actor);
6435 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6437 // Build the animation
6438 float durationSeconds(1.0f);
6439 Animation animation = Animation::New(durationSeconds);
6440 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6442 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
6444 TimePeriod( delay, durationSeconds - delay ) );
6446 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6448 // Start the animation
6451 bool signalReceived(false);
6452 AnimationFinishCheck finishCheck(signalReceived);
6453 animation.FinishedSignal().Connect(&application, finishCheck);
6455 application.SendNotification();
6456 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6458 // We didn't expect the animation to finish yet
6459 application.SendNotification();
6460 finishCheck.CheckSignalNotReceived();
6461 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6463 application.SendNotification();
6464 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
6466 // We didn't expect the animation to finish yet
6467 application.SendNotification();
6468 finishCheck.CheckSignalNotReceived();
6469 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
6471 application.SendNotification();
6472 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
6474 // We did expect the animation to finish
6475 application.SendNotification();
6476 finishCheck.CheckSignalReceived();
6477 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6481 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void)
6483 TestApplication application;
6485 Actor actor = Actor::New();
6486 Stage::GetCurrent().Add(actor);
6487 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6489 // Build the animation
6490 float durationSeconds(1.0f);
6491 Animation animation = Animation::New(durationSeconds);
6492 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6494 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
6496 AlphaFunction::LINEAR,
6497 TimePeriod( delay, durationSeconds - delay ) );
6499 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6501 // Start the animation
6504 bool signalReceived(false);
6505 AnimationFinishCheck finishCheck(signalReceived);
6506 animation.FinishedSignal().Connect(&application, finishCheck);
6508 application.SendNotification();
6509 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6511 // We didn't expect the animation to finish yet
6512 application.SendNotification();
6513 finishCheck.CheckSignalNotReceived();
6514 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6516 application.SendNotification();
6517 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
6519 // We didn't expect the animation to finish yet
6520 application.SendNotification();
6521 finishCheck.CheckSignalNotReceived();
6522 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
6524 application.SendNotification();
6525 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
6527 // We did expect the animation to finish
6528 application.SendNotification();
6529 finishCheck.CheckSignalReceived();
6530 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6534 int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void)
6536 TestApplication application;
6538 Actor actor = Actor::New();
6539 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
6540 Stage::GetCurrent().Add(actor);
6541 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
6543 // Build the animation
6544 float durationSeconds(1.0f);
6545 Animation animation = Animation::New(durationSeconds);
6546 Degree targetRotationDegrees(90.0f);
6547 Radian targetRotationRadians(targetRotationDegrees);
6548 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS) );
6550 // Start the animation
6553 bool signalReceived(false);
6554 AnimationFinishCheck finishCheck(signalReceived);
6555 animation.FinishedSignal().Connect(&application, finishCheck);
6557 application.SendNotification();
6558 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6560 // We didn't expect the animation to finish yet
6561 application.SendNotification();
6562 finishCheck.CheckSignalNotReceived();
6563 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6565 application.SendNotification();
6566 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6568 // We didn't expect the animation to finish yet
6569 application.SendNotification();
6570 finishCheck.CheckSignalNotReceived();
6571 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6573 application.SendNotification();
6574 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6576 // We didn't expect the animation to finish yet
6577 application.SendNotification();
6578 finishCheck.CheckSignalNotReceived();
6579 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6581 application.SendNotification();
6582 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6584 // We did expect the animation to finish
6585 application.SendNotification();
6586 finishCheck.CheckSignalReceived();
6587 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6591 int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void)
6593 TestApplication application;
6595 Actor actor = Actor::New();
6596 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
6597 Stage::GetCurrent().Add(actor);
6598 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
6600 // Build the animation
6601 float durationSeconds(1.0f);
6602 Animation animation = Animation::New(durationSeconds);
6603 Degree targetRotationDegrees(90.0f);
6604 Radian targetRotationRadians(targetRotationDegrees);
6605 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
6606 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), targetRotation );
6608 // Start the animation
6611 bool signalReceived(false);
6612 AnimationFinishCheck finishCheck(signalReceived);
6613 animation.FinishedSignal().Connect(&application, finishCheck);
6615 application.SendNotification();
6616 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6618 // We didn't expect the animation to finish yet
6619 application.SendNotification();
6620 finishCheck.CheckSignalNotReceived();
6621 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6623 application.SendNotification();
6624 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6626 // We didn't expect the animation to finish yet
6627 application.SendNotification();
6628 finishCheck.CheckSignalNotReceived();
6629 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6631 application.SendNotification();
6632 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6634 // We didn't expect the animation to finish yet
6635 application.SendNotification();
6636 finishCheck.CheckSignalNotReceived();
6637 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6639 application.SendNotification();
6640 application.Render(static_cast<unsigned int>(durationSeconds*250.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.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6649 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void)
6651 TestApplication application;
6653 Actor actor = Actor::New();
6654 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
6655 Stage::GetCurrent().Add(actor);
6656 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6658 // Build the animation
6659 float durationSeconds(1.0f);
6660 Animation animation = Animation::New(durationSeconds);
6661 Degree targetRotationDegrees(90.0f);
6662 Radian targetRotationRadians(targetRotationDegrees);
6663 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
6665 // Start the animation
6668 bool signalReceived(false);
6669 AnimationFinishCheck finishCheck(signalReceived);
6670 animation.FinishedSignal().Connect(&application, finishCheck);
6672 application.SendNotification();
6673 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6675 // We didn't expect the animation to finish yet
6676 application.SendNotification();
6677 finishCheck.CheckSignalNotReceived();
6678 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6680 application.SendNotification();
6681 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6683 // We didn't expect the animation to finish yet
6684 application.SendNotification();
6685 finishCheck.CheckSignalNotReceived();
6686 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6688 application.SendNotification();
6689 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6691 // We didn't expect the animation to finish yet
6692 application.SendNotification();
6693 finishCheck.CheckSignalNotReceived();
6694 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6696 application.SendNotification();
6697 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6699 // We did expect the animation to finish
6700 application.SendNotification();
6701 finishCheck.CheckSignalReceived();
6702 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6706 int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void)
6708 TestApplication application;
6710 Actor actor = Actor::New();
6711 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
6712 Stage::GetCurrent().Add(actor);
6713 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
6715 // Build the animation
6716 float durationSeconds(1.0f);
6717 Animation animation = Animation::New(durationSeconds);
6718 Degree targetRotationDegrees(90.0f);
6719 Radian targetRotationRadians(targetRotationDegrees);
6721 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
6723 // Start the animation
6726 bool signalReceived(false);
6727 AnimationFinishCheck finishCheck(signalReceived);
6728 animation.FinishedSignal().Connect(&application, finishCheck);
6730 application.SendNotification();
6731 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6733 // We didn't expect the animation to finish yet
6734 application.SendNotification();
6735 finishCheck.CheckSignalNotReceived();
6736 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
6737 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6739 application.SendNotification();
6740 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6742 // We didn't expect the animation to finish yet
6743 application.SendNotification();
6744 finishCheck.CheckSignalNotReceived();
6745 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
6746 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6748 application.SendNotification();
6749 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6751 // We didn't expect the animation to finish yet
6752 application.SendNotification();
6753 finishCheck.CheckSignalNotReceived();
6754 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
6755 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6757 application.SendNotification();
6758 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6760 // We did expect the animation to finish
6761 application.SendNotification();
6762 finishCheck.CheckSignalReceived();
6763 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6767 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void)
6769 TestApplication application;
6771 Actor actor = Actor::New();
6772 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
6773 Stage::GetCurrent().Add(actor);
6774 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
6776 // Build the animation
6777 float durationSeconds(1.0f);
6778 Animation animation = Animation::New(durationSeconds);
6779 Degree targetRotationDegrees(90.0f);
6780 Radian targetRotationRadians(targetRotationDegrees);
6782 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
6784 // Start the animation
6787 bool signalReceived(false);
6788 AnimationFinishCheck finishCheck(signalReceived);
6789 animation.FinishedSignal().Connect(&application, finishCheck);
6791 application.SendNotification();
6792 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6794 // We didn't expect the animation to finish yet
6795 application.SendNotification();
6796 finishCheck.CheckSignalNotReceived();
6797 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
6798 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6800 application.SendNotification();
6801 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6803 // We didn't expect the animation to finish yet
6804 application.SendNotification();
6805 finishCheck.CheckSignalNotReceived();
6806 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
6807 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6809 application.SendNotification();
6810 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6812 // We didn't expect the animation to finish yet
6813 application.SendNotification();
6814 finishCheck.CheckSignalNotReceived();
6815 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
6816 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6818 application.SendNotification();
6819 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6821 // We did expect the animation to finish
6822 application.SendNotification();
6823 finishCheck.CheckSignalReceived();
6824 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6828 int UtcDaliAnimationAnimateToActorScaleP(void)
6830 TestApplication application;
6832 Actor actor = Actor::New();
6833 Stage::GetCurrent().Add(actor);
6834 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
6836 // Build the animation
6837 float durationSeconds(1.0f);
6838 Animation animation = Animation::New(durationSeconds);
6839 Vector3 targetScale(2.0f, 2.0f, 2.0f);
6840 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale );
6842 Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f);
6844 // Start the animation
6847 bool signalReceived(false);
6848 AnimationFinishCheck finishCheck(signalReceived);
6849 animation.FinishedSignal().Connect(&application, finishCheck);
6851 application.SendNotification();
6852 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6854 // We didn't expect the animation to finish yet
6855 application.SendNotification();
6856 finishCheck.CheckSignalNotReceived();
6857 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
6859 application.SendNotification();
6860 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6862 // We did expect the animation to finish
6863 application.SendNotification();
6864 finishCheck.CheckSignalReceived();
6865 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
6868 finishCheck.Reset();
6869 actor.SetScale(Vector3::ONE);
6870 application.SendNotification();
6871 application.Render(0);
6872 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
6874 // Repeat with a different (ease-in) alpha function
6875 animation = Animation::New(durationSeconds);
6876 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
6877 animation.FinishedSignal().Connect(&application, finishCheck);
6880 application.SendNotification();
6881 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6883 // We didn't expect the animation to finish yet
6884 application.SendNotification();
6885 finishCheck.CheckSignalNotReceived();
6887 // The scale should have grown less, than with a linear alpha function
6888 Vector3 current(actor.GetCurrentScale());
6889 DALI_TEST_CHECK( current.x > 1.0f );
6890 DALI_TEST_CHECK( current.y > 1.0f );
6891 DALI_TEST_CHECK( current.z > 1.0f );
6892 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
6893 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
6894 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
6896 application.SendNotification();
6897 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6899 // We did expect the animation to finish
6900 application.SendNotification();
6901 finishCheck.CheckSignalReceived();
6902 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
6905 finishCheck.Reset();
6906 actor.SetScale(Vector3::ONE);
6907 application.SendNotification();
6908 application.Render(0);
6909 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
6911 // Repeat with a delay
6913 animation = Animation::New(durationSeconds);
6914 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
6915 animation.FinishedSignal().Connect(&application, finishCheck);
6918 application.SendNotification();
6919 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6921 // We didn't expect the animation to finish yet
6922 application.SendNotification();
6923 finishCheck.CheckSignalNotReceived();
6924 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
6926 application.SendNotification();
6927 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6929 // We did expect the animation to finish
6930 application.SendNotification();
6931 finishCheck.CheckSignalReceived();
6932 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
6936 int UtcDaliAnimationAnimateToActorScaleXP(void)
6938 TestApplication application;
6940 Actor actor = Actor::New();
6941 Stage::GetCurrent().Add(actor);
6942 float startValue(1.0f);
6943 DALI_TEST_EQUALS( actor.GetCurrentScale().x, startValue, TEST_LOCATION );
6944 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
6945 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
6946 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
6948 // Build the animation
6949 float durationSeconds(1.0f);
6950 Animation animation = Animation::New(durationSeconds);
6951 float targetX(10.0f);
6952 animation.AnimateTo( Property(actor, Actor::Property::SCALE_X), targetX );
6954 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
6956 // Start the animation
6959 bool signalReceived(false);
6960 AnimationFinishCheck finishCheck(signalReceived);
6961 animation.FinishedSignal().Connect(&application, finishCheck);
6963 application.SendNotification();
6964 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6966 // We didn't expect the animation to finish yet
6967 application.SendNotification();
6968 finishCheck.CheckSignalNotReceived();
6969 DALI_TEST_EQUALS( actor.GetCurrentScale().x, fiftyPercentProgress, TEST_LOCATION );
6970 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), fiftyPercentProgress, TEST_LOCATION );
6971 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
6972 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
6974 application.SendNotification();
6975 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6977 // We did expect the animation to finish
6978 application.SendNotification();
6979 finishCheck.CheckSignalReceived();
6980 DALI_TEST_EQUALS( actor.GetCurrentScale().x, targetX, TEST_LOCATION );
6981 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), targetX, TEST_LOCATION );
6982 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
6983 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
6987 int UtcDaliAnimationAnimateToActorScaleYP(void)
6989 TestApplication application;
6991 Actor actor = Actor::New();
6992 Stage::GetCurrent().Add(actor);
6993 float startValue(1.0f);
6994 DALI_TEST_EQUALS( actor.GetCurrentScale().y, startValue, TEST_LOCATION );
6995 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
6996 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
6997 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
6999 // Build the animation
7000 float durationSeconds(1.0f);
7001 Animation animation = Animation::New(durationSeconds);
7002 float targetY(1000.0f);
7003 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Y), targetY );
7005 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
7007 // Start the animation
7010 bool signalReceived(false);
7011 AnimationFinishCheck finishCheck(signalReceived);
7012 animation.FinishedSignal().Connect(&application, finishCheck);
7014 application.SendNotification();
7015 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7017 // We didn't expect the animation to finish yet
7018 application.SendNotification();
7019 finishCheck.CheckSignalNotReceived();
7020 DALI_TEST_EQUALS( actor.GetCurrentScale().y, fiftyPercentProgress, TEST_LOCATION );
7021 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7022 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), fiftyPercentProgress, TEST_LOCATION );
7023 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7025 application.SendNotification();
7026 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7028 // We did expect the animation to finish
7029 application.SendNotification();
7030 finishCheck.CheckSignalReceived();
7031 DALI_TEST_EQUALS( actor.GetCurrentScale().y, targetY, TEST_LOCATION );
7032 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7033 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), targetY, TEST_LOCATION );
7034 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7038 int UtcDaliAnimationAnimateToActorScaleZP(void)
7040 TestApplication application;
7042 Actor actor = Actor::New();
7043 Stage::GetCurrent().Add(actor);
7044 float startValue(1.0f);
7045 DALI_TEST_EQUALS( actor.GetCurrentScale().z, startValue, TEST_LOCATION );
7046 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7047 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7048 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7050 // Build the animation
7051 float durationSeconds(1.0f);
7052 Animation animation = Animation::New(durationSeconds);
7053 float targetZ(-1000.0f);
7054 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Z), targetZ );
7056 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
7058 // Start the animation
7061 bool signalReceived(false);
7062 AnimationFinishCheck finishCheck(signalReceived);
7063 animation.FinishedSignal().Connect(&application, finishCheck);
7065 application.SendNotification();
7066 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7068 // We didn't expect the animation to finish yet
7069 application.SendNotification();
7070 finishCheck.CheckSignalNotReceived();
7071 DALI_TEST_EQUALS( actor.GetCurrentScale().z, fiftyPercentProgress, TEST_LOCATION );
7072 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7073 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7074 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), fiftyPercentProgress, TEST_LOCATION );
7076 application.SendNotification();
7077 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7079 // We did expect the animation to finish
7080 application.SendNotification();
7081 finishCheck.CheckSignalReceived();
7082 DALI_TEST_EQUALS( actor.GetCurrentScale().z, targetZ, TEST_LOCATION );
7083 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7084 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7085 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), targetZ, TEST_LOCATION );
7089 int UtcDaliAnimationAnimateToActorColorP(void)
7091 TestApplication application;
7093 Actor actor = Actor::New();
7094 Stage::GetCurrent().Add(actor);
7095 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7097 // Build the animation
7098 float durationSeconds(1.0f);
7099 Animation animation = Animation::New(durationSeconds);
7100 Vector4 targetColor(Color::RED);
7101 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor );
7103 Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
7104 Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
7106 // Start the animation
7109 bool signalReceived(false);
7110 AnimationFinishCheck finishCheck(signalReceived);
7111 animation.FinishedSignal().Connect(&application, finishCheck);
7113 application.SendNotification();
7114 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7116 // We didn't expect the animation to finish yet
7117 application.SendNotification();
7118 finishCheck.CheckSignalNotReceived();
7119 DALI_TEST_EQUALS( actor.GetCurrentColor(), tenPercentProgress, TEST_LOCATION );
7121 application.SendNotification();
7122 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7124 // We did expect the animation to finish
7125 application.SendNotification();
7126 finishCheck.CheckSignalReceived();
7127 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7130 finishCheck.Reset();
7131 actor.SetColor(Color::WHITE);
7132 application.SendNotification();
7133 application.Render(0);
7134 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7136 // Repeat with a different (ease-in) alpha function
7137 animation = Animation::New(durationSeconds);
7138 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
7139 animation.FinishedSignal().Connect(&application, finishCheck);
7142 application.SendNotification();
7143 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7145 // We didn't expect the animation to finish yet
7146 application.SendNotification();
7147 finishCheck.CheckSignalNotReceived();
7149 // The color should have changed less, than with a linear alpha function
7150 Vector4 current(actor.GetCurrentColor());
7151 DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change
7152 DALI_TEST_CHECK( current.y < 1.0f );
7153 DALI_TEST_CHECK( current.y > tenPercentProgress.y );
7154 DALI_TEST_CHECK( current.z < 1.0f );
7155 DALI_TEST_CHECK( current.z > tenPercentProgress.z );
7156 DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
7158 application.SendNotification();
7159 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7161 // We did expect the animation to finish
7162 application.SendNotification();
7163 finishCheck.CheckSignalReceived();
7164 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7167 finishCheck.Reset();
7168 actor.SetColor(Color::WHITE);
7169 application.SendNotification();
7170 application.Render(0);
7171 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7173 // Repeat with a shorter animator duration
7174 float animatorDuration = 0.5f;
7175 animation = Animation::New(durationSeconds);
7176 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
7177 animation.FinishedSignal().Connect(&application, finishCheck);
7180 application.SendNotification();
7181 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
7183 // We didn't expect the animation to finish yet
7184 application.SendNotification();
7185 finishCheck.CheckSignalNotReceived();
7186 DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION );
7188 application.SendNotification();
7189 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
7191 // We didn't expect the animation to finish yet
7192 application.SendNotification();
7193 finishCheck.CheckSignalNotReceived();
7194 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7196 application.SendNotification();
7197 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7199 // We did expect the animation to finish
7200 application.SendNotification();
7201 finishCheck.CheckSignalReceived();
7202 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7206 int UtcDaliAnimationAnimateToActorColorRedP(void)
7208 TestApplication application;
7210 Actor actor = Actor::New();
7211 Stage::GetCurrent().Add(actor);
7212 float startValue(1.0f);
7213 DALI_TEST_EQUALS( actor.GetCurrentColor().r, startValue, TEST_LOCATION );
7214 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7215 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7216 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7217 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7219 // Build the animation
7220 float durationSeconds(1.0f);
7221 Animation animation = Animation::New(durationSeconds);
7222 float targetRed(0.5f);
7223 animation.AnimateTo( Property(actor, Actor::Property::COLOR_RED), targetRed );
7225 float fiftyPercentProgress(startValue + (targetRed - startValue)*0.5f);
7227 // Start the animation
7230 bool signalReceived(false);
7231 AnimationFinishCheck finishCheck(signalReceived);
7232 animation.FinishedSignal().Connect(&application, finishCheck);
7234 application.SendNotification();
7235 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7237 // We didn't expect the animation to finish yet
7238 application.SendNotification();
7239 finishCheck.CheckSignalNotReceived();
7240 DALI_TEST_EQUALS( actor.GetCurrentColor().r, fiftyPercentProgress, TEST_LOCATION );
7241 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION );
7242 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7243 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7244 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7246 application.SendNotification();
7247 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7249 // We did expect the animation to finish
7250 application.SendNotification();
7251 finishCheck.CheckSignalReceived();
7252 DALI_TEST_EQUALS( actor.GetCurrentColor().r, targetRed, TEST_LOCATION );
7253 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), targetRed, TEST_LOCATION );
7254 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7255 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7256 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7260 int UtcDaliAnimationAnimateToActorColorGreenP(void)
7262 TestApplication application;
7264 Actor actor = Actor::New();
7265 Stage::GetCurrent().Add(actor);
7266 float startValue(1.0f);
7267 DALI_TEST_EQUALS( actor.GetCurrentColor().g, startValue, TEST_LOCATION );
7268 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7269 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7270 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7271 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7273 // Build the animation
7274 float durationSeconds(1.0f);
7275 Animation animation = Animation::New(durationSeconds);
7276 float targetGreen(0.5f);
7277 animation.AnimateTo( Property(actor, Actor::Property::COLOR_GREEN), targetGreen );
7279 float fiftyPercentProgress(startValue + (targetGreen - startValue)*0.5f);
7281 // Start the animation
7284 bool signalReceived(false);
7285 AnimationFinishCheck finishCheck(signalReceived);
7286 animation.FinishedSignal().Connect(&application, finishCheck);
7288 application.SendNotification();
7289 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7291 // We didn't expect the animation to finish yet
7292 application.SendNotification();
7293 finishCheck.CheckSignalNotReceived();
7294 DALI_TEST_EQUALS( actor.GetCurrentColor().g, fiftyPercentProgress, TEST_LOCATION );
7295 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7296 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION );
7297 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7298 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7300 application.SendNotification();
7301 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7303 // We did expect the animation to finish
7304 application.SendNotification();
7305 finishCheck.CheckSignalReceived();
7306 DALI_TEST_EQUALS( actor.GetCurrentColor().g, targetGreen, TEST_LOCATION );
7307 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7308 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION );
7309 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7310 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7314 int UtcDaliAnimationAnimateToActorColorBlueP(void)
7316 TestApplication application;
7318 Actor actor = Actor::New();
7319 Stage::GetCurrent().Add(actor);
7320 float startValue(1.0f);
7321 DALI_TEST_EQUALS( actor.GetCurrentColor().b, startValue, TEST_LOCATION );
7322 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7323 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7324 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7325 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7327 // Build the animation
7328 float durationSeconds(1.0f);
7329 Animation animation = Animation::New(durationSeconds);
7330 float targetBlue(0.5f);
7331 animation.AnimateTo( Property(actor, Actor::Property::COLOR_BLUE), targetBlue );
7333 float fiftyPercentProgress(startValue + (targetBlue - startValue)*0.5f);
7335 // Start the animation
7338 bool signalReceived(false);
7339 AnimationFinishCheck finishCheck(signalReceived);
7340 animation.FinishedSignal().Connect(&application, finishCheck);
7342 application.SendNotification();
7343 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7345 // We didn't expect the animation to finish yet
7346 application.SendNotification();
7347 finishCheck.CheckSignalNotReceived();
7348 DALI_TEST_EQUALS( actor.GetCurrentColor().b, fiftyPercentProgress, TEST_LOCATION );
7349 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7350 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7351 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), fiftyPercentProgress, TEST_LOCATION );
7352 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7354 application.SendNotification();
7355 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7357 // We did expect the animation to finish
7358 application.SendNotification();
7359 finishCheck.CheckSignalReceived();
7360 DALI_TEST_EQUALS( actor.GetCurrentColor().b, targetBlue, TEST_LOCATION );
7361 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7362 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7363 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetBlue, TEST_LOCATION );
7364 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7368 int UtcDaliAnimationAnimateToActorColorAlphaP(void)
7370 TestApplication application;
7372 Actor actor = Actor::New();
7373 Stage::GetCurrent().Add(actor);
7374 float startValue(1.0f);
7375 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7376 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7377 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7378 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7379 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7381 // Build the animation
7382 float durationSeconds(1.0f);
7383 Animation animation = Animation::New(durationSeconds);
7384 float targetAlpha(0.5f);
7385 animation.AnimateTo( Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha );
7387 float fiftyPercentProgress(startValue + (targetAlpha - startValue)*0.5f);
7389 // Start the animation
7392 bool signalReceived(false);
7393 AnimationFinishCheck finishCheck(signalReceived);
7394 animation.FinishedSignal().Connect(&application, finishCheck);
7396 application.SendNotification();
7397 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7399 // We didn't expect the animation to finish yet
7400 application.SendNotification();
7401 finishCheck.CheckSignalNotReceived();
7402 DALI_TEST_EQUALS( actor.GetCurrentColor().a, fiftyPercentProgress, TEST_LOCATION );
7403 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7404 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7405 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7406 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), fiftyPercentProgress, TEST_LOCATION );
7408 application.SendNotification();
7409 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7411 // We did expect the animation to finish
7412 application.SendNotification();
7413 finishCheck.CheckSignalReceived();
7414 DALI_TEST_EQUALS( actor.GetCurrentColor().a, targetAlpha, TEST_LOCATION );
7415 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7416 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7417 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7418 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetAlpha, TEST_LOCATION );
7422 int UtcDaliAnimationKeyFrames01P(void)
7424 TestApplication application;
7426 KeyFrames keyFrames = KeyFrames::New();
7427 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7429 keyFrames.Add(0.0f, 0.1f);
7431 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
7433 KeyFrames keyFrames2( keyFrames);
7434 DALI_TEST_CHECK( keyFrames2 );
7435 DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
7437 KeyFrames keyFrames3 = KeyFrames::New();
7438 keyFrames3.Add(0.6f, true);
7439 DALI_TEST_CHECK( keyFrames3 );
7440 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
7442 keyFrames3 = keyFrames;
7443 DALI_TEST_CHECK( keyFrames3 );
7444 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
7449 int UtcDaliAnimationKeyFrames02P(void)
7451 TestApplication application;
7453 KeyFrames keyFrames = KeyFrames::New();
7454 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7456 keyFrames.Add(0.0f, 0.1f);
7457 keyFrames.Add(0.2f, 0.5f);
7458 keyFrames.Add(0.4f, 0.0f);
7459 keyFrames.Add(0.6f, 1.0f);
7460 keyFrames.Add(0.8f, 0.7f);
7461 keyFrames.Add(1.0f, 0.9f);
7463 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
7467 keyFrames.Add(1.9f, false);
7469 catch (Dali::DaliException& e)
7471 DALI_TEST_PRINT_ASSERT( e );
7472 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
7477 int UtcDaliAnimationKeyFrames03P(void)
7479 TestApplication application;
7481 KeyFrames keyFrames = KeyFrames::New();
7482 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7484 keyFrames.Add(0.0f, true);
7485 keyFrames.Add(0.2f, false);
7486 keyFrames.Add(0.4f, false);
7487 keyFrames.Add(0.6f, true);
7488 keyFrames.Add(0.8f, true);
7489 keyFrames.Add(1.0f, false);
7491 DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
7495 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
7497 catch (Dali::DaliException& e)
7499 DALI_TEST_PRINT_ASSERT( e );
7500 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
7505 int UtcDaliAnimationKeyFrames04P(void)
7507 TestApplication application;
7509 KeyFrames keyFrames = KeyFrames::New();
7510 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7512 keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
7513 keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
7514 keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
7515 keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
7516 keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
7517 keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
7519 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
7523 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
7525 catch (Dali::DaliException& e)
7527 DALI_TEST_PRINT_ASSERT( e );
7528 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
7533 int UtcDaliAnimationKeyFrames05P(void)
7535 TestApplication application;
7537 KeyFrames keyFrames = KeyFrames::New();
7538 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7540 keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
7541 keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
7542 keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
7543 keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
7544 keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
7545 keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
7547 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
7551 keyFrames.Add(0.7f, 1.0f);
7553 catch (Dali::DaliException& e)
7555 DALI_TEST_PRINT_ASSERT( e );
7556 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
7561 int UtcDaliAnimationKeyFrames06P(void)
7563 TestApplication application;
7565 KeyFrames keyFrames = KeyFrames::New();
7566 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7568 keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
7569 keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
7570 keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
7571 keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
7572 keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
7573 keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
7575 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
7579 keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
7581 catch (Dali::DaliException& e)
7583 DALI_TEST_PRINT_ASSERT( e );
7584 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
7589 int UtcDaliAnimationKeyFrames07P(void)
7591 TestApplication application;
7593 KeyFrames keyFrames = KeyFrames::New();
7594 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7596 keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
7597 keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
7598 keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
7599 keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
7600 keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
7601 keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
7603 DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
7607 keyFrames.Add(0.7f, 1.1f);
7609 catch (Dali::DaliException& e)
7611 DALI_TEST_PRINT_ASSERT( e );
7612 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
7617 int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
7619 TestApplication application;
7621 float startValue(1.0f);
7622 Actor actor = Actor::New();
7623 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
7624 Stage::GetCurrent().Add(actor);
7626 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7627 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7628 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7629 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7630 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7632 // Build the animation
7633 float durationSeconds(1.0f);
7634 Animation animation = Animation::New(durationSeconds);
7636 KeyFrames keyFrames = KeyFrames::New();
7637 keyFrames.Add(0.0f, 0.1f);
7638 keyFrames.Add(0.2f, 0.5f);
7639 keyFrames.Add(0.4f, 0.0f);
7640 keyFrames.Add(0.6f, 1.0f);
7641 keyFrames.Add(0.8f, 0.7f);
7642 keyFrames.Add(1.0f, 0.9f);
7644 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames );
7646 // Start the animation
7649 bool signalReceived(false);
7650 AnimationFinishCheck finishCheck(signalReceived);
7651 animation.FinishedSignal().Connect(&application, finishCheck);
7652 application.SendNotification();
7653 application.Render(0);
7654 application.SendNotification();
7655 finishCheck.CheckSignalNotReceived();
7656 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
7658 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7659 application.SendNotification();
7660 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7661 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7662 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7663 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION );
7664 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.3f, 0.01f, TEST_LOCATION );
7666 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
7667 application.SendNotification();
7668 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7669 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7670 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7671 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION );
7672 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.25f, 0.01f, TEST_LOCATION );
7674 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
7675 application.SendNotification();
7676 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7677 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7678 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7679 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
7680 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
7682 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
7683 application.SendNotification();
7684 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7685 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7686 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7687 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
7688 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
7690 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
7691 application.SendNotification();
7692 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7693 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7694 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7695 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION );
7696 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.8f, 0.01f, TEST_LOCATION );
7698 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
7699 application.SendNotification();
7700 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7701 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7702 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7703 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
7704 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
7706 // We did expect the animation to finish
7708 finishCheck.CheckSignalReceived();
7712 int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
7714 TestApplication application;
7716 float startValue(1.0f);
7717 Actor actor = Actor::New();
7718 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
7719 Stage::GetCurrent().Add(actor);
7721 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7722 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7723 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7724 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7725 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7727 // Build the animation
7728 float durationSeconds(1.0f);
7729 Animation animation = Animation::New(durationSeconds);
7731 KeyFrames keyFrames = KeyFrames::New();
7732 keyFrames.Add(0.0f, 0.1f);
7733 keyFrames.Add(0.2f, 0.5f);
7734 keyFrames.Add(0.4f, 0.0f);
7735 keyFrames.Add(0.6f, 1.0f);
7736 keyFrames.Add(0.8f, 0.7f);
7737 keyFrames.Add(1.0f, 0.9f);
7739 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::Cubic );
7741 // Start the animation
7744 bool signalReceived(false);
7745 AnimationFinishCheck finishCheck(signalReceived);
7746 animation.FinishedSignal().Connect(&application, finishCheck);
7747 application.SendNotification();
7748 application.Render(0);
7749 application.SendNotification();
7750 finishCheck.CheckSignalNotReceived();
7751 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
7753 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7754 application.SendNotification();
7755 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7756 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7757 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7758 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.36f, 0.01f, TEST_LOCATION );
7759 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.36f, 0.01f, TEST_LOCATION );
7761 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
7762 application.SendNotification();
7763 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7764 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7765 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7766 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.21f, 0.01f, TEST_LOCATION );
7767 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.21f, 0.01f, TEST_LOCATION );
7769 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
7770 application.SendNotification();
7771 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7772 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7773 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7774 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
7775 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
7777 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
7778 application.SendNotification();
7779 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7780 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7781 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7782 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
7783 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
7785 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
7786 application.SendNotification();
7787 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7788 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7789 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7790 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.76f, 0.01f, TEST_LOCATION );
7791 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.76f, 0.01f, TEST_LOCATION );
7793 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
7794 application.SendNotification();
7795 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7796 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7797 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7798 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
7799 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
7801 // We did expect the animation to finish
7803 finishCheck.CheckSignalReceived();
7807 int UtcDaliAnimationAnimateBetweenActorColorP(void)
7809 TestApplication application;
7811 float startValue(1.0f);
7812 Actor actor = Actor::New();
7813 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
7814 Stage::GetCurrent().Add(actor);
7816 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7817 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7818 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7819 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7820 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7822 // Build the animation
7823 float durationSeconds(1.0f);
7824 Animation animation = Animation::New(durationSeconds);
7826 KeyFrames keyFrames = KeyFrames::New();
7827 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
7828 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
7829 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
7831 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames );
7833 // Start the animation
7836 bool signalReceived(false);
7837 AnimationFinishCheck finishCheck(signalReceived);
7838 animation.FinishedSignal().Connect(&application, finishCheck);
7839 application.SendNotification();
7840 application.Render(0);
7841 application.SendNotification();
7842 finishCheck.CheckSignalNotReceived();
7843 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
7844 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
7845 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
7846 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
7848 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7849 application.SendNotification();
7850 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
7851 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
7852 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
7853 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
7855 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7856 application.SendNotification();
7857 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
7858 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
7859 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
7860 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
7862 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7863 application.SendNotification();
7864 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
7865 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
7866 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
7867 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
7869 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
7870 application.SendNotification();
7871 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
7872 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
7873 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
7874 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
7876 // We did expect the animation to finish
7878 finishCheck.CheckSignalReceived();
7882 int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
7884 TestApplication application;
7886 float startValue(1.0f);
7887 Actor actor = Actor::New();
7888 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
7889 Stage::GetCurrent().Add(actor);
7891 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7892 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7893 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7894 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7895 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7897 // Build the animation
7898 float durationSeconds(1.0f);
7899 Animation animation = Animation::New(durationSeconds);
7901 KeyFrames keyFrames = KeyFrames::New();
7902 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
7903 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
7904 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
7906 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, Animation::Cubic );
7908 // Start the animation
7911 bool signalReceived(false);
7912 AnimationFinishCheck finishCheck(signalReceived);
7913 animation.FinishedSignal().Connect(&application, finishCheck);
7914 application.SendNotification();
7915 application.Render(0);
7916 application.SendNotification();
7917 finishCheck.CheckSignalNotReceived();
7918 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
7919 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
7920 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
7921 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
7923 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7924 application.SendNotification();
7925 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION );
7926 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
7927 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION );
7928 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
7930 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7931 application.SendNotification();
7932 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
7933 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
7934 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
7935 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
7937 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7938 application.SendNotification();
7939 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION );
7940 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
7941 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION );
7942 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
7944 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
7945 application.SendNotification();
7946 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
7947 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
7948 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
7949 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
7951 // We did expect the animation to finish
7953 finishCheck.CheckSignalReceived();
7957 int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
7959 TestApplication application;
7961 Actor actor = Actor::New();
7962 AngleAxis aa(Degree(90), Vector3::XAXIS);
7963 actor.SetOrientation(aa.angle, aa.axis);
7964 Stage::GetCurrent().Add(actor);
7966 application.SendNotification();
7967 application.Render(0);
7969 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
7971 // Build the animation
7972 float durationSeconds(1.0f);
7973 Animation animation = Animation::New(durationSeconds);
7975 KeyFrames keyFrames = KeyFrames::New();
7976 keyFrames.Add(0.0f, false);
7977 keyFrames.Add(0.2f, true);
7978 keyFrames.Add(0.4f, true);
7979 keyFrames.Add(0.8f, false);
7980 keyFrames.Add(1.0f, true);
7982 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames );
7984 // Start the animation
7987 bool signalReceived(false);
7988 AnimationFinishCheck finishCheck(signalReceived);
7989 animation.FinishedSignal().Connect(&application, finishCheck);
7990 application.SendNotification();
7991 application.SendNotification();
7992 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
7993 application.SendNotification();
7994 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
7995 application.SendNotification();
7997 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
7998 finishCheck.CheckSignalReceived();
8002 int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
8004 TestApplication application;
8006 Actor actor = Actor::New();
8007 AngleAxis aa(Degree(90), Vector3::XAXIS);
8008 actor.SetOrientation(aa.angle, aa.axis);
8009 Stage::GetCurrent().Add(actor);
8011 application.SendNotification();
8012 application.Render(0);
8014 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
8016 // Build the animation
8017 float durationSeconds(1.0f);
8018 Animation animation = Animation::New(durationSeconds);
8020 KeyFrames keyFrames = KeyFrames::New();
8021 keyFrames.Add(0.0f, false);
8022 keyFrames.Add(0.2f, true);
8023 keyFrames.Add(0.4f, true);
8024 keyFrames.Add(0.8f, false);
8025 keyFrames.Add(1.0f, true);
8027 //Cubic interpolation for boolean values should be ignored
8028 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::Cubic );
8030 // Start the animation
8033 bool signalReceived(false);
8034 AnimationFinishCheck finishCheck(signalReceived);
8035 animation.FinishedSignal().Connect(&application, finishCheck);
8036 application.SendNotification();
8037 application.SendNotification();
8038 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8039 application.SendNotification();
8040 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8041 application.SendNotification();
8043 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
8044 finishCheck.CheckSignalReceived();
8048 int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
8050 TestApplication application;
8052 Actor actor = Actor::New();
8053 AngleAxis aa(Degree(90), Vector3::XAXIS);
8054 actor.SetOrientation(aa.angle, aa.axis);
8055 Stage::GetCurrent().Add(actor);
8057 application.SendNotification();
8058 application.Render(0);
8059 Quaternion start(Radian(aa.angle), aa.axis);
8060 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8062 // Build the animation
8063 float durationSeconds(1.0f);
8064 Animation animation = Animation::New(durationSeconds);
8066 KeyFrames keyFrames = KeyFrames::New();
8067 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
8069 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
8071 // Start the animation
8074 bool signalReceived(false);
8075 AnimationFinishCheck finishCheck(signalReceived);
8076 animation.FinishedSignal().Connect(&application, finishCheck);
8077 application.SendNotification();
8078 application.SendNotification();
8079 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8080 application.SendNotification();
8081 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8082 application.SendNotification();
8084 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
8086 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8087 finishCheck.CheckSignalReceived();
8091 int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
8093 TestApplication application;
8095 Actor actor = Actor::New();
8096 AngleAxis aa(Degree(90), Vector3::XAXIS);
8097 actor.SetOrientation(aa.angle, aa.axis);
8098 application.SendNotification();
8099 application.Render(0);
8100 Stage::GetCurrent().Add(actor);
8102 Quaternion start(Radian(aa.angle), aa.axis);
8103 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8105 // Build the animation
8106 float durationSeconds(1.0f);
8107 Animation animation = Animation::New(durationSeconds);
8109 KeyFrames keyFrames = KeyFrames::New();
8110 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
8111 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
8112 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
8114 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
8116 // Start the animation
8119 bool signalReceived(false);
8120 AnimationFinishCheck finishCheck(signalReceived);
8121 animation.FinishedSignal().Connect(&application, finishCheck);
8122 application.SendNotification();
8123 application.Render(0);
8124 application.SendNotification();
8125 finishCheck.CheckSignalNotReceived();
8127 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
8128 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8130 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8131 application.SendNotification();
8132 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
8133 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8135 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8136 application.SendNotification();
8137 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
8138 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8140 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8141 application.SendNotification();
8142 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f) );
8143 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8145 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8146 application.SendNotification();
8147 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
8148 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8150 // We did expect the animation to finish
8152 finishCheck.CheckSignalReceived();
8156 int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
8158 TestApplication application;
8160 Actor actor = Actor::New();
8161 AngleAxis aa(Degree(90), Vector3::XAXIS);
8162 actor.SetOrientation(aa.angle, aa.axis);
8163 Stage::GetCurrent().Add(actor);
8165 application.SendNotification();
8166 application.Render(0);
8167 Quaternion start(Radian(aa.angle), aa.axis);
8168 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8170 // Build the animation
8171 float durationSeconds(1.0f);
8172 Animation animation = Animation::New(durationSeconds);
8174 KeyFrames keyFrames = KeyFrames::New();
8175 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
8177 //Cubic interpolation should be ignored for quaternions
8178 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
8180 // Start the animation
8183 bool signalReceived(false);
8184 AnimationFinishCheck finishCheck(signalReceived);
8185 animation.FinishedSignal().Connect(&application, finishCheck);
8186 application.SendNotification();
8187 application.SendNotification();
8188 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8189 application.SendNotification();
8190 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8191 application.SendNotification();
8193 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
8195 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8196 finishCheck.CheckSignalReceived();
8200 int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
8202 TestApplication application;
8204 Actor actor = Actor::New();
8205 AngleAxis aa(Degree(90), Vector3::XAXIS);
8206 actor.SetOrientation(aa.angle, aa.axis);
8207 application.SendNotification();
8208 application.Render(0);
8209 Stage::GetCurrent().Add(actor);
8211 Quaternion start(Radian(aa.angle), aa.axis);
8212 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8214 // Build the animation
8215 float durationSeconds(1.0f);
8216 Animation animation = Animation::New(durationSeconds);
8218 KeyFrames keyFrames = KeyFrames::New();
8219 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
8220 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
8221 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
8223 //Cubic interpolation should be ignored for quaternions
8224 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
8226 // Start the animation
8229 bool signalReceived(false);
8230 AnimationFinishCheck finishCheck(signalReceived);
8231 animation.FinishedSignal().Connect(&application, finishCheck);
8232 application.SendNotification();
8233 application.Render(0);
8234 application.SendNotification();
8235 finishCheck.CheckSignalNotReceived();
8237 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
8238 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8240 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8241 application.SendNotification();
8242 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
8243 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8245 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8246 application.SendNotification();
8247 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
8248 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8250 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8251 application.SendNotification();
8252 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f ) );
8253 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8255 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8256 application.SendNotification();
8257 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
8258 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8260 // We did expect the animation to finish
8262 finishCheck.CheckSignalReceived();
8266 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
8268 TestApplication application;
8270 float startValue(1.0f);
8271 Actor actor = Actor::New();
8272 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8273 Stage::GetCurrent().Add(actor);
8275 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8276 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8277 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8278 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8279 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8281 // Build the animation
8282 float durationSeconds(1.0f);
8283 Animation animation = Animation::New(durationSeconds);
8285 KeyFrames keyFrames = KeyFrames::New();
8286 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8287 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8288 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8290 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR );
8292 // Start the animation
8295 bool signalReceived(false);
8296 AnimationFinishCheck finishCheck(signalReceived);
8297 animation.FinishedSignal().Connect(&application, finishCheck);
8298 application.SendNotification();
8299 application.Render(0);
8300 application.SendNotification();
8301 finishCheck.CheckSignalNotReceived();
8302 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8303 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8304 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8305 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8307 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8308 application.SendNotification();
8309 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
8310 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
8311 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
8312 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
8314 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8315 application.SendNotification();
8316 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8317 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8318 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8319 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8321 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8322 application.SendNotification();
8323 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
8324 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
8325 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
8326 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
8328 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8329 application.SendNotification();
8330 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8331 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8332 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8333 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8335 // We did expect the animation to finish
8337 finishCheck.CheckSignalReceived();
8341 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
8343 TestApplication application;
8345 float startValue(1.0f);
8346 Actor actor = Actor::New();
8347 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8348 Stage::GetCurrent().Add(actor);
8350 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8351 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8352 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8353 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8354 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8356 // Build the animation
8357 float durationSeconds(1.0f);
8358 Animation animation = Animation::New(durationSeconds);
8360 KeyFrames keyFrames = KeyFrames::New();
8361 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8362 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8363 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8365 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::Cubic );
8367 // Start the animation
8370 bool signalReceived(false);
8371 AnimationFinishCheck finishCheck(signalReceived);
8372 animation.FinishedSignal().Connect(&application, finishCheck);
8373 application.SendNotification();
8374 application.Render(0);
8375 application.SendNotification();
8376 finishCheck.CheckSignalNotReceived();
8377 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8378 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8379 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8380 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8382 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8383 application.SendNotification();
8384 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION );
8385 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
8386 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION );
8387 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
8389 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8390 application.SendNotification();
8391 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8392 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8393 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8394 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8396 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8397 application.SendNotification();
8398 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION );
8399 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
8400 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION );
8401 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
8403 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8404 application.SendNotification();
8405 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8406 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8407 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8408 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8410 // We did expect the animation to finish
8412 finishCheck.CheckSignalReceived();
8416 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(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);
8434 Animation animation = Animation::New(durationSeconds);
8436 KeyFrames keyFrames = KeyFrames::New();
8437 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8438 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8439 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8441 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ) );
8443 // Start the animation
8446 bool signalReceived(false);
8447 AnimationFinishCheck finishCheck(signalReceived);
8448 animation.FinishedSignal().Connect(&application, finishCheck);
8449 application.SendNotification();
8451 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
8452 application.SendNotification();
8453 finishCheck.CheckSignalNotReceived();
8454 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8455 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8456 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8457 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8459 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
8460 application.SendNotification();
8461 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
8462 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
8463 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
8464 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
8466 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
8467 application.SendNotification();
8468 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8469 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8470 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8471 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8473 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
8474 application.SendNotification();
8475 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
8476 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
8477 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
8478 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
8480 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
8481 application.SendNotification();
8482 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8483 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8484 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8485 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8487 // We did expect the animation to finish
8489 finishCheck.CheckSignalReceived();
8493 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
8495 TestApplication application;
8497 float startValue(1.0f);
8498 Actor actor = Actor::New();
8499 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8500 Stage::GetCurrent().Add(actor);
8502 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8503 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8504 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8505 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8506 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8508 // Build the animation
8509 float durationSeconds(1.0f);
8511 Animation animation = Animation::New(durationSeconds);
8513 KeyFrames keyFrames = KeyFrames::New();
8514 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8515 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8516 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8518 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
8520 // Start the animation
8523 bool signalReceived(false);
8524 AnimationFinishCheck finishCheck(signalReceived);
8525 animation.FinishedSignal().Connect(&application, finishCheck);
8526 application.SendNotification();
8528 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
8529 application.SendNotification();
8530 finishCheck.CheckSignalNotReceived();
8531 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8532 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8533 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8534 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8536 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
8537 application.SendNotification();
8538 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION );
8539 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
8540 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION );
8541 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
8543 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
8544 application.SendNotification();
8545 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8546 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8547 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8548 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8550 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
8551 application.SendNotification();
8552 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION );
8553 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
8554 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION );
8555 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
8557 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
8558 application.SendNotification();
8559 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8560 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8561 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8562 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8564 // We did expect the animation to finish
8566 finishCheck.CheckSignalReceived();
8570 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
8572 TestApplication application;
8574 float startValue(1.0f);
8576 Actor actor = Actor::New();
8577 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8578 Stage::GetCurrent().Add(actor);
8580 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8581 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8582 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8583 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8584 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8586 // Build the animation
8587 float durationSeconds(1.0f);
8588 Animation animation = Animation::New(durationSeconds);
8590 KeyFrames keyFrames = KeyFrames::New();
8591 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8592 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8593 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8595 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
8597 // Start the animation
8600 bool signalReceived(false);
8601 AnimationFinishCheck finishCheck(signalReceived);
8602 animation.FinishedSignal().Connect(&application, finishCheck);
8603 application.SendNotification();
8605 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
8606 application.SendNotification();
8607 finishCheck.CheckSignalNotReceived();
8608 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8609 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8610 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8611 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8613 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
8614 application.SendNotification();
8615 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
8616 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
8617 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
8618 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
8620 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
8621 application.SendNotification();
8622 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8623 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8624 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8625 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8627 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
8628 application.SendNotification();
8629 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
8630 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
8631 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
8632 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
8634 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
8635 application.SendNotification();
8636 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8637 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8638 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8639 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8641 // We did expect the animation to finish
8643 finishCheck.CheckSignalReceived();
8647 int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void)
8649 TestApplication application;
8651 float startValue(1.0f);
8652 Actor actor = Actor::New();
8653 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8654 Stage::GetCurrent().Add(actor);
8656 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8657 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8658 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8659 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8660 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8662 // Build the animation
8663 float durationSeconds(1.0f);
8665 Animation animation = Animation::New(durationSeconds);
8667 KeyFrames keyFrames = KeyFrames::New();
8668 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8669 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8670 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8672 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
8674 // Start the animation
8677 bool signalReceived(false);
8678 AnimationFinishCheck finishCheck(signalReceived);
8679 animation.FinishedSignal().Connect(&application, finishCheck);
8680 application.SendNotification();
8682 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
8683 application.SendNotification();
8684 finishCheck.CheckSignalNotReceived();
8685 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8686 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8687 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8688 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8690 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
8691 application.SendNotification();
8692 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION );
8693 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
8694 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION );
8695 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
8697 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
8698 application.SendNotification();
8699 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8700 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8701 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8702 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8704 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
8705 application.SendNotification();
8706 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION );
8707 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
8708 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION );
8709 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
8711 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
8712 application.SendNotification();
8713 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8714 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8715 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8716 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8718 // We did expect the animation to finish
8720 finishCheck.CheckSignalReceived();
8724 int UtcDaliAnimationAnimateP(void)
8726 TestApplication application;
8728 Actor actor = Actor::New();
8729 Stage::GetCurrent().Add(actor);
8732 Vector3 position0( 30.0, 80.0, 0.0);
8733 Vector3 position1( 70.0, 120.0, 0.0);
8734 Vector3 position2( 100.0, 100.0, 0.0);
8736 Dali::Path path = Dali::Path::New();
8737 path.AddPoint(position0);
8738 path.AddPoint(position1);
8739 path.AddPoint(position2);
8741 //Control points for first segment
8742 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
8743 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
8745 //Control points for second segment
8746 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
8747 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
8749 // Build the animation
8750 float durationSeconds( 1.0f );
8751 Animation animation = Animation::New(durationSeconds);
8752 animation.Animate(actor, path, Vector3::XAXIS);
8754 // Start the animation
8757 bool signalReceived(false);
8758 AnimationFinishCheck finishCheck(signalReceived);
8759 animation.FinishedSignal().Connect(&application, finishCheck);
8760 application.SendNotification();
8761 application.Render(0);
8762 application.SendNotification();
8763 finishCheck.CheckSignalNotReceived();
8764 Vector3 position, tangent;
8765 Quaternion rotation;
8766 path.Sample( 0.0f, position, tangent );
8767 rotation = Quaternion( Vector3::XAXIS, tangent );
8768 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8769 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8771 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8772 application.SendNotification();
8773 path.Sample( 0.25f, position, tangent );
8774 rotation = Quaternion( Vector3::XAXIS, tangent );
8775 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8776 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8778 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8779 application.SendNotification();
8780 path.Sample( 0.5f, position, tangent );
8781 rotation = Quaternion( Vector3::XAXIS, tangent );
8782 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8783 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8785 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8786 application.SendNotification();
8787 path.Sample( 0.75f, position, tangent );
8788 rotation = Quaternion( Vector3::XAXIS, tangent );
8789 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8790 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8792 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8793 application.SendNotification();
8794 path.Sample( 1.0f, position, tangent );
8795 rotation = Quaternion( Vector3::XAXIS, tangent );
8796 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8797 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8799 finishCheck.CheckSignalReceived();
8803 int UtcDaliAnimationAnimateAlphaFunctionP(void)
8805 TestApplication application;
8807 Actor actor = Actor::New();
8808 Stage::GetCurrent().Add(actor);
8811 Vector3 position0( 30.0, 80.0, 0.0);
8812 Vector3 position1( 70.0, 120.0, 0.0);
8813 Vector3 position2( 100.0, 100.0, 0.0);
8815 Dali::Path path = Dali::Path::New();
8816 path.AddPoint(position0);
8817 path.AddPoint(position1);
8818 path.AddPoint(position2);
8820 //Control points for first segment
8821 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
8822 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
8824 //Control points for second segment
8825 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
8826 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
8828 // Build the animation
8829 float durationSeconds( 1.0f );
8830 Animation animation = Animation::New(durationSeconds);
8831 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
8833 // Start the animation
8836 bool signalReceived(false);
8837 AnimationFinishCheck finishCheck(signalReceived);
8838 animation.FinishedSignal().Connect(&application, finishCheck);
8839 application.SendNotification();
8840 application.Render(0);
8841 application.SendNotification();
8842 finishCheck.CheckSignalNotReceived();
8843 Vector3 position, tangent;
8844 Quaternion rotation;
8845 path.Sample( 0.0f, position, tangent );
8846 rotation = Quaternion( Vector3::XAXIS, tangent );
8847 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8848 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8850 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8851 application.SendNotification();
8852 path.Sample( 0.25f, position, tangent );
8853 rotation = Quaternion( Vector3::XAXIS, tangent );
8854 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8855 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8857 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8858 application.SendNotification();
8859 path.Sample( 0.5f, position, tangent );
8860 rotation = Quaternion( Vector3::XAXIS, tangent );
8861 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8862 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8864 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8865 application.SendNotification();
8866 path.Sample( 0.75f, position, tangent );
8867 rotation = Quaternion( Vector3::XAXIS, tangent );
8868 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8869 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8871 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8872 application.SendNotification();
8873 path.Sample( 1.0f, position, tangent );
8874 rotation = Quaternion( Vector3::XAXIS, tangent );
8875 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8876 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8878 finishCheck.CheckSignalReceived();
8882 int UtcDaliAnimationAnimateTimePeriodP(void)
8884 TestApplication application;
8886 Actor actor = Actor::New();
8887 Stage::GetCurrent().Add(actor);
8890 Vector3 position0( 30.0, 80.0, 0.0);
8891 Vector3 position1( 70.0, 120.0, 0.0);
8892 Vector3 position2( 100.0, 100.0, 0.0);
8894 Dali::Path path = Dali::Path::New();
8895 path.AddPoint(position0);
8896 path.AddPoint(position1);
8897 path.AddPoint(position2);
8899 //Control points for first segment
8900 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
8901 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
8903 //Control points for second segment
8904 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
8905 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
8907 // Build the animation
8908 float durationSeconds( 1.0f );
8909 Animation animation = Animation::New(durationSeconds);
8910 animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
8912 // Start the animation
8915 bool signalReceived(false);
8916 AnimationFinishCheck finishCheck(signalReceived);
8917 animation.FinishedSignal().Connect(&application, finishCheck);
8918 application.SendNotification();
8919 application.Render(0);
8920 application.SendNotification();
8921 finishCheck.CheckSignalNotReceived();
8922 Vector3 position, tangent;
8923 Quaternion rotation;
8924 path.Sample( 0.0f, position, tangent );
8925 rotation = Quaternion( Vector3::XAXIS, tangent );
8926 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8927 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8929 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8930 application.SendNotification();
8931 path.Sample( 0.25f, position, tangent );
8932 rotation = Quaternion( Vector3::XAXIS, tangent );
8933 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8934 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8936 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8937 application.SendNotification();
8938 path.Sample( 0.5f, position, tangent );
8939 rotation = Quaternion( Vector3::XAXIS, tangent );
8940 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8941 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8943 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8944 application.SendNotification();
8945 path.Sample( 0.75f, position, tangent );
8946 rotation = Quaternion( Vector3::XAXIS, tangent );
8947 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8948 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8950 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8951 application.SendNotification();
8952 path.Sample( 1.0f, position, tangent );
8953 rotation = Quaternion( Vector3::XAXIS, tangent );
8954 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8955 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8957 finishCheck.CheckSignalReceived();
8961 int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
8963 TestApplication application;
8965 Actor actor = Actor::New();
8966 Stage::GetCurrent().Add(actor);
8969 Vector3 position0( 30.0, 80.0, 0.0);
8970 Vector3 position1( 70.0, 120.0, 0.0);
8971 Vector3 position2( 100.0, 100.0, 0.0);
8973 Dali::Path path = Dali::Path::New();
8974 path.AddPoint(position0);
8975 path.AddPoint(position1);
8976 path.AddPoint(position2);
8978 //Control points for first segment
8979 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
8980 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
8982 //Control points for second segment
8983 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
8984 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
8986 // Build the animation
8987 float durationSeconds( 1.0f );
8988 Animation animation = Animation::New(durationSeconds);
8989 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
8991 // Start the animation
8994 bool signalReceived(false);
8995 AnimationFinishCheck finishCheck(signalReceived);
8996 animation.FinishedSignal().Connect(&application, finishCheck);
8997 application.SendNotification();
8998 application.Render(0);
8999 application.SendNotification();
9000 finishCheck.CheckSignalNotReceived();
9001 Vector3 position, tangent;
9002 Quaternion rotation;
9003 path.Sample( 0.0f, position, tangent );
9004 rotation = Quaternion( Vector3::XAXIS, tangent );
9005 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9006 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9008 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9009 application.SendNotification();
9010 path.Sample( 0.25f, position, tangent );
9011 rotation = Quaternion( Vector3::XAXIS, tangent );
9012 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9013 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9015 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9016 application.SendNotification();
9017 path.Sample( 0.5f, position, tangent );
9018 rotation = Quaternion( Vector3::XAXIS, tangent );
9019 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9020 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9022 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9023 application.SendNotification();
9024 path.Sample( 0.75f, position, tangent );
9025 rotation = Quaternion( Vector3::XAXIS, tangent );
9026 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9027 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9029 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9030 application.SendNotification();
9031 path.Sample( 1.0f, position, tangent );
9032 rotation = Quaternion( Vector3::XAXIS, tangent );
9033 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9034 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9036 finishCheck.CheckSignalReceived();
9040 int UtcDaliAnimationShowP(void)
9042 TestApplication application;
9044 Actor actor = Actor::New();
9045 actor.SetVisible(false);
9046 application.SendNotification();
9047 application.Render(0);
9048 DALI_TEST_CHECK( !actor.IsVisible() );
9049 Stage::GetCurrent().Add(actor);
9051 // Start the animation
9052 float durationSeconds(10.0f);
9053 Animation animation = Animation::New(durationSeconds);
9054 animation.Show(actor, durationSeconds*0.5f);
9057 bool signalReceived(false);
9058 AnimationFinishCheck finishCheck(signalReceived);
9059 animation.FinishedSignal().Connect(&application, finishCheck);
9061 application.SendNotification();
9062 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
9064 // We didn't expect the animation to finish yet
9065 application.SendNotification();
9066 finishCheck.CheckSignalNotReceived();
9067 DALI_TEST_CHECK( !actor.IsVisible() );
9069 application.SendNotification();
9070 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be shown now*/);
9072 // We didn't expect the animation to finish yet
9073 application.SendNotification();
9074 finishCheck.CheckSignalNotReceived();
9075 DALI_TEST_CHECK( actor.IsVisible() );
9077 application.SendNotification();
9078 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
9080 // We did expect the animation to finish
9081 application.SendNotification();
9082 finishCheck.CheckSignalReceived();
9083 DALI_TEST_CHECK( actor.IsVisible() );
9087 int UtcDaliAnimationHideP(void)
9089 TestApplication application;
9091 Actor actor = Actor::New();
9092 DALI_TEST_CHECK( actor.IsVisible() );
9093 Stage::GetCurrent().Add(actor);
9095 // Start the animation
9096 float durationSeconds(10.0f);
9097 Animation animation = Animation::New(durationSeconds);
9098 animation.Hide(actor, durationSeconds*0.5f);
9101 bool signalReceived(false);
9102 AnimationFinishCheck finishCheck(signalReceived);
9103 animation.FinishedSignal().Connect(&application, finishCheck);
9105 application.SendNotification();
9106 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
9108 // We didn't expect the animation to finish yet
9109 application.SendNotification();
9110 finishCheck.CheckSignalNotReceived();
9111 DALI_TEST_CHECK( actor.IsVisible() );
9113 application.SendNotification();
9114 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be hidden now*/);
9116 // We didn't expect the animation to finish yet
9117 application.SendNotification();
9118 finishCheck.CheckSignalNotReceived();
9119 DALI_TEST_CHECK( !actor.IsVisible() );
9121 application.SendNotification();
9122 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
9124 // We did expect the animation to finish
9125 application.SendNotification();
9126 finishCheck.CheckSignalReceived();
9127 DALI_TEST_CHECK( !actor.IsVisible() );
9131 int UtcDaliAnimationShowHideAtEndP(void)
9133 // Test that show/hide delay can be the same as animation duration
9134 // i.e. to show/hide at the end of the animation
9136 TestApplication application;
9138 Actor actor = Actor::New();
9139 DALI_TEST_CHECK( actor.IsVisible() );
9140 Stage::GetCurrent().Add(actor);
9142 // Start Hide animation
9143 float durationSeconds(10.0f);
9144 Animation animation = Animation::New(durationSeconds);
9145 animation.Hide(actor, durationSeconds/*Hide at end*/);
9148 bool signalReceived(false);
9149 AnimationFinishCheck finishCheck(signalReceived);
9150 animation.FinishedSignal().Connect(&application, finishCheck);
9152 application.SendNotification();
9153 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
9155 // We did expect the animation to finish
9156 application.SendNotification();
9157 finishCheck.CheckSignalReceived();
9158 DALI_TEST_CHECK( !actor.IsVisible() );
9160 // Start Show animation
9161 animation = Animation::New(durationSeconds);
9162 animation.Show(actor, durationSeconds/*Show at end*/);
9163 animation.FinishedSignal().Connect(&application, finishCheck);
9166 application.SendNotification();
9167 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
9169 // We did expect the animation to finish
9170 application.SendNotification();
9171 finishCheck.CheckSignalReceived();
9172 DALI_TEST_CHECK( actor.IsVisible() );
9176 int UtcDaliKeyFramesCreateDestroyP(void)
9178 tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
9180 KeyFrames* keyFrames = new KeyFrames;
9182 DALI_TEST_CHECK( true );
9186 int UtcDaliKeyFramesDownCastP(void)
9188 TestApplication application;
9189 tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
9191 KeyFrames keyFrames = KeyFrames::New();
9192 BaseHandle object(keyFrames);
9194 KeyFrames keyFrames2 = KeyFrames::DownCast(object);
9195 DALI_TEST_CHECK(keyFrames2);
9197 KeyFrames keyFrames3 = DownCast< KeyFrames >(object);
9198 DALI_TEST_CHECK(keyFrames3);
9200 BaseHandle unInitializedObject;
9201 KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
9202 DALI_TEST_CHECK(!keyFrames4);
9204 KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject);
9205 DALI_TEST_CHECK(!keyFrames5);
9209 int UtcDaliAnimationCreateDestroyP(void)
9211 TestApplication application;
9212 Animation* animation = new Animation;
9213 DALI_TEST_CHECK( animation );
9218 struct UpdateManagerTestConstraint
9220 UpdateManagerTestConstraint(TestApplication& application)
9221 : mApplication(application)
9225 void operator()( Vector3& current, const PropertyInputContainer& /* inputs */)
9227 mApplication.SendNotification(); // Process events
9230 TestApplication& mApplication;
9233 int UtcDaliAnimationUpdateManagerP(void)
9235 TestApplication application;
9237 Actor actor = Actor::New();
9238 Stage::GetCurrent().Add( actor );
9240 // Build the animation
9241 Animation animation = Animation::New( 0.0f );
9243 bool signalReceived = false;
9244 AnimationFinishCheck finishCheck( signalReceived );
9245 animation.FinishedSignal().Connect( &application, finishCheck );
9247 Vector3 startValue(1.0f, 1.0f, 1.0f);
9248 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
9249 Constraint constraint = Constraint::New<Vector3>( actor, index, UpdateManagerTestConstraint( application ) );
9252 // Apply animation to actor
9253 animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunction::LINEAR );
9257 application.SendNotification();
9258 application.UpdateOnly( 16 );
9260 finishCheck.CheckSignalNotReceived();
9262 application.SendNotification(); // Process events
9264 finishCheck.CheckSignalReceived();
9269 int UtcDaliAnimationSignalOrderP(void)
9271 TestApplication application;
9273 Actor actor = Actor::New();
9274 Stage::GetCurrent().Add( actor );
9276 // Build the animations
9277 Animation animation1 = Animation::New( 0.0f ); // finishes first frame
9278 Animation animation2 = Animation::New( 0.02f ); // finishes in 20 ms
9280 bool signal1Received = false;
9281 animation1.FinishedSignal().Connect( &application, AnimationFinishCheck( signal1Received ) );
9283 bool signal2Received = false;
9284 animation2.FinishedSignal().Connect( &application, AnimationFinishCheck( signal2Received ) );
9286 // Apply animations to actor
9287 animation1.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 3.0f, 2.0f, 1.0f ), AlphaFunction::LINEAR );
9289 animation2.AnimateTo( Property(actor, Actor::Property::SIZE ), Vector3( 10.0f, 20.0f, 30.0f ), AlphaFunction::LINEAR );
9292 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
9293 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
9295 application.SendNotification();
9296 application.UpdateOnly( 10 ); // 10ms progress
9298 // no notifications yet
9299 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
9300 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
9302 application.SendNotification();
9305 DALI_TEST_EQUALS( signal1Received, true, TEST_LOCATION );
9306 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
9307 signal1Received = false;
9309 // 1st animation is complete now, do another update with no ProcessEvents in between
9310 application.UpdateOnly( 20 ); // 20ms progress
9313 application.SendNotification();
9315 // 2nd should complete now
9316 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
9317 DALI_TEST_EQUALS( signal2Received, true, TEST_LOCATION );
9322 int UtcDaliAnimationExtendDurationP(void)
9324 TestApplication application;
9326 Actor actor = Actor::New();
9328 // Register a float property
9329 float startValue(10.0f);
9330 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
9331 Stage::GetCurrent().Add(actor);
9332 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
9334 // Build the animation
9335 float initialDurationSeconds(1.0f);
9336 float animatorDelay = 5.0f;
9337 float animatorDurationSeconds(5.0f);
9338 float extendedDurationSeconds(animatorDelay+animatorDurationSeconds);
9339 Animation animation = Animation::New(initialDurationSeconds);
9340 float targetValue(30.0f);
9341 float relativeValue(targetValue - startValue);
9343 animation.AnimateTo(Property(actor, index),
9345 TimePeriod(animatorDelay, animatorDurationSeconds));
9347 // The duration should have been extended
9348 DALI_TEST_EQUALS( animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION );
9350 // Start the animation
9353 bool signalReceived(false);
9354 AnimationFinishCheck finishCheck(signalReceived);
9355 animation.FinishedSignal().Connect(&application, finishCheck);
9357 application.SendNotification();
9358 application.Render(static_cast<unsigned int>(extendedDurationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
9360 // We didn't expect the animation to finish yet
9361 application.SendNotification();
9362 finishCheck.CheckSignalNotReceived();
9363 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
9365 application.SendNotification();
9366 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
9368 // We didn't expect the animation to finish yet
9369 application.SendNotification();
9370 finishCheck.CheckSignalNotReceived();
9371 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
9373 application.SendNotification();
9374 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
9376 // We did expect the animation to finish
9377 application.SendNotification();
9378 finishCheck.CheckSignalReceived();
9379 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
9383 int UtcDaliAnimationCustomIntProperty(void)
9385 TestApplication application;
9387 Actor actor = Actor::New();
9388 Stage::GetCurrent().Add(actor);
9391 Property::Index index = actor.RegisterProperty("anIndex", startValue);
9392 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
9394 // Build the animation
9395 float durationSeconds(1.0f);
9396 Animation animation = Animation::New(durationSeconds);
9397 animation.AnimateTo( Property(actor, index), 20 );
9399 // Start the animation
9402 bool signalReceived(false);
9403 AnimationFinishCheck finishCheck(signalReceived);
9404 animation.FinishedSignal().Connect(&application, finishCheck);
9406 application.SendNotification();
9407 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
9409 // We didn't expect the animation to finish yet
9410 application.SendNotification();
9411 finishCheck.CheckSignalNotReceived();
9412 DALI_TEST_EQUALS( actor.GetProperty<int>(index), 10, TEST_LOCATION );
9414 application.SendNotification();
9415 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
9417 // We did expect the animation to finish
9418 application.SendNotification();
9419 finishCheck.CheckSignalReceived();
9420 DALI_TEST_EQUALS( actor.GetProperty<int>(index), 20, TEST_LOCATION );