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 UtcDaliAnimationIsLoopingP(void)
341 TestApplication application;
343 Animation animation = Animation::New(1.0f);
344 DALI_TEST_CHECK(!animation.IsLooping());
346 animation.SetLooping(true);
347 DALI_TEST_CHECK(animation.IsLooping());
351 int UtcDaliAnimationSetEndActioN(void)
353 TestApplication application;
355 Actor actor = Actor::New();
356 Stage::GetCurrent().Add(actor);
358 // Build the animation
359 float durationSeconds(1.0f);
360 Animation animation = Animation::New(durationSeconds);
361 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
363 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
364 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
366 // Start the animation
369 bool signalReceived(false);
370 AnimationFinishCheck finishCheck(signalReceived);
371 animation.FinishedSignal().Connect(&application, finishCheck);
373 application.SendNotification();
374 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
376 // We did expect the animation to finish
377 application.SendNotification();
378 finishCheck.CheckSignalReceived();
379 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
381 // Go back to the start
382 actor.SetPosition(Vector3::ZERO);
383 application.SendNotification();
384 application.Render(0);
385 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
387 // Test BakeFinal, animate again, for half the duration
389 animation.SetEndAction(Animation::BakeFinal);
390 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
393 application.SendNotification();
394 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f*0.5f) /*half of the animation duration*/);
396 // Stop the animation early
399 // We did NOT expect the animation to finish
400 application.SendNotification();
401 finishCheck.CheckSignalNotReceived();
402 DALI_TEST_EQUALS( targetPosition * 0.5f, actor.GetCurrentPosition(), VECTOR4_EPSILON, TEST_LOCATION );
404 // The position should be same with target position in the next frame
405 application.Render(0);
406 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
408 // Go back to the start
409 actor.SetPosition(Vector3::ZERO);
410 application.SendNotification();
411 application.Render(0);
412 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
414 // Test EndAction::Discard, animate again, but don't bake this time
416 animation.SetEndAction(Animation::Discard);
417 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
420 application.SendNotification();
421 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
423 // We did expect the animation to finish
424 application.SendNotification();
425 finishCheck.CheckSignalReceived();
426 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
428 // The position should be discarded in the next frame
429 application.Render(0);
430 DALI_TEST_EQUALS( Vector3::ZERO/*discarded*/, actor.GetCurrentPosition(), TEST_LOCATION );
432 // Check that nothing has changed after a couple of buffer swaps
433 application.Render(0);
434 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
435 application.Render(0);
436 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
440 int UtcDaliAnimationGetEndActionP(void)
442 TestApplication application;
444 Animation animation = Animation::New(1.0f);
445 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
447 animation.SetEndAction(Animation::Discard);
448 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
450 animation.SetEndAction(Animation::BakeFinal);
451 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
456 int UtcDaliAnimationSetDisconnectActionP(void)
458 TestApplication application;
459 Stage stage( Stage::GetCurrent() );
461 // Default: BakeFinal
463 Actor actor = Actor::New();
466 // Build the animation
467 float durationSeconds(1.0f);
468 Animation animation = Animation::New(durationSeconds);
469 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal);
471 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
472 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
474 // Start the animation
477 application.SendNotification();
478 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
482 application.SendNotification();
483 application.Render();
485 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
490 Actor actor = Actor::New();
493 // Build the animation
494 float durationSeconds(1.0f);
495 Animation animation = Animation::New(durationSeconds);
496 animation.SetDisconnectAction( Animation::Bake );
498 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
499 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
501 // Start the animation
504 application.SendNotification();
505 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
509 application.SendNotification();
510 application.Render();
512 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition*0.5f, TEST_LOCATION );
517 Actor actor = Actor::New();
520 // Build the animation
521 float durationSeconds(1.0f);
522 Animation animation = Animation::New(durationSeconds);
523 animation.SetDisconnectAction( Animation::Discard );
525 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
526 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
528 // Start the animation
531 application.SendNotification();
532 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
536 application.SendNotification();
537 application.Render();
539 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
542 // Don't play the animation: disconnect action should not be applied
544 Actor actor = Actor::New();
547 // Build the animation
548 float durationSeconds(1.0f);
549 Animation animation = Animation::New(durationSeconds);
551 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
552 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
554 application.SendNotification();
555 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
559 application.SendNotification();
560 application.Render();
562 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
568 int UtcDaliAnimationGetDisconnectActionP(void)
570 TestApplication application;
571 Animation animation = Animation::New(1.0f);
572 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal); // default!
574 animation.SetDisconnectAction(Animation::Discard);
575 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Discard);
577 animation.SetDisconnectAction(Animation::Bake);
578 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Bake);
583 int UtcDaliAnimationSetDefaultAlphaFunctionP(void)
585 TestApplication application;
587 Animation animation = Animation::New(1.0f);
588 AlphaFunction func = animation.GetDefaultAlphaFunction();
589 DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
591 animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
592 AlphaFunction func2 = animation.GetDefaultAlphaFunction();
593 DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
597 int UtcDaliAnimationGetDefaultAlphaFunctionP(void)
599 TestApplication application;
601 Animation animation = Animation::New(1.0f);
602 AlphaFunction func = animation.GetDefaultAlphaFunction();
604 // Test that the default is linear
605 DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
607 animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
608 AlphaFunction func2 = animation.GetDefaultAlphaFunction();
609 DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
614 int UtcDaliAnimationSetCurrentProgressP(void)
616 TestApplication application;
618 Actor actor = Actor::New();
619 Stage::GetCurrent().Add(actor);
621 // Build the animation
622 Animation animation = Animation::New(0.0f);
625 float durationSeconds(1.0f);
626 animation.SetDuration(durationSeconds);
628 bool signalReceived(false);
629 AnimationFinishCheck finishCheck(signalReceived);
630 animation.FinishedSignal().Connect(&application, finishCheck);
631 application.SendNotification();
633 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
634 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
636 // Start the animation from 40% progress
637 animation.SetCurrentProgress( 0.4f );
640 application.SendNotification();
641 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
643 // We didn't expect the animation to finish yet
644 application.SendNotification();
645 finishCheck.CheckSignalNotReceived();
646 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
647 DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
649 animation.Play(); // Test that calling play has no effect, when animation is already playing
650 application.SendNotification();
652 //Set the progress to 70%
653 animation.SetCurrentProgress( 0.7f );
654 application.SendNotification();
655 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 80% progress */);
656 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
658 application.SendNotification();
659 finishCheck.CheckSignalNotReceived();
660 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
661 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
663 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
664 // We did expect the animation to finish
665 application.SendNotification();
666 finishCheck.CheckSignalReceived();
667 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
669 // Check that nothing has changed after a couple of buffer swaps
670 application.Render(0);
671 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
672 application.Render(0);
673 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
677 int UtcDaliAnimationSetCurrentProgressN(void)
679 TestApplication application;
681 Actor actor = Actor::New();
682 Stage::GetCurrent().Add(actor);
684 // Build the animation
685 Animation animation = Animation::New(0.0f);
688 float durationSeconds(1.0f);
689 animation.SetDuration(durationSeconds);
691 bool signalReceived(false);
692 AnimationFinishCheck finishCheck(signalReceived);
693 animation.FinishedSignal().Connect(&application, finishCheck);
694 application.SendNotification();
696 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
697 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
699 //Trying to set the current cursor outside the range [0..1] is ignored
700 animation.SetCurrentProgress( -1.0f);
701 application.SendNotification();
702 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
704 animation.SetCurrentProgress( 100.0f);
705 application.SendNotification();
706 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
710 int UtcDaliAnimationGetCurrentProgressP(void)
712 TestApplication application;
714 Actor actor = Actor::New();
715 Stage::GetCurrent().Add(actor);
717 // Build the animation
718 Animation animation = Animation::New(0.0f);
721 //Test GetCurrentProgress return 0.0 as the duration is 0.0
722 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
724 animation.SetCurrentProgress( 0.5f );
725 application.SendNotification();
726 application.Render(static_cast<unsigned int>(100.0f));
728 //Progress should still be 0.0
729 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
732 float durationSeconds(1.0f);
733 animation.SetDuration(durationSeconds);
734 application.SendNotification();
736 bool signalReceived(false);
737 AnimationFinishCheck finishCheck(signalReceived);
738 animation.FinishedSignal().Connect(&application, finishCheck);
739 application.SendNotification();
741 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
742 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
744 // Start the animation from 40% progress
745 animation.SetCurrentProgress( 0.4f );
748 application.SendNotification();
749 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
751 // We didn't expect the animation to finish yet
752 application.SendNotification();
753 finishCheck.CheckSignalNotReceived();
754 DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
756 animation.Play(); // Test that calling play has no effect, when animation is already playing
757 application.SendNotification();
759 //Set the progress to 70%
760 animation.SetCurrentProgress( 0.7f );
761 application.SendNotification();
762 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 80% progress */);
763 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
765 application.SendNotification();
766 finishCheck.CheckSignalNotReceived();
767 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
769 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
770 // We did expect the animation to finish
771 application.SendNotification();
772 finishCheck.CheckSignalReceived();
776 int UtcDaliAnimationSetSpeedFactorP(void)
778 TestApplication application;
780 Actor actor = Actor::New();
781 Stage::GetCurrent().Add(actor);
783 // Build the animation
784 float durationSeconds(1.0f);
785 Animation animation = Animation::New(durationSeconds);
787 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
788 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
790 KeyFrames keyframes = KeyFrames::New();
791 keyframes.Add( 0.0f, initialPosition);
792 keyframes.Add( 1.0f, targetPosition );
793 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
796 animation.SetSpeedFactor(2.0f);
798 // Start the animation
801 bool signalReceived(false);
802 AnimationFinishCheck finishCheck(signalReceived);
803 animation.FinishedSignal().Connect(&application, finishCheck);
805 application.SendNotification();
806 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
808 // We didn't expect the animation to finish yet
809 application.SendNotification();
810 finishCheck.CheckSignalNotReceived();
811 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
813 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
815 // We didn't expect the animation to finish yet
816 application.SendNotification();
817 finishCheck.CheckSignalNotReceived();
818 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
820 application.Render(static_cast<unsigned int>(durationSeconds*100.0f) + 1u/*just beyond half the duration*/);
822 // We did expect the animation to finish
823 application.SendNotification();
824 finishCheck.CheckSignalReceived();
825 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
827 // Check that nothing has changed after a couple of buffer swaps
828 application.Render(0);
829 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
830 application.Render(0);
831 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
835 //Test -1 speed factor. Animation will play in reverse at normal speed
836 animation.SetSpeedFactor( -1.0f );
838 // Start the animation
841 application.SendNotification();
842 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
844 // We didn't expect the animation to finish yet
845 application.SendNotification();
846 finishCheck.CheckSignalNotReceived();
847 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
849 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
851 // We didn't expect the animation to finish yet
852 application.SendNotification();
853 finishCheck.CheckSignalNotReceived();
854 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
856 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
858 // We didn't expect the animation to finish yet
859 application.SendNotification();
860 finishCheck.CheckSignalNotReceived();
861 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
863 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
865 // We didn't expect the animation to finish yet
866 application.SendNotification();
867 finishCheck.CheckSignalNotReceived();
868 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
870 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
872 // We did expect the animation to finish
873 application.SendNotification();
874 finishCheck.CheckSignalReceived();
875 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
877 // Check that nothing has changed after a couple of buffer swaps
878 application.Render(0);
879 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
880 application.Render(0);
881 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
883 //Test change speed factor on the fly
886 //Set speed to be half of normal speed
887 animation.SetSpeedFactor( 0.5f );
889 // Start the animation
892 application.SendNotification();
893 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
895 // We didn't expect the animation to finish yet
896 application.SendNotification();
897 finishCheck.CheckSignalNotReceived();
898 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), TEST_LOCATION );
900 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
902 // We didn't expect the animation to finish yet
903 application.SendNotification();
904 finishCheck.CheckSignalNotReceived();
905 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
907 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
909 // We didn't expect the animation to finish yet
910 application.SendNotification();
911 finishCheck.CheckSignalNotReceived();
912 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.3f), TEST_LOCATION );
914 //Change speed factor while animation still playing.
915 animation.SetSpeedFactor(-1.0f);
916 application.SendNotification();
917 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
919 // We didn't expect the animation to finish yet
920 application.SendNotification();
921 finishCheck.CheckSignalNotReceived();
922 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), TEST_LOCATION );
924 application.Render(static_cast<unsigned int>(durationSeconds*100.0f) + 1u/*just beyond the animation duration*/);
926 // We did expect the animation to finish
927 application.SendNotification();
928 finishCheck.CheckSignalReceived();
929 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
931 // Check that nothing has changed after a couple of buffer swaps
932 application.Render(0);
933 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
934 application.Render(0);
935 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
939 int UtcDaliAnimationGetSpeedFactorP(void)
941 TestApplication application;
943 Animation animation = Animation::New(1.0f);
944 animation.SetSpeedFactor(0.5f);
945 DALI_TEST_EQUALS(animation.GetSpeedFactor(), 0.5f, TEST_LOCATION);
947 animation.SetSpeedFactor(-2.5f);
948 DALI_TEST_EQUALS(animation.GetSpeedFactor(), -2.5f, TEST_LOCATION);
952 int UtcDaliAnimationSetPlayRangeP(void)
954 TestApplication application;
956 Actor actor = Actor::New();
957 Stage::GetCurrent().Add( actor );
959 // Build the animation
960 float durationSeconds( 1.0f );
961 Animation animation = Animation::New( durationSeconds );
963 bool signalReceived( false );
964 AnimationFinishCheck finishCheck( signalReceived );
965 animation.FinishedSignal().Connect( &application, finishCheck );
966 application.SendNotification();
968 // Set range between 0.4 and 0.8
969 animation.SetPlayRange( Vector2( 0.4f, 0.9f ) );
970 application.SendNotification();
971 DALI_TEST_EQUALS( Vector2( 0.4f, 0.9f ), animation.GetPlayRange(), TEST_LOCATION );
973 Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
974 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR );
976 // Start the animation from 40% progress
979 application.SendNotification();
980 application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 60% progress */ );
982 // We didn't expect the animation to finish yet
983 application.SendNotification();
984 finishCheck.CheckSignalNotReceived();
985 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.6f ), TEST_LOCATION );
987 application.SendNotification();
988 application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 80% progress */ );
990 application.SendNotification();
991 finishCheck.CheckSignalNotReceived();
992 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.8f ), TEST_LOCATION );
994 application.SendNotification();
995 application.Render( static_cast< unsigned int >( durationSeconds*100.0f ) + 1u/*just beyond the animation duration*/ );
997 // We did expect the animation to finish
998 application.SendNotification();
999 finishCheck.CheckSignalReceived();
1000 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.9f ), TEST_LOCATION );
1004 int UtcDaliAnimationSetPlayRangeN(void)
1006 TestApplication application;
1008 Actor actor = Actor::New();
1009 Stage::GetCurrent().Add(actor);
1011 // Build the animation
1012 Animation animation = Animation::New(0);
1013 application.SendNotification();
1015 //PlayRange out of bounds
1016 animation.SetPlayRange( Vector2(-1.0f,1.0f) );
1017 application.SendNotification();
1018 DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
1019 animation.SetPlayRange( Vector2(0.0f,2.0f) );
1020 application.SendNotification();
1021 DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
1023 //If playRange is not in the correct order it has to be ordered
1024 animation.SetPlayRange( Vector2(0.8f,0.2f) );
1025 application.SendNotification();
1026 DALI_TEST_EQUALS( Vector2(0.2f,0.8f), animation.GetPlayRange(), TEST_LOCATION );
1031 int UtcDaliAnimationGetPlayRangeP(void)
1033 TestApplication application;
1035 Actor actor = Actor::New();
1036 Stage::GetCurrent().Add( actor );
1038 // Build the animation
1039 Animation animation = Animation::New( 1.0f );
1040 application.SendNotification();
1042 //If PlayRange not specified it should be 0.0-1.0 by default
1043 DALI_TEST_EQUALS( Vector2( 0.0f,1.0f ), animation.GetPlayRange(), TEST_LOCATION );
1045 // Set range between 0.4 and 0.8
1046 animation.SetPlayRange( Vector2( 0.4f, 0.8f ) );
1047 application.SendNotification();
1048 DALI_TEST_EQUALS( Vector2( 0.4f, 0.8f ), animation.GetPlayRange(), TEST_LOCATION );
1053 int UtcDaliAnimationPlayP(void)
1055 TestApplication application;
1057 Actor actor = Actor::New();
1058 Stage::GetCurrent().Add(actor);
1060 // Build the animation
1061 float durationSeconds(1.0f);
1062 Animation animation = Animation::New(durationSeconds);
1063 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1064 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1066 // Start the animation
1069 bool signalReceived(false);
1070 AnimationFinishCheck finishCheck(signalReceived);
1071 animation.FinishedSignal().Connect(&application, finishCheck);
1073 application.SendNotification();
1074 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1076 // We didn't expect the animation to finish yet
1077 application.SendNotification();
1078 finishCheck.CheckSignalNotReceived();
1079 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1081 animation.Play(); // Test that calling play has no effect, when animation is already playing
1082 application.SendNotification();
1083 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1085 // We didn't expect the animation to finish yet
1086 application.SendNotification();
1087 finishCheck.CheckSignalNotReceived();
1088 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1090 animation.Play(); // Test that calling play has no effect, when animation is already playing
1091 application.SendNotification();
1092 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1094 // We didn't expect the animation to finish yet
1095 application.SendNotification();
1096 finishCheck.CheckSignalNotReceived();
1097 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1099 animation.Play(); // Test that calling play has no effect, when animation is already playing
1100 application.SendNotification();
1101 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1103 // We didn't expect the animation to finish yet
1104 application.SendNotification();
1105 finishCheck.CheckSignalNotReceived();
1106 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1108 animation.Play(); // Test that calling play has no effect, when animation is already playing
1109 application.SendNotification();
1110 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1112 // We did expect the animation to finish
1113 application.SendNotification();
1114 finishCheck.CheckSignalReceived();
1115 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1117 // Check that nothing has changed after a couple of buffer swaps
1118 application.Render(0);
1119 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1120 application.Render(0);
1121 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1125 int UtcDaliAnimationPlayOffStageP(void)
1127 // Test that an animation can be played, when the actor is off-stage.
1128 // When the actor is added to the stage, it should appear at the current position
1129 // i.e. where it would have been anyway, if on-stage from the beginning.
1131 TestApplication application;
1133 Actor actor = Actor::New();
1134 Vector3 basePosition(Vector3::ZERO);
1135 DALI_TEST_EQUALS( actor.GetCurrentPosition(), basePosition, TEST_LOCATION );
1136 // Not added to the stage!
1138 // Build the animation
1139 float durationSeconds(1.0f);
1140 Animation animation = Animation::New(durationSeconds);
1141 animation.SetDisconnectAction( Animation::Discard );
1142 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1143 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1145 // Start the animation
1148 bool signalReceived(false);
1149 AnimationFinishCheck finishCheck(signalReceived);
1150 animation.FinishedSignal().Connect(&application, finishCheck);
1152 application.SendNotification();
1153 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1155 // We didn't expect the animation to finish yet
1156 application.SendNotification();
1157 finishCheck.CheckSignalNotReceived();
1158 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*off-stage*/, TEST_LOCATION );
1161 Stage::GetCurrent().Add(actor);
1163 application.SendNotification();
1164 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1166 // We didn't expect the animation to finish yet
1167 application.SendNotification();
1168 finishCheck.CheckSignalNotReceived();
1169 Vector3 expectedPosition(basePosition + (targetPosition - basePosition)*0.4f);
1170 DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition/*on-stage*/, TEST_LOCATION );
1172 // Remove from the stage
1173 Stage::GetCurrent().Remove(actor);
1175 application.SendNotification();
1176 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1178 // We didn't expect the animation to finish yet
1179 application.SendNotification();
1180 finishCheck.CheckSignalNotReceived();
1181 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*back to start position*/, TEST_LOCATION );
1184 Stage::GetCurrent().Add(actor);
1186 application.SendNotification();
1187 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1189 // We didn't expect the animation to finish yet
1190 application.SendNotification();
1191 finishCheck.CheckSignalNotReceived();
1192 expectedPosition = Vector3(basePosition + (targetPosition - basePosition)*0.8f);
1193 DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition, TEST_LOCATION );
1195 application.SendNotification();
1196 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1198 // We did expect the animation to finish
1199 application.SendNotification();
1200 finishCheck.CheckSignalReceived();
1201 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1203 // Check that nothing has changed after a couple of buffer swaps
1204 application.Render(0);
1205 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1206 application.Render(0);
1207 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1211 int UtcDaliAnimationPlayDiscardHandleP(void)
1213 TestApplication application;
1215 Actor actor = Actor::New();
1216 Stage::GetCurrent().Add(actor);
1218 // Build the animation
1219 float durationSeconds(1.0f);
1220 Animation animation = Animation::New(durationSeconds);
1221 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1222 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1224 bool signalReceived(false);
1225 AnimationFinishCheck finishCheck(signalReceived);
1226 animation.FinishedSignal().Connect(&application, finishCheck);
1228 // Start the animation
1231 // This is a test of the "Fire and Forget" behaviour
1232 // Discard the animation handle!
1234 DALI_TEST_CHECK( !animation );
1236 application.SendNotification();
1237 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1239 // We didn't expect the animation to finish yet
1240 application.SendNotification();
1241 finishCheck.CheckSignalNotReceived();
1242 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1244 application.SendNotification();
1245 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1247 // We didn't expect the animation to finish yet
1248 application.SendNotification();
1249 finishCheck.CheckSignalNotReceived();
1250 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1252 application.SendNotification();
1253 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1255 // We didn't expect the animation to finish yet
1256 application.SendNotification();
1257 finishCheck.CheckSignalNotReceived();
1258 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1260 application.SendNotification();
1261 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1263 // We didn't expect the animation to finish yet
1264 application.SendNotification();
1265 finishCheck.CheckSignalNotReceived();
1266 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1268 application.SendNotification();
1269 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1271 // We did expect the animation to finish
1272 application.SendNotification();
1273 finishCheck.CheckSignalReceived();
1274 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1276 // Check that nothing has changed after a couple of buffer swaps
1277 application.Render(0);
1278 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1279 application.Render(0);
1280 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1284 int UtcDaliAnimationPlayStopDiscardHandleP(void)
1286 TestApplication application;
1288 Actor actor = Actor::New();
1289 Stage::GetCurrent().Add(actor);
1291 // Build the animation
1292 float durationSeconds(1.0f);
1293 Animation animation = Animation::New(durationSeconds);
1294 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1295 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1297 // Start the animation
1300 bool signalReceived(false);
1301 AnimationFinishCheck finishCheck(signalReceived);
1302 animation.FinishedSignal().Connect(&application, finishCheck);
1304 application.SendNotification();
1305 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1307 // We didn't expect the animation to finish yet
1308 application.SendNotification();
1309 finishCheck.CheckSignalNotReceived();
1310 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1312 // This is a test of the "Fire and Forget" behaviour
1313 // Stop the animation, and Discard the animation handle!
1316 DALI_TEST_CHECK( !animation );
1318 application.SendNotification();
1319 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1321 // We expect the animation to finish at 20% progress
1322 application.SendNotification();
1323 finishCheck.CheckSignalReceived();
1324 finishCheck.Reset();
1325 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1327 application.SendNotification();
1328 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1330 // Check that nothing has changed
1331 application.SendNotification();
1332 finishCheck.CheckSignalNotReceived();
1333 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1335 application.SendNotification();
1336 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1338 // Check that nothing has changed
1339 application.SendNotification();
1340 finishCheck.CheckSignalNotReceived();
1341 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1343 application.SendNotification();
1344 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 100% progress */);
1346 // Check that nothing has changed
1347 application.SendNotification();
1348 finishCheck.CheckSignalNotReceived();
1349 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1353 int UtcDaliAnimationPlayRangeP(void)
1355 TestApplication application;
1357 Actor actor = Actor::New();
1358 Stage::GetCurrent().Add(actor);
1360 // Build the animation
1361 float durationSeconds(1.0f);
1362 Animation animation = Animation::New(durationSeconds);
1363 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1364 KeyFrames keyframes = KeyFrames::New();
1365 keyframes.Add( 0.0f , Vector3(0.0f,0.0f,0.0f ) );
1366 keyframes.Add( 1.0f , Vector3(100.0f,100.0f,100.0f ) );
1368 animation.AnimateBetween( Property( actor, Actor::Property::POSITION), keyframes );
1370 // Set range between 0.4 and 0.8
1371 animation.SetPlayRange( Vector2(0.4f,0.8f) );
1374 bool signalReceived(false);
1375 AnimationFinishCheck finishCheck(signalReceived);
1376 animation.FinishedSignal().Connect(&application, finishCheck);
1378 //Test that setting progress outside the range doesn't work
1379 animation.SetCurrentProgress( 0.9f );
1380 application.SendNotification();
1381 application.Render(0);
1382 DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
1383 animation.SetCurrentProgress( 0.2f );
1384 application.SendNotification();
1385 application.Render(0);
1386 DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
1388 application.SendNotification();
1389 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1391 // We didn't expect the animation to finish yet
1392 application.SendNotification();
1393 finishCheck.CheckSignalNotReceived();
1394 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1396 animation.Play(); // Test that calling play has no effect, when animation is already playing
1397 application.SendNotification();
1398 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/* 80% progress */);
1400 // We did expect the animation to finish
1401 application.SendNotification();
1402 finishCheck.CheckSignalReceived();
1403 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1405 // Check that nothing has changed after a couple of buffer swaps
1406 application.Render(0);
1407 DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentPosition(), TEST_LOCATION );
1408 application.Render(0);
1409 DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentPosition(), TEST_LOCATION );
1412 //Loop inside the range
1413 finishCheck.Reset();
1414 animation.SetLooping( true );
1416 application.SendNotification();
1417 float intervalSeconds = 0.1f;
1418 float progress = 0.4f;
1419 for (int iterations = 0; iterations < 10; ++iterations )
1421 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
1423 progress += intervalSeconds;
1424 if (progress > 0.8f)
1426 progress = progress - 0.4f;
1429 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
1432 // We didn't expect the animation to finish yet
1433 application.SendNotification();
1434 finishCheck.CheckSignalNotReceived();
1437 //Test change range on the fly
1438 animation.SetPlayRange( Vector2( 0.2f, 0.9f ) );
1439 application.SendNotification();
1441 for (int iterations = 0; iterations < 10; ++iterations )
1443 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
1445 progress += intervalSeconds;
1446 if (progress > 0.9f)
1448 progress = progress - 0.7f;
1451 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
1457 int UtcDaliAnimationPlayFromP(void)
1459 TestApplication application;
1461 Actor actor = Actor::New();
1462 Stage::GetCurrent().Add(actor);
1464 // Build the animation
1465 float durationSeconds(1.0f);
1466 Animation animation = Animation::New(durationSeconds);
1467 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1468 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1470 // Start the animation from 40% progress
1471 animation.PlayFrom( 0.4f );
1473 bool signalReceived(false);
1474 AnimationFinishCheck finishCheck(signalReceived);
1475 animation.FinishedSignal().Connect(&application, finishCheck);
1477 application.SendNotification();
1478 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1480 // We didn't expect the animation to finish yet
1481 application.SendNotification();
1482 finishCheck.CheckSignalNotReceived();
1483 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1485 animation.Play(); // Test that calling play has no effect, when animation is already playing
1486 application.SendNotification();
1487 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1489 // We didn't expect the animation to finish yet
1490 application.SendNotification();
1491 finishCheck.CheckSignalNotReceived();
1492 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1494 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1495 // We did expect the animation to finish
1496 application.SendNotification();
1497 finishCheck.CheckSignalReceived();
1498 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1500 // Check that nothing has changed after a couple of buffer swaps
1501 application.Render(0);
1502 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1503 application.Render(0);
1504 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1508 int UtcDaliAnimationPlayFromN(void)
1510 TestApplication application;
1512 Actor actor = Actor::New();
1513 Stage::GetCurrent().Add(actor);
1515 // Build the animation
1516 float durationSeconds(1.0f);
1517 Animation animation = Animation::New(durationSeconds);
1518 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1519 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1521 //PlayFrom with an argument outside the range [0..1] will be ignored
1522 animation.PlayFrom(-1.0f);
1523 application.SendNotification();
1524 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1526 animation.PlayFrom(100.0f);
1527 application.SendNotification();
1528 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1532 int UtcDaliAnimationPauseP(void)
1534 TestApplication application;
1536 Actor actor = Actor::New();
1537 Stage::GetCurrent().Add(actor);
1539 // Build the animation
1540 float durationSeconds(1.0f);
1541 Animation animation = Animation::New(durationSeconds);
1542 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1543 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1545 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
1547 // Start the animation
1550 bool signalReceived(false);
1551 AnimationFinishCheck finishCheck(signalReceived);
1552 animation.FinishedSignal().Connect(&application, finishCheck);
1554 application.SendNotification();
1555 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
1557 // We didn't expect the animation to finish yet
1558 application.SendNotification();
1559 finishCheck.CheckSignalNotReceived();
1560 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
1562 // Pause the animation
1564 application.SendNotification();
1567 for (int i=0; i<5; ++i)
1569 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
1571 // We didn't expect the animation to finish yet
1572 application.SendNotification();
1573 finishCheck.CheckSignalNotReceived();
1574 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
1579 application.SendNotification();
1580 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
1582 // We didn't expect the animation to finish yet
1583 application.SendNotification();
1584 finishCheck.CheckSignalNotReceived();
1586 application.SendNotification();
1587 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
1589 // We did expect the animation to finish
1590 application.SendNotification();
1591 finishCheck.CheckSignalReceived();
1592 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1594 // Check that nothing has changed after a couple of buffer swaps
1595 application.Render(0);
1596 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1597 application.Render(0);
1598 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1602 int UtcDaliAnimationStoP(void)
1604 TestApplication application;
1606 Actor actor = Actor::New();
1607 Stage::GetCurrent().Add(actor);
1609 // Build the animation
1610 float durationSeconds(1.0f);
1611 Animation animation = Animation::New(durationSeconds);
1612 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1613 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1615 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
1617 // Start the animation
1620 bool signalReceived(false);
1621 AnimationFinishCheck finishCheck(signalReceived);
1622 animation.FinishedSignal().Connect(&application, finishCheck);
1624 application.SendNotification();
1625 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
1627 // We didn't expect the animation to finish yet
1628 application.SendNotification();
1629 finishCheck.CheckSignalNotReceived();
1630 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
1632 // Stop the animation
1634 application.SendNotification();
1637 for (int i=0; i<5; ++i)
1639 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
1641 // We did expect the animation to finish
1642 application.SendNotification();
1643 finishCheck.CheckSignalReceived();
1644 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when stopped */, TEST_LOCATION );
1649 int UtcDaliAnimationStopSetPositionP(void)
1651 // Test that Animation::Stop & Actor::SetPosition can be used in conjunction
1652 // i.e. to check that the animation does not interfere with the position set.
1654 TestApplication application;
1656 Actor actor = Actor::New();
1657 Stage::GetCurrent().Add(actor);
1659 // Build the animation
1660 float durationSeconds(1.0f);
1661 Animation animation = Animation::New(durationSeconds);
1662 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1663 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1665 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
1667 // Start the animation
1670 bool signalReceived(false);
1671 AnimationFinishCheck finishCheck(signalReceived);
1672 animation.FinishedSignal().Connect(&application, finishCheck);
1674 application.SendNotification();
1675 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
1677 // We didn't expect the animation to finish yet
1678 application.SendNotification();
1679 finishCheck.CheckSignalNotReceived();
1680 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
1682 // Stop the animation
1684 Vector3 positionSet(2.0f, 3.0f, 4.0f);
1685 actor.SetPosition(positionSet);
1686 application.SendNotification();
1689 for (int i=0; i<5; ++i)
1691 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
1693 // We did expect the animation to finish
1694 application.SendNotification();
1695 finishCheck.CheckSignalReceived();
1696 DALI_TEST_EQUALS( actor.GetCurrentPosition(), positionSet/*Animation should not interfere with this*/, TEST_LOCATION );
1701 int UtcDaliAnimationClearP(void)
1703 TestApplication application;
1705 Actor actor = Actor::New();
1706 Stage::GetCurrent().Add(actor);
1708 // Build the animation
1709 float durationSeconds(1.0f);
1710 Animation animation = Animation::New(durationSeconds);
1711 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1712 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1714 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
1716 // Start the animation
1719 bool signalReceived(false);
1720 AnimationFinishCheck finishCheck(signalReceived);
1721 animation.FinishedSignal().Connect(&application, finishCheck);
1723 application.SendNotification();
1724 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
1726 // We didn't expect the animation to finish yet
1727 application.SendNotification();
1728 finishCheck.CheckSignalNotReceived();
1729 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
1731 // Clear the animation
1733 application.SendNotification();
1735 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
1737 // We don't expect the animation to finish now
1738 application.SendNotification();
1739 finishCheck.CheckSignalNotReceived();
1740 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress since the animator was destroyed */, TEST_LOCATION );
1742 // Restart as a scale animation; this should not move the actor's position
1743 finishCheck.Reset();
1744 actor.SetPosition(Vector3::ZERO);
1745 Vector3 targetScale(3.0f, 3.0f, 3.0f);
1746 animation.AnimateTo( Property( actor, Actor::Property::SCALE ), targetScale, AlphaFunction::LINEAR );
1749 application.SendNotification();
1750 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
1752 // We didn't expect the animation to finish yet
1753 application.SendNotification();
1754 finishCheck.CheckSignalNotReceived();
1755 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
1756 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION );
1758 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
1760 // We did expect the animation to finish
1761 application.SendNotification();
1762 finishCheck.CheckSignalReceived();
1763 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
1764 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
1768 int UtcDaliAnimationFinishedSignalP(void)
1770 TestApplication application;
1772 // Start the empty animation
1773 float durationSeconds(1.0f);
1774 Animation animation = Animation::New(durationSeconds);
1777 bool signalReceived(false);
1778 AnimationFinishCheck finishCheck(signalReceived);
1779 animation.FinishedSignal().Connect(&application, finishCheck);
1781 application.SendNotification();
1782 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*beyond the animation duration*/);
1784 // We did expect the animation to finish
1785 application.SendNotification();
1786 finishCheck.CheckSignalReceived();
1790 int UtcDaliAnimationAnimateByBooleanP(void)
1792 TestApplication application;
1794 Actor actor = Actor::New();
1796 // Register a boolean property
1797 bool startValue(false);
1798 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1799 Stage::GetCurrent().Add(actor);
1800 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1802 // Build the animation
1803 float durationSeconds(2.0f);
1804 Animation animation = Animation::New(durationSeconds);
1805 const bool relativeValue(true);
1806 const bool finalValue( false || relativeValue );
1807 animation.AnimateBy(Property(actor, index), relativeValue);
1809 // Start the animation
1812 bool signalReceived(false);
1813 AnimationFinishCheck finishCheck(signalReceived);
1814 animation.FinishedSignal().Connect(&application, finishCheck);
1816 application.SendNotification();
1817 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1819 // We didn't expect the animation to finish yet
1820 application.SendNotification();
1821 finishCheck.CheckSignalNotReceived();
1822 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1824 application.SendNotification();
1825 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1827 // We did expect the animation to finish
1828 application.SendNotification();
1829 finishCheck.CheckSignalReceived();
1830 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1832 // Check that nothing has changed after a couple of buffer swaps
1833 application.Render(0);
1834 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1835 application.Render(0);
1836 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1838 // Repeat with relative value "false" - this should be an NOOP
1839 animation = Animation::New(durationSeconds);
1840 bool noOpValue(false);
1841 animation.AnimateBy(Property(actor, index), noOpValue);
1843 // Start the animation
1846 finishCheck.Reset();
1847 animation.FinishedSignal().Connect(&application, finishCheck);
1849 application.SendNotification();
1850 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1852 // We didn't expect the animation to finish yet
1853 application.SendNotification();
1854 finishCheck.CheckSignalNotReceived();
1855 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1857 application.SendNotification();
1858 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1860 // We did expect the animation to finish
1861 application.SendNotification();
1862 finishCheck.CheckSignalReceived();
1863 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1865 // Check that nothing has changed after a couple of buffer swaps
1866 application.Render(0);
1867 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1868 application.Render(0);
1869 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1873 int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void)
1875 TestApplication application;
1877 Actor actor = Actor::New();
1879 // Register a boolean property
1880 bool startValue(false);
1881 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1882 Stage::GetCurrent().Add(actor);
1883 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1885 // Build the animation
1886 float durationSeconds(2.0f);
1887 Animation animation = Animation::New(durationSeconds);
1888 bool relativeValue(true);
1889 bool finalValue( false || relativeValue );
1890 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN);
1892 // Start the animation
1895 bool signalReceived(false);
1896 AnimationFinishCheck finishCheck(signalReceived);
1897 animation.FinishedSignal().Connect(&application, finishCheck);
1899 application.SendNotification();
1900 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1902 // We didn't expect the animation to finish yet
1903 application.SendNotification();
1904 finishCheck.CheckSignalNotReceived();
1905 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1907 application.SendNotification();
1908 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1910 // We did expect the animation to finish
1911 application.SendNotification();
1912 finishCheck.CheckSignalReceived();
1913 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1915 // Check that nothing has changed after a couple of buffer swaps
1916 application.Render(0);
1917 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1918 application.Render(0);
1919 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1921 // Repeat with relative value "false" - this should be an NOOP
1922 animation = Animation::New(durationSeconds);
1923 bool noOpValue(false);
1924 animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunction::EASE_IN);
1926 // Start the animation
1929 finishCheck.Reset();
1930 animation.FinishedSignal().Connect(&application, finishCheck);
1932 application.SendNotification();
1933 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1935 // We didn't expect the animation to finish yet
1936 application.SendNotification();
1937 finishCheck.CheckSignalNotReceived();
1938 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1940 application.SendNotification();
1941 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1943 // We did expect the animation to finish
1944 application.SendNotification();
1945 finishCheck.CheckSignalReceived();
1946 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1950 int UtcDaliAnimationAnimateByBooleanTimePeriodP(void)
1952 TestApplication application;
1954 Actor actor = Actor::New();
1956 // Register a boolean property
1957 bool startValue(false);
1958 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1959 Stage::GetCurrent().Add(actor);
1960 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1962 // Build the animation
1963 float durationSeconds(2.0f);
1964 Animation animation = Animation::New(durationSeconds);
1965 bool relativeValue(true);
1966 bool finalValue( false || relativeValue );
1967 float animatorDurationSeconds(durationSeconds * 0.5f);
1968 animation.AnimateBy( Property(actor, index),
1970 TimePeriod( animatorDurationSeconds ) );
1972 // Start the animation
1975 bool signalReceived(false);
1976 AnimationFinishCheck finishCheck(signalReceived);
1977 animation.FinishedSignal().Connect(&application, finishCheck);
1979 application.SendNotification();
1980 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
1982 // We didn't expect the animation to finish yet
1983 application.SendNotification();
1984 finishCheck.CheckSignalNotReceived();
1985 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1987 application.SendNotification();
1988 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
1990 // We didn't expect the animation to finish yet...
1991 application.SendNotification();
1992 finishCheck.CheckSignalNotReceived();
1994 // ...however we should have reached the final value
1995 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1997 application.SendNotification();
1998 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
2000 // We did expect the animation to finish
2001 application.SendNotification();
2002 finishCheck.CheckSignalReceived();
2003 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2005 // Check that nothing has changed after a couple of buffer swaps
2006 application.Render(0);
2007 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2008 application.Render(0);
2009 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2013 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void)
2015 TestApplication application;
2017 Actor actor = Actor::New();
2019 // Register a boolean property
2020 bool startValue(false);
2021 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2022 Stage::GetCurrent().Add(actor);
2023 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2025 // Build the animation
2026 float durationSeconds(2.0f);
2027 Animation animation = Animation::New(durationSeconds);
2028 bool relativeValue(true);
2029 bool finalValue( false || relativeValue );
2030 float animatorDurationSeconds(durationSeconds * 0.5f);
2031 animation.AnimateBy( Property(actor, index),
2033 AlphaFunction::EASE_IN_OUT,
2034 TimePeriod( animatorDurationSeconds ) );
2036 // Start the animation
2039 bool signalReceived(false);
2040 AnimationFinishCheck finishCheck(signalReceived);
2041 animation.FinishedSignal().Connect(&application, finishCheck);
2043 application.SendNotification();
2044 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
2046 // We didn't expect the animation to finish yet
2047 application.SendNotification();
2048 finishCheck.CheckSignalNotReceived();
2049 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2051 application.SendNotification();
2052 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
2054 // We didn't expect the animation to finish yet...
2055 application.SendNotification();
2056 finishCheck.CheckSignalNotReceived();
2058 // ...however we should have reached the final value
2059 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2061 application.SendNotification();
2062 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
2064 // We did expect the animation to finish
2065 application.SendNotification();
2066 finishCheck.CheckSignalReceived();
2067 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2069 // Check that nothing has changed after a couple of buffer swaps
2070 application.Render(0);
2071 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2072 application.Render(0);
2073 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2077 int UtcDaliAnimationAnimateByFloatP(void)
2079 TestApplication application;
2081 Actor actor = Actor::New();
2083 // Register a float property
2084 float startValue(10.0f);
2085 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2086 Stage::GetCurrent().Add(actor);
2087 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2089 // Build the animation
2090 float durationSeconds(2.0f);
2091 Animation animation = Animation::New(durationSeconds);
2092 float targetValue(50.0f);
2093 float relativeValue(targetValue - startValue);
2094 animation.AnimateBy(Property(actor, index), relativeValue);
2096 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2098 // Start the animation
2101 bool signalReceived(false);
2102 AnimationFinishCheck finishCheck(signalReceived);
2103 animation.FinishedSignal().Connect(&application, finishCheck);
2105 application.SendNotification();
2106 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2108 // We didn't expect the animation to finish yet
2109 application.SendNotification();
2110 finishCheck.CheckSignalNotReceived();
2111 DALI_TEST_EQUALS( actor.GetProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION );
2113 application.SendNotification();
2114 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2116 // We did expect the animation to finish
2117 application.SendNotification();
2118 finishCheck.CheckSignalReceived();
2119 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2121 // Check that nothing has changed after a couple of buffer swaps
2122 application.Render(0);
2123 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2124 application.Render(0);
2125 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2129 int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void)
2131 TestApplication application;
2133 Actor actor = Actor::New();
2135 // Register a float property
2136 float startValue(10.0f);
2137 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2138 Stage::GetCurrent().Add(actor);
2139 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2141 // Build the animation
2142 float durationSeconds(1.0f);
2143 Animation animation = Animation::New(durationSeconds);
2144 float targetValue(90.0f);
2145 float relativeValue(targetValue - startValue);
2146 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
2148 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2150 // Start the animation
2153 bool signalReceived(false);
2154 AnimationFinishCheck finishCheck(signalReceived);
2155 animation.FinishedSignal().Connect(&application, finishCheck);
2157 application.SendNotification();
2158 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2160 // We didn't expect the animation to finish yet
2161 application.SendNotification();
2162 finishCheck.CheckSignalNotReceived();
2164 // The position should have moved more, than with a linear alpha function
2165 float current(actor.GetProperty<float>(index));
2166 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
2168 application.SendNotification();
2169 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2171 // We did expect the animation to finish
2172 application.SendNotification();
2173 finishCheck.CheckSignalReceived();
2174 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2176 // Check that nothing has changed after a couple of buffer swaps
2177 application.Render(0);
2178 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2179 application.Render(0);
2180 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2184 int UtcDaliAnimationAnimateByFloatTimePeriodP(void)
2186 TestApplication application;
2188 Actor actor = Actor::New();
2190 // Register a float property
2191 float startValue(10.0f);
2192 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2193 Stage::GetCurrent().Add(actor);
2194 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2196 // Build the animation
2197 float durationSeconds(1.0f);
2198 Animation animation = Animation::New(durationSeconds);
2199 float targetValue(30.0f);
2200 float relativeValue(targetValue - startValue);
2202 animation.AnimateBy(Property(actor, index),
2204 TimePeriod(delay, durationSeconds - delay));
2206 // Start the animation
2209 bool signalReceived(false);
2210 AnimationFinishCheck finishCheck(signalReceived);
2211 animation.FinishedSignal().Connect(&application, finishCheck);
2213 application.SendNotification();
2214 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2216 // We didn't expect the animation to finish yet
2217 application.SendNotification();
2218 finishCheck.CheckSignalNotReceived();
2219 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2221 application.SendNotification();
2222 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2224 // We didn't expect the animation to finish yet
2225 application.SendNotification();
2226 finishCheck.CheckSignalNotReceived();
2227 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2229 application.SendNotification();
2230 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2232 // We did expect the animation to finish
2233 application.SendNotification();
2234 finishCheck.CheckSignalReceived();
2235 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2237 // Check that nothing has changed after a couple of buffer swaps
2238 application.Render(0);
2239 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2240 application.Render(0);
2241 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2245 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void)
2247 TestApplication application;
2249 Actor actor = Actor::New();
2251 // Register a float property
2252 float startValue(10.0f);
2253 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2254 Stage::GetCurrent().Add(actor);
2255 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2257 // Build the animation
2258 float durationSeconds(1.0f);
2259 Animation animation = Animation::New(durationSeconds);
2260 float targetValue(30.0f);
2261 float relativeValue(targetValue - startValue);
2263 animation.AnimateBy(Property(actor, index),
2265 AlphaFunction::LINEAR,
2266 TimePeriod(delay, durationSeconds - delay));
2268 // Start the animation
2271 bool signalReceived(false);
2272 AnimationFinishCheck finishCheck(signalReceived);
2273 animation.FinishedSignal().Connect(&application, finishCheck);
2275 application.SendNotification();
2276 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2278 // We didn't expect the animation to finish yet
2279 application.SendNotification();
2280 finishCheck.CheckSignalNotReceived();
2281 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2283 application.SendNotification();
2284 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2286 // We didn't expect the animation to finish yet
2287 application.SendNotification();
2288 finishCheck.CheckSignalNotReceived();
2289 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2291 application.SendNotification();
2292 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2294 // We did expect the animation to finish
2295 application.SendNotification();
2296 finishCheck.CheckSignalReceived();
2297 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2299 // Check that nothing has changed after a couple of buffer swaps
2300 application.Render(0);
2301 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2302 application.Render(0);
2303 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2307 int UtcDaliAnimationAnimateByIntegerP(void)
2309 TestApplication application;
2311 Actor actor = Actor::New();
2313 // Register an integer property
2315 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2316 Stage::GetCurrent().Add(actor);
2317 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
2319 // Build the animation
2320 float durationSeconds(2.0f);
2321 Animation animation = Animation::New(durationSeconds);
2322 int targetValue(50);
2323 int relativeValue(targetValue - startValue);
2324 animation.AnimateBy(Property(actor, index), relativeValue);
2326 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
2328 // Start the animation
2331 bool signalReceived(false);
2332 AnimationFinishCheck finishCheck(signalReceived);
2333 animation.FinishedSignal().Connect(&application, finishCheck);
2335 application.SendNotification();
2336 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2338 // We didn't expect the animation to finish yet
2339 application.SendNotification();
2340 finishCheck.CheckSignalNotReceived();
2341 DALI_TEST_EQUALS( actor.GetProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION );
2343 application.SendNotification();
2344 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2346 // We did expect the animation to finish
2347 application.SendNotification();
2348 finishCheck.CheckSignalReceived();
2349 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2351 // Check that nothing has changed after a couple of buffer swaps
2352 application.Render(0);
2353 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2354 application.Render(0);
2355 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2359 int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void)
2361 TestApplication application;
2363 Actor actor = Actor::New();
2365 // Register an integer property
2367 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2368 Stage::GetCurrent().Add(actor);
2369 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
2371 // Build the animation
2372 float durationSeconds(1.0f);
2373 Animation animation = Animation::New(durationSeconds);
2374 int targetValue(90);
2375 int relativeValue(targetValue - startValue);
2376 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
2378 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
2380 // Start the animation
2383 bool signalReceived(false);
2384 AnimationFinishCheck finishCheck(signalReceived);
2385 animation.FinishedSignal().Connect(&application, finishCheck);
2387 application.SendNotification();
2388 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2390 // We didn't expect the animation to finish yet
2391 application.SendNotification();
2392 finishCheck.CheckSignalNotReceived();
2394 // The position should have moved more, than with a linear alpha function
2395 int current(actor.GetProperty<int>(index));
2396 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
2398 application.SendNotification();
2399 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2401 // We did expect the animation to finish
2402 application.SendNotification();
2403 finishCheck.CheckSignalReceived();
2404 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2406 // Check that nothing has changed after a couple of buffer swaps
2407 application.Render(0);
2408 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2409 application.Render(0);
2410 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2414 int UtcDaliAnimationAnimateByIntegerTimePeriodP(void)
2416 TestApplication application;
2418 Actor actor = Actor::New();
2420 // Register an integer property
2422 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2423 Stage::GetCurrent().Add(actor);
2424 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
2426 // Build the animation
2427 float durationSeconds(1.0f);
2428 Animation animation = Animation::New(durationSeconds);
2429 int targetValue(30);
2430 int relativeValue(targetValue - startValue);
2432 animation.AnimateBy(Property(actor, index),
2434 TimePeriod(delay, durationSeconds - delay));
2436 // Start the animation
2439 bool signalReceived(false);
2440 AnimationFinishCheck finishCheck(signalReceived);
2441 animation.FinishedSignal().Connect(&application, finishCheck);
2443 application.SendNotification();
2444 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2446 // We didn't expect the animation to finish yet
2447 application.SendNotification();
2448 finishCheck.CheckSignalNotReceived();
2449 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
2451 application.SendNotification();
2452 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2454 // We didn't expect the animation to finish yet
2455 application.SendNotification();
2456 finishCheck.CheckSignalNotReceived();
2457 DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
2459 application.SendNotification();
2460 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2462 // We did expect the animation to finish
2463 application.SendNotification();
2464 finishCheck.CheckSignalReceived();
2465 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2467 // Check that nothing has changed after a couple of buffer swaps
2468 application.Render(0);
2469 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2470 application.Render(0);
2471 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2475 int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void)
2477 TestApplication application;
2479 Actor actor = Actor::New();
2481 // Register an integer property
2483 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2484 Stage::GetCurrent().Add(actor);
2485 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
2487 // Build the animation
2488 float durationSeconds(1.0f);
2489 Animation animation = Animation::New(durationSeconds);
2490 int targetValue(30);
2491 int relativeValue(targetValue - startValue);
2493 animation.AnimateBy(Property(actor, index),
2495 AlphaFunction::LINEAR,
2496 TimePeriod(delay, durationSeconds - delay));
2498 // Start the animation
2501 bool signalReceived(false);
2502 AnimationFinishCheck finishCheck(signalReceived);
2503 animation.FinishedSignal().Connect(&application, finishCheck);
2505 application.SendNotification();
2506 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2508 // We didn't expect the animation to finish yet
2509 application.SendNotification();
2510 finishCheck.CheckSignalNotReceived();
2511 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
2513 application.SendNotification();
2514 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2516 // We didn't expect the animation to finish yet
2517 application.SendNotification();
2518 finishCheck.CheckSignalNotReceived();
2519 DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
2521 application.SendNotification();
2522 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2524 // We did expect the animation to finish
2525 application.SendNotification();
2526 finishCheck.CheckSignalReceived();
2527 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2529 // Check that nothing has changed after a couple of buffer swaps
2530 application.Render(0);
2531 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2532 application.Render(0);
2533 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2537 int UtcDaliAnimationAnimateByVector2P(void)
2539 TestApplication application;
2541 Actor actor = Actor::New();
2543 // Register a Vector2 property
2544 Vector2 startValue(10.0f, 10.0f);
2545 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2546 Stage::GetCurrent().Add(actor);
2547 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
2549 // Build the animation
2550 float durationSeconds(2.0f);
2551 Animation animation = Animation::New(durationSeconds);
2552 Vector2 targetValue(60.0f, 60.0f);
2553 Vector2 relativeValue(targetValue - startValue);
2554 animation.AnimateBy(Property(actor, index), relativeValue);
2556 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2558 // Start the animation
2561 bool signalReceived(false);
2562 AnimationFinishCheck finishCheck(signalReceived);
2563 animation.FinishedSignal().Connect(&application, finishCheck);
2565 application.SendNotification();
2566 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2568 // We didn't expect the animation to finish yet
2569 application.SendNotification();
2570 finishCheck.CheckSignalNotReceived();
2571 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION );
2573 application.SendNotification();
2574 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2576 // We did expect the animation to finish
2577 application.SendNotification();
2578 finishCheck.CheckSignalReceived();
2579 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
2581 // Check that nothing has changed after a couple of buffer swaps
2582 application.Render(0);
2583 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
2584 application.Render(0);
2585 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
2589 int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void)
2591 TestApplication application;
2593 Actor actor = Actor::New();
2595 // Register a Vector2 property
2596 Vector2 startValue(100.0f, 100.0f);
2597 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2598 Stage::GetCurrent().Add(actor);
2599 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
2601 // Build the animation
2602 float durationSeconds(1.0f);
2603 Animation animation = Animation::New(durationSeconds);
2604 Vector2 targetValue(20.0f, 20.0f);
2605 Vector2 relativeValue(targetValue - startValue);
2606 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
2608 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2610 // Start the animation
2613 bool signalReceived(false);
2614 AnimationFinishCheck finishCheck(signalReceived);
2615 animation.FinishedSignal().Connect(&application, finishCheck);
2617 application.SendNotification();
2618 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2620 // We didn't expect the animation to finish yet
2621 application.SendNotification();
2622 finishCheck.CheckSignalNotReceived();
2624 // The position should have moved more, than with a linear alpha function
2625 Vector2 current(actor.GetProperty<Vector2>(index));
2626 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
2627 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
2629 application.SendNotification();
2630 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2632 // We did expect the animation to finish
2633 application.SendNotification();
2634 finishCheck.CheckSignalReceived();
2635 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
2637 // Check that nothing has changed after a couple of buffer swaps
2638 application.Render(0);
2639 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
2640 application.Render(0);
2641 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
2645 int UtcDaliAnimationAnimateByVector2TimePeriodP(void)
2647 TestApplication application;
2649 Actor actor = Actor::New();
2651 // Register a Vector2 property
2652 Vector2 startValue(10.0f, 10.0f);
2653 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2654 Stage::GetCurrent().Add(actor);
2655 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
2657 // Build the animation
2658 float durationSeconds(1.0f);
2659 Animation animation = Animation::New(durationSeconds);
2660 Vector2 targetValue(30.0f, 30.0f);
2661 Vector2 relativeValue(targetValue - startValue);
2663 animation.AnimateBy(Property(actor, index),
2665 TimePeriod(delay, durationSeconds - delay));
2667 // Start the animation
2670 bool signalReceived(false);
2671 AnimationFinishCheck finishCheck(signalReceived);
2672 animation.FinishedSignal().Connect(&application, finishCheck);
2674 application.SendNotification();
2675 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2677 // We didn't expect the animation to finish yet
2678 application.SendNotification();
2679 finishCheck.CheckSignalNotReceived();
2680 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
2682 application.SendNotification();
2683 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2685 // We didn't expect the animation to finish yet
2686 application.SendNotification();
2687 finishCheck.CheckSignalNotReceived();
2688 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2690 application.SendNotification();
2691 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2693 // We did expect the animation to finish
2694 application.SendNotification();
2695 finishCheck.CheckSignalReceived();
2696 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
2698 // Check that nothing has changed after a couple of buffer swaps
2699 application.Render(0);
2700 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
2701 application.Render(0);
2702 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
2706 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void)
2708 TestApplication application;
2710 Actor actor = Actor::New();
2712 // Register a Vector2 property
2713 Vector2 startValue(5.0f, 5.0f);
2714 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2715 Stage::GetCurrent().Add(actor);
2716 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
2718 // Build the animation
2719 float durationSeconds(1.0f);
2720 Animation animation = Animation::New(durationSeconds);
2721 Vector2 targetValue(10.0f, 10.0f);
2722 Vector2 relativeValue(targetValue - startValue);
2724 animation.AnimateBy(Property(actor, index),
2726 AlphaFunction::LINEAR,
2727 TimePeriod(delay, durationSeconds - delay));
2729 // Start the animation
2732 bool signalReceived(false);
2733 AnimationFinishCheck finishCheck(signalReceived);
2734 animation.FinishedSignal().Connect(&application, finishCheck);
2736 application.SendNotification();
2737 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2739 // We didn't expect the animation to finish yet
2740 application.SendNotification();
2741 finishCheck.CheckSignalNotReceived();
2742 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
2744 application.SendNotification();
2745 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2747 // We didn't expect the animation to finish yet
2748 application.SendNotification();
2749 finishCheck.CheckSignalNotReceived();
2750 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2752 application.SendNotification();
2753 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2755 // We did expect the animation to finish
2756 application.SendNotification();
2757 finishCheck.CheckSignalReceived();
2758 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
2760 // Check that nothing has changed after a couple of buffer swaps
2761 application.Render(0);
2762 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
2763 application.Render(0);
2764 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
2768 int UtcDaliAnimationAnimateByVector3P(void)
2770 TestApplication application;
2772 Actor actor = Actor::New();
2774 // Register a Vector3 property
2775 Vector3 startValue(10.0f, 10.0f, 10.0f);
2776 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2777 Stage::GetCurrent().Add(actor);
2778 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
2780 // Build the animation
2781 float durationSeconds(2.0f);
2782 Animation animation = Animation::New(durationSeconds);
2783 Vector3 targetValue(60.0f, 60.0f, 60.0f);
2784 Vector3 relativeValue(targetValue - startValue);
2785 animation.AnimateBy(Property(actor, index), relativeValue);
2787 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2789 // Start the animation
2792 bool signalReceived(false);
2793 AnimationFinishCheck finishCheck(signalReceived);
2794 animation.FinishedSignal().Connect(&application, finishCheck);
2796 application.SendNotification();
2797 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2799 // We didn't expect the animation to finish yet
2800 application.SendNotification();
2801 finishCheck.CheckSignalNotReceived();
2802 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION );
2804 application.SendNotification();
2805 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2807 // We did expect the animation to finish
2808 application.SendNotification();
2809 finishCheck.CheckSignalReceived();
2810 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2812 // Check that nothing has changed after a couple of buffer swaps
2813 application.Render(0);
2814 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2815 application.Render(0);
2816 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2820 int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void)
2822 TestApplication application;
2824 Actor actor = Actor::New();
2826 // Register a Vector3 property
2827 Vector3 startValue(100.0f, 100.0f, 100.0f);
2828 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2829 Stage::GetCurrent().Add(actor);
2830 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
2832 // Build the animation
2833 float durationSeconds(1.0f);
2834 Animation animation = Animation::New(durationSeconds);
2835 Vector3 targetValue(20.0f, 20.0f, 20.0f);
2836 Vector3 relativeValue(targetValue - startValue);
2837 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
2839 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2841 // Start the animation
2844 bool signalReceived(false);
2845 AnimationFinishCheck finishCheck(signalReceived);
2846 animation.FinishedSignal().Connect(&application, finishCheck);
2848 application.SendNotification();
2849 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2851 // We didn't expect the animation to finish yet
2852 application.SendNotification();
2853 finishCheck.CheckSignalNotReceived();
2855 // The position should have moved more, than with a linear alpha function
2856 Vector3 current(actor.GetProperty<Vector3>(index));
2857 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
2858 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
2859 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
2861 application.SendNotification();
2862 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2864 // We did expect the animation to finish
2865 application.SendNotification();
2866 finishCheck.CheckSignalReceived();
2867 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2869 // Check that nothing has changed after a couple of buffer swaps
2870 application.Render(0);
2871 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2872 application.Render(0);
2873 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2877 int UtcDaliAnimationAnimateByVector3TimePeriodP(void)
2879 TestApplication application;
2881 Actor actor = Actor::New();
2883 // Register a Vector3 property
2884 Vector3 startValue(10.0f, 10.0f, 10.0f);
2885 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2886 Stage::GetCurrent().Add(actor);
2887 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
2889 // Build the animation
2890 float durationSeconds(1.0f);
2891 Animation animation = Animation::New(durationSeconds);
2892 Vector3 targetValue(30.0f, 30.0f, 30.0f);
2893 Vector3 relativeValue(targetValue - startValue);
2895 animation.AnimateBy(Property(actor, index),
2897 TimePeriod(delay, durationSeconds - delay));
2899 // Start the animation
2902 bool signalReceived(false);
2903 AnimationFinishCheck finishCheck(signalReceived);
2904 animation.FinishedSignal().Connect(&application, finishCheck);
2906 application.SendNotification();
2907 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2909 // We didn't expect the animation to finish yet
2910 application.SendNotification();
2911 finishCheck.CheckSignalNotReceived();
2912 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
2914 application.SendNotification();
2915 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2917 // We didn't expect the animation to finish yet
2918 application.SendNotification();
2919 finishCheck.CheckSignalNotReceived();
2920 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2922 application.SendNotification();
2923 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2925 // We did expect the animation to finish
2926 application.SendNotification();
2927 finishCheck.CheckSignalReceived();
2928 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2930 // Check that nothing has changed after a couple of buffer swaps
2931 application.Render(0);
2932 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2933 application.Render(0);
2934 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2938 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void)
2940 TestApplication application;
2942 Actor actor = Actor::New();
2944 // Register a Vector3 property
2945 Vector3 startValue(5.0f, 5.0f, 5.0f);
2946 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2947 Stage::GetCurrent().Add(actor);
2948 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
2950 // Build the animation
2951 float durationSeconds(1.0f);
2952 Animation animation = Animation::New(durationSeconds);
2953 Vector3 targetValue(10.0f, 10.0f, 10.0f);
2954 Vector3 relativeValue(targetValue - startValue);
2956 animation.AnimateBy(Property(actor, index),
2958 AlphaFunction::LINEAR,
2959 TimePeriod(delay, durationSeconds - delay));
2961 // Start the animation
2964 bool signalReceived(false);
2965 AnimationFinishCheck finishCheck(signalReceived);
2966 animation.FinishedSignal().Connect(&application, finishCheck);
2968 application.SendNotification();
2969 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2971 // We didn't expect the animation to finish yet
2972 application.SendNotification();
2973 finishCheck.CheckSignalNotReceived();
2974 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
2976 application.SendNotification();
2977 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2979 // We didn't expect the animation to finish yet
2980 application.SendNotification();
2981 finishCheck.CheckSignalNotReceived();
2982 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2984 application.SendNotification();
2985 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2987 // We did expect the animation to finish
2988 application.SendNotification();
2989 finishCheck.CheckSignalReceived();
2990 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2992 // Check that nothing has changed after a couple of buffer swaps
2993 application.Render(0);
2994 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2995 application.Render(0);
2996 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3000 int UtcDaliAnimationAnimateByVector4P(void)
3002 TestApplication application;
3004 Actor actor = Actor::New();
3006 // Register a Vector4 property
3007 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
3008 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3009 Stage::GetCurrent().Add(actor);
3010 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3012 // Build the animation
3013 float durationSeconds(2.0f);
3014 Animation animation = Animation::New(durationSeconds);
3015 Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f);
3016 Vector4 relativeValue(targetValue - startValue);
3017 animation.AnimateBy(Property(actor, index), relativeValue);
3019 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3021 // Start the animation
3024 bool signalReceived(false);
3025 AnimationFinishCheck finishCheck(signalReceived);
3026 animation.FinishedSignal().Connect(&application, finishCheck);
3028 application.SendNotification();
3029 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3031 // We didn't expect the animation to finish yet
3032 application.SendNotification();
3033 finishCheck.CheckSignalNotReceived();
3034 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION );
3036 application.SendNotification();
3037 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3039 // We did expect the animation to finish
3040 application.SendNotification();
3041 finishCheck.CheckSignalReceived();
3042 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3044 // Check that nothing has changed after a couple of buffer swaps
3045 application.Render(0);
3046 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3047 application.Render(0);
3048 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3052 int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void)
3054 TestApplication application;
3056 Actor actor = Actor::New();
3058 // Register a Vector4 property
3059 Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f);
3060 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3061 Stage::GetCurrent().Add(actor);
3062 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3064 // Build the animation
3065 float durationSeconds(1.0f);
3066 Animation animation = Animation::New(durationSeconds);
3067 Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
3068 Vector4 relativeValue(targetValue - startValue);
3069 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3071 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3073 // Start the animation
3076 bool signalReceived(false);
3077 AnimationFinishCheck finishCheck(signalReceived);
3078 animation.FinishedSignal().Connect(&application, finishCheck);
3080 application.SendNotification();
3081 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3083 // We didn't expect the animation to finish yet
3084 application.SendNotification();
3085 finishCheck.CheckSignalNotReceived();
3087 // The position should have moved more, than with a linear alpha function
3088 Vector4 current(actor.GetProperty<Vector4>(index));
3089 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3090 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3091 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
3092 DALI_TEST_CHECK( current.w < ninetyFivePercentProgress.w );
3094 application.SendNotification();
3095 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3097 // We did expect the animation to finish
3098 application.SendNotification();
3099 finishCheck.CheckSignalReceived();
3100 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3102 // Check that nothing has changed after a couple of buffer swaps
3103 application.Render(0);
3104 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3105 application.Render(0);
3106 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3110 int UtcDaliAnimationAnimateByVector4TimePeriodP(void)
3112 TestApplication application;
3114 Actor actor = Actor::New();
3116 // Register a Vector4 property
3117 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
3118 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3119 Stage::GetCurrent().Add(actor);
3120 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3122 // Build the animation
3123 float durationSeconds(1.0f);
3124 Animation animation = Animation::New(durationSeconds);
3125 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
3126 Vector4 relativeValue(targetValue - startValue);
3128 animation.AnimateBy(Property(actor, index),
3130 TimePeriod(delay, durationSeconds - delay));
3132 // Start the animation
3135 bool signalReceived(false);
3136 AnimationFinishCheck finishCheck(signalReceived);
3137 animation.FinishedSignal().Connect(&application, finishCheck);
3139 application.SendNotification();
3140 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3142 // We didn't expect the animation to finish yet
3143 application.SendNotification();
3144 finishCheck.CheckSignalNotReceived();
3145 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3147 application.SendNotification();
3148 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3150 // We didn't expect the animation to finish yet
3151 application.SendNotification();
3152 finishCheck.CheckSignalNotReceived();
3153 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3155 application.SendNotification();
3156 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3158 // We did expect the animation to finish
3159 application.SendNotification();
3160 finishCheck.CheckSignalReceived();
3161 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3163 // Check that nothing has changed after a couple of buffer swaps
3164 application.Render(0);
3165 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3166 application.Render(0);
3167 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3171 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void)
3173 TestApplication application;
3175 Actor actor = Actor::New();
3177 // Register a Vector4 property
3178 Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f);
3179 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3180 Stage::GetCurrent().Add(actor);
3181 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3183 // Build the animation
3184 float durationSeconds(1.0f);
3185 Animation animation = Animation::New(durationSeconds);
3186 Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f);
3187 Vector4 relativeValue(targetValue - startValue);
3189 animation.AnimateBy(Property(actor, index),
3191 AlphaFunction::LINEAR,
3192 TimePeriod(delay, durationSeconds - delay));
3194 // Start the animation
3197 bool signalReceived(false);
3198 AnimationFinishCheck finishCheck(signalReceived);
3199 animation.FinishedSignal().Connect(&application, finishCheck);
3201 application.SendNotification();
3202 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3204 // We didn't expect the animation to finish yet
3205 application.SendNotification();
3206 finishCheck.CheckSignalNotReceived();
3207 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3209 application.SendNotification();
3210 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3212 // We didn't expect the animation to finish yet
3213 application.SendNotification();
3214 finishCheck.CheckSignalNotReceived();
3215 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3217 application.SendNotification();
3218 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3220 // We did expect the animation to finish
3221 application.SendNotification();
3222 finishCheck.CheckSignalReceived();
3223 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3225 // Check that nothing has changed after a couple of buffer swaps
3226 application.Render(0);
3227 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3228 application.Render(0);
3229 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3233 int UtcDaliAnimationAnimateByActorPositionP(void)
3235 TestApplication application;
3237 Actor actor = Actor::New();
3238 Vector3 startPosition(10.0f, 10.0f, 10.0f);
3239 actor.SetPosition(startPosition);
3240 Stage::GetCurrent().Add(actor);
3241 application.SendNotification();
3242 application.Render(0);
3243 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
3245 // Build the animation
3246 float durationSeconds(1.0f);
3247 Animation animation = Animation::New(durationSeconds);
3248 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
3249 Vector3 relativePosition(targetPosition - startPosition);
3250 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition);
3252 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
3254 // Start the animation
3257 bool signalReceived(false);
3258 AnimationFinishCheck finishCheck(signalReceived);
3259 animation.FinishedSignal().Connect(&application, finishCheck);
3261 application.SendNotification();
3262 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3264 // We didn't expect the animation to finish yet
3265 application.SendNotification();
3266 finishCheck.CheckSignalNotReceived();
3267 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ninetyFivePercentProgress, TEST_LOCATION );
3269 application.SendNotification();
3270 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3272 // We did expect the animation to finish
3273 application.SendNotification();
3274 finishCheck.CheckSignalReceived();
3275 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3277 // Check that nothing has changed after a couple of buffer swaps
3278 application.Render(0);
3279 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3280 application.Render(0);
3281 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3285 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
3287 TestApplication application;
3289 Actor actor = Actor::New();
3290 Vector3 startPosition(10.0f, 10.0f, 10.0f);
3291 actor.SetPosition(startPosition);
3292 Stage::GetCurrent().Add(actor);
3293 application.SendNotification();
3294 application.Render(0);
3295 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
3297 // Build the animation
3298 float durationSeconds(1.0f);
3299 Animation animation = Animation::New(durationSeconds);
3300 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
3301 Vector3 relativePosition(targetPosition - startPosition);
3302 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
3304 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
3306 // Start the animation
3309 bool signalReceived(false);
3310 AnimationFinishCheck finishCheck(signalReceived);
3311 animation.FinishedSignal().Connect(&application, finishCheck);
3313 application.SendNotification();
3314 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3316 // We didn't expect the animation to finish yet
3317 application.SendNotification();
3318 finishCheck.CheckSignalNotReceived();
3320 // The position should have moved more, than with a linear alpha function
3321 Vector3 current(actor.GetCurrentPosition());
3322 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
3323 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
3324 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
3326 application.SendNotification();
3327 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3329 // We did expect the animation to finish
3330 application.SendNotification();
3331 finishCheck.CheckSignalReceived();
3332 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3334 // Check that nothing has changed after a couple of buffer swaps
3335 application.Render(0);
3336 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3337 application.Render(0);
3338 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3342 int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void)
3344 TestApplication application;
3346 Actor actor = Actor::New();
3347 Vector3 startPosition(10.0f, 10.0f, 10.0f);
3348 actor.SetPosition(startPosition);
3349 Stage::GetCurrent().Add(actor);
3350 application.SendNotification();
3351 application.Render(0);
3352 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
3354 // Build the animation
3355 float durationSeconds(1.0f);
3356 Animation animation = Animation::New(durationSeconds);
3357 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
3358 Vector3 relativePosition(targetPosition - startPosition);
3360 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
3362 TimePeriod(delay, durationSeconds - delay));
3364 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
3366 // Start the animation
3369 bool signalReceived(false);
3370 AnimationFinishCheck finishCheck(signalReceived);
3371 animation.FinishedSignal().Connect(&application, finishCheck);
3373 application.SendNotification();
3374 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3376 // We didn't expect the animation to finish yet
3377 application.SendNotification();
3378 finishCheck.CheckSignalNotReceived();
3379 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
3381 application.SendNotification();
3382 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
3384 // We did expect the animation to finish
3385 application.SendNotification();
3386 finishCheck.CheckSignalReceived();
3387 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3389 // Check that nothing has changed after a couple of buffer swaps
3390 application.Render(0);
3391 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3392 application.Render(0);
3393 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3397 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void)
3399 TestApplication application;
3401 Actor actor = Actor::New();
3402 Vector3 startPosition(10.0f, 10.0f, 10.0f);
3403 actor.SetPosition(startPosition);
3404 Stage::GetCurrent().Add(actor);
3405 application.SendNotification();
3406 application.Render(0);
3407 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
3409 // Build the animation
3410 float durationSeconds(1.0f);
3411 Animation animation = Animation::New(durationSeconds);
3412 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
3413 Vector3 relativePosition(targetPosition - startPosition);
3415 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
3417 AlphaFunction::LINEAR,
3418 TimePeriod(delay, durationSeconds - delay));
3420 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
3422 // Start the animation
3425 bool signalReceived(false);
3426 AnimationFinishCheck finishCheck(signalReceived);
3427 animation.FinishedSignal().Connect(&application, finishCheck);
3429 application.SendNotification();
3430 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3432 // We didn't expect the animation to finish yet
3433 application.SendNotification();
3434 finishCheck.CheckSignalNotReceived();
3435 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
3437 application.SendNotification();
3438 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
3440 // We did expect the animation to finish
3441 application.SendNotification();
3442 finishCheck.CheckSignalReceived();
3443 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3445 // Check that nothing has changed after a couple of buffer swaps
3446 application.Render(0);
3447 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3448 application.Render(0);
3449 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3453 int UtcDaliAnimationAnimateByActorOrientationP(void)
3455 TestApplication application;
3457 Actor actor = Actor::New();
3458 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
3459 Stage::GetCurrent().Add(actor);
3460 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
3462 // Build the animation
3463 float durationSeconds(1.0f);
3464 Animation animation = Animation::New(durationSeconds);
3465 Degree relativeRotationDegrees(360.0f);
3466 Radian relativeRotationRadians(relativeRotationDegrees);
3467 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ) );
3469 // Start the animation
3472 bool signalReceived(false);
3473 AnimationFinishCheck finishCheck(signalReceived);
3474 animation.FinishedSignal().Connect(&application, finishCheck);
3476 application.SendNotification();
3477 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
3479 // We didn't expect the animation to finish yet
3480 application.SendNotification();
3481 finishCheck.CheckSignalNotReceived();
3482 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
3484 application.SendNotification();
3485 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
3487 // We didn't expect the animation to finish yet
3488 application.SendNotification();
3489 finishCheck.CheckSignalNotReceived();
3490 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
3492 application.SendNotification();
3493 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
3495 // We didn't expect the animation to finish yet
3496 application.SendNotification();
3497 finishCheck.CheckSignalNotReceived();
3498 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
3500 application.SendNotification();
3501 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3503 // We did expect the animation to finish
3504 application.SendNotification();
3505 finishCheck.CheckSignalReceived();
3506 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
3510 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
3512 TestApplication application;
3514 Actor actor = Actor::New();
3515 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
3516 Stage::GetCurrent().Add(actor);
3517 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
3519 // Build the animation
3520 float durationSeconds(1.0f);
3521 Animation animation = Animation::New(durationSeconds);
3522 Degree relativeRotationDegrees(360.0f);
3523 Radian relativeRotationRadians(relativeRotationDegrees);
3524 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ), AlphaFunction::EASE_IN );
3526 // Start the animation
3529 bool signalReceived(false);
3530 AnimationFinishCheck finishCheck(signalReceived);
3531 animation.FinishedSignal().Connect(&application, finishCheck);
3533 application.SendNotification();
3534 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
3536 // We didn't expect the animation to finish yet
3537 application.SendNotification();
3538 finishCheck.CheckSignalNotReceived();
3539 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
3541 application.SendNotification();
3542 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
3544 // We didn't expect the animation to finish yet
3545 application.SendNotification();
3546 finishCheck.CheckSignalNotReceived();
3547 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
3549 application.SendNotification();
3550 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
3552 // We didn't expect the animation to finish yet
3553 application.SendNotification();
3554 finishCheck.CheckSignalNotReceived();
3555 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
3557 application.SendNotification();
3558 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3560 // We did expect the animation to finish
3561 application.SendNotification();
3562 finishCheck.CheckSignalReceived();
3563 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
3567 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void)
3569 TestApplication application;
3571 Actor actor = Actor::New();
3572 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
3573 Stage::GetCurrent().Add(actor);
3574 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
3576 // Build the animation
3577 float durationSeconds(1.0f);
3578 Animation animation = Animation::New(durationSeconds);
3579 Degree relativeRotationDegrees(360.0f);
3580 Radian relativeRotationRadians(relativeRotationDegrees);
3582 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ),
3583 AlphaFunction::EASE_IN, TimePeriod( delay, durationSeconds - delay ) );
3585 // Start the animation
3588 bool signalReceived(false);
3589 AnimationFinishCheck finishCheck(signalReceived);
3590 animation.FinishedSignal().Connect(&application, finishCheck);
3592 application.SendNotification();
3593 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
3595 // We didn't expect the animation to finish yet
3596 application.SendNotification();
3597 finishCheck.CheckSignalNotReceived();
3598 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
3599 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
3601 application.SendNotification();
3602 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
3604 // We didn't expect the animation to finish yet
3605 application.SendNotification();
3606 finishCheck.CheckSignalNotReceived();
3607 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
3608 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
3610 application.SendNotification();
3611 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
3613 // We didn't expect the animation to finish yet
3614 application.SendNotification();
3615 finishCheck.CheckSignalNotReceived();
3616 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
3617 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
3619 application.SendNotification();
3620 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3622 // We did expect the animation to finish
3623 application.SendNotification();
3624 finishCheck.CheckSignalReceived();
3625 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
3629 int UtcDaliAnimationAnimateByActorScaleP(void)
3631 TestApplication application;
3633 Actor actor = Actor::New();
3634 Stage::GetCurrent().Add(actor);
3635 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
3637 // Build the animation
3638 float durationSeconds(1.0f);
3639 Animation animation = Animation::New(durationSeconds);
3640 Vector3 targetScale(2.0f, 2.0f, 2.0f);
3641 Vector3 relativeScale(targetScale - Vector3::ONE);
3642 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), Vector3( relativeScale.x, relativeScale.y, relativeScale.z ) );
3644 Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale*0.99f);
3646 // Start the animation
3649 bool signalReceived(false);
3650 AnimationFinishCheck finishCheck(signalReceived);
3651 animation.FinishedSignal().Connect(&application, finishCheck);
3653 application.SendNotification();
3654 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
3656 // We didn't expect the animation to finish yet
3657 application.SendNotification();
3658 finishCheck.CheckSignalNotReceived();
3659 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
3661 application.SendNotification();
3662 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
3664 // We did expect the animation to finish
3665 application.SendNotification();
3666 finishCheck.CheckSignalReceived();
3667 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
3670 finishCheck.Reset();
3671 actor.SetScale(Vector3::ONE);
3672 application.SendNotification();
3673 application.Render(0);
3674 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
3676 // Repeat with a different (ease-in) alpha function
3677 animation = Animation::New(durationSeconds);
3678 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::EASE_IN );
3679 animation.FinishedSignal().Connect(&application, finishCheck);
3682 application.SendNotification();
3683 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
3685 // We didn't expect the animation to finish yet
3686 application.SendNotification();
3687 finishCheck.CheckSignalNotReceived();
3689 // The scale should have grown less, than with a linear alpha function
3690 Vector3 current(actor.GetCurrentScale());
3691 DALI_TEST_CHECK( current.x > 1.0f );
3692 DALI_TEST_CHECK( current.y > 1.0f );
3693 DALI_TEST_CHECK( current.z > 1.0f );
3694 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
3695 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
3696 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
3698 application.SendNotification();
3699 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
3701 // We did expect the animation to finish
3702 application.SendNotification();
3703 finishCheck.CheckSignalReceived();
3704 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
3707 finishCheck.Reset();
3708 actor.SetScale(Vector3::ONE);
3709 application.SendNotification();
3710 application.Render(0);
3711 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
3713 // Repeat with a delay
3715 animation = Animation::New(durationSeconds);
3716 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
3717 animation.FinishedSignal().Connect(&application, finishCheck);
3720 application.SendNotification();
3721 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3723 // We didn't expect the animation to finish yet
3724 application.SendNotification();
3725 finishCheck.CheckSignalNotReceived();
3726 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
3728 application.SendNotification();
3729 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
3731 // We did expect the animation to finish
3732 application.SendNotification();
3733 finishCheck.CheckSignalReceived();
3734 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
3738 int UtcDaliAnimationAnimateToBooleanP(void)
3740 TestApplication application;
3742 Actor actor = Actor::New();
3744 // Register a boolean property
3745 const bool startValue(false);
3746 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3747 Stage::GetCurrent().Add(actor);
3748 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3750 // Build the animation
3751 float durationSeconds(2.0f);
3752 Animation animation = Animation::New(durationSeconds);
3753 const bool targetValue( !startValue );
3754 animation.AnimateTo(Property(actor, index), targetValue);
3756 // Start the animation
3759 bool signalReceived(false);
3760 AnimationFinishCheck finishCheck(signalReceived);
3761 animation.FinishedSignal().Connect(&application, finishCheck);
3763 application.SendNotification();
3764 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3766 // We didn't expect the animation to finish yet
3767 application.SendNotification();
3768 finishCheck.CheckSignalNotReceived();
3769 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3771 application.SendNotification();
3772 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3774 // We did expect the animation to finish
3775 application.SendNotification();
3776 finishCheck.CheckSignalReceived();
3777 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
3779 // Check that nothing has changed after a couple of buffer swaps
3780 application.Render(0);
3781 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
3782 application.Render(0);
3783 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
3785 // Repeat with target value "false"
3786 animation = Animation::New(durationSeconds);
3787 const bool finalValue( !targetValue );
3788 animation.AnimateTo(Property(actor, index), finalValue);
3790 // Start the animation
3793 finishCheck.Reset();
3794 animation.FinishedSignal().Connect(&application, finishCheck);
3796 application.SendNotification();
3797 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3799 // We didn't expect the animation to finish yet
3800 application.SendNotification();
3801 finishCheck.CheckSignalNotReceived();
3802 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
3804 application.SendNotification();
3805 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3807 // We did expect the animation to finish
3808 application.SendNotification();
3809 finishCheck.CheckSignalReceived();
3810 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3812 // Check that nothing has changed after a couple of buffer swaps
3813 application.Render(0);
3814 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3815 application.Render(0);
3816 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3820 int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void)
3822 TestApplication application;
3824 Actor actor = Actor::New();
3826 // Register a boolean property
3827 const bool startValue(false);
3828 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3829 Stage::GetCurrent().Add(actor);
3830 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3832 // Build the animation
3833 float durationSeconds(2.0f);
3834 Animation animation = Animation::New(durationSeconds);
3835 const bool targetValue( !startValue );
3836 animation.AnimateTo(Property(actor, "test-property"), targetValue, AlphaFunction::EASE_OUT);
3838 // Start the animation
3841 bool signalReceived(false);
3842 AnimationFinishCheck finishCheck(signalReceived);
3843 animation.FinishedSignal().Connect(&application, finishCheck);
3845 application.SendNotification();
3846 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3848 // We didn't expect the animation to finish yet
3849 application.SendNotification();
3850 finishCheck.CheckSignalNotReceived();
3851 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3853 application.SendNotification();
3854 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3856 // We did expect the animation to finish
3857 application.SendNotification();
3858 finishCheck.CheckSignalReceived();
3859 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
3861 // Check that nothing has changed after a couple of buffer swaps
3862 application.Render(0);
3863 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
3864 application.Render(0);
3865 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
3867 // Repeat with target value "false"
3868 animation = Animation::New(durationSeconds);
3869 const bool finalValue( !targetValue );
3870 animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
3872 // Start the animation
3875 finishCheck.Reset();
3876 animation.FinishedSignal().Connect(&application, finishCheck);
3878 application.SendNotification();
3879 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3881 // We didn't expect the animation to finish yet
3882 application.SendNotification();
3883 finishCheck.CheckSignalNotReceived();
3884 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
3886 application.SendNotification();
3887 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3889 // We did expect the animation to finish
3890 application.SendNotification();
3891 finishCheck.CheckSignalReceived();
3892 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3894 // Check that nothing has changed after a couple of buffer swaps
3895 application.Render(0);
3896 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3897 application.Render(0);
3898 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3902 int UtcDaliAnimationAnimateToBooleanTimePeriodP(void)
3904 TestApplication application;
3906 Actor actor = Actor::New();
3908 // Register a boolean property
3909 bool startValue(false);
3910 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3911 Stage::GetCurrent().Add(actor);
3912 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3914 // Build the animation
3915 float durationSeconds(2.0f);
3916 Animation animation = Animation::New(durationSeconds);
3917 bool finalValue( !startValue );
3918 float animatorDurationSeconds(durationSeconds * 0.5f);
3919 animation.AnimateTo( Property(actor, index),
3921 TimePeriod( animatorDurationSeconds ) );
3923 // Start the animation
3926 bool signalReceived(false);
3927 AnimationFinishCheck finishCheck(signalReceived);
3928 animation.FinishedSignal().Connect(&application, finishCheck);
3930 application.SendNotification();
3931 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
3933 // We didn't expect the animation to finish yet
3934 application.SendNotification();
3935 finishCheck.CheckSignalNotReceived();
3936 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3938 application.SendNotification();
3939 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
3941 // We didn't expect the animation to finish yet...
3942 application.SendNotification();
3943 finishCheck.CheckSignalNotReceived();
3945 // ...however we should have reached the final value
3946 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3948 application.SendNotification();
3949 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
3951 // We did expect the animation to finish
3952 application.SendNotification();
3953 finishCheck.CheckSignalReceived();
3954 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3956 // Check that nothing has changed after a couple of buffer swaps
3957 application.Render(0);
3958 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3959 application.Render(0);
3960 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3964 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void)
3966 TestApplication application;
3968 Actor actor = Actor::New();
3970 // Register a boolean property
3971 bool startValue(false);
3972 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3973 Stage::GetCurrent().Add(actor);
3974 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3976 // Build the animation
3977 float durationSeconds(2.0f);
3978 Animation animation = Animation::New(durationSeconds);
3979 bool finalValue( !startValue );
3980 float animatorDurationSeconds(durationSeconds * 0.5f);
3981 animation.AnimateTo( Property(actor, index),
3983 AlphaFunction::LINEAR,
3984 TimePeriod( animatorDurationSeconds ) );
3986 // Start the animation
3989 bool signalReceived(false);
3990 AnimationFinishCheck finishCheck(signalReceived);
3991 animation.FinishedSignal().Connect(&application, finishCheck);
3993 application.SendNotification();
3994 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
3996 // We didn't expect the animation to finish yet
3997 application.SendNotification();
3998 finishCheck.CheckSignalNotReceived();
3999 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4001 application.SendNotification();
4002 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
4004 // We didn't expect the animation to finish yet...
4005 application.SendNotification();
4006 finishCheck.CheckSignalNotReceived();
4008 // ...however we should have reached the final value
4009 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4011 application.SendNotification();
4012 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
4014 // We did expect the animation to finish
4015 application.SendNotification();
4016 finishCheck.CheckSignalReceived();
4017 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4019 // Check that nothing has changed after a couple of buffer swaps
4020 application.Render(0);
4021 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4022 application.Render(0);
4023 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4027 int UtcDaliAnimationAnimateToFloatP(void)
4029 TestApplication application;
4031 Actor actor = Actor::New();
4033 // Register a float property
4034 float startValue(10.0f);
4035 Property::Index index = actor.RegisterProperty( "test-property", startValue );
4036 Stage::GetCurrent().Add(actor);
4037 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
4039 // Build the animation
4040 float durationSeconds(2.0f);
4041 Animation animation = Animation::New(durationSeconds);
4042 float targetValue(50.0f);
4043 float relativeValue(targetValue - startValue);
4044 animation.AnimateTo(Property(actor, "test-property"), targetValue);
4046 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4048 // Start the animation
4051 bool signalReceived(false);
4052 AnimationFinishCheck finishCheck(signalReceived);
4053 animation.FinishedSignal().Connect(&application, finishCheck);
4055 application.SendNotification();
4056 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4058 // We didn't expect the animation to finish yet
4059 application.SendNotification();
4060 finishCheck.CheckSignalNotReceived();
4061 DALI_TEST_EQUALS( actor.GetProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION );
4063 application.SendNotification();
4064 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4066 // We did expect the animation to finish
4067 application.SendNotification();
4068 finishCheck.CheckSignalReceived();
4069 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
4073 int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void)
4075 TestApplication application;
4077 Actor actor = Actor::New();
4079 // Register a float property
4080 float startValue(10.0f);
4081 Property::Index index = actor.RegisterProperty( "test-property", startValue );
4082 Stage::GetCurrent().Add(actor);
4083 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
4085 // Build the animation
4086 float durationSeconds(1.0f);
4087 Animation animation = Animation::New(durationSeconds);
4088 float targetValue(90.0f);
4089 float relativeValue(targetValue - startValue);
4090 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
4092 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4094 // Start the animation
4097 bool signalReceived(false);
4098 AnimationFinishCheck finishCheck(signalReceived);
4099 animation.FinishedSignal().Connect(&application, finishCheck);
4101 application.SendNotification();
4102 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4104 // We didn't expect the animation to finish yet
4105 application.SendNotification();
4106 finishCheck.CheckSignalNotReceived();
4108 // The position should have moved more, than with a linear alpha function
4109 float current(actor.GetProperty<float>(index));
4110 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
4112 application.SendNotification();
4113 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4115 // We did expect the animation to finish
4116 application.SendNotification();
4117 finishCheck.CheckSignalReceived();
4118 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
4122 int UtcDaliAnimationAnimateToFloatTimePeriodP(void)
4124 TestApplication application;
4126 Actor actor = Actor::New();
4128 // Register a float property
4129 float startValue(10.0f);
4130 Property::Index index = actor.RegisterProperty( "test-property", startValue );
4131 Stage::GetCurrent().Add(actor);
4132 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
4134 // Build the animation
4135 float durationSeconds(1.0f);
4136 Animation animation = Animation::New(durationSeconds);
4137 float targetValue(30.0f);
4138 float relativeValue(targetValue - startValue);
4140 animation.AnimateTo(Property(actor, index),
4142 TimePeriod(delay, durationSeconds - delay));
4144 // Start the animation
4147 bool signalReceived(false);
4148 AnimationFinishCheck finishCheck(signalReceived);
4149 animation.FinishedSignal().Connect(&application, finishCheck);
4151 application.SendNotification();
4152 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4154 // We didn't expect the animation to finish yet
4155 application.SendNotification();
4156 finishCheck.CheckSignalNotReceived();
4157 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
4159 application.SendNotification();
4160 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4162 // We didn't expect the animation to finish yet
4163 application.SendNotification();
4164 finishCheck.CheckSignalNotReceived();
4165 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
4167 application.SendNotification();
4168 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4170 // We did expect the animation to finish
4171 application.SendNotification();
4172 finishCheck.CheckSignalReceived();
4173 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
4177 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void)
4179 TestApplication application;
4181 Actor actor = Actor::New();
4183 // Register a float property
4184 float startValue(10.0f);
4185 Property::Index index = actor.RegisterProperty( "test-property", startValue );
4186 Stage::GetCurrent().Add(actor);
4187 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
4189 // Build the animation
4190 float durationSeconds(1.0f);
4191 Animation animation = Animation::New(durationSeconds);
4192 float targetValue(30.0f);
4193 float relativeValue(targetValue - startValue);
4195 animation.AnimateTo(Property(actor, index),
4197 AlphaFunction::LINEAR,
4198 TimePeriod(delay, durationSeconds - delay));
4200 // Start the animation
4203 bool signalReceived(false);
4204 AnimationFinishCheck finishCheck(signalReceived);
4205 animation.FinishedSignal().Connect(&application, finishCheck);
4207 application.SendNotification();
4208 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4210 // We didn't expect the animation to finish yet
4211 application.SendNotification();
4212 finishCheck.CheckSignalNotReceived();
4213 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
4215 application.SendNotification();
4216 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4218 // We didn't expect the animation to finish yet
4219 application.SendNotification();
4220 finishCheck.CheckSignalNotReceived();
4221 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
4223 application.SendNotification();
4224 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4226 // We did expect the animation to finish
4227 application.SendNotification();
4228 finishCheck.CheckSignalReceived();
4229 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
4233 int UtcDaliAnimationAnimateToIntegerP(void)
4235 TestApplication application;
4237 Actor actor = Actor::New();
4239 // Register an integer property
4241 Property::Index index = actor.RegisterProperty( "test-property", startValue );
4242 Stage::GetCurrent().Add(actor);
4243 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
4245 // Build the animation
4246 float durationSeconds(2.0f);
4247 Animation animation = Animation::New(durationSeconds);
4248 int targetValue(50);
4249 int relativeValue(targetValue - startValue);
4250 animation.AnimateTo(Property(actor, "test-property"), targetValue);
4252 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
4254 // Start the animation
4257 bool signalReceived(false);
4258 AnimationFinishCheck finishCheck(signalReceived);
4259 animation.FinishedSignal().Connect(&application, finishCheck);
4261 application.SendNotification();
4262 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4264 // We didn't expect the animation to finish yet
4265 application.SendNotification();
4266 finishCheck.CheckSignalNotReceived();
4267 DALI_TEST_EQUALS( actor.GetProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION );
4269 application.SendNotification();
4270 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4272 // We did expect the animation to finish
4273 application.SendNotification();
4274 finishCheck.CheckSignalReceived();
4275 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
4279 int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void)
4281 TestApplication application;
4283 Actor actor = Actor::New();
4285 // Register an integer property
4287 Property::Index index = actor.RegisterProperty( "test-property", startValue );
4288 Stage::GetCurrent().Add(actor);
4289 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
4291 // Build the animation
4292 float durationSeconds(1.0f);
4293 Animation animation = Animation::New(durationSeconds);
4294 int targetValue(90);
4295 int relativeValue(targetValue - startValue);
4296 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
4298 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
4300 // Start the animation
4303 bool signalReceived(false);
4304 AnimationFinishCheck finishCheck(signalReceived);
4305 animation.FinishedSignal().Connect(&application, finishCheck);
4307 application.SendNotification();
4308 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4310 // We didn't expect the animation to finish yet
4311 application.SendNotification();
4312 finishCheck.CheckSignalNotReceived();
4314 // The position should have moved more, than with a linear alpha function
4315 int current(actor.GetProperty<int>(index));
4316 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
4318 application.SendNotification();
4319 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4321 // We did expect the animation to finish
4322 application.SendNotification();
4323 finishCheck.CheckSignalReceived();
4324 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
4328 int UtcDaliAnimationAnimateToIntegerTimePeriodP(void)
4330 TestApplication application;
4332 Actor actor = Actor::New();
4334 // Register an integer property
4336 Property::Index index = actor.RegisterProperty( "test-property", startValue );
4337 Stage::GetCurrent().Add(actor);
4338 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
4340 // Build the animation
4341 float durationSeconds(1.0f);
4342 Animation animation = Animation::New(durationSeconds);
4343 int targetValue(30);
4344 int relativeValue(targetValue - startValue);
4346 animation.AnimateTo(Property(actor, index),
4348 TimePeriod(delay, durationSeconds - delay));
4350 // Start the animation
4353 bool signalReceived(false);
4354 AnimationFinishCheck finishCheck(signalReceived);
4355 animation.FinishedSignal().Connect(&application, finishCheck);
4357 application.SendNotification();
4358 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4360 // We didn't expect the animation to finish yet
4361 application.SendNotification();
4362 finishCheck.CheckSignalNotReceived();
4363 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
4365 application.SendNotification();
4366 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4368 // We didn't expect the animation to finish yet
4369 application.SendNotification();
4370 finishCheck.CheckSignalNotReceived();
4371 DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
4373 application.SendNotification();
4374 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4376 // We did expect the animation to finish
4377 application.SendNotification();
4378 finishCheck.CheckSignalReceived();
4379 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
4383 int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void)
4385 TestApplication application;
4387 Actor actor = Actor::New();
4389 // Register an integer property
4391 Property::Index index = actor.RegisterProperty( "test-property", startValue );
4392 Stage::GetCurrent().Add(actor);
4393 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
4395 // Build the animation
4396 float durationSeconds(1.0f);
4397 Animation animation = Animation::New(durationSeconds);
4398 int targetValue(30);
4399 int relativeValue(targetValue - startValue);
4401 animation.AnimateTo(Property(actor, index),
4403 AlphaFunction::LINEAR,
4404 TimePeriod(delay, durationSeconds - delay));
4406 // Start the animation
4409 bool signalReceived(false);
4410 AnimationFinishCheck finishCheck(signalReceived);
4411 animation.FinishedSignal().Connect(&application, finishCheck);
4413 application.SendNotification();
4414 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4416 // We didn't expect the animation to finish yet
4417 application.SendNotification();
4418 finishCheck.CheckSignalNotReceived();
4419 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
4421 application.SendNotification();
4422 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4424 // We didn't expect the animation to finish yet
4425 application.SendNotification();
4426 finishCheck.CheckSignalNotReceived();
4427 DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
4429 application.SendNotification();
4430 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4432 // We did expect the animation to finish
4433 application.SendNotification();
4434 finishCheck.CheckSignalReceived();
4435 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
4439 int UtcDaliAnimationAnimateToVector2P(void)
4441 TestApplication application;
4443 Actor actor = Actor::New();
4445 // Register a Vector2 property
4446 Vector2 startValue(-50.0f, -50.0f);
4447 Property::Index index = actor.RegisterProperty( "test-property", startValue );
4448 Stage::GetCurrent().Add(actor);
4449 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
4451 // Build the animation
4452 float durationSeconds(2.0f);
4453 Animation animation = Animation::New(durationSeconds);
4454 Vector2 targetValue(50.0f, 50.0f);
4455 Vector2 relativeValue(targetValue - startValue);
4456 animation.AnimateTo(Property(actor, index), targetValue);
4458 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4460 // Start the animation
4463 bool signalReceived(false);
4464 AnimationFinishCheck finishCheck(signalReceived);
4465 animation.FinishedSignal().Connect(&application, finishCheck);
4467 application.SendNotification();
4468 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4470 // We didn't expect the animation to finish yet
4471 application.SendNotification();
4472 finishCheck.CheckSignalNotReceived();
4473 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION );
4475 application.SendNotification();
4476 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4478 // We did expect the animation to finish
4479 application.SendNotification();
4480 finishCheck.CheckSignalReceived();
4481 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
4485 int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void)
4487 TestApplication application;
4489 Actor actor = Actor::New();
4491 // Register a Vector2 property
4492 Vector2 startValue(1000.0f, 1000.0f);
4493 Property::Index index = actor.RegisterProperty( "test-property", startValue );
4494 Stage::GetCurrent().Add(actor);
4495 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
4497 // Build the animation
4498 float durationSeconds(1.0f);
4499 Animation animation = Animation::New(durationSeconds);
4500 Vector2 targetValue(9000.0f, 9000.0f);
4501 Vector2 relativeValue(targetValue - startValue);
4502 animation.AnimateTo(Property(actor, "test-property"), targetValue, AlphaFunction::EASE_OUT);
4504 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4506 // Start the animation
4509 bool signalReceived(false);
4510 AnimationFinishCheck finishCheck(signalReceived);
4511 animation.FinishedSignal().Connect(&application, finishCheck);
4513 application.SendNotification();
4514 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4516 // We didn't expect the animation to finish yet
4517 application.SendNotification();
4518 finishCheck.CheckSignalNotReceived();
4520 // The position should have moved more, than with a linear alpha function
4521 Vector2 current(actor.GetProperty<Vector2>(index));
4522 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
4523 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
4525 application.SendNotification();
4526 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4528 // We did expect the animation to finish
4529 application.SendNotification();
4530 finishCheck.CheckSignalReceived();
4531 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
4535 int UtcDaliAnimationAnimateToVector2TimePeriodP(void)
4537 TestApplication application;
4539 Actor actor = Actor::New();
4541 // Register a Vector2 property
4542 Vector2 startValue(10.0f, 10.0f);
4543 Property::Index index = actor.RegisterProperty( "test-property", startValue );
4544 Stage::GetCurrent().Add(actor);
4545 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
4547 // Build the animation
4548 float durationSeconds(1.0f);
4549 Animation animation = Animation::New(durationSeconds);
4550 Vector2 targetValue(-10.0f, 20.0f);
4551 Vector2 relativeValue(targetValue - startValue);
4553 animation.AnimateTo(Property(actor, index),
4555 TimePeriod(delay, durationSeconds - delay));
4557 // Start the animation
4560 bool signalReceived(false);
4561 AnimationFinishCheck finishCheck(signalReceived);
4562 animation.FinishedSignal().Connect(&application, finishCheck);
4564 application.SendNotification();
4565 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4567 // We didn't expect the animation to finish yet
4568 application.SendNotification();
4569 finishCheck.CheckSignalNotReceived();
4570 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
4572 application.SendNotification();
4573 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4575 // We didn't expect the animation to finish yet
4576 application.SendNotification();
4577 finishCheck.CheckSignalNotReceived();
4578 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
4580 application.SendNotification();
4581 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4583 // We did expect the animation to finish
4584 application.SendNotification();
4585 finishCheck.CheckSignalReceived();
4586 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
4590 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void)
4592 TestApplication application;
4594 Actor actor = Actor::New();
4596 // Register a Vector2 property
4597 Vector2 startValue(10.0f, 10.0f);
4598 Property::Index index = actor.RegisterProperty( "test-property", startValue );
4599 Stage::GetCurrent().Add(actor);
4600 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
4602 // Build the animation
4603 float durationSeconds(1.0f);
4604 Animation animation = Animation::New(durationSeconds);
4605 Vector2 targetValue(30.0f, 30.0f);
4606 Vector2 relativeValue(targetValue - startValue);
4608 animation.AnimateTo(Property(actor, index),
4610 AlphaFunction::LINEAR,
4611 TimePeriod(delay, durationSeconds - delay));
4613 // Start the animation
4616 bool signalReceived(false);
4617 AnimationFinishCheck finishCheck(signalReceived);
4618 animation.FinishedSignal().Connect(&application, finishCheck);
4620 application.SendNotification();
4621 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4623 // We didn't expect the animation to finish yet
4624 application.SendNotification();
4625 finishCheck.CheckSignalNotReceived();
4626 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
4628 application.SendNotification();
4629 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4631 // We didn't expect the animation to finish yet
4632 application.SendNotification();
4633 finishCheck.CheckSignalNotReceived();
4634 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
4636 application.SendNotification();
4637 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4639 // We did expect the animation to finish
4640 application.SendNotification();
4641 finishCheck.CheckSignalReceived();
4642 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
4646 int UtcDaliAnimationAnimateToVector3P(void)
4648 TestApplication application;
4650 Actor actor = Actor::New();
4652 // Register a Vector3 property
4653 Vector3 startValue(-50.0f, -50.0f, -50.0f);
4654 Property::Index index = actor.RegisterProperty( "test-property", startValue );
4655 Stage::GetCurrent().Add(actor);
4656 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4658 // Build the animation
4659 float durationSeconds(2.0f);
4660 Animation animation = Animation::New(durationSeconds);
4661 Vector3 targetValue(50.0f, 50.0f, 50.0f);
4662 Vector3 relativeValue(targetValue - startValue);
4663 animation.AnimateTo(Property(actor, index), targetValue);
4665 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4667 // Start the animation
4670 bool signalReceived(false);
4671 AnimationFinishCheck finishCheck(signalReceived);
4672 animation.FinishedSignal().Connect(&application, finishCheck);
4674 application.SendNotification();
4675 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4677 // We didn't expect the animation to finish yet
4678 application.SendNotification();
4679 finishCheck.CheckSignalNotReceived();
4680 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION );
4682 application.SendNotification();
4683 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4685 // We did expect the animation to finish
4686 application.SendNotification();
4687 finishCheck.CheckSignalReceived();
4688 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
4692 int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void)
4694 TestApplication application;
4696 Actor actor = Actor::New();
4698 // Register a Vector3 property
4699 Vector3 startValue(1000.0f, 1000.0f, 1000.0f);
4700 Property::Index index = actor.RegisterProperty( "test-property", startValue );
4701 Stage::GetCurrent().Add(actor);
4702 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4704 // Build the animation
4705 float durationSeconds(1.0f);
4706 Animation animation = Animation::New(durationSeconds);
4707 Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
4708 Vector3 relativeValue(targetValue - startValue);
4709 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
4711 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4713 // Start the animation
4716 bool signalReceived(false);
4717 AnimationFinishCheck finishCheck(signalReceived);
4718 animation.FinishedSignal().Connect(&application, finishCheck);
4720 application.SendNotification();
4721 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4723 // We didn't expect the animation to finish yet
4724 application.SendNotification();
4725 finishCheck.CheckSignalNotReceived();
4727 // The position should have moved more, than with a linear alpha function
4728 Vector3 current(actor.GetProperty<Vector3>(index));
4729 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
4730 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
4731 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
4733 application.SendNotification();
4734 application.Render(static_cast<unsigned int>(durationSeconds*50.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<Vector3>(index), targetValue, TEST_LOCATION );
4743 int UtcDaliAnimationAnimateToVector3TimePeriodP(void)
4745 TestApplication application;
4747 Actor actor = Actor::New();
4749 // Register a Vector3 property
4750 Vector3 startValue(10.0f, 10.0f, 10.0f);
4751 Property::Index index = actor.RegisterProperty( "test-property", startValue );
4752 Stage::GetCurrent().Add(actor);
4753 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4755 // Build the animation
4756 float durationSeconds(1.0f);
4757 Animation animation = Animation::New(durationSeconds);
4758 Vector3 targetValue(-10.0f, 20.0f, 100.0f);
4759 Vector3 relativeValue(targetValue - startValue);
4761 animation.AnimateTo(Property(actor, index),
4763 TimePeriod(delay, durationSeconds - delay));
4765 // Start the animation
4768 bool signalReceived(false);
4769 AnimationFinishCheck finishCheck(signalReceived);
4770 animation.FinishedSignal().Connect(&application, finishCheck);
4772 application.SendNotification();
4773 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4775 // We didn't expect the animation to finish yet
4776 application.SendNotification();
4777 finishCheck.CheckSignalNotReceived();
4778 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4780 application.SendNotification();
4781 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4783 // We didn't expect the animation to finish yet
4784 application.SendNotification();
4785 finishCheck.CheckSignalNotReceived();
4786 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
4788 application.SendNotification();
4789 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4791 // We did expect the animation to finish
4792 application.SendNotification();
4793 finishCheck.CheckSignalReceived();
4794 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
4798 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void)
4800 TestApplication application;
4802 Actor actor = Actor::New();
4804 // Register a Vector3 property
4805 Vector3 startValue(10.0f, 10.0f, 10.0f);
4806 Property::Index index = actor.RegisterProperty( "test-property", startValue );
4807 Stage::GetCurrent().Add(actor);
4808 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4810 // Build the animation
4811 float durationSeconds(1.0f);
4812 Animation animation = Animation::New(durationSeconds);
4813 Vector3 targetValue(30.0f, 30.0f, 30.0f);
4814 Vector3 relativeValue(targetValue - startValue);
4816 animation.AnimateTo(Property(actor, "test-property"),
4818 AlphaFunction::LINEAR,
4819 TimePeriod(delay, durationSeconds - delay));
4821 // Start the animation
4824 bool signalReceived(false);
4825 AnimationFinishCheck finishCheck(signalReceived);
4826 animation.FinishedSignal().Connect(&application, finishCheck);
4828 application.SendNotification();
4829 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4831 // We didn't expect the animation to finish yet
4832 application.SendNotification();
4833 finishCheck.CheckSignalNotReceived();
4834 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4836 application.SendNotification();
4837 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4839 // We didn't expect the animation to finish yet
4840 application.SendNotification();
4841 finishCheck.CheckSignalNotReceived();
4842 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
4844 application.SendNotification();
4845 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4847 // We did expect the animation to finish
4848 application.SendNotification();
4849 finishCheck.CheckSignalReceived();
4850 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
4854 int UtcDaliAnimationAnimateToVector3ComponentP(void)
4856 TestApplication application;
4858 Actor actor = Actor::New();
4860 // Register a Vector3 property
4861 Vector3 startValue(10.0f, 10.0f, 10.0f);
4862 Property::Index index = actor.RegisterProperty( "test-property", startValue );
4863 Stage::GetCurrent().Add(actor);
4864 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4866 // Build the animation
4867 float durationSeconds(1.0f);
4868 Animation animation = Animation::New(durationSeconds);
4869 Vector3 targetValue(30.0f, 30.0f, 10.0f);
4870 Vector3 relativeValue(targetValue - startValue);
4872 animation.AnimateTo(Property(actor, "test-property", 0),
4874 AlphaFunction::LINEAR,
4875 TimePeriod(delay, durationSeconds - delay));
4876 animation.AnimateTo(Property(actor, index, 1),
4878 AlphaFunction::LINEAR,
4879 TimePeriod(delay, durationSeconds - delay));
4881 // Start the animation
4884 bool signalReceived(false);
4885 AnimationFinishCheck finishCheck(signalReceived);
4886 animation.FinishedSignal().Connect(&application, finishCheck);
4888 application.SendNotification();
4889 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4891 // We didn't expect the animation to finish yet
4892 application.SendNotification();
4893 finishCheck.CheckSignalNotReceived();
4894 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4896 application.SendNotification();
4897 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4899 // We didn't expect the animation to finish yet
4900 application.SendNotification();
4901 finishCheck.CheckSignalNotReceived();
4902 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
4904 application.SendNotification();
4905 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4907 // We did expect the animation to finish
4908 application.SendNotification();
4909 finishCheck.CheckSignalReceived();
4910 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
4914 int UtcDaliAnimationAnimateToVector4P(void)
4916 TestApplication application;
4918 Actor actor = Actor::New();
4920 // Register a Vector4 property
4921 Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f);
4922 Property::Index index = actor.RegisterProperty( "test-property", startValue );
4923 Stage::GetCurrent().Add(actor);
4924 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4926 // Build the animation
4927 float durationSeconds(2.0f);
4928 Animation animation = Animation::New(durationSeconds);
4929 Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f);
4930 Vector4 relativeValue(targetValue - startValue);
4931 animation.AnimateTo(Property(actor, index), targetValue);
4933 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4935 // Start the animation
4938 bool signalReceived(false);
4939 AnimationFinishCheck finishCheck(signalReceived);
4940 animation.FinishedSignal().Connect(&application, finishCheck);
4942 application.SendNotification();
4943 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4945 // We didn't expect the animation to finish yet
4946 application.SendNotification();
4947 finishCheck.CheckSignalNotReceived();
4948 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION );
4950 application.SendNotification();
4951 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4953 // We did expect the animation to finish
4954 application.SendNotification();
4955 finishCheck.CheckSignalReceived();
4956 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4960 int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void)
4962 TestApplication application;
4964 Actor actor = Actor::New();
4966 // Register a Vector4 property
4967 Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
4968 Property::Index index = actor.RegisterProperty( "test-property", startValue );
4969 Stage::GetCurrent().Add(actor);
4970 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4972 // Build the animation
4973 float durationSeconds(1.0f);
4974 Animation animation = Animation::New(durationSeconds);
4975 Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
4976 Vector4 relativeValue(targetValue - startValue);
4977 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
4979 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4981 // Start the animation
4984 bool signalReceived(false);
4985 AnimationFinishCheck finishCheck(signalReceived);
4986 animation.FinishedSignal().Connect(&application, finishCheck);
4988 application.SendNotification();
4989 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4991 // We didn't expect the animation to finish yet
4992 application.SendNotification();
4993 finishCheck.CheckSignalNotReceived();
4995 // The position should have moved more, than with a linear alpha function
4996 Vector4 current(actor.GetProperty<Vector4>(index));
4997 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
4998 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
4999 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
5000 DALI_TEST_CHECK( current.w > ninetyFivePercentProgress.w );
5002 application.SendNotification();
5003 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5005 // We did expect the animation to finish
5006 application.SendNotification();
5007 finishCheck.CheckSignalReceived();
5008 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
5012 int UtcDaliAnimationAnimateToVector4TimePeriodP(void)
5014 TestApplication application;
5016 Actor actor = Actor::New();
5018 // Register a Vector4 property
5019 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
5020 Property::Index index = actor.RegisterProperty( "test-property", startValue );
5021 Stage::GetCurrent().Add(actor);
5022 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION );
5024 // Build the animation
5025 float durationSeconds(1.0f);
5026 Animation animation = Animation::New(durationSeconds);
5027 Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
5028 Vector4 relativeValue(targetValue - startValue);
5030 animation.AnimateTo(Property(actor, index),
5032 TimePeriod(delay, durationSeconds - delay));
5034 // Start the animation
5037 bool signalReceived(false);
5038 AnimationFinishCheck finishCheck(signalReceived);
5039 animation.FinishedSignal().Connect(&application, finishCheck);
5041 application.SendNotification();
5042 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5044 // We didn't expect the animation to finish yet
5045 application.SendNotification();
5046 finishCheck.CheckSignalNotReceived();
5047 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION );
5049 application.SendNotification();
5050 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5052 // We didn't expect the animation to finish yet
5053 application.SendNotification();
5054 finishCheck.CheckSignalNotReceived();
5055 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), VECTOR4_EPSILON, TEST_LOCATION );
5057 application.SendNotification();
5058 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5060 // We did expect the animation to finish
5061 application.SendNotification();
5062 finishCheck.CheckSignalReceived();
5063 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, VECTOR4_EPSILON, TEST_LOCATION );
5067 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void)
5069 TestApplication application;
5071 Actor actor = Actor::New();
5073 // Register a Vector4 property
5074 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
5075 Property::Index index = actor.RegisterProperty( "test-property", startValue );
5076 Stage::GetCurrent().Add(actor);
5077 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
5079 // Build the animation
5080 float durationSeconds(1.0f);
5081 Animation animation = Animation::New(durationSeconds);
5082 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
5083 Vector4 relativeValue(targetValue - startValue);
5085 animation.AnimateTo(Property(actor, index),
5087 AlphaFunction::LINEAR,
5088 TimePeriod(delay, durationSeconds - delay));
5090 // Start the animation
5093 bool signalReceived(false);
5094 AnimationFinishCheck finishCheck(signalReceived);
5095 animation.FinishedSignal().Connect(&application, finishCheck);
5097 application.SendNotification();
5098 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5100 // We didn't expect the animation to finish yet
5101 application.SendNotification();
5102 finishCheck.CheckSignalNotReceived();
5103 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
5105 application.SendNotification();
5106 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5108 // We didn't expect the animation to finish yet
5109 application.SendNotification();
5110 finishCheck.CheckSignalNotReceived();
5111 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5113 application.SendNotification();
5114 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5116 // We did expect the animation to finish
5117 application.SendNotification();
5118 finishCheck.CheckSignalReceived();
5119 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
5123 int UtcDaliAnimationAnimateToActorParentOriginP(void)
5125 TestApplication application;
5127 Actor actor = Actor::New();
5128 Stage::GetCurrent().Add(actor);
5129 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_LEFT, TEST_LOCATION );
5131 // Build the animation
5132 float durationSeconds(1.0f);
5133 Animation animation = Animation::New(durationSeconds);
5134 Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
5138 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin );
5140 catch (Dali::DaliException& e)
5142 DALI_TEST_PRINT_ASSERT( e );
5143 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5148 int UtcDaliAnimationAnimateToActorParentOriginXP(void)
5150 TestApplication application;
5152 Actor actor = Actor::New();
5153 Stage::GetCurrent().Add(actor);
5154 float startValue(0.0f);
5155 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().x, startValue, TEST_LOCATION );
5156 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION );
5158 // Build the animation
5159 float durationSeconds(1.0f);
5160 Animation animation = Animation::New(durationSeconds);
5161 float targetX(1.0f);
5165 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX );
5167 catch (Dali::DaliException& e)
5169 DALI_TEST_PRINT_ASSERT( e );
5170 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5175 int UtcDaliAnimationAnimateToActorParentOriginYP(void)
5177 TestApplication application;
5179 Actor actor = Actor::New();
5180 Stage::GetCurrent().Add(actor);
5181 float startValue(0.0f);
5182 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().y, startValue, TEST_LOCATION );
5183 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION );
5185 // Build the animation
5186 float durationSeconds(1.0f);
5187 Animation animation = Animation::New(durationSeconds);
5188 float targetY(1.0f);
5192 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY );
5194 catch (Dali::DaliException& e)
5196 DALI_TEST_PRINT_ASSERT( e );
5197 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5202 int UtcDaliAnimationAnimateToActorParentOriginZP(void)
5204 TestApplication application;
5206 Actor actor = Actor::New();
5207 Stage::GetCurrent().Add(actor);
5208 float startValue(0.5f);
5209 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().z, startValue, TEST_LOCATION );
5210 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION );
5212 // Build the animation
5213 float durationSeconds(1.0f);
5214 Animation animation = Animation::New(durationSeconds);
5215 float targetZ(1.0f);
5219 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ );
5221 catch (Dali::DaliException& e)
5223 DALI_TEST_PRINT_ASSERT( e );
5224 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5229 int UtcDaliAnimationAnimateToActorAnchorPointP(void)
5231 TestApplication application;
5233 Actor actor = Actor::New();
5234 Stage::GetCurrent().Add(actor);
5235 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), AnchorPoint::CENTER, TEST_LOCATION );
5237 // Build the animation
5238 float durationSeconds(1.0f);
5239 Animation animation = Animation::New(durationSeconds);
5240 Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT);
5244 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
5246 catch (Dali::DaliException& e)
5248 DALI_TEST_PRINT_ASSERT( e );
5249 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5254 int UtcDaliAnimationAnimateToActorAnchorPointXP(void)
5256 TestApplication application;
5258 Actor actor = Actor::New();
5259 Stage::GetCurrent().Add(actor);
5260 float startValue(0.5f);
5261 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().x, startValue, TEST_LOCATION );
5262 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION );
5264 // Build the animation
5265 float durationSeconds(1.0f);
5266 Animation animation = Animation::New(durationSeconds);
5267 float targetX(1.0f);
5271 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_X), targetX );
5273 catch (Dali::DaliException& e)
5275 DALI_TEST_PRINT_ASSERT( e );
5276 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5281 int UtcDaliAnimationAnimateToActorAnchorPointYP(void)
5283 TestApplication application;
5285 Actor actor = Actor::New();
5286 Stage::GetCurrent().Add(actor);
5287 float startValue(0.5f);
5288 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().y, startValue, TEST_LOCATION );
5289 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION );
5291 // Build the animation
5292 float durationSeconds(1.0f);
5293 Animation animation = Animation::New(durationSeconds);
5294 float targetY(0.0f);
5298 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY );
5300 catch (Dali::DaliException& e)
5302 DALI_TEST_PRINT_ASSERT( e );
5303 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5308 int UtcDaliAnimationAnimateToActorAnchorPointZP(void)
5310 TestApplication application;
5312 Actor actor = Actor::New();
5313 Stage::GetCurrent().Add(actor);
5314 float startValue(0.5f);
5315 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().z, startValue, TEST_LOCATION );
5316 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION );
5318 // Build the animation
5319 float durationSeconds(1.0f);
5320 Animation animation = Animation::New(durationSeconds);
5321 float targetZ(100.0f);
5325 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ );
5327 catch (Dali::DaliException& e)
5329 DALI_TEST_PRINT_ASSERT( e );
5330 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5335 int UtcDaliAnimationAnimateToActorSizeP(void)
5337 TestApplication application;
5339 Actor actor = Actor::New();
5340 Stage::GetCurrent().Add(actor);
5341 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5343 // Build the animation
5344 float durationSeconds(1.0f);
5345 Animation animation = Animation::New(durationSeconds);
5346 Vector3 targetSize(100.0f, 100.0f, 100.0f);
5347 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize );
5349 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
5351 // Start the animation
5354 bool signalReceived(false);
5355 AnimationFinishCheck finishCheck(signalReceived);
5356 animation.FinishedSignal().Connect(&application, finishCheck);
5358 application.SendNotification();
5359 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
5361 // We didn't expect the animation to finish yet
5362 application.SendNotification();
5363 finishCheck.CheckSignalNotReceived();
5364 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
5366 application.SendNotification();
5367 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
5369 // We did expect the animation to finish
5370 application.SendNotification();
5371 finishCheck.CheckSignalReceived();
5372 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
5375 finishCheck.Reset();
5376 actor.SetSize(Vector3::ZERO);
5377 application.SendNotification();
5378 application.Render(0);
5379 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5381 // Repeat with a different (ease-in) alpha function
5382 animation = Animation::New(durationSeconds);
5383 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
5384 animation.FinishedSignal().Connect(&application, finishCheck);
5387 application.SendNotification();
5388 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
5390 // We didn't expect the animation to finish yet
5391 application.SendNotification();
5392 finishCheck.CheckSignalNotReceived();
5394 // The size should have travelled less, than with a linear alpha function
5395 Vector3 current(actor.GetCurrentSize());
5396 DALI_TEST_CHECK( current.x > 0.0f );
5397 DALI_TEST_CHECK( current.y > 0.0f );
5398 DALI_TEST_CHECK( current.z > 0.0f );
5399 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
5400 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
5401 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
5403 application.SendNotification();
5404 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
5406 // We did expect the animation to finish
5407 application.SendNotification();
5408 finishCheck.CheckSignalReceived();
5409 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
5412 finishCheck.Reset();
5413 actor.SetSize(Vector3::ZERO);
5414 application.SendNotification();
5415 application.Render(0);
5416 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5418 // Repeat with a delay
5420 animation = Animation::New(durationSeconds);
5421 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
5422 animation.FinishedSignal().Connect(&application, finishCheck);
5425 application.SendNotification();
5426 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5428 // We didn't expect the animation to finish yet
5429 application.SendNotification();
5430 finishCheck.CheckSignalNotReceived();
5431 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5433 application.SendNotification();
5434 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5436 // We did expect the animation to finish
5437 application.SendNotification();
5438 finishCheck.CheckSignalReceived();
5439 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
5443 int UtcDaliAnimationAnimateToActorSizeWidthP(void)
5445 TestApplication application;
5447 Actor actor = Actor::New();
5448 Stage::GetCurrent().Add(actor);
5449 float startValue(0.0f);
5450 DALI_TEST_EQUALS( actor.GetCurrentSize().width, startValue, TEST_LOCATION );
5451 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION );
5453 // Build the animation
5454 float durationSeconds(1.0f);
5455 Animation animation = Animation::New(durationSeconds);
5456 float targetWidth(10.0f);
5457 animation.AnimateTo( Property(actor, Actor::Property::SIZE_WIDTH), targetWidth );
5459 float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f);
5461 // Start the animation
5464 bool signalReceived(false);
5465 AnimationFinishCheck finishCheck(signalReceived);
5466 animation.FinishedSignal().Connect(&application, finishCheck);
5468 application.SendNotification();
5469 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5471 // We didn't expect the animation to finish yet
5472 application.SendNotification();
5473 finishCheck.CheckSignalNotReceived();
5474 DALI_TEST_EQUALS( actor.GetCurrentSize().width, fiftyPercentProgress, TEST_LOCATION );
5475 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), fiftyPercentProgress, TEST_LOCATION );
5477 application.SendNotification();
5478 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5480 // We did expect the animation to finish
5481 application.SendNotification();
5482 finishCheck.CheckSignalReceived();
5483 DALI_TEST_EQUALS( actor.GetCurrentSize().width, targetWidth, TEST_LOCATION );
5484 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION );
5488 int UtcDaliAnimationAnimateToActorSizeHeightP(void)
5490 TestApplication application;
5492 Actor actor = Actor::New();
5493 Stage::GetCurrent().Add(actor);
5494 float startValue(0.0f);
5495 DALI_TEST_EQUALS( actor.GetCurrentSize().height, startValue, TEST_LOCATION );
5496 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION );
5498 // Build the animation
5499 float durationSeconds(1.0f);
5500 Animation animation = Animation::New(durationSeconds);
5501 float targetHeight(-10.0f);
5502 animation.AnimateTo( Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight );
5504 float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f);
5506 // Start the animation
5509 bool signalReceived(false);
5510 AnimationFinishCheck finishCheck(signalReceived);
5511 animation.FinishedSignal().Connect(&application, finishCheck);
5513 application.SendNotification();
5514 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5516 // We didn't expect the animation to finish yet
5517 application.SendNotification();
5518 finishCheck.CheckSignalNotReceived();
5519 DALI_TEST_EQUALS( actor.GetCurrentSize().height, fiftyPercentProgress, TEST_LOCATION );
5520 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), fiftyPercentProgress, TEST_LOCATION );
5522 application.SendNotification();
5523 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5525 // We did expect the animation to finish
5526 application.SendNotification();
5527 finishCheck.CheckSignalReceived();
5528 DALI_TEST_EQUALS( actor.GetCurrentSize().height, targetHeight, TEST_LOCATION );
5529 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION );
5533 int UtcDaliAnimationAnimateToActorSizeDepthP(void)
5535 TestApplication application;
5537 Actor actor = Actor::New();
5538 Stage::GetCurrent().Add(actor);
5539 float startValue(0.0f);
5540 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, startValue, TEST_LOCATION );
5541 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION );
5543 // Build the animation
5544 float durationSeconds(1.0f);
5545 Animation animation = Animation::New(durationSeconds);
5546 float targetDepth(-10.0f);
5547 animation.AnimateTo( Property(actor, Actor::Property::SIZE_DEPTH), targetDepth );
5549 float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f);
5551 // Start the animation
5554 bool signalReceived(false);
5555 AnimationFinishCheck finishCheck(signalReceived);
5556 animation.FinishedSignal().Connect(&application, finishCheck);
5558 application.SendNotification();
5559 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5561 // We didn't expect the animation to finish yet
5562 application.SendNotification();
5563 finishCheck.CheckSignalNotReceived();
5564 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, fiftyPercentProgress, TEST_LOCATION );
5565 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), fiftyPercentProgress, TEST_LOCATION );
5567 application.SendNotification();
5568 application.Render(static_cast<unsigned int>(durationSeconds*500.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.GetCurrentSize().depth, targetDepth, TEST_LOCATION );
5574 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION );
5578 int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void)
5580 TestApplication application;
5582 Actor actor = Actor::New();
5583 Stage::GetCurrent().Add(actor);
5584 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5586 // Build the animation
5587 float durationSeconds(1.0f);
5588 Animation animation = Animation::New(durationSeconds);
5589 Vector3 targetSize(100.0f, 100.0f, 100.0f);
5590 animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetSize );
5592 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
5594 // Start the animation
5597 bool signalReceived(false);
5598 AnimationFinishCheck finishCheck(signalReceived);
5599 animation.FinishedSignal().Connect(&application, finishCheck);
5601 application.SendNotification();
5602 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
5604 // We didn't expect the animation to finish yet
5605 application.SendNotification();
5606 finishCheck.CheckSignalNotReceived();
5607 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
5609 application.SendNotification();
5610 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
5612 // We did expect the animation to finish
5613 application.SendNotification();
5614 finishCheck.CheckSignalReceived();
5615 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
5618 finishCheck.Reset();
5619 actor.SetSize(Vector3::ZERO);
5620 application.SendNotification();
5621 application.Render(0);
5622 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5624 // Repeat with a different (ease-in) alpha function
5625 animation = Animation::New(durationSeconds);
5626 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::EASE_IN );
5627 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::EASE_IN );
5628 animation.FinishedSignal().Connect(&application, finishCheck);
5631 application.SendNotification();
5632 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
5634 // We didn't expect the animation to finish yet
5635 application.SendNotification();
5636 finishCheck.CheckSignalNotReceived();
5638 // The size should have travelled less, than with a linear alpha function
5639 Vector3 current(actor.GetCurrentSize());
5640 DALI_TEST_CHECK( current.x > 0.0f );
5641 DALI_TEST_CHECK( current.y > 0.0f );
5642 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
5643 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
5645 application.SendNotification();
5646 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
5648 // We did expect the animation to finish
5649 application.SendNotification();
5650 finishCheck.CheckSignalReceived();
5651 DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
5652 DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
5655 finishCheck.Reset();
5656 actor.SetSize(Vector3::ZERO);
5657 application.SendNotification();
5658 application.Render(0);
5659 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5661 // Repeat with a delay
5663 animation = Animation::New(durationSeconds);
5664 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
5665 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
5666 animation.FinishedSignal().Connect(&application, finishCheck);
5669 application.SendNotification();
5670 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5672 // We didn't expect the animation to finish yet
5673 application.SendNotification();
5674 finishCheck.CheckSignalNotReceived();
5675 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5677 application.SendNotification();
5678 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5680 // We did expect the animation to finish
5681 application.SendNotification();
5682 finishCheck.CheckSignalReceived();
5683 DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
5684 DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
5688 int UtcDaliAnimationAnimateToActorPositionP(void)
5690 TestApplication application;
5692 Actor actor = Actor::New();
5693 Stage::GetCurrent().Add(actor);
5694 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
5696 // Build the animation
5697 float durationSeconds(1.0f);
5698 Animation animation = Animation::New(durationSeconds);
5699 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
5700 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
5702 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
5704 // Start the animation
5707 bool signalReceived(false);
5708 AnimationFinishCheck finishCheck(signalReceived);
5709 animation.FinishedSignal().Connect(&application, finishCheck);
5711 application.SendNotification();
5712 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
5714 // We didn't expect the animation to finish yet
5715 application.SendNotification();
5716 finishCheck.CheckSignalNotReceived();
5717 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
5719 application.SendNotification();
5720 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5722 // We did expect the animation to finish
5723 application.SendNotification();
5724 finishCheck.CheckSignalReceived();
5725 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
5729 int UtcDaliAnimationAnimateToActorPositionXP(void)
5731 TestApplication application;
5733 Actor actor = Actor::New();
5734 Stage::GetCurrent().Add(actor);
5735 float startValue(0.0f);
5736 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, startValue, TEST_LOCATION );
5737 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
5738 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
5739 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
5741 // Build the animation
5742 float durationSeconds(1.0f);
5743 Animation animation = Animation::New(durationSeconds);
5744 float targetX(1.0f);
5745 animation.AnimateTo( Property(actor, Actor::Property::POSITION_X), targetX );
5747 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
5749 // Start the animation
5752 bool signalReceived(false);
5753 AnimationFinishCheck finishCheck(signalReceived);
5754 animation.FinishedSignal().Connect(&application, finishCheck);
5756 application.SendNotification();
5757 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5759 // We didn't expect the animation to finish yet
5760 application.SendNotification();
5761 finishCheck.CheckSignalNotReceived();
5762 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, fiftyPercentProgress, TEST_LOCATION );
5763 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), fiftyPercentProgress, TEST_LOCATION );
5764 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
5765 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
5767 application.SendNotification();
5768 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5770 // We did expect the animation to finish
5771 application.SendNotification();
5772 finishCheck.CheckSignalReceived();
5773 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, targetX, TEST_LOCATION );
5774 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION );
5775 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
5776 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
5780 int UtcDaliAnimationAnimateToActorPositionYP(void)
5782 TestApplication application;
5784 Actor actor = Actor::New();
5785 Stage::GetCurrent().Add(actor);
5786 float startValue(0.0f);
5787 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, startValue, TEST_LOCATION );
5788 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
5789 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
5790 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
5792 // Build the animation
5793 float durationSeconds(1.0f);
5794 Animation animation = Animation::New(durationSeconds);
5795 float targetY(10.0f);
5796 animation.AnimateTo( Property(actor, Actor::Property::POSITION_Y), targetY );
5798 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
5800 // Start the animation
5803 bool signalReceived(false);
5804 AnimationFinishCheck finishCheck(signalReceived);
5805 animation.FinishedSignal().Connect(&application, finishCheck);
5807 application.SendNotification();
5808 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5810 // We didn't expect the animation to finish yet
5811 application.SendNotification();
5812 finishCheck.CheckSignalNotReceived();
5813 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, fiftyPercentProgress, TEST_LOCATION );
5814 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
5815 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), fiftyPercentProgress, TEST_LOCATION );
5816 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
5818 application.SendNotification();
5819 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5821 // We did expect the animation to finish
5822 application.SendNotification();
5823 finishCheck.CheckSignalReceived();
5824 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, targetY, TEST_LOCATION );
5825 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
5826 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION );
5827 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
5831 int UtcDaliAnimationAnimateToActorPositionZP(void)
5833 TestApplication application;
5835 Actor actor = Actor::New();
5836 Stage::GetCurrent().Add(actor);
5837 float startValue(0.0f);
5838 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, startValue, TEST_LOCATION );
5839 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
5840 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
5841 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
5843 // Build the animation
5844 float durationSeconds(1.0f);
5845 Animation animation = Animation::New(durationSeconds);
5846 float targetZ(-5.0f);
5847 animation.AnimateTo( Property(actor, Actor::Property::POSITION_Z), targetZ );
5849 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
5851 // Start the animation
5854 bool signalReceived(false);
5855 AnimationFinishCheck finishCheck(signalReceived);
5856 animation.FinishedSignal().Connect(&application, finishCheck);
5858 application.SendNotification();
5859 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5861 // We didn't expect the animation to finish yet
5862 application.SendNotification();
5863 finishCheck.CheckSignalNotReceived();
5864 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, fiftyPercentProgress, TEST_LOCATION );
5865 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
5866 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
5867 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), fiftyPercentProgress, TEST_LOCATION );
5869 application.SendNotification();
5870 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5872 // We did expect the animation to finish
5873 application.SendNotification();
5874 finishCheck.CheckSignalReceived();
5875 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, targetZ, TEST_LOCATION );
5876 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
5877 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
5878 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION );
5882 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void)
5884 TestApplication application;
5886 Actor actor = Actor::New();
5887 Stage::GetCurrent().Add(actor);
5888 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
5890 // Build the animation
5891 float durationSeconds(1.0f);
5892 Animation animation = Animation::New(durationSeconds);
5893 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
5894 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
5896 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
5898 // Start the animation
5901 bool signalReceived(false);
5902 AnimationFinishCheck finishCheck(signalReceived);
5903 animation.FinishedSignal().Connect(&application, finishCheck);
5905 application.SendNotification();
5906 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
5908 // We didn't expect the animation to finish yet
5909 application.SendNotification();
5910 finishCheck.CheckSignalNotReceived();
5912 // The position should have moved less, than with a linear alpha function
5913 Vector3 current(actor.GetCurrentPosition());
5914 DALI_TEST_CHECK( current.x > Vector3::ZERO.x );
5915 DALI_TEST_CHECK( current.y > Vector3::ZERO.y );
5916 DALI_TEST_CHECK( current.z > Vector3::ZERO.z );
5917 DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x );
5918 DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y );
5919 DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z );
5921 application.SendNotification();
5922 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5924 // We did expect the animation to finish
5925 application.SendNotification();
5926 finishCheck.CheckSignalReceived();
5927 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
5931 int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void)
5933 TestApplication application;
5935 Actor actor = Actor::New();
5936 Stage::GetCurrent().Add(actor);
5937 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
5939 // Build the animation
5940 float durationSeconds(1.0f);
5941 Animation animation = Animation::New(durationSeconds);
5942 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
5944 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
5946 TimePeriod( delay, durationSeconds - delay ) );
5948 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
5950 // Start the animation
5953 bool signalReceived(false);
5954 AnimationFinishCheck finishCheck(signalReceived);
5955 animation.FinishedSignal().Connect(&application, finishCheck);
5957 application.SendNotification();
5958 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5960 // We didn't expect the animation to finish yet
5961 application.SendNotification();
5962 finishCheck.CheckSignalNotReceived();
5963 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
5965 application.SendNotification();
5966 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
5968 // We didn't expect the animation to finish yet
5969 application.SendNotification();
5970 finishCheck.CheckSignalNotReceived();
5971 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
5973 application.SendNotification();
5974 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
5976 // We did expect the animation to finish
5977 application.SendNotification();
5978 finishCheck.CheckSignalReceived();
5979 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
5983 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void)
5985 TestApplication application;
5987 Actor actor = Actor::New();
5988 Stage::GetCurrent().Add(actor);
5989 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
5991 // Build the animation
5992 float durationSeconds(1.0f);
5993 Animation animation = Animation::New(durationSeconds);
5994 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
5996 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
5998 AlphaFunction::LINEAR,
5999 TimePeriod( delay, durationSeconds - delay ) );
6001 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6003 // Start the animation
6006 bool signalReceived(false);
6007 AnimationFinishCheck finishCheck(signalReceived);
6008 animation.FinishedSignal().Connect(&application, finishCheck);
6010 application.SendNotification();
6011 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6013 // We didn't expect the animation to finish yet
6014 application.SendNotification();
6015 finishCheck.CheckSignalNotReceived();
6016 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6018 application.SendNotification();
6019 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
6021 // We didn't expect the animation to finish yet
6022 application.SendNotification();
6023 finishCheck.CheckSignalNotReceived();
6024 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
6026 application.SendNotification();
6027 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
6029 // We did expect the animation to finish
6030 application.SendNotification();
6031 finishCheck.CheckSignalReceived();
6032 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6036 int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void)
6038 TestApplication application;
6040 Actor actor = Actor::New();
6041 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
6042 Stage::GetCurrent().Add(actor);
6043 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
6045 // Build the animation
6046 float durationSeconds(1.0f);
6047 Animation animation = Animation::New(durationSeconds);
6048 Degree targetRotationDegrees(90.0f);
6049 Radian targetRotationRadians(targetRotationDegrees);
6050 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS) );
6052 // Start the animation
6055 bool signalReceived(false);
6056 AnimationFinishCheck finishCheck(signalReceived);
6057 animation.FinishedSignal().Connect(&application, finishCheck);
6059 application.SendNotification();
6060 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6062 // We didn't expect the animation to finish yet
6063 application.SendNotification();
6064 finishCheck.CheckSignalNotReceived();
6065 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6067 application.SendNotification();
6068 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6070 // We didn't expect the animation to finish yet
6071 application.SendNotification();
6072 finishCheck.CheckSignalNotReceived();
6073 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6075 application.SendNotification();
6076 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6078 // We didn't expect the animation to finish yet
6079 application.SendNotification();
6080 finishCheck.CheckSignalNotReceived();
6081 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6083 application.SendNotification();
6084 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6086 // We did expect the animation to finish
6087 application.SendNotification();
6088 finishCheck.CheckSignalReceived();
6089 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6093 int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void)
6095 TestApplication application;
6097 Actor actor = Actor::New();
6098 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
6099 Stage::GetCurrent().Add(actor);
6100 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
6102 // Build the animation
6103 float durationSeconds(1.0f);
6104 Animation animation = Animation::New(durationSeconds);
6105 Degree targetRotationDegrees(90.0f);
6106 Radian targetRotationRadians(targetRotationDegrees);
6107 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
6108 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), targetRotation );
6110 // Start the animation
6113 bool signalReceived(false);
6114 AnimationFinishCheck finishCheck(signalReceived);
6115 animation.FinishedSignal().Connect(&application, finishCheck);
6117 application.SendNotification();
6118 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6120 // We didn't expect the animation to finish yet
6121 application.SendNotification();
6122 finishCheck.CheckSignalNotReceived();
6123 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6125 application.SendNotification();
6126 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6128 // We didn't expect the animation to finish yet
6129 application.SendNotification();
6130 finishCheck.CheckSignalNotReceived();
6131 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6133 application.SendNotification();
6134 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6136 // We didn't expect the animation to finish yet
6137 application.SendNotification();
6138 finishCheck.CheckSignalNotReceived();
6139 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6141 application.SendNotification();
6142 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6144 // We did expect the animation to finish
6145 application.SendNotification();
6146 finishCheck.CheckSignalReceived();
6147 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6151 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void)
6153 TestApplication application;
6155 Actor actor = Actor::New();
6156 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
6157 Stage::GetCurrent().Add(actor);
6158 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6160 // Build the animation
6161 float durationSeconds(1.0f);
6162 Animation animation = Animation::New(durationSeconds);
6163 Degree targetRotationDegrees(90.0f);
6164 Radian targetRotationRadians(targetRotationDegrees);
6165 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
6167 // Start the animation
6170 bool signalReceived(false);
6171 AnimationFinishCheck finishCheck(signalReceived);
6172 animation.FinishedSignal().Connect(&application, finishCheck);
6174 application.SendNotification();
6175 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6177 // We didn't expect the animation to finish yet
6178 application.SendNotification();
6179 finishCheck.CheckSignalNotReceived();
6180 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6182 application.SendNotification();
6183 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6185 // We didn't expect the animation to finish yet
6186 application.SendNotification();
6187 finishCheck.CheckSignalNotReceived();
6188 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6190 application.SendNotification();
6191 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6193 // We didn't expect the animation to finish yet
6194 application.SendNotification();
6195 finishCheck.CheckSignalNotReceived();
6196 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6198 application.SendNotification();
6199 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6201 // We did expect the animation to finish
6202 application.SendNotification();
6203 finishCheck.CheckSignalReceived();
6204 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6208 int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void)
6210 TestApplication application;
6212 Actor actor = Actor::New();
6213 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
6214 Stage::GetCurrent().Add(actor);
6215 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
6217 // Build the animation
6218 float durationSeconds(1.0f);
6219 Animation animation = Animation::New(durationSeconds);
6220 Degree targetRotationDegrees(90.0f);
6221 Radian targetRotationRadians(targetRotationDegrees);
6223 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
6225 // Start the animation
6228 bool signalReceived(false);
6229 AnimationFinishCheck finishCheck(signalReceived);
6230 animation.FinishedSignal().Connect(&application, finishCheck);
6232 application.SendNotification();
6233 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6235 // We didn't expect the animation to finish yet
6236 application.SendNotification();
6237 finishCheck.CheckSignalNotReceived();
6238 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
6239 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6241 application.SendNotification();
6242 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6244 // We didn't expect the animation to finish yet
6245 application.SendNotification();
6246 finishCheck.CheckSignalNotReceived();
6247 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
6248 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6250 application.SendNotification();
6251 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6253 // We didn't expect the animation to finish yet
6254 application.SendNotification();
6255 finishCheck.CheckSignalNotReceived();
6256 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
6257 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6259 application.SendNotification();
6260 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6262 // We did expect the animation to finish
6263 application.SendNotification();
6264 finishCheck.CheckSignalReceived();
6265 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6269 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void)
6271 TestApplication application;
6273 Actor actor = Actor::New();
6274 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
6275 Stage::GetCurrent().Add(actor);
6276 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
6278 // Build the animation
6279 float durationSeconds(1.0f);
6280 Animation animation = Animation::New(durationSeconds);
6281 Degree targetRotationDegrees(90.0f);
6282 Radian targetRotationRadians(targetRotationDegrees);
6284 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
6286 // Start the animation
6289 bool signalReceived(false);
6290 AnimationFinishCheck finishCheck(signalReceived);
6291 animation.FinishedSignal().Connect(&application, finishCheck);
6293 application.SendNotification();
6294 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6296 // We didn't expect the animation to finish yet
6297 application.SendNotification();
6298 finishCheck.CheckSignalNotReceived();
6299 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
6300 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6302 application.SendNotification();
6303 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6305 // We didn't expect the animation to finish yet
6306 application.SendNotification();
6307 finishCheck.CheckSignalNotReceived();
6308 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
6309 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6311 application.SendNotification();
6312 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6314 // We didn't expect the animation to finish yet
6315 application.SendNotification();
6316 finishCheck.CheckSignalNotReceived();
6317 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
6318 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6320 application.SendNotification();
6321 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6323 // We did expect the animation to finish
6324 application.SendNotification();
6325 finishCheck.CheckSignalReceived();
6326 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6330 int UtcDaliAnimationAnimateToActorScaleP(void)
6332 TestApplication application;
6334 Actor actor = Actor::New();
6335 Stage::GetCurrent().Add(actor);
6336 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
6338 // Build the animation
6339 float durationSeconds(1.0f);
6340 Animation animation = Animation::New(durationSeconds);
6341 Vector3 targetScale(2.0f, 2.0f, 2.0f);
6342 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale );
6344 Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f);
6346 // Start the animation
6349 bool signalReceived(false);
6350 AnimationFinishCheck finishCheck(signalReceived);
6351 animation.FinishedSignal().Connect(&application, finishCheck);
6353 application.SendNotification();
6354 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6356 // We didn't expect the animation to finish yet
6357 application.SendNotification();
6358 finishCheck.CheckSignalNotReceived();
6359 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
6361 application.SendNotification();
6362 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6364 // We did expect the animation to finish
6365 application.SendNotification();
6366 finishCheck.CheckSignalReceived();
6367 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
6370 finishCheck.Reset();
6371 actor.SetScale(Vector3::ONE);
6372 application.SendNotification();
6373 application.Render(0);
6374 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
6376 // Repeat with a different (ease-in) alpha function
6377 animation = Animation::New(durationSeconds);
6378 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
6379 animation.FinishedSignal().Connect(&application, finishCheck);
6382 application.SendNotification();
6383 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6385 // We didn't expect the animation to finish yet
6386 application.SendNotification();
6387 finishCheck.CheckSignalNotReceived();
6389 // The scale should have grown less, than with a linear alpha function
6390 Vector3 current(actor.GetCurrentScale());
6391 DALI_TEST_CHECK( current.x > 1.0f );
6392 DALI_TEST_CHECK( current.y > 1.0f );
6393 DALI_TEST_CHECK( current.z > 1.0f );
6394 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
6395 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
6396 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
6398 application.SendNotification();
6399 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6401 // We did expect the animation to finish
6402 application.SendNotification();
6403 finishCheck.CheckSignalReceived();
6404 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
6407 finishCheck.Reset();
6408 actor.SetScale(Vector3::ONE);
6409 application.SendNotification();
6410 application.Render(0);
6411 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
6413 // Repeat with a delay
6415 animation = Animation::New(durationSeconds);
6416 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
6417 animation.FinishedSignal().Connect(&application, finishCheck);
6420 application.SendNotification();
6421 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6423 // We didn't expect the animation to finish yet
6424 application.SendNotification();
6425 finishCheck.CheckSignalNotReceived();
6426 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
6428 application.SendNotification();
6429 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6431 // We did expect the animation to finish
6432 application.SendNotification();
6433 finishCheck.CheckSignalReceived();
6434 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
6438 int UtcDaliAnimationAnimateToActorScaleXP(void)
6440 TestApplication application;
6442 Actor actor = Actor::New();
6443 Stage::GetCurrent().Add(actor);
6444 float startValue(1.0f);
6445 DALI_TEST_EQUALS( actor.GetCurrentScale().x, startValue, TEST_LOCATION );
6446 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
6447 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
6448 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
6450 // Build the animation
6451 float durationSeconds(1.0f);
6452 Animation animation = Animation::New(durationSeconds);
6453 float targetX(10.0f);
6454 animation.AnimateTo( Property(actor, Actor::Property::SCALE_X), targetX );
6456 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
6458 // Start the animation
6461 bool signalReceived(false);
6462 AnimationFinishCheck finishCheck(signalReceived);
6463 animation.FinishedSignal().Connect(&application, finishCheck);
6465 application.SendNotification();
6466 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6468 // We didn't expect the animation to finish yet
6469 application.SendNotification();
6470 finishCheck.CheckSignalNotReceived();
6471 DALI_TEST_EQUALS( actor.GetCurrentScale().x, fiftyPercentProgress, TEST_LOCATION );
6472 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), fiftyPercentProgress, TEST_LOCATION );
6473 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
6474 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
6476 application.SendNotification();
6477 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6479 // We did expect the animation to finish
6480 application.SendNotification();
6481 finishCheck.CheckSignalReceived();
6482 DALI_TEST_EQUALS( actor.GetCurrentScale().x, targetX, TEST_LOCATION );
6483 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), targetX, TEST_LOCATION );
6484 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
6485 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
6489 int UtcDaliAnimationAnimateToActorScaleYP(void)
6491 TestApplication application;
6493 Actor actor = Actor::New();
6494 Stage::GetCurrent().Add(actor);
6495 float startValue(1.0f);
6496 DALI_TEST_EQUALS( actor.GetCurrentScale().y, startValue, TEST_LOCATION );
6497 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
6498 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
6499 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
6501 // Build the animation
6502 float durationSeconds(1.0f);
6503 Animation animation = Animation::New(durationSeconds);
6504 float targetY(1000.0f);
6505 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Y), targetY );
6507 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
6509 // Start the animation
6512 bool signalReceived(false);
6513 AnimationFinishCheck finishCheck(signalReceived);
6514 animation.FinishedSignal().Connect(&application, finishCheck);
6516 application.SendNotification();
6517 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6519 // We didn't expect the animation to finish yet
6520 application.SendNotification();
6521 finishCheck.CheckSignalNotReceived();
6522 DALI_TEST_EQUALS( actor.GetCurrentScale().y, fiftyPercentProgress, TEST_LOCATION );
6523 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
6524 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), fiftyPercentProgress, TEST_LOCATION );
6525 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
6527 application.SendNotification();
6528 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6530 // We did expect the animation to finish
6531 application.SendNotification();
6532 finishCheck.CheckSignalReceived();
6533 DALI_TEST_EQUALS( actor.GetCurrentScale().y, targetY, TEST_LOCATION );
6534 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
6535 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), targetY, TEST_LOCATION );
6536 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
6540 int UtcDaliAnimationAnimateToActorScaleZP(void)
6542 TestApplication application;
6544 Actor actor = Actor::New();
6545 Stage::GetCurrent().Add(actor);
6546 float startValue(1.0f);
6547 DALI_TEST_EQUALS( actor.GetCurrentScale().z, startValue, TEST_LOCATION );
6548 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
6549 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
6550 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
6552 // Build the animation
6553 float durationSeconds(1.0f);
6554 Animation animation = Animation::New(durationSeconds);
6555 float targetZ(-1000.0f);
6556 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Z), targetZ );
6558 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
6560 // Start the animation
6563 bool signalReceived(false);
6564 AnimationFinishCheck finishCheck(signalReceived);
6565 animation.FinishedSignal().Connect(&application, finishCheck);
6567 application.SendNotification();
6568 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6570 // We didn't expect the animation to finish yet
6571 application.SendNotification();
6572 finishCheck.CheckSignalNotReceived();
6573 DALI_TEST_EQUALS( actor.GetCurrentScale().z, fiftyPercentProgress, TEST_LOCATION );
6574 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
6575 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
6576 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), fiftyPercentProgress, TEST_LOCATION );
6578 application.SendNotification();
6579 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6581 // We did expect the animation to finish
6582 application.SendNotification();
6583 finishCheck.CheckSignalReceived();
6584 DALI_TEST_EQUALS( actor.GetCurrentScale().z, targetZ, TEST_LOCATION );
6585 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
6586 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
6587 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), targetZ, TEST_LOCATION );
6591 int UtcDaliAnimationAnimateToActorColorP(void)
6593 TestApplication application;
6595 Actor actor = Actor::New();
6596 Stage::GetCurrent().Add(actor);
6597 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
6599 // Build the animation
6600 float durationSeconds(1.0f);
6601 Animation animation = Animation::New(durationSeconds);
6602 Vector4 targetColor(Color::RED);
6603 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor );
6605 Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
6606 Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
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*100.0f)/* 10% progress */);
6618 // We didn't expect the animation to finish yet
6619 application.SendNotification();
6620 finishCheck.CheckSignalNotReceived();
6621 DALI_TEST_EQUALS( actor.GetCurrentColor(), tenPercentProgress, TEST_LOCATION );
6623 application.SendNotification();
6624 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
6626 // We did expect the animation to finish
6627 application.SendNotification();
6628 finishCheck.CheckSignalReceived();
6629 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
6632 finishCheck.Reset();
6633 actor.SetColor(Color::WHITE);
6634 application.SendNotification();
6635 application.Render(0);
6636 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
6638 // Repeat with a different (ease-in) alpha function
6639 animation = Animation::New(durationSeconds);
6640 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
6641 animation.FinishedSignal().Connect(&application, finishCheck);
6644 application.SendNotification();
6645 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
6647 // We didn't expect the animation to finish yet
6648 application.SendNotification();
6649 finishCheck.CheckSignalNotReceived();
6651 // The color should have changed less, than with a linear alpha function
6652 Vector4 current(actor.GetCurrentColor());
6653 DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change
6654 DALI_TEST_CHECK( current.y < 1.0f );
6655 DALI_TEST_CHECK( current.y > tenPercentProgress.y );
6656 DALI_TEST_CHECK( current.z < 1.0f );
6657 DALI_TEST_CHECK( current.z > tenPercentProgress.z );
6658 DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
6660 application.SendNotification();
6661 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
6663 // We did expect the animation to finish
6664 application.SendNotification();
6665 finishCheck.CheckSignalReceived();
6666 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
6669 finishCheck.Reset();
6670 actor.SetColor(Color::WHITE);
6671 application.SendNotification();
6672 application.Render(0);
6673 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
6675 // Repeat with a shorter animator duration
6676 float animatorDuration = 0.5f;
6677 animation = Animation::New(durationSeconds);
6678 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
6679 animation.FinishedSignal().Connect(&application, finishCheck);
6682 application.SendNotification();
6683 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
6685 // We didn't expect the animation to finish yet
6686 application.SendNotification();
6687 finishCheck.CheckSignalNotReceived();
6688 DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION );
6690 application.SendNotification();
6691 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
6693 // We didn't expect the animation to finish yet
6694 application.SendNotification();
6695 finishCheck.CheckSignalNotReceived();
6696 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
6698 application.SendNotification();
6699 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6701 // We did expect the animation to finish
6702 application.SendNotification();
6703 finishCheck.CheckSignalReceived();
6704 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
6708 int UtcDaliAnimationAnimateToActorColorRedP(void)
6710 TestApplication application;
6712 Actor actor = Actor::New();
6713 Stage::GetCurrent().Add(actor);
6714 float startValue(1.0f);
6715 DALI_TEST_EQUALS( actor.GetCurrentColor().r, startValue, TEST_LOCATION );
6716 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
6717 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
6718 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
6719 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
6721 // Build the animation
6722 float durationSeconds(1.0f);
6723 Animation animation = Animation::New(durationSeconds);
6724 float targetRed(0.5f);
6725 animation.AnimateTo( Property(actor, Actor::Property::COLOR_RED), targetRed );
6727 float fiftyPercentProgress(startValue + (targetRed - startValue)*0.5f);
6729 // Start the animation
6732 bool signalReceived(false);
6733 AnimationFinishCheck finishCheck(signalReceived);
6734 animation.FinishedSignal().Connect(&application, finishCheck);
6736 application.SendNotification();
6737 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6739 // We didn't expect the animation to finish yet
6740 application.SendNotification();
6741 finishCheck.CheckSignalNotReceived();
6742 DALI_TEST_EQUALS( actor.GetCurrentColor().r, fiftyPercentProgress, TEST_LOCATION );
6743 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION );
6744 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
6745 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
6746 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
6748 application.SendNotification();
6749 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6751 // We did expect the animation to finish
6752 application.SendNotification();
6753 finishCheck.CheckSignalReceived();
6754 DALI_TEST_EQUALS( actor.GetCurrentColor().r, targetRed, TEST_LOCATION );
6755 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), targetRed, TEST_LOCATION );
6756 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
6757 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
6758 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
6762 int UtcDaliAnimationAnimateToActorColorGreenP(void)
6764 TestApplication application;
6766 Actor actor = Actor::New();
6767 Stage::GetCurrent().Add(actor);
6768 float startValue(1.0f);
6769 DALI_TEST_EQUALS( actor.GetCurrentColor().g, startValue, TEST_LOCATION );
6770 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
6771 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
6772 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
6773 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
6775 // Build the animation
6776 float durationSeconds(1.0f);
6777 Animation animation = Animation::New(durationSeconds);
6778 float targetGreen(0.5f);
6779 animation.AnimateTo( Property(actor, Actor::Property::COLOR_GREEN), targetGreen );
6781 float fiftyPercentProgress(startValue + (targetGreen - startValue)*0.5f);
6783 // Start the animation
6786 bool signalReceived(false);
6787 AnimationFinishCheck finishCheck(signalReceived);
6788 animation.FinishedSignal().Connect(&application, finishCheck);
6790 application.SendNotification();
6791 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6793 // We didn't expect the animation to finish yet
6794 application.SendNotification();
6795 finishCheck.CheckSignalNotReceived();
6796 DALI_TEST_EQUALS( actor.GetCurrentColor().g, fiftyPercentProgress, TEST_LOCATION );
6797 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
6798 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION );
6799 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
6800 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
6802 application.SendNotification();
6803 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6805 // We did expect the animation to finish
6806 application.SendNotification();
6807 finishCheck.CheckSignalReceived();
6808 DALI_TEST_EQUALS( actor.GetCurrentColor().g, targetGreen, TEST_LOCATION );
6809 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
6810 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION );
6811 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
6812 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
6816 int UtcDaliAnimationAnimateToActorColorBlueP(void)
6818 TestApplication application;
6820 Actor actor = Actor::New();
6821 Stage::GetCurrent().Add(actor);
6822 float startValue(1.0f);
6823 DALI_TEST_EQUALS( actor.GetCurrentColor().b, startValue, TEST_LOCATION );
6824 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
6825 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
6826 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
6827 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
6829 // Build the animation
6830 float durationSeconds(1.0f);
6831 Animation animation = Animation::New(durationSeconds);
6832 float targetBlue(0.5f);
6833 animation.AnimateTo( Property(actor, Actor::Property::COLOR_BLUE), targetBlue );
6835 float fiftyPercentProgress(startValue + (targetBlue - startValue)*0.5f);
6837 // Start the animation
6840 bool signalReceived(false);
6841 AnimationFinishCheck finishCheck(signalReceived);
6842 animation.FinishedSignal().Connect(&application, finishCheck);
6844 application.SendNotification();
6845 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6847 // We didn't expect the animation to finish yet
6848 application.SendNotification();
6849 finishCheck.CheckSignalNotReceived();
6850 DALI_TEST_EQUALS( actor.GetCurrentColor().b, fiftyPercentProgress, TEST_LOCATION );
6851 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
6852 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
6853 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), fiftyPercentProgress, TEST_LOCATION );
6854 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
6856 application.SendNotification();
6857 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6859 // We did expect the animation to finish
6860 application.SendNotification();
6861 finishCheck.CheckSignalReceived();
6862 DALI_TEST_EQUALS( actor.GetCurrentColor().b, targetBlue, TEST_LOCATION );
6863 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
6864 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
6865 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetBlue, TEST_LOCATION );
6866 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
6870 int UtcDaliAnimationAnimateToActorColorAlphaP(void)
6872 TestApplication application;
6874 Actor actor = Actor::New();
6875 Stage::GetCurrent().Add(actor);
6876 float startValue(1.0f);
6877 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
6878 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
6879 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
6880 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
6881 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
6883 // Build the animation
6884 float durationSeconds(1.0f);
6885 Animation animation = Animation::New(durationSeconds);
6886 float targetAlpha(0.5f);
6887 animation.AnimateTo( Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha );
6889 float fiftyPercentProgress(startValue + (targetAlpha - startValue)*0.5f);
6891 // Start the animation
6894 bool signalReceived(false);
6895 AnimationFinishCheck finishCheck(signalReceived);
6896 animation.FinishedSignal().Connect(&application, finishCheck);
6898 application.SendNotification();
6899 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6901 // We didn't expect the animation to finish yet
6902 application.SendNotification();
6903 finishCheck.CheckSignalNotReceived();
6904 DALI_TEST_EQUALS( actor.GetCurrentColor().a, fiftyPercentProgress, TEST_LOCATION );
6905 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
6906 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
6907 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
6908 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), fiftyPercentProgress, TEST_LOCATION );
6910 application.SendNotification();
6911 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6913 // We did expect the animation to finish
6914 application.SendNotification();
6915 finishCheck.CheckSignalReceived();
6916 DALI_TEST_EQUALS( actor.GetCurrentColor().a, targetAlpha, TEST_LOCATION );
6917 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
6918 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
6919 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
6920 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetAlpha, TEST_LOCATION );
6924 int UtcDaliAnimationKeyFrames01P(void)
6926 TestApplication application;
6928 KeyFrames keyFrames = KeyFrames::New();
6929 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
6931 keyFrames.Add(0.0f, 0.1f);
6933 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
6935 KeyFrames keyFrames2( keyFrames);
6936 DALI_TEST_CHECK( keyFrames2 );
6937 DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
6939 KeyFrames keyFrames3 = KeyFrames::New();
6940 keyFrames3.Add(0.6f, true);
6941 DALI_TEST_CHECK( keyFrames3 );
6942 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
6944 keyFrames3 = keyFrames;
6945 DALI_TEST_CHECK( keyFrames3 );
6946 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
6951 int UtcDaliAnimationKeyFrames02P(void)
6953 TestApplication application;
6955 KeyFrames keyFrames = KeyFrames::New();
6956 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
6958 keyFrames.Add(0.0f, 0.1f);
6959 keyFrames.Add(0.2f, 0.5f);
6960 keyFrames.Add(0.4f, 0.0f);
6961 keyFrames.Add(0.6f, 1.0f);
6962 keyFrames.Add(0.8f, 0.7f);
6963 keyFrames.Add(1.0f, 0.9f);
6965 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
6969 keyFrames.Add(1.9f, false);
6971 catch (Dali::DaliException& e)
6973 DALI_TEST_PRINT_ASSERT( e );
6974 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
6979 int UtcDaliAnimationKeyFrames03P(void)
6981 TestApplication application;
6983 KeyFrames keyFrames = KeyFrames::New();
6984 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
6986 keyFrames.Add(0.0f, true);
6987 keyFrames.Add(0.2f, false);
6988 keyFrames.Add(0.4f, false);
6989 keyFrames.Add(0.6f, true);
6990 keyFrames.Add(0.8f, true);
6991 keyFrames.Add(1.0f, false);
6993 DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
6997 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
6999 catch (Dali::DaliException& e)
7001 DALI_TEST_PRINT_ASSERT( e );
7002 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
7007 int UtcDaliAnimationKeyFrames04P(void)
7009 TestApplication application;
7011 KeyFrames keyFrames = KeyFrames::New();
7012 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7014 keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
7015 keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
7016 keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
7017 keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
7018 keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
7019 keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
7021 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
7025 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
7027 catch (Dali::DaliException& e)
7029 DALI_TEST_PRINT_ASSERT( e );
7030 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
7035 int UtcDaliAnimationKeyFrames05P(void)
7037 TestApplication application;
7039 KeyFrames keyFrames = KeyFrames::New();
7040 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7042 keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
7043 keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
7044 keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
7045 keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
7046 keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
7047 keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
7049 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
7053 keyFrames.Add(0.7f, 1.0f);
7055 catch (Dali::DaliException& e)
7057 DALI_TEST_PRINT_ASSERT( e );
7058 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
7063 int UtcDaliAnimationKeyFrames06P(void)
7065 TestApplication application;
7067 KeyFrames keyFrames = KeyFrames::New();
7068 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7070 keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
7071 keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
7072 keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
7073 keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
7074 keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
7075 keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
7077 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
7081 keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
7083 catch (Dali::DaliException& e)
7085 DALI_TEST_PRINT_ASSERT( e );
7086 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
7091 int UtcDaliAnimationKeyFrames07P(void)
7093 TestApplication application;
7095 KeyFrames keyFrames = KeyFrames::New();
7096 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7098 keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
7099 keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
7100 keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
7101 keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
7102 keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
7103 keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
7105 DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
7109 keyFrames.Add(0.7f, 1.1f);
7111 catch (Dali::DaliException& e)
7113 DALI_TEST_PRINT_ASSERT( e );
7114 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
7119 int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
7121 TestApplication application;
7123 float startValue(1.0f);
7124 Actor actor = Actor::New();
7125 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
7126 Stage::GetCurrent().Add(actor);
7128 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7129 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7130 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7131 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7132 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7134 // Build the animation
7135 float durationSeconds(1.0f);
7136 Animation animation = Animation::New(durationSeconds);
7138 KeyFrames keyFrames = KeyFrames::New();
7139 keyFrames.Add(0.0f, 0.1f);
7140 keyFrames.Add(0.2f, 0.5f);
7141 keyFrames.Add(0.4f, 0.0f);
7142 keyFrames.Add(0.6f, 1.0f);
7143 keyFrames.Add(0.8f, 0.7f);
7144 keyFrames.Add(1.0f, 0.9f);
7146 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames );
7148 // Start the animation
7151 bool signalReceived(false);
7152 AnimationFinishCheck finishCheck(signalReceived);
7153 animation.FinishedSignal().Connect(&application, finishCheck);
7154 application.SendNotification();
7155 application.Render(0);
7156 application.SendNotification();
7157 finishCheck.CheckSignalNotReceived();
7158 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
7160 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7161 application.SendNotification();
7162 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7163 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7164 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7165 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION );
7166 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.3f, 0.01f, TEST_LOCATION );
7168 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
7169 application.SendNotification();
7170 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7171 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7172 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7173 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION );
7174 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.25f, 0.01f, TEST_LOCATION );
7176 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
7177 application.SendNotification();
7178 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7179 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7180 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7181 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
7182 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
7184 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
7185 application.SendNotification();
7186 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7187 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7188 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7189 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
7190 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
7192 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
7193 application.SendNotification();
7194 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7195 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7196 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7197 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION );
7198 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.8f, 0.01f, TEST_LOCATION );
7200 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
7201 application.SendNotification();
7202 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7203 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7204 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7205 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
7206 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
7208 // We did expect the animation to finish
7210 finishCheck.CheckSignalReceived();
7214 int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
7216 TestApplication application;
7218 float startValue(1.0f);
7219 Actor actor = Actor::New();
7220 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
7221 Stage::GetCurrent().Add(actor);
7223 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7224 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7225 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7226 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7227 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7229 // Build the animation
7230 float durationSeconds(1.0f);
7231 Animation animation = Animation::New(durationSeconds);
7233 KeyFrames keyFrames = KeyFrames::New();
7234 keyFrames.Add(0.0f, 0.1f);
7235 keyFrames.Add(0.2f, 0.5f);
7236 keyFrames.Add(0.4f, 0.0f);
7237 keyFrames.Add(0.6f, 1.0f);
7238 keyFrames.Add(0.8f, 0.7f);
7239 keyFrames.Add(1.0f, 0.9f);
7241 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::Cubic );
7243 // Start the animation
7246 bool signalReceived(false);
7247 AnimationFinishCheck finishCheck(signalReceived);
7248 animation.FinishedSignal().Connect(&application, finishCheck);
7249 application.SendNotification();
7250 application.Render(0);
7251 application.SendNotification();
7252 finishCheck.CheckSignalNotReceived();
7253 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
7255 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7256 application.SendNotification();
7257 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7258 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7259 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7260 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.36f, 0.01f, TEST_LOCATION );
7261 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.36f, 0.01f, TEST_LOCATION );
7263 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
7264 application.SendNotification();
7265 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7266 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7267 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7268 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.21f, 0.01f, TEST_LOCATION );
7269 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.21f, 0.01f, TEST_LOCATION );
7271 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
7272 application.SendNotification();
7273 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7274 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7275 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7276 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
7277 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
7279 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
7280 application.SendNotification();
7281 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7282 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7283 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7284 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
7285 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
7287 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
7288 application.SendNotification();
7289 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7290 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7291 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7292 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.76f, 0.01f, TEST_LOCATION );
7293 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.76f, 0.01f, TEST_LOCATION );
7295 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
7296 application.SendNotification();
7297 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7298 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7299 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7300 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
7301 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
7303 // We did expect the animation to finish
7305 finishCheck.CheckSignalReceived();
7309 int UtcDaliAnimationAnimateBetweenActorColorP(void)
7311 TestApplication application;
7313 float startValue(1.0f);
7314 Actor actor = Actor::New();
7315 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
7316 Stage::GetCurrent().Add(actor);
7318 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7319 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7320 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7321 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7322 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7324 // Build the animation
7325 float durationSeconds(1.0f);
7326 Animation animation = Animation::New(durationSeconds);
7328 KeyFrames keyFrames = KeyFrames::New();
7329 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
7330 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
7331 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
7333 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames );
7335 // Start the animation
7338 bool signalReceived(false);
7339 AnimationFinishCheck finishCheck(signalReceived);
7340 animation.FinishedSignal().Connect(&application, finishCheck);
7341 application.SendNotification();
7342 application.Render(0);
7343 application.SendNotification();
7344 finishCheck.CheckSignalNotReceived();
7345 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
7346 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
7347 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
7348 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
7350 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7351 application.SendNotification();
7352 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
7353 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
7354 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
7355 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
7357 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7358 application.SendNotification();
7359 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
7360 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
7361 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
7362 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
7364 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7365 application.SendNotification();
7366 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
7367 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
7368 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
7369 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
7371 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
7372 application.SendNotification();
7373 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
7374 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
7375 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
7376 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
7378 // We did expect the animation to finish
7380 finishCheck.CheckSignalReceived();
7384 int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
7386 TestApplication application;
7388 float startValue(1.0f);
7389 Actor actor = Actor::New();
7390 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
7391 Stage::GetCurrent().Add(actor);
7393 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7394 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7395 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7396 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7397 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7399 // Build the animation
7400 float durationSeconds(1.0f);
7401 Animation animation = Animation::New(durationSeconds);
7403 KeyFrames keyFrames = KeyFrames::New();
7404 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
7405 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
7406 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
7408 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, Animation::Cubic );
7410 // Start the animation
7413 bool signalReceived(false);
7414 AnimationFinishCheck finishCheck(signalReceived);
7415 animation.FinishedSignal().Connect(&application, finishCheck);
7416 application.SendNotification();
7417 application.Render(0);
7418 application.SendNotification();
7419 finishCheck.CheckSignalNotReceived();
7420 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
7421 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
7422 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
7423 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
7425 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7426 application.SendNotification();
7427 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION );
7428 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
7429 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION );
7430 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
7432 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7433 application.SendNotification();
7434 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
7435 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
7436 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
7437 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
7439 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7440 application.SendNotification();
7441 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION );
7442 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
7443 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION );
7444 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
7446 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
7447 application.SendNotification();
7448 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
7449 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
7450 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
7451 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
7453 // We did expect the animation to finish
7455 finishCheck.CheckSignalReceived();
7459 int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
7461 TestApplication application;
7463 Actor actor = Actor::New();
7464 AngleAxis aa(Degree(90), Vector3::XAXIS);
7465 actor.SetOrientation(aa.angle, aa.axis);
7466 Stage::GetCurrent().Add(actor);
7468 application.SendNotification();
7469 application.Render(0);
7471 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
7473 // Build the animation
7474 float durationSeconds(1.0f);
7475 Animation animation = Animation::New(durationSeconds);
7477 KeyFrames keyFrames = KeyFrames::New();
7478 keyFrames.Add(0.0f, false);
7479 keyFrames.Add(0.2f, true);
7480 keyFrames.Add(0.4f, true);
7481 keyFrames.Add(0.8f, false);
7482 keyFrames.Add(1.0f, true);
7484 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames );
7486 // Start the animation
7489 bool signalReceived(false);
7490 AnimationFinishCheck finishCheck(signalReceived);
7491 animation.FinishedSignal().Connect(&application, finishCheck);
7492 application.SendNotification();
7493 application.SendNotification();
7494 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
7495 application.SendNotification();
7496 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
7497 application.SendNotification();
7499 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
7500 finishCheck.CheckSignalReceived();
7504 int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
7506 TestApplication application;
7508 Actor actor = Actor::New();
7509 AngleAxis aa(Degree(90), Vector3::XAXIS);
7510 actor.SetOrientation(aa.angle, aa.axis);
7511 Stage::GetCurrent().Add(actor);
7513 application.SendNotification();
7514 application.Render(0);
7516 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
7518 // Build the animation
7519 float durationSeconds(1.0f);
7520 Animation animation = Animation::New(durationSeconds);
7522 KeyFrames keyFrames = KeyFrames::New();
7523 keyFrames.Add(0.0f, false);
7524 keyFrames.Add(0.2f, true);
7525 keyFrames.Add(0.4f, true);
7526 keyFrames.Add(0.8f, false);
7527 keyFrames.Add(1.0f, true);
7529 //Cubic interpolation for boolean values should be ignored
7530 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::Cubic );
7532 // Start the animation
7535 bool signalReceived(false);
7536 AnimationFinishCheck finishCheck(signalReceived);
7537 animation.FinishedSignal().Connect(&application, finishCheck);
7538 application.SendNotification();
7539 application.SendNotification();
7540 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
7541 application.SendNotification();
7542 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
7543 application.SendNotification();
7545 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
7546 finishCheck.CheckSignalReceived();
7550 int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
7552 TestApplication application;
7554 Actor actor = Actor::New();
7555 AngleAxis aa(Degree(90), Vector3::XAXIS);
7556 actor.SetOrientation(aa.angle, aa.axis);
7557 Stage::GetCurrent().Add(actor);
7559 application.SendNotification();
7560 application.Render(0);
7561 Quaternion start(Radian(aa.angle), aa.axis);
7562 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
7564 // Build the animation
7565 float durationSeconds(1.0f);
7566 Animation animation = Animation::New(durationSeconds);
7568 KeyFrames keyFrames = KeyFrames::New();
7569 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
7571 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
7573 // Start the animation
7576 bool signalReceived(false);
7577 AnimationFinishCheck finishCheck(signalReceived);
7578 animation.FinishedSignal().Connect(&application, finishCheck);
7579 application.SendNotification();
7580 application.SendNotification();
7581 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
7582 application.SendNotification();
7583 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
7584 application.SendNotification();
7586 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
7588 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
7589 finishCheck.CheckSignalReceived();
7593 int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
7595 TestApplication application;
7597 Actor actor = Actor::New();
7598 AngleAxis aa(Degree(90), Vector3::XAXIS);
7599 actor.SetOrientation(aa.angle, aa.axis);
7600 application.SendNotification();
7601 application.Render(0);
7602 Stage::GetCurrent().Add(actor);
7604 Quaternion start(Radian(aa.angle), aa.axis);
7605 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
7607 // Build the animation
7608 float durationSeconds(1.0f);
7609 Animation animation = Animation::New(durationSeconds);
7611 KeyFrames keyFrames = KeyFrames::New();
7612 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
7613 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
7614 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
7616 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
7618 // Start the animation
7621 bool signalReceived(false);
7622 AnimationFinishCheck finishCheck(signalReceived);
7623 animation.FinishedSignal().Connect(&application, finishCheck);
7624 application.SendNotification();
7625 application.Render(0);
7626 application.SendNotification();
7627 finishCheck.CheckSignalNotReceived();
7629 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
7630 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
7632 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7633 application.SendNotification();
7634 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
7635 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
7637 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7638 application.SendNotification();
7639 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
7640 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
7642 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7643 application.SendNotification();
7644 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f) );
7645 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
7647 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
7648 application.SendNotification();
7649 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
7650 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
7652 // We did expect the animation to finish
7654 finishCheck.CheckSignalReceived();
7658 int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
7660 TestApplication application;
7662 Actor actor = Actor::New();
7663 AngleAxis aa(Degree(90), Vector3::XAXIS);
7664 actor.SetOrientation(aa.angle, aa.axis);
7665 Stage::GetCurrent().Add(actor);
7667 application.SendNotification();
7668 application.Render(0);
7669 Quaternion start(Radian(aa.angle), aa.axis);
7670 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
7672 // Build the animation
7673 float durationSeconds(1.0f);
7674 Animation animation = Animation::New(durationSeconds);
7676 KeyFrames keyFrames = KeyFrames::New();
7677 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
7679 //Cubic interpolation should be ignored for quaternions
7680 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
7682 // Start the animation
7685 bool signalReceived(false);
7686 AnimationFinishCheck finishCheck(signalReceived);
7687 animation.FinishedSignal().Connect(&application, finishCheck);
7688 application.SendNotification();
7689 application.SendNotification();
7690 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
7691 application.SendNotification();
7692 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
7693 application.SendNotification();
7695 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
7697 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
7698 finishCheck.CheckSignalReceived();
7702 int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
7704 TestApplication application;
7706 Actor actor = Actor::New();
7707 AngleAxis aa(Degree(90), Vector3::XAXIS);
7708 actor.SetOrientation(aa.angle, aa.axis);
7709 application.SendNotification();
7710 application.Render(0);
7711 Stage::GetCurrent().Add(actor);
7713 Quaternion start(Radian(aa.angle), aa.axis);
7714 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
7716 // Build the animation
7717 float durationSeconds(1.0f);
7718 Animation animation = Animation::New(durationSeconds);
7720 KeyFrames keyFrames = KeyFrames::New();
7721 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
7722 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
7723 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
7725 //Cubic interpolation should be ignored for quaternions
7726 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
7728 // Start the animation
7731 bool signalReceived(false);
7732 AnimationFinishCheck finishCheck(signalReceived);
7733 animation.FinishedSignal().Connect(&application, finishCheck);
7734 application.SendNotification();
7735 application.Render(0);
7736 application.SendNotification();
7737 finishCheck.CheckSignalNotReceived();
7739 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
7740 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
7742 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7743 application.SendNotification();
7744 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
7745 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
7747 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7748 application.SendNotification();
7749 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
7750 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
7752 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7753 application.SendNotification();
7754 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f ) );
7755 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
7757 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
7758 application.SendNotification();
7759 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
7760 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
7762 // We did expect the animation to finish
7764 finishCheck.CheckSignalReceived();
7768 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
7770 TestApplication application;
7772 float startValue(1.0f);
7773 Actor actor = Actor::New();
7774 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
7775 Stage::GetCurrent().Add(actor);
7777 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7778 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7779 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7780 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7781 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7783 // Build the animation
7784 float durationSeconds(1.0f);
7785 Animation animation = Animation::New(durationSeconds);
7787 KeyFrames keyFrames = KeyFrames::New();
7788 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
7789 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
7790 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
7792 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR );
7794 // Start the animation
7797 bool signalReceived(false);
7798 AnimationFinishCheck finishCheck(signalReceived);
7799 animation.FinishedSignal().Connect(&application, finishCheck);
7800 application.SendNotification();
7801 application.Render(0);
7802 application.SendNotification();
7803 finishCheck.CheckSignalNotReceived();
7804 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
7805 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
7806 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
7807 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
7809 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7810 application.SendNotification();
7811 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
7812 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
7813 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
7814 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
7816 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7817 application.SendNotification();
7818 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
7819 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
7820 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
7821 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
7823 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7824 application.SendNotification();
7825 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
7826 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
7827 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
7828 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
7830 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
7831 application.SendNotification();
7832 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
7833 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
7834 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
7835 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
7837 // We did expect the animation to finish
7839 finishCheck.CheckSignalReceived();
7843 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
7845 TestApplication application;
7847 float startValue(1.0f);
7848 Actor actor = Actor::New();
7849 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
7850 Stage::GetCurrent().Add(actor);
7852 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7853 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7854 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7855 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7856 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7858 // Build the animation
7859 float durationSeconds(1.0f);
7860 Animation animation = Animation::New(durationSeconds);
7862 KeyFrames keyFrames = KeyFrames::New();
7863 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
7864 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
7865 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
7867 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::Cubic );
7869 // Start the animation
7872 bool signalReceived(false);
7873 AnimationFinishCheck finishCheck(signalReceived);
7874 animation.FinishedSignal().Connect(&application, finishCheck);
7875 application.SendNotification();
7876 application.Render(0);
7877 application.SendNotification();
7878 finishCheck.CheckSignalNotReceived();
7879 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
7880 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
7881 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
7882 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
7884 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7885 application.SendNotification();
7886 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION );
7887 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
7888 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION );
7889 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
7891 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7892 application.SendNotification();
7893 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
7894 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
7895 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
7896 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
7898 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7899 application.SendNotification();
7900 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION );
7901 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
7902 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION );
7903 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
7905 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
7906 application.SendNotification();
7907 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
7908 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
7909 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
7910 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
7912 // We did expect the animation to finish
7914 finishCheck.CheckSignalReceived();
7918 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void)
7920 TestApplication application;
7922 float startValue(1.0f);
7923 Actor actor = Actor::New();
7924 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
7925 Stage::GetCurrent().Add(actor);
7927 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7928 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7929 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7930 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7931 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7933 // Build the animation
7934 float durationSeconds(1.0f);
7936 Animation animation = Animation::New(durationSeconds);
7938 KeyFrames keyFrames = KeyFrames::New();
7939 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
7940 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
7941 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
7943 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ) );
7945 // Start the animation
7948 bool signalReceived(false);
7949 AnimationFinishCheck finishCheck(signalReceived);
7950 animation.FinishedSignal().Connect(&application, finishCheck);
7951 application.SendNotification();
7953 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
7954 application.SendNotification();
7955 finishCheck.CheckSignalNotReceived();
7956 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
7957 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
7958 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
7959 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
7961 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
7962 application.SendNotification();
7963 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
7964 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
7965 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
7966 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
7968 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
7969 application.SendNotification();
7970 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
7971 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
7972 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
7973 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
7975 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
7976 application.SendNotification();
7977 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
7978 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
7979 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
7980 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
7982 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
7983 application.SendNotification();
7984 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
7985 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
7986 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
7987 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
7989 // We did expect the animation to finish
7991 finishCheck.CheckSignalReceived();
7995 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
7997 TestApplication application;
7999 float startValue(1.0f);
8000 Actor actor = Actor::New();
8001 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8002 Stage::GetCurrent().Add(actor);
8004 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8005 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8006 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8007 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8008 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8010 // Build the animation
8011 float durationSeconds(1.0f);
8013 Animation animation = Animation::New(durationSeconds);
8015 KeyFrames keyFrames = KeyFrames::New();
8016 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8017 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8018 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8020 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
8022 // Start the animation
8025 bool signalReceived(false);
8026 AnimationFinishCheck finishCheck(signalReceived);
8027 animation.FinishedSignal().Connect(&application, finishCheck);
8028 application.SendNotification();
8030 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
8031 application.SendNotification();
8032 finishCheck.CheckSignalNotReceived();
8033 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8034 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8035 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8036 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8038 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
8039 application.SendNotification();
8040 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION );
8041 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
8042 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION );
8043 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
8045 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
8046 application.SendNotification();
8047 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8048 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8049 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8050 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8052 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
8053 application.SendNotification();
8054 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION );
8055 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
8056 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION );
8057 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
8059 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
8060 application.SendNotification();
8061 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8062 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8063 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8064 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8066 // We did expect the animation to finish
8068 finishCheck.CheckSignalReceived();
8072 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
8074 TestApplication application;
8076 float startValue(1.0f);
8078 Actor actor = Actor::New();
8079 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8080 Stage::GetCurrent().Add(actor);
8082 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8083 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8084 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8085 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8086 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8088 // Build the animation
8089 float durationSeconds(1.0f);
8090 Animation animation = Animation::New(durationSeconds);
8092 KeyFrames keyFrames = KeyFrames::New();
8093 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8094 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8095 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8097 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
8099 // Start the animation
8102 bool signalReceived(false);
8103 AnimationFinishCheck finishCheck(signalReceived);
8104 animation.FinishedSignal().Connect(&application, finishCheck);
8105 application.SendNotification();
8107 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
8108 application.SendNotification();
8109 finishCheck.CheckSignalNotReceived();
8110 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8111 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8112 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8113 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8115 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
8116 application.SendNotification();
8117 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
8118 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
8119 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
8120 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
8122 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
8123 application.SendNotification();
8124 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8125 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8126 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8127 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8129 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
8130 application.SendNotification();
8131 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
8132 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
8133 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
8134 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
8136 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
8137 application.SendNotification();
8138 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8139 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8140 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8141 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8143 // We did expect the animation to finish
8145 finishCheck.CheckSignalReceived();
8151 TestApplication application;
8153 float startValue(1.0f);
8154 Actor actor = Actor::New();
8155 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8156 Stage::GetCurrent().Add(actor);
8158 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8159 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8160 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8161 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8162 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8164 // Build the animation
8165 float durationSeconds(1.0f);
8167 Animation animation = Animation::New(durationSeconds);
8169 KeyFrames keyFrames = KeyFrames::New();
8170 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8171 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8172 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8174 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
8176 // Start the animation
8179 bool signalReceived(false);
8180 AnimationFinishCheck finishCheck(signalReceived);
8181 animation.FinishedSignal().Connect(&application, finishCheck);
8182 application.SendNotification();
8184 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
8185 application.SendNotification();
8186 finishCheck.CheckSignalNotReceived();
8187 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8188 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8189 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8190 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8192 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
8193 application.SendNotification();
8194 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION );
8195 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
8196 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION );
8197 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
8199 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
8200 application.SendNotification();
8201 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8202 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8203 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8204 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8206 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
8207 application.SendNotification();
8208 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION );
8209 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
8210 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION );
8211 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
8213 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
8214 application.SendNotification();
8215 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8216 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8217 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8218 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8220 // We did expect the animation to finish
8222 finishCheck.CheckSignalReceived();
8226 int UtcDaliAnimationAnimateP(void)
8228 TestApplication application;
8230 Actor actor = Actor::New();
8231 Stage::GetCurrent().Add(actor);
8234 Vector3 position0( 30.0, 80.0, 0.0);
8235 Vector3 position1( 70.0, 120.0, 0.0);
8236 Vector3 position2( 100.0, 100.0, 0.0);
8238 Dali::Path path = Dali::Path::New();
8239 path.AddPoint(position0);
8240 path.AddPoint(position1);
8241 path.AddPoint(position2);
8243 //Control points for first segment
8244 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
8245 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
8247 //Control points for second segment
8248 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
8249 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
8251 // Build the animation
8252 float durationSeconds( 1.0f );
8253 Animation animation = Animation::New(durationSeconds);
8254 animation.Animate(actor, path, Vector3::XAXIS);
8256 // Start the animation
8259 bool signalReceived(false);
8260 AnimationFinishCheck finishCheck(signalReceived);
8261 animation.FinishedSignal().Connect(&application, finishCheck);
8262 application.SendNotification();
8263 application.Render(0);
8264 application.SendNotification();
8265 finishCheck.CheckSignalNotReceived();
8266 Vector3 position, tangent;
8267 Quaternion rotation;
8268 path.Sample( 0.0f, position, tangent );
8269 rotation = Quaternion( Vector3::XAXIS, tangent );
8270 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8271 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8273 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8274 application.SendNotification();
8275 path.Sample( 0.25f, position, tangent );
8276 rotation = Quaternion( Vector3::XAXIS, tangent );
8277 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8278 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8280 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8281 application.SendNotification();
8282 path.Sample( 0.5f, position, tangent );
8283 rotation = Quaternion( Vector3::XAXIS, tangent );
8284 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8285 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8287 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8288 application.SendNotification();
8289 path.Sample( 0.75f, position, tangent );
8290 rotation = Quaternion( Vector3::XAXIS, tangent );
8291 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8292 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8294 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8295 application.SendNotification();
8296 path.Sample( 1.0f, position, tangent );
8297 rotation = Quaternion( Vector3::XAXIS, tangent );
8298 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8299 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8301 finishCheck.CheckSignalReceived();
8305 int UtcDaliAnimationAnimateAlphaFunctionP(void)
8307 TestApplication application;
8309 Actor actor = Actor::New();
8310 Stage::GetCurrent().Add(actor);
8313 Vector3 position0( 30.0, 80.0, 0.0);
8314 Vector3 position1( 70.0, 120.0, 0.0);
8315 Vector3 position2( 100.0, 100.0, 0.0);
8317 Dali::Path path = Dali::Path::New();
8318 path.AddPoint(position0);
8319 path.AddPoint(position1);
8320 path.AddPoint(position2);
8322 //Control points for first segment
8323 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
8324 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
8326 //Control points for second segment
8327 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
8328 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
8330 // Build the animation
8331 float durationSeconds( 1.0f );
8332 Animation animation = Animation::New(durationSeconds);
8333 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
8335 // Start the animation
8338 bool signalReceived(false);
8339 AnimationFinishCheck finishCheck(signalReceived);
8340 animation.FinishedSignal().Connect(&application, finishCheck);
8341 application.SendNotification();
8342 application.Render(0);
8343 application.SendNotification();
8344 finishCheck.CheckSignalNotReceived();
8345 Vector3 position, tangent;
8346 Quaternion rotation;
8347 path.Sample( 0.0f, position, tangent );
8348 rotation = Quaternion( Vector3::XAXIS, tangent );
8349 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8350 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8352 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8353 application.SendNotification();
8354 path.Sample( 0.25f, position, tangent );
8355 rotation = Quaternion( Vector3::XAXIS, tangent );
8356 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8357 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8359 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8360 application.SendNotification();
8361 path.Sample( 0.5f, position, tangent );
8362 rotation = Quaternion( Vector3::XAXIS, tangent );
8363 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8364 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8366 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8367 application.SendNotification();
8368 path.Sample( 0.75f, position, tangent );
8369 rotation = Quaternion( Vector3::XAXIS, tangent );
8370 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8371 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8373 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8374 application.SendNotification();
8375 path.Sample( 1.0f, position, tangent );
8376 rotation = Quaternion( Vector3::XAXIS, tangent );
8377 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8378 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8380 finishCheck.CheckSignalReceived();
8384 int UtcDaliAnimationAnimateTimePeriodP(void)
8386 TestApplication application;
8388 Actor actor = Actor::New();
8389 Stage::GetCurrent().Add(actor);
8392 Vector3 position0( 30.0, 80.0, 0.0);
8393 Vector3 position1( 70.0, 120.0, 0.0);
8394 Vector3 position2( 100.0, 100.0, 0.0);
8396 Dali::Path path = Dali::Path::New();
8397 path.AddPoint(position0);
8398 path.AddPoint(position1);
8399 path.AddPoint(position2);
8401 //Control points for first segment
8402 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
8403 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
8405 //Control points for second segment
8406 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
8407 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
8409 // Build the animation
8410 float durationSeconds( 1.0f );
8411 Animation animation = Animation::New(durationSeconds);
8412 animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
8414 // Start the animation
8417 bool signalReceived(false);
8418 AnimationFinishCheck finishCheck(signalReceived);
8419 animation.FinishedSignal().Connect(&application, finishCheck);
8420 application.SendNotification();
8421 application.Render(0);
8422 application.SendNotification();
8423 finishCheck.CheckSignalNotReceived();
8424 Vector3 position, tangent;
8425 Quaternion rotation;
8426 path.Sample( 0.0f, position, tangent );
8427 rotation = Quaternion( Vector3::XAXIS, tangent );
8428 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8429 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8431 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8432 application.SendNotification();
8433 path.Sample( 0.25f, position, tangent );
8434 rotation = Quaternion( Vector3::XAXIS, tangent );
8435 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8436 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8438 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8439 application.SendNotification();
8440 path.Sample( 0.5f, position, tangent );
8441 rotation = Quaternion( Vector3::XAXIS, tangent );
8442 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8443 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8445 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8446 application.SendNotification();
8447 path.Sample( 0.75f, position, tangent );
8448 rotation = Quaternion( Vector3::XAXIS, tangent );
8449 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8450 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8452 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8453 application.SendNotification();
8454 path.Sample( 1.0f, position, tangent );
8455 rotation = Quaternion( Vector3::XAXIS, tangent );
8456 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8457 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8459 finishCheck.CheckSignalReceived();
8463 int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
8465 TestApplication application;
8467 Actor actor = Actor::New();
8468 Stage::GetCurrent().Add(actor);
8471 Vector3 position0( 30.0, 80.0, 0.0);
8472 Vector3 position1( 70.0, 120.0, 0.0);
8473 Vector3 position2( 100.0, 100.0, 0.0);
8475 Dali::Path path = Dali::Path::New();
8476 path.AddPoint(position0);
8477 path.AddPoint(position1);
8478 path.AddPoint(position2);
8480 //Control points for first segment
8481 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
8482 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
8484 //Control points for second segment
8485 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
8486 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
8488 // Build the animation
8489 float durationSeconds( 1.0f );
8490 Animation animation = Animation::New(durationSeconds);
8491 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
8493 // Start the animation
8496 bool signalReceived(false);
8497 AnimationFinishCheck finishCheck(signalReceived);
8498 animation.FinishedSignal().Connect(&application, finishCheck);
8499 application.SendNotification();
8500 application.Render(0);
8501 application.SendNotification();
8502 finishCheck.CheckSignalNotReceived();
8503 Vector3 position, tangent;
8504 Quaternion rotation;
8505 path.Sample( 0.0f, position, tangent );
8506 rotation = Quaternion( Vector3::XAXIS, tangent );
8507 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8508 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8510 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8511 application.SendNotification();
8512 path.Sample( 0.25f, position, tangent );
8513 rotation = Quaternion( Vector3::XAXIS, tangent );
8514 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8515 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8517 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8518 application.SendNotification();
8519 path.Sample( 0.5f, position, tangent );
8520 rotation = Quaternion( Vector3::XAXIS, tangent );
8521 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8522 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8524 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8525 application.SendNotification();
8526 path.Sample( 0.75f, position, tangent );
8527 rotation = Quaternion( Vector3::XAXIS, tangent );
8528 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8529 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8531 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8532 application.SendNotification();
8533 path.Sample( 1.0f, position, tangent );
8534 rotation = Quaternion( Vector3::XAXIS, tangent );
8535 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8536 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8538 finishCheck.CheckSignalReceived();
8542 int UtcDaliAnimationShowP(void)
8544 TestApplication application;
8546 Actor actor = Actor::New();
8547 actor.SetVisible(false);
8548 application.SendNotification();
8549 application.Render(0);
8550 DALI_TEST_CHECK( !actor.IsVisible() );
8551 Stage::GetCurrent().Add(actor);
8553 // Start the animation
8554 float durationSeconds(10.0f);
8555 Animation animation = Animation::New(durationSeconds);
8556 animation.Show(actor, durationSeconds*0.5f);
8559 bool signalReceived(false);
8560 AnimationFinishCheck finishCheck(signalReceived);
8561 animation.FinishedSignal().Connect(&application, finishCheck);
8563 application.SendNotification();
8564 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
8566 // We didn't expect the animation to finish yet
8567 application.SendNotification();
8568 finishCheck.CheckSignalNotReceived();
8569 DALI_TEST_CHECK( !actor.IsVisible() );
8571 application.SendNotification();
8572 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be shown now*/);
8574 // We didn't expect the animation to finish yet
8575 application.SendNotification();
8576 finishCheck.CheckSignalNotReceived();
8577 DALI_TEST_CHECK( actor.IsVisible() );
8579 application.SendNotification();
8580 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8582 // We did expect the animation to finish
8583 application.SendNotification();
8584 finishCheck.CheckSignalReceived();
8585 DALI_TEST_CHECK( actor.IsVisible() );
8589 int UtcDaliAnimationHideP(void)
8591 TestApplication application;
8593 Actor actor = Actor::New();
8594 DALI_TEST_CHECK( actor.IsVisible() );
8595 Stage::GetCurrent().Add(actor);
8597 // Start the animation
8598 float durationSeconds(10.0f);
8599 Animation animation = Animation::New(durationSeconds);
8600 animation.Hide(actor, durationSeconds*0.5f);
8603 bool signalReceived(false);
8604 AnimationFinishCheck finishCheck(signalReceived);
8605 animation.FinishedSignal().Connect(&application, finishCheck);
8607 application.SendNotification();
8608 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
8610 // We didn't expect the animation to finish yet
8611 application.SendNotification();
8612 finishCheck.CheckSignalNotReceived();
8613 DALI_TEST_CHECK( actor.IsVisible() );
8615 application.SendNotification();
8616 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be hidden now*/);
8618 // We didn't expect the animation to finish yet
8619 application.SendNotification();
8620 finishCheck.CheckSignalNotReceived();
8621 DALI_TEST_CHECK( !actor.IsVisible() );
8623 application.SendNotification();
8624 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8626 // We did expect the animation to finish
8627 application.SendNotification();
8628 finishCheck.CheckSignalReceived();
8629 DALI_TEST_CHECK( !actor.IsVisible() );
8633 int UtcDaliAnimationShowHideAtEndP(void)
8635 // Test that show/hide delay can be the same as animation duration
8636 // i.e. to show/hide at the end of the animation
8638 TestApplication application;
8640 Actor actor = Actor::New();
8641 DALI_TEST_CHECK( actor.IsVisible() );
8642 Stage::GetCurrent().Add(actor);
8644 // Start Hide animation
8645 float durationSeconds(10.0f);
8646 Animation animation = Animation::New(durationSeconds);
8647 animation.Hide(actor, durationSeconds/*Hide at end*/);
8650 bool signalReceived(false);
8651 AnimationFinishCheck finishCheck(signalReceived);
8652 animation.FinishedSignal().Connect(&application, finishCheck);
8654 application.SendNotification();
8655 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
8657 // We did expect the animation to finish
8658 application.SendNotification();
8659 finishCheck.CheckSignalReceived();
8660 DALI_TEST_CHECK( !actor.IsVisible() );
8662 // Start Show animation
8663 animation = Animation::New(durationSeconds);
8664 animation.Show(actor, durationSeconds/*Show at end*/);
8665 animation.FinishedSignal().Connect(&application, finishCheck);
8668 application.SendNotification();
8669 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
8671 // We did expect the animation to finish
8672 application.SendNotification();
8673 finishCheck.CheckSignalReceived();
8674 DALI_TEST_CHECK( actor.IsVisible() );
8678 int UtcDaliKeyFramesCreateDestroyP(void)
8680 tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
8682 KeyFrames* keyFrames = new KeyFrames;
8684 DALI_TEST_CHECK( true );
8688 int UtcDaliKeyFramesDownCastP(void)
8690 TestApplication application;
8691 tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
8693 KeyFrames keyFrames = KeyFrames::New();
8694 BaseHandle object(keyFrames);
8696 KeyFrames keyFrames2 = KeyFrames::DownCast(object);
8697 DALI_TEST_CHECK(keyFrames2);
8699 KeyFrames keyFrames3 = DownCast< KeyFrames >(object);
8700 DALI_TEST_CHECK(keyFrames3);
8702 BaseHandle unInitializedObject;
8703 KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
8704 DALI_TEST_CHECK(!keyFrames4);
8706 KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject);
8707 DALI_TEST_CHECK(!keyFrames5);
8711 int UtcDaliAnimationCreateDestroyP(void)
8713 TestApplication application;
8714 Animation* animation = new Animation;
8715 DALI_TEST_CHECK( animation );
8720 struct UpdateManagerTestConstraint
8722 UpdateManagerTestConstraint(TestApplication& application)
8723 : mApplication(application)
8727 void operator()( Vector3& current, const PropertyInputContainer& /* inputs */)
8729 mApplication.SendNotification(); // Process events
8732 TestApplication& mApplication;
8735 int UtcDaliAnimationUpdateManagerP(void)
8737 TestApplication application;
8739 Actor actor = Actor::New();
8740 Stage::GetCurrent().Add( actor );
8742 // Build the animation
8743 Animation animation = Animation::New( 0.0f );
8745 bool signalReceived = false;
8746 AnimationFinishCheck finishCheck( signalReceived );
8747 animation.FinishedSignal().Connect( &application, finishCheck );
8749 Vector3 startValue(1.0f, 1.0f, 1.0f);
8750 Property::Index index = actor.RegisterProperty( "test-property", startValue );
8751 Constraint constraint = Constraint::New<Vector3>( actor, index, UpdateManagerTestConstraint( application ) );
8754 // Apply animation to actor
8755 animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunction::LINEAR );
8759 application.SendNotification();
8760 application.UpdateOnly( 16 );
8762 finishCheck.CheckSignalNotReceived();
8764 application.SendNotification(); // Process events
8766 finishCheck.CheckSignalReceived();
8771 int UtcDaliAnimationSignalOrderP(void)
8773 TestApplication application;
8775 Actor actor = Actor::New();
8776 Stage::GetCurrent().Add( actor );
8778 // Build the animations
8779 Animation animation1 = Animation::New( 0.0f ); // finishes first frame
8780 Animation animation2 = Animation::New( 0.02f ); // finishes in 20 ms
8782 bool signal1Received = false;
8783 animation1.FinishedSignal().Connect( &application, AnimationFinishCheck( signal1Received ) );
8785 bool signal2Received = false;
8786 animation2.FinishedSignal().Connect( &application, AnimationFinishCheck( signal2Received ) );
8788 // Apply animations to actor
8789 animation1.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 3.0f, 2.0f, 1.0f ), AlphaFunction::LINEAR );
8791 animation2.AnimateTo( Property(actor, Actor::Property::SIZE ), Vector3( 10.0f, 20.0f, 30.0f ), AlphaFunction::LINEAR );
8794 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
8795 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
8797 application.SendNotification();
8798 application.UpdateOnly( 10 ); // 10ms progress
8800 // no notifications yet
8801 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
8802 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
8804 application.SendNotification();
8807 DALI_TEST_EQUALS( signal1Received, true, TEST_LOCATION );
8808 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
8809 signal1Received = false;
8811 // 1st animation is complete now, do another update with no ProcessEvents in between
8812 application.UpdateOnly( 20 ); // 20ms progress
8815 application.SendNotification();
8817 // 2nd should complete now
8818 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
8819 DALI_TEST_EQUALS( signal2Received, true, TEST_LOCATION );
8824 int UtcDaliAnimationExtendDurationP(void)
8826 TestApplication application;
8828 Actor actor = Actor::New();
8830 // Register a float property
8831 float startValue(10.0f);
8832 Property::Index index = actor.RegisterProperty( "test-property", startValue );
8833 Stage::GetCurrent().Add(actor);
8834 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
8836 // Build the animation
8837 float initialDurationSeconds(1.0f);
8838 float animatorDelay = 5.0f;
8839 float animatorDurationSeconds(5.0f);
8840 float extendedDurationSeconds(animatorDelay+animatorDurationSeconds);
8841 Animation animation = Animation::New(initialDurationSeconds);
8842 float targetValue(30.0f);
8843 float relativeValue(targetValue - startValue);
8845 animation.AnimateTo(Property(actor, index),
8847 TimePeriod(animatorDelay, animatorDurationSeconds));
8849 // The duration should have been extended
8850 DALI_TEST_EQUALS( animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION );
8852 // Start the animation
8855 bool signalReceived(false);
8856 AnimationFinishCheck finishCheck(signalReceived);
8857 animation.FinishedSignal().Connect(&application, finishCheck);
8859 application.SendNotification();
8860 application.Render(static_cast<unsigned int>(extendedDurationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
8862 // We didn't expect the animation to finish yet
8863 application.SendNotification();
8864 finishCheck.CheckSignalNotReceived();
8865 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
8867 application.SendNotification();
8868 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
8870 // We didn't expect the animation to finish yet
8871 application.SendNotification();
8872 finishCheck.CheckSignalNotReceived();
8873 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
8875 application.SendNotification();
8876 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8878 // We did expect the animation to finish
8879 application.SendNotification();
8880 finishCheck.CheckSignalReceived();
8881 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
8885 int UtcDaliAnimationCustomUnsignedIntProperty(void)
8887 TestApplication application;
8889 Actor actor = Actor::New();
8890 Stage::GetCurrent().Add(actor);
8891 unsigned int startValue(0u);
8893 Property::Index index = actor.RegisterProperty("an-index", startValue);
8894 DALI_TEST_EQUALS( actor.GetProperty<unsigned int>(index), startValue, TEST_LOCATION );
8896 // Build the animation
8897 float durationSeconds(1.0f);
8898 Animation animation = Animation::New(durationSeconds);
8899 animation.AnimateTo( Property(actor, index), 20u );
8901 // Start the animation
8904 bool signalReceived(false);
8905 AnimationFinishCheck finishCheck(signalReceived);
8906 animation.FinishedSignal().Connect(&application, finishCheck);
8908 application.SendNotification();
8909 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8911 // We didn't expect the animation to finish yet
8912 application.SendNotification();
8913 finishCheck.CheckSignalNotReceived();
8914 DALI_TEST_EQUALS( actor.GetProperty<unsigned int>(index), 10u, TEST_LOCATION );
8916 application.SendNotification();
8917 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8919 // We did expect the animation to finish
8920 application.SendNotification();
8921 finishCheck.CheckSignalReceived();
8922 DALI_TEST_EQUALS( actor.GetProperty<unsigned int>(index), 20u, TEST_LOCATION );