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 UtcDaliAnimationNew01(void)
95 TestApplication application;
98 DALI_TEST_CHECK(!animation);
100 animation = Animation::New(1.0f);
102 DALI_TEST_CHECK(animation);
106 int UtcDaliAnimationNew02(void)
108 TestApplication application;
111 DALI_TEST_CHECK(!animation);
114 animation = Animation::New(0.0f);
116 catch (Dali::DaliException& e)
118 // TODO: Determine why catch doesn't.
121 // Tests that a negative test of an assertion succeeds
122 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
123 DALI_TEST_EQUALS(e.mCondition, "durationSeconds > 0.0f", TEST_LOCATION);
128 int UtcDaliAnimationDownCast(void)
130 TestApplication application;
131 tet_infoline("Testing Dali::Animation::DownCast()");
133 float durationSeconds(1.0f);
134 Animation animation = Animation::New(durationSeconds);
136 BaseHandle object(animation);
138 Animation animation2 = Animation::DownCast(object);
139 DALI_TEST_CHECK(animation2);
141 Animation animation3 = DownCast< Animation >(object);
142 DALI_TEST_CHECK(animation3);
144 BaseHandle unInitializedObject;
145 Animation animation4 = Animation::DownCast(unInitializedObject);
146 DALI_TEST_CHECK(!animation4);
148 Animation animation5 = DownCast< Animation >(unInitializedObject);
149 DALI_TEST_CHECK(!animation5);
153 int UtcDaliAnimationSetDuration(void)
155 TestApplication application;
157 Actor actor = Actor::New();
158 Stage::GetCurrent().Add(actor);
160 // Build the animation
161 float durationSeconds(1.0f);
162 Animation animation = Animation::New(durationSeconds);
163 DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
165 // Start the animation
166 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
167 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
170 bool signalReceived(false);
171 AnimationFinishCheck finishCheck(signalReceived);
172 animation.FinishedSignal().Connect(&application, finishCheck);
174 application.SendNotification();
175 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
177 // We didn't expect the animation to finish yet
178 application.SendNotification();
179 finishCheck.CheckSignalNotReceived();
181 application.Render(2u/*just beyond the animation duration*/);
183 // We did expect the animation to finish
184 application.SendNotification();
185 finishCheck.CheckSignalReceived();
186 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
188 // Restart the animation, with a different duration
190 actor.SetPosition(Vector3::ZERO);
191 durationSeconds = 3.5f;
192 animation.SetDuration(durationSeconds);
193 DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
196 application.SendNotification();
197 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
199 // We didn't expect the animation to finish yet
200 application.SendNotification();
201 finishCheck.CheckSignalNotReceived();
203 application.Render(2u/*just beyond the animation duration*/);
205 // We did expect the animation to finish
206 application.SendNotification();
207 finishCheck.CheckSignalReceived();
208 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
210 // Check that nothing has changed after a couple of buffer swaps
211 application.Render(0);
212 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
213 application.Render(0);
214 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
218 int UtcDaliAnimationGetDuration(void)
220 TestApplication application;
222 Animation animation = Animation::New(1.0f);
223 DALI_TEST_EQUALS(animation.GetDuration(), 1.0f, TEST_LOCATION);
225 animation.SetDuration(2.0f);
226 DALI_TEST_EQUALS(animation.GetDuration(), 2.0f, TEST_LOCATION);
230 int UtcDaliAnimationSetLooping(void)
232 TestApplication application;
234 Actor actor = Actor::New();
235 Stage::GetCurrent().Add(actor);
237 // Build the animation
238 float durationSeconds(1.0f);
239 Animation animation = Animation::New(durationSeconds);
240 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
241 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
243 // Start the animation
244 animation.SetLooping(true);
245 DALI_TEST_CHECK(animation.IsLooping());
248 bool signalReceived(false);
249 AnimationFinishCheck finishCheck(signalReceived);
250 animation.FinishedSignal().Connect(&application, finishCheck);
252 application.SendNotification();
255 float intervalSeconds = 0.25f;
256 float progress = 0.0f;
257 for (int iterations = 0; iterations < 5;)
259 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
261 progress += intervalSeconds;
262 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
264 if (progress >= 1.0f)
266 progress = progress - 1.0f;
271 // We didn't expect the animation to finish yet
272 application.SendNotification();
273 finishCheck.CheckSignalNotReceived();
275 animation.SetLooping(false);
276 DALI_TEST_CHECK(!animation.IsLooping());
278 application.SendNotification();
279 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
281 // We did expect the animation to finish
282 application.SendNotification();
283 finishCheck.CheckSignalReceived();
284 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
286 // Check that nothing has changed after a couple of buffer swaps
287 application.Render(0);
288 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
289 application.Render(0);
290 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
294 int UtcDaliAnimationIsLooping(void)
296 TestApplication application;
298 Animation animation = Animation::New(1.0f);
299 DALI_TEST_CHECK(!animation.IsLooping());
301 animation.SetLooping(true);
302 DALI_TEST_CHECK(animation.IsLooping());
306 int UtcDaliAnimationSetEndAction(void)
308 TestApplication application;
310 Actor actor = Actor::New();
311 Stage::GetCurrent().Add(actor);
313 // Build the animation
314 float durationSeconds(1.0f);
315 Animation animation = Animation::New(durationSeconds);
316 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
318 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
319 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
321 // Start the animation
324 bool signalReceived(false);
325 AnimationFinishCheck finishCheck(signalReceived);
326 animation.FinishedSignal().Connect(&application, finishCheck);
328 application.SendNotification();
329 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
331 // We did expect the animation to finish
332 application.SendNotification();
333 finishCheck.CheckSignalReceived();
334 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
336 // Go back to the start
337 actor.SetPosition(Vector3::ZERO);
338 application.SendNotification();
339 application.Render(0);
340 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
342 // Test BakeFinal, animate again, for half the duration
344 animation.SetEndAction(Animation::BakeFinal);
345 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
348 application.SendNotification();
349 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f*0.5f) /*half of the animation duration*/);
351 // Stop the animation early
354 // We did NOT expect the animation to finish
355 application.SendNotification();
356 finishCheck.CheckSignalNotReceived();
357 DALI_TEST_EQUALS( targetPosition * 0.5f, actor.GetCurrentPosition(), VECTOR4_EPSILON, TEST_LOCATION );
359 // Go back to the start
360 actor.SetPosition(Vector3::ZERO);
361 application.SendNotification();
362 application.Render(0);
363 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
365 // Test EndAction::Discard, animate again, but don't bake this time
367 animation.SetEndAction(Animation::Discard);
368 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
371 application.SendNotification();
372 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
374 // We did expect the animation to finish
375 application.SendNotification();
376 finishCheck.CheckSignalReceived();
377 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
379 // The position should be discarded in the next frame
380 application.Render(0);
381 DALI_TEST_EQUALS( Vector3::ZERO/*discarded*/, actor.GetCurrentPosition(), TEST_LOCATION );
383 // Check that nothing has changed after a couple of buffer swaps
384 application.Render(0);
385 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
386 application.Render(0);
387 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
391 int UtcDaliAnimationGetEndAction(void)
393 TestApplication application;
395 Animation animation = Animation::New(1.0f);
396 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
398 animation.SetEndAction(Animation::Discard);
399 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
401 animation.SetEndAction(Animation::BakeFinal);
402 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
407 int UtcDaliAnimationSetDisconnectAction(void)
409 TestApplication application;
410 Stage stage( Stage::GetCurrent() );
412 // Default: BakeFinal
414 Actor actor = Actor::New();
417 // Build the animation
418 float durationSeconds(1.0f);
419 Animation animation = Animation::New(durationSeconds);
420 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal);
422 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
423 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
425 // Start the animation
428 application.SendNotification();
429 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
433 application.SendNotification();
434 application.Render();
436 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
441 Actor actor = Actor::New();
444 // Build the animation
445 float durationSeconds(1.0f);
446 Animation animation = Animation::New(durationSeconds);
447 animation.SetDisconnectAction( Animation::Bake );
449 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
450 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
452 // Start the animation
455 application.SendNotification();
456 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
460 application.SendNotification();
461 application.Render();
463 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition*0.5f, TEST_LOCATION );
468 Actor actor = Actor::New();
471 // Build the animation
472 float durationSeconds(1.0f);
473 Animation animation = Animation::New(durationSeconds);
474 animation.SetDisconnectAction( Animation::Discard );
476 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
477 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
479 // Start the animation
482 application.SendNotification();
483 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
487 application.SendNotification();
488 application.Render();
490 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
493 // Don't play the animation: disconnect action should not be applied
495 Actor actor = Actor::New();
498 // Build the animation
499 float durationSeconds(1.0f);
500 Animation animation = Animation::New(durationSeconds);
502 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
503 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
505 application.SendNotification();
506 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
510 application.SendNotification();
511 application.Render();
513 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
519 int UtcDaliAnimationGetDisconnectAction(void)
521 TestApplication application;
522 Animation animation = Animation::New(1.0f);
523 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal); // default!
525 animation.SetDisconnectAction(Animation::Discard);
526 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Discard);
528 animation.SetDisconnectAction(Animation::Bake);
529 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Bake);
534 int UtcDaliAnimationSetDefaultAlphaFunction(void)
536 TestApplication application;
538 Animation animation = Animation::New(1.0f);
539 AlphaFunction func = animation.GetDefaultAlphaFunction();
540 DALI_TEST_EQUALS(func(0.1f), AlphaFunctions::Linear(0.1f), TEST_LOCATION);
542 animation.SetDefaultAlphaFunction(AlphaFunctions::EaseIn);
543 AlphaFunction func2 = animation.GetDefaultAlphaFunction();
544 DALI_TEST_CHECK(func2(0.1f) < AlphaFunctions::Linear(0.1f)); // less progress when easing-in
548 int UtcDaliAnimationGetDefaultAlphaFunction(void)
550 TestApplication application;
552 Animation animation = Animation::New(1.0f);
553 AlphaFunction func = animation.GetDefaultAlphaFunction();
555 // Test that the default is linear
556 DALI_TEST_EQUALS(func(0.1f), AlphaFunctions::Linear(0.1f), TEST_LOCATION);
560 int UtcDaliAnimationPlay(void)
562 TestApplication application;
564 Actor actor = Actor::New();
565 Stage::GetCurrent().Add(actor);
567 // Build the animation
568 float durationSeconds(1.0f);
569 Animation animation = Animation::New(durationSeconds);
570 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
571 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
573 // Start the animation
576 bool signalReceived(false);
577 AnimationFinishCheck finishCheck(signalReceived);
578 animation.FinishedSignal().Connect(&application, finishCheck);
580 application.SendNotification();
581 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
583 // We didn't expect the animation to finish yet
584 application.SendNotification();
585 finishCheck.CheckSignalNotReceived();
586 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
588 animation.Play(); // Test that calling play has no effect, when animation is already playing
589 application.SendNotification();
590 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
592 // We didn't expect the animation to finish yet
593 application.SendNotification();
594 finishCheck.CheckSignalNotReceived();
595 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
597 animation.Play(); // Test that calling play has no effect, when animation is already playing
598 application.SendNotification();
599 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
601 // We didn't expect the animation to finish yet
602 application.SendNotification();
603 finishCheck.CheckSignalNotReceived();
604 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
606 animation.Play(); // Test that calling play has no effect, when animation is already playing
607 application.SendNotification();
608 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
610 // We didn't expect the animation to finish yet
611 application.SendNotification();
612 finishCheck.CheckSignalNotReceived();
613 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
615 animation.Play(); // Test that calling play has no effect, when animation is already playing
616 application.SendNotification();
617 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
619 // We did expect the animation to finish
620 application.SendNotification();
621 finishCheck.CheckSignalReceived();
622 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
624 // Check that nothing has changed after a couple of buffer swaps
625 application.Render(0);
626 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
627 application.Render(0);
628 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
632 int UtcDaliAnimationSetSpeedFactor(void)
634 TestApplication application;
636 Actor actor = Actor::New();
637 Stage::GetCurrent().Add(actor);
639 // Build the animation
640 float durationSeconds(1.0f);
641 Animation animation = Animation::New(durationSeconds);
643 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
644 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
646 KeyFrames keyframes = KeyFrames::New();
647 keyframes.Add( 0.0f, initialPosition);
648 keyframes.Add( 1.0f, targetPosition );
649 animation.AnimateBetween( Property(actor, Actor::POSITION), keyframes, AlphaFunctions::Linear);
652 animation.SetSpeedFactor(2.0f);
654 // Start the animation
657 bool signalReceived(false);
658 AnimationFinishCheck finishCheck(signalReceived);
659 animation.FinishedSignal().Connect(&application, finishCheck);
661 application.SendNotification();
662 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
664 // We didn't expect the animation to finish yet
665 application.SendNotification();
666 finishCheck.CheckSignalNotReceived();
667 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
669 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
671 // We didn't expect the animation to finish yet
672 application.SendNotification();
673 finishCheck.CheckSignalNotReceived();
674 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
676 application.Render(static_cast<unsigned int>(durationSeconds*100.0f) + 1u/*just beyond half the duration*/);
678 // We did expect the animation to finish
679 application.SendNotification();
680 finishCheck.CheckSignalReceived();
681 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
683 // Check that nothing has changed after a couple of buffer swaps
684 application.Render(0);
685 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
686 application.Render(0);
687 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
691 //Test -1 speed factor. Animation will play in reverse at normal speed
692 animation.SetSpeedFactor( -1.0f );
694 // Start the animation
697 application.SendNotification();
698 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
700 // We didn't expect the animation to finish yet
701 application.SendNotification();
702 finishCheck.CheckSignalNotReceived();
703 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
705 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
707 // We didn't expect the animation to finish yet
708 application.SendNotification();
709 finishCheck.CheckSignalNotReceived();
710 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
712 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
714 // We didn't expect the animation to finish yet
715 application.SendNotification();
716 finishCheck.CheckSignalNotReceived();
717 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
719 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
721 // We didn't expect the animation to finish yet
722 application.SendNotification();
723 finishCheck.CheckSignalNotReceived();
724 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
726 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
728 // We did expect the animation to finish
729 application.SendNotification();
730 finishCheck.CheckSignalReceived();
731 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
733 // Check that nothing has changed after a couple of buffer swaps
734 application.Render(0);
735 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
736 application.Render(0);
737 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
740 //Test change speed factor on the fly
743 //Set speed to be half of normal speed
744 animation.SetSpeedFactor( 0.5f );
746 // Start the animation
749 application.SendNotification();
750 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
752 // We didn't expect the animation to finish yet
753 application.SendNotification();
754 finishCheck.CheckSignalNotReceived();
755 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), TEST_LOCATION );
757 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
759 // We didn't expect the animation to finish yet
760 application.SendNotification();
761 finishCheck.CheckSignalNotReceived();
762 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
764 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
766 // We didn't expect the animation to finish yet
767 application.SendNotification();
768 finishCheck.CheckSignalNotReceived();
769 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.3f), TEST_LOCATION );
771 //Change speed factor while animation still playing.
772 animation.SetSpeedFactor(-1.0f);
773 application.SendNotification();
774 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
776 // We didn't expect the animation to finish yet
777 application.SendNotification();
778 finishCheck.CheckSignalNotReceived();
779 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), TEST_LOCATION );
781 application.Render(static_cast<unsigned int>(durationSeconds*100.0f) + 1u/*just beyond the animation duration*/);
783 // We did expect the animation to finish
784 application.SendNotification();
785 finishCheck.CheckSignalReceived();
786 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
788 // Check that nothing has changed after a couple of buffer swaps
789 application.Render(0);
790 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
791 application.Render(0);
792 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
796 int UtcDaliAnimationGetSpeedFactor(void)
798 TestApplication application;
800 Animation animation = Animation::New(1.0f);
801 animation.SetSpeedFactor(0.5f);
802 DALI_TEST_EQUALS(animation.GetSpeedFactor(), 0.5f, TEST_LOCATION);
804 animation.SetSpeedFactor(-2.5f);
805 DALI_TEST_EQUALS(animation.GetSpeedFactor(), -2.5f, TEST_LOCATION);
809 int UtcDaliAnimationPlayOffStage(void)
811 // Test that an animation can be played, when the actor is off-stage.
812 // When the actor is added to the stage, it should appear at the current position
813 // i.e. where it would have been anyway, if on-stage from the beginning.
815 TestApplication application;
817 Actor actor = Actor::New();
818 Vector3 basePosition(Vector3::ZERO);
819 DALI_TEST_EQUALS( actor.GetCurrentPosition(), basePosition, TEST_LOCATION );
820 // Not added to the stage!
822 // Build the animation
823 float durationSeconds(1.0f);
824 Animation animation = Animation::New(durationSeconds);
825 animation.SetDisconnectAction( Animation::Discard );
826 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
827 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
829 // Start the animation
832 bool signalReceived(false);
833 AnimationFinishCheck finishCheck(signalReceived);
834 animation.FinishedSignal().Connect(&application, finishCheck);
836 application.SendNotification();
837 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
839 // We didn't expect the animation to finish yet
840 application.SendNotification();
841 finishCheck.CheckSignalNotReceived();
842 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*off-stage*/, TEST_LOCATION );
845 Stage::GetCurrent().Add(actor);
847 application.SendNotification();
848 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
850 // We didn't expect the animation to finish yet
851 application.SendNotification();
852 finishCheck.CheckSignalNotReceived();
853 Vector3 expectedPosition(basePosition + (targetPosition - basePosition)*0.4f);
854 DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition/*on-stage*/, TEST_LOCATION );
856 // Remove from the stage
857 Stage::GetCurrent().Remove(actor);
859 application.SendNotification();
860 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
862 // We didn't expect the animation to finish yet
863 application.SendNotification();
864 finishCheck.CheckSignalNotReceived();
865 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*back to start position*/, TEST_LOCATION );
868 Stage::GetCurrent().Add(actor);
870 application.SendNotification();
871 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
873 // We didn't expect the animation to finish yet
874 application.SendNotification();
875 finishCheck.CheckSignalNotReceived();
876 expectedPosition = Vector3(basePosition + (targetPosition - basePosition)*0.8f);
877 DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition, TEST_LOCATION );
879 application.SendNotification();
880 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
882 // We did expect the animation to finish
883 application.SendNotification();
884 finishCheck.CheckSignalReceived();
885 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
887 // Check that nothing has changed after a couple of buffer swaps
888 application.Render(0);
889 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
890 application.Render(0);
891 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
895 int UtcDaliAnimationPlayDiscardHandle(void)
897 TestApplication application;
899 Actor actor = Actor::New();
900 Stage::GetCurrent().Add(actor);
902 // Build the animation
903 float durationSeconds(1.0f);
904 Animation animation = Animation::New(durationSeconds);
905 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
906 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
908 bool signalReceived(false);
909 AnimationFinishCheck finishCheck(signalReceived);
910 animation.FinishedSignal().Connect(&application, finishCheck);
912 // Start the animation
915 // This is a test of the "Fire and Forget" behaviour
916 // Discard the animation handle!
918 DALI_TEST_CHECK( !animation );
920 application.SendNotification();
921 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
923 // We didn't expect the animation to finish yet
924 application.SendNotification();
925 finishCheck.CheckSignalNotReceived();
926 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
928 application.SendNotification();
929 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
931 // We didn't expect the animation to finish yet
932 application.SendNotification();
933 finishCheck.CheckSignalNotReceived();
934 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
936 application.SendNotification();
937 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
939 // We didn't expect the animation to finish yet
940 application.SendNotification();
941 finishCheck.CheckSignalNotReceived();
942 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
944 application.SendNotification();
945 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
947 // We didn't expect the animation to finish yet
948 application.SendNotification();
949 finishCheck.CheckSignalNotReceived();
950 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
952 application.SendNotification();
953 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
955 // We did expect the animation to finish
956 application.SendNotification();
957 finishCheck.CheckSignalReceived();
958 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
960 // Check that nothing has changed after a couple of buffer swaps
961 application.Render(0);
962 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
963 application.Render(0);
964 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
968 int UtcDaliAnimationPlayStopDiscardHandle(void)
970 TestApplication application;
972 Actor actor = Actor::New();
973 Stage::GetCurrent().Add(actor);
975 // Build the animation
976 float durationSeconds(1.0f);
977 Animation animation = Animation::New(durationSeconds);
978 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
979 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
981 // Start the animation
984 bool signalReceived(false);
985 AnimationFinishCheck finishCheck(signalReceived);
986 animation.FinishedSignal().Connect(&application, finishCheck);
988 application.SendNotification();
989 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
991 // We didn't expect the animation to finish yet
992 application.SendNotification();
993 finishCheck.CheckSignalNotReceived();
994 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
996 // This is a test of the "Fire and Forget" behaviour
997 // Stop the animation, and Discard the animation handle!
1000 DALI_TEST_CHECK( !animation );
1002 application.SendNotification();
1003 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1005 // We expect the animation to finish at 20% progress
1006 application.SendNotification();
1007 finishCheck.CheckSignalReceived();
1008 finishCheck.Reset();
1009 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1011 application.SendNotification();
1012 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1014 // Check that nothing has changed
1015 application.SendNotification();
1016 finishCheck.CheckSignalNotReceived();
1017 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1019 application.SendNotification();
1020 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1022 // Check that nothing has changed
1023 application.SendNotification();
1024 finishCheck.CheckSignalNotReceived();
1025 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1027 application.SendNotification();
1028 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 100% progress */);
1030 // Check that nothing has changed
1031 application.SendNotification();
1032 finishCheck.CheckSignalNotReceived();
1033 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1037 int UtcDaliAnimationPlayFrom(void)
1039 TestApplication application;
1041 Actor actor = Actor::New();
1042 Stage::GetCurrent().Add(actor);
1044 // Build the animation
1045 float durationSeconds(1.0f);
1046 Animation animation = Animation::New(durationSeconds);
1047 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1048 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
1050 //PlayFrom with an argument outside the range [0..1] will be ignored
1051 animation.PlayFrom(-1.0f);
1052 application.SendNotification();
1053 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1055 animation.PlayFrom(100.0f);
1056 application.SendNotification();
1057 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1059 // Start the animation from 40% progress
1060 animation.PlayFrom( 0.4f );
1062 bool signalReceived(false);
1063 AnimationFinishCheck finishCheck(signalReceived);
1064 animation.FinishedSignal().Connect(&application, finishCheck);
1066 application.SendNotification();
1067 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1069 // We didn't expect the animation to finish yet
1070 application.SendNotification();
1071 finishCheck.CheckSignalNotReceived();
1072 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1074 animation.Play(); // Test that calling play has no effect, when animation is already playing
1075 application.SendNotification();
1076 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1078 // We didn't expect the animation to finish yet
1079 application.SendNotification();
1080 finishCheck.CheckSignalNotReceived();
1081 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1083 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1084 // We did expect the animation to finish
1085 application.SendNotification();
1086 finishCheck.CheckSignalReceived();
1087 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1089 // Check that nothing has changed after a couple of buffer swaps
1090 application.Render(0);
1091 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1092 application.Render(0);
1093 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1097 int UtcDaliAnimationSetCurrentProgress(void)
1099 TestApplication application;
1101 Actor actor = Actor::New();
1102 Stage::GetCurrent().Add(actor);
1104 // Build the animation
1105 Animation animation = Animation::New(0.0f);
1108 //Test GetCurrentProgress return 0.0 as the duration is 0.0
1109 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1111 animation.SetCurrentProgress( 0.5f );
1112 application.SendNotification();
1113 application.Render(static_cast<unsigned int>(100.0f));
1115 //Progress should still be 0.0
1116 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1119 float durationSeconds(1.0f);
1120 animation.SetDuration(durationSeconds);
1121 application.SendNotification();
1123 bool signalReceived(false);
1124 AnimationFinishCheck finishCheck(signalReceived);
1125 animation.FinishedSignal().Connect(&application, finishCheck);
1126 application.SendNotification();
1128 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1129 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
1131 //Trying to set the current cursor outside the range [0..1] is ignored
1132 animation.SetCurrentProgress( -1.0f);
1133 application.SendNotification();
1134 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1136 animation.SetCurrentProgress( 100.0f);
1137 application.SendNotification();
1138 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1140 // Start the animation from 40% progress
1141 animation.SetCurrentProgress( 0.4f );
1144 application.SendNotification();
1145 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1147 // We didn't expect the animation to finish yet
1148 application.SendNotification();
1149 finishCheck.CheckSignalNotReceived();
1150 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1151 DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
1153 animation.Play(); // Test that calling play has no effect, when animation is already playing
1154 application.SendNotification();
1156 //Set the progress to 70%
1157 animation.SetCurrentProgress( 0.7f );
1158 application.SendNotification();
1159 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 80% progress */);
1160 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1163 application.SendNotification();
1164 finishCheck.CheckSignalNotReceived();
1165 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1166 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1170 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1171 // We did expect the animation to finish
1172 application.SendNotification();
1173 finishCheck.CheckSignalReceived();
1174 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1176 // Check that nothing has changed after a couple of buffer swaps
1177 application.Render(0);
1178 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1179 application.Render(0);
1180 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1184 int UtcDaliAnimationPlayRange(void)
1186 TestApplication application;
1188 Actor actor = Actor::New();
1189 Stage::GetCurrent().Add(actor);
1191 // Build the animation
1192 float durationSeconds(1.0f);
1193 Animation animation = Animation::New(durationSeconds);
1194 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1195 KeyFrames keyframes = KeyFrames::New();
1196 keyframes.Add( 0.0f , Vector3(0.0f,0.0f,0.0f ) );
1197 keyframes.Add( 1.0f , Vector3(100.0f,100.0f,100.0f ) );
1199 animation.AnimateBetween( Property( actor, Actor::POSITION), keyframes );
1201 // Set range between 0.4 and 0.8
1202 animation.SetPlayRange( Vector2(0.4f,0.8f) );
1205 bool signalReceived(false);
1206 AnimationFinishCheck finishCheck(signalReceived);
1207 animation.FinishedSignal().Connect(&application, finishCheck);
1209 //Test that setting progress outside the range doesn't work
1210 animation.SetCurrentProgress( 0.9f );
1211 application.SendNotification();
1212 application.Render(0);
1213 DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
1214 animation.SetCurrentProgress( 0.2f );
1215 application.SendNotification();
1216 application.Render(0);
1217 DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
1219 application.SendNotification();
1220 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1222 // We didn't expect the animation to finish yet
1223 application.SendNotification();
1224 finishCheck.CheckSignalNotReceived();
1225 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1227 animation.Play(); // Test that calling play has no effect, when animation is already playing
1228 application.SendNotification();
1229 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/* 80% progress */);
1231 // We did expect the animation to finish
1232 application.SendNotification();
1233 finishCheck.CheckSignalReceived();
1234 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1236 // Check that nothing has changed after a couple of buffer swaps
1237 application.Render(0);
1238 DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentPosition(), TEST_LOCATION );
1239 application.Render(0);
1240 DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentPosition(), TEST_LOCATION );
1243 //Loop inside the range
1244 finishCheck.Reset();
1245 animation.SetLooping( true );
1247 application.SendNotification();
1248 float intervalSeconds = 0.1f;
1249 float progress = 0.4f;
1250 for (int iterations = 0; iterations < 10; ++iterations )
1252 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
1254 progress += intervalSeconds;
1255 if (progress > 0.8f)
1257 progress = progress - 0.4f;
1260 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
1263 // We didn't expect the animation to finish yet
1264 application.SendNotification();
1265 finishCheck.CheckSignalNotReceived();
1268 //Test change range on the fly
1269 animation.SetPlayRange( Vector2( 0.2f, 0.9f ) );
1270 application.SendNotification();
1272 for (int iterations = 0; iterations < 10; ++iterations )
1274 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
1276 progress += intervalSeconds;
1277 if (progress > 0.9f)
1279 progress = progress - 0.7f;
1282 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
1288 int UtcDaliAnimationSetPlayRange(void)
1290 TestApplication application;
1292 Actor actor = Actor::New();
1293 Stage::GetCurrent().Add(actor);
1295 // Build the animation
1296 Animation animation = Animation::New(0);
1297 application.SendNotification();
1299 //If PlayRange not specified it should be 0.0-1.0 by default
1300 DALI_TEST_EQUALS( Vector2(0.0,1.0), animation.GetPlayRange(), TEST_LOCATION );
1302 //PlayRange out of bounds
1303 animation.SetPlayRange( Vector2(-1.0f,1.0f) );
1304 application.SendNotification();
1305 DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
1306 animation.SetPlayRange( Vector2(0.0f,2.0f) );
1307 application.SendNotification();
1308 DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
1310 //If playRange is not in the correct order it has to be ordered
1311 animation.SetPlayRange( Vector2(0.8f,0.2f) );
1312 application.SendNotification();
1313 DALI_TEST_EQUALS( Vector2(0.2f,0.8f), animation.GetPlayRange(), TEST_LOCATION );
1315 // Set range between 0.4 and 0.8
1316 animation.SetPlayRange( Vector2(0.4f,0.8f) );
1317 application.SendNotification();
1318 DALI_TEST_EQUALS( Vector2(0.4f,0.8f), animation.GetPlayRange(), TEST_LOCATION );
1323 int UtcDaliAnimationPause(void)
1325 TestApplication application;
1327 Actor actor = Actor::New();
1328 Stage::GetCurrent().Add(actor);
1330 // Build the animation
1331 float durationSeconds(1.0f);
1332 Animation animation = Animation::New(durationSeconds);
1333 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1334 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
1336 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
1338 // Start the animation
1341 bool signalReceived(false);
1342 AnimationFinishCheck finishCheck(signalReceived);
1343 animation.FinishedSignal().Connect(&application, finishCheck);
1345 application.SendNotification();
1346 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
1348 // We didn't expect the animation to finish yet
1349 application.SendNotification();
1350 finishCheck.CheckSignalNotReceived();
1351 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
1353 // Pause the animation
1355 application.SendNotification();
1358 for (int i=0; i<5; ++i)
1360 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
1362 // We didn't expect the animation to finish yet
1363 application.SendNotification();
1364 finishCheck.CheckSignalNotReceived();
1365 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
1370 application.SendNotification();
1371 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
1373 // We didn't expect the animation to finish yet
1374 application.SendNotification();
1375 finishCheck.CheckSignalNotReceived();
1377 application.SendNotification();
1378 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
1380 // We did expect the animation to finish
1381 application.SendNotification();
1382 finishCheck.CheckSignalReceived();
1383 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1385 // Check that nothing has changed after a couple of buffer swaps
1386 application.Render(0);
1387 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1388 application.Render(0);
1389 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1393 int UtcDaliAnimationStop(void)
1395 TestApplication application;
1397 Actor actor = Actor::New();
1398 Stage::GetCurrent().Add(actor);
1400 // Build the animation
1401 float durationSeconds(1.0f);
1402 Animation animation = Animation::New(durationSeconds);
1403 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1404 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
1406 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
1408 // Start the animation
1411 bool signalReceived(false);
1412 AnimationFinishCheck finishCheck(signalReceived);
1413 animation.FinishedSignal().Connect(&application, finishCheck);
1415 application.SendNotification();
1416 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
1418 // We didn't expect the animation to finish yet
1419 application.SendNotification();
1420 finishCheck.CheckSignalNotReceived();
1421 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
1423 // Stop the animation
1425 application.SendNotification();
1428 for (int i=0; i<5; ++i)
1430 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
1432 // We did expect the animation to finish
1433 application.SendNotification();
1434 finishCheck.CheckSignalReceived();
1435 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when stopped */, TEST_LOCATION );
1440 int UtcDaliAnimationStopSetPosition(void)
1442 // Test that Animation::Stop & Actor::SetPosition can be used in conjunction
1443 // i.e. to check that the animation does not interfere with the position set.
1445 TestApplication application;
1447 Actor actor = Actor::New();
1448 Stage::GetCurrent().Add(actor);
1450 // Build the animation
1451 float durationSeconds(1.0f);
1452 Animation animation = Animation::New(durationSeconds);
1453 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1454 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
1456 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
1458 // Start the animation
1461 bool signalReceived(false);
1462 AnimationFinishCheck finishCheck(signalReceived);
1463 animation.FinishedSignal().Connect(&application, finishCheck);
1465 application.SendNotification();
1466 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
1468 // We didn't expect the animation to finish yet
1469 application.SendNotification();
1470 finishCheck.CheckSignalNotReceived();
1471 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
1473 // Stop the animation
1475 Vector3 positionSet(2.0f, 3.0f, 4.0f);
1476 actor.SetPosition(positionSet);
1477 application.SendNotification();
1480 for (int i=0; i<5; ++i)
1482 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
1484 // We did expect the animation to finish
1485 application.SendNotification();
1486 finishCheck.CheckSignalReceived();
1487 DALI_TEST_EQUALS( actor.GetCurrentPosition(), positionSet/*Animation should not interfere with this*/, TEST_LOCATION );
1492 int UtcDaliAnimationClear(void)
1494 TestApplication application;
1496 Actor actor = Actor::New();
1497 Stage::GetCurrent().Add(actor);
1499 // Build the animation
1500 float durationSeconds(1.0f);
1501 Animation animation = Animation::New(durationSeconds);
1502 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1503 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
1505 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
1507 // Start the animation
1510 bool signalReceived(false);
1511 AnimationFinishCheck finishCheck(signalReceived);
1512 animation.FinishedSignal().Connect(&application, finishCheck);
1514 application.SendNotification();
1515 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
1517 // We didn't expect the animation to finish yet
1518 application.SendNotification();
1519 finishCheck.CheckSignalNotReceived();
1520 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
1522 // Clear the animation
1524 application.SendNotification();
1526 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
1528 // We don't expect the animation to finish now
1529 application.SendNotification();
1530 finishCheck.CheckSignalNotReceived();
1531 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress since the animator was destroyed */, TEST_LOCATION );
1533 // Restart as a scale animation; this should not move the actor's position
1534 finishCheck.Reset();
1535 actor.SetPosition(Vector3::ZERO);
1536 Vector3 targetScale(3.0f, 3.0f, 3.0f);
1537 animation.ScaleTo(actor, targetScale, AlphaFunctions::Linear);
1540 application.SendNotification();
1541 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
1543 // We didn't expect the animation to finish yet
1544 application.SendNotification();
1545 finishCheck.CheckSignalNotReceived();
1546 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
1547 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION );
1549 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
1551 // We did expect the animation to finish
1552 application.SendNotification();
1553 finishCheck.CheckSignalReceived();
1554 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
1555 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
1559 int UtcDaliAnimationSignalFinish(void)
1561 TestApplication application;
1563 // Start the empty animation
1564 float durationSeconds(1.0f);
1565 Animation animation = Animation::New(durationSeconds);
1568 bool signalReceived(false);
1569 AnimationFinishCheck finishCheck(signalReceived);
1570 animation.FinishedSignal().Connect(&application, finishCheck);
1572 application.SendNotification();
1573 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*beyond the animation duration*/);
1575 // We did expect the animation to finish
1576 application.SendNotification();
1577 finishCheck.CheckSignalReceived();
1581 int UtcDaliAnimationAnimateByBoolean(void)
1583 TestApplication application;
1585 Actor actor = Actor::New();
1587 // Register a boolean property
1588 bool startValue(false);
1589 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1590 Stage::GetCurrent().Add(actor);
1591 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1593 // Build the animation
1594 float durationSeconds(2.0f);
1595 Animation animation = Animation::New(durationSeconds);
1596 const bool relativeValue(true);
1597 const bool finalValue( false || relativeValue );
1598 animation.AnimateBy(Property(actor, index), relativeValue);
1600 // Start the animation
1603 bool signalReceived(false);
1604 AnimationFinishCheck finishCheck(signalReceived);
1605 animation.FinishedSignal().Connect(&application, finishCheck);
1607 application.SendNotification();
1608 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1610 // We didn't expect the animation to finish yet
1611 application.SendNotification();
1612 finishCheck.CheckSignalNotReceived();
1613 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1615 application.SendNotification();
1616 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1618 // We did expect the animation to finish
1619 application.SendNotification();
1620 finishCheck.CheckSignalReceived();
1621 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1623 // Check that nothing has changed after a couple of buffer swaps
1624 application.Render(0);
1625 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1626 application.Render(0);
1627 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1629 // Repeat with relative value "false" - this should be an NOOP
1630 animation = Animation::New(durationSeconds);
1631 bool noOpValue(false);
1632 animation.AnimateBy(Property(actor, index), noOpValue);
1634 // Start the animation
1637 finishCheck.Reset();
1638 animation.FinishedSignal().Connect(&application, finishCheck);
1640 application.SendNotification();
1641 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1643 // We didn't expect the animation to finish yet
1644 application.SendNotification();
1645 finishCheck.CheckSignalNotReceived();
1646 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1648 application.SendNotification();
1649 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1651 // We did expect the animation to finish
1652 application.SendNotification();
1653 finishCheck.CheckSignalReceived();
1654 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1656 // Check that nothing has changed after a couple of buffer swaps
1657 application.Render(0);
1658 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1659 application.Render(0);
1660 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1664 int UtcDaliAnimationAnimateByBooleanAlphaFunction(void)
1666 TestApplication application;
1668 Actor actor = Actor::New();
1670 // Register a boolean property
1671 bool startValue(false);
1672 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1673 Stage::GetCurrent().Add(actor);
1674 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1676 // Build the animation
1677 float durationSeconds(2.0f);
1678 Animation animation = Animation::New(durationSeconds);
1679 bool relativeValue(true);
1680 bool finalValue( false || relativeValue );
1681 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseIn);
1683 // Start the animation
1686 bool signalReceived(false);
1687 AnimationFinishCheck finishCheck(signalReceived);
1688 animation.FinishedSignal().Connect(&application, finishCheck);
1690 application.SendNotification();
1691 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1693 // We didn't expect the animation to finish yet
1694 application.SendNotification();
1695 finishCheck.CheckSignalNotReceived();
1696 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1698 application.SendNotification();
1699 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1701 // We did expect the animation to finish
1702 application.SendNotification();
1703 finishCheck.CheckSignalReceived();
1704 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1706 // Check that nothing has changed after a couple of buffer swaps
1707 application.Render(0);
1708 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1709 application.Render(0);
1710 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1712 // Repeat with relative value "false" - this should be an NOOP
1713 animation = Animation::New(durationSeconds);
1714 bool noOpValue(false);
1715 animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunctions::EaseIn);
1717 // Start the animation
1720 finishCheck.Reset();
1721 animation.FinishedSignal().Connect(&application, finishCheck);
1723 application.SendNotification();
1724 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1726 // We didn't expect the animation to finish yet
1727 application.SendNotification();
1728 finishCheck.CheckSignalNotReceived();
1729 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1731 application.SendNotification();
1732 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1734 // We did expect the animation to finish
1735 application.SendNotification();
1736 finishCheck.CheckSignalReceived();
1737 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1741 int UtcDaliAnimationAnimateByBooleanTimePeriod(void)
1743 TestApplication application;
1745 Actor actor = Actor::New();
1747 // Register a boolean property
1748 bool startValue(false);
1749 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1750 Stage::GetCurrent().Add(actor);
1751 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1753 // Build the animation
1754 float durationSeconds(2.0f);
1755 Animation animation = Animation::New(durationSeconds);
1756 bool relativeValue(true);
1757 bool finalValue( false || relativeValue );
1758 float animatorDurationSeconds(durationSeconds * 0.5f);
1759 animation.AnimateBy( Property(actor, index),
1761 TimePeriod( animatorDurationSeconds ) );
1763 // Start the animation
1766 bool signalReceived(false);
1767 AnimationFinishCheck finishCheck(signalReceived);
1768 animation.FinishedSignal().Connect(&application, finishCheck);
1770 application.SendNotification();
1771 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
1773 // We didn't expect the animation to finish yet
1774 application.SendNotification();
1775 finishCheck.CheckSignalNotReceived();
1776 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1778 application.SendNotification();
1779 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
1781 // We didn't expect the animation to finish yet...
1782 application.SendNotification();
1783 finishCheck.CheckSignalNotReceived();
1785 // ...however we should have reached the final value
1786 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1788 application.SendNotification();
1789 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
1791 // We did expect the animation to finish
1792 application.SendNotification();
1793 finishCheck.CheckSignalReceived();
1794 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1796 // Check that nothing has changed after a couple of buffer swaps
1797 application.Render(0);
1798 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1799 application.Render(0);
1800 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1804 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriod(void)
1806 TestApplication application;
1808 Actor actor = Actor::New();
1810 // Register a boolean property
1811 bool startValue(false);
1812 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1813 Stage::GetCurrent().Add(actor);
1814 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1816 // Build the animation
1817 float durationSeconds(2.0f);
1818 Animation animation = Animation::New(durationSeconds);
1819 bool relativeValue(true);
1820 bool finalValue( false || relativeValue );
1821 float animatorDurationSeconds(durationSeconds * 0.5f);
1822 animation.AnimateBy( Property(actor, index),
1824 AlphaFunctions::EaseInOut,
1825 TimePeriod( animatorDurationSeconds ) );
1827 // Start the animation
1830 bool signalReceived(false);
1831 AnimationFinishCheck finishCheck(signalReceived);
1832 animation.FinishedSignal().Connect(&application, finishCheck);
1834 application.SendNotification();
1835 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
1837 // We didn't expect the animation to finish yet
1838 application.SendNotification();
1839 finishCheck.CheckSignalNotReceived();
1840 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1842 application.SendNotification();
1843 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
1845 // We didn't expect the animation to finish yet...
1846 application.SendNotification();
1847 finishCheck.CheckSignalNotReceived();
1849 // ...however we should have reached the final value
1850 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1852 application.SendNotification();
1853 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
1855 // We did expect the animation to finish
1856 application.SendNotification();
1857 finishCheck.CheckSignalReceived();
1858 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1860 // Check that nothing has changed after a couple of buffer swaps
1861 application.Render(0);
1862 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1863 application.Render(0);
1864 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1868 int UtcDaliAnimationAnimateByFloat(void)
1870 TestApplication application;
1872 Actor actor = Actor::New();
1874 // Register a float property
1875 float startValue(10.0f);
1876 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1877 Stage::GetCurrent().Add(actor);
1878 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
1880 // Build the animation
1881 float durationSeconds(2.0f);
1882 Animation animation = Animation::New(durationSeconds);
1883 float targetValue(50.0f);
1884 float relativeValue(targetValue - startValue);
1885 animation.AnimateBy(Property(actor, index), relativeValue);
1887 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
1889 // Start the animation
1892 bool signalReceived(false);
1893 AnimationFinishCheck finishCheck(signalReceived);
1894 animation.FinishedSignal().Connect(&application, finishCheck);
1896 application.SendNotification();
1897 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1899 // We didn't expect the animation to finish yet
1900 application.SendNotification();
1901 finishCheck.CheckSignalNotReceived();
1902 DALI_TEST_EQUALS( actor.GetProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION );
1904 application.SendNotification();
1905 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1907 // We did expect the animation to finish
1908 application.SendNotification();
1909 finishCheck.CheckSignalReceived();
1910 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1912 // Check that nothing has changed after a couple of buffer swaps
1913 application.Render(0);
1914 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1915 application.Render(0);
1916 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1920 int UtcDaliAnimationAnimateByFloatAlphaFunction(void)
1922 TestApplication application;
1924 Actor actor = Actor::New();
1926 // Register a float property
1927 float startValue(10.0f);
1928 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1929 Stage::GetCurrent().Add(actor);
1930 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
1932 // Build the animation
1933 float durationSeconds(1.0f);
1934 Animation animation = Animation::New(durationSeconds);
1935 float targetValue(90.0f);
1936 float relativeValue(targetValue - startValue);
1937 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseOut);
1939 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
1941 // Start the animation
1944 bool signalReceived(false);
1945 AnimationFinishCheck finishCheck(signalReceived);
1946 animation.FinishedSignal().Connect(&application, finishCheck);
1948 application.SendNotification();
1949 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1951 // We didn't expect the animation to finish yet
1952 application.SendNotification();
1953 finishCheck.CheckSignalNotReceived();
1955 // The position should have moved more, than with a linear alpha function
1956 float current(actor.GetProperty<float>(index));
1957 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
1959 application.SendNotification();
1960 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1962 // We did expect the animation to finish
1963 application.SendNotification();
1964 finishCheck.CheckSignalReceived();
1965 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1967 // Check that nothing has changed after a couple of buffer swaps
1968 application.Render(0);
1969 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1970 application.Render(0);
1971 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1975 int UtcDaliAnimationAnimateByFloatTimePeriod(void)
1977 TestApplication application;
1979 Actor actor = Actor::New();
1981 // Register a float property
1982 float startValue(10.0f);
1983 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1984 Stage::GetCurrent().Add(actor);
1985 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
1987 // Build the animation
1988 float durationSeconds(1.0f);
1989 Animation animation = Animation::New(durationSeconds);
1990 float targetValue(30.0f);
1991 float relativeValue(targetValue - startValue);
1993 animation.AnimateBy(Property(actor, index),
1995 TimePeriod(delay, durationSeconds - delay));
1997 // Start the animation
2000 bool signalReceived(false);
2001 AnimationFinishCheck finishCheck(signalReceived);
2002 animation.FinishedSignal().Connect(&application, finishCheck);
2004 application.SendNotification();
2005 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2007 // We didn't expect the animation to finish yet
2008 application.SendNotification();
2009 finishCheck.CheckSignalNotReceived();
2010 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2012 application.SendNotification();
2013 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2015 // We didn't expect the animation to finish yet
2016 application.SendNotification();
2017 finishCheck.CheckSignalNotReceived();
2018 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2020 application.SendNotification();
2021 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2023 // We did expect the animation to finish
2024 application.SendNotification();
2025 finishCheck.CheckSignalReceived();
2026 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2028 // Check that nothing has changed after a couple of buffer swaps
2029 application.Render(0);
2030 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2031 application.Render(0);
2032 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2036 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriod(void)
2038 TestApplication application;
2040 Actor actor = Actor::New();
2042 // Register a float property
2043 float startValue(10.0f);
2044 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2045 Stage::GetCurrent().Add(actor);
2046 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2048 // Build the animation
2049 float durationSeconds(1.0f);
2050 Animation animation = Animation::New(durationSeconds);
2051 float targetValue(30.0f);
2052 float relativeValue(targetValue - startValue);
2054 animation.AnimateBy(Property(actor, index),
2056 AlphaFunctions::Linear,
2057 TimePeriod(delay, durationSeconds - delay));
2059 // Start the animation
2062 bool signalReceived(false);
2063 AnimationFinishCheck finishCheck(signalReceived);
2064 animation.FinishedSignal().Connect(&application, finishCheck);
2066 application.SendNotification();
2067 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2069 // We didn't expect the animation to finish yet
2070 application.SendNotification();
2071 finishCheck.CheckSignalNotReceived();
2072 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2074 application.SendNotification();
2075 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2077 // We didn't expect the animation to finish yet
2078 application.SendNotification();
2079 finishCheck.CheckSignalNotReceived();
2080 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2082 application.SendNotification();
2083 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2085 // We did expect the animation to finish
2086 application.SendNotification();
2087 finishCheck.CheckSignalReceived();
2088 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2090 // Check that nothing has changed after a couple of buffer swaps
2091 application.Render(0);
2092 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2093 application.Render(0);
2094 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2098 int UtcDaliAnimationAnimateByInteger(void)
2100 TestApplication application;
2102 Actor actor = Actor::New();
2104 // Register an integer property
2106 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2107 Stage::GetCurrent().Add(actor);
2108 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
2110 // Build the animation
2111 float durationSeconds(2.0f);
2112 Animation animation = Animation::New(durationSeconds);
2113 int targetValue(50);
2114 int relativeValue(targetValue - startValue);
2115 animation.AnimateBy(Property(actor, index), relativeValue);
2117 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
2119 // Start the animation
2122 bool signalReceived(false);
2123 AnimationFinishCheck finishCheck(signalReceived);
2124 animation.FinishedSignal().Connect(&application, finishCheck);
2126 application.SendNotification();
2127 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2129 // We didn't expect the animation to finish yet
2130 application.SendNotification();
2131 finishCheck.CheckSignalNotReceived();
2132 DALI_TEST_EQUALS( actor.GetProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION );
2134 application.SendNotification();
2135 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2137 // We did expect the animation to finish
2138 application.SendNotification();
2139 finishCheck.CheckSignalReceived();
2140 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2142 // Check that nothing has changed after a couple of buffer swaps
2143 application.Render(0);
2144 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2145 application.Render(0);
2146 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2150 int UtcDaliAnimationAnimateByIntegerAlphaFunction(void)
2152 TestApplication application;
2154 Actor actor = Actor::New();
2156 // Register an integer property
2158 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2159 Stage::GetCurrent().Add(actor);
2160 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
2162 // Build the animation
2163 float durationSeconds(1.0f);
2164 Animation animation = Animation::New(durationSeconds);
2165 int targetValue(90);
2166 int relativeValue(targetValue - startValue);
2167 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseOut);
2169 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
2171 // Start the animation
2174 bool signalReceived(false);
2175 AnimationFinishCheck finishCheck(signalReceived);
2176 animation.FinishedSignal().Connect(&application, finishCheck);
2178 application.SendNotification();
2179 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2181 // We didn't expect the animation to finish yet
2182 application.SendNotification();
2183 finishCheck.CheckSignalNotReceived();
2185 // The position should have moved more, than with a linear alpha function
2186 int current(actor.GetProperty<int>(index));
2187 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
2189 application.SendNotification();
2190 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2192 // We did expect the animation to finish
2193 application.SendNotification();
2194 finishCheck.CheckSignalReceived();
2195 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2197 // Check that nothing has changed after a couple of buffer swaps
2198 application.Render(0);
2199 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2200 application.Render(0);
2201 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2205 int UtcDaliAnimationAnimateByIntegerTimePeriod(void)
2207 TestApplication application;
2209 Actor actor = Actor::New();
2211 // Register an integer property
2213 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2214 Stage::GetCurrent().Add(actor);
2215 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
2217 // Build the animation
2218 float durationSeconds(1.0f);
2219 Animation animation = Animation::New(durationSeconds);
2220 int targetValue(30);
2221 int relativeValue(targetValue - startValue);
2223 animation.AnimateBy(Property(actor, index),
2225 TimePeriod(delay, durationSeconds - delay));
2227 // Start the animation
2230 bool signalReceived(false);
2231 AnimationFinishCheck finishCheck(signalReceived);
2232 animation.FinishedSignal().Connect(&application, finishCheck);
2234 application.SendNotification();
2235 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2237 // We didn't expect the animation to finish yet
2238 application.SendNotification();
2239 finishCheck.CheckSignalNotReceived();
2240 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
2242 application.SendNotification();
2243 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2245 // We didn't expect the animation to finish yet
2246 application.SendNotification();
2247 finishCheck.CheckSignalNotReceived();
2248 DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
2250 application.SendNotification();
2251 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2253 // We did expect the animation to finish
2254 application.SendNotification();
2255 finishCheck.CheckSignalReceived();
2256 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2258 // Check that nothing has changed after a couple of buffer swaps
2259 application.Render(0);
2260 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2261 application.Render(0);
2262 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2266 int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriod(void)
2268 TestApplication application;
2270 Actor actor = Actor::New();
2272 // Register an integer property
2274 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2275 Stage::GetCurrent().Add(actor);
2276 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
2278 // Build the animation
2279 float durationSeconds(1.0f);
2280 Animation animation = Animation::New(durationSeconds);
2281 int targetValue(30);
2282 int relativeValue(targetValue - startValue);
2284 animation.AnimateBy(Property(actor, index),
2286 AlphaFunctions::Linear,
2287 TimePeriod(delay, durationSeconds - delay));
2289 // Start the animation
2292 bool signalReceived(false);
2293 AnimationFinishCheck finishCheck(signalReceived);
2294 animation.FinishedSignal().Connect(&application, finishCheck);
2296 application.SendNotification();
2297 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2299 // We didn't expect the animation to finish yet
2300 application.SendNotification();
2301 finishCheck.CheckSignalNotReceived();
2302 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
2304 application.SendNotification();
2305 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2307 // We didn't expect the animation to finish yet
2308 application.SendNotification();
2309 finishCheck.CheckSignalNotReceived();
2310 DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
2312 application.SendNotification();
2313 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2315 // We did expect the animation to finish
2316 application.SendNotification();
2317 finishCheck.CheckSignalReceived();
2318 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2320 // Check that nothing has changed after a couple of buffer swaps
2321 application.Render(0);
2322 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2323 application.Render(0);
2324 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2328 int UtcDaliAnimationAnimateByVector2(void)
2330 TestApplication application;
2332 Actor actor = Actor::New();
2334 // Register a Vector2 property
2335 Vector2 startValue(10.0f, 10.0f);
2336 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2337 Stage::GetCurrent().Add(actor);
2338 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
2340 // Build the animation
2341 float durationSeconds(2.0f);
2342 Animation animation = Animation::New(durationSeconds);
2343 Vector2 targetValue(60.0f, 60.0f);
2344 Vector2 relativeValue(targetValue - startValue);
2345 animation.AnimateBy(Property(actor, index), relativeValue);
2347 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2349 // Start the animation
2352 bool signalReceived(false);
2353 AnimationFinishCheck finishCheck(signalReceived);
2354 animation.FinishedSignal().Connect(&application, finishCheck);
2356 application.SendNotification();
2357 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2359 // We didn't expect the animation to finish yet
2360 application.SendNotification();
2361 finishCheck.CheckSignalNotReceived();
2362 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION );
2364 application.SendNotification();
2365 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2367 // We did expect the animation to finish
2368 application.SendNotification();
2369 finishCheck.CheckSignalReceived();
2370 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
2372 // Check that nothing has changed after a couple of buffer swaps
2373 application.Render(0);
2374 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
2375 application.Render(0);
2376 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
2380 int UtcDaliAnimationAnimateByVector2AlphaFunction(void)
2382 TestApplication application;
2384 Actor actor = Actor::New();
2386 // Register a Vector2 property
2387 Vector2 startValue(100.0f, 100.0f);
2388 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2389 Stage::GetCurrent().Add(actor);
2390 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
2392 // Build the animation
2393 float durationSeconds(1.0f);
2394 Animation animation = Animation::New(durationSeconds);
2395 Vector2 targetValue(20.0f, 20.0f);
2396 Vector2 relativeValue(targetValue - startValue);
2397 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseOut);
2399 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2401 // Start the animation
2404 bool signalReceived(false);
2405 AnimationFinishCheck finishCheck(signalReceived);
2406 animation.FinishedSignal().Connect(&application, finishCheck);
2408 application.SendNotification();
2409 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2411 // We didn't expect the animation to finish yet
2412 application.SendNotification();
2413 finishCheck.CheckSignalNotReceived();
2415 // The position should have moved more, than with a linear alpha function
2416 Vector2 current(actor.GetProperty<Vector2>(index));
2417 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
2418 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
2420 application.SendNotification();
2421 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2423 // We did expect the animation to finish
2424 application.SendNotification();
2425 finishCheck.CheckSignalReceived();
2426 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
2428 // Check that nothing has changed after a couple of buffer swaps
2429 application.Render(0);
2430 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
2431 application.Render(0);
2432 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
2436 int UtcDaliAnimationAnimateByVector2TimePeriod(void)
2438 TestApplication application;
2440 Actor actor = Actor::New();
2442 // Register a Vector2 property
2443 Vector2 startValue(10.0f, 10.0f);
2444 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2445 Stage::GetCurrent().Add(actor);
2446 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
2448 // Build the animation
2449 float durationSeconds(1.0f);
2450 Animation animation = Animation::New(durationSeconds);
2451 Vector2 targetValue(30.0f, 30.0f);
2452 Vector2 relativeValue(targetValue - startValue);
2454 animation.AnimateBy(Property(actor, index),
2456 TimePeriod(delay, durationSeconds - delay));
2458 // Start the animation
2461 bool signalReceived(false);
2462 AnimationFinishCheck finishCheck(signalReceived);
2463 animation.FinishedSignal().Connect(&application, finishCheck);
2465 application.SendNotification();
2466 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2468 // We didn't expect the animation to finish yet
2469 application.SendNotification();
2470 finishCheck.CheckSignalNotReceived();
2471 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
2473 application.SendNotification();
2474 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2476 // We didn't expect the animation to finish yet
2477 application.SendNotification();
2478 finishCheck.CheckSignalNotReceived();
2479 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2481 application.SendNotification();
2482 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2484 // We did expect the animation to finish
2485 application.SendNotification();
2486 finishCheck.CheckSignalReceived();
2487 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
2489 // Check that nothing has changed after a couple of buffer swaps
2490 application.Render(0);
2491 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
2492 application.Render(0);
2493 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
2497 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriod(void)
2499 TestApplication application;
2501 Actor actor = Actor::New();
2503 // Register a Vector2 property
2504 Vector2 startValue(5.0f, 5.0f);
2505 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2506 Stage::GetCurrent().Add(actor);
2507 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
2509 // Build the animation
2510 float durationSeconds(1.0f);
2511 Animation animation = Animation::New(durationSeconds);
2512 Vector2 targetValue(10.0f, 10.0f);
2513 Vector2 relativeValue(targetValue - startValue);
2515 animation.AnimateBy(Property(actor, index),
2517 AlphaFunctions::Linear,
2518 TimePeriod(delay, durationSeconds - delay));
2520 // Start the animation
2523 bool signalReceived(false);
2524 AnimationFinishCheck finishCheck(signalReceived);
2525 animation.FinishedSignal().Connect(&application, finishCheck);
2527 application.SendNotification();
2528 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2530 // We didn't expect the animation to finish yet
2531 application.SendNotification();
2532 finishCheck.CheckSignalNotReceived();
2533 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
2535 application.SendNotification();
2536 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2538 // We didn't expect the animation to finish yet
2539 application.SendNotification();
2540 finishCheck.CheckSignalNotReceived();
2541 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2543 application.SendNotification();
2544 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2546 // We did expect the animation to finish
2547 application.SendNotification();
2548 finishCheck.CheckSignalReceived();
2549 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
2551 // Check that nothing has changed after a couple of buffer swaps
2552 application.Render(0);
2553 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
2554 application.Render(0);
2555 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
2559 int UtcDaliAnimationAnimateByVector3(void)
2561 TestApplication application;
2563 Actor actor = Actor::New();
2565 // Register a Vector3 property
2566 Vector3 startValue(10.0f, 10.0f, 10.0f);
2567 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2568 Stage::GetCurrent().Add(actor);
2569 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
2571 // Build the animation
2572 float durationSeconds(2.0f);
2573 Animation animation = Animation::New(durationSeconds);
2574 Vector3 targetValue(60.0f, 60.0f, 60.0f);
2575 Vector3 relativeValue(targetValue - startValue);
2576 animation.AnimateBy(Property(actor, index), relativeValue);
2578 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2580 // Start the animation
2583 bool signalReceived(false);
2584 AnimationFinishCheck finishCheck(signalReceived);
2585 animation.FinishedSignal().Connect(&application, finishCheck);
2587 application.SendNotification();
2588 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2590 // We didn't expect the animation to finish yet
2591 application.SendNotification();
2592 finishCheck.CheckSignalNotReceived();
2593 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION );
2595 application.SendNotification();
2596 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2598 // We did expect the animation to finish
2599 application.SendNotification();
2600 finishCheck.CheckSignalReceived();
2601 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2603 // Check that nothing has changed after a couple of buffer swaps
2604 application.Render(0);
2605 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2606 application.Render(0);
2607 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2611 int UtcDaliAnimationAnimateByVector3AlphaFunction(void)
2613 TestApplication application;
2615 Actor actor = Actor::New();
2617 // Register a Vector3 property
2618 Vector3 startValue(100.0f, 100.0f, 100.0f);
2619 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2620 Stage::GetCurrent().Add(actor);
2621 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
2623 // Build the animation
2624 float durationSeconds(1.0f);
2625 Animation animation = Animation::New(durationSeconds);
2626 Vector3 targetValue(20.0f, 20.0f, 20.0f);
2627 Vector3 relativeValue(targetValue - startValue);
2628 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseOut);
2630 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2632 // Start the animation
2635 bool signalReceived(false);
2636 AnimationFinishCheck finishCheck(signalReceived);
2637 animation.FinishedSignal().Connect(&application, finishCheck);
2639 application.SendNotification();
2640 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2642 // We didn't expect the animation to finish yet
2643 application.SendNotification();
2644 finishCheck.CheckSignalNotReceived();
2646 // The position should have moved more, than with a linear alpha function
2647 Vector3 current(actor.GetProperty<Vector3>(index));
2648 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
2649 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
2650 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
2652 application.SendNotification();
2653 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2655 // We did expect the animation to finish
2656 application.SendNotification();
2657 finishCheck.CheckSignalReceived();
2658 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2660 // Check that nothing has changed after a couple of buffer swaps
2661 application.Render(0);
2662 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2663 application.Render(0);
2664 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2668 int UtcDaliAnimationAnimateByVector3TimePeriod(void)
2670 TestApplication application;
2672 Actor actor = Actor::New();
2674 // Register a Vector3 property
2675 Vector3 startValue(10.0f, 10.0f, 10.0f);
2676 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2677 Stage::GetCurrent().Add(actor);
2678 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
2680 // Build the animation
2681 float durationSeconds(1.0f);
2682 Animation animation = Animation::New(durationSeconds);
2683 Vector3 targetValue(30.0f, 30.0f, 30.0f);
2684 Vector3 relativeValue(targetValue - startValue);
2686 animation.AnimateBy(Property(actor, index),
2688 TimePeriod(delay, durationSeconds - delay));
2690 // Start the animation
2693 bool signalReceived(false);
2694 AnimationFinishCheck finishCheck(signalReceived);
2695 animation.FinishedSignal().Connect(&application, finishCheck);
2697 application.SendNotification();
2698 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2700 // We didn't expect the animation to finish yet
2701 application.SendNotification();
2702 finishCheck.CheckSignalNotReceived();
2703 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
2705 application.SendNotification();
2706 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2708 // We didn't expect the animation to finish yet
2709 application.SendNotification();
2710 finishCheck.CheckSignalNotReceived();
2711 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2713 application.SendNotification();
2714 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2716 // We did expect the animation to finish
2717 application.SendNotification();
2718 finishCheck.CheckSignalReceived();
2719 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2721 // Check that nothing has changed after a couple of buffer swaps
2722 application.Render(0);
2723 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2724 application.Render(0);
2725 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2729 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriod(void)
2731 TestApplication application;
2733 Actor actor = Actor::New();
2735 // Register a Vector3 property
2736 Vector3 startValue(5.0f, 5.0f, 5.0f);
2737 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2738 Stage::GetCurrent().Add(actor);
2739 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
2741 // Build the animation
2742 float durationSeconds(1.0f);
2743 Animation animation = Animation::New(durationSeconds);
2744 Vector3 targetValue(10.0f, 10.0f, 10.0f);
2745 Vector3 relativeValue(targetValue - startValue);
2747 animation.AnimateBy(Property(actor, index),
2749 AlphaFunctions::Linear,
2750 TimePeriod(delay, durationSeconds - delay));
2752 // Start the animation
2755 bool signalReceived(false);
2756 AnimationFinishCheck finishCheck(signalReceived);
2757 animation.FinishedSignal().Connect(&application, finishCheck);
2759 application.SendNotification();
2760 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2762 // We didn't expect the animation to finish yet
2763 application.SendNotification();
2764 finishCheck.CheckSignalNotReceived();
2765 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
2767 application.SendNotification();
2768 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2770 // We didn't expect the animation to finish yet
2771 application.SendNotification();
2772 finishCheck.CheckSignalNotReceived();
2773 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2775 application.SendNotification();
2776 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2778 // We did expect the animation to finish
2779 application.SendNotification();
2780 finishCheck.CheckSignalReceived();
2781 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2783 // Check that nothing has changed after a couple of buffer swaps
2784 application.Render(0);
2785 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2786 application.Render(0);
2787 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2791 int UtcDaliAnimationAnimateByVector4(void)
2793 TestApplication application;
2795 Actor actor = Actor::New();
2797 // Register a Vector4 property
2798 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
2799 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2800 Stage::GetCurrent().Add(actor);
2801 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
2803 // Build the animation
2804 float durationSeconds(2.0f);
2805 Animation animation = Animation::New(durationSeconds);
2806 Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f);
2807 Vector4 relativeValue(targetValue - startValue);
2808 animation.AnimateBy(Property(actor, index), relativeValue);
2810 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2812 // Start the animation
2815 bool signalReceived(false);
2816 AnimationFinishCheck finishCheck(signalReceived);
2817 animation.FinishedSignal().Connect(&application, finishCheck);
2819 application.SendNotification();
2820 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2822 // We didn't expect the animation to finish yet
2823 application.SendNotification();
2824 finishCheck.CheckSignalNotReceived();
2825 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION );
2827 application.SendNotification();
2828 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2830 // We did expect the animation to finish
2831 application.SendNotification();
2832 finishCheck.CheckSignalReceived();
2833 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2835 // Check that nothing has changed after a couple of buffer swaps
2836 application.Render(0);
2837 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2838 application.Render(0);
2839 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2843 int UtcDaliAnimationAnimateByVector4AlphaFunction(void)
2845 TestApplication application;
2847 Actor actor = Actor::New();
2849 // Register a Vector4 property
2850 Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f);
2851 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2852 Stage::GetCurrent().Add(actor);
2853 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
2855 // Build the animation
2856 float durationSeconds(1.0f);
2857 Animation animation = Animation::New(durationSeconds);
2858 Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
2859 Vector4 relativeValue(targetValue - startValue);
2860 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseOut);
2862 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2864 // Start the animation
2867 bool signalReceived(false);
2868 AnimationFinishCheck finishCheck(signalReceived);
2869 animation.FinishedSignal().Connect(&application, finishCheck);
2871 application.SendNotification();
2872 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2874 // We didn't expect the animation to finish yet
2875 application.SendNotification();
2876 finishCheck.CheckSignalNotReceived();
2878 // The position should have moved more, than with a linear alpha function
2879 Vector4 current(actor.GetProperty<Vector4>(index));
2880 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
2881 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
2882 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
2883 DALI_TEST_CHECK( current.w < ninetyFivePercentProgress.w );
2885 application.SendNotification();
2886 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2888 // We did expect the animation to finish
2889 application.SendNotification();
2890 finishCheck.CheckSignalReceived();
2891 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2893 // Check that nothing has changed after a couple of buffer swaps
2894 application.Render(0);
2895 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2896 application.Render(0);
2897 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2901 int UtcDaliAnimationAnimateByVector4TimePeriod(void)
2903 TestApplication application;
2905 Actor actor = Actor::New();
2907 // Register a Vector4 property
2908 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
2909 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2910 Stage::GetCurrent().Add(actor);
2911 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
2913 // Build the animation
2914 float durationSeconds(1.0f);
2915 Animation animation = Animation::New(durationSeconds);
2916 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
2917 Vector4 relativeValue(targetValue - startValue);
2919 animation.AnimateBy(Property(actor, index),
2921 TimePeriod(delay, durationSeconds - delay));
2923 // Start the animation
2926 bool signalReceived(false);
2927 AnimationFinishCheck finishCheck(signalReceived);
2928 animation.FinishedSignal().Connect(&application, finishCheck);
2930 application.SendNotification();
2931 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2933 // We didn't expect the animation to finish yet
2934 application.SendNotification();
2935 finishCheck.CheckSignalNotReceived();
2936 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
2938 application.SendNotification();
2939 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2941 // We didn't expect the animation to finish yet
2942 application.SendNotification();
2943 finishCheck.CheckSignalNotReceived();
2944 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2946 application.SendNotification();
2947 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2949 // We did expect the animation to finish
2950 application.SendNotification();
2951 finishCheck.CheckSignalReceived();
2952 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2954 // Check that nothing has changed after a couple of buffer swaps
2955 application.Render(0);
2956 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2957 application.Render(0);
2958 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2962 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriod(void)
2964 TestApplication application;
2966 Actor actor = Actor::New();
2968 // Register a Vector4 property
2969 Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f);
2970 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2971 Stage::GetCurrent().Add(actor);
2972 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
2974 // Build the animation
2975 float durationSeconds(1.0f);
2976 Animation animation = Animation::New(durationSeconds);
2977 Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f);
2978 Vector4 relativeValue(targetValue - startValue);
2980 animation.AnimateBy(Property(actor, index),
2982 AlphaFunctions::Linear,
2983 TimePeriod(delay, durationSeconds - delay));
2985 // Start the animation
2988 bool signalReceived(false);
2989 AnimationFinishCheck finishCheck(signalReceived);
2990 animation.FinishedSignal().Connect(&application, finishCheck);
2992 application.SendNotification();
2993 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2995 // We didn't expect the animation to finish yet
2996 application.SendNotification();
2997 finishCheck.CheckSignalNotReceived();
2998 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3000 application.SendNotification();
3001 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3003 // We didn't expect the animation to finish yet
3004 application.SendNotification();
3005 finishCheck.CheckSignalNotReceived();
3006 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3008 application.SendNotification();
3009 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3011 // We did expect the animation to finish
3012 application.SendNotification();
3013 finishCheck.CheckSignalReceived();
3014 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3016 // Check that nothing has changed after a couple of buffer swaps
3017 application.Render(0);
3018 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3019 application.Render(0);
3020 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3024 int UtcDaliAnimationAnimateByActorPosition(void)
3026 TestApplication application;
3028 Actor actor = Actor::New();
3029 Vector3 startPosition(10.0f, 10.0f, 10.0f);
3030 actor.SetPosition(startPosition);
3031 Stage::GetCurrent().Add(actor);
3032 application.SendNotification();
3033 application.Render(0);
3034 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
3036 // Build the animation
3037 float durationSeconds(1.0f);
3038 Animation animation = Animation::New(durationSeconds);
3039 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
3040 Vector3 relativePosition(targetPosition - startPosition);
3041 animation.AnimateBy(Property(actor, Actor::POSITION), relativePosition);
3043 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
3045 // Start the animation
3048 bool signalReceived(false);
3049 AnimationFinishCheck finishCheck(signalReceived);
3050 animation.FinishedSignal().Connect(&application, finishCheck);
3052 application.SendNotification();
3053 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3055 // We didn't expect the animation to finish yet
3056 application.SendNotification();
3057 finishCheck.CheckSignalNotReceived();
3058 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ninetyFivePercentProgress, TEST_LOCATION );
3060 application.SendNotification();
3061 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3063 // We did expect the animation to finish
3064 application.SendNotification();
3065 finishCheck.CheckSignalReceived();
3066 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3068 // Check that nothing has changed after a couple of buffer swaps
3069 application.Render(0);
3070 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3071 application.Render(0);
3072 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3076 int UtcDaliAnimationAnimateByActorPositionAlphaFunction(void)
3078 TestApplication application;
3080 Actor actor = Actor::New();
3081 Vector3 startPosition(10.0f, 10.0f, 10.0f);
3082 actor.SetPosition(startPosition);
3083 Stage::GetCurrent().Add(actor);
3084 application.SendNotification();
3085 application.Render(0);
3086 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
3088 // Build the animation
3089 float durationSeconds(1.0f);
3090 Animation animation = Animation::New(durationSeconds);
3091 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
3092 Vector3 relativePosition(targetPosition - startPosition);
3093 animation.AnimateBy(Property(actor, Actor::POSITION), relativePosition, AlphaFunctions::EaseOut);
3095 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
3097 // Start the animation
3100 bool signalReceived(false);
3101 AnimationFinishCheck finishCheck(signalReceived);
3102 animation.FinishedSignal().Connect(&application, finishCheck);
3104 application.SendNotification();
3105 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3107 // We didn't expect the animation to finish yet
3108 application.SendNotification();
3109 finishCheck.CheckSignalNotReceived();
3111 // The position should have moved more, than with a linear alpha function
3112 Vector3 current(actor.GetCurrentPosition());
3113 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
3114 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
3115 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
3117 application.SendNotification();
3118 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3120 // We did expect the animation to finish
3121 application.SendNotification();
3122 finishCheck.CheckSignalReceived();
3123 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3125 // Check that nothing has changed after a couple of buffer swaps
3126 application.Render(0);
3127 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3128 application.Render(0);
3129 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3133 int UtcDaliAnimationAnimateByActorPositionTimePeriod(void)
3135 TestApplication application;
3137 Actor actor = Actor::New();
3138 Vector3 startPosition(10.0f, 10.0f, 10.0f);
3139 actor.SetPosition(startPosition);
3140 Stage::GetCurrent().Add(actor);
3141 application.SendNotification();
3142 application.Render(0);
3143 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
3145 // Build the animation
3146 float durationSeconds(1.0f);
3147 Animation animation = Animation::New(durationSeconds);
3148 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
3149 Vector3 relativePosition(targetPosition - startPosition);
3151 animation.AnimateBy(Property(actor, Actor::POSITION),
3153 TimePeriod(delay, durationSeconds - delay));
3155 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
3157 // Start the animation
3160 bool signalReceived(false);
3161 AnimationFinishCheck finishCheck(signalReceived);
3162 animation.FinishedSignal().Connect(&application, finishCheck);
3164 application.SendNotification();
3165 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3167 // We didn't expect the animation to finish yet
3168 application.SendNotification();
3169 finishCheck.CheckSignalNotReceived();
3170 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
3172 application.SendNotification();
3173 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
3175 // We did expect the animation to finish
3176 application.SendNotification();
3177 finishCheck.CheckSignalReceived();
3178 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3180 // Check that nothing has changed after a couple of buffer swaps
3181 application.Render(0);
3182 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3183 application.Render(0);
3184 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3188 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriod(void)
3190 TestApplication application;
3192 Actor actor = Actor::New();
3193 Vector3 startPosition(10.0f, 10.0f, 10.0f);
3194 actor.SetPosition(startPosition);
3195 Stage::GetCurrent().Add(actor);
3196 application.SendNotification();
3197 application.Render(0);
3198 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
3200 // Build the animation
3201 float durationSeconds(1.0f);
3202 Animation animation = Animation::New(durationSeconds);
3203 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
3204 Vector3 relativePosition(targetPosition - startPosition);
3206 animation.AnimateBy(Property(actor, Actor::POSITION),
3208 AlphaFunctions::Linear,
3209 TimePeriod(delay, durationSeconds - delay));
3211 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
3213 // Start the animation
3216 bool signalReceived(false);
3217 AnimationFinishCheck finishCheck(signalReceived);
3218 animation.FinishedSignal().Connect(&application, finishCheck);
3220 application.SendNotification();
3221 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3223 // We didn't expect the animation to finish yet
3224 application.SendNotification();
3225 finishCheck.CheckSignalNotReceived();
3226 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
3228 application.SendNotification();
3229 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
3231 // We did expect the animation to finish
3232 application.SendNotification();
3233 finishCheck.CheckSignalReceived();
3234 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3236 // Check that nothing has changed after a couple of buffer swaps
3237 application.Render(0);
3238 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3239 application.Render(0);
3240 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3244 int UtcDaliAnimationAnimateToBoolean(void)
3246 TestApplication application;
3248 Actor actor = Actor::New();
3250 // Register a boolean property
3251 const bool startValue(false);
3252 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3253 Stage::GetCurrent().Add(actor);
3254 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3256 // Build the animation
3257 float durationSeconds(2.0f);
3258 Animation animation = Animation::New(durationSeconds);
3259 const bool targetValue( !startValue );
3260 animation.AnimateTo(Property(actor, index), targetValue);
3262 // Start the animation
3265 bool signalReceived(false);
3266 AnimationFinishCheck finishCheck(signalReceived);
3267 animation.FinishedSignal().Connect(&application, finishCheck);
3269 application.SendNotification();
3270 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3272 // We didn't expect the animation to finish yet
3273 application.SendNotification();
3274 finishCheck.CheckSignalNotReceived();
3275 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3277 application.SendNotification();
3278 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3280 // We did expect the animation to finish
3281 application.SendNotification();
3282 finishCheck.CheckSignalReceived();
3283 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
3285 // Check that nothing has changed after a couple of buffer swaps
3286 application.Render(0);
3287 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
3288 application.Render(0);
3289 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
3291 // Repeat with target value "false"
3292 animation = Animation::New(durationSeconds);
3293 const bool finalValue( !targetValue );
3294 animation.AnimateTo(Property(actor, index), finalValue);
3296 // Start the animation
3299 finishCheck.Reset();
3300 animation.FinishedSignal().Connect(&application, finishCheck);
3302 application.SendNotification();
3303 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3305 // We didn't expect the animation to finish yet
3306 application.SendNotification();
3307 finishCheck.CheckSignalNotReceived();
3308 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
3310 application.SendNotification();
3311 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3313 // We did expect the animation to finish
3314 application.SendNotification();
3315 finishCheck.CheckSignalReceived();
3316 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3318 // Check that nothing has changed after a couple of buffer swaps
3319 application.Render(0);
3320 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3321 application.Render(0);
3322 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3326 int UtcDaliAnimationAnimateToBooleanAlphaFunction(void)
3328 TestApplication application;
3330 Actor actor = Actor::New();
3332 // Register a boolean property
3333 const bool startValue(false);
3334 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3335 Stage::GetCurrent().Add(actor);
3336 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3338 // Build the animation
3339 float durationSeconds(2.0f);
3340 Animation animation = Animation::New(durationSeconds);
3341 const bool targetValue( !startValue );
3342 animation.AnimateTo(Property(actor, "test-property"), targetValue, AlphaFunctions::EaseOut);
3344 // Start the animation
3347 bool signalReceived(false);
3348 AnimationFinishCheck finishCheck(signalReceived);
3349 animation.FinishedSignal().Connect(&application, finishCheck);
3351 application.SendNotification();
3352 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3354 // We didn't expect the animation to finish yet
3355 application.SendNotification();
3356 finishCheck.CheckSignalNotReceived();
3357 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3359 application.SendNotification();
3360 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3362 // We did expect the animation to finish
3363 application.SendNotification();
3364 finishCheck.CheckSignalReceived();
3365 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
3367 // Check that nothing has changed after a couple of buffer swaps
3368 application.Render(0);
3369 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
3370 application.Render(0);
3371 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
3373 // Repeat with target value "false"
3374 animation = Animation::New(durationSeconds);
3375 const bool finalValue( !targetValue );
3376 animation.AnimateTo(Property(actor, index), finalValue, AlphaFunctions::EaseOut);
3378 // Start the animation
3381 finishCheck.Reset();
3382 animation.FinishedSignal().Connect(&application, finishCheck);
3384 application.SendNotification();
3385 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3387 // We didn't expect the animation to finish yet
3388 application.SendNotification();
3389 finishCheck.CheckSignalNotReceived();
3390 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
3392 application.SendNotification();
3393 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3395 // We did expect the animation to finish
3396 application.SendNotification();
3397 finishCheck.CheckSignalReceived();
3398 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3400 // Check that nothing has changed after a couple of buffer swaps
3401 application.Render(0);
3402 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3403 application.Render(0);
3404 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3408 int UtcDaliAnimationAnimateToBooleanTimePeriod(void)
3410 TestApplication application;
3412 Actor actor = Actor::New();
3414 // Register a boolean property
3415 bool startValue(false);
3416 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3417 Stage::GetCurrent().Add(actor);
3418 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3420 // Build the animation
3421 float durationSeconds(2.0f);
3422 Animation animation = Animation::New(durationSeconds);
3423 bool finalValue( !startValue );
3424 float animatorDurationSeconds(durationSeconds * 0.5f);
3425 animation.AnimateTo( Property(actor, index),
3427 TimePeriod( animatorDurationSeconds ) );
3429 // Start the animation
3432 bool signalReceived(false);
3433 AnimationFinishCheck finishCheck(signalReceived);
3434 animation.FinishedSignal().Connect(&application, finishCheck);
3436 application.SendNotification();
3437 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
3439 // We didn't expect the animation to finish yet
3440 application.SendNotification();
3441 finishCheck.CheckSignalNotReceived();
3442 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3444 application.SendNotification();
3445 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
3447 // We didn't expect the animation to finish yet...
3448 application.SendNotification();
3449 finishCheck.CheckSignalNotReceived();
3451 // ...however we should have reached the final value
3452 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3454 application.SendNotification();
3455 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
3457 // We did expect the animation to finish
3458 application.SendNotification();
3459 finishCheck.CheckSignalReceived();
3460 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3462 // Check that nothing has changed after a couple of buffer swaps
3463 application.Render(0);
3464 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3465 application.Render(0);
3466 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3470 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriod(void)
3472 TestApplication application;
3474 Actor actor = Actor::New();
3476 // Register a boolean property
3477 bool startValue(false);
3478 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3479 Stage::GetCurrent().Add(actor);
3480 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3482 // Build the animation
3483 float durationSeconds(2.0f);
3484 Animation animation = Animation::New(durationSeconds);
3485 bool finalValue( !startValue );
3486 float animatorDurationSeconds(durationSeconds * 0.5f);
3487 animation.AnimateTo( Property(actor, index),
3489 AlphaFunctions::Linear,
3490 TimePeriod( animatorDurationSeconds ) );
3492 // Start the animation
3495 bool signalReceived(false);
3496 AnimationFinishCheck finishCheck(signalReceived);
3497 animation.FinishedSignal().Connect(&application, finishCheck);
3499 application.SendNotification();
3500 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
3502 // We didn't expect the animation to finish yet
3503 application.SendNotification();
3504 finishCheck.CheckSignalNotReceived();
3505 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3507 application.SendNotification();
3508 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
3510 // We didn't expect the animation to finish yet...
3511 application.SendNotification();
3512 finishCheck.CheckSignalNotReceived();
3514 // ...however we should have reached the final value
3515 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3517 application.SendNotification();
3518 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
3520 // We did expect the animation to finish
3521 application.SendNotification();
3522 finishCheck.CheckSignalReceived();
3523 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3525 // Check that nothing has changed after a couple of buffer swaps
3526 application.Render(0);
3527 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3528 application.Render(0);
3529 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3533 int UtcDaliAnimationAnimateToFloat(void)
3535 TestApplication application;
3537 Actor actor = Actor::New();
3539 // Register a float property
3540 float startValue(10.0f);
3541 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3542 Stage::GetCurrent().Add(actor);
3543 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3545 // Build the animation
3546 float durationSeconds(2.0f);
3547 Animation animation = Animation::New(durationSeconds);
3548 float targetValue(50.0f);
3549 float relativeValue(targetValue - startValue);
3550 animation.AnimateTo(Property(actor, "test-property"), targetValue);
3552 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3554 // Start the animation
3557 bool signalReceived(false);
3558 AnimationFinishCheck finishCheck(signalReceived);
3559 animation.FinishedSignal().Connect(&application, finishCheck);
3561 application.SendNotification();
3562 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3564 // We didn't expect the animation to finish yet
3565 application.SendNotification();
3566 finishCheck.CheckSignalNotReceived();
3567 DALI_TEST_EQUALS( actor.GetProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION );
3569 application.SendNotification();
3570 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3572 // We did expect the animation to finish
3573 application.SendNotification();
3574 finishCheck.CheckSignalReceived();
3575 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3579 int UtcDaliAnimationAnimateToFloatAlphaFunction(void)
3581 TestApplication application;
3583 Actor actor = Actor::New();
3585 // Register a float property
3586 float startValue(10.0f);
3587 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3588 Stage::GetCurrent().Add(actor);
3589 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3591 // Build the animation
3592 float durationSeconds(1.0f);
3593 Animation animation = Animation::New(durationSeconds);
3594 float targetValue(90.0f);
3595 float relativeValue(targetValue - startValue);
3596 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunctions::EaseOut);
3598 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3600 // Start the animation
3603 bool signalReceived(false);
3604 AnimationFinishCheck finishCheck(signalReceived);
3605 animation.FinishedSignal().Connect(&application, finishCheck);
3607 application.SendNotification();
3608 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3610 // We didn't expect the animation to finish yet
3611 application.SendNotification();
3612 finishCheck.CheckSignalNotReceived();
3614 // The position should have moved more, than with a linear alpha function
3615 float current(actor.GetProperty<float>(index));
3616 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3618 application.SendNotification();
3619 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3621 // We did expect the animation to finish
3622 application.SendNotification();
3623 finishCheck.CheckSignalReceived();
3624 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3628 int UtcDaliAnimationAnimateToFloatTimePeriod(void)
3630 TestApplication application;
3632 Actor actor = Actor::New();
3634 // Register a float property
3635 float startValue(10.0f);
3636 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3637 Stage::GetCurrent().Add(actor);
3638 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3640 // Build the animation
3641 float durationSeconds(1.0f);
3642 Animation animation = Animation::New(durationSeconds);
3643 float targetValue(30.0f);
3644 float relativeValue(targetValue - startValue);
3646 animation.AnimateTo(Property(actor, index),
3648 TimePeriod(delay, durationSeconds - delay));
3650 // Start the animation
3653 bool signalReceived(false);
3654 AnimationFinishCheck finishCheck(signalReceived);
3655 animation.FinishedSignal().Connect(&application, finishCheck);
3657 application.SendNotification();
3658 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3660 // We didn't expect the animation to finish yet
3661 application.SendNotification();
3662 finishCheck.CheckSignalNotReceived();
3663 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3665 application.SendNotification();
3666 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3668 // We didn't expect the animation to finish yet
3669 application.SendNotification();
3670 finishCheck.CheckSignalNotReceived();
3671 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3673 application.SendNotification();
3674 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3676 // We did expect the animation to finish
3677 application.SendNotification();
3678 finishCheck.CheckSignalReceived();
3679 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3683 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriod(void)
3685 TestApplication application;
3687 Actor actor = Actor::New();
3689 // Register a float property
3690 float startValue(10.0f);
3691 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3692 Stage::GetCurrent().Add(actor);
3693 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3695 // Build the animation
3696 float durationSeconds(1.0f);
3697 Animation animation = Animation::New(durationSeconds);
3698 float targetValue(30.0f);
3699 float relativeValue(targetValue - startValue);
3701 animation.AnimateTo(Property(actor, index),
3703 AlphaFunctions::Linear,
3704 TimePeriod(delay, durationSeconds - delay));
3706 // Start the animation
3709 bool signalReceived(false);
3710 AnimationFinishCheck finishCheck(signalReceived);
3711 animation.FinishedSignal().Connect(&application, finishCheck);
3713 application.SendNotification();
3714 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3716 // We didn't expect the animation to finish yet
3717 application.SendNotification();
3718 finishCheck.CheckSignalNotReceived();
3719 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3721 application.SendNotification();
3722 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3724 // We didn't expect the animation to finish yet
3725 application.SendNotification();
3726 finishCheck.CheckSignalNotReceived();
3727 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3729 application.SendNotification();
3730 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3732 // We did expect the animation to finish
3733 application.SendNotification();
3734 finishCheck.CheckSignalReceived();
3735 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3739 int UtcDaliAnimationAnimateToInteger(void)
3741 TestApplication application;
3743 Actor actor = Actor::New();
3745 // Register an integer property
3747 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3748 Stage::GetCurrent().Add(actor);
3749 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3751 // Build the animation
3752 float durationSeconds(2.0f);
3753 Animation animation = Animation::New(durationSeconds);
3754 int targetValue(50);
3755 int relativeValue(targetValue - startValue);
3756 animation.AnimateTo(Property(actor, "test-property"), targetValue);
3758 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3760 // Start the animation
3763 bool signalReceived(false);
3764 AnimationFinishCheck finishCheck(signalReceived);
3765 animation.FinishedSignal().Connect(&application, finishCheck);
3767 application.SendNotification();
3768 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3770 // We didn't expect the animation to finish yet
3771 application.SendNotification();
3772 finishCheck.CheckSignalNotReceived();
3773 DALI_TEST_EQUALS( actor.GetProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION );
3775 application.SendNotification();
3776 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3778 // We did expect the animation to finish
3779 application.SendNotification();
3780 finishCheck.CheckSignalReceived();
3781 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3785 int UtcDaliAnimationAnimateToIntegerAlphaFunction(void)
3787 TestApplication application;
3789 Actor actor = Actor::New();
3791 // Register an integer property
3793 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3794 Stage::GetCurrent().Add(actor);
3795 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3797 // Build the animation
3798 float durationSeconds(1.0f);
3799 Animation animation = Animation::New(durationSeconds);
3800 int targetValue(90);
3801 int relativeValue(targetValue - startValue);
3802 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunctions::EaseOut);
3804 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3806 // Start the animation
3809 bool signalReceived(false);
3810 AnimationFinishCheck finishCheck(signalReceived);
3811 animation.FinishedSignal().Connect(&application, finishCheck);
3813 application.SendNotification();
3814 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3816 // We didn't expect the animation to finish yet
3817 application.SendNotification();
3818 finishCheck.CheckSignalNotReceived();
3820 // The position should have moved more, than with a linear alpha function
3821 int current(actor.GetProperty<int>(index));
3822 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3824 application.SendNotification();
3825 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3827 // We did expect the animation to finish
3828 application.SendNotification();
3829 finishCheck.CheckSignalReceived();
3830 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3834 int UtcDaliAnimationAnimateToIntegerTimePeriod(void)
3836 TestApplication application;
3838 Actor actor = Actor::New();
3840 // Register an integer property
3842 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3843 Stage::GetCurrent().Add(actor);
3844 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3846 // Build the animation
3847 float durationSeconds(1.0f);
3848 Animation animation = Animation::New(durationSeconds);
3849 int targetValue(30);
3850 int relativeValue(targetValue - startValue);
3852 animation.AnimateTo(Property(actor, index),
3854 TimePeriod(delay, durationSeconds - delay));
3856 // Start the animation
3859 bool signalReceived(false);
3860 AnimationFinishCheck finishCheck(signalReceived);
3861 animation.FinishedSignal().Connect(&application, finishCheck);
3863 application.SendNotification();
3864 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3866 // We didn't expect the animation to finish yet
3867 application.SendNotification();
3868 finishCheck.CheckSignalNotReceived();
3869 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3871 application.SendNotification();
3872 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3874 // We didn't expect the animation to finish yet
3875 application.SendNotification();
3876 finishCheck.CheckSignalNotReceived();
3877 DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3879 application.SendNotification();
3880 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3882 // We did expect the animation to finish
3883 application.SendNotification();
3884 finishCheck.CheckSignalReceived();
3885 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3889 int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriod(void)
3891 TestApplication application;
3893 Actor actor = Actor::New();
3895 // Register an integer property
3897 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3898 Stage::GetCurrent().Add(actor);
3899 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3901 // Build the animation
3902 float durationSeconds(1.0f);
3903 Animation animation = Animation::New(durationSeconds);
3904 int targetValue(30);
3905 int relativeValue(targetValue - startValue);
3907 animation.AnimateTo(Property(actor, index),
3909 AlphaFunctions::Linear,
3910 TimePeriod(delay, durationSeconds - delay));
3912 // Start the animation
3915 bool signalReceived(false);
3916 AnimationFinishCheck finishCheck(signalReceived);
3917 animation.FinishedSignal().Connect(&application, finishCheck);
3919 application.SendNotification();
3920 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3922 // We didn't expect the animation to finish yet
3923 application.SendNotification();
3924 finishCheck.CheckSignalNotReceived();
3925 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3927 application.SendNotification();
3928 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3930 // We didn't expect the animation to finish yet
3931 application.SendNotification();
3932 finishCheck.CheckSignalNotReceived();
3933 DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3935 application.SendNotification();
3936 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3938 // We did expect the animation to finish
3939 application.SendNotification();
3940 finishCheck.CheckSignalReceived();
3941 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3945 int UtcDaliAnimationAnimateToVector2(void)
3947 TestApplication application;
3949 Actor actor = Actor::New();
3951 // Register a Vector2 property
3952 Vector2 startValue(-50.0f, -50.0f);
3953 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3954 Stage::GetCurrent().Add(actor);
3955 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3957 // Build the animation
3958 float durationSeconds(2.0f);
3959 Animation animation = Animation::New(durationSeconds);
3960 Vector2 targetValue(50.0f, 50.0f);
3961 Vector2 relativeValue(targetValue - startValue);
3962 animation.AnimateTo(Property(actor, index), targetValue);
3964 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3966 // Start the animation
3969 bool signalReceived(false);
3970 AnimationFinishCheck finishCheck(signalReceived);
3971 animation.FinishedSignal().Connect(&application, finishCheck);
3973 application.SendNotification();
3974 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3976 // We didn't expect the animation to finish yet
3977 application.SendNotification();
3978 finishCheck.CheckSignalNotReceived();
3979 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION );
3981 application.SendNotification();
3982 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3984 // We did expect the animation to finish
3985 application.SendNotification();
3986 finishCheck.CheckSignalReceived();
3987 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3991 int UtcDaliAnimationAnimateToVector2AlphaFunction(void)
3993 TestApplication application;
3995 Actor actor = Actor::New();
3997 // Register a Vector2 property
3998 Vector2 startValue(1000.0f, 1000.0f);
3999 Property::Index index = actor.RegisterProperty( "test-property", startValue );
4000 Stage::GetCurrent().Add(actor);
4001 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
4003 // Build the animation
4004 float durationSeconds(1.0f);
4005 Animation animation = Animation::New(durationSeconds);
4006 Vector2 targetValue(9000.0f, 9000.0f);
4007 Vector2 relativeValue(targetValue - startValue);
4008 animation.AnimateTo(Property(actor, "test-property"), targetValue, AlphaFunctions::EaseOut);
4010 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4012 // Start the animation
4015 bool signalReceived(false);
4016 AnimationFinishCheck finishCheck(signalReceived);
4017 animation.FinishedSignal().Connect(&application, finishCheck);
4019 application.SendNotification();
4020 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4022 // We didn't expect the animation to finish yet
4023 application.SendNotification();
4024 finishCheck.CheckSignalNotReceived();
4026 // The position should have moved more, than with a linear alpha function
4027 Vector2 current(actor.GetProperty<Vector2>(index));
4028 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
4029 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
4031 application.SendNotification();
4032 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4034 // We did expect the animation to finish
4035 application.SendNotification();
4036 finishCheck.CheckSignalReceived();
4037 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
4041 int UtcDaliAnimationAnimateToVector2TimePeriod(void)
4043 TestApplication application;
4045 Actor actor = Actor::New();
4047 // Register a Vector2 property
4048 Vector2 startValue(10.0f, 10.0f);
4049 Property::Index index = actor.RegisterProperty( "test-property", startValue );
4050 Stage::GetCurrent().Add(actor);
4051 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
4053 // Build the animation
4054 float durationSeconds(1.0f);
4055 Animation animation = Animation::New(durationSeconds);
4056 Vector2 targetValue(-10.0f, 20.0f);
4057 Vector2 relativeValue(targetValue - startValue);
4059 animation.AnimateTo(Property(actor, index),
4061 TimePeriod(delay, durationSeconds - delay));
4063 // Start the animation
4066 bool signalReceived(false);
4067 AnimationFinishCheck finishCheck(signalReceived);
4068 animation.FinishedSignal().Connect(&application, finishCheck);
4070 application.SendNotification();
4071 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4073 // We didn't expect the animation to finish yet
4074 application.SendNotification();
4075 finishCheck.CheckSignalNotReceived();
4076 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
4078 application.SendNotification();
4079 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4081 // We didn't expect the animation to finish yet
4082 application.SendNotification();
4083 finishCheck.CheckSignalNotReceived();
4084 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
4086 application.SendNotification();
4087 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4089 // We did expect the animation to finish
4090 application.SendNotification();
4091 finishCheck.CheckSignalReceived();
4092 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
4096 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriod(void)
4098 TestApplication application;
4100 Actor actor = Actor::New();
4102 // Register a Vector2 property
4103 Vector2 startValue(10.0f, 10.0f);
4104 Property::Index index = actor.RegisterProperty( "test-property", startValue );
4105 Stage::GetCurrent().Add(actor);
4106 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
4108 // Build the animation
4109 float durationSeconds(1.0f);
4110 Animation animation = Animation::New(durationSeconds);
4111 Vector2 targetValue(30.0f, 30.0f);
4112 Vector2 relativeValue(targetValue - startValue);
4114 animation.AnimateTo(Property(actor, index),
4116 AlphaFunctions::Linear,
4117 TimePeriod(delay, durationSeconds - delay));
4119 // Start the animation
4122 bool signalReceived(false);
4123 AnimationFinishCheck finishCheck(signalReceived);
4124 animation.FinishedSignal().Connect(&application, finishCheck);
4126 application.SendNotification();
4127 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4129 // We didn't expect the animation to finish yet
4130 application.SendNotification();
4131 finishCheck.CheckSignalNotReceived();
4132 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
4134 application.SendNotification();
4135 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4137 // We didn't expect the animation to finish yet
4138 application.SendNotification();
4139 finishCheck.CheckSignalNotReceived();
4140 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
4142 application.SendNotification();
4143 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4145 // We did expect the animation to finish
4146 application.SendNotification();
4147 finishCheck.CheckSignalReceived();
4148 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
4152 int UtcDaliAnimationAnimateToVector3(void)
4154 TestApplication application;
4156 Actor actor = Actor::New();
4158 // Register a Vector3 property
4159 Vector3 startValue(-50.0f, -50.0f, -50.0f);
4160 Property::Index index = actor.RegisterProperty( "test-property", startValue );
4161 Stage::GetCurrent().Add(actor);
4162 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4164 // Build the animation
4165 float durationSeconds(2.0f);
4166 Animation animation = Animation::New(durationSeconds);
4167 Vector3 targetValue(50.0f, 50.0f, 50.0f);
4168 Vector3 relativeValue(targetValue - startValue);
4169 animation.AnimateTo(Property(actor, index), targetValue);
4171 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4173 // Start the animation
4176 bool signalReceived(false);
4177 AnimationFinishCheck finishCheck(signalReceived);
4178 animation.FinishedSignal().Connect(&application, finishCheck);
4180 application.SendNotification();
4181 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4183 // We didn't expect the animation to finish yet
4184 application.SendNotification();
4185 finishCheck.CheckSignalNotReceived();
4186 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION );
4188 application.SendNotification();
4189 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4191 // We did expect the animation to finish
4192 application.SendNotification();
4193 finishCheck.CheckSignalReceived();
4194 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
4198 int UtcDaliAnimationAnimateToVector3AlphaFunction(void)
4200 TestApplication application;
4202 Actor actor = Actor::New();
4204 // Register a Vector3 property
4205 Vector3 startValue(1000.0f, 1000.0f, 1000.0f);
4206 Property::Index index = actor.RegisterProperty( "test-property", startValue );
4207 Stage::GetCurrent().Add(actor);
4208 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4210 // Build the animation
4211 float durationSeconds(1.0f);
4212 Animation animation = Animation::New(durationSeconds);
4213 Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
4214 Vector3 relativeValue(targetValue - startValue);
4215 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunctions::EaseOut);
4217 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4219 // Start the animation
4222 bool signalReceived(false);
4223 AnimationFinishCheck finishCheck(signalReceived);
4224 animation.FinishedSignal().Connect(&application, finishCheck);
4226 application.SendNotification();
4227 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4229 // We didn't expect the animation to finish yet
4230 application.SendNotification();
4231 finishCheck.CheckSignalNotReceived();
4233 // The position should have moved more, than with a linear alpha function
4234 Vector3 current(actor.GetProperty<Vector3>(index));
4235 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
4236 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
4237 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
4239 application.SendNotification();
4240 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4242 // We did expect the animation to finish
4243 application.SendNotification();
4244 finishCheck.CheckSignalReceived();
4245 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
4249 int UtcDaliAnimationAnimateToVector3TimePeriod(void)
4251 TestApplication application;
4253 Actor actor = Actor::New();
4255 // Register a Vector3 property
4256 Vector3 startValue(10.0f, 10.0f, 10.0f);
4257 Property::Index index = actor.RegisterProperty( "test-property", startValue );
4258 Stage::GetCurrent().Add(actor);
4259 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4261 // Build the animation
4262 float durationSeconds(1.0f);
4263 Animation animation = Animation::New(durationSeconds);
4264 Vector3 targetValue(-10.0f, 20.0f, 100.0f);
4265 Vector3 relativeValue(targetValue - startValue);
4267 animation.AnimateTo(Property(actor, index),
4269 TimePeriod(delay, durationSeconds - delay));
4271 // Start the animation
4274 bool signalReceived(false);
4275 AnimationFinishCheck finishCheck(signalReceived);
4276 animation.FinishedSignal().Connect(&application, finishCheck);
4278 application.SendNotification();
4279 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4281 // We didn't expect the animation to finish yet
4282 application.SendNotification();
4283 finishCheck.CheckSignalNotReceived();
4284 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4286 application.SendNotification();
4287 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4289 // We didn't expect the animation to finish yet
4290 application.SendNotification();
4291 finishCheck.CheckSignalNotReceived();
4292 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
4294 application.SendNotification();
4295 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4297 // We did expect the animation to finish
4298 application.SendNotification();
4299 finishCheck.CheckSignalReceived();
4300 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
4304 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriod(void)
4306 TestApplication application;
4308 Actor actor = Actor::New();
4310 // Register a Vector3 property
4311 Vector3 startValue(10.0f, 10.0f, 10.0f);
4312 Property::Index index = actor.RegisterProperty( "test-property", startValue );
4313 Stage::GetCurrent().Add(actor);
4314 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4316 // Build the animation
4317 float durationSeconds(1.0f);
4318 Animation animation = Animation::New(durationSeconds);
4319 Vector3 targetValue(30.0f, 30.0f, 30.0f);
4320 Vector3 relativeValue(targetValue - startValue);
4322 animation.AnimateTo(Property(actor, "test-property"),
4324 AlphaFunctions::Linear,
4325 TimePeriod(delay, durationSeconds - delay));
4327 // Start the animation
4330 bool signalReceived(false);
4331 AnimationFinishCheck finishCheck(signalReceived);
4332 animation.FinishedSignal().Connect(&application, finishCheck);
4334 application.SendNotification();
4335 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4337 // We didn't expect the animation to finish yet
4338 application.SendNotification();
4339 finishCheck.CheckSignalNotReceived();
4340 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4342 application.SendNotification();
4343 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4345 // We didn't expect the animation to finish yet
4346 application.SendNotification();
4347 finishCheck.CheckSignalNotReceived();
4348 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
4350 application.SendNotification();
4351 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4353 // We did expect the animation to finish
4354 application.SendNotification();
4355 finishCheck.CheckSignalReceived();
4356 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
4360 int UtcDaliAnimationAnimateToVector3Component(void)
4362 TestApplication application;
4364 Actor actor = Actor::New();
4366 // Register a Vector3 property
4367 Vector3 startValue(10.0f, 10.0f, 10.0f);
4368 Property::Index index = actor.RegisterProperty( "test-property", startValue );
4369 Stage::GetCurrent().Add(actor);
4370 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4372 // Build the animation
4373 float durationSeconds(1.0f);
4374 Animation animation = Animation::New(durationSeconds);
4375 Vector3 targetValue(30.0f, 30.0f, 10.0f);
4376 Vector3 relativeValue(targetValue - startValue);
4378 animation.AnimateTo(Property(actor, "test-property", 0),
4380 AlphaFunctions::Linear,
4381 TimePeriod(delay, durationSeconds - delay));
4382 animation.AnimateTo(Property(actor, index, 1),
4384 AlphaFunctions::Linear,
4385 TimePeriod(delay, durationSeconds - delay));
4387 // Start the animation
4390 bool signalReceived(false);
4391 AnimationFinishCheck finishCheck(signalReceived);
4392 animation.FinishedSignal().Connect(&application, finishCheck);
4394 application.SendNotification();
4395 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4397 // We didn't expect the animation to finish yet
4398 application.SendNotification();
4399 finishCheck.CheckSignalNotReceived();
4400 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4402 application.SendNotification();
4403 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4405 // We didn't expect the animation to finish yet
4406 application.SendNotification();
4407 finishCheck.CheckSignalNotReceived();
4408 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
4410 application.SendNotification();
4411 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4413 // We did expect the animation to finish
4414 application.SendNotification();
4415 finishCheck.CheckSignalReceived();
4416 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
4420 int UtcDaliAnimationAnimateToVector4(void)
4422 TestApplication application;
4424 Actor actor = Actor::New();
4426 // Register a Vector4 property
4427 Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f);
4428 Property::Index index = actor.RegisterProperty( "test-property", startValue );
4429 Stage::GetCurrent().Add(actor);
4430 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4432 // Build the animation
4433 float durationSeconds(2.0f);
4434 Animation animation = Animation::New(durationSeconds);
4435 Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f);
4436 Vector4 relativeValue(targetValue - startValue);
4437 animation.AnimateTo(Property(actor, index), targetValue);
4439 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4441 // Start the animation
4444 bool signalReceived(false);
4445 AnimationFinishCheck finishCheck(signalReceived);
4446 animation.FinishedSignal().Connect(&application, finishCheck);
4448 application.SendNotification();
4449 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4451 // We didn't expect the animation to finish yet
4452 application.SendNotification();
4453 finishCheck.CheckSignalNotReceived();
4454 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION );
4456 application.SendNotification();
4457 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4459 // We did expect the animation to finish
4460 application.SendNotification();
4461 finishCheck.CheckSignalReceived();
4462 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4466 int UtcDaliAnimationAnimateToVector4AlphaFunction(void)
4468 TestApplication application;
4470 Actor actor = Actor::New();
4472 // Register a Vector4 property
4473 Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
4474 Property::Index index = actor.RegisterProperty( "test-property", startValue );
4475 Stage::GetCurrent().Add(actor);
4476 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4478 // Build the animation
4479 float durationSeconds(1.0f);
4480 Animation animation = Animation::New(durationSeconds);
4481 Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
4482 Vector4 relativeValue(targetValue - startValue);
4483 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunctions::EaseOut);
4485 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4487 // Start the animation
4490 bool signalReceived(false);
4491 AnimationFinishCheck finishCheck(signalReceived);
4492 animation.FinishedSignal().Connect(&application, finishCheck);
4494 application.SendNotification();
4495 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4497 // We didn't expect the animation to finish yet
4498 application.SendNotification();
4499 finishCheck.CheckSignalNotReceived();
4501 // The position should have moved more, than with a linear alpha function
4502 Vector4 current(actor.GetProperty<Vector4>(index));
4503 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
4504 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
4505 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
4506 DALI_TEST_CHECK( current.w > ninetyFivePercentProgress.w );
4508 application.SendNotification();
4509 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4511 // We did expect the animation to finish
4512 application.SendNotification();
4513 finishCheck.CheckSignalReceived();
4514 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4518 int UtcDaliAnimationAnimateToVector4TimePeriod(void)
4520 TestApplication application;
4522 Actor actor = Actor::New();
4524 // Register a Vector4 property
4525 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4526 Property::Index index = actor.RegisterProperty( "test-property", startValue );
4527 Stage::GetCurrent().Add(actor);
4528 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION );
4530 // Build the animation
4531 float durationSeconds(1.0f);
4532 Animation animation = Animation::New(durationSeconds);
4533 Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
4534 Vector4 relativeValue(targetValue - startValue);
4536 animation.AnimateTo(Property(actor, index),
4538 TimePeriod(delay, durationSeconds - delay));
4540 // Start the animation
4543 bool signalReceived(false);
4544 AnimationFinishCheck finishCheck(signalReceived);
4545 animation.FinishedSignal().Connect(&application, finishCheck);
4547 application.SendNotification();
4548 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4550 // We didn't expect the animation to finish yet
4551 application.SendNotification();
4552 finishCheck.CheckSignalNotReceived();
4553 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION );
4555 application.SendNotification();
4556 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4558 // We didn't expect the animation to finish yet
4559 application.SendNotification();
4560 finishCheck.CheckSignalNotReceived();
4561 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), VECTOR4_EPSILON, TEST_LOCATION );
4563 application.SendNotification();
4564 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4566 // We did expect the animation to finish
4567 application.SendNotification();
4568 finishCheck.CheckSignalReceived();
4569 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, VECTOR4_EPSILON, TEST_LOCATION );
4573 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriod(void)
4575 TestApplication application;
4577 Actor actor = Actor::New();
4579 // Register a Vector4 property
4580 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4581 Property::Index index = actor.RegisterProperty( "test-property", startValue );
4582 Stage::GetCurrent().Add(actor);
4583 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4585 // Build the animation
4586 float durationSeconds(1.0f);
4587 Animation animation = Animation::New(durationSeconds);
4588 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
4589 Vector4 relativeValue(targetValue - startValue);
4591 animation.AnimateTo(Property(actor, index),
4593 AlphaFunctions::Linear,
4594 TimePeriod(delay, durationSeconds - delay));
4596 // Start the animation
4599 bool signalReceived(false);
4600 AnimationFinishCheck finishCheck(signalReceived);
4601 animation.FinishedSignal().Connect(&application, finishCheck);
4603 application.SendNotification();
4604 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4606 // We didn't expect the animation to finish yet
4607 application.SendNotification();
4608 finishCheck.CheckSignalNotReceived();
4609 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4611 application.SendNotification();
4612 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4614 // We didn't expect the animation to finish yet
4615 application.SendNotification();
4616 finishCheck.CheckSignalNotReceived();
4617 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
4619 application.SendNotification();
4620 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4622 // We did expect the animation to finish
4623 application.SendNotification();
4624 finishCheck.CheckSignalReceived();
4625 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4629 int UtcDaliAnimationAnimateToActorParentOrigin(void)
4631 TestApplication application;
4633 Actor actor = Actor::New();
4634 Stage::GetCurrent().Add(actor);
4635 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_LEFT, TEST_LOCATION );
4637 // Build the animation
4638 float durationSeconds(1.0f);
4639 Animation animation = Animation::New(durationSeconds);
4640 Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
4644 animation.AnimateTo( Property(actor, Actor::PARENT_ORIGIN), targetParentOrigin );
4646 catch (Dali::DaliException& e)
4648 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
4649 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
4654 int UtcDaliAnimationAnimateToActorParentOriginX(void)
4656 TestApplication application;
4658 Actor actor = Actor::New();
4659 Stage::GetCurrent().Add(actor);
4660 float startValue(0.0f);
4661 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().x, startValue, TEST_LOCATION );
4662 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::PARENT_ORIGIN_X), startValue, TEST_LOCATION );
4664 // Build the animation
4665 float durationSeconds(1.0f);
4666 Animation animation = Animation::New(durationSeconds);
4667 float targetX(1.0f);
4671 animation.AnimateTo( Property(actor, Actor::PARENT_ORIGIN_X), targetX );
4673 catch (Dali::DaliException& e)
4675 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
4676 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
4681 int UtcDaliAnimationAnimateToActorParentOriginY(void)
4683 TestApplication application;
4685 Actor actor = Actor::New();
4686 Stage::GetCurrent().Add(actor);
4687 float startValue(0.0f);
4688 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().y, startValue, TEST_LOCATION );
4689 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::PARENT_ORIGIN_Y), startValue, TEST_LOCATION );
4691 // Build the animation
4692 float durationSeconds(1.0f);
4693 Animation animation = Animation::New(durationSeconds);
4694 float targetY(1.0f);
4698 animation.AnimateTo( Property(actor, Actor::PARENT_ORIGIN_Y), targetY );
4700 catch (Dali::DaliException& e)
4702 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
4703 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
4708 int UtcDaliAnimationAnimateToActorParentOriginZ(void)
4710 TestApplication application;
4712 Actor actor = Actor::New();
4713 Stage::GetCurrent().Add(actor);
4714 float startValue(0.5f);
4715 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().z, startValue, TEST_LOCATION );
4716 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::PARENT_ORIGIN_Z), startValue, TEST_LOCATION );
4718 // Build the animation
4719 float durationSeconds(1.0f);
4720 Animation animation = Animation::New(durationSeconds);
4721 float targetZ(1.0f);
4725 animation.AnimateTo( Property(actor, Actor::PARENT_ORIGIN_Z), targetZ );
4727 catch (Dali::DaliException& e)
4729 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
4730 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
4735 int UtcDaliAnimationAnimateToActorAnchorPoint(void)
4737 TestApplication application;
4739 Actor actor = Actor::New();
4740 Stage::GetCurrent().Add(actor);
4741 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), AnchorPoint::CENTER, TEST_LOCATION );
4743 // Build the animation
4744 float durationSeconds(1.0f);
4745 Animation animation = Animation::New(durationSeconds);
4746 Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT);
4750 animation.AnimateTo( Property(actor, Actor::ANCHOR_POINT), targetAnchorPoint);
4752 catch (Dali::DaliException& e)
4754 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
4755 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
4760 int UtcDaliAnimationAnimateToActorAnchorPointX(void)
4762 TestApplication application;
4764 Actor actor = Actor::New();
4765 Stage::GetCurrent().Add(actor);
4766 float startValue(0.5f);
4767 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().x, startValue, TEST_LOCATION );
4768 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::ANCHOR_POINT_X), startValue, TEST_LOCATION );
4770 // Build the animation
4771 float durationSeconds(1.0f);
4772 Animation animation = Animation::New(durationSeconds);
4773 float targetX(1.0f);
4777 animation.AnimateTo( Property(actor, Actor::ANCHOR_POINT_X), targetX );
4779 catch (Dali::DaliException& e)
4781 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
4782 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
4787 int UtcDaliAnimationAnimateToActorAnchorPointY(void)
4789 TestApplication application;
4791 Actor actor = Actor::New();
4792 Stage::GetCurrent().Add(actor);
4793 float startValue(0.5f);
4794 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().y, startValue, TEST_LOCATION );
4795 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::ANCHOR_POINT_Y), startValue, TEST_LOCATION );
4797 // Build the animation
4798 float durationSeconds(1.0f);
4799 Animation animation = Animation::New(durationSeconds);
4800 float targetY(0.0f);
4804 animation.AnimateTo( Property(actor, Actor::ANCHOR_POINT_Y), targetY );
4806 catch (Dali::DaliException& e)
4808 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
4809 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
4814 int UtcDaliAnimationAnimateToActorAnchorPointZ(void)
4816 TestApplication application;
4818 Actor actor = Actor::New();
4819 Stage::GetCurrent().Add(actor);
4820 float startValue(0.5f);
4821 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().z, startValue, TEST_LOCATION );
4822 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::ANCHOR_POINT_Z), startValue, TEST_LOCATION );
4824 // Build the animation
4825 float durationSeconds(1.0f);
4826 Animation animation = Animation::New(durationSeconds);
4827 float targetZ(100.0f);
4831 animation.AnimateTo( Property(actor, Actor::ANCHOR_POINT_Z), targetZ );
4833 catch (Dali::DaliException& e)
4835 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
4836 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
4841 int UtcDaliAnimationAnimateToActorSize(void)
4843 TestApplication application;
4845 Actor actor = Actor::New();
4846 Stage::GetCurrent().Add(actor);
4847 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
4849 // Build the animation
4850 float durationSeconds(1.0f);
4851 Animation animation = Animation::New(durationSeconds);
4852 Vector3 targetSize(100.0f, 100.0f, 100.0f);
4853 animation.AnimateTo( Property(actor, Actor::SIZE), targetSize );
4855 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
4857 // Start the animation
4860 bool signalReceived(false);
4861 AnimationFinishCheck finishCheck(signalReceived);
4862 animation.FinishedSignal().Connect(&application, finishCheck);
4864 application.SendNotification();
4865 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4867 // We didn't expect the animation to finish yet
4868 application.SendNotification();
4869 finishCheck.CheckSignalNotReceived();
4870 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
4872 application.SendNotification();
4873 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4875 // We did expect the animation to finish
4876 application.SendNotification();
4877 finishCheck.CheckSignalReceived();
4878 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
4881 finishCheck.Reset();
4882 actor.SetSize(Vector3::ZERO);
4883 application.SendNotification();
4884 application.Render(0);
4885 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
4887 // Repeat with a different (ease-in) alpha function
4888 animation = Animation::New(durationSeconds);
4889 animation.AnimateTo( Property(actor, Actor::SIZE), targetSize, AlphaFunctions::EaseIn);
4890 animation.FinishedSignal().Connect(&application, finishCheck);
4893 application.SendNotification();
4894 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4896 // We didn't expect the animation to finish yet
4897 application.SendNotification();
4898 finishCheck.CheckSignalNotReceived();
4900 // The size should have travelled less, than with a linear alpha function
4901 Vector3 current(actor.GetCurrentSize());
4902 DALI_TEST_CHECK( current.x > 0.0f );
4903 DALI_TEST_CHECK( current.y > 0.0f );
4904 DALI_TEST_CHECK( current.z > 0.0f );
4905 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
4906 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
4907 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
4909 application.SendNotification();
4910 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4912 // We did expect the animation to finish
4913 application.SendNotification();
4914 finishCheck.CheckSignalReceived();
4915 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
4918 finishCheck.Reset();
4919 actor.SetSize(Vector3::ZERO);
4920 application.SendNotification();
4921 application.Render(0);
4922 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
4924 // Repeat with a delay
4926 animation = Animation::New(durationSeconds);
4927 animation.AnimateTo( Property(actor, Actor::SIZE), targetSize, AlphaFunctions::Linear, TimePeriod(delay, durationSeconds - delay));
4928 animation.FinishedSignal().Connect(&application, finishCheck);
4931 application.SendNotification();
4932 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4934 // We didn't expect the animation to finish yet
4935 application.SendNotification();
4936 finishCheck.CheckSignalNotReceived();
4937 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
4939 application.SendNotification();
4940 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4942 // We did expect the animation to finish
4943 application.SendNotification();
4944 finishCheck.CheckSignalReceived();
4945 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
4949 int UtcDaliAnimationAnimateToActorSizeWidth(void)
4951 TestApplication application;
4953 Actor actor = Actor::New();
4954 Stage::GetCurrent().Add(actor);
4955 float startValue(0.0f);
4956 DALI_TEST_EQUALS( actor.GetCurrentSize().width, startValue, TEST_LOCATION );
4957 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_WIDTH), startValue, TEST_LOCATION );
4959 // Build the animation
4960 float durationSeconds(1.0f);
4961 Animation animation = Animation::New(durationSeconds);
4962 float targetWidth(10.0f);
4963 animation.AnimateTo( Property(actor, Actor::SIZE_WIDTH), targetWidth );
4965 float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f);
4967 // Start the animation
4970 bool signalReceived(false);
4971 AnimationFinishCheck finishCheck(signalReceived);
4972 animation.FinishedSignal().Connect(&application, finishCheck);
4974 application.SendNotification();
4975 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
4977 // We didn't expect the animation to finish yet
4978 application.SendNotification();
4979 finishCheck.CheckSignalNotReceived();
4980 DALI_TEST_EQUALS( actor.GetCurrentSize().width, fiftyPercentProgress, TEST_LOCATION );
4981 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_WIDTH), fiftyPercentProgress, TEST_LOCATION );
4983 application.SendNotification();
4984 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4986 // We did expect the animation to finish
4987 application.SendNotification();
4988 finishCheck.CheckSignalReceived();
4989 DALI_TEST_EQUALS( actor.GetCurrentSize().width, targetWidth, TEST_LOCATION );
4990 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_WIDTH), targetWidth, TEST_LOCATION );
4994 int UtcDaliAnimationAnimateToActorSizeHeight(void)
4996 TestApplication application;
4998 Actor actor = Actor::New();
4999 Stage::GetCurrent().Add(actor);
5000 float startValue(0.0f);
5001 DALI_TEST_EQUALS( actor.GetCurrentSize().height, startValue, TEST_LOCATION );
5002 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_HEIGHT), startValue, TEST_LOCATION );
5004 // Build the animation
5005 float durationSeconds(1.0f);
5006 Animation animation = Animation::New(durationSeconds);
5007 float targetHeight(-10.0f);
5008 animation.AnimateTo( Property(actor, Actor::SIZE_HEIGHT), targetHeight );
5010 float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f);
5012 // Start the animation
5015 bool signalReceived(false);
5016 AnimationFinishCheck finishCheck(signalReceived);
5017 animation.FinishedSignal().Connect(&application, finishCheck);
5019 application.SendNotification();
5020 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5022 // We didn't expect the animation to finish yet
5023 application.SendNotification();
5024 finishCheck.CheckSignalNotReceived();
5025 DALI_TEST_EQUALS( actor.GetCurrentSize().height, fiftyPercentProgress, TEST_LOCATION );
5026 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_HEIGHT), fiftyPercentProgress, TEST_LOCATION );
5028 application.SendNotification();
5029 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5031 // We did expect the animation to finish
5032 application.SendNotification();
5033 finishCheck.CheckSignalReceived();
5034 DALI_TEST_EQUALS( actor.GetCurrentSize().height, targetHeight, TEST_LOCATION );
5035 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_HEIGHT), targetHeight, TEST_LOCATION );
5039 int UtcDaliAnimationAnimateToActorSizeDepth(void)
5041 TestApplication application;
5043 Actor actor = Actor::New();
5044 Stage::GetCurrent().Add(actor);
5045 float startValue(0.0f);
5046 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, startValue, TEST_LOCATION );
5047 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_DEPTH), startValue, TEST_LOCATION );
5049 // Build the animation
5050 float durationSeconds(1.0f);
5051 Animation animation = Animation::New(durationSeconds);
5052 float targetDepth(-10.0f);
5053 animation.AnimateTo( Property(actor, Actor::SIZE_DEPTH), targetDepth );
5055 float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f);
5057 // Start the animation
5060 bool signalReceived(false);
5061 AnimationFinishCheck finishCheck(signalReceived);
5062 animation.FinishedSignal().Connect(&application, finishCheck);
5064 application.SendNotification();
5065 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5067 // We didn't expect the animation to finish yet
5068 application.SendNotification();
5069 finishCheck.CheckSignalNotReceived();
5070 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, fiftyPercentProgress, TEST_LOCATION );
5071 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_DEPTH), fiftyPercentProgress, TEST_LOCATION );
5073 application.SendNotification();
5074 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5076 // We did expect the animation to finish
5077 application.SendNotification();
5078 finishCheck.CheckSignalReceived();
5079 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, targetDepth, TEST_LOCATION );
5080 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_DEPTH), targetDepth, TEST_LOCATION );
5084 int UtcDaliAnimationAnimateToActorPosition(void)
5086 TestApplication application;
5088 Actor actor = Actor::New();
5089 Stage::GetCurrent().Add(actor);
5090 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
5092 // Build the animation
5093 float durationSeconds(1.0f);
5094 Animation animation = Animation::New(durationSeconds);
5095 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
5096 animation.AnimateTo(Property(actor, Actor::POSITION), targetPosition);
5098 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
5100 // Start the animation
5103 bool signalReceived(false);
5104 AnimationFinishCheck finishCheck(signalReceived);
5105 animation.FinishedSignal().Connect(&application, finishCheck);
5107 application.SendNotification();
5108 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
5110 // We didn't expect the animation to finish yet
5111 application.SendNotification();
5112 finishCheck.CheckSignalNotReceived();
5113 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
5115 application.SendNotification();
5116 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5118 // We did expect the animation to finish
5119 application.SendNotification();
5120 finishCheck.CheckSignalReceived();
5121 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
5125 int UtcDaliAnimationAnimateToActorPositionX(void)
5127 TestApplication application;
5129 Actor actor = Actor::New();
5130 Stage::GetCurrent().Add(actor);
5131 float startValue(0.0f);
5132 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, startValue, TEST_LOCATION );
5133 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), startValue, TEST_LOCATION );
5134 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), startValue, TEST_LOCATION );
5135 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), startValue, TEST_LOCATION );
5137 // Build the animation
5138 float durationSeconds(1.0f);
5139 Animation animation = Animation::New(durationSeconds);
5140 float targetX(1.0f);
5141 animation.AnimateTo( Property(actor, Actor::POSITION_X), targetX );
5143 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
5145 // Start the animation
5148 bool signalReceived(false);
5149 AnimationFinishCheck finishCheck(signalReceived);
5150 animation.FinishedSignal().Connect(&application, finishCheck);
5152 application.SendNotification();
5153 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5155 // We didn't expect the animation to finish yet
5156 application.SendNotification();
5157 finishCheck.CheckSignalNotReceived();
5158 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, fiftyPercentProgress, TEST_LOCATION );
5159 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), fiftyPercentProgress, TEST_LOCATION );
5160 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), startValue, TEST_LOCATION );
5161 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), startValue, TEST_LOCATION );
5163 application.SendNotification();
5164 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5166 // We did expect the animation to finish
5167 application.SendNotification();
5168 finishCheck.CheckSignalReceived();
5169 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, targetX, TEST_LOCATION );
5170 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), targetX, TEST_LOCATION );
5171 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), startValue, TEST_LOCATION );
5172 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), startValue, TEST_LOCATION );
5176 int UtcDaliAnimationAnimateToActorPositionY(void)
5178 TestApplication application;
5180 Actor actor = Actor::New();
5181 Stage::GetCurrent().Add(actor);
5182 float startValue(0.0f);
5183 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, startValue, TEST_LOCATION );
5184 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), startValue, TEST_LOCATION );
5185 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), startValue, TEST_LOCATION );
5186 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), startValue, TEST_LOCATION );
5188 // Build the animation
5189 float durationSeconds(1.0f);
5190 Animation animation = Animation::New(durationSeconds);
5191 float targetY(10.0f);
5192 animation.AnimateTo( Property(actor, Actor::POSITION_Y), targetY );
5194 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
5196 // Start the animation
5199 bool signalReceived(false);
5200 AnimationFinishCheck finishCheck(signalReceived);
5201 animation.FinishedSignal().Connect(&application, finishCheck);
5203 application.SendNotification();
5204 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5206 // We didn't expect the animation to finish yet
5207 application.SendNotification();
5208 finishCheck.CheckSignalNotReceived();
5209 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, fiftyPercentProgress, TEST_LOCATION );
5210 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), startValue, TEST_LOCATION );
5211 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), fiftyPercentProgress, TEST_LOCATION );
5212 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), startValue, TEST_LOCATION );
5214 application.SendNotification();
5215 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5217 // We did expect the animation to finish
5218 application.SendNotification();
5219 finishCheck.CheckSignalReceived();
5220 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, targetY, TEST_LOCATION );
5221 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), startValue, TEST_LOCATION );
5222 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), targetY, TEST_LOCATION );
5223 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), startValue, TEST_LOCATION );
5227 int UtcDaliAnimationAnimateToActorPositionZ(void)
5229 TestApplication application;
5231 Actor actor = Actor::New();
5232 Stage::GetCurrent().Add(actor);
5233 float startValue(0.0f);
5234 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, startValue, TEST_LOCATION );
5235 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), startValue, TEST_LOCATION );
5236 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), startValue, TEST_LOCATION );
5237 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), startValue, TEST_LOCATION );
5239 // Build the animation
5240 float durationSeconds(1.0f);
5241 Animation animation = Animation::New(durationSeconds);
5242 float targetZ(-5.0f);
5243 animation.AnimateTo( Property(actor, Actor::POSITION_Z), targetZ );
5245 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
5247 // Start the animation
5250 bool signalReceived(false);
5251 AnimationFinishCheck finishCheck(signalReceived);
5252 animation.FinishedSignal().Connect(&application, finishCheck);
5254 application.SendNotification();
5255 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5257 // We didn't expect the animation to finish yet
5258 application.SendNotification();
5259 finishCheck.CheckSignalNotReceived();
5260 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, fiftyPercentProgress, TEST_LOCATION );
5261 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), startValue, TEST_LOCATION );
5262 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), startValue, TEST_LOCATION );
5263 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), fiftyPercentProgress, TEST_LOCATION );
5265 application.SendNotification();
5266 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5268 // We did expect the animation to finish
5269 application.SendNotification();
5270 finishCheck.CheckSignalReceived();
5271 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, targetZ, TEST_LOCATION );
5272 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), startValue, TEST_LOCATION );
5273 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), startValue, TEST_LOCATION );
5274 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), targetZ, TEST_LOCATION );
5278 int UtcDaliAnimationAnimateToActorPositionAlphaFunction(void)
5280 TestApplication application;
5282 Actor actor = Actor::New();
5283 Stage::GetCurrent().Add(actor);
5284 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
5286 // Build the animation
5287 float durationSeconds(1.0f);
5288 Animation animation = Animation::New(durationSeconds);
5289 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
5290 animation.AnimateTo(Property(actor, Actor::POSITION), targetPosition, AlphaFunctions::EaseIn);
5292 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
5294 // Start the animation
5297 bool signalReceived(false);
5298 AnimationFinishCheck finishCheck(signalReceived);
5299 animation.FinishedSignal().Connect(&application, finishCheck);
5301 application.SendNotification();
5302 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
5304 // We didn't expect the animation to finish yet
5305 application.SendNotification();
5306 finishCheck.CheckSignalNotReceived();
5308 // The position should have moved less, than with a linear alpha function
5309 Vector3 current(actor.GetCurrentPosition());
5310 DALI_TEST_CHECK( current.x > Vector3::ZERO.x );
5311 DALI_TEST_CHECK( current.y > Vector3::ZERO.y );
5312 DALI_TEST_CHECK( current.z > Vector3::ZERO.z );
5313 DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x );
5314 DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y );
5315 DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z );
5317 application.SendNotification();
5318 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5320 // We did expect the animation to finish
5321 application.SendNotification();
5322 finishCheck.CheckSignalReceived();
5323 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
5327 int UtcDaliAnimationAnimateToActorPositionTimePeriod(void)
5329 TestApplication application;
5331 Actor actor = Actor::New();
5332 Stage::GetCurrent().Add(actor);
5333 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
5335 // Build the animation
5336 float durationSeconds(1.0f);
5337 Animation animation = Animation::New(durationSeconds);
5338 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
5340 animation.AnimateTo( Property(actor, Actor::POSITION),
5342 TimePeriod( delay, durationSeconds - delay ) );
5344 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
5346 // Start the animation
5349 bool signalReceived(false);
5350 AnimationFinishCheck finishCheck(signalReceived);
5351 animation.FinishedSignal().Connect(&application, finishCheck);
5353 application.SendNotification();
5354 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5356 // We didn't expect the animation to finish yet
5357 application.SendNotification();
5358 finishCheck.CheckSignalNotReceived();
5359 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
5361 application.SendNotification();
5362 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
5364 // We didn't expect the animation to finish yet
5365 application.SendNotification();
5366 finishCheck.CheckSignalNotReceived();
5367 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
5369 application.SendNotification();
5370 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
5372 // We did expect the animation to finish
5373 application.SendNotification();
5374 finishCheck.CheckSignalReceived();
5375 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
5379 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriod(void)
5381 TestApplication application;
5383 Actor actor = Actor::New();
5384 Stage::GetCurrent().Add(actor);
5385 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
5387 // Build the animation
5388 float durationSeconds(1.0f);
5389 Animation animation = Animation::New(durationSeconds);
5390 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
5392 animation.AnimateTo( Property(actor, Actor::POSITION),
5394 AlphaFunctions::Linear,
5395 TimePeriod( delay, durationSeconds - delay ) );
5397 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
5399 // Start the animation
5402 bool signalReceived(false);
5403 AnimationFinishCheck finishCheck(signalReceived);
5404 animation.FinishedSignal().Connect(&application, finishCheck);
5406 application.SendNotification();
5407 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5409 // We didn't expect the animation to finish yet
5410 application.SendNotification();
5411 finishCheck.CheckSignalNotReceived();
5412 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
5414 application.SendNotification();
5415 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
5417 // We didn't expect the animation to finish yet
5418 application.SendNotification();
5419 finishCheck.CheckSignalNotReceived();
5420 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
5422 application.SendNotification();
5423 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
5425 // We did expect the animation to finish
5426 application.SendNotification();
5427 finishCheck.CheckSignalReceived();
5428 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
5432 int UtcDaliAnimationAnimateToActorRotationAngleAxis(void)
5434 TestApplication application;
5436 Actor actor = Actor::New();
5437 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
5438 Stage::GetCurrent().Add(actor);
5439 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5441 // Build the animation
5442 float durationSeconds(1.0f);
5443 Animation animation = Animation::New(durationSeconds);
5444 Degree targetRotationDegrees(90.0f);
5445 Radian targetRotationRadians(targetRotationDegrees);
5446 animation.AnimateTo( Property(actor, Actor::ROTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS) );
5448 // Start the animation
5451 bool signalReceived(false);
5452 AnimationFinishCheck finishCheck(signalReceived);
5453 animation.FinishedSignal().Connect(&application, finishCheck);
5455 application.SendNotification();
5456 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
5458 // We didn't expect the animation to finish yet
5459 application.SendNotification();
5460 finishCheck.CheckSignalNotReceived();
5461 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5463 application.SendNotification();
5464 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
5466 // We didn't expect the animation to finish yet
5467 application.SendNotification();
5468 finishCheck.CheckSignalNotReceived();
5469 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5471 application.SendNotification();
5472 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
5474 // We didn't expect the animation to finish yet
5475 application.SendNotification();
5476 finishCheck.CheckSignalNotReceived();
5477 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5479 application.SendNotification();
5480 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5482 // We did expect the animation to finish
5483 application.SendNotification();
5484 finishCheck.CheckSignalReceived();
5485 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5489 int UtcDaliAnimationAnimateToActorRotationQuaternion(void)
5491 TestApplication application;
5493 Actor actor = Actor::New();
5494 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
5495 Stage::GetCurrent().Add(actor);
5496 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5498 // Build the animation
5499 float durationSeconds(1.0f);
5500 Animation animation = Animation::New(durationSeconds);
5501 Degree targetRotationDegrees(90.0f);
5502 Radian targetRotationRadians(targetRotationDegrees);
5503 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
5504 animation.AnimateTo( Property(actor, Actor::ROTATION), targetRotation );
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*250.0f)/* 25% progress */);
5516 // We didn't expect the animation to finish yet
5517 application.SendNotification();
5518 finishCheck.CheckSignalNotReceived();
5519 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5521 application.SendNotification();
5522 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
5524 // We didn't expect the animation to finish yet
5525 application.SendNotification();
5526 finishCheck.CheckSignalNotReceived();
5527 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5529 application.SendNotification();
5530 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
5532 // We didn't expect the animation to finish yet
5533 application.SendNotification();
5534 finishCheck.CheckSignalNotReceived();
5535 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5537 application.SendNotification();
5538 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5540 // We did expect the animation to finish
5541 application.SendNotification();
5542 finishCheck.CheckSignalReceived();
5543 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5547 int UtcDaliAnimationAnimateToActorRotationAlphaFunction(void)
5549 TestApplication application;
5551 Actor actor = Actor::New();
5552 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
5553 Stage::GetCurrent().Add(actor);
5554 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5556 // Build the animation
5557 float durationSeconds(1.0f);
5558 Animation animation = Animation::New(durationSeconds);
5559 Degree targetRotationDegrees(90.0f);
5560 Radian targetRotationRadians(targetRotationDegrees);
5561 animation.AnimateTo( Property(actor, Actor::ROTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunctions::EaseIn);
5563 // Start the animation
5566 bool signalReceived(false);
5567 AnimationFinishCheck finishCheck(signalReceived);
5568 animation.FinishedSignal().Connect(&application, finishCheck);
5570 application.SendNotification();
5571 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
5573 // We didn't expect the animation to finish yet
5574 application.SendNotification();
5575 finishCheck.CheckSignalNotReceived();
5576 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.25f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5578 application.SendNotification();
5579 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
5581 // We didn't expect the animation to finish yet
5582 application.SendNotification();
5583 finishCheck.CheckSignalNotReceived();
5584 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.5f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5586 application.SendNotification();
5587 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
5589 // We didn't expect the animation to finish yet
5590 application.SendNotification();
5591 finishCheck.CheckSignalNotReceived();
5592 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5594 application.SendNotification();
5595 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5597 // We did expect the animation to finish
5598 application.SendNotification();
5599 finishCheck.CheckSignalReceived();
5600 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5604 int UtcDaliAnimationAnimateToActorRotationTimePeriod(void)
5606 TestApplication application;
5608 Actor actor = Actor::New();
5609 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
5610 Stage::GetCurrent().Add(actor);
5611 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5613 // Build the animation
5614 float durationSeconds(1.0f);
5615 Animation animation = Animation::New(durationSeconds);
5616 Degree targetRotationDegrees(90.0f);
5617 Radian targetRotationRadians(targetRotationDegrees);
5619 animation.AnimateTo( Property(actor, Actor::ROTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
5621 // Start the animation
5624 bool signalReceived(false);
5625 AnimationFinishCheck finishCheck(signalReceived);
5626 animation.FinishedSignal().Connect(&application, finishCheck);
5628 application.SendNotification();
5629 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
5631 // We didn't expect the animation to finish yet
5632 application.SendNotification();
5633 finishCheck.CheckSignalNotReceived();
5634 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
5635 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5637 application.SendNotification();
5638 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
5640 // We didn't expect the animation to finish yet
5641 application.SendNotification();
5642 finishCheck.CheckSignalNotReceived();
5643 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
5644 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5646 application.SendNotification();
5647 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
5649 // We didn't expect the animation to finish yet
5650 application.SendNotification();
5651 finishCheck.CheckSignalNotReceived();
5652 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
5653 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5655 application.SendNotification();
5656 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5658 // We did expect the animation to finish
5659 application.SendNotification();
5660 finishCheck.CheckSignalReceived();
5661 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5665 int UtcDaliAnimationAnimateToActorRotationAlphaFunctionTimePeriod(void)
5667 TestApplication application;
5669 Actor actor = Actor::New();
5670 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
5671 Stage::GetCurrent().Add(actor);
5672 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5674 // Build the animation
5675 float durationSeconds(1.0f);
5676 Animation animation = Animation::New(durationSeconds);
5677 Degree targetRotationDegrees(90.0f);
5678 Radian targetRotationRadians(targetRotationDegrees);
5680 animation.AnimateTo( Property(actor, Actor::ROTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunctions::EaseIn, TimePeriod(delay, durationSeconds - delay));
5682 // Start the animation
5685 bool signalReceived(false);
5686 AnimationFinishCheck finishCheck(signalReceived);
5687 animation.FinishedSignal().Connect(&application, finishCheck);
5689 application.SendNotification();
5690 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
5692 // We didn't expect the animation to finish yet
5693 application.SendNotification();
5694 finishCheck.CheckSignalNotReceived();
5695 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
5696 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5698 application.SendNotification();
5699 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
5701 // We didn't expect the animation to finish yet
5702 application.SendNotification();
5703 finishCheck.CheckSignalNotReceived();
5704 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
5705 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5707 application.SendNotification();
5708 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
5710 // We didn't expect the animation to finish yet
5711 application.SendNotification();
5712 finishCheck.CheckSignalNotReceived();
5713 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
5714 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5716 application.SendNotification();
5717 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5719 // We did expect the animation to finish
5720 application.SendNotification();
5721 finishCheck.CheckSignalReceived();
5722 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5726 int UtcDaliAnimationAnimateToActorScale(void)
5728 TestApplication application;
5730 Actor actor = Actor::New();
5731 Stage::GetCurrent().Add(actor);
5732 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
5734 // Build the animation
5735 float durationSeconds(1.0f);
5736 Animation animation = Animation::New(durationSeconds);
5737 Vector3 targetScale(2.0f, 2.0f, 2.0f);
5738 animation.AnimateTo( Property(actor, Actor::SCALE), targetScale );
5740 Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f);
5742 // Start the animation
5745 bool signalReceived(false);
5746 AnimationFinishCheck finishCheck(signalReceived);
5747 animation.FinishedSignal().Connect(&application, finishCheck);
5749 application.SendNotification();
5750 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
5752 // We didn't expect the animation to finish yet
5753 application.SendNotification();
5754 finishCheck.CheckSignalNotReceived();
5755 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
5757 application.SendNotification();
5758 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
5760 // We did expect the animation to finish
5761 application.SendNotification();
5762 finishCheck.CheckSignalReceived();
5763 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
5766 finishCheck.Reset();
5767 actor.SetScale(Vector3::ONE);
5768 application.SendNotification();
5769 application.Render(0);
5770 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
5772 // Repeat with a different (ease-in) alpha function
5773 animation = Animation::New(durationSeconds);
5774 animation.AnimateTo( Property(actor, Actor::SCALE), targetScale, AlphaFunctions::EaseIn);
5775 animation.FinishedSignal().Connect(&application, finishCheck);
5778 application.SendNotification();
5779 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
5781 // We didn't expect the animation to finish yet
5782 application.SendNotification();
5783 finishCheck.CheckSignalNotReceived();
5785 // The scale should have grown less, than with a linear alpha function
5786 Vector3 current(actor.GetCurrentScale());
5787 DALI_TEST_CHECK( current.x > 1.0f );
5788 DALI_TEST_CHECK( current.y > 1.0f );
5789 DALI_TEST_CHECK( current.z > 1.0f );
5790 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
5791 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
5792 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
5794 application.SendNotification();
5795 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
5797 // We did expect the animation to finish
5798 application.SendNotification();
5799 finishCheck.CheckSignalReceived();
5800 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
5803 finishCheck.Reset();
5804 actor.SetScale(Vector3::ONE);
5805 application.SendNotification();
5806 application.Render(0);
5807 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
5809 // Repeat with a delay
5811 animation = Animation::New(durationSeconds);
5812 animation.AnimateTo( Property(actor, Actor::SCALE), targetScale, AlphaFunctions::Linear, TimePeriod(delay, durationSeconds - delay));
5813 animation.FinishedSignal().Connect(&application, finishCheck);
5816 application.SendNotification();
5817 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5819 // We didn't expect the animation to finish yet
5820 application.SendNotification();
5821 finishCheck.CheckSignalNotReceived();
5822 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
5824 application.SendNotification();
5825 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5827 // We did expect the animation to finish
5828 application.SendNotification();
5829 finishCheck.CheckSignalReceived();
5830 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
5834 int UtcDaliAnimationAnimateToActorScaleX(void)
5836 TestApplication application;
5838 Actor actor = Actor::New();
5839 Stage::GetCurrent().Add(actor);
5840 float startValue(1.0f);
5841 DALI_TEST_EQUALS( actor.GetCurrentScale().x, startValue, TEST_LOCATION );
5842 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), startValue, TEST_LOCATION );
5843 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), startValue, TEST_LOCATION );
5844 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), startValue, TEST_LOCATION );
5846 // Build the animation
5847 float durationSeconds(1.0f);
5848 Animation animation = Animation::New(durationSeconds);
5849 float targetX(10.0f);
5850 animation.AnimateTo( Property(actor, Actor::SCALE_X), targetX );
5852 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
5854 // Start the animation
5857 bool signalReceived(false);
5858 AnimationFinishCheck finishCheck(signalReceived);
5859 animation.FinishedSignal().Connect(&application, finishCheck);
5861 application.SendNotification();
5862 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5864 // We didn't expect the animation to finish yet
5865 application.SendNotification();
5866 finishCheck.CheckSignalNotReceived();
5867 DALI_TEST_EQUALS( actor.GetCurrentScale().x, fiftyPercentProgress, TEST_LOCATION );
5868 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), fiftyPercentProgress, TEST_LOCATION );
5869 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), startValue, TEST_LOCATION );
5870 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), startValue, TEST_LOCATION );
5872 application.SendNotification();
5873 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5875 // We did expect the animation to finish
5876 application.SendNotification();
5877 finishCheck.CheckSignalReceived();
5878 DALI_TEST_EQUALS( actor.GetCurrentScale().x, targetX, TEST_LOCATION );
5879 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), targetX, TEST_LOCATION );
5880 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), startValue, TEST_LOCATION );
5881 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), startValue, TEST_LOCATION );
5885 int UtcDaliAnimationAnimateToActorScaleY(void)
5887 TestApplication application;
5889 Actor actor = Actor::New();
5890 Stage::GetCurrent().Add(actor);
5891 float startValue(1.0f);
5892 DALI_TEST_EQUALS( actor.GetCurrentScale().y, startValue, TEST_LOCATION );
5893 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), startValue, TEST_LOCATION );
5894 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), startValue, TEST_LOCATION );
5895 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), startValue, TEST_LOCATION );
5897 // Build the animation
5898 float durationSeconds(1.0f);
5899 Animation animation = Animation::New(durationSeconds);
5900 float targetY(1000.0f);
5901 animation.AnimateTo( Property(actor, Actor::SCALE_Y), targetY );
5903 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
5905 // Start the animation
5908 bool signalReceived(false);
5909 AnimationFinishCheck finishCheck(signalReceived);
5910 animation.FinishedSignal().Connect(&application, finishCheck);
5912 application.SendNotification();
5913 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5915 // We didn't expect the animation to finish yet
5916 application.SendNotification();
5917 finishCheck.CheckSignalNotReceived();
5918 DALI_TEST_EQUALS( actor.GetCurrentScale().y, fiftyPercentProgress, TEST_LOCATION );
5919 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), startValue, TEST_LOCATION );
5920 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), fiftyPercentProgress, TEST_LOCATION );
5921 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), startValue, TEST_LOCATION );
5923 application.SendNotification();
5924 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5926 // We did expect the animation to finish
5927 application.SendNotification();
5928 finishCheck.CheckSignalReceived();
5929 DALI_TEST_EQUALS( actor.GetCurrentScale().y, targetY, TEST_LOCATION );
5930 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), startValue, TEST_LOCATION );
5931 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), targetY, TEST_LOCATION );
5932 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), startValue, TEST_LOCATION );
5936 int UtcDaliAnimationAnimateToActorScaleZ(void)
5938 TestApplication application;
5940 Actor actor = Actor::New();
5941 Stage::GetCurrent().Add(actor);
5942 float startValue(1.0f);
5943 DALI_TEST_EQUALS( actor.GetCurrentScale().z, startValue, TEST_LOCATION );
5944 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), startValue, TEST_LOCATION );
5945 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), startValue, TEST_LOCATION );
5946 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), startValue, TEST_LOCATION );
5948 // Build the animation
5949 float durationSeconds(1.0f);
5950 Animation animation = Animation::New(durationSeconds);
5951 float targetZ(-1000.0f);
5952 animation.AnimateTo( Property(actor, Actor::SCALE_Z), targetZ );
5954 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
5956 // Start the animation
5959 bool signalReceived(false);
5960 AnimationFinishCheck finishCheck(signalReceived);
5961 animation.FinishedSignal().Connect(&application, finishCheck);
5963 application.SendNotification();
5964 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5966 // We didn't expect the animation to finish yet
5967 application.SendNotification();
5968 finishCheck.CheckSignalNotReceived();
5969 DALI_TEST_EQUALS( actor.GetCurrentScale().z, fiftyPercentProgress, TEST_LOCATION );
5970 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), startValue, TEST_LOCATION );
5971 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), startValue, TEST_LOCATION );
5972 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), fiftyPercentProgress, TEST_LOCATION );
5974 application.SendNotification();
5975 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5977 // We did expect the animation to finish
5978 application.SendNotification();
5979 finishCheck.CheckSignalReceived();
5980 DALI_TEST_EQUALS( actor.GetCurrentScale().z, targetZ, TEST_LOCATION );
5981 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), startValue, TEST_LOCATION );
5982 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), startValue, TEST_LOCATION );
5983 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), targetZ, TEST_LOCATION );
5987 int UtcDaliAnimationAnimateToActorColor(void)
5989 TestApplication application;
5991 Actor actor = Actor::New();
5992 Stage::GetCurrent().Add(actor);
5993 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5995 // Build the animation
5996 float durationSeconds(1.0f);
5997 Animation animation = Animation::New(durationSeconds);
5998 Vector4 targetColor(Color::RED);
5999 animation.AnimateTo( Property(actor, Actor::COLOR), targetColor );
6001 Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
6002 Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
6004 // Start the animation
6007 bool signalReceived(false);
6008 AnimationFinishCheck finishCheck(signalReceived);
6009 animation.FinishedSignal().Connect(&application, finishCheck);
6011 application.SendNotification();
6012 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
6014 // We didn't expect the animation to finish yet
6015 application.SendNotification();
6016 finishCheck.CheckSignalNotReceived();
6017 DALI_TEST_EQUALS( actor.GetCurrentColor(), tenPercentProgress, TEST_LOCATION );
6019 application.SendNotification();
6020 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
6022 // We did expect the animation to finish
6023 application.SendNotification();
6024 finishCheck.CheckSignalReceived();
6025 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
6028 finishCheck.Reset();
6029 actor.SetColor(Color::WHITE);
6030 application.SendNotification();
6031 application.Render(0);
6032 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
6034 // Repeat with a different (ease-in) alpha function
6035 animation = Animation::New(durationSeconds);
6036 animation.AnimateTo( Property(actor, Actor::COLOR), targetColor, AlphaFunctions::EaseIn);
6037 animation.FinishedSignal().Connect(&application, finishCheck);
6040 application.SendNotification();
6041 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
6043 // We didn't expect the animation to finish yet
6044 application.SendNotification();
6045 finishCheck.CheckSignalNotReceived();
6047 // The color should have changed less, than with a linear alpha function
6048 Vector4 current(actor.GetCurrentColor());
6049 DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change
6050 DALI_TEST_CHECK( current.y < 1.0f );
6051 DALI_TEST_CHECK( current.y > tenPercentProgress.y );
6052 DALI_TEST_CHECK( current.z < 1.0f );
6053 DALI_TEST_CHECK( current.z > tenPercentProgress.z );
6054 DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
6056 application.SendNotification();
6057 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
6059 // We did expect the animation to finish
6060 application.SendNotification();
6061 finishCheck.CheckSignalReceived();
6062 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
6065 finishCheck.Reset();
6066 actor.SetColor(Color::WHITE);
6067 application.SendNotification();
6068 application.Render(0);
6069 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
6071 // Repeat with a shorter animator duration
6072 float animatorDuration = 0.5f;
6073 animation = Animation::New(durationSeconds);
6074 animation.AnimateTo( Property(actor, Actor::COLOR), targetColor, AlphaFunctions::Linear, TimePeriod(animatorDuration));
6075 animation.FinishedSignal().Connect(&application, finishCheck);
6078 application.SendNotification();
6079 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
6081 // We didn't expect the animation to finish yet
6082 application.SendNotification();
6083 finishCheck.CheckSignalNotReceived();
6084 DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION );
6086 application.SendNotification();
6087 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
6089 // We didn't expect the animation to finish yet
6090 application.SendNotification();
6091 finishCheck.CheckSignalNotReceived();
6092 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
6094 application.SendNotification();
6095 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6097 // We did expect the animation to finish
6098 application.SendNotification();
6099 finishCheck.CheckSignalReceived();
6100 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
6104 int UtcDaliAnimationAnimateToActorColorRed(void)
6106 TestApplication application;
6108 Actor actor = Actor::New();
6109 Stage::GetCurrent().Add(actor);
6110 float startValue(1.0f);
6111 DALI_TEST_EQUALS( actor.GetCurrentColor().r, startValue, TEST_LOCATION );
6112 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
6113 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
6114 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
6115 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
6117 // Build the animation
6118 float durationSeconds(1.0f);
6119 Animation animation = Animation::New(durationSeconds);
6120 float targetRed(0.5f);
6121 animation.AnimateTo( Property(actor, Actor::COLOR_RED), targetRed );
6123 float fiftyPercentProgress(startValue + (targetRed - startValue)*0.5f);
6125 // Start the animation
6128 bool signalReceived(false);
6129 AnimationFinishCheck finishCheck(signalReceived);
6130 animation.FinishedSignal().Connect(&application, finishCheck);
6132 application.SendNotification();
6133 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6135 // We didn't expect the animation to finish yet
6136 application.SendNotification();
6137 finishCheck.CheckSignalNotReceived();
6138 DALI_TEST_EQUALS( actor.GetCurrentColor().r, fiftyPercentProgress, TEST_LOCATION );
6139 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), fiftyPercentProgress, TEST_LOCATION );
6140 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
6141 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
6142 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
6144 application.SendNotification();
6145 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6147 // We did expect the animation to finish
6148 application.SendNotification();
6149 finishCheck.CheckSignalReceived();
6150 DALI_TEST_EQUALS( actor.GetCurrentColor().r, targetRed, TEST_LOCATION );
6151 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), targetRed, TEST_LOCATION );
6152 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
6153 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
6154 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
6158 int UtcDaliAnimationAnimateToActorColorGreen(void)
6160 TestApplication application;
6162 Actor actor = Actor::New();
6163 Stage::GetCurrent().Add(actor);
6164 float startValue(1.0f);
6165 DALI_TEST_EQUALS( actor.GetCurrentColor().g, startValue, TEST_LOCATION );
6166 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
6167 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
6168 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
6169 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
6171 // Build the animation
6172 float durationSeconds(1.0f);
6173 Animation animation = Animation::New(durationSeconds);
6174 float targetGreen(0.5f);
6175 animation.AnimateTo( Property(actor, Actor::COLOR_GREEN), targetGreen );
6177 float fiftyPercentProgress(startValue + (targetGreen - startValue)*0.5f);
6179 // Start the animation
6182 bool signalReceived(false);
6183 AnimationFinishCheck finishCheck(signalReceived);
6184 animation.FinishedSignal().Connect(&application, finishCheck);
6186 application.SendNotification();
6187 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6189 // We didn't expect the animation to finish yet
6190 application.SendNotification();
6191 finishCheck.CheckSignalNotReceived();
6192 DALI_TEST_EQUALS( actor.GetCurrentColor().g, fiftyPercentProgress, TEST_LOCATION );
6193 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
6194 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION );
6195 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
6196 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
6198 application.SendNotification();
6199 application.Render(static_cast<unsigned int>(durationSeconds*500.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.GetCurrentColor().g, targetGreen, TEST_LOCATION );
6205 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
6206 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), targetGreen, TEST_LOCATION );
6207 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
6208 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
6212 int UtcDaliAnimationAnimateToActorColorBlue(void)
6214 TestApplication application;
6216 Actor actor = Actor::New();
6217 Stage::GetCurrent().Add(actor);
6218 float startValue(1.0f);
6219 DALI_TEST_EQUALS( actor.GetCurrentColor().b, startValue, TEST_LOCATION );
6220 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
6221 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
6222 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
6223 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
6225 // Build the animation
6226 float durationSeconds(1.0f);
6227 Animation animation = Animation::New(durationSeconds);
6228 float targetBlue(0.5f);
6229 animation.AnimateTo( Property(actor, Actor::COLOR_BLUE), targetBlue );
6231 float fiftyPercentProgress(startValue + (targetBlue - startValue)*0.5f);
6233 // Start the animation
6236 bool signalReceived(false);
6237 AnimationFinishCheck finishCheck(signalReceived);
6238 animation.FinishedSignal().Connect(&application, finishCheck);
6240 application.SendNotification();
6241 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6243 // We didn't expect the animation to finish yet
6244 application.SendNotification();
6245 finishCheck.CheckSignalNotReceived();
6246 DALI_TEST_EQUALS( actor.GetCurrentColor().b, fiftyPercentProgress, TEST_LOCATION );
6247 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
6248 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
6249 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), fiftyPercentProgress, TEST_LOCATION );
6250 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
6252 application.SendNotification();
6253 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6255 // We did expect the animation to finish
6256 application.SendNotification();
6257 finishCheck.CheckSignalReceived();
6258 DALI_TEST_EQUALS( actor.GetCurrentColor().b, targetBlue, TEST_LOCATION );
6259 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
6260 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
6261 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), targetBlue, TEST_LOCATION );
6262 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
6266 int UtcDaliAnimationAnimateToActorColorAlpha(void)
6268 TestApplication application;
6270 Actor actor = Actor::New();
6271 Stage::GetCurrent().Add(actor);
6272 float startValue(1.0f);
6273 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
6274 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
6275 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
6276 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
6277 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
6279 // Build the animation
6280 float durationSeconds(1.0f);
6281 Animation animation = Animation::New(durationSeconds);
6282 float targetAlpha(0.5f);
6283 animation.AnimateTo( Property(actor, Actor::COLOR_ALPHA), targetAlpha );
6285 float fiftyPercentProgress(startValue + (targetAlpha - startValue)*0.5f);
6287 // Start the animation
6290 bool signalReceived(false);
6291 AnimationFinishCheck finishCheck(signalReceived);
6292 animation.FinishedSignal().Connect(&application, finishCheck);
6294 application.SendNotification();
6295 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6297 // We didn't expect the animation to finish yet
6298 application.SendNotification();
6299 finishCheck.CheckSignalNotReceived();
6300 DALI_TEST_EQUALS( actor.GetCurrentColor().a, fiftyPercentProgress, TEST_LOCATION );
6301 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
6302 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
6303 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
6304 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), fiftyPercentProgress, TEST_LOCATION );
6306 application.SendNotification();
6307 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6309 // We did expect the animation to finish
6310 application.SendNotification();
6311 finishCheck.CheckSignalReceived();
6312 DALI_TEST_EQUALS( actor.GetCurrentColor().a, targetAlpha, TEST_LOCATION );
6313 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
6314 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
6315 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
6316 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), targetAlpha, TEST_LOCATION );
6322 int UtcDaliAnimationKeyFrames01(void)
6324 TestApplication application;
6326 KeyFrames keyFrames = KeyFrames::New();
6327 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
6329 keyFrames.Add(0.0f, 0.1f);
6330 keyFrames.Add(0.2f, 0.5f);
6331 keyFrames.Add(0.4f, 0.0f);
6332 keyFrames.Add(0.6f, 1.0f);
6333 keyFrames.Add(0.8f, 0.7f);
6334 keyFrames.Add(1.0f, 0.9f);
6336 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
6340 keyFrames.Add(1.9f, false);
6342 catch (Dali::DaliException& e)
6344 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
6345 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
6350 int UtcDaliAnimationKeyFrames02(void)
6352 TestApplication application;
6354 KeyFrames keyFrames = KeyFrames::New();
6355 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
6357 keyFrames.Add(0.0f, true);
6358 keyFrames.Add(0.2f, false);
6359 keyFrames.Add(0.4f, false);
6360 keyFrames.Add(0.6f, true);
6361 keyFrames.Add(0.8f, true);
6362 keyFrames.Add(1.0f, false);
6364 DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
6368 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
6370 catch (Dali::DaliException& e)
6372 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
6373 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
6379 int UtcDaliAnimationKeyFrames03(void)
6381 TestApplication application;
6383 KeyFrames keyFrames = KeyFrames::New();
6384 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
6386 keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
6387 keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
6388 keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
6389 keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
6390 keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
6391 keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
6393 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
6397 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
6399 catch (Dali::DaliException& e)
6401 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
6402 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
6408 int UtcDaliAnimationKeyFrames04(void)
6410 TestApplication application;
6412 KeyFrames keyFrames = KeyFrames::New();
6413 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
6415 keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
6416 keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
6417 keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
6418 keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
6419 keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
6420 keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
6422 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
6426 keyFrames.Add(0.7f, 1.0f);
6428 catch (Dali::DaliException& e)
6430 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
6431 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
6436 int UtcDaliAnimationKeyFrames05(void)
6438 TestApplication application;
6440 KeyFrames keyFrames = KeyFrames::New();
6441 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
6443 keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
6444 keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
6445 keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
6446 keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
6447 keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
6448 keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
6450 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
6454 keyFrames.Add(0.7f, Quaternion(1.717f, Vector3::XAXIS));
6456 catch (Dali::DaliException& e)
6458 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
6459 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
6465 int UtcDaliAnimationKeyFrames06(void)
6467 TestApplication application;
6469 KeyFrames keyFrames = KeyFrames::New();
6470 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
6472 keyFrames.Add(0.0f, Quaternion(1.717f, Vector3::XAXIS));
6473 keyFrames.Add(0.2f, Quaternion(2.0f, Vector3::XAXIS));
6474 keyFrames.Add(0.4f, Quaternion(3.0f, Vector3::ZAXIS));
6475 keyFrames.Add(0.6f, Quaternion(4.0f, Vector3(1.0f, 1.0f, 1.0f)));
6476 keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
6477 keyFrames.Add(1.0f, Quaternion(3.0f, Vector3::YAXIS));
6479 DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
6483 keyFrames.Add(0.7f, 1.1f);
6485 catch (Dali::DaliException& e)
6487 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
6488 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
6497 int UtcDaliAnimationAnimateBetweenActorColorAlpha(void)
6499 TestApplication application;
6501 float startValue(1.0f);
6502 Actor actor = Actor::New();
6503 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
6504 Stage::GetCurrent().Add(actor);
6506 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
6507 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
6508 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
6509 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
6510 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
6512 // Build the animation
6513 float durationSeconds(1.0f);
6514 Animation animation = Animation::New(durationSeconds);
6516 KeyFrames keyFrames = KeyFrames::New();
6517 keyFrames.Add(0.0f, 0.1f);
6518 keyFrames.Add(0.2f, 0.5f);
6519 keyFrames.Add(0.4f, 0.0f);
6520 keyFrames.Add(0.6f, 1.0f);
6521 keyFrames.Add(0.8f, 0.7f);
6522 keyFrames.Add(1.0f, 0.9f);
6524 animation.AnimateBetween( Property(actor, Actor::COLOR_ALPHA), keyFrames );
6526 // Start the animation
6529 bool signalReceived(false);
6530 AnimationFinishCheck finishCheck(signalReceived);
6531 animation.FinishedSignal().Connect(&application, finishCheck);
6532 application.SendNotification();
6533 application.Render(0);
6534 application.SendNotification();
6535 finishCheck.CheckSignalNotReceived();
6536 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
6538 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
6539 application.SendNotification();
6540 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
6541 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
6542 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
6543 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION );
6544 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.3f, 0.01f, TEST_LOCATION );
6546 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
6547 application.SendNotification();
6548 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
6549 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
6550 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
6551 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION );
6552 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.25f, 0.01f, TEST_LOCATION );
6554 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
6555 application.SendNotification();
6556 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
6557 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
6558 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
6559 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
6560 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
6562 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
6563 application.SendNotification();
6564 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
6565 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
6566 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
6567 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
6568 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
6570 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
6571 application.SendNotification();
6572 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
6573 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
6574 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
6575 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION );
6576 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.8f, 0.01f, TEST_LOCATION );
6578 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
6579 application.SendNotification();
6580 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
6581 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
6582 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
6583 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
6584 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
6586 // We did expect the animation to finish
6588 finishCheck.CheckSignalReceived();
6593 int UtcDaliAnimationAnimateBetweenActorColor(void)
6595 TestApplication application;
6597 float startValue(1.0f);
6598 Actor actor = Actor::New();
6599 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
6600 Stage::GetCurrent().Add(actor);
6602 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
6603 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
6604 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
6605 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
6606 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
6608 // Build the animation
6609 float durationSeconds(1.0f);
6610 Animation animation = Animation::New(durationSeconds);
6612 KeyFrames keyFrames = KeyFrames::New();
6613 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
6614 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
6615 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
6617 animation.AnimateBetween( Property(actor, Actor::COLOR), keyFrames );
6619 // Start the animation
6622 bool signalReceived(false);
6623 AnimationFinishCheck finishCheck(signalReceived);
6624 animation.FinishedSignal().Connect(&application, finishCheck);
6625 application.SendNotification();
6626 application.Render(0);
6627 application.SendNotification();
6628 finishCheck.CheckSignalNotReceived();
6629 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
6630 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
6631 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
6632 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
6634 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6635 application.SendNotification();
6636 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
6637 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
6638 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
6639 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
6641 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6642 application.SendNotification();
6643 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
6644 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
6645 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
6646 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
6648 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6649 application.SendNotification();
6650 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
6651 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
6652 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
6653 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
6655 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
6656 application.SendNotification();
6657 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
6658 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
6659 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
6660 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
6662 // We did expect the animation to finish
6664 finishCheck.CheckSignalReceived();
6668 int UtcDaliAnimationAnimateBetweenActorVisible01(void)
6670 TestApplication application;
6672 Actor actor = Actor::New();
6673 AngleAxis aa(Degree(90), Vector3::XAXIS);
6674 actor.SetRotation(aa.angle, aa.axis);
6675 Stage::GetCurrent().Add(actor);
6677 application.SendNotification();
6678 application.Render(0);
6680 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
6682 // Build the animation
6683 float durationSeconds(1.0f);
6684 Animation animation = Animation::New(durationSeconds);
6686 KeyFrames keyFrames = KeyFrames::New();
6687 keyFrames.Add(0.0f, false);
6688 keyFrames.Add(0.2f, true);
6689 keyFrames.Add(0.4f, true);
6690 keyFrames.Add(0.8f, false);
6691 keyFrames.Add(1.0f, true);
6693 animation.AnimateBetween( Property(actor, Actor::VISIBLE), keyFrames );
6695 // Start the animation
6698 bool signalReceived(false);
6699 AnimationFinishCheck finishCheck(signalReceived);
6700 animation.FinishedSignal().Connect(&application, finishCheck);
6701 application.SendNotification();
6702 application.SendNotification();
6703 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
6704 application.SendNotification();
6705 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
6706 application.SendNotification();
6708 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
6709 finishCheck.CheckSignalReceived();
6713 int UtcDaliAnimationAnimateBetweenActorRotation01(void)
6715 TestApplication application;
6717 Actor actor = Actor::New();
6718 AngleAxis aa(Degree(90), Vector3::XAXIS);
6719 actor.SetRotation(aa.angle, aa.axis);
6720 Stage::GetCurrent().Add(actor);
6722 application.SendNotification();
6723 application.Render(0);
6724 Quaternion start(Radian(aa.angle), aa.axis);
6725 DALI_TEST_EQUALS( actor.GetCurrentRotation(), start, 0.001f, TEST_LOCATION );
6727 // Build the animation
6728 float durationSeconds(1.0f);
6729 Animation animation = Animation::New(durationSeconds);
6731 KeyFrames keyFrames = KeyFrames::New();
6732 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
6734 animation.AnimateBetween( Property(actor, Actor::ROTATION), keyFrames );
6736 // Start the animation
6739 bool signalReceived(false);
6740 AnimationFinishCheck finishCheck(signalReceived);
6741 animation.FinishedSignal().Connect(&application, finishCheck);
6742 application.SendNotification();
6743 application.SendNotification();
6744 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
6745 application.SendNotification();
6746 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
6747 application.SendNotification();
6749 Quaternion check = Quaternion::FromAxisAngle(Vector4::ZAXIS, Radian(Degree(60)));
6751 DALI_TEST_EQUALS( actor.GetCurrentRotation(), check, 0.001f, TEST_LOCATION );
6752 finishCheck.CheckSignalReceived();
6756 int UtcDaliAnimationAnimateBetweenActorRotation02(void)
6758 TestApplication application;
6760 Actor actor = Actor::New();
6761 AngleAxis aa(Degree(90), Vector3::XAXIS);
6762 actor.SetRotation(aa.angle, aa.axis);
6763 application.SendNotification();
6764 application.Render(0);
6765 Stage::GetCurrent().Add(actor);
6767 Quaternion start(Radian(aa.angle), aa.axis);
6768 DALI_TEST_EQUALS( actor.GetCurrentRotation(), start, 0.001f, TEST_LOCATION );
6770 // Build the animation
6771 float durationSeconds(1.0f);
6772 Animation animation = Animation::New(durationSeconds);
6774 KeyFrames keyFrames = KeyFrames::New();
6775 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
6776 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
6777 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
6779 animation.AnimateBetween( Property(actor, Actor::ROTATION), keyFrames );
6781 // Start the animation
6784 bool signalReceived(false);
6785 AnimationFinishCheck finishCheck(signalReceived);
6786 animation.FinishedSignal().Connect(&application, finishCheck);
6787 application.SendNotification();
6788 application.Render(0);
6789 application.SendNotification();
6790 finishCheck.CheckSignalNotReceived();
6792 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
6793 DALI_TEST_EQUALS( actor.GetCurrentRotation(), check, 0.001f, TEST_LOCATION );
6795 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6796 application.SendNotification();
6797 check = Quaternion::FromAxisAngle(Vector4::XAXIS, Radian(Degree(90)));
6798 DALI_TEST_EQUALS( actor.GetCurrentRotation(), check, 0.001f, TEST_LOCATION );
6800 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6801 application.SendNotification();
6802 check = Quaternion::FromAxisAngle(Vector4::XAXIS, Radian(Degree(120)));
6803 DALI_TEST_EQUALS( actor.GetCurrentRotation(), check, 0.001f, TEST_LOCATION );
6805 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6806 application.SendNotification();
6807 check = Quaternion::FromAxisAngle(Vector4(0.5f, 0.5f, 0.0f, 0.0f), Radian(Degree(101.5)));
6808 DALI_TEST_EQUALS( actor.GetCurrentRotation(), check, 0.001f, TEST_LOCATION );
6810 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
6811 application.SendNotification();
6812 check = Quaternion::FromAxisAngle(Vector4::YAXIS, Radian(Degree(120)));
6813 DALI_TEST_EQUALS( actor.GetCurrentRotation(), check, 0.001f, TEST_LOCATION );
6815 // We did expect the animation to finish
6817 finishCheck.CheckSignalReceived();
6821 int UtcDaliAnimationMoveByFloat3(void)
6823 TestApplication application;
6825 Actor actor = Actor::New();
6826 Vector3 startPosition(10.0f, 10.0f, 10.0f);
6827 actor.SetPosition(startPosition);
6828 Stage::GetCurrent().Add(actor);
6829 application.SendNotification();
6830 application.Render(0);
6831 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
6833 // Build the animation
6834 float durationSeconds(1.0f);
6835 Animation animation = Animation::New(durationSeconds);
6836 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
6837 Vector3 relativePosition(targetPosition - startPosition);
6838 animation.MoveBy(actor, relativePosition.x, relativePosition.y, relativePosition.z);
6840 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
6842 // Start the animation
6845 bool signalReceived(false);
6846 AnimationFinishCheck finishCheck(signalReceived);
6847 animation.FinishedSignal().Connect(&application, finishCheck);
6849 application.SendNotification();
6850 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6852 // We didn't expect the animation to finish yet
6853 application.SendNotification();
6854 finishCheck.CheckSignalNotReceived();
6855 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ninetyFivePercentProgress, TEST_LOCATION );
6857 application.SendNotification();
6858 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6860 // We did expect the animation to finish
6861 application.SendNotification();
6862 finishCheck.CheckSignalReceived();
6863 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6867 int UtcDaliAnimationMoveByVector3Alpha(void)
6869 TestApplication application;
6871 Actor actor = Actor::New();
6872 Vector3 startPosition(10.0f, 10.0f, 10.0f);
6873 actor.SetPosition(startPosition);
6874 Stage::GetCurrent().Add(actor);
6875 application.SendNotification();
6876 application.Render(0);
6877 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
6879 // Build the animation
6880 float durationSeconds(1.0f);
6881 Animation animation = Animation::New(durationSeconds);
6882 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
6883 Vector3 relativePosition(targetPosition - startPosition);
6884 animation.MoveBy(actor, relativePosition, AlphaFunctions::EaseOut);
6886 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
6888 // Start the animation
6891 bool signalReceived(false);
6892 AnimationFinishCheck finishCheck(signalReceived);
6893 animation.FinishedSignal().Connect(&application, finishCheck);
6895 application.SendNotification();
6896 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6898 // We didn't expect the animation to finish yet
6899 application.SendNotification();
6900 finishCheck.CheckSignalNotReceived();
6902 // The position should have moved more, than with a linear alpha function
6903 Vector3 current(actor.GetCurrentPosition());
6904 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6905 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6906 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
6908 application.SendNotification();
6909 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6911 // We did expect the animation to finish
6912 application.SendNotification();
6913 finishCheck.CheckSignalReceived();
6914 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6918 int UtcDaliAnimationMoveByVector3AlphaFloat2(void)
6920 TestApplication application;
6922 Actor actor = Actor::New();
6923 Vector3 startPosition(10.0f, 10.0f, 10.0f);
6924 actor.SetPosition(startPosition);
6925 Stage::GetCurrent().Add(actor);
6926 application.SendNotification();
6927 application.Render(0);
6928 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
6930 // Build the animation
6931 float durationSeconds(1.0f);
6932 Animation animation = Animation::New(durationSeconds);
6933 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
6934 Vector3 relativePosition(targetPosition - startPosition);
6936 animation.MoveBy(actor, relativePosition, AlphaFunctions::Linear, delay, durationSeconds - delay);
6938 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
6940 // Start the animation
6943 bool signalReceived(false);
6944 AnimationFinishCheck finishCheck(signalReceived);
6945 animation.FinishedSignal().Connect(&application, finishCheck);
6947 application.SendNotification();
6948 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6950 // We didn't expect the animation to finish yet
6951 application.SendNotification();
6952 finishCheck.CheckSignalNotReceived();
6953 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
6955 application.SendNotification();
6956 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6958 // We did expect the animation to finish
6959 application.SendNotification();
6960 finishCheck.CheckSignalReceived();
6961 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6965 int UtcDaliAnimationMoveToFloat3(void)
6967 TestApplication application;
6969 Actor actor = Actor::New();
6970 Stage::GetCurrent().Add(actor);
6971 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6973 // Build the animation
6974 float durationSeconds(1.0f);
6975 Animation animation = Animation::New(durationSeconds);
6976 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6977 animation.MoveTo(actor, targetPosition.x, targetPosition.y, targetPosition.z);
6979 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6981 // Start the animation
6984 bool signalReceived(false);
6985 AnimationFinishCheck finishCheck(signalReceived);
6986 animation.FinishedSignal().Connect(&application, finishCheck);
6988 application.SendNotification();
6989 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
6991 // We didn't expect the animation to finish yet
6992 application.SendNotification();
6993 finishCheck.CheckSignalNotReceived();
6994 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
6996 application.SendNotification();
6997 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6999 // We did expect the animation to finish
7000 application.SendNotification();
7001 finishCheck.CheckSignalReceived();
7002 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7006 int UtcDaliAnimationMoveToVector3Alpha(void)
7008 TestApplication application;
7010 Actor actor = Actor::New();
7011 Stage::GetCurrent().Add(actor);
7012 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7014 // Build the animation
7015 float durationSeconds(1.0f);
7016 Animation animation = Animation::New(durationSeconds);
7017 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7018 animation.MoveTo(actor, targetPosition, AlphaFunctions::EaseIn);
7020 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7022 // Start the animation
7025 bool signalReceived(false);
7026 AnimationFinishCheck finishCheck(signalReceived);
7027 animation.FinishedSignal().Connect(&application, finishCheck);
7029 application.SendNotification();
7030 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
7032 // We didn't expect the animation to finish yet
7033 application.SendNotification();
7034 finishCheck.CheckSignalNotReceived();
7036 // The position should have moved less, than with a linear alpha function
7037 Vector3 current(actor.GetCurrentPosition());
7038 DALI_TEST_CHECK( current.x > Vector3::ZERO.x );
7039 DALI_TEST_CHECK( current.y > Vector3::ZERO.y );
7040 DALI_TEST_CHECK( current.z > Vector3::ZERO.z );
7041 DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x );
7042 DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y );
7043 DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z );
7045 application.SendNotification();
7046 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7048 // We did expect the animation to finish
7049 application.SendNotification();
7050 finishCheck.CheckSignalReceived();
7051 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7055 int UtcDaliAnimationMoveToVector3AlphaFloat2(void)
7057 TestApplication application;
7059 Actor actor = Actor::New();
7060 Stage::GetCurrent().Add(actor);
7061 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7063 // Build the animation
7064 float durationSeconds(1.0f);
7065 Animation animation = Animation::New(durationSeconds);
7066 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7068 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear, delay, durationSeconds - delay);
7070 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7072 // Start the animation
7075 bool signalReceived(false);
7076 AnimationFinishCheck finishCheck(signalReceived);
7077 animation.FinishedSignal().Connect(&application, finishCheck);
7079 application.SendNotification();
7080 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7082 // We didn't expect the animation to finish yet
7083 application.SendNotification();
7084 finishCheck.CheckSignalNotReceived();
7085 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7087 application.SendNotification();
7088 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7090 // We didn't expect the animation to finish yet
7091 application.SendNotification();
7092 finishCheck.CheckSignalNotReceived();
7093 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7095 application.SendNotification();
7096 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7098 // We did expect the animation to finish
7099 application.SendNotification();
7100 finishCheck.CheckSignalReceived();
7101 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7105 int UtcDaliAnimationRotateByDegreeVector3(void)
7107 TestApplication application;
7109 Actor actor = Actor::New();
7110 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
7111 Stage::GetCurrent().Add(actor);
7112 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7114 // Build the animation
7115 float durationSeconds(1.0f);
7116 Animation animation = Animation::New(durationSeconds);
7117 Degree relativeRotationDegrees(360.0f);
7118 Radian relativeRotationRadians(relativeRotationDegrees);
7119 animation.RotateBy(actor, relativeRotationDegrees/*Degree version*/, Vector3::YAXIS);
7121 // Start the animation
7124 bool signalReceived(false);
7125 AnimationFinishCheck finishCheck(signalReceived);
7126 animation.FinishedSignal().Connect(&application, finishCheck);
7128 application.SendNotification();
7129 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7131 // We didn't expect the animation to finish yet
7132 application.SendNotification();
7133 finishCheck.CheckSignalNotReceived();
7134 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7136 application.SendNotification();
7137 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7139 // We didn't expect the animation to finish yet
7140 application.SendNotification();
7141 finishCheck.CheckSignalNotReceived();
7142 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7144 application.SendNotification();
7145 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7147 // We didn't expect the animation to finish yet
7148 application.SendNotification();
7149 finishCheck.CheckSignalNotReceived();
7150 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7152 application.SendNotification();
7153 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7155 // We did expect the animation to finish
7156 application.SendNotification();
7157 finishCheck.CheckSignalReceived();
7158 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7162 int UtcDaliAnimationRotateByRadianVector3(void)
7164 TestApplication application;
7166 Actor actor = Actor::New();
7167 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
7168 Stage::GetCurrent().Add(actor);
7169 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7171 // Build the animation
7172 float durationSeconds(1.0f);
7173 Animation animation = Animation::New(durationSeconds);
7174 Degree relativeRotationDegrees(360.0f);
7175 Radian relativeRotationRadians(relativeRotationDegrees);
7176 animation.RotateBy(actor, relativeRotationRadians/*Radian version*/, Vector3::YAXIS);
7178 // Start the animation
7181 bool signalReceived(false);
7182 AnimationFinishCheck finishCheck(signalReceived);
7183 animation.FinishedSignal().Connect(&application, finishCheck);
7185 application.SendNotification();
7186 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7188 // We didn't expect the animation to finish yet
7189 application.SendNotification();
7190 finishCheck.CheckSignalNotReceived();
7191 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7193 application.SendNotification();
7194 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7196 // We didn't expect the animation to finish yet
7197 application.SendNotification();
7198 finishCheck.CheckSignalNotReceived();
7199 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7201 application.SendNotification();
7202 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7204 // We didn't expect the animation to finish yet
7205 application.SendNotification();
7206 finishCheck.CheckSignalNotReceived();
7207 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7209 application.SendNotification();
7210 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7212 // We did expect the animation to finish
7213 application.SendNotification();
7214 finishCheck.CheckSignalReceived();
7215 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7219 int UtcDaliAnimationRotateByDegreeVector3Alpha(void)
7221 TestApplication application;
7223 Actor actor = Actor::New();
7224 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
7225 Stage::GetCurrent().Add(actor);
7226 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7228 // Build the animation
7229 float durationSeconds(1.0f);
7230 Animation animation = Animation::New(durationSeconds);
7231 Degree relativeRotationDegrees(360.0f);
7232 Radian relativeRotationRadians(relativeRotationDegrees);
7233 animation.RotateBy(actor, relativeRotationDegrees/*Degree version*/, Vector3::YAXIS, AlphaFunctions::EaseIn);
7235 // Start the animation
7238 bool signalReceived(false);
7239 AnimationFinishCheck finishCheck(signalReceived);
7240 animation.FinishedSignal().Connect(&application, finishCheck);
7242 application.SendNotification();
7243 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7245 // We didn't expect the animation to finish yet
7246 application.SendNotification();
7247 finishCheck.CheckSignalNotReceived();
7248 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.25f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7250 application.SendNotification();
7251 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7253 // We didn't expect the animation to finish yet
7254 application.SendNotification();
7255 finishCheck.CheckSignalNotReceived();
7256 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.5f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7258 application.SendNotification();
7259 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7261 // We didn't expect the animation to finish yet
7262 application.SendNotification();
7263 finishCheck.CheckSignalNotReceived();
7264 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7266 application.SendNotification();
7267 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7269 // We did expect the animation to finish
7270 application.SendNotification();
7271 finishCheck.CheckSignalReceived();
7272 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7276 int UtcDaliAnimationRotateByRadianVector3Alpha(void)
7278 TestApplication application;
7280 Actor actor = Actor::New();
7281 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
7282 Stage::GetCurrent().Add(actor);
7283 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7285 // Build the animation
7286 float durationSeconds(1.0f);
7287 Animation animation = Animation::New(durationSeconds);
7288 Degree relativeRotationDegrees(360.0f);
7289 Radian relativeRotationRadians(relativeRotationDegrees);
7290 animation.RotateBy(actor, relativeRotationRadians/*Radian version*/, Vector3::YAXIS, AlphaFunctions::EaseIn);
7292 // Start the animation
7295 bool signalReceived(false);
7296 AnimationFinishCheck finishCheck(signalReceived);
7297 animation.FinishedSignal().Connect(&application, finishCheck);
7299 application.SendNotification();
7300 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7302 // We didn't expect the animation to finish yet
7303 application.SendNotification();
7304 finishCheck.CheckSignalNotReceived();
7305 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.25f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7307 application.SendNotification();
7308 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7310 // We didn't expect the animation to finish yet
7311 application.SendNotification();
7312 finishCheck.CheckSignalNotReceived();
7313 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.5f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7315 application.SendNotification();
7316 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7318 // We didn't expect the animation to finish yet
7319 application.SendNotification();
7320 finishCheck.CheckSignalNotReceived();
7321 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7323 application.SendNotification();
7324 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7326 // We did expect the animation to finish
7327 application.SendNotification();
7328 finishCheck.CheckSignalReceived();
7329 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7333 int UtcDaliAnimationRotateByDegreeVector3AlphaFloat2(void)
7335 TestApplication application;
7337 Actor actor = Actor::New();
7338 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
7339 Stage::GetCurrent().Add(actor);
7340 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7342 // Build the animation
7343 float durationSeconds(1.0f);
7344 Animation animation = Animation::New(durationSeconds);
7345 Degree relativeRotationDegrees(360.0f);
7346 Radian relativeRotationRadians(relativeRotationDegrees);
7348 animation.RotateBy(actor, relativeRotationDegrees/*Degree version*/, Vector3::YAXIS, AlphaFunctions::EaseIn, delay, durationSeconds - delay);
7350 // Start the animation
7353 bool signalReceived(false);
7354 AnimationFinishCheck finishCheck(signalReceived);
7355 animation.FinishedSignal().Connect(&application, finishCheck);
7357 application.SendNotification();
7358 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7360 // We didn't expect the animation to finish yet
7361 application.SendNotification();
7362 finishCheck.CheckSignalNotReceived();
7363 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7364 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7366 application.SendNotification();
7367 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7369 // We didn't expect the animation to finish yet
7370 application.SendNotification();
7371 finishCheck.CheckSignalNotReceived();
7372 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7373 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7375 application.SendNotification();
7376 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7378 // We didn't expect the animation to finish yet
7379 application.SendNotification();
7380 finishCheck.CheckSignalNotReceived();
7381 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7382 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7384 application.SendNotification();
7385 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7387 // We did expect the animation to finish
7388 application.SendNotification();
7389 finishCheck.CheckSignalReceived();
7390 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7395 int UtcDaliAnimationRotateByRadianVector3AlphaFloat2(void)
7397 TestApplication application;
7399 Actor actor = Actor::New();
7400 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
7401 Stage::GetCurrent().Add(actor);
7402 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7404 // Build the animation
7405 float durationSeconds(1.0f);
7406 Animation animation = Animation::New(durationSeconds);
7407 Degree relativeRotationDegrees(360.0f);
7408 Radian relativeRotationRadians(relativeRotationDegrees);
7410 animation.RotateBy(actor, relativeRotationRadians/*Radian version*/, Vector3::YAXIS, AlphaFunctions::EaseIn, delay, durationSeconds - delay);
7412 // Start the animation
7415 bool signalReceived(false);
7416 AnimationFinishCheck finishCheck(signalReceived);
7417 animation.FinishedSignal().Connect(&application, finishCheck);
7419 application.SendNotification();
7420 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7422 // We didn't expect the animation to finish yet
7423 application.SendNotification();
7424 finishCheck.CheckSignalNotReceived();
7425 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7426 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7428 application.SendNotification();
7429 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7431 // We didn't expect the animation to finish yet
7432 application.SendNotification();
7433 finishCheck.CheckSignalNotReceived();
7434 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7435 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7437 application.SendNotification();
7438 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7440 // We didn't expect the animation to finish yet
7441 application.SendNotification();
7442 finishCheck.CheckSignalNotReceived();
7443 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7444 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7446 application.SendNotification();
7447 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7449 // We did expect the animation to finish
7450 application.SendNotification();
7451 finishCheck.CheckSignalReceived();
7452 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7456 int UtcDaliAnimationRotateToDegreeVector3(void)
7458 TestApplication application;
7460 Actor actor = Actor::New();
7461 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
7462 Stage::GetCurrent().Add(actor);
7463 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7465 // Build the animation
7466 float durationSeconds(1.0f);
7467 Animation animation = Animation::New(durationSeconds);
7468 Degree targetRotationDegrees(90.0f);
7469 Radian targetRotationRadians(targetRotationDegrees);
7470 animation.RotateTo(actor, targetRotationDegrees/*Degree version*/, Vector3::YAXIS);
7472 // Start the animation
7475 bool signalReceived(false);
7476 AnimationFinishCheck finishCheck(signalReceived);
7477 animation.FinishedSignal().Connect(&application, finishCheck);
7479 application.SendNotification();
7480 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7482 // We didn't expect the animation to finish yet
7483 application.SendNotification();
7484 finishCheck.CheckSignalNotReceived();
7485 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7487 application.SendNotification();
7488 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7490 // We didn't expect the animation to finish yet
7491 application.SendNotification();
7492 finishCheck.CheckSignalNotReceived();
7493 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7495 application.SendNotification();
7496 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7498 // We didn't expect the animation to finish yet
7499 application.SendNotification();
7500 finishCheck.CheckSignalNotReceived();
7501 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7503 application.SendNotification();
7504 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7506 // We did expect the animation to finish
7507 application.SendNotification();
7508 finishCheck.CheckSignalReceived();
7509 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7513 int UtcDaliAnimationRotateToRadianVector3(void)
7515 TestApplication application;
7517 Actor actor = Actor::New();
7518 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
7519 Stage::GetCurrent().Add(actor);
7520 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7522 // Build the animation
7523 float durationSeconds(1.0f);
7524 Animation animation = Animation::New(durationSeconds);
7525 Degree targetRotationDegrees(90.0f);
7526 Radian targetRotationRadians(targetRotationDegrees);
7527 animation.RotateTo(actor, targetRotationRadians/*Radian version*/, Vector3::YAXIS);
7529 // Start the animation
7532 bool signalReceived(false);
7533 AnimationFinishCheck finishCheck(signalReceived);
7534 animation.FinishedSignal().Connect(&application, finishCheck);
7536 application.SendNotification();
7537 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7539 // We didn't expect the animation to finish yet
7540 application.SendNotification();
7541 finishCheck.CheckSignalNotReceived();
7542 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7544 application.SendNotification();
7545 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7547 // We didn't expect the animation to finish yet
7548 application.SendNotification();
7549 finishCheck.CheckSignalNotReceived();
7550 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7552 application.SendNotification();
7553 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7555 // We didn't expect the animation to finish yet
7556 application.SendNotification();
7557 finishCheck.CheckSignalNotReceived();
7558 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7560 application.SendNotification();
7561 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7563 // We did expect the animation to finish
7564 application.SendNotification();
7565 finishCheck.CheckSignalReceived();
7566 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7570 int UtcDaliAnimationRotateToQuaternion(void)
7572 TestApplication application;
7574 Actor actor = Actor::New();
7575 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
7576 Stage::GetCurrent().Add(actor);
7577 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7579 // Build the animation
7580 float durationSeconds(1.0f);
7581 Animation animation = Animation::New(durationSeconds);
7582 Degree targetRotationDegrees(90.0f);
7583 Radian targetRotationRadians(targetRotationDegrees);
7584 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
7585 animation.RotateTo(actor, targetRotation/*Quaternion version*/);
7587 // Start the animation
7590 bool signalReceived(false);
7591 AnimationFinishCheck finishCheck(signalReceived);
7592 animation.FinishedSignal().Connect(&application, finishCheck);
7594 application.SendNotification();
7595 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7597 // We didn't expect the animation to finish yet
7598 application.SendNotification();
7599 finishCheck.CheckSignalNotReceived();
7600 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7602 application.SendNotification();
7603 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7605 // We didn't expect the animation to finish yet
7606 application.SendNotification();
7607 finishCheck.CheckSignalNotReceived();
7608 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7610 application.SendNotification();
7611 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7613 // We didn't expect the animation to finish yet
7614 application.SendNotification();
7615 finishCheck.CheckSignalNotReceived();
7616 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7618 application.SendNotification();
7619 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7621 // We did expect the animation to finish
7622 application.SendNotification();
7623 finishCheck.CheckSignalReceived();
7624 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7628 int UtcDaliAnimationRotateToDegreeVector3Alpha(void)
7630 TestApplication application;
7632 Actor actor = Actor::New();
7633 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
7634 Stage::GetCurrent().Add(actor);
7635 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7637 // Build the animation
7638 float durationSeconds(1.0f);
7639 Animation animation = Animation::New(durationSeconds);
7640 Degree targetRotationDegrees(90.0f);
7641 Radian targetRotationRadians(targetRotationDegrees);
7642 animation.RotateTo(actor, targetRotationDegrees/*Degree version*/, Vector3::YAXIS, AlphaFunctions::EaseIn);
7644 // Start the animation
7647 bool signalReceived(false);
7648 AnimationFinishCheck finishCheck(signalReceived);
7649 animation.FinishedSignal().Connect(&application, finishCheck);
7651 application.SendNotification();
7652 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7654 // We didn't expect the animation to finish yet
7655 application.SendNotification();
7656 finishCheck.CheckSignalNotReceived();
7657 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.25f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7659 application.SendNotification();
7660 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7662 // We didn't expect the animation to finish yet
7663 application.SendNotification();
7664 finishCheck.CheckSignalNotReceived();
7665 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.5f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7667 application.SendNotification();
7668 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7670 // We didn't expect the animation to finish yet
7671 application.SendNotification();
7672 finishCheck.CheckSignalNotReceived();
7673 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7675 application.SendNotification();
7676 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7678 // We did expect the animation to finish
7679 application.SendNotification();
7680 finishCheck.CheckSignalReceived();
7681 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7685 int UtcDaliAnimationRotateToRadianVector3Alpha(void)
7687 TestApplication application;
7689 Actor actor = Actor::New();
7690 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
7691 Stage::GetCurrent().Add(actor);
7692 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7694 // Build the animation
7695 float durationSeconds(1.0f);
7696 Animation animation = Animation::New(durationSeconds);
7697 Degree targetRotationDegrees(90.0f);
7698 Radian targetRotationRadians(targetRotationDegrees);
7699 animation.RotateTo(actor, targetRotationRadians/*Radian version*/, Vector3::YAXIS, AlphaFunctions::EaseIn);
7701 // Start the animation
7704 bool signalReceived(false);
7705 AnimationFinishCheck finishCheck(signalReceived);
7706 animation.FinishedSignal().Connect(&application, finishCheck);
7708 application.SendNotification();
7709 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7711 // We didn't expect the animation to finish yet
7712 application.SendNotification();
7713 finishCheck.CheckSignalNotReceived();
7714 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.25f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7716 application.SendNotification();
7717 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7719 // We didn't expect the animation to finish yet
7720 application.SendNotification();
7721 finishCheck.CheckSignalNotReceived();
7722 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.5f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7724 application.SendNotification();
7725 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7727 // We didn't expect the animation to finish yet
7728 application.SendNotification();
7729 finishCheck.CheckSignalNotReceived();
7730 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7732 application.SendNotification();
7733 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7735 // We did expect the animation to finish
7736 application.SendNotification();
7737 finishCheck.CheckSignalReceived();
7738 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7742 int UtcDaliAnimationRotateToQuaternionAlpha(void)
7744 TestApplication application;
7746 Actor actor = Actor::New();
7747 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
7748 Stage::GetCurrent().Add(actor);
7749 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7751 // Build the animation
7752 float durationSeconds(1.0f);
7753 Animation animation = Animation::New(durationSeconds);
7754 Degree targetRotationDegrees(90.0f);
7755 Radian targetRotationRadians(targetRotationDegrees);
7756 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
7757 animation.RotateTo(actor, targetRotation/*Quaternion version*/, AlphaFunctions::EaseIn);
7759 // Start the animation
7762 bool signalReceived(false);
7763 AnimationFinishCheck finishCheck(signalReceived);
7764 animation.FinishedSignal().Connect(&application, finishCheck);
7766 application.SendNotification();
7767 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7769 // We didn't expect the animation to finish yet
7770 application.SendNotification();
7771 finishCheck.CheckSignalNotReceived();
7772 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.25f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7774 application.SendNotification();
7775 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7777 // We didn't expect the animation to finish yet
7778 application.SendNotification();
7779 finishCheck.CheckSignalNotReceived();
7780 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.5f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7782 application.SendNotification();
7783 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7785 // We didn't expect the animation to finish yet
7786 application.SendNotification();
7787 finishCheck.CheckSignalNotReceived();
7788 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7790 application.SendNotification();
7791 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7793 // We did expect the animation to finish
7794 application.SendNotification();
7795 finishCheck.CheckSignalReceived();
7796 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7800 int UtcDaliAnimationRotateToDegreeVector3AlphaFloat2(void)
7802 TestApplication application;
7804 Actor actor = Actor::New();
7805 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
7806 Stage::GetCurrent().Add(actor);
7807 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7809 // Build the animation
7810 float durationSeconds(1.0f);
7811 Animation animation = Animation::New(durationSeconds);
7812 Degree targetRotationDegrees(90.0f);
7813 Radian targetRotationRadians(targetRotationDegrees);
7815 animation.RotateTo(actor, targetRotationDegrees/*Degree version*/, Vector3::YAXIS, AlphaFunctions::EaseIn, delay, durationSeconds - delay);
7817 // Start the animation
7820 bool signalReceived(false);
7821 AnimationFinishCheck finishCheck(signalReceived);
7822 animation.FinishedSignal().Connect(&application, finishCheck);
7824 application.SendNotification();
7825 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7827 // We didn't expect the animation to finish yet
7828 application.SendNotification();
7829 finishCheck.CheckSignalNotReceived();
7830 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7831 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7833 application.SendNotification();
7834 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7836 // We didn't expect the animation to finish yet
7837 application.SendNotification();
7838 finishCheck.CheckSignalNotReceived();
7839 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7840 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7842 application.SendNotification();
7843 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7845 // We didn't expect the animation to finish yet
7846 application.SendNotification();
7847 finishCheck.CheckSignalNotReceived();
7848 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7849 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7851 application.SendNotification();
7852 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7854 // We did expect the animation to finish
7855 application.SendNotification();
7856 finishCheck.CheckSignalReceived();
7857 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7861 int UtcDaliAnimationRotateToRadianVector3AlphaFloat2(void)
7863 TestApplication application;
7865 Actor actor = Actor::New();
7866 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
7867 Stage::GetCurrent().Add(actor);
7868 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7870 // Build the animation
7871 float durationSeconds(1.0f);
7872 Animation animation = Animation::New(durationSeconds);
7873 Degree targetRotationDegrees(90.0f);
7874 Radian targetRotationRadians(targetRotationDegrees);
7876 animation.RotateTo(actor, targetRotationRadians/*Radian version*/, Vector3::YAXIS, AlphaFunctions::EaseIn, delay, durationSeconds - delay);
7878 // Start the animation
7881 bool signalReceived(false);
7882 AnimationFinishCheck finishCheck(signalReceived);
7883 animation.FinishedSignal().Connect(&application, finishCheck);
7885 application.SendNotification();
7886 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7888 // We didn't expect the animation to finish yet
7889 application.SendNotification();
7890 finishCheck.CheckSignalNotReceived();
7891 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7892 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7894 application.SendNotification();
7895 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7897 // We didn't expect the animation to finish yet
7898 application.SendNotification();
7899 finishCheck.CheckSignalNotReceived();
7900 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7901 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7903 application.SendNotification();
7904 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7906 // We didn't expect the animation to finish yet
7907 application.SendNotification();
7908 finishCheck.CheckSignalNotReceived();
7909 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7910 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7912 application.SendNotification();
7913 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7915 // We did expect the animation to finish
7916 application.SendNotification();
7917 finishCheck.CheckSignalReceived();
7918 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7922 int UtcDaliAnimationRotateToQuaternionAlphaFloat2(void)
7924 TestApplication application;
7926 Actor actor = Actor::New();
7927 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
7928 Stage::GetCurrent().Add(actor);
7929 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7931 // Build the animation
7932 float durationSeconds(1.0f);
7933 Animation animation = Animation::New(durationSeconds);
7934 Degree targetRotationDegrees(90.0f);
7935 Radian targetRotationRadians(targetRotationDegrees);
7937 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
7938 animation.RotateTo(actor, targetRotation/*Quaternion version*/, AlphaFunctions::EaseIn, delay, durationSeconds - delay);
7940 // Start the animation
7943 bool signalReceived(false);
7944 AnimationFinishCheck finishCheck(signalReceived);
7945 animation.FinishedSignal().Connect(&application, finishCheck);
7947 application.SendNotification();
7948 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7950 // We didn't expect the animation to finish yet
7951 application.SendNotification();
7952 finishCheck.CheckSignalNotReceived();
7953 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7954 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7956 application.SendNotification();
7957 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7959 // We didn't expect the animation to finish yet
7960 application.SendNotification();
7961 finishCheck.CheckSignalNotReceived();
7962 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7963 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7965 application.SendNotification();
7966 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7968 // We didn't expect the animation to finish yet
7969 application.SendNotification();
7970 finishCheck.CheckSignalNotReceived();
7971 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7972 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7974 application.SendNotification();
7975 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7977 // We did expect the animation to finish
7978 application.SendNotification();
7979 finishCheck.CheckSignalReceived();
7980 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7984 int UtcDaliAnimationScaleBy(void)
7986 TestApplication application;
7988 Actor actor = Actor::New();
7989 Stage::GetCurrent().Add(actor);
7990 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7992 // Build the animation
7993 float durationSeconds(1.0f);
7994 Animation animation = Animation::New(durationSeconds);
7995 Vector3 targetScale(2.0f, 2.0f, 2.0f);
7996 Vector3 relativeScale(targetScale - Vector3::ONE);
7997 animation.ScaleBy(actor, relativeScale.x, relativeScale.y, relativeScale.z);
7999 Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale*0.99f);
8001 // Start the animation
8004 bool signalReceived(false);
8005 AnimationFinishCheck finishCheck(signalReceived);
8006 animation.FinishedSignal().Connect(&application, finishCheck);
8008 application.SendNotification();
8009 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8011 // We didn't expect the animation to finish yet
8012 application.SendNotification();
8013 finishCheck.CheckSignalNotReceived();
8014 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
8016 application.SendNotification();
8017 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8019 // We did expect the animation to finish
8020 application.SendNotification();
8021 finishCheck.CheckSignalReceived();
8022 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
8025 finishCheck.Reset();
8026 actor.SetScale(Vector3::ONE);
8027 application.SendNotification();
8028 application.Render(0);
8029 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
8031 // Repeat with a different (ease-in) alpha function
8032 animation = Animation::New(durationSeconds);
8033 animation.ScaleBy(actor, relativeScale, AlphaFunctions::EaseIn);
8034 animation.FinishedSignal().Connect(&application, finishCheck);
8037 application.SendNotification();
8038 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8040 // We didn't expect the animation to finish yet
8041 application.SendNotification();
8042 finishCheck.CheckSignalNotReceived();
8044 // The scale should have grown less, than with a linear alpha function
8045 Vector3 current(actor.GetCurrentScale());
8046 DALI_TEST_CHECK( current.x > 1.0f );
8047 DALI_TEST_CHECK( current.y > 1.0f );
8048 DALI_TEST_CHECK( current.z > 1.0f );
8049 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
8050 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
8051 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
8053 application.SendNotification();
8054 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8056 // We did expect the animation to finish
8057 application.SendNotification();
8058 finishCheck.CheckSignalReceived();
8059 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
8062 finishCheck.Reset();
8063 actor.SetScale(Vector3::ONE);
8064 application.SendNotification();
8065 application.Render(0);
8066 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
8068 // Repeat with a delay
8070 animation = Animation::New(durationSeconds);
8071 animation.ScaleBy(actor, relativeScale, AlphaFunctions::Linear, delay, durationSeconds - delay);
8072 animation.FinishedSignal().Connect(&application, finishCheck);
8075 application.SendNotification();
8076 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
8078 // We didn't expect the animation to finish yet
8079 application.SendNotification();
8080 finishCheck.CheckSignalNotReceived();
8081 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
8083 application.SendNotification();
8084 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8086 // We did expect the animation to finish
8087 application.SendNotification();
8088 finishCheck.CheckSignalReceived();
8089 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
8093 int UtcDaliAnimationScaleTo(void)
8095 TestApplication application;
8097 Actor actor = Actor::New();
8098 Stage::GetCurrent().Add(actor);
8099 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
8101 // Build the animation
8102 float durationSeconds(1.0f);
8103 Animation animation = Animation::New(durationSeconds);
8104 Vector3 targetScale(2.0f, 2.0f, 2.0f);
8105 animation.ScaleTo(actor, targetScale.x, targetScale.y, targetScale.z);
8107 Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f);
8109 // Start the animation
8112 bool signalReceived(false);
8113 AnimationFinishCheck finishCheck(signalReceived);
8114 animation.FinishedSignal().Connect(&application, finishCheck);
8116 application.SendNotification();
8117 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8119 // We didn't expect the animation to finish yet
8120 application.SendNotification();
8121 finishCheck.CheckSignalNotReceived();
8122 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
8124 application.SendNotification();
8125 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8127 // We did expect the animation to finish
8128 application.SendNotification();
8129 finishCheck.CheckSignalReceived();
8130 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
8133 finishCheck.Reset();
8134 actor.SetScale(Vector3::ONE);
8135 application.SendNotification();
8136 application.Render(0);
8137 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
8139 // Repeat with a different (ease-in) alpha function
8140 animation = Animation::New(durationSeconds);
8141 animation.ScaleTo(actor, targetScale, AlphaFunctions::EaseIn);
8142 animation.FinishedSignal().Connect(&application, finishCheck);
8145 application.SendNotification();
8146 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8148 // We didn't expect the animation to finish yet
8149 application.SendNotification();
8150 finishCheck.CheckSignalNotReceived();
8152 // The scale should have grown less, than with a linear alpha function
8153 Vector3 current(actor.GetCurrentScale());
8154 DALI_TEST_CHECK( current.x > 1.0f );
8155 DALI_TEST_CHECK( current.y > 1.0f );
8156 DALI_TEST_CHECK( current.z > 1.0f );
8157 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
8158 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
8159 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
8161 application.SendNotification();
8162 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8164 // We did expect the animation to finish
8165 application.SendNotification();
8166 finishCheck.CheckSignalReceived();
8167 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
8170 finishCheck.Reset();
8171 actor.SetScale(Vector3::ONE);
8172 application.SendNotification();
8173 application.Render(0);
8174 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
8176 // Repeat with a delay
8178 animation = Animation::New(durationSeconds);
8179 animation.ScaleTo(actor, targetScale, AlphaFunctions::Linear, delay, durationSeconds - delay);
8180 animation.FinishedSignal().Connect(&application, finishCheck);
8183 application.SendNotification();
8184 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
8186 // We didn't expect the animation to finish yet
8187 application.SendNotification();
8188 finishCheck.CheckSignalNotReceived();
8189 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
8191 application.SendNotification();
8192 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8194 // We did expect the animation to finish
8195 application.SendNotification();
8196 finishCheck.CheckSignalReceived();
8197 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
8201 int UtcDaliAnimationShow(void)
8203 TestApplication application;
8205 Actor actor = Actor::New();
8206 actor.SetVisible(false);
8207 application.SendNotification();
8208 application.Render(0);
8209 DALI_TEST_CHECK( !actor.IsVisible() );
8210 Stage::GetCurrent().Add(actor);
8212 // Start the animation
8213 float durationSeconds(10.0f);
8214 Animation animation = Animation::New(durationSeconds);
8215 animation.Show(actor, durationSeconds*0.5f);
8218 bool signalReceived(false);
8219 AnimationFinishCheck finishCheck(signalReceived);
8220 animation.FinishedSignal().Connect(&application, finishCheck);
8222 application.SendNotification();
8223 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
8225 // We didn't expect the animation to finish yet
8226 application.SendNotification();
8227 finishCheck.CheckSignalNotReceived();
8228 DALI_TEST_CHECK( !actor.IsVisible() );
8230 application.SendNotification();
8231 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be shown now*/);
8233 // We didn't expect the animation to finish yet
8234 application.SendNotification();
8235 finishCheck.CheckSignalNotReceived();
8236 DALI_TEST_CHECK( actor.IsVisible() );
8238 application.SendNotification();
8239 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8241 // We did expect the animation to finish
8242 application.SendNotification();
8243 finishCheck.CheckSignalReceived();
8244 DALI_TEST_CHECK( actor.IsVisible() );
8248 int UtcDaliAnimationHide(void)
8250 TestApplication application;
8252 Actor actor = Actor::New();
8253 DALI_TEST_CHECK( actor.IsVisible() );
8254 Stage::GetCurrent().Add(actor);
8256 // Start the animation
8257 float durationSeconds(10.0f);
8258 Animation animation = Animation::New(durationSeconds);
8259 animation.Hide(actor, durationSeconds*0.5f);
8262 bool signalReceived(false);
8263 AnimationFinishCheck finishCheck(signalReceived);
8264 animation.FinishedSignal().Connect(&application, finishCheck);
8266 application.SendNotification();
8267 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
8269 // We didn't expect the animation to finish yet
8270 application.SendNotification();
8271 finishCheck.CheckSignalNotReceived();
8272 DALI_TEST_CHECK( actor.IsVisible() );
8274 application.SendNotification();
8275 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be hidden now*/);
8277 // We didn't expect the animation to finish yet
8278 application.SendNotification();
8279 finishCheck.CheckSignalNotReceived();
8280 DALI_TEST_CHECK( !actor.IsVisible() );
8282 application.SendNotification();
8283 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8285 // We did expect the animation to finish
8286 application.SendNotification();
8287 finishCheck.CheckSignalReceived();
8288 DALI_TEST_CHECK( !actor.IsVisible() );
8292 int UtcDaliAnimationShowHideAtEnd(void)
8294 // Test that show/hide delay can be the same as animation duration
8295 // i.e. to show/hide at the end of the animation
8297 TestApplication application;
8299 Actor actor = Actor::New();
8300 DALI_TEST_CHECK( actor.IsVisible() );
8301 Stage::GetCurrent().Add(actor);
8303 // Start Hide animation
8304 float durationSeconds(10.0f);
8305 Animation animation = Animation::New(durationSeconds);
8306 animation.Hide(actor, durationSeconds/*Hide at end*/);
8309 bool signalReceived(false);
8310 AnimationFinishCheck finishCheck(signalReceived);
8311 animation.FinishedSignal().Connect(&application, finishCheck);
8313 application.SendNotification();
8314 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
8316 // We did expect the animation to finish
8317 application.SendNotification();
8318 finishCheck.CheckSignalReceived();
8319 DALI_TEST_CHECK( !actor.IsVisible() );
8321 // Start Show animation
8322 animation = Animation::New(durationSeconds);
8323 animation.Show(actor, durationSeconds/*Show at end*/);
8324 animation.FinishedSignal().Connect(&application, finishCheck);
8327 application.SendNotification();
8328 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
8330 // We did expect the animation to finish
8331 application.SendNotification();
8332 finishCheck.CheckSignalReceived();
8333 DALI_TEST_CHECK( actor.IsVisible() );
8337 int UtcDaliAnimationOpacityBy(void)
8339 TestApplication application;
8340 Actor actor = Actor::New();
8341 float startingOpacity(0.5f);
8342 actor.SetOpacity(startingOpacity);
8343 application.SendNotification();
8344 application.Render(0);
8345 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity, TEST_LOCATION );
8346 Stage::GetCurrent().Add(actor);
8348 // Build the animation
8349 float durationSeconds(1.0f);
8350 Animation animation = Animation::New(durationSeconds);
8351 float relativeOpacity(-0.5f); // target of zero
8352 animation.OpacityBy(actor, relativeOpacity);
8354 float seventyFivePercentProgress((1.0f - 0.75f) * startingOpacity);
8356 // Start the animation
8359 bool signalReceived(false);
8360 AnimationFinishCheck finishCheck(signalReceived);
8361 animation.FinishedSignal().Connect(&application, finishCheck);
8363 application.SendNotification();
8364 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
8366 // We didn't expect the animation to finish yet
8367 application.SendNotification();
8368 finishCheck.CheckSignalNotReceived();
8369 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), seventyFivePercentProgress, TEST_LOCATION );
8371 application.SendNotification();
8372 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8374 // We did expect the animation to finish
8375 application.SendNotification();
8376 finishCheck.CheckSignalReceived();
8377 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity+relativeOpacity, TEST_LOCATION );
8380 finishCheck.Reset();
8381 actor.SetOpacity(startingOpacity);
8382 application.SendNotification();
8383 application.Render(0);
8384 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity, TEST_LOCATION );
8386 // Repeat with a different (ease-in) alpha function
8387 animation = Animation::New(durationSeconds);
8388 animation.OpacityBy(actor, relativeOpacity, AlphaFunctions::EaseIn);
8389 animation.FinishedSignal().Connect(&application, finishCheck);
8392 application.SendNotification();
8393 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
8395 // We didn't expect the animation to finish yet
8396 application.SendNotification();
8397 finishCheck.CheckSignalNotReceived();
8399 // The opacity should reduce less, than with a linear alpha function
8400 float current(actor.GetCurrentOpacity());
8401 DALI_TEST_CHECK( current < 1.0f );
8402 DALI_TEST_CHECK( current > seventyFivePercentProgress );
8404 application.SendNotification();
8405 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8407 // We did expect the animation to finish
8408 application.SendNotification();
8409 finishCheck.CheckSignalReceived();
8410 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity+relativeOpacity, TEST_LOCATION );
8413 finishCheck.Reset();
8414 actor.SetOpacity(startingOpacity);
8415 application.SendNotification();
8416 application.Render(0);
8417 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity, TEST_LOCATION );
8419 // Repeat with a delay
8421 animation = Animation::New(durationSeconds);
8422 animation.OpacityBy(actor, relativeOpacity, AlphaFunctions::Linear, delay, durationSeconds - delay);
8423 animation.FinishedSignal().Connect(&application, finishCheck);
8426 application.SendNotification();
8427 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
8429 // We didn't expect the animation to finish yet
8430 application.SendNotification();
8431 finishCheck.CheckSignalNotReceived();
8432 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity, TEST_LOCATION );
8434 application.SendNotification();
8435 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
8437 // We didn't expect the animation to finish yet
8438 application.SendNotification();
8439 finishCheck.CheckSignalNotReceived();
8440 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), seventyFivePercentProgress, TEST_LOCATION );
8442 application.SendNotification();
8443 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
8445 // We did expect the animation to finish
8446 application.SendNotification();
8447 finishCheck.CheckSignalReceived();
8448 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity+relativeOpacity, TEST_LOCATION );
8452 int UtcDaliAnimationOpacityTo(void)
8454 TestApplication application;
8456 Actor actor = Actor::New();
8457 Stage::GetCurrent().Add(actor);
8458 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
8460 // Build the animation
8461 float durationSeconds(1.0f);
8462 Animation animation = Animation::New(durationSeconds);
8463 float targetOpacity(0.0f);
8464 animation.OpacityTo(actor, targetOpacity);
8466 float ninetyNinePercentProgress(0.01f);
8468 // Start the animation
8471 bool signalReceived(false);
8472 AnimationFinishCheck finishCheck(signalReceived);
8473 animation.FinishedSignal().Connect(&application, finishCheck);
8475 application.SendNotification();
8476 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8478 // We didn't expect the animation to finish yet
8479 application.SendNotification();
8480 finishCheck.CheckSignalNotReceived();
8481 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), ninetyNinePercentProgress, 0.001f, TEST_LOCATION );
8483 application.SendNotification();
8484 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8486 // We did expect the animation to finish
8487 application.SendNotification();
8488 finishCheck.CheckSignalReceived();
8489 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), targetOpacity, TEST_LOCATION );
8492 finishCheck.Reset();
8493 actor.SetOpacity(1.0f);
8494 application.SendNotification();
8495 application.Render(0);
8496 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
8498 // Repeat with a different (ease-in) alpha function
8499 animation = Animation::New(durationSeconds);
8500 animation.OpacityTo(actor, targetOpacity, AlphaFunctions::EaseIn);
8501 animation.FinishedSignal().Connect(&application, finishCheck);
8504 application.SendNotification();
8505 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8507 // We didn't expect the animation to finish yet
8508 application.SendNotification();
8509 finishCheck.CheckSignalNotReceived();
8511 // The opacity should reduce less, than with a linear alpha function
8512 float current(actor.GetCurrentOpacity());
8513 DALI_TEST_CHECK( current < 1.0f );
8514 DALI_TEST_CHECK( current > ninetyNinePercentProgress );
8516 application.SendNotification();
8517 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8519 // We did expect the animation to finish
8520 application.SendNotification();
8521 finishCheck.CheckSignalReceived();
8522 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), targetOpacity, TEST_LOCATION );
8525 finishCheck.Reset();
8526 actor.SetOpacity(1.0f);
8527 application.SendNotification();
8528 application.Render(0);
8529 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
8531 // Repeat with a delay
8533 animation = Animation::New(durationSeconds);
8534 animation.OpacityTo(actor, targetOpacity, AlphaFunctions::Linear, delay, durationSeconds - delay);
8535 animation.FinishedSignal().Connect(&application, finishCheck);
8538 application.SendNotification();
8539 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
8541 // We didn't expect the animation to finish yet
8542 application.SendNotification();
8543 finishCheck.CheckSignalNotReceived();
8544 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
8546 application.SendNotification();
8547 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8549 // We did expect the animation to finish
8550 application.SendNotification();
8551 finishCheck.CheckSignalReceived();
8552 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), targetOpacity, TEST_LOCATION );
8556 int UtcDaliAnimationColorBy(void)
8558 TestApplication application;
8560 Actor actor = Actor::New();
8561 actor.SetColor(Color::BLACK);
8562 application.SendNotification();
8563 application.Render(0);
8564 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::BLACK, TEST_LOCATION );
8565 Stage::GetCurrent().Add(actor);
8567 // Build the animation
8568 float durationSeconds(1.0f);
8569 Animation animation = Animation::New(durationSeconds);
8570 Vector4 targetColor(Color::GREEN);
8571 Vector4 relativeColor(Color::GREEN); // Note the alpha is automatically clamped <= 1.0f in world color
8572 animation.ColorBy(actor, relativeColor);
8574 Vector4 tenPercentProgress(Vector4(0.0f, 0.1f, 0.0f, 1.0f));
8575 Vector4 twentyPercentProgress(Vector4(0.0f, 0.2f, 0.0f, 1.0f));
8577 // Start the animation
8580 bool signalReceived(false);
8581 AnimationFinishCheck finishCheck(signalReceived);
8582 animation.FinishedSignal().Connect(&application, finishCheck);
8584 application.SendNotification();
8585 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8587 // We didn't expect the animation to finish yet
8588 application.SendNotification();
8589 finishCheck.CheckSignalNotReceived();
8590 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), tenPercentProgress, TEST_LOCATION );
8592 application.SendNotification();
8593 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
8595 // We did expect the animation to finish
8596 application.SendNotification();
8597 finishCheck.CheckSignalReceived();
8598 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), targetColor, TEST_LOCATION );
8601 finishCheck.Reset();
8602 actor.SetColor(Color::BLACK);
8603 application.SendNotification();
8604 application.Render(0);
8605 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), Color::BLACK, TEST_LOCATION );
8607 // Repeat with a different (ease-in) alpha function
8608 animation = Animation::New(durationSeconds);
8609 animation.ColorBy(actor, relativeColor, AlphaFunctions::EaseIn);
8610 animation.FinishedSignal().Connect(&application, finishCheck);
8613 application.SendNotification();
8614 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8616 // We didn't expect the animation to finish yet
8617 application.SendNotification();
8618 finishCheck.CheckSignalNotReceived();
8620 // The color should have changed less, than with a linear alpha function
8621 Vector4 current(actor.GetCurrentWorldColor());
8622 DALI_TEST_CHECK( current.x == 0.0f ); // doesn't change
8623 DALI_TEST_CHECK( current.y > 0.0f );
8624 DALI_TEST_CHECK( current.y < tenPercentProgress.y );
8625 DALI_TEST_CHECK( current.z == 0.0f ); // doesn't change
8626 DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
8628 application.SendNotification();
8629 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
8631 // We did expect the animation to finish
8632 application.SendNotification();
8633 finishCheck.CheckSignalReceived();
8634 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), targetColor, TEST_LOCATION );
8637 finishCheck.Reset();
8638 actor.SetColor(Color::BLACK);
8639 application.SendNotification();
8640 application.Render(0);
8641 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), Color::BLACK, TEST_LOCATION );
8643 // Repeat with a shorter animator duration
8644 float animatorDuration = 0.5f;
8645 animation = Animation::New(durationSeconds);
8646 animation.ColorBy(actor, relativeColor, AlphaFunctions::Linear, 0, animatorDuration);
8647 animation.FinishedSignal().Connect(&application, finishCheck);
8650 application.SendNotification();
8651 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
8653 // We didn't expect the animation to finish yet
8654 application.SendNotification();
8655 finishCheck.CheckSignalNotReceived();
8656 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), twentyPercentProgress, TEST_LOCATION );
8658 application.SendNotification();
8659 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
8661 // We didn't expect the animation to finish yet
8662 application.SendNotification();
8663 finishCheck.CheckSignalNotReceived();
8664 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), targetColor, TEST_LOCATION );
8666 application.SendNotification();
8667 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8669 // We did expect the animation to finish
8670 application.SendNotification();
8671 finishCheck.CheckSignalReceived();
8672 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), targetColor, TEST_LOCATION );
8676 int UtcDaliAnimationColorTo(void)
8678 TestApplication application;
8680 Actor actor = Actor::New();
8681 Stage::GetCurrent().Add(actor);
8682 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
8684 // Build the animation
8685 float durationSeconds(1.0f);
8686 Animation animation = Animation::New(durationSeconds);
8687 Vector4 targetColor(Color::RED);
8688 animation.ColorTo(actor, targetColor);
8690 Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
8691 Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
8693 // Start the animation
8696 bool signalReceived(false);
8697 AnimationFinishCheck finishCheck(signalReceived);
8698 animation.FinishedSignal().Connect(&application, finishCheck);
8700 application.SendNotification();
8701 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8703 // We didn't expect the animation to finish yet
8704 application.SendNotification();
8705 finishCheck.CheckSignalNotReceived();
8706 DALI_TEST_EQUALS( actor.GetCurrentColor(), tenPercentProgress, TEST_LOCATION );
8708 application.SendNotification();
8709 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
8711 // We did expect the animation to finish
8712 application.SendNotification();
8713 finishCheck.CheckSignalReceived();
8714 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8717 finishCheck.Reset();
8718 actor.SetColor(Color::WHITE);
8719 application.SendNotification();
8720 application.Render(0);
8721 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
8723 // Repeat with a different (ease-in) alpha function
8724 animation = Animation::New(durationSeconds);
8725 animation.ColorTo(actor, targetColor, AlphaFunctions::EaseIn);
8726 animation.FinishedSignal().Connect(&application, finishCheck);
8729 application.SendNotification();
8730 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8732 // We didn't expect the animation to finish yet
8733 application.SendNotification();
8734 finishCheck.CheckSignalNotReceived();
8736 // The color should have changed less, than with a linear alpha function
8737 Vector4 current(actor.GetCurrentColor());
8738 DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change
8739 DALI_TEST_CHECK( current.y < 1.0f );
8740 DALI_TEST_CHECK( current.y > tenPercentProgress.y );
8741 DALI_TEST_CHECK( current.z < 1.0f );
8742 DALI_TEST_CHECK( current.z > tenPercentProgress.z );
8743 DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
8745 application.SendNotification();
8746 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
8748 // We did expect the animation to finish
8749 application.SendNotification();
8750 finishCheck.CheckSignalReceived();
8751 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8754 finishCheck.Reset();
8755 actor.SetColor(Color::WHITE);
8756 application.SendNotification();
8757 application.Render(0);
8758 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
8760 // Repeat with a shorter animator duration
8761 float animatorDuration = 0.5f;
8762 animation = Animation::New(durationSeconds);
8763 animation.ColorTo(actor, targetColor, AlphaFunctions::Linear, 0, animatorDuration);
8764 animation.FinishedSignal().Connect(&application, finishCheck);
8767 application.SendNotification();
8768 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
8770 // We didn't expect the animation to finish yet
8771 application.SendNotification();
8772 finishCheck.CheckSignalNotReceived();
8773 DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION );
8775 application.SendNotification();
8776 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
8778 // We didn't expect the animation to finish yet
8779 application.SendNotification();
8780 finishCheck.CheckSignalNotReceived();
8781 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8783 application.SendNotification();
8784 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8786 // We did expect the animation to finish
8787 application.SendNotification();
8788 finishCheck.CheckSignalReceived();
8789 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8793 int UtcDaliAnimationResize(void)
8795 TestApplication application;
8797 Actor actor = Actor::New();
8798 Stage::GetCurrent().Add(actor);
8799 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
8801 // Build the animation
8802 float durationSeconds(1.0f);
8803 Animation animation = Animation::New(durationSeconds);
8804 Vector3 targetSize(100.0f, 100.0f, 100.0f);
8805 animation.Resize(actor, targetSize);
8807 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
8809 // Start the animation
8812 bool signalReceived(false);
8813 AnimationFinishCheck finishCheck(signalReceived);
8814 animation.FinishedSignal().Connect(&application, finishCheck);
8816 application.SendNotification();
8817 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8819 // We didn't expect the animation to finish yet
8820 application.SendNotification();
8821 finishCheck.CheckSignalNotReceived();
8822 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
8824 application.SendNotification();
8825 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8827 // We did expect the animation to finish
8828 application.SendNotification();
8829 finishCheck.CheckSignalReceived();
8830 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
8833 finishCheck.Reset();
8834 actor.SetSize(Vector3::ZERO);
8835 application.SendNotification();
8836 application.Render(0);
8837 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
8839 // Repeat with a different (ease-in) alpha function
8840 animation = Animation::New(durationSeconds);
8841 animation.Resize(actor, targetSize, AlphaFunctions::EaseIn);
8842 animation.FinishedSignal().Connect(&application, finishCheck);
8845 application.SendNotification();
8846 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8848 // We didn't expect the animation to finish yet
8849 application.SendNotification();
8850 finishCheck.CheckSignalNotReceived();
8852 // The size should have travelled less, than with a linear alpha function
8853 Vector3 current(actor.GetCurrentSize());
8854 DALI_TEST_CHECK( current.x > 0.0f );
8855 DALI_TEST_CHECK( current.y > 0.0f );
8856 DALI_TEST_CHECK( current.z > 0.0f );
8857 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
8858 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
8859 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
8861 application.SendNotification();
8862 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8864 // We did expect the animation to finish
8865 application.SendNotification();
8866 finishCheck.CheckSignalReceived();
8867 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
8870 finishCheck.Reset();
8871 actor.SetSize(Vector3::ZERO);
8872 application.SendNotification();
8873 application.Render(0);
8874 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
8876 // Repeat with a delay
8878 animation = Animation::New(durationSeconds);
8879 animation.Resize(actor, targetSize, AlphaFunctions::Linear, delay, durationSeconds - delay);
8880 animation.FinishedSignal().Connect(&application, finishCheck);
8883 application.SendNotification();
8884 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
8886 // We didn't expect the animation to finish yet
8887 application.SendNotification();
8888 finishCheck.CheckSignalNotReceived();
8889 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
8891 application.SendNotification();
8892 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8894 // We did expect the animation to finish
8895 application.SendNotification();
8896 finishCheck.CheckSignalReceived();
8897 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
8901 int UtcDaliKeyFramesCreateDestroy(void)
8903 tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
8905 KeyFrames* keyFrames = new KeyFrames;
8907 DALI_TEST_CHECK( true );
8911 int UtcDaliKeyFramesDownCast(void)
8913 TestApplication application;
8914 tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
8916 KeyFrames keyFrames = KeyFrames::New();
8917 BaseHandle object(keyFrames);
8919 KeyFrames keyFrames2 = KeyFrames::DownCast(object);
8920 DALI_TEST_CHECK(keyFrames2);
8922 KeyFrames keyFrames3 = DownCast< KeyFrames >(object);
8923 DALI_TEST_CHECK(keyFrames3);
8925 BaseHandle unInitializedObject;
8926 KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
8927 DALI_TEST_CHECK(!keyFrames4);
8929 KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject);
8930 DALI_TEST_CHECK(!keyFrames5);
8934 int UtcDaliAnimationResizeByXY(void)
8936 TestApplication application;
8938 Actor actor = Actor::New();
8939 Stage::GetCurrent().Add(actor);
8940 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
8942 // Build the animation
8943 float durationSeconds(1.0f);
8944 Animation animation = Animation::New(durationSeconds);
8945 Vector3 targetSize(100.0f, 100.0f, 100.0f);
8946 animation.Resize(actor, targetSize);
8948 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
8950 // Start the animation
8953 bool signalReceived(false);
8954 AnimationFinishCheck finishCheck(signalReceived);
8955 animation.FinishedSignal().Connect(&application, finishCheck);
8957 application.SendNotification();
8958 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8960 // We didn't expect the animation to finish yet
8961 application.SendNotification();
8962 finishCheck.CheckSignalNotReceived();
8963 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
8965 application.SendNotification();
8966 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8968 // We did expect the animation to finish
8969 application.SendNotification();
8970 finishCheck.CheckSignalReceived();
8971 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
8974 finishCheck.Reset();
8975 actor.SetSize(Vector3::ZERO);
8976 application.SendNotification();
8977 application.Render(0);
8978 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
8980 // Repeat with a different (ease-in) alpha function
8981 animation = Animation::New(durationSeconds);
8982 animation.Resize(actor, targetSize.x, targetSize.y, AlphaFunctions::EaseIn);
8983 animation.FinishedSignal().Connect(&application, finishCheck);
8986 application.SendNotification();
8987 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8989 // We didn't expect the animation to finish yet
8990 application.SendNotification();
8991 finishCheck.CheckSignalNotReceived();
8993 // The size should have travelled less, than with a linear alpha function
8994 Vector3 current(actor.GetCurrentSize());
8995 DALI_TEST_CHECK( current.x > 0.0f );
8996 DALI_TEST_CHECK( current.y > 0.0f );
8997 DALI_TEST_CHECK( current.z > 0.0f );
8998 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
8999 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
9000 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
9002 application.SendNotification();
9003 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
9005 // We did expect the animation to finish
9006 application.SendNotification();
9007 finishCheck.CheckSignalReceived();
9008 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
9011 finishCheck.Reset();
9012 actor.SetSize(Vector3::ZERO);
9013 application.SendNotification();
9014 application.Render(0);
9015 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
9017 // Repeat with a delay
9019 animation = Animation::New(durationSeconds);
9020 animation.Resize(actor, targetSize.x, targetSize.y, AlphaFunctions::Linear, delay, durationSeconds - delay);
9021 animation.FinishedSignal().Connect(&application, finishCheck);
9024 application.SendNotification();
9025 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
9027 // We didn't expect the animation to finish yet
9028 application.SendNotification();
9029 finishCheck.CheckSignalNotReceived();
9030 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
9032 application.SendNotification();
9033 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
9035 // We did expect the animation to finish
9036 application.SendNotification();
9037 finishCheck.CheckSignalReceived();
9038 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
9043 int UtcDaliAnimationAnimateBetweenActorColorTimePeriod(void)
9045 TestApplication application;
9047 float startValue(1.0f);
9048 Actor actor = Actor::New();
9049 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9050 Stage::GetCurrent().Add(actor);
9052 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9053 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
9054 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
9055 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
9056 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
9058 // Build the animation
9059 float durationSeconds(1.0f);
9060 Animation animation = Animation::New(durationSeconds);
9062 KeyFrames keyFrames = KeyFrames::New();
9063 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9064 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9065 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9067 animation.AnimateBetween( Property(actor, Actor::COLOR), keyFrames, TimePeriod( 1.0f) );
9069 // Start the animation
9072 bool signalReceived(false);
9073 AnimationFinishCheck finishCheck(signalReceived);
9074 animation.FinishedSignal().Connect(&application, finishCheck);
9075 application.SendNotification();
9076 application.Render(0);
9077 application.SendNotification();
9078 finishCheck.CheckSignalNotReceived();
9079 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
9080 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
9081 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
9082 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
9084 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9085 application.SendNotification();
9086 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
9087 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
9088 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
9089 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
9091 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9092 application.SendNotification();
9093 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
9094 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
9095 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
9096 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
9098 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9099 application.SendNotification();
9100 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
9101 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
9102 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
9103 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
9105 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9106 application.SendNotification();
9107 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
9108 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
9109 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
9110 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
9112 // We did expect the animation to finish
9114 finishCheck.CheckSignalReceived();
9118 int UtcDaliAnimationAnimateBetweenActorColorFunction(void)
9120 TestApplication application;
9122 float startValue(1.0f);
9123 Actor actor = Actor::New();
9124 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9125 Stage::GetCurrent().Add(actor);
9127 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9128 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
9129 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
9130 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
9131 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
9133 // Build the animation
9134 float durationSeconds(1.0f);
9135 Animation animation = Animation::New(durationSeconds);
9137 KeyFrames keyFrames = KeyFrames::New();
9138 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9139 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9140 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9142 animation.AnimateBetween( Property(actor, Actor::COLOR), keyFrames, AlphaFunctions::Linear );
9144 // Start the animation
9147 bool signalReceived(false);
9148 AnimationFinishCheck finishCheck(signalReceived);
9149 animation.FinishedSignal().Connect(&application, finishCheck);
9150 application.SendNotification();
9151 application.Render(0);
9152 application.SendNotification();
9153 finishCheck.CheckSignalNotReceived();
9154 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
9155 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
9156 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
9157 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
9159 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9160 application.SendNotification();
9161 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
9162 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
9163 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
9164 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
9166 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9167 application.SendNotification();
9168 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
9169 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
9170 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
9171 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
9173 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9174 application.SendNotification();
9175 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
9176 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
9177 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
9178 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
9180 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9181 application.SendNotification();
9182 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
9183 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
9184 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
9185 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
9187 // We did expect the animation to finish
9189 finishCheck.CheckSignalReceived();
9193 int UtcDaliAnimationAnimateBetweenActorColorFunctionTimePeriod(void)
9195 TestApplication application;
9197 float startValue(1.0f);
9198 Actor actor = Actor::New();
9199 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9200 Stage::GetCurrent().Add(actor);
9202 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9203 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
9204 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
9205 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
9206 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
9208 // Build the animation
9209 float durationSeconds(1.0f);
9210 Animation animation = Animation::New(durationSeconds);
9212 KeyFrames keyFrames = KeyFrames::New();
9213 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9214 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9215 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9217 animation.AnimateBetween( Property(actor, Actor::COLOR), keyFrames, AlphaFunctions::Linear, TimePeriod( 1.0f) );
9219 // Start the animation
9222 bool signalReceived(false);
9223 AnimationFinishCheck finishCheck(signalReceived);
9224 animation.FinishedSignal().Connect(&application, finishCheck);
9225 application.SendNotification();
9226 application.Render(0);
9227 application.SendNotification();
9228 finishCheck.CheckSignalNotReceived();
9229 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
9230 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
9231 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
9232 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
9234 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9235 application.SendNotification();
9236 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
9237 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
9238 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
9239 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
9241 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9242 application.SendNotification();
9243 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
9244 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
9245 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
9246 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
9248 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9249 application.SendNotification();
9250 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
9251 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
9252 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
9253 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
9255 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9256 application.SendNotification();
9257 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
9258 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
9259 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
9260 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
9262 // We did expect the animation to finish
9264 finishCheck.CheckSignalReceived();
9268 int UtcDaliAnimationCreateDestroy(void)
9270 TestApplication application;
9271 Animation* animation = new Animation;
9272 DALI_TEST_CHECK( animation );
9277 struct UpdateManagerTestConstraint
9279 UpdateManagerTestConstraint(TestApplication& application)
9280 : mApplication(application)
9284 Vector3 operator()(const Vector3& current)
9286 mApplication.SendNotification(); // Process events
9290 TestApplication& mApplication;
9293 int UtcDaliAnimationUpdateManager(void)
9295 TestApplication application;
9297 Actor actor = Actor::New();
9298 Stage::GetCurrent().Add( actor );
9300 // Build the animation
9301 Animation animation = Animation::New( 0.0f );
9303 bool signalReceived = false;
9304 AnimationFinishCheck finishCheck( signalReceived );
9305 animation.FinishedSignal().Connect( &application, finishCheck );
9307 Vector3 startValue(1.0f, 1.0f, 1.0f);
9308 Property::Index index = actor.RegisterProperty( "test-property", startValue );
9309 Constraint constraint = Constraint::New<Vector3>( index, UpdateManagerTestConstraint( application ) );
9310 actor.ApplyConstraint( constraint );
9312 // Apply animation to actor
9313 animation.AnimateTo( Property(actor, Actor::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunctions::Linear );
9317 application.SendNotification();
9318 application.UpdateOnly( 16 );
9320 finishCheck.CheckSignalNotReceived();
9322 application.SendNotification(); // Process events
9324 finishCheck.CheckSignalReceived();
9329 int UtcDaliAnimationSignalOrder(void)
9331 TestApplication application;
9333 Actor actor = Actor::New();
9334 Stage::GetCurrent().Add( actor );
9336 // Build the animations
9337 Animation animation1 = Animation::New( 0.0f ); // finishes first frame
9338 Animation animation2 = Animation::New( 0.02f ); // finishes in 20 ms
9340 bool signal1Received = false;
9341 animation1.FinishedSignal().Connect( &application, AnimationFinishCheck( signal1Received ) );
9343 bool signal2Received = false;
9344 animation2.FinishedSignal().Connect( &application, AnimationFinishCheck( signal2Received ) );
9346 // Apply animations to actor
9347 animation1.AnimateTo( Property(actor, Actor::POSITION), Vector3( 3.0f, 2.0f, 1.0f ), AlphaFunctions::Linear );
9349 animation2.AnimateTo( Property(actor, Actor::SIZE ), Vector3( 10.0f, 20.0f, 30.0f ), AlphaFunctions::Linear );
9352 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
9353 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
9355 application.SendNotification();
9356 application.UpdateOnly( 10 ); // 10ms progress
9358 // no notifications yet
9359 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
9360 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
9362 application.SendNotification();
9365 DALI_TEST_EQUALS( signal1Received, true, TEST_LOCATION );
9366 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
9367 signal1Received = false;
9369 // 1st animation is complete now, do another update with no ProcessEvents in between
9370 application.UpdateOnly( 20 ); // 20ms progress
9373 application.SendNotification();
9375 // 2nd should complete now
9376 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
9377 DALI_TEST_EQUALS( signal2Received, true, TEST_LOCATION );
9382 int UtcDaliAnimationExtendDuration(void)
9384 TestApplication application;
9386 Actor actor = Actor::New();
9388 // Register a float property
9389 float startValue(10.0f);
9390 Property::Index index = actor.RegisterProperty( "test-property", startValue );
9391 Stage::GetCurrent().Add(actor);
9392 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
9394 // Build the animation
9395 float initialDurationSeconds(1.0f);
9396 float animatorDelay = 5.0f;
9397 float animatorDurationSeconds(5.0f);
9398 float extendedDurationSeconds(animatorDelay+animatorDurationSeconds);
9399 Animation animation = Animation::New(initialDurationSeconds);
9400 float targetValue(30.0f);
9401 float relativeValue(targetValue - startValue);
9403 animation.AnimateTo(Property(actor, index),
9405 TimePeriod(animatorDelay, animatorDurationSeconds));
9407 // The duration should have been extended
9408 DALI_TEST_EQUALS( animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION );
9410 // Start the animation
9413 bool signalReceived(false);
9414 AnimationFinishCheck finishCheck(signalReceived);
9415 animation.FinishedSignal().Connect(&application, finishCheck);
9417 application.SendNotification();
9418 application.Render(static_cast<unsigned int>(extendedDurationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
9420 // We didn't expect the animation to finish yet
9421 application.SendNotification();
9422 finishCheck.CheckSignalNotReceived();
9423 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
9425 application.SendNotification();
9426 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
9428 // We didn't expect the animation to finish yet
9429 application.SendNotification();
9430 finishCheck.CheckSignalNotReceived();
9431 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
9433 application.SendNotification();
9434 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
9436 // We did expect the animation to finish
9437 application.SendNotification();
9438 finishCheck.CheckSignalReceived();
9439 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
9443 int UtcDaliAnimationPath(void)
9445 TestApplication application;
9447 Actor actor = Actor::New();
9448 Stage::GetCurrent().Add(actor);
9451 Vector3 position0( 30.0, 80.0, 0.0);
9452 Vector3 position1( 70.0, 120.0, 0.0);
9453 Vector3 position2( 100.0, 100.0, 0.0);
9455 Dali::Path path = Dali::Path::New();
9456 path.AddPoint(position0);
9457 path.AddPoint(position1);
9458 path.AddPoint(position2);
9460 //Control points for first segment
9461 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9462 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9464 //Control points for second segment
9465 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9466 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9468 // Build the animation
9469 float durationSeconds( 1.0f );
9470 Animation animation = Animation::New(durationSeconds);
9471 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunctions::Linear, TimePeriod(0.0f, 1.0f ));
9473 // Start the animation
9476 bool signalReceived(false);
9477 AnimationFinishCheck finishCheck(signalReceived);
9478 animation.FinishedSignal().Connect(&application, finishCheck);
9479 application.SendNotification();
9480 application.Render(0);
9481 application.SendNotification();
9482 finishCheck.CheckSignalNotReceived();
9483 Vector3 position, tangent;
9484 Quaternion rotation;
9485 path.Sample( 0.0f, position, tangent );
9486 rotation = Quaternion( Vector3::XAXIS, tangent );
9487 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9488 DALI_TEST_EQUALS( actor.GetCurrentRotation(), rotation, TEST_LOCATION );
9490 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9491 application.SendNotification();
9492 path.Sample( 0.25f, position, tangent );
9493 rotation = Quaternion( Vector3::XAXIS, tangent );
9494 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9495 DALI_TEST_EQUALS( actor.GetCurrentRotation(), rotation, TEST_LOCATION );
9497 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9498 application.SendNotification();
9499 path.Sample( 0.5f, position, tangent );
9500 rotation = Quaternion( Vector3::XAXIS, tangent );
9501 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9502 DALI_TEST_EQUALS( actor.GetCurrentRotation(), rotation, TEST_LOCATION );
9504 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9505 application.SendNotification();
9506 path.Sample( 0.75f, position, tangent );
9507 rotation = Quaternion( Vector3::XAXIS, tangent );
9508 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9509 DALI_TEST_EQUALS( actor.GetCurrentRotation(), rotation, TEST_LOCATION );
9511 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9512 application.SendNotification();
9513 path.Sample( 1.0f, position, tangent );
9514 rotation = Quaternion( Vector3::XAXIS, tangent );
9515 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9516 DALI_TEST_EQUALS( actor.GetCurrentRotation(), rotation, TEST_LOCATION );
9518 finishCheck.CheckSignalReceived();