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 UtcDaliAnimationSetDuratioN(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, AlphaFunctions::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 UtcDaliAnimationGetDuratioN(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, AlphaFunctions::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, AlphaFunctions::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 UtcDaliAnimationGetEndActioN(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 UtcDaliAnimationSetDisconnectActioN(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, AlphaFunctions::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, AlphaFunctions::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, AlphaFunctions::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, AlphaFunctions::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 UtcDaliAnimationGetDisconnectActioN(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 UtcDaliAnimationSetDefaultAlphaFunctioN(void)
585 TestApplication application;
587 Animation animation = Animation::New(1.0f);
588 AlphaFunction func = animation.GetDefaultAlphaFunction();
589 DALI_TEST_EQUALS(func(0.1f), AlphaFunctions::Linear(0.1f), TEST_LOCATION);
591 animation.SetDefaultAlphaFunction(AlphaFunctions::EaseIn);
592 AlphaFunction func2 = animation.GetDefaultAlphaFunction();
593 DALI_TEST_CHECK(func2(0.1f) < AlphaFunctions::Linear(0.1f)); // less progress when easing-in
597 int UtcDaliAnimationGetDefaultAlphaFunctioN(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(0.1f), AlphaFunctions::Linear(0.1f), TEST_LOCATION);
607 animation.SetDefaultAlphaFunction(AlphaFunctions::EaseIn);
608 AlphaFunction func2 = animation.GetDefaultAlphaFunction();
609 DALI_TEST_CHECK(func2(0.1f) < AlphaFunctions::Linear(0.1f)); // less progress when easing-in
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, AlphaFunctions::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, AlphaFunctions::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, AlphaFunctions::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, AlphaFunctions::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, AlphaFunctions::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, AlphaFunctions::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, AlphaFunctions::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, AlphaFunctions::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, AlphaFunctions::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, AlphaFunctions::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, AlphaFunctions::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, AlphaFunctions::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, AlphaFunctions::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 UtcDaliAnimationStopSetPositioN(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, AlphaFunctions::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, AlphaFunctions::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, AlphaFunctions::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 UtcDaliAnimationAnimateByBooleaN(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 UtcDaliAnimationAnimateByBooleanAlphaFunctioN(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, AlphaFunctions::EaseIn);
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, AlphaFunctions::EaseIn);
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 AlphaFunctions::EaseInOut,
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 UtcDaliAnimationAnimateByFloatAlphaFunctioN(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, AlphaFunctions::EaseOut);
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 AlphaFunctions::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 UtcDaliAnimationAnimateByIntegerAlphaFunctioN(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, AlphaFunctions::EaseOut);
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 AlphaFunctions::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 UtcDaliAnimationAnimateByVector2AlphaFunctioN(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, AlphaFunctions::EaseOut);
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 AlphaFunctions::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 UtcDaliAnimationAnimateByVector3AlphaFunctioN(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, AlphaFunctions::EaseOut);
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 AlphaFunctions::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 UtcDaliAnimationAnimateByVector4AlphaFunctioN(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, AlphaFunctions::EaseOut);
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 AlphaFunctions::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 UtcDaliAnimationAnimateByActorPositioN(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 UtcDaliAnimationAnimateByActorPositionAlphaFunctioN(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, AlphaFunctions::EaseOut);
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 AlphaFunctions::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 UtcDaliAnimationAnimateByActorOrientatioN(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 UtcDaliAnimationAnimateByActorOrientationAlphaFunctioN(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 ), AlphaFunctions::EaseIn );
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 * AlphaFunctions::EaseIn(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 * AlphaFunctions::EaseIn(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 * AlphaFunctions::EaseIn(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 AlphaFunctions::EaseIn, 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 * AlphaFunctions::EaseIn(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 * AlphaFunctions::EaseIn(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 * AlphaFunctions::EaseIn(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, AlphaFunctions::EaseIn );
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, AlphaFunctions::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 UtcDaliAnimationAnimateToBooleaN(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 UtcDaliAnimationAnimateToBooleanAlphaFunctioN(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, AlphaFunctions::EaseOut);
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, AlphaFunctions::EaseOut);
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 AlphaFunctions::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 UtcDaliAnimationAnimateToFloatAlphaFunctioN(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, AlphaFunctions::EaseOut);
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 AlphaFunctions::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 UtcDaliAnimationAnimateToIntegerAlphaFunctioN(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, AlphaFunctions::EaseOut);
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 AlphaFunctions::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 UtcDaliAnimationAnimateToVector2AlphaFunctioN(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, AlphaFunctions::EaseOut);
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 AlphaFunctions::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 UtcDaliAnimationAnimateToVector3AlphaFunctioN(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, AlphaFunctions::EaseOut);
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 AlphaFunctions::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 AlphaFunctions::Linear,
4875 TimePeriod(delay, durationSeconds - delay));
4876 animation.AnimateTo(Property(actor, index, 1),
4878 AlphaFunctions::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 UtcDaliAnimationAnimateToVector4AlphaFunctioN(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, AlphaFunctions::EaseOut);
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 AlphaFunctions::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 UtcDaliAnimationAnimateToActorParentOrigiN(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, AlphaFunctions::EaseIn);
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, AlphaFunctions::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, AlphaFunctions::EaseIn );
5627 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunctions::EaseIn );
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, AlphaFunctions::Linear, TimePeriod( delay, durationSeconds - delay ) );
5665 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunctions::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 UtcDaliAnimationAnimateToActorPositioN(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 UtcDaliAnimationAnimateToActorPositionAlphaFunctioN(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, AlphaFunctions::EaseIn);
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 AlphaFunctions::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 UtcDaliAnimationAnimateToActorOrientationQuaternioN(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 UtcDaliAnimationAnimateToActorOrientationAlphaFunctioN(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), AlphaFunctions::EaseIn);
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 * AlphaFunctions::EaseIn(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 * AlphaFunctions::EaseIn(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 * AlphaFunctions::EaseIn(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), AlphaFunctions::EaseIn, 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 * AlphaFunctions::EaseIn(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 * AlphaFunctions::EaseIn(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 * AlphaFunctions::EaseIn(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, AlphaFunctions::EaseIn);
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, AlphaFunctions::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, AlphaFunctions::EaseIn);
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, AlphaFunctions::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 UtcDaliAnimationAnimateToActorColorGreeN(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);
6932 keyFrames.Add(0.2f, 0.5f);
6933 keyFrames.Add(0.4f, 0.0f);
6934 keyFrames.Add(0.6f, 1.0f);
6935 keyFrames.Add(0.8f, 0.7f);
6936 keyFrames.Add(1.0f, 0.9f);
6938 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
6942 keyFrames.Add(1.9f, false);
6944 catch (Dali::DaliException& e)
6946 DALI_TEST_PRINT_ASSERT( e );
6947 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
6952 int UtcDaliAnimationKeyFrames02P(void)
6954 TestApplication application;
6956 KeyFrames keyFrames = KeyFrames::New();
6957 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
6959 keyFrames.Add(0.0f, true);
6960 keyFrames.Add(0.2f, false);
6961 keyFrames.Add(0.4f, false);
6962 keyFrames.Add(0.6f, true);
6963 keyFrames.Add(0.8f, true);
6964 keyFrames.Add(1.0f, false);
6966 DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
6970 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
6972 catch (Dali::DaliException& e)
6974 DALI_TEST_PRINT_ASSERT( e );
6975 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
6980 int UtcDaliAnimationKeyFrames03P(void)
6982 TestApplication application;
6984 KeyFrames keyFrames = KeyFrames::New();
6985 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
6987 keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
6988 keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
6989 keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
6990 keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
6991 keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
6992 keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
6994 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
6998 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
7000 catch (Dali::DaliException& e)
7002 DALI_TEST_PRINT_ASSERT( e );
7003 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
7008 int UtcDaliAnimationKeyFrames04P(void)
7010 TestApplication application;
7012 KeyFrames keyFrames = KeyFrames::New();
7013 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7015 keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
7016 keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
7017 keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
7018 keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
7019 keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
7020 keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
7022 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
7026 keyFrames.Add(0.7f, 1.0f);
7028 catch (Dali::DaliException& e)
7030 DALI_TEST_PRINT_ASSERT( e );
7031 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
7036 int UtcDaliAnimationKeyFrames05P(void)
7038 TestApplication application;
7040 KeyFrames keyFrames = KeyFrames::New();
7041 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7043 keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
7044 keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
7045 keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
7046 keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
7047 keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
7048 keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
7050 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
7054 keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
7056 catch (Dali::DaliException& e)
7058 DALI_TEST_PRINT_ASSERT( e );
7059 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
7064 int UtcDaliAnimationKeyFrames06P(void)
7066 TestApplication application;
7068 KeyFrames keyFrames = KeyFrames::New();
7069 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7071 keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
7072 keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
7073 keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
7074 keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
7075 keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
7076 keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
7078 DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
7082 keyFrames.Add(0.7f, 1.1f);
7084 catch (Dali::DaliException& e)
7086 DALI_TEST_PRINT_ASSERT( e );
7087 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
7092 int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
7094 TestApplication application;
7096 float startValue(1.0f);
7097 Actor actor = Actor::New();
7098 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
7099 Stage::GetCurrent().Add(actor);
7101 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7102 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7103 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7104 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7105 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7107 // Build the animation
7108 float durationSeconds(1.0f);
7109 Animation animation = Animation::New(durationSeconds);
7111 KeyFrames keyFrames = KeyFrames::New();
7112 keyFrames.Add(0.0f, 0.1f);
7113 keyFrames.Add(0.2f, 0.5f);
7114 keyFrames.Add(0.4f, 0.0f);
7115 keyFrames.Add(0.6f, 1.0f);
7116 keyFrames.Add(0.8f, 0.7f);
7117 keyFrames.Add(1.0f, 0.9f);
7119 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames );
7121 // Start the animation
7124 bool signalReceived(false);
7125 AnimationFinishCheck finishCheck(signalReceived);
7126 animation.FinishedSignal().Connect(&application, finishCheck);
7127 application.SendNotification();
7128 application.Render(0);
7129 application.SendNotification();
7130 finishCheck.CheckSignalNotReceived();
7131 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
7133 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7134 application.SendNotification();
7135 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7136 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7137 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7138 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION );
7139 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.3f, 0.01f, TEST_LOCATION );
7141 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
7142 application.SendNotification();
7143 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7144 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7145 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7146 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION );
7147 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.25f, 0.01f, TEST_LOCATION );
7149 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
7150 application.SendNotification();
7151 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7152 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7153 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7154 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
7155 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
7157 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
7158 application.SendNotification();
7159 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7160 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7161 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7162 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
7163 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
7165 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
7166 application.SendNotification();
7167 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7168 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7169 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7170 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION );
7171 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.8f, 0.01f, TEST_LOCATION );
7173 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
7174 application.SendNotification();
7175 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7176 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7177 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7178 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
7179 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
7181 // We did expect the animation to finish
7183 finishCheck.CheckSignalReceived();
7187 int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
7189 TestApplication application;
7191 float startValue(1.0f);
7192 Actor actor = Actor::New();
7193 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
7194 Stage::GetCurrent().Add(actor);
7196 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7197 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7198 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7199 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7200 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7202 // Build the animation
7203 float durationSeconds(1.0f);
7204 Animation animation = Animation::New(durationSeconds);
7206 KeyFrames keyFrames = KeyFrames::New();
7207 keyFrames.Add(0.0f, 0.1f);
7208 keyFrames.Add(0.2f, 0.5f);
7209 keyFrames.Add(0.4f, 0.0f);
7210 keyFrames.Add(0.6f, 1.0f);
7211 keyFrames.Add(0.8f, 0.7f);
7212 keyFrames.Add(1.0f, 0.9f);
7214 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::Cubic );
7216 // Start the animation
7219 bool signalReceived(false);
7220 AnimationFinishCheck finishCheck(signalReceived);
7221 animation.FinishedSignal().Connect(&application, finishCheck);
7222 application.SendNotification();
7223 application.Render(0);
7224 application.SendNotification();
7225 finishCheck.CheckSignalNotReceived();
7226 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
7228 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7229 application.SendNotification();
7230 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7231 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7232 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7233 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.36f, 0.01f, TEST_LOCATION );
7234 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.36f, 0.01f, TEST_LOCATION );
7236 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
7237 application.SendNotification();
7238 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7239 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7240 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7241 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.21f, 0.01f, TEST_LOCATION );
7242 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.21f, 0.01f, TEST_LOCATION );
7244 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
7245 application.SendNotification();
7246 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7247 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7248 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7249 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
7250 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
7252 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
7253 application.SendNotification();
7254 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7255 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7256 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7257 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
7258 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
7260 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
7261 application.SendNotification();
7262 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7263 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7264 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7265 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.76f, 0.01f, TEST_LOCATION );
7266 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.76f, 0.01f, TEST_LOCATION );
7268 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
7269 application.SendNotification();
7270 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7271 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7272 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7273 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
7274 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
7276 // We did expect the animation to finish
7278 finishCheck.CheckSignalReceived();
7282 int UtcDaliAnimationAnimateBetweenActorColorP(void)
7284 TestApplication application;
7286 float startValue(1.0f);
7287 Actor actor = Actor::New();
7288 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
7289 Stage::GetCurrent().Add(actor);
7291 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7292 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7293 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7294 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7295 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7297 // Build the animation
7298 float durationSeconds(1.0f);
7299 Animation animation = Animation::New(durationSeconds);
7301 KeyFrames keyFrames = KeyFrames::New();
7302 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
7303 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
7304 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
7306 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames );
7308 // Start the animation
7311 bool signalReceived(false);
7312 AnimationFinishCheck finishCheck(signalReceived);
7313 animation.FinishedSignal().Connect(&application, finishCheck);
7314 application.SendNotification();
7315 application.Render(0);
7316 application.SendNotification();
7317 finishCheck.CheckSignalNotReceived();
7318 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
7319 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
7320 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
7321 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
7323 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7324 application.SendNotification();
7325 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
7326 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
7327 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
7328 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
7330 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7331 application.SendNotification();
7332 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
7333 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
7334 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
7335 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
7337 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7338 application.SendNotification();
7339 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
7340 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
7341 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
7342 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
7344 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
7345 application.SendNotification();
7346 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
7347 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
7348 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
7349 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
7351 // We did expect the animation to finish
7353 finishCheck.CheckSignalReceived();
7357 int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
7359 TestApplication application;
7361 float startValue(1.0f);
7362 Actor actor = Actor::New();
7363 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
7364 Stage::GetCurrent().Add(actor);
7366 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7367 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7368 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7369 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7370 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7372 // Build the animation
7373 float durationSeconds(1.0f);
7374 Animation animation = Animation::New(durationSeconds);
7376 KeyFrames keyFrames = KeyFrames::New();
7377 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
7378 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
7379 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
7381 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, Animation::Cubic );
7383 // Start the animation
7386 bool signalReceived(false);
7387 AnimationFinishCheck finishCheck(signalReceived);
7388 animation.FinishedSignal().Connect(&application, finishCheck);
7389 application.SendNotification();
7390 application.Render(0);
7391 application.SendNotification();
7392 finishCheck.CheckSignalNotReceived();
7393 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
7394 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
7395 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
7396 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
7398 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7399 application.SendNotification();
7400 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION );
7401 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
7402 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION );
7403 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
7405 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7406 application.SendNotification();
7407 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
7408 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
7409 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
7410 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
7412 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7413 application.SendNotification();
7414 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION );
7415 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
7416 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION );
7417 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
7419 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
7420 application.SendNotification();
7421 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
7422 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
7423 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
7424 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
7426 // We did expect the animation to finish
7428 finishCheck.CheckSignalReceived();
7432 int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
7434 TestApplication application;
7436 Actor actor = Actor::New();
7437 AngleAxis aa(Degree(90), Vector3::XAXIS);
7438 actor.SetOrientation(aa.angle, aa.axis);
7439 Stage::GetCurrent().Add(actor);
7441 application.SendNotification();
7442 application.Render(0);
7444 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
7446 // Build the animation
7447 float durationSeconds(1.0f);
7448 Animation animation = Animation::New(durationSeconds);
7450 KeyFrames keyFrames = KeyFrames::New();
7451 keyFrames.Add(0.0f, false);
7452 keyFrames.Add(0.2f, true);
7453 keyFrames.Add(0.4f, true);
7454 keyFrames.Add(0.8f, false);
7455 keyFrames.Add(1.0f, true);
7457 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames );
7459 // Start the animation
7462 bool signalReceived(false);
7463 AnimationFinishCheck finishCheck(signalReceived);
7464 animation.FinishedSignal().Connect(&application, finishCheck);
7465 application.SendNotification();
7466 application.SendNotification();
7467 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
7468 application.SendNotification();
7469 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
7470 application.SendNotification();
7472 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
7473 finishCheck.CheckSignalReceived();
7477 int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
7479 TestApplication application;
7481 Actor actor = Actor::New();
7482 AngleAxis aa(Degree(90), Vector3::XAXIS);
7483 actor.SetOrientation(aa.angle, aa.axis);
7484 Stage::GetCurrent().Add(actor);
7486 application.SendNotification();
7487 application.Render(0);
7489 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
7491 // Build the animation
7492 float durationSeconds(1.0f);
7493 Animation animation = Animation::New(durationSeconds);
7495 KeyFrames keyFrames = KeyFrames::New();
7496 keyFrames.Add(0.0f, false);
7497 keyFrames.Add(0.2f, true);
7498 keyFrames.Add(0.4f, true);
7499 keyFrames.Add(0.8f, false);
7500 keyFrames.Add(1.0f, true);
7502 //Cubic interpolation for boolean values should be ignored
7503 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::Cubic );
7505 // Start the animation
7508 bool signalReceived(false);
7509 AnimationFinishCheck finishCheck(signalReceived);
7510 animation.FinishedSignal().Connect(&application, finishCheck);
7511 application.SendNotification();
7512 application.SendNotification();
7513 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
7514 application.SendNotification();
7515 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
7516 application.SendNotification();
7518 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
7519 finishCheck.CheckSignalReceived();
7523 int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
7525 TestApplication application;
7527 Actor actor = Actor::New();
7528 AngleAxis aa(Degree(90), Vector3::XAXIS);
7529 actor.SetOrientation(aa.angle, aa.axis);
7530 Stage::GetCurrent().Add(actor);
7532 application.SendNotification();
7533 application.Render(0);
7534 Quaternion start(Radian(aa.angle), aa.axis);
7535 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
7537 // Build the animation
7538 float durationSeconds(1.0f);
7539 Animation animation = Animation::New(durationSeconds);
7541 KeyFrames keyFrames = KeyFrames::New();
7542 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
7544 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
7546 // Start the animation
7549 bool signalReceived(false);
7550 AnimationFinishCheck finishCheck(signalReceived);
7551 animation.FinishedSignal().Connect(&application, finishCheck);
7552 application.SendNotification();
7553 application.SendNotification();
7554 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
7555 application.SendNotification();
7556 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
7557 application.SendNotification();
7559 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
7561 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
7562 finishCheck.CheckSignalReceived();
7566 int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
7568 TestApplication application;
7570 Actor actor = Actor::New();
7571 AngleAxis aa(Degree(90), Vector3::XAXIS);
7572 actor.SetOrientation(aa.angle, aa.axis);
7573 application.SendNotification();
7574 application.Render(0);
7575 Stage::GetCurrent().Add(actor);
7577 Quaternion start(Radian(aa.angle), aa.axis);
7578 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
7580 // Build the animation
7581 float durationSeconds(1.0f);
7582 Animation animation = Animation::New(durationSeconds);
7584 KeyFrames keyFrames = KeyFrames::New();
7585 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
7586 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
7587 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
7589 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
7591 // Start the animation
7594 bool signalReceived(false);
7595 AnimationFinishCheck finishCheck(signalReceived);
7596 animation.FinishedSignal().Connect(&application, finishCheck);
7597 application.SendNotification();
7598 application.Render(0);
7599 application.SendNotification();
7600 finishCheck.CheckSignalNotReceived();
7602 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
7603 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
7605 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7606 application.SendNotification();
7607 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
7608 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
7610 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7611 application.SendNotification();
7612 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
7613 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
7615 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7616 application.SendNotification();
7617 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f) );
7618 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
7620 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
7621 application.SendNotification();
7622 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
7623 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
7625 // We did expect the animation to finish
7627 finishCheck.CheckSignalReceived();
7631 int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
7633 TestApplication application;
7635 Actor actor = Actor::New();
7636 AngleAxis aa(Degree(90), Vector3::XAXIS);
7637 actor.SetOrientation(aa.angle, aa.axis);
7638 Stage::GetCurrent().Add(actor);
7640 application.SendNotification();
7641 application.Render(0);
7642 Quaternion start(Radian(aa.angle), aa.axis);
7643 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
7645 // Build the animation
7646 float durationSeconds(1.0f);
7647 Animation animation = Animation::New(durationSeconds);
7649 KeyFrames keyFrames = KeyFrames::New();
7650 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
7652 //Cubic interpolation should be ignored for quaternions
7653 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
7655 // Start the animation
7658 bool signalReceived(false);
7659 AnimationFinishCheck finishCheck(signalReceived);
7660 animation.FinishedSignal().Connect(&application, finishCheck);
7661 application.SendNotification();
7662 application.SendNotification();
7663 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
7664 application.SendNotification();
7665 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
7666 application.SendNotification();
7668 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
7670 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
7671 finishCheck.CheckSignalReceived();
7675 int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
7677 TestApplication application;
7679 Actor actor = Actor::New();
7680 AngleAxis aa(Degree(90), Vector3::XAXIS);
7681 actor.SetOrientation(aa.angle, aa.axis);
7682 application.SendNotification();
7683 application.Render(0);
7684 Stage::GetCurrent().Add(actor);
7686 Quaternion start(Radian(aa.angle), aa.axis);
7687 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
7689 // Build the animation
7690 float durationSeconds(1.0f);
7691 Animation animation = Animation::New(durationSeconds);
7693 KeyFrames keyFrames = KeyFrames::New();
7694 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
7695 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
7696 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
7698 //Cubic interpolation should be ignored for quaternions
7699 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
7701 // Start the animation
7704 bool signalReceived(false);
7705 AnimationFinishCheck finishCheck(signalReceived);
7706 animation.FinishedSignal().Connect(&application, finishCheck);
7707 application.SendNotification();
7708 application.Render(0);
7709 application.SendNotification();
7710 finishCheck.CheckSignalNotReceived();
7712 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
7713 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
7715 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7716 application.SendNotification();
7717 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
7718 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
7720 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7721 application.SendNotification();
7722 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
7723 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
7725 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7726 application.SendNotification();
7727 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f ) );
7728 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
7730 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
7731 application.SendNotification();
7732 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
7733 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
7735 // We did expect the animation to finish
7737 finishCheck.CheckSignalReceived();
7741 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctioN(void)
7743 TestApplication application;
7745 float startValue(1.0f);
7746 Actor actor = Actor::New();
7747 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
7748 Stage::GetCurrent().Add(actor);
7750 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7751 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7752 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7753 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7754 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7756 // Build the animation
7757 float durationSeconds(1.0f);
7758 Animation animation = Animation::New(durationSeconds);
7760 KeyFrames keyFrames = KeyFrames::New();
7761 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
7762 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
7763 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
7765 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunctions::Linear );
7767 // Start the animation
7770 bool signalReceived(false);
7771 AnimationFinishCheck finishCheck(signalReceived);
7772 animation.FinishedSignal().Connect(&application, finishCheck);
7773 application.SendNotification();
7774 application.Render(0);
7775 application.SendNotification();
7776 finishCheck.CheckSignalNotReceived();
7777 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
7778 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
7779 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
7780 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
7782 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7783 application.SendNotification();
7784 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
7785 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
7786 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
7787 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
7789 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7790 application.SendNotification();
7791 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
7792 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
7793 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
7794 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
7796 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7797 application.SendNotification();
7798 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
7799 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
7800 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
7801 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
7803 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
7804 application.SendNotification();
7805 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
7806 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
7807 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
7808 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
7810 // We did expect the animation to finish
7812 finishCheck.CheckSignalReceived();
7816 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
7818 TestApplication application;
7820 float startValue(1.0f);
7821 Actor actor = Actor::New();
7822 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
7823 Stage::GetCurrent().Add(actor);
7825 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7826 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7827 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7828 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7829 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7831 // Build the animation
7832 float durationSeconds(1.0f);
7833 Animation animation = Animation::New(durationSeconds);
7835 KeyFrames keyFrames = KeyFrames::New();
7836 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
7837 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
7838 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
7840 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunctions::Linear, Animation::Cubic );
7842 // Start the animation
7845 bool signalReceived(false);
7846 AnimationFinishCheck finishCheck(signalReceived);
7847 animation.FinishedSignal().Connect(&application, finishCheck);
7848 application.SendNotification();
7849 application.Render(0);
7850 application.SendNotification();
7851 finishCheck.CheckSignalNotReceived();
7852 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
7853 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
7854 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
7855 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
7857 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7858 application.SendNotification();
7859 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION );
7860 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
7861 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION );
7862 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
7864 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7865 application.SendNotification();
7866 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
7867 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
7868 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
7869 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
7871 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7872 application.SendNotification();
7873 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION );
7874 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
7875 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION );
7876 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
7878 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
7879 application.SendNotification();
7880 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
7881 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
7882 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
7883 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
7885 // We did expect the animation to finish
7887 finishCheck.CheckSignalReceived();
7891 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void)
7893 TestApplication application;
7895 float startValue(1.0f);
7896 Actor actor = Actor::New();
7897 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
7898 Stage::GetCurrent().Add(actor);
7900 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7901 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7902 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7903 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7904 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7906 // Build the animation
7907 float durationSeconds(1.0f);
7909 Animation animation = Animation::New(durationSeconds);
7911 KeyFrames keyFrames = KeyFrames::New();
7912 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
7913 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
7914 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
7916 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ) );
7918 // Start the animation
7921 bool signalReceived(false);
7922 AnimationFinishCheck finishCheck(signalReceived);
7923 animation.FinishedSignal().Connect(&application, finishCheck);
7924 application.SendNotification();
7926 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
7927 application.SendNotification();
7928 finishCheck.CheckSignalNotReceived();
7929 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
7930 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
7931 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
7932 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
7934 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
7935 application.SendNotification();
7936 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
7937 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
7938 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
7939 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
7941 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
7942 application.SendNotification();
7943 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
7944 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
7945 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
7946 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
7948 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
7949 application.SendNotification();
7950 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
7951 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
7952 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
7953 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
7955 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
7956 application.SendNotification();
7957 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
7958 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
7959 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
7960 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
7962 // We did expect the animation to finish
7964 finishCheck.CheckSignalReceived();
7968 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
7970 TestApplication application;
7972 float startValue(1.0f);
7973 Actor actor = Actor::New();
7974 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
7975 Stage::GetCurrent().Add(actor);
7977 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7978 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7979 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7980 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7981 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7983 // Build the animation
7984 float durationSeconds(1.0f);
7986 Animation animation = Animation::New(durationSeconds);
7988 KeyFrames keyFrames = KeyFrames::New();
7989 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
7990 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
7991 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
7993 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
7995 // Start the animation
7998 bool signalReceived(false);
7999 AnimationFinishCheck finishCheck(signalReceived);
8000 animation.FinishedSignal().Connect(&application, finishCheck);
8001 application.SendNotification();
8003 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
8004 application.SendNotification();
8005 finishCheck.CheckSignalNotReceived();
8006 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8007 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8008 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8009 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8011 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
8012 application.SendNotification();
8013 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION );
8014 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
8015 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION );
8016 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
8018 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
8019 application.SendNotification();
8020 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8021 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8022 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8023 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8025 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
8026 application.SendNotification();
8027 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION );
8028 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
8029 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION );
8030 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
8032 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
8033 application.SendNotification();
8034 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8035 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8036 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8037 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8039 // We did expect the animation to finish
8041 finishCheck.CheckSignalReceived();
8045 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
8047 TestApplication application;
8049 float startValue(1.0f);
8051 Actor actor = Actor::New();
8052 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8053 Stage::GetCurrent().Add(actor);
8055 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8056 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8057 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8058 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8059 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8061 // Build the animation
8062 float durationSeconds(1.0f);
8063 Animation animation = Animation::New(durationSeconds);
8065 KeyFrames keyFrames = KeyFrames::New();
8066 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8067 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8068 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8070 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunctions::Linear, TimePeriod( delay, durationSeconds - delay ) );
8072 // Start the animation
8075 bool signalReceived(false);
8076 AnimationFinishCheck finishCheck(signalReceived);
8077 animation.FinishedSignal().Connect(&application, finishCheck);
8078 application.SendNotification();
8080 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
8081 application.SendNotification();
8082 finishCheck.CheckSignalNotReceived();
8083 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8084 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8085 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8086 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8088 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
8089 application.SendNotification();
8090 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
8091 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
8092 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
8093 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
8095 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
8096 application.SendNotification();
8097 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8098 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8099 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8100 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8102 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
8103 application.SendNotification();
8104 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
8105 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
8106 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
8107 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
8109 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
8110 application.SendNotification();
8111 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8112 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8113 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8114 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8116 // We did expect the animation to finish
8118 finishCheck.CheckSignalReceived();
8124 TestApplication application;
8126 float startValue(1.0f);
8127 Actor actor = Actor::New();
8128 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8129 Stage::GetCurrent().Add(actor);
8131 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8132 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8133 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8134 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8135 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8137 // Build the animation
8138 float durationSeconds(1.0f);
8140 Animation animation = Animation::New(durationSeconds);
8142 KeyFrames keyFrames = KeyFrames::New();
8143 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8144 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8145 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8147 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunctions::Linear, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
8149 // Start the animation
8152 bool signalReceived(false);
8153 AnimationFinishCheck finishCheck(signalReceived);
8154 animation.FinishedSignal().Connect(&application, finishCheck);
8155 application.SendNotification();
8157 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
8158 application.SendNotification();
8159 finishCheck.CheckSignalNotReceived();
8160 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8161 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8162 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8163 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8165 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
8166 application.SendNotification();
8167 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION );
8168 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
8169 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION );
8170 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
8172 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
8173 application.SendNotification();
8174 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8175 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8176 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8177 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8179 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
8180 application.SendNotification();
8181 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION );
8182 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
8183 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION );
8184 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
8186 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
8187 application.SendNotification();
8188 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8189 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8190 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8191 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8193 // We did expect the animation to finish
8195 finishCheck.CheckSignalReceived();
8199 int UtcDaliAnimationAnimateP(void)
8201 TestApplication application;
8203 Actor actor = Actor::New();
8204 Stage::GetCurrent().Add(actor);
8207 Vector3 position0( 30.0, 80.0, 0.0);
8208 Vector3 position1( 70.0, 120.0, 0.0);
8209 Vector3 position2( 100.0, 100.0, 0.0);
8211 Dali::Path path = Dali::Path::New();
8212 path.AddPoint(position0);
8213 path.AddPoint(position1);
8214 path.AddPoint(position2);
8216 //Control points for first segment
8217 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
8218 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
8220 //Control points for second segment
8221 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
8222 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
8224 // Build the animation
8225 float durationSeconds( 1.0f );
8226 Animation animation = Animation::New(durationSeconds);
8227 animation.Animate(actor, path, Vector3::XAXIS);
8229 // Start the animation
8232 bool signalReceived(false);
8233 AnimationFinishCheck finishCheck(signalReceived);
8234 animation.FinishedSignal().Connect(&application, finishCheck);
8235 application.SendNotification();
8236 application.Render(0);
8237 application.SendNotification();
8238 finishCheck.CheckSignalNotReceived();
8239 Vector3 position, tangent;
8240 Quaternion rotation;
8241 path.Sample( 0.0f, position, tangent );
8242 rotation = Quaternion( Vector3::XAXIS, tangent );
8243 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8244 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8246 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8247 application.SendNotification();
8248 path.Sample( 0.25f, position, tangent );
8249 rotation = Quaternion( Vector3::XAXIS, tangent );
8250 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8251 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8253 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8254 application.SendNotification();
8255 path.Sample( 0.5f, position, tangent );
8256 rotation = Quaternion( Vector3::XAXIS, tangent );
8257 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8258 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8260 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8261 application.SendNotification();
8262 path.Sample( 0.75f, position, tangent );
8263 rotation = Quaternion( Vector3::XAXIS, tangent );
8264 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8265 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8267 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8268 application.SendNotification();
8269 path.Sample( 1.0f, position, tangent );
8270 rotation = Quaternion( Vector3::XAXIS, tangent );
8271 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8272 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8274 finishCheck.CheckSignalReceived();
8278 int UtcDaliAnimationAnimateAlphaFunctioN(void)
8280 TestApplication application;
8282 Actor actor = Actor::New();
8283 Stage::GetCurrent().Add(actor);
8286 Vector3 position0( 30.0, 80.0, 0.0);
8287 Vector3 position1( 70.0, 120.0, 0.0);
8288 Vector3 position2( 100.0, 100.0, 0.0);
8290 Dali::Path path = Dali::Path::New();
8291 path.AddPoint(position0);
8292 path.AddPoint(position1);
8293 path.AddPoint(position2);
8295 //Control points for first segment
8296 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
8297 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
8299 //Control points for second segment
8300 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
8301 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
8303 // Build the animation
8304 float durationSeconds( 1.0f );
8305 Animation animation = Animation::New(durationSeconds);
8306 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunctions::Linear);
8308 // Start the animation
8311 bool signalReceived(false);
8312 AnimationFinishCheck finishCheck(signalReceived);
8313 animation.FinishedSignal().Connect(&application, finishCheck);
8314 application.SendNotification();
8315 application.Render(0);
8316 application.SendNotification();
8317 finishCheck.CheckSignalNotReceived();
8318 Vector3 position, tangent;
8319 Quaternion rotation;
8320 path.Sample( 0.0f, position, tangent );
8321 rotation = Quaternion( Vector3::XAXIS, tangent );
8322 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8323 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8325 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8326 application.SendNotification();
8327 path.Sample( 0.25f, position, tangent );
8328 rotation = Quaternion( Vector3::XAXIS, tangent );
8329 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8330 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8332 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8333 application.SendNotification();
8334 path.Sample( 0.5f, position, tangent );
8335 rotation = Quaternion( Vector3::XAXIS, tangent );
8336 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8337 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8339 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8340 application.SendNotification();
8341 path.Sample( 0.75f, position, tangent );
8342 rotation = Quaternion( Vector3::XAXIS, tangent );
8343 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8344 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8346 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8347 application.SendNotification();
8348 path.Sample( 1.0f, position, tangent );
8349 rotation = Quaternion( Vector3::XAXIS, tangent );
8350 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8351 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8353 finishCheck.CheckSignalReceived();
8357 int UtcDaliAnimationAnimateTimePeriodP(void)
8359 TestApplication application;
8361 Actor actor = Actor::New();
8362 Stage::GetCurrent().Add(actor);
8365 Vector3 position0( 30.0, 80.0, 0.0);
8366 Vector3 position1( 70.0, 120.0, 0.0);
8367 Vector3 position2( 100.0, 100.0, 0.0);
8369 Dali::Path path = Dali::Path::New();
8370 path.AddPoint(position0);
8371 path.AddPoint(position1);
8372 path.AddPoint(position2);
8374 //Control points for first segment
8375 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
8376 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
8378 //Control points for second segment
8379 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
8380 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
8382 // Build the animation
8383 float durationSeconds( 1.0f );
8384 Animation animation = Animation::New(durationSeconds);
8385 animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
8387 // Start the animation
8390 bool signalReceived(false);
8391 AnimationFinishCheck finishCheck(signalReceived);
8392 animation.FinishedSignal().Connect(&application, finishCheck);
8393 application.SendNotification();
8394 application.Render(0);
8395 application.SendNotification();
8396 finishCheck.CheckSignalNotReceived();
8397 Vector3 position, tangent;
8398 Quaternion rotation;
8399 path.Sample( 0.0f, position, tangent );
8400 rotation = Quaternion( Vector3::XAXIS, tangent );
8401 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8402 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8404 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8405 application.SendNotification();
8406 path.Sample( 0.25f, position, tangent );
8407 rotation = Quaternion( Vector3::XAXIS, tangent );
8408 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8409 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8411 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8412 application.SendNotification();
8413 path.Sample( 0.5f, position, tangent );
8414 rotation = Quaternion( Vector3::XAXIS, tangent );
8415 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8416 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8418 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8419 application.SendNotification();
8420 path.Sample( 0.75f, position, tangent );
8421 rotation = Quaternion( Vector3::XAXIS, tangent );
8422 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8423 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8425 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8426 application.SendNotification();
8427 path.Sample( 1.0f, position, tangent );
8428 rotation = Quaternion( Vector3::XAXIS, tangent );
8429 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8430 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8432 finishCheck.CheckSignalReceived();
8436 int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
8438 TestApplication application;
8440 Actor actor = Actor::New();
8441 Stage::GetCurrent().Add(actor);
8444 Vector3 position0( 30.0, 80.0, 0.0);
8445 Vector3 position1( 70.0, 120.0, 0.0);
8446 Vector3 position2( 100.0, 100.0, 0.0);
8448 Dali::Path path = Dali::Path::New();
8449 path.AddPoint(position0);
8450 path.AddPoint(position1);
8451 path.AddPoint(position2);
8453 //Control points for first segment
8454 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
8455 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
8457 //Control points for second segment
8458 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
8459 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
8461 // Build the animation
8462 float durationSeconds( 1.0f );
8463 Animation animation = Animation::New(durationSeconds);
8464 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunctions::Linear, TimePeriod(0.0f, 1.0f));
8466 // Start the animation
8469 bool signalReceived(false);
8470 AnimationFinishCheck finishCheck(signalReceived);
8471 animation.FinishedSignal().Connect(&application, finishCheck);
8472 application.SendNotification();
8473 application.Render(0);
8474 application.SendNotification();
8475 finishCheck.CheckSignalNotReceived();
8476 Vector3 position, tangent;
8477 Quaternion rotation;
8478 path.Sample( 0.0f, position, tangent );
8479 rotation = Quaternion( Vector3::XAXIS, tangent );
8480 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8481 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8483 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8484 application.SendNotification();
8485 path.Sample( 0.25f, position, tangent );
8486 rotation = Quaternion( Vector3::XAXIS, tangent );
8487 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8488 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8490 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8491 application.SendNotification();
8492 path.Sample( 0.5f, position, tangent );
8493 rotation = Quaternion( Vector3::XAXIS, tangent );
8494 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8495 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8497 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8498 application.SendNotification();
8499 path.Sample( 0.75f, position, tangent );
8500 rotation = Quaternion( Vector3::XAXIS, tangent );
8501 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8502 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8504 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8505 application.SendNotification();
8506 path.Sample( 1.0f, position, tangent );
8507 rotation = Quaternion( Vector3::XAXIS, tangent );
8508 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8509 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8511 finishCheck.CheckSignalReceived();
8515 int UtcDaliAnimationShowP(void)
8517 TestApplication application;
8519 Actor actor = Actor::New();
8520 actor.SetVisible(false);
8521 application.SendNotification();
8522 application.Render(0);
8523 DALI_TEST_CHECK( !actor.IsVisible() );
8524 Stage::GetCurrent().Add(actor);
8526 // Start the animation
8527 float durationSeconds(10.0f);
8528 Animation animation = Animation::New(durationSeconds);
8529 animation.Show(actor, durationSeconds*0.5f);
8532 bool signalReceived(false);
8533 AnimationFinishCheck finishCheck(signalReceived);
8534 animation.FinishedSignal().Connect(&application, finishCheck);
8536 application.SendNotification();
8537 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
8539 // We didn't expect the animation to finish yet
8540 application.SendNotification();
8541 finishCheck.CheckSignalNotReceived();
8542 DALI_TEST_CHECK( !actor.IsVisible() );
8544 application.SendNotification();
8545 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be shown now*/);
8547 // We didn't expect the animation to finish yet
8548 application.SendNotification();
8549 finishCheck.CheckSignalNotReceived();
8550 DALI_TEST_CHECK( actor.IsVisible() );
8552 application.SendNotification();
8553 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8555 // We did expect the animation to finish
8556 application.SendNotification();
8557 finishCheck.CheckSignalReceived();
8558 DALI_TEST_CHECK( actor.IsVisible() );
8562 int UtcDaliAnimationHideP(void)
8564 TestApplication application;
8566 Actor actor = Actor::New();
8567 DALI_TEST_CHECK( actor.IsVisible() );
8568 Stage::GetCurrent().Add(actor);
8570 // Start the animation
8571 float durationSeconds(10.0f);
8572 Animation animation = Animation::New(durationSeconds);
8573 animation.Hide(actor, durationSeconds*0.5f);
8576 bool signalReceived(false);
8577 AnimationFinishCheck finishCheck(signalReceived);
8578 animation.FinishedSignal().Connect(&application, finishCheck);
8580 application.SendNotification();
8581 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
8583 // We didn't expect the animation to finish yet
8584 application.SendNotification();
8585 finishCheck.CheckSignalNotReceived();
8586 DALI_TEST_CHECK( actor.IsVisible() );
8588 application.SendNotification();
8589 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be hidden now*/);
8591 // We didn't expect the animation to finish yet
8592 application.SendNotification();
8593 finishCheck.CheckSignalNotReceived();
8594 DALI_TEST_CHECK( !actor.IsVisible() );
8596 application.SendNotification();
8597 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8599 // We did expect the animation to finish
8600 application.SendNotification();
8601 finishCheck.CheckSignalReceived();
8602 DALI_TEST_CHECK( !actor.IsVisible() );
8606 int UtcDaliAnimationShowHideAtEndP(void)
8608 // Test that show/hide delay can be the same as animation duration
8609 // i.e. to show/hide at the end of the animation
8611 TestApplication application;
8613 Actor actor = Actor::New();
8614 DALI_TEST_CHECK( actor.IsVisible() );
8615 Stage::GetCurrent().Add(actor);
8617 // Start Hide animation
8618 float durationSeconds(10.0f);
8619 Animation animation = Animation::New(durationSeconds);
8620 animation.Hide(actor, durationSeconds/*Hide at end*/);
8623 bool signalReceived(false);
8624 AnimationFinishCheck finishCheck(signalReceived);
8625 animation.FinishedSignal().Connect(&application, finishCheck);
8627 application.SendNotification();
8628 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
8630 // We did expect the animation to finish
8631 application.SendNotification();
8632 finishCheck.CheckSignalReceived();
8633 DALI_TEST_CHECK( !actor.IsVisible() );
8635 // Start Show animation
8636 animation = Animation::New(durationSeconds);
8637 animation.Show(actor, durationSeconds/*Show at end*/);
8638 animation.FinishedSignal().Connect(&application, finishCheck);
8641 application.SendNotification();
8642 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
8644 // We did expect the animation to finish
8645 application.SendNotification();
8646 finishCheck.CheckSignalReceived();
8647 DALI_TEST_CHECK( actor.IsVisible() );
8651 int UtcDaliKeyFramesCreateDestroyP(void)
8653 tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
8655 KeyFrames* keyFrames = new KeyFrames;
8657 DALI_TEST_CHECK( true );
8661 int UtcDaliKeyFramesDownCastP(void)
8663 TestApplication application;
8664 tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
8666 KeyFrames keyFrames = KeyFrames::New();
8667 BaseHandle object(keyFrames);
8669 KeyFrames keyFrames2 = KeyFrames::DownCast(object);
8670 DALI_TEST_CHECK(keyFrames2);
8672 KeyFrames keyFrames3 = DownCast< KeyFrames >(object);
8673 DALI_TEST_CHECK(keyFrames3);
8675 BaseHandle unInitializedObject;
8676 KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
8677 DALI_TEST_CHECK(!keyFrames4);
8679 KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject);
8680 DALI_TEST_CHECK(!keyFrames5);
8684 int UtcDaliAnimationCreateDestroyP(void)
8686 TestApplication application;
8687 Animation* animation = new Animation;
8688 DALI_TEST_CHECK( animation );
8693 struct UpdateManagerTestConstraint
8695 UpdateManagerTestConstraint(TestApplication& application)
8696 : mApplication(application)
8700 void operator()( Vector3& current, const PropertyInputContainer& /* inputs */)
8702 mApplication.SendNotification(); // Process events
8705 TestApplication& mApplication;
8708 int UtcDaliAnimationUpdateManagerP(void)
8710 TestApplication application;
8712 Actor actor = Actor::New();
8713 Stage::GetCurrent().Add( actor );
8715 // Build the animation
8716 Animation animation = Animation::New( 0.0f );
8718 bool signalReceived = false;
8719 AnimationFinishCheck finishCheck( signalReceived );
8720 animation.FinishedSignal().Connect( &application, finishCheck );
8722 Vector3 startValue(1.0f, 1.0f, 1.0f);
8723 Property::Index index = actor.RegisterProperty( "test-property", startValue );
8724 Constraint constraint = Constraint::New<Vector3>( actor, index, UpdateManagerTestConstraint( application ) );
8727 // Apply animation to actor
8728 animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunctions::Linear );
8732 application.SendNotification();
8733 application.UpdateOnly( 16 );
8735 finishCheck.CheckSignalNotReceived();
8737 application.SendNotification(); // Process events
8739 finishCheck.CheckSignalReceived();
8744 int UtcDaliAnimationSignalOrderP(void)
8746 TestApplication application;
8748 Actor actor = Actor::New();
8749 Stage::GetCurrent().Add( actor );
8751 // Build the animations
8752 Animation animation1 = Animation::New( 0.0f ); // finishes first frame
8753 Animation animation2 = Animation::New( 0.02f ); // finishes in 20 ms
8755 bool signal1Received = false;
8756 animation1.FinishedSignal().Connect( &application, AnimationFinishCheck( signal1Received ) );
8758 bool signal2Received = false;
8759 animation2.FinishedSignal().Connect( &application, AnimationFinishCheck( signal2Received ) );
8761 // Apply animations to actor
8762 animation1.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 3.0f, 2.0f, 1.0f ), AlphaFunctions::Linear );
8764 animation2.AnimateTo( Property(actor, Actor::Property::SIZE ), Vector3( 10.0f, 20.0f, 30.0f ), AlphaFunctions::Linear );
8767 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
8768 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
8770 application.SendNotification();
8771 application.UpdateOnly( 10 ); // 10ms progress
8773 // no notifications yet
8774 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
8775 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
8777 application.SendNotification();
8780 DALI_TEST_EQUALS( signal1Received, true, TEST_LOCATION );
8781 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
8782 signal1Received = false;
8784 // 1st animation is complete now, do another update with no ProcessEvents in between
8785 application.UpdateOnly( 20 ); // 20ms progress
8788 application.SendNotification();
8790 // 2nd should complete now
8791 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
8792 DALI_TEST_EQUALS( signal2Received, true, TEST_LOCATION );
8797 int UtcDaliAnimationExtendDuratioN(void)
8799 TestApplication application;
8801 Actor actor = Actor::New();
8803 // Register a float property
8804 float startValue(10.0f);
8805 Property::Index index = actor.RegisterProperty( "test-property", startValue );
8806 Stage::GetCurrent().Add(actor);
8807 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
8809 // Build the animation
8810 float initialDurationSeconds(1.0f);
8811 float animatorDelay = 5.0f;
8812 float animatorDurationSeconds(5.0f);
8813 float extendedDurationSeconds(animatorDelay+animatorDurationSeconds);
8814 Animation animation = Animation::New(initialDurationSeconds);
8815 float targetValue(30.0f);
8816 float relativeValue(targetValue - startValue);
8818 animation.AnimateTo(Property(actor, index),
8820 TimePeriod(animatorDelay, animatorDurationSeconds));
8822 // The duration should have been extended
8823 DALI_TEST_EQUALS( animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION );
8825 // Start the animation
8828 bool signalReceived(false);
8829 AnimationFinishCheck finishCheck(signalReceived);
8830 animation.FinishedSignal().Connect(&application, finishCheck);
8832 application.SendNotification();
8833 application.Render(static_cast<unsigned int>(extendedDurationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
8835 // We didn't expect the animation to finish yet
8836 application.SendNotification();
8837 finishCheck.CheckSignalNotReceived();
8838 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
8840 application.SendNotification();
8841 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
8843 // We didn't expect the animation to finish yet
8844 application.SendNotification();
8845 finishCheck.CheckSignalNotReceived();
8846 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
8848 application.SendNotification();
8849 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8851 // We did expect the animation to finish
8852 application.SendNotification();
8853 finishCheck.CheckSignalReceived();
8854 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
8858 int UtcDaliAnimationCustomUnsignedIntProperty(void)
8860 TestApplication application;
8862 Actor actor = Actor::New();
8863 Stage::GetCurrent().Add(actor);
8864 unsigned int startValue(0u);
8866 Property::Index index = actor.RegisterProperty("an-index", startValue);
8867 DALI_TEST_EQUALS( actor.GetProperty<unsigned int>(index), startValue, TEST_LOCATION );
8869 // Build the animation
8870 float durationSeconds(1.0f);
8871 Animation animation = Animation::New(durationSeconds);
8872 animation.AnimateTo( Property(actor, index), 20u );
8874 // Start the animation
8877 bool signalReceived(false);
8878 AnimationFinishCheck finishCheck(signalReceived);
8879 animation.FinishedSignal().Connect(&application, finishCheck);
8881 application.SendNotification();
8882 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8884 // We didn't expect the animation to finish yet
8885 application.SendNotification();
8886 finishCheck.CheckSignalNotReceived();
8887 DALI_TEST_EQUALS( actor.GetProperty<unsigned int>(index), 10u, TEST_LOCATION );
8889 application.SendNotification();
8890 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8892 // We did expect the animation to finish
8893 application.SendNotification();
8894 finishCheck.CheckSignalReceived();
8895 DALI_TEST_EQUALS( actor.GetProperty<unsigned int>(index), 20u, TEST_LOCATION );