2 * Copyright (c) 2017 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/devel-api/actors/actor-devel.h>
24 #include <dali/devel-api/object/handle-devel.h>
25 #include <dali-test-suite-utils.h>
30 void utc_dali_animation_startuP(void)
32 test_return_value = TET_UNDEF;
35 void utc_dali_animation_cleanuP(void)
37 test_return_value = TET_PASS;
43 static const float ROTATION_EPSILON = 0.0001f;
44 static const float VECTOR4_EPSILON = 0.0001f;
46 // Functor to test whether a Finish signal is emitted
47 struct AnimationFinishCheck
49 AnimationFinishCheck(bool& signalReceived)
50 : mSignalReceived(signalReceived)
54 void operator()(Animation& animation)
56 mSignalReceived = true;
61 mSignalReceived = false;
64 void CheckSignalReceived()
68 tet_printf("Expected Finish signal was not received\n");
77 void CheckSignalNotReceived()
81 tet_printf("Unexpected Finish signal was received\n");
90 bool& mSignalReceived; // owned by individual tests
95 int UtcDaliAnimationConstructorP(void)
97 TestApplication application;
101 DALI_TEST_CHECK( !animation );
105 int UtcDaliAnimationNewP(void)
107 TestApplication application;
109 Animation animation = Animation::New( 1.0f );
111 DALI_TEST_CHECK(animation);
115 int UtcDaliAnimationNewN(void)
117 TestApplication application;
119 Animation animation = Animation::New( -1.0f );
121 DALI_TEST_CHECK(animation);
122 DALI_TEST_EQUALS(animation.GetDuration(), 0.0f, TEST_LOCATION);
126 int UtcDaliAnimationDownCastP(void)
128 TestApplication application;
130 tet_infoline("Testing Dali::Animation::DownCast()");
132 float durationSeconds(1.0f);
133 Animation animation = Animation::New(durationSeconds);
135 BaseHandle object(animation);
137 Animation animation2 = Animation::DownCast(object);
138 DALI_TEST_CHECK(animation2);
140 Animation animation3 = DownCast< Animation >(object);
141 DALI_TEST_CHECK(animation3);
145 int UtcDaliAnimationDownCastN(void)
147 TestApplication application;
149 BaseHandle unInitializedObject;
151 Animation animation1 = Animation::DownCast( unInitializedObject );
152 DALI_TEST_CHECK( !animation1 );
154 Animation animation2 = DownCast< Animation >( unInitializedObject );
155 DALI_TEST_CHECK( !animation2 );
159 int UtcDaliAnimationCopyConstructorP(void)
161 TestApplication application;
163 // Initialize an object, ref count == 1
164 Animation animation = Animation::New( 1.0f );
166 Animation copy( animation );
167 DALI_TEST_CHECK( copy );
169 DALI_TEST_CHECK( copy.GetDuration() == animation.GetDuration() );
173 int UtcDaliAnimationAssignmentOperatorP(void)
175 TestApplication application;
177 Animation animation = Animation::New( 1.0f );
179 Animation copy = animation;
180 DALI_TEST_CHECK( copy );
182 DALI_TEST_CHECK( animation == copy );
184 DALI_TEST_CHECK( copy.GetDuration() == animation.GetDuration() );
188 int UtcDaliAnimationSetDurationP(void)
190 TestApplication application;
192 Actor actor = Actor::New();
193 Stage::GetCurrent().Add(actor);
195 // Build the animation
196 float durationSeconds(1.0f);
197 Animation animation = Animation::New(durationSeconds);
198 DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
200 // Start the animation
201 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
202 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
205 bool signalReceived(false);
206 AnimationFinishCheck finishCheck(signalReceived);
207 animation.FinishedSignal().Connect(&application, finishCheck);
209 application.SendNotification();
210 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
212 // We didn't expect the animation to finish yet
213 application.SendNotification();
214 finishCheck.CheckSignalNotReceived();
216 application.Render(2u/*just beyond the animation duration*/);
218 // We did expect the animation to finish
219 application.SendNotification();
220 finishCheck.CheckSignalReceived();
221 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
223 // Restart the animation, with a different duration
225 actor.SetPosition(Vector3::ZERO);
226 durationSeconds = 3.5f;
227 animation.SetDuration(durationSeconds);
228 DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
231 application.SendNotification();
232 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
234 // We didn't expect the animation to finish yet
235 application.SendNotification();
236 finishCheck.CheckSignalNotReceived();
238 application.Render(2u/*just beyond the animation duration*/);
240 // We did expect the animation to finish
241 application.SendNotification();
242 finishCheck.CheckSignalReceived();
243 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
245 // Check that nothing has changed after a couple of buffer swaps
246 application.Render(0);
247 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
248 application.Render(0);
249 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
253 int UtcDaliAnimationSetDurationN(void)
255 TestApplication application;
257 Animation animation = Animation::New( 1.0f );
258 DALI_TEST_EQUALS( animation.GetDuration(), 1.0f, TEST_LOCATION );
260 animation.SetDuration( -1.0f );
261 DALI_TEST_EQUALS( animation.GetDuration(), 0.0f, TEST_LOCATION );
265 int UtcDaliAnimationGetDurationP(void)
267 TestApplication application;
269 Animation animation = Animation::New(1.0f);
270 DALI_TEST_EQUALS(animation.GetDuration(), 1.0f, TEST_LOCATION);
272 animation.SetDuration(2.0f);
273 DALI_TEST_EQUALS(animation.GetDuration(), 2.0f, TEST_LOCATION);
277 int UtcDaliAnimationSetLoopingP(void)
279 TestApplication application;
281 Actor actor = Actor::New();
282 Stage::GetCurrent().Add(actor);
284 // Build the animation
285 float durationSeconds(1.0f);
286 Animation animation = Animation::New(durationSeconds);
287 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
288 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
290 // Start the animation
291 animation.SetLooping(true);
292 DALI_TEST_CHECK(animation.IsLooping());
295 bool signalReceived(false);
296 AnimationFinishCheck finishCheck(signalReceived);
297 animation.FinishedSignal().Connect(&application, finishCheck);
299 application.SendNotification();
302 float intervalSeconds = 0.25f;
303 float progress = 0.0f;
304 for (int iterations = 0; iterations < 5;)
306 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
308 progress += intervalSeconds;
309 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
311 if (progress >= 1.0f)
313 progress = progress - 1.0f;
318 // We didn't expect the animation to finish yet
319 application.SendNotification();
320 finishCheck.CheckSignalNotReceived();
322 animation.SetLooping(false);
323 DALI_TEST_CHECK(!animation.IsLooping());
325 application.SendNotification();
326 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
328 // We did expect the animation to finish
329 application.SendNotification();
330 finishCheck.CheckSignalReceived();
331 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
333 // Check that nothing has changed after a couple of buffer swaps
334 application.Render(0);
335 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
336 application.Render(0);
337 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
341 int UtcDaliAnimationSetLoopCountP(void)
343 TestApplication application;
345 Actor actor = Actor::New();
346 Stage::GetCurrent().Add(actor);
348 // Build the animation
349 float durationSeconds(1.0f);
350 Animation animation = Animation::New(durationSeconds);
351 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
352 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
354 // Start the animation
355 animation.SetLoopCount(3);
356 DALI_TEST_CHECK(animation.IsLooping());
359 bool signalReceived(false);
360 AnimationFinishCheck finishCheck(signalReceived);
361 animation.FinishedSignal().Connect(&application, finishCheck);
363 application.Render(0);
364 application.SendNotification();
365 application.Render(0);
366 application.SendNotification();
367 application.Render(0);
368 application.SendNotification();
369 application.Render(0);
370 application.SendNotification();
373 float intervalSeconds = 3.0f;
375 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
376 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
378 application.Render(0);
379 application.SendNotification();
380 application.Render(0);
381 application.SendNotification();
382 application.Render(0);
383 application.SendNotification();
384 application.Render(0);
385 application.SendNotification();
386 finishCheck.CheckSignalNotReceived();
388 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
390 application.SendNotification();
391 finishCheck.CheckSignalReceived();
392 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
396 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
397 application.SendNotification();
398 finishCheck.CheckSignalNotReceived();
400 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
401 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
402 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
403 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
404 application.SendNotification();
405 finishCheck.CheckSignalNotReceived();
410 int UtcDaliAnimationSetLoopCountP2(void)
412 TestApplication application;
415 // switching between forever and loop count
418 Actor actor = Actor::New();
419 Stage::GetCurrent().Add(actor);
421 // Build the animation
422 float durationSeconds(1.0f);
423 Animation animation = Animation::New(durationSeconds);
424 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
425 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
426 animation.SetEndAction(Animation::Discard);
428 // Start the animation
429 animation.SetLoopCount(3);
430 DALI_TEST_CHECK(animation.IsLooping());
433 bool signalReceived(false);
434 AnimationFinishCheck finishCheck(signalReceived);
435 animation.FinishedSignal().Connect(&application, finishCheck);
437 float intervalSeconds = 3.0f;
439 application.SendNotification();
440 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
441 application.SendNotification();
442 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
443 application.SendNotification();
444 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
445 application.SendNotification();
447 application.SendNotification();
448 finishCheck.CheckSignalReceived();
453 animation.SetLooping(true);
454 DALI_TEST_CHECK(animation.IsLooping());
456 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
457 application.SendNotification();
458 finishCheck.CheckSignalNotReceived();
460 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
461 application.SendNotification();
462 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
463 application.SendNotification();
464 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
465 application.SendNotification();
466 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
467 application.SendNotification();
468 application.SendNotification();
469 finishCheck.CheckSignalNotReceived();
474 animation.SetLoopCount(3);
475 DALI_TEST_CHECK(animation.IsLooping());
478 application.SendNotification();
479 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
480 application.SendNotification();
481 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
482 application.SendNotification();
483 finishCheck.CheckSignalNotReceived();
485 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
486 application.SendNotification();
487 finishCheck.CheckSignalReceived();
492 animation.SetLooping(true);
493 DALI_TEST_CHECK(animation.IsLooping());
495 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
496 application.SendNotification();
497 finishCheck.CheckSignalNotReceived();
499 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
500 application.SendNotification();
501 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
502 application.SendNotification();
503 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
504 application.SendNotification();
505 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
506 application.SendNotification();
507 finishCheck.CheckSignalNotReceived();
512 animation.SetLoopCount(3);
513 DALI_TEST_CHECK(animation.IsLooping());
515 application.SendNotification();
516 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
517 application.SendNotification();
518 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
519 application.SendNotification();
520 finishCheck.CheckSignalNotReceived();
522 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
523 application.SendNotification();
524 finishCheck.CheckSignalNotReceived(); // we never hit play
532 int UtcDaliAnimationSetLoopCountP3(void)
534 TestApplication application;
537 // switching between forever and loop count
539 Actor actor = Actor::New();
540 Stage::GetCurrent().Add(actor);
542 // Build the animation
543 float durationSeconds(1.0f);
544 Animation animation = Animation::New(durationSeconds);
545 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
546 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
547 animation.SetEndAction(Animation::Discard);
549 float intervalSeconds = 3.0f;
551 bool signalReceived(false);
552 AnimationFinishCheck finishCheck(signalReceived);
553 animation.FinishedSignal().Connect(&application, finishCheck);
556 animation.SetLooping(true);
557 DALI_TEST_CHECK(animation.IsLooping());
559 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
560 application.SendNotification();
561 finishCheck.CheckSignalNotReceived();
563 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
564 application.SendNotification();
565 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
566 application.SendNotification();
567 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
568 application.SendNotification();
569 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
570 application.SendNotification();
571 finishCheck.CheckSignalNotReceived();
576 animation.SetLoopCount(3);
577 DALI_TEST_CHECK(animation.IsLooping());
579 application.SendNotification();
580 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
581 application.SendNotification();
582 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
583 application.SendNotification();
584 finishCheck.CheckSignalNotReceived();
586 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
587 application.SendNotification();
588 finishCheck.CheckSignalNotReceived(); // we never hit play
596 int UtcDaliAnimationSetLoopCountP4(void)
598 TestApplication application;
603 Actor actor = Actor::New();
604 Stage::GetCurrent().Add(actor);
606 // Build the animation
607 float durationSeconds(1.0f);
608 Animation animation = Animation::New(durationSeconds);
609 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
610 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
611 animation.SetEndAction(Animation::Bake);
613 float intervalSeconds = 3.0f;
615 bool signalReceived(false);
616 AnimationFinishCheck finishCheck(signalReceived);
617 animation.FinishedSignal().Connect(&application, finishCheck);
619 animation.SetLoopCount(1);
621 DALI_TEST_CHECK(!animation.IsLooping());
623 application.SendNotification();
624 finishCheck.CheckSignalNotReceived();
625 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
626 application.SendNotification();
627 finishCheck.CheckSignalReceived();
629 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
630 actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f) );
634 animation.Play(); // again
635 DALI_TEST_CHECK(!animation.IsLooping());
637 application.SendNotification();
638 finishCheck.CheckSignalNotReceived();
639 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
640 application.SendNotification();
641 finishCheck.CheckSignalReceived();
643 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
648 int UtcDaliAnimationGetLoopCountP(void)
650 TestApplication application;
652 Actor actor = Actor::New();
653 Stage::GetCurrent().Add(actor);
655 // Build the animation
656 float durationSeconds(1.0f);
657 Animation animation = Animation::New(durationSeconds);
658 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
659 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
661 DALI_TEST_CHECK(1 == animation.GetLoopCount());
663 // Start the animation
664 animation.SetLoopCount(3);
665 DALI_TEST_CHECK(animation.IsLooping());
666 DALI_TEST_CHECK(3 == animation.GetLoopCount());
670 application.Render(0);
671 application.SendNotification();
674 float intervalSeconds = 3.0f;
676 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
677 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
679 application.Render(0);
680 application.SendNotification();
682 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
683 application.SendNotification();
685 animation.SetLoopCount(0);
686 DALI_TEST_CHECK(animation.IsLooping());
687 DALI_TEST_CHECK(0 == animation.GetLoopCount());
689 animation.SetLoopCount(1);
690 DALI_TEST_CHECK(!animation.IsLooping());
691 DALI_TEST_CHECK(1 == animation.GetLoopCount());
697 int UtcDaliAnimationGetCurrentLoopP(void)
699 TestApplication application;
701 Actor actor = Actor::New();
702 Stage::GetCurrent().Add(actor);
704 // Build the animation
705 float durationSeconds(1.0f);
706 Animation animation = Animation::New(durationSeconds);
707 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
708 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
710 // Start the animation
711 animation.SetLoopCount(3);
712 DALI_TEST_CHECK(animation.IsLooping());
713 DALI_TEST_CHECK(0 == animation.GetCurrentLoop());
716 bool signalReceived(false);
717 AnimationFinishCheck finishCheck(signalReceived);
718 animation.FinishedSignal().Connect(&application, finishCheck);
720 application.SendNotification();
723 float intervalSeconds = 3.0f;
725 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
726 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
728 application.SendNotification();
729 finishCheck.CheckSignalNotReceived();
730 DALI_TEST_CHECK(2 == animation.GetCurrentLoop());
732 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
734 application.SendNotification();
735 finishCheck.CheckSignalReceived();
736 DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
737 DALI_TEST_CHECK(animation.GetLoopCount() == animation.GetCurrentLoop());
741 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
742 application.SendNotification();
743 finishCheck.CheckSignalNotReceived();
744 DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
746 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
747 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
748 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
749 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
750 application.SendNotification();
751 finishCheck.CheckSignalNotReceived();
752 DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
757 int UtcDaliAnimationIsLoopingP(void)
759 TestApplication application;
761 Animation animation = Animation::New(1.0f);
762 DALI_TEST_CHECK(!animation.IsLooping());
764 animation.SetLooping(true);
765 DALI_TEST_CHECK(animation.IsLooping());
769 int UtcDaliAnimationSetEndActioN(void)
771 TestApplication application;
773 Actor actor = Actor::New();
774 Stage::GetCurrent().Add(actor);
776 // Build the animation
777 float durationSeconds(1.0f);
778 Animation animation = Animation::New(durationSeconds);
779 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
781 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
782 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
784 // Start the animation
787 bool signalReceived(false);
788 AnimationFinishCheck finishCheck(signalReceived);
789 animation.FinishedSignal().Connect(&application, finishCheck);
791 application.SendNotification();
792 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
794 // We did expect the animation to finish
795 application.SendNotification();
796 finishCheck.CheckSignalReceived();
797 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
799 // Go back to the start
800 actor.SetPosition(Vector3::ZERO);
801 application.SendNotification();
802 application.Render(0);
803 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
805 // Test BakeFinal, animate again, for half the duration
807 animation.SetEndAction(Animation::BakeFinal);
808 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
811 application.SendNotification();
812 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f*0.5f) /*half of the animation duration*/);
814 // Stop the animation early
817 // We did NOT expect the animation to finish
818 application.SendNotification();
819 finishCheck.CheckSignalNotReceived();
820 DALI_TEST_EQUALS( targetPosition * 0.5f, actor.GetCurrentPosition(), VECTOR4_EPSILON, TEST_LOCATION );
822 // The position should be same with target position in the next frame
823 application.Render(0);
824 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
826 // Go back to the start
827 actor.SetPosition(Vector3::ZERO);
828 application.SendNotification();
829 application.Render(0);
830 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
832 // Test EndAction::Discard, animate again, but don't bake this time
834 animation.SetEndAction(Animation::Discard);
835 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
838 application.SendNotification();
839 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
841 // We did expect the animation to finish
842 application.SendNotification();
843 finishCheck.CheckSignalReceived();
844 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
846 // The position should be discarded in the next frame
847 application.Render(0);
848 DALI_TEST_EQUALS( Vector3::ZERO/*discarded*/, actor.GetCurrentPosition(), TEST_LOCATION );
850 // Check that nothing has changed after a couple of buffer swaps
851 application.Render(0);
852 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
853 application.Render(0);
854 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
858 int UtcDaliAnimationGetEndActionP(void)
860 TestApplication application;
862 Animation animation = Animation::New(1.0f);
863 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
865 animation.SetEndAction(Animation::Discard);
866 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
868 animation.SetEndAction(Animation::BakeFinal);
869 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
874 int UtcDaliAnimationSetDisconnectActionP(void)
876 TestApplication application;
877 Stage stage( Stage::GetCurrent() );
879 // Default: BakeFinal
881 Actor actor = Actor::New();
884 // Build the animation
885 float durationSeconds(1.0f);
886 Animation animation = Animation::New(durationSeconds);
887 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal);
889 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
890 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
892 // Start the animation
895 application.SendNotification();
896 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
900 application.SendNotification();
901 application.Render();
903 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
908 Actor actor = Actor::New();
911 // Build the animation
912 float durationSeconds(1.0f);
913 Animation animation = Animation::New(durationSeconds);
914 animation.SetDisconnectAction( Animation::Bake );
916 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
917 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
919 // Start the animation
922 application.SendNotification();
923 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
927 application.SendNotification();
928 application.Render();
930 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition*0.5f, TEST_LOCATION );
935 Actor actor = Actor::New();
938 // Build the animation
939 float durationSeconds(1.0f);
940 Animation animation = Animation::New(durationSeconds);
941 animation.SetDisconnectAction( Animation::Discard );
943 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
944 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
946 // Start the animation
949 application.SendNotification();
950 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
954 application.SendNotification();
955 application.Render();
957 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
960 // Don't play the animation: disconnect action should not be applied
962 Actor actor = Actor::New();
965 // Build the animation
966 float durationSeconds(1.0f);
967 Animation animation = Animation::New(durationSeconds);
969 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
970 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
972 application.SendNotification();
973 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
977 application.SendNotification();
978 application.Render();
980 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
986 int UtcDaliAnimationGetDisconnectActionP(void)
988 TestApplication application;
989 Animation animation = Animation::New(1.0f);
990 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal); // default!
992 animation.SetDisconnectAction(Animation::Discard);
993 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Discard);
995 animation.SetDisconnectAction(Animation::Bake);
996 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Bake);
1001 int UtcDaliAnimationSetDefaultAlphaFunctionP(void)
1003 TestApplication application;
1005 Animation animation = Animation::New(1.0f);
1006 AlphaFunction func = animation.GetDefaultAlphaFunction();
1007 DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1009 animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1010 AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1011 DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1015 int UtcDaliAnimationGetDefaultAlphaFunctionP(void)
1017 TestApplication application;
1019 Animation animation = Animation::New(1.0f);
1020 AlphaFunction func = animation.GetDefaultAlphaFunction();
1022 // Test that the default is linear
1023 DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1025 animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1026 AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1027 DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1032 int UtcDaliAnimationSetCurrentProgressP(void)
1034 TestApplication application;
1036 Actor actor = Actor::New();
1037 Stage::GetCurrent().Add(actor);
1039 // Build the animation
1040 Animation animation = Animation::New(0.0f);
1043 float durationSeconds(1.0f);
1044 animation.SetDuration(durationSeconds);
1046 bool signalReceived(false);
1047 AnimationFinishCheck finishCheck(signalReceived);
1048 animation.FinishedSignal().Connect(&application, finishCheck);
1049 application.SendNotification();
1051 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1052 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1054 // Start the animation from 40% progress
1055 animation.SetCurrentProgress( 0.4f );
1058 application.SendNotification();
1059 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1061 // We didn't expect the animation to finish yet
1062 application.SendNotification();
1063 finishCheck.CheckSignalNotReceived();
1064 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1065 DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
1067 animation.Play(); // Test that calling play has no effect, when animation is already playing
1068 application.SendNotification();
1070 //Set the progress to 70%
1071 animation.SetCurrentProgress( 0.7f );
1072 application.SendNotification();
1073 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 80% progress */);
1074 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1076 application.SendNotification();
1077 finishCheck.CheckSignalNotReceived();
1078 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1079 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1081 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1082 // We did expect the animation to finish
1083 application.SendNotification();
1084 finishCheck.CheckSignalReceived();
1085 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1087 // Check that nothing has changed after a couple of buffer swaps
1088 application.Render(0);
1089 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1090 application.Render(0);
1091 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1095 int UtcDaliAnimationSetCurrentProgressN(void)
1097 TestApplication application;
1099 Actor actor = Actor::New();
1100 Stage::GetCurrent().Add(actor);
1102 // Build the animation
1103 Animation animation = Animation::New(0.0f);
1106 float durationSeconds(1.0f);
1107 animation.SetDuration(durationSeconds);
1109 bool signalReceived(false);
1110 AnimationFinishCheck finishCheck(signalReceived);
1111 animation.FinishedSignal().Connect(&application, finishCheck);
1112 application.SendNotification();
1114 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1115 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1117 //Trying to set the current cursor outside the range [0..1] is ignored
1118 animation.SetCurrentProgress( -1.0f);
1119 application.SendNotification();
1120 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1122 animation.SetCurrentProgress( 100.0f);
1123 application.SendNotification();
1124 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1128 int UtcDaliAnimationGetCurrentProgressP(void)
1130 TestApplication application;
1132 Actor actor = Actor::New();
1133 Stage::GetCurrent().Add(actor);
1135 // Build the animation
1136 Animation animation = Animation::New(0.0f);
1139 //Test GetCurrentProgress return 0.0 as the duration is 0.0
1140 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1142 animation.SetCurrentProgress( 0.5f );
1143 application.SendNotification();
1144 application.Render(static_cast<unsigned int>(100.0f));
1146 //Progress should still be 0.0
1147 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1150 float durationSeconds(1.0f);
1151 animation.SetDuration(durationSeconds);
1152 application.SendNotification();
1154 bool signalReceived(false);
1155 AnimationFinishCheck finishCheck(signalReceived);
1156 animation.FinishedSignal().Connect(&application, finishCheck);
1157 application.SendNotification();
1159 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1160 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1162 // Start the animation from 40% progress
1163 animation.SetCurrentProgress( 0.4f );
1166 application.SendNotification();
1167 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1169 // We didn't expect the animation to finish yet
1170 application.SendNotification();
1171 finishCheck.CheckSignalNotReceived();
1172 DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
1174 animation.Play(); // Test that calling play has no effect, when animation is already playing
1175 application.SendNotification();
1177 //Set the progress to 70%
1178 animation.SetCurrentProgress( 0.7f );
1179 application.SendNotification();
1180 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 80% progress */);
1181 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1183 application.SendNotification();
1184 finishCheck.CheckSignalNotReceived();
1185 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1187 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1188 // We did expect the animation to finish
1189 application.SendNotification();
1190 finishCheck.CheckSignalReceived();
1194 int UtcDaliAnimationSetSpeedFactorP1(void)
1196 TestApplication application;
1198 tet_printf("Testing that setting a speed factor of 2 takes half the time\n");
1200 Actor actor = Actor::New();
1201 Stage::GetCurrent().Add(actor);
1203 // Build the animation
1204 float durationSeconds(1.0f);
1205 Animation animation = Animation::New(durationSeconds);
1207 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1208 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1210 KeyFrames keyframes = KeyFrames::New();
1211 keyframes.Add( 0.0f, initialPosition);
1212 keyframes.Add( 1.0f, targetPosition );
1213 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1215 //Set speed to be x2
1216 animation.SetSpeedFactor(2.0f);
1218 // Start the animation
1221 bool signalReceived(false);
1222 AnimationFinishCheck finishCheck(signalReceived);
1223 animation.FinishedSignal().Connect(&application, finishCheck);
1225 application.SendNotification();
1226 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1228 // We didn't expect the animation to finish yet
1229 application.SendNotification();
1230 finishCheck.CheckSignalNotReceived();
1231 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1233 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1235 // We didn't expect the animation to finish yet
1236 application.SendNotification();
1237 finishCheck.CheckSignalNotReceived();
1238 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1240 application.Render(static_cast<unsigned int>(durationSeconds*100.0f) + 1u/*just beyond half the duration*/);
1242 // We did expect the animation to finish
1243 application.SendNotification();
1244 finishCheck.CheckSignalReceived();
1245 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1247 // Check that nothing has changed after a couple of buffer swaps
1248 application.Render(0);
1249 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1250 application.Render(0);
1251 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1256 int UtcDaliAnimationSetSpeedFactorP2(void)
1258 TestApplication application;
1260 Actor actor = Actor::New();
1261 Stage::GetCurrent().Add(actor);
1263 // Build the animation
1264 float durationSeconds(1.0f);
1265 Animation animation = Animation::New(durationSeconds);
1267 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1268 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1270 KeyFrames keyframes = KeyFrames::New();
1271 keyframes.Add( 0.0f, initialPosition);
1272 keyframes.Add( 1.0f, targetPosition );
1273 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1275 tet_printf("Test -1 speed factor. Animation will play in reverse at normal speed\n");
1276 animation.SetSpeedFactor( -1.0f );
1278 // Start the animation
1281 bool signalReceived(false);
1282 AnimationFinishCheck finishCheck(signalReceived);
1283 animation.FinishedSignal().Connect(&application, finishCheck);
1285 application.SendNotification();
1286 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1288 // We didn't expect the animation to finish yet
1289 application.SendNotification();
1290 finishCheck.CheckSignalNotReceived();
1291 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1293 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1295 // We didn't expect the animation to finish yet
1296 application.SendNotification();
1297 finishCheck.CheckSignalNotReceived();
1298 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1300 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1302 // We didn't expect the animation to finish yet
1303 application.SendNotification();
1304 finishCheck.CheckSignalNotReceived();
1305 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1307 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1309 // We didn't expect the animation to finish yet
1310 application.SendNotification();
1311 finishCheck.CheckSignalNotReceived();
1312 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1314 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1316 // We did expect the animation to finish
1317 application.SendNotification();
1318 finishCheck.CheckSignalReceived();
1319 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
1321 // Check that nothing has changed after a couple of buffer swaps
1322 application.Render(0);
1323 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1324 application.Render(0);
1325 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1330 int UtcDaliAnimationSetSpeedFactorP3(void)
1332 TestApplication application;
1334 Actor actor = Actor::New();
1335 Stage::GetCurrent().Add(actor);
1337 // Build the animation
1338 float durationSeconds(1.0f);
1339 Animation animation = Animation::New(durationSeconds);
1341 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1342 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1344 KeyFrames keyframes = KeyFrames::New();
1345 keyframes.Add( 0.0f, initialPosition);
1346 keyframes.Add( 1.0f, targetPosition );
1347 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1349 bool signalReceived(false);
1350 AnimationFinishCheck finishCheck(signalReceived);
1351 animation.FinishedSignal().Connect(&application, finishCheck);
1353 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1355 //Set speed to be half of normal speed
1356 animation.SetSpeedFactor( 0.5f );
1358 // Start the animation
1361 application.SendNotification();
1362 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1364 // We didn't expect the animation to finish yet
1365 application.SendNotification();
1366 finishCheck.CheckSignalNotReceived();
1367 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), TEST_LOCATION );
1369 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1371 // We didn't expect the animation to finish yet
1372 application.SendNotification();
1373 finishCheck.CheckSignalNotReceived();
1374 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1376 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
1378 // We didn't expect the animation to finish yet
1379 application.SendNotification();
1380 finishCheck.CheckSignalNotReceived();
1381 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.3f), TEST_LOCATION );
1383 application.SendNotification();
1384 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1386 // We didn't expect the animation to finish yet
1387 application.SendNotification();
1388 finishCheck.CheckSignalNotReceived();
1389 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1391 application.Render(static_cast<unsigned int>(durationSeconds*1200.0f) + 1u/*just beyond the animation duration*/);
1393 // We did expect the animation to finish
1394 application.SendNotification();
1395 finishCheck.CheckSignalReceived();
1396 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1398 // Check that nothing has changed after a couple of buffer swaps
1399 application.Render(0);
1400 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1401 application.Render(0);
1402 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1407 int UtcDaliAnimationSetSpeedFactorP4(void)
1409 TestApplication application;
1411 Actor actor = Actor::New();
1412 Stage::GetCurrent().Add(actor);
1414 // Build the animation
1415 float durationSeconds(1.0f);
1416 Animation animation = Animation::New(durationSeconds);
1418 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1419 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1421 KeyFrames keyframes = KeyFrames::New();
1422 keyframes.Add( 0.0f, initialPosition);
1423 keyframes.Add( 1.0f, targetPosition );
1424 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1426 bool signalReceived(false);
1427 AnimationFinishCheck finishCheck(signalReceived);
1428 animation.FinishedSignal().Connect(&application, finishCheck);
1430 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1432 tet_printf("Set speed to be half of normal speed\n");
1433 tet_printf("SetSpeedFactor(0.5f)\n");
1434 animation.SetSpeedFactor( 0.5f );
1436 // Start the animation
1439 application.SendNotification();
1440 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1442 // We didn't expect the animation to finish yet
1443 application.SendNotification();
1444 finishCheck.CheckSignalNotReceived();
1445 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), TEST_LOCATION );
1447 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1449 // We didn't expect the animation to finish yet
1450 application.SendNotification();
1451 finishCheck.CheckSignalNotReceived();
1452 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1454 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
1456 // We didn't expect the animation to finish yet
1457 application.SendNotification();
1458 finishCheck.CheckSignalNotReceived();
1459 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.3f), TEST_LOCATION );
1461 tet_printf("Reverse direction of animation whilst playing\n");
1462 tet_printf("SetSpeedFactor(-0.5f)\n");
1463 animation.SetSpeedFactor(-0.5f);
1465 application.SendNotification();
1466 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1468 // We didn't expect the animation to finish yet
1469 application.SendNotification();
1470 finishCheck.CheckSignalNotReceived();
1471 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1473 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1475 // We didn't expect the animation to finish yet
1476 application.SendNotification();
1477 finishCheck.CheckSignalNotReceived();
1478 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), 0.0001, TEST_LOCATION );
1480 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1482 // We did expect the animation to finish
1483 application.SendNotification();
1484 finishCheck.CheckSignalReceived();
1485 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
1487 // Check that nothing has changed after a couple of buffer swaps
1488 application.Render(0);
1489 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1490 application.Render(0);
1491 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1495 int UtcDaliAnimationSetSpeedFactorAndRange(void)
1497 TestApplication application;
1499 const unsigned int NUM_FRAMES(15);
1507 float expected[NUM_FRAMES];
1510 TestData testData[] = {
1512 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1513 /* |----------PlayRange---------------| */
1515 { 0.0f, 1.0f, // TimePeriod
1516 0.0f, 100.0f, // POS
1517 {/**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1518 /**/ 30.0f, 40.0f, 50.0f, 60.0f, /* Reverse direction */
1529 // ACTOR 1 - Across start of range
1530 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1531 /* |----------PlayRange---------------| */
1533 { 0.2f, 0.5f, // TimePeriod
1534 20.0f, 50.0f, // POS
1535 {/**/ 30.0f, 40.0f, 50.0f, 50.0f, 50.0f, /* Loop */
1536 /**/ 30.0f, 40.0f, 50.0f, 50.0f, /* Reverse direction @ frame #9 */
1546 // ACTOR 2 - Across end of range
1547 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1548 /* |----------PlayRange---------------| */
1550 {/**/ 0.5f, 0.9f, // TimePeriod
1551 /**/ 50.0f, 90.0f, // POS
1552 { /**/ 50.0f, 50.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1553 /**/ 50.0f, 50.0f, 50.0f, 60.0f,/* Reverse direction @ frame #9 */
1562 // ACTOR 3 - Before beginning of range
1563 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1564 /* |----------PlayRange---------------| */
1566 {/**/ 0.1f, 0.25f, // TimePeriod
1567 /**/ 10.0f, 25.0f, // POS
1569 /**/ 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f
1574 // ACTOR 4 - After end of range
1575 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1576 /* |----------PlayRange---------------| */
1578 {/**/ 0.85f, 1.0f, // TimePeriod
1579 /**/ 85.0f, 100.0f, // POS
1581 /**/ 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f
1585 // Actor 5 - Middle of range
1586 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1587 /* |----------PlayRange---------------| */
1589 {/**/ 0.4f, 0.65f, // Time Period
1590 /**/ 40.0f, 65.0f, // Position
1591 { /**/ 40.0f, 40.0f, 50.0f, 60.0f, 65.0f,
1592 /**/ 40.0f, 40.0f, 50.0f, 60.0f, // Reverse
1603 const size_t NUM_ENTRIES(sizeof(testData)/sizeof(TestData));
1605 // Build the animation
1606 float durationSeconds(1.0f);
1607 Animation animation = Animation::New(durationSeconds);
1608 bool signalReceived(false);
1609 AnimationFinishCheck finishCheck(signalReceived);
1610 animation.FinishedSignal().Connect(&application, finishCheck);
1612 std::vector<Dali::Actor> actors;
1614 for( unsigned int actorIndex = 0; actorIndex < NUM_ENTRIES; ++actorIndex )
1616 Actor actor = Actor::New();
1617 actor.SetPosition( Vector3( testData[actorIndex].startX, 0, 0 ) );
1618 actors.push_back(actor);
1619 Stage::GetCurrent().Add(actor);
1621 if( actorIndex == 0 || actorIndex == NUM_ENTRIES-1 )
1623 KeyFrames keyframes = KeyFrames::New();
1624 keyframes.Add( testData[actorIndex].startTime, Vector3(testData[actorIndex].startX, 0, 0));
1625 keyframes.Add( testData[actorIndex].endTime, Vector3(testData[actorIndex].endX, 0, 0));
1626 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1630 animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( testData[actorIndex].endX, 0, 0 ), TimePeriod( testData[actorIndex].startTime, testData[actorIndex].endTime - testData[actorIndex].startTime) );
1634 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1635 tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1636 tet_printf("SetSpeedFactor(0.5f)\n");
1637 animation.SetSpeedFactor( 0.5f );
1638 animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1639 animation.SetLooping(true);
1641 // Start the animation
1643 application.SendNotification();
1644 application.Render(0); // Frame 0 tests initial values
1646 for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1648 unsigned int actorIndex = 0u;
1649 for( actorIndex = 0u; actorIndex < NUM_ENTRIES; ++actorIndex )
1651 DALI_TEST_EQUALS( actors[actorIndex].GetCurrentPosition().x, testData[actorIndex].expected[frame], 0.001, TEST_LOCATION );
1652 if( ! Equals(actors[actorIndex].GetCurrentPosition().x, testData[actorIndex].expected[frame]) )
1654 tet_printf("Failed at frame %u, actorIndex %u\n", frame, actorIndex );
1660 tet_printf("Reverse direction of animation whilst playing after frame 8\n");
1661 tet_printf("SetSpeedFactor(-0.5f)\n");
1662 animation.SetSpeedFactor(-0.5f);
1663 application.SendNotification();
1665 application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1667 // We didn't expect the animation to finish yet
1668 application.SendNotification();
1669 finishCheck.CheckSignalNotReceived();
1675 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount01(void)
1677 TestApplication application;
1679 const unsigned int NUM_FRAMES(15);
1687 float expected[NUM_FRAMES];
1692 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1693 /* |----------PlayRange---------------| */
1694 { 0.0f, 1.0f, // TimePeriod
1695 0.0f, 100.0f, // POS
1696 {/**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1697 /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,
1698 /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,
1704 // Build the animation
1705 float durationSeconds(1.0f);
1706 Animation animation = Animation::New(durationSeconds);
1707 bool signalReceived(false);
1708 AnimationFinishCheck finishCheck(signalReceived);
1709 animation.FinishedSignal().Connect(&application, finishCheck);
1711 std::vector<Dali::Actor> actors;
1713 Actor actor = Actor::New();
1714 actor.SetPosition( Vector3( testData.startX, 0, 0 ) );
1715 actors.push_back(actor);
1716 Stage::GetCurrent().Add(actor);
1718 KeyFrames keyframes = KeyFrames::New();
1719 keyframes.Add( testData.startTime, Vector3(testData.startX, 0, 0));
1720 keyframes.Add( testData.endTime, Vector3(testData.endX, 0, 0));
1721 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1723 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1724 tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1725 tet_printf("SetSpeedFactor(0.5f)\n");
1726 tet_printf("SetLoopCount(3)\n");
1727 animation.SetSpeedFactor( 0.5f );
1728 animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1729 animation.SetLoopCount(3);
1731 // Start the animation
1733 application.SendNotification();
1734 application.Render(0); // Frame 0 tests initial values
1736 for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1738 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, testData.expected[frame], 0.001, TEST_LOCATION );
1740 application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1742 if( frame < NUM_FRAMES-1 )
1744 // We didn't expect the animation to finish yet
1745 application.SendNotification();
1746 finishCheck.CheckSignalNotReceived();
1750 // We did expect the animation to finish
1751 application.SendNotification();
1752 finishCheck.CheckSignalReceived();
1753 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 80.0f, 0.001, TEST_LOCATION );
1758 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount02(void)
1760 TestApplication application;
1762 const unsigned int NUM_FRAMES(15);
1770 float expected[NUM_FRAMES];
1775 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1776 /* |----------PlayRange---------------| */
1777 { 0.0f, 1.0f, // TimePeriod
1778 0.0f, 100.0f, // POS
1779 {/**/ 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1780 /**/ 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1781 /**/ 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1786 // Build the animation
1787 float durationSeconds(1.0f);
1788 Animation animation = Animation::New(durationSeconds);
1789 bool signalReceived(false);
1790 AnimationFinishCheck finishCheck(signalReceived);
1791 animation.FinishedSignal().Connect(&application, finishCheck);
1793 std::vector<Dali::Actor> actors;
1795 Actor actor = Actor::New();
1796 actor.SetPosition( Vector3( testData.startX, 0, 0 ) );
1797 actors.push_back(actor);
1798 Stage::GetCurrent().Add(actor);
1800 KeyFrames keyframes = KeyFrames::New();
1801 keyframes.Add( testData.startTime, Vector3(testData.startX, 0, 0));
1802 keyframes.Add( testData.endTime, Vector3(testData.endX, 0, 0));
1803 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1805 tet_printf("Test reverse half speed factor. Animation will take twice the duration\n");
1806 tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1807 tet_printf("SetSpeedFactor(-0.5f)\n");
1808 tet_printf("SetLoopCount(3)\n");
1809 animation.SetSpeedFactor( -0.5f );
1810 animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1811 animation.SetLoopCount(3);
1813 // Start the animation
1815 application.SendNotification();
1816 application.Render(0); // Frame 0 tests initial values
1818 for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1820 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, testData.expected[frame], 0.001, TEST_LOCATION );
1822 application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1824 if( frame < NUM_FRAMES-1 )
1826 // We didn't expect the animation to finish yet
1827 application.SendNotification();
1828 finishCheck.CheckSignalNotReceived();
1832 // We did expect the animation to finish
1833 application.SendNotification();
1834 finishCheck.CheckSignalReceived();
1835 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 30.0f, 0.001, TEST_LOCATION );
1841 int UtcDaliAnimationGetSpeedFactorP(void)
1843 TestApplication application;
1845 Animation animation = Animation::New(1.0f);
1846 animation.SetSpeedFactor(0.5f);
1847 DALI_TEST_EQUALS(animation.GetSpeedFactor(), 0.5f, TEST_LOCATION);
1849 animation.SetSpeedFactor(-2.5f);
1850 DALI_TEST_EQUALS(animation.GetSpeedFactor(), -2.5f, TEST_LOCATION);
1854 int UtcDaliAnimationSetPlayRangeP(void)
1856 TestApplication application;
1858 Actor actor = Actor::New();
1859 Stage::GetCurrent().Add( actor );
1861 // Build the animation
1862 float durationSeconds( 1.0f );
1863 Animation animation = Animation::New( durationSeconds );
1865 bool signalReceived( false );
1866 AnimationFinishCheck finishCheck( signalReceived );
1867 animation.FinishedSignal().Connect( &application, finishCheck );
1868 application.SendNotification();
1870 // Set range between 0.4 and 0.8
1871 animation.SetPlayRange( Vector2( 0.4f, 0.9f ) );
1872 application.SendNotification();
1873 DALI_TEST_EQUALS( Vector2( 0.4f, 0.9f ), animation.GetPlayRange(), TEST_LOCATION );
1875 Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
1876 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR );
1878 // Start the animation from 40% progress
1881 application.SendNotification();
1882 application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 60% progress */ );
1884 // We didn't expect the animation to finish yet
1885 application.SendNotification();
1886 finishCheck.CheckSignalNotReceived();
1887 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.6f ), TEST_LOCATION );
1889 application.SendNotification();
1890 application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 80% progress */ );
1892 application.SendNotification();
1893 finishCheck.CheckSignalNotReceived();
1894 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.8f ), TEST_LOCATION );
1896 application.SendNotification();
1897 application.Render( static_cast< unsigned int >( durationSeconds*100.0f ) + 1u/*just beyond the animation duration*/ );
1899 // We did expect the animation to finish
1900 application.SendNotification();
1901 finishCheck.CheckSignalReceived();
1902 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.9f ), TEST_LOCATION );
1906 int UtcDaliAnimationSetPlayRangeN(void)
1908 TestApplication application;
1910 Actor actor = Actor::New();
1911 Stage::GetCurrent().Add(actor);
1913 // Build the animation
1914 Animation animation = Animation::New(0);
1915 application.SendNotification();
1917 //PlayRange out of bounds
1918 animation.SetPlayRange( Vector2(-1.0f,1.0f) );
1919 application.SendNotification();
1920 DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
1921 animation.SetPlayRange( Vector2(0.0f,2.0f) );
1922 application.SendNotification();
1923 DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
1925 //If playRange is not in the correct order it has to be ordered
1926 animation.SetPlayRange( Vector2(0.8f,0.2f) );
1927 application.SendNotification();
1928 DALI_TEST_EQUALS( Vector2(0.2f,0.8f), animation.GetPlayRange(), TEST_LOCATION );
1933 int UtcDaliAnimationGetPlayRangeP(void)
1935 TestApplication application;
1937 Actor actor = Actor::New();
1938 Stage::GetCurrent().Add( actor );
1940 // Build the animation
1941 Animation animation = Animation::New( 1.0f );
1942 application.SendNotification();
1944 //If PlayRange not specified it should be 0.0-1.0 by default
1945 DALI_TEST_EQUALS( Vector2( 0.0f,1.0f ), animation.GetPlayRange(), TEST_LOCATION );
1947 // Set range between 0.4 and 0.8
1948 animation.SetPlayRange( Vector2( 0.4f, 0.8f ) );
1949 application.SendNotification();
1950 DALI_TEST_EQUALS( Vector2( 0.4f, 0.8f ), animation.GetPlayRange(), TEST_LOCATION );
1955 int UtcDaliAnimationPlayP(void)
1957 TestApplication application;
1959 Actor actor = Actor::New();
1960 Stage::GetCurrent().Add(actor);
1962 // Build the animation
1963 float durationSeconds(1.0f);
1964 Animation animation = Animation::New(durationSeconds);
1965 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1966 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1968 // Start the animation
1971 bool signalReceived(false);
1972 AnimationFinishCheck finishCheck(signalReceived);
1973 animation.FinishedSignal().Connect(&application, finishCheck);
1975 application.SendNotification();
1976 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1978 // We didn't expect the animation to finish yet
1979 application.SendNotification();
1980 finishCheck.CheckSignalNotReceived();
1981 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1983 animation.Play(); // Test that calling play has no effect, when animation is already playing
1984 application.SendNotification();
1985 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1987 // We didn't expect the animation to finish yet
1988 application.SendNotification();
1989 finishCheck.CheckSignalNotReceived();
1990 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1992 animation.Play(); // Test that calling play has no effect, when animation is already playing
1993 application.SendNotification();
1994 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1996 // We didn't expect the animation to finish yet
1997 application.SendNotification();
1998 finishCheck.CheckSignalNotReceived();
1999 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2001 animation.Play(); // Test that calling play has no effect, when animation is already playing
2002 application.SendNotification();
2003 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2005 // We didn't expect the animation to finish yet
2006 application.SendNotification();
2007 finishCheck.CheckSignalNotReceived();
2008 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2010 animation.Play(); // Test that calling play has no effect, when animation is already playing
2011 application.SendNotification();
2012 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2014 // We did expect the animation to finish
2015 application.SendNotification();
2016 finishCheck.CheckSignalReceived();
2017 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2019 // Check that nothing has changed after a couple of buffer swaps
2020 application.Render(0);
2021 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2022 application.Render(0);
2023 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2027 int UtcDaliAnimationPlayOffStageP(void)
2029 // Test that an animation can be played, when the actor is off-stage.
2030 // When the actor is added to the stage, it should appear at the current position
2031 // i.e. where it would have been anyway, if on-stage from the beginning.
2033 TestApplication application;
2035 Actor actor = Actor::New();
2036 Vector3 basePosition(Vector3::ZERO);
2037 DALI_TEST_EQUALS( actor.GetCurrentPosition(), basePosition, TEST_LOCATION );
2038 // Not added to the stage!
2040 // Build the animation
2041 float durationSeconds(1.0f);
2042 Animation animation = Animation::New(durationSeconds);
2043 animation.SetDisconnectAction( Animation::Discard );
2044 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2045 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2047 // Start the animation
2050 bool signalReceived(false);
2051 AnimationFinishCheck finishCheck(signalReceived);
2052 animation.FinishedSignal().Connect(&application, finishCheck);
2054 application.SendNotification();
2055 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2057 // We didn't expect the animation to finish yet
2058 application.SendNotification();
2059 finishCheck.CheckSignalNotReceived();
2060 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*off-stage*/, TEST_LOCATION );
2063 Stage::GetCurrent().Add(actor);
2065 application.SendNotification();
2066 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2068 // We didn't expect the animation to finish yet
2069 application.SendNotification();
2070 finishCheck.CheckSignalNotReceived();
2071 Vector3 expectedPosition(basePosition + (targetPosition - basePosition)*0.4f);
2072 DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition/*on-stage*/, TEST_LOCATION );
2074 // Remove from the stage
2075 Stage::GetCurrent().Remove(actor);
2077 application.SendNotification();
2078 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2080 // We didn't expect the animation to finish yet
2081 application.SendNotification();
2082 finishCheck.CheckSignalNotReceived();
2083 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*back to start position*/, TEST_LOCATION );
2086 Stage::GetCurrent().Add(actor);
2088 application.SendNotification();
2089 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2091 // We didn't expect the animation to finish yet
2092 application.SendNotification();
2093 finishCheck.CheckSignalNotReceived();
2094 expectedPosition = Vector3(basePosition + (targetPosition - basePosition)*0.8f);
2095 DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition, TEST_LOCATION );
2097 application.SendNotification();
2098 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2100 // We did expect the animation to finish
2101 application.SendNotification();
2102 finishCheck.CheckSignalReceived();
2103 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2105 // Check that nothing has changed after a couple of buffer swaps
2106 application.Render(0);
2107 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2108 application.Render(0);
2109 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2113 int UtcDaliAnimationPlayDiscardHandleP(void)
2115 TestApplication application;
2117 Actor actor = Actor::New();
2118 Stage::GetCurrent().Add(actor);
2120 // Build the animation
2121 float durationSeconds(1.0f);
2122 Animation animation = Animation::New(durationSeconds);
2123 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2124 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2126 bool signalReceived(false);
2127 AnimationFinishCheck finishCheck(signalReceived);
2128 animation.FinishedSignal().Connect(&application, finishCheck);
2130 // Start the animation
2133 // This is a test of the "Fire and Forget" behaviour
2134 // Discard the animation handle!
2136 DALI_TEST_CHECK( !animation );
2138 application.SendNotification();
2139 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2141 // We didn't expect the animation to finish yet
2142 application.SendNotification();
2143 finishCheck.CheckSignalNotReceived();
2144 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2146 application.SendNotification();
2147 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2149 // We didn't expect the animation to finish yet
2150 application.SendNotification();
2151 finishCheck.CheckSignalNotReceived();
2152 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
2154 application.SendNotification();
2155 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2157 // We didn't expect the animation to finish yet
2158 application.SendNotification();
2159 finishCheck.CheckSignalNotReceived();
2160 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2162 application.SendNotification();
2163 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2165 // We didn't expect the animation to finish yet
2166 application.SendNotification();
2167 finishCheck.CheckSignalNotReceived();
2168 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2170 application.SendNotification();
2171 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2173 // We did expect the animation to finish
2174 application.SendNotification();
2175 finishCheck.CheckSignalReceived();
2176 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2178 // Check that nothing has changed after a couple of buffer swaps
2179 application.Render(0);
2180 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2181 application.Render(0);
2182 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2186 int UtcDaliAnimationPlayStopDiscardHandleP(void)
2188 TestApplication application;
2190 Actor actor = Actor::New();
2191 Stage::GetCurrent().Add(actor);
2193 // Build the animation
2194 float durationSeconds(1.0f);
2195 Animation animation = Animation::New(durationSeconds);
2196 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2197 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2199 // Start the animation
2202 bool signalReceived(false);
2203 AnimationFinishCheck finishCheck(signalReceived);
2204 animation.FinishedSignal().Connect(&application, finishCheck);
2206 application.SendNotification();
2207 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2209 // We didn't expect the animation to finish yet
2210 application.SendNotification();
2211 finishCheck.CheckSignalNotReceived();
2212 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2214 // This is a test of the "Fire and Forget" behaviour
2215 // Stop the animation, and Discard the animation handle!
2218 DALI_TEST_CHECK( !animation );
2220 application.SendNotification();
2221 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2223 // We expect the animation to finish at 20% progress
2224 application.SendNotification();
2225 finishCheck.CheckSignalReceived();
2226 finishCheck.Reset();
2227 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2229 application.SendNotification();
2230 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2232 // Check that nothing has changed
2233 application.SendNotification();
2234 finishCheck.CheckSignalNotReceived();
2235 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2237 application.SendNotification();
2238 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2240 // Check that nothing has changed
2241 application.SendNotification();
2242 finishCheck.CheckSignalNotReceived();
2243 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2245 application.SendNotification();
2246 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 100% progress */);
2248 // Check that nothing has changed
2249 application.SendNotification();
2250 finishCheck.CheckSignalNotReceived();
2251 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2255 int UtcDaliAnimationPlayRangeP(void)
2257 TestApplication application;
2259 Actor actor = Actor::New();
2260 Stage::GetCurrent().Add(actor);
2262 // Build the animation
2263 float durationSeconds(1.0f);
2264 Animation animation = Animation::New(durationSeconds);
2265 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2266 KeyFrames keyframes = KeyFrames::New();
2267 keyframes.Add( 0.0f , Vector3(0.0f,0.0f,0.0f ) );
2268 keyframes.Add( 1.0f , Vector3(100.0f,100.0f,100.0f ) );
2270 animation.AnimateBetween( Property( actor, Actor::Property::POSITION), keyframes );
2272 // Set range between 0.4 and 0.8
2273 animation.SetPlayRange( Vector2(0.4f,0.8f) );
2276 bool signalReceived(false);
2277 AnimationFinishCheck finishCheck(signalReceived);
2278 animation.FinishedSignal().Connect(&application, finishCheck);
2280 //Test that setting progress outside the range doesn't work
2281 animation.SetCurrentProgress( 0.9f );
2282 application.SendNotification();
2283 application.Render(0);
2284 DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
2285 animation.SetCurrentProgress( 0.2f );
2286 application.SendNotification();
2287 application.Render(0);
2288 DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
2290 application.SendNotification();
2291 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2293 // We didn't expect the animation to finish yet
2294 application.SendNotification();
2295 finishCheck.CheckSignalNotReceived();
2296 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2298 animation.Play(); // Test that calling play has no effect, when animation is already playing
2299 application.SendNotification();
2300 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/* 80% progress */);
2302 // We did expect the animation to finish
2303 application.SendNotification();
2304 finishCheck.CheckSignalReceived();
2305 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2307 // Check that nothing has changed after a couple of buffer swaps
2308 application.Render(0);
2309 DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentPosition(), TEST_LOCATION );
2310 application.Render(0);
2311 DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentPosition(), TEST_LOCATION );
2314 //Loop inside the range
2315 finishCheck.Reset();
2316 animation.SetLooping( true );
2318 application.SendNotification();
2319 float intervalSeconds = 0.1f;
2320 float progress = 0.4f;
2321 for (int iterations = 0; iterations < 10; ++iterations )
2323 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
2325 progress += intervalSeconds;
2326 if (progress > 0.8f)
2328 progress = progress - 0.4f;
2331 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
2334 // We didn't expect the animation to finish yet
2335 application.SendNotification();
2336 finishCheck.CheckSignalNotReceived();
2339 //Test change range on the fly
2340 animation.SetPlayRange( Vector2( 0.2f, 0.9f ) );
2341 application.SendNotification();
2343 for (int iterations = 0; iterations < 10; ++iterations )
2345 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
2347 progress += intervalSeconds;
2348 if (progress > 0.9f)
2350 progress = progress - 0.7f;
2353 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
2359 int UtcDaliAnimationPlayFromP(void)
2361 TestApplication application;
2363 Actor actor = Actor::New();
2364 Stage::GetCurrent().Add(actor);
2366 // Build the animation
2367 float durationSeconds(1.0f);
2368 Animation animation = Animation::New(durationSeconds);
2369 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2370 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2372 // Start the animation from 40% progress
2373 animation.PlayFrom( 0.4f );
2375 bool signalReceived(false);
2376 AnimationFinishCheck finishCheck(signalReceived);
2377 animation.FinishedSignal().Connect(&application, finishCheck);
2379 application.SendNotification();
2380 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2382 // We didn't expect the animation to finish yet
2383 application.SendNotification();
2384 finishCheck.CheckSignalNotReceived();
2385 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2387 animation.Play(); // Test that calling play has no effect, when animation is already playing
2388 application.SendNotification();
2389 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2391 // We didn't expect the animation to finish yet
2392 application.SendNotification();
2393 finishCheck.CheckSignalNotReceived();
2394 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2396 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2397 // We did expect the animation to finish
2398 application.SendNotification();
2399 finishCheck.CheckSignalReceived();
2400 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2402 // Check that nothing has changed after a couple of buffer swaps
2403 application.Render(0);
2404 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2405 application.Render(0);
2406 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2410 int UtcDaliAnimationPlayFromN(void)
2412 TestApplication application;
2414 Actor actor = Actor::New();
2415 Stage::GetCurrent().Add(actor);
2417 // Build the animation
2418 float durationSeconds(1.0f);
2419 Animation animation = Animation::New(durationSeconds);
2420 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2421 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2423 //PlayFrom with an argument outside the range [0..1] will be ignored
2424 animation.PlayFrom(-1.0f);
2425 application.SendNotification();
2426 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
2428 animation.PlayFrom(100.0f);
2429 application.SendNotification();
2430 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
2434 int UtcDaliAnimationPauseP(void)
2436 TestApplication application;
2438 Actor actor = Actor::New();
2439 Stage::GetCurrent().Add(actor);
2441 // Build the animation
2442 float durationSeconds(1.0f);
2443 Animation animation = Animation::New(durationSeconds);
2444 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2445 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2447 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2449 // Start the animation
2452 bool signalReceived(false);
2453 AnimationFinishCheck finishCheck(signalReceived);
2454 animation.FinishedSignal().Connect(&application, finishCheck);
2456 application.SendNotification();
2457 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2459 // We didn't expect the animation to finish yet
2460 application.SendNotification();
2461 finishCheck.CheckSignalNotReceived();
2462 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2464 // Pause the animation
2466 application.SendNotification();
2469 for (int i=0; i<5; ++i)
2471 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2473 // We didn't expect the animation to finish yet
2474 application.SendNotification();
2475 finishCheck.CheckSignalNotReceived();
2476 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
2481 application.SendNotification();
2482 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2484 // We didn't expect the animation to finish yet
2485 application.SendNotification();
2486 finishCheck.CheckSignalNotReceived();
2488 application.SendNotification();
2489 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2491 // We did expect the animation to finish
2492 application.SendNotification();
2493 finishCheck.CheckSignalReceived();
2494 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2496 // Check that nothing has changed after a couple of buffer swaps
2497 application.Render(0);
2498 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2499 application.Render(0);
2500 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2505 int UtcDaliAnimationGetStateP(void)
2507 TestApplication application;
2509 Actor actor = Actor::New();
2510 Stage::GetCurrent().Add(actor);
2512 // Build the animation
2513 float durationSeconds(1.0f);
2514 Animation animation = Animation::New(durationSeconds);
2515 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2516 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2517 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2519 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2521 // Start the animation
2524 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2526 bool signalReceived(false);
2527 AnimationFinishCheck finishCheck(signalReceived);
2528 animation.FinishedSignal().Connect(&application, finishCheck);
2530 application.SendNotification();
2531 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2533 // We didn't expect the animation to finish yet
2534 application.SendNotification();
2535 finishCheck.CheckSignalNotReceived();
2536 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2537 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2539 // Pause the animation
2541 DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
2542 application.SendNotification();
2543 application.Render(0.f);
2546 for (int i=0; i<5; ++i)
2548 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2550 // We didn't expect the animation to finish yet
2551 application.SendNotification();
2552 finishCheck.CheckSignalNotReceived();
2553 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
2554 DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
2558 finishCheck.Reset();
2560 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2561 application.SendNotification();
2562 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2563 // We didn't expect the animation to finish yet
2564 application.SendNotification();
2565 finishCheck.CheckSignalNotReceived();
2566 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2568 application.SendNotification();
2569 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2571 // We did expect the animation to finish
2572 application.SendNotification();
2573 finishCheck.CheckSignalReceived();
2574 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2575 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2577 // Check that nothing has changed after a couple of buffer swaps
2578 application.Render(0);
2579 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2580 application.Render(0);
2581 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2582 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2585 finishCheck.Reset();
2587 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2588 application.SendNotification();
2589 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2590 application.SendNotification();
2591 finishCheck.CheckSignalNotReceived();
2592 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2598 int UtcDaliAnimationStopP(void)
2600 TestApplication application;
2602 Actor actor = Actor::New();
2603 Stage::GetCurrent().Add(actor);
2605 // Build the animation
2606 float durationSeconds(1.0f);
2607 Animation animation = Animation::New(durationSeconds);
2608 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2609 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2611 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2613 // Start the animation
2616 bool signalReceived(false);
2617 AnimationFinishCheck finishCheck(signalReceived);
2618 animation.FinishedSignal().Connect(&application, finishCheck);
2620 application.SendNotification();
2621 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2623 // We didn't expect the animation to finish yet
2624 application.SendNotification();
2625 finishCheck.CheckSignalNotReceived();
2626 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2628 // Stop the animation
2630 application.SendNotification();
2633 for (int i=0; i<5; ++i)
2635 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2637 // We did expect the animation to finish
2638 application.SendNotification();
2639 finishCheck.CheckSignalReceived();
2640 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when stopped */, TEST_LOCATION );
2645 int UtcDaliAnimationStopSetPositionP(void)
2647 // Test that Animation::Stop & Actor::SetPosition can be used in conjunction
2648 // i.e. to check that the animation does not interfere with the position set.
2650 TestApplication application;
2652 Actor actor = Actor::New();
2653 Stage::GetCurrent().Add(actor);
2655 // Build the animation
2656 float durationSeconds(1.0f);
2657 Animation animation = Animation::New(durationSeconds);
2658 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2659 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2661 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2663 // Start the animation
2666 bool signalReceived(false);
2667 AnimationFinishCheck finishCheck(signalReceived);
2668 animation.FinishedSignal().Connect(&application, finishCheck);
2670 application.SendNotification();
2671 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2673 // We didn't expect the animation to finish yet
2674 application.SendNotification();
2675 finishCheck.CheckSignalNotReceived();
2676 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2678 // Stop the animation
2680 Vector3 positionSet(2.0f, 3.0f, 4.0f);
2681 actor.SetPosition(positionSet);
2682 application.SendNotification();
2685 for (int i=0; i<5; ++i)
2687 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2689 // We did expect the animation to finish
2690 application.SendNotification();
2691 finishCheck.CheckSignalReceived();
2692 DALI_TEST_EQUALS( actor.GetCurrentPosition(), positionSet/*Animation should not interfere with this*/, TEST_LOCATION );
2697 int UtcDaliAnimationClearP(void)
2699 TestApplication application;
2701 Actor actor = Actor::New();
2702 Stage::GetCurrent().Add(actor);
2704 // Build the animation
2705 float durationSeconds(1.0f);
2706 Animation animation = Animation::New(durationSeconds);
2707 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2708 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2710 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2712 // Start the animation
2715 bool signalReceived(false);
2716 AnimationFinishCheck finishCheck(signalReceived);
2717 animation.FinishedSignal().Connect(&application, finishCheck);
2719 application.SendNotification();
2720 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2722 // We didn't expect the animation to finish yet
2723 application.SendNotification();
2724 finishCheck.CheckSignalNotReceived();
2725 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2727 // Clear the animation
2729 application.SendNotification();
2731 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2733 // We don't expect the animation to finish now
2734 application.SendNotification();
2735 finishCheck.CheckSignalNotReceived();
2736 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress since the animator was destroyed */, TEST_LOCATION );
2738 // Restart as a scale animation; this should not move the actor's position
2739 finishCheck.Reset();
2740 actor.SetPosition(Vector3::ZERO);
2741 Vector3 targetScale(3.0f, 3.0f, 3.0f);
2742 animation.AnimateTo( Property( actor, Actor::Property::SCALE ), targetScale, AlphaFunction::LINEAR );
2745 application.SendNotification();
2746 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2748 // We didn't expect the animation to finish yet
2749 application.SendNotification();
2750 finishCheck.CheckSignalNotReceived();
2751 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
2752 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION );
2754 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2756 // We did expect the animation to finish
2757 application.SendNotification();
2758 finishCheck.CheckSignalReceived();
2759 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
2760 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
2764 int UtcDaliAnimationFinishedSignalP(void)
2766 TestApplication application;
2768 // Start the empty animation
2769 float durationSeconds(1.0f);
2770 Animation animation = Animation::New(durationSeconds);
2773 bool signalReceived(false);
2774 AnimationFinishCheck finishCheck(signalReceived);
2775 animation.FinishedSignal().Connect(&application, finishCheck);
2777 application.SendNotification();
2778 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*beyond the animation duration*/);
2780 // We did expect the animation to finish
2781 application.SendNotification();
2782 finishCheck.CheckSignalReceived();
2786 int UtcDaliAnimationAnimateByBooleanP(void)
2788 TestApplication application;
2790 Actor actor = Actor::New();
2792 // Register a boolean property
2793 bool startValue(false);
2794 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2795 Stage::GetCurrent().Add(actor);
2796 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2797 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
2799 // Build the animation
2800 float durationSeconds(2.0f);
2801 Animation animation = Animation::New(durationSeconds);
2802 const bool relativeValue(true);
2803 const bool finalValue( false || relativeValue );
2804 animation.AnimateBy(Property(actor, index), relativeValue);
2806 // Start the animation
2809 // Target value should be retrievable straight away
2810 DALI_TEST_EQUALS( actor.GetProperty< bool >( index ), finalValue, TEST_LOCATION );
2812 bool signalReceived(false);
2813 AnimationFinishCheck finishCheck(signalReceived);
2814 animation.FinishedSignal().Connect(&application, finishCheck);
2816 application.SendNotification();
2817 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2819 // We didn't expect the animation to finish yet
2820 application.SendNotification();
2821 finishCheck.CheckSignalNotReceived();
2822 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
2824 application.SendNotification();
2825 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2827 // We did expect the animation to finish
2828 application.SendNotification();
2829 finishCheck.CheckSignalReceived();
2830 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2832 // Check that nothing has changed after a couple of buffer swaps
2833 application.Render(0);
2834 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2835 application.Render(0);
2836 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2838 // Repeat with relative value "false" - this should be an NOOP
2839 animation = Animation::New(durationSeconds);
2840 bool noOpValue(false);
2841 animation.AnimateBy(Property(actor, index), noOpValue);
2843 // Start the animation
2846 finishCheck.Reset();
2847 animation.FinishedSignal().Connect(&application, finishCheck);
2849 application.SendNotification();
2850 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2852 // We didn't expect the animation to finish yet
2853 application.SendNotification();
2854 finishCheck.CheckSignalNotReceived();
2855 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2857 application.SendNotification();
2858 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2860 // We did expect the animation to finish
2861 application.SendNotification();
2862 finishCheck.CheckSignalReceived();
2863 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2865 // Check that nothing has changed after a couple of buffer swaps
2866 application.Render(0);
2867 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2868 application.Render(0);
2869 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2873 int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void)
2875 TestApplication application;
2877 Actor actor = Actor::New();
2879 // Register a boolean property
2880 bool startValue(false);
2881 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2882 Stage::GetCurrent().Add(actor);
2883 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2884 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
2886 // Build the animation
2887 float durationSeconds(2.0f);
2888 Animation animation = Animation::New(durationSeconds);
2889 bool relativeValue(true);
2890 bool finalValue( false || relativeValue );
2891 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN);
2893 // Start the animation
2896 bool signalReceived(false);
2897 AnimationFinishCheck finishCheck(signalReceived);
2898 animation.FinishedSignal().Connect(&application, finishCheck);
2900 application.SendNotification();
2901 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2903 // We didn't expect the animation to finish yet
2904 application.SendNotification();
2905 finishCheck.CheckSignalNotReceived();
2906 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
2908 application.SendNotification();
2909 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2911 // We did expect the animation to finish
2912 application.SendNotification();
2913 finishCheck.CheckSignalReceived();
2914 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2916 // Check that nothing has changed after a couple of buffer swaps
2917 application.Render(0);
2918 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2919 application.Render(0);
2920 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2922 // Repeat with relative value "false" - this should be an NOOP
2923 animation = Animation::New(durationSeconds);
2924 bool noOpValue(false);
2925 animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunction::EASE_IN);
2927 // Start the animation
2930 finishCheck.Reset();
2931 animation.FinishedSignal().Connect(&application, finishCheck);
2933 application.SendNotification();
2934 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2936 // We didn't expect the animation to finish yet
2937 application.SendNotification();
2938 finishCheck.CheckSignalNotReceived();
2939 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2941 application.SendNotification();
2942 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2944 // We did expect the animation to finish
2945 application.SendNotification();
2946 finishCheck.CheckSignalReceived();
2947 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2951 int UtcDaliAnimationAnimateByBooleanTimePeriodP(void)
2953 TestApplication application;
2955 Actor actor = Actor::New();
2957 // Register a boolean property
2958 bool startValue(false);
2959 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2960 Stage::GetCurrent().Add(actor);
2961 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2962 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
2964 // Build the animation
2965 float durationSeconds(2.0f);
2966 Animation animation = Animation::New(durationSeconds);
2967 bool relativeValue(true);
2968 bool finalValue( false || relativeValue );
2969 float animatorDurationSeconds(durationSeconds * 0.5f);
2970 animation.AnimateBy( Property(actor, index),
2972 TimePeriod( animatorDurationSeconds ) );
2974 // Start the animation
2977 bool signalReceived(false);
2978 AnimationFinishCheck finishCheck(signalReceived);
2979 animation.FinishedSignal().Connect(&application, finishCheck);
2981 application.SendNotification();
2982 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
2984 // We didn't expect the animation to finish yet
2985 application.SendNotification();
2986 finishCheck.CheckSignalNotReceived();
2987 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
2989 application.SendNotification();
2990 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
2992 // We didn't expect the animation to finish yet...
2993 application.SendNotification();
2994 finishCheck.CheckSignalNotReceived();
2996 // ...however we should have reached the final value
2997 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2999 application.SendNotification();
3000 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
3002 // We did expect the animation to finish
3003 application.SendNotification();
3004 finishCheck.CheckSignalReceived();
3005 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
3007 // Check that nothing has changed after a couple of buffer swaps
3008 application.Render(0);
3009 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
3010 application.Render(0);
3011 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
3015 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void)
3017 TestApplication application;
3019 Actor actor = Actor::New();
3021 // Register a boolean property
3022 bool startValue(false);
3023 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3024 Stage::GetCurrent().Add(actor);
3025 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3026 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
3028 // Build the animation
3029 float durationSeconds(2.0f);
3030 Animation animation = Animation::New(durationSeconds);
3031 bool relativeValue(true);
3032 bool finalValue( false || relativeValue );
3033 float animatorDurationSeconds(durationSeconds * 0.5f);
3034 animation.AnimateBy( Property(actor, index),
3036 AlphaFunction::EASE_IN_OUT,
3037 TimePeriod( animatorDurationSeconds ) );
3039 // Start the animation
3042 bool signalReceived(false);
3043 AnimationFinishCheck finishCheck(signalReceived);
3044 animation.FinishedSignal().Connect(&application, finishCheck);
3046 application.SendNotification();
3047 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
3049 // We didn't expect the animation to finish yet
3050 application.SendNotification();
3051 finishCheck.CheckSignalNotReceived();
3052 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
3054 application.SendNotification();
3055 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
3057 // We didn't expect the animation to finish yet...
3058 application.SendNotification();
3059 finishCheck.CheckSignalNotReceived();
3061 // ...however we should have reached the final value
3062 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
3064 application.SendNotification();
3065 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
3067 // We did expect the animation to finish
3068 application.SendNotification();
3069 finishCheck.CheckSignalReceived();
3070 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
3072 // Check that nothing has changed after a couple of buffer swaps
3073 application.Render(0);
3074 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
3075 application.Render(0);
3076 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
3080 int UtcDaliAnimationAnimateByFloatP(void)
3082 TestApplication application;
3084 Actor actor = Actor::New();
3086 // Register a float property
3087 float startValue(10.0f);
3088 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3089 Stage::GetCurrent().Add(actor);
3090 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3091 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
3093 // Build the animation
3094 float durationSeconds(2.0f);
3095 Animation animation = Animation::New(durationSeconds);
3096 float targetValue(50.0f);
3097 float relativeValue(targetValue - startValue);
3098 animation.AnimateBy(Property(actor, index), relativeValue);
3100 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3102 // Start the animation
3105 // Target value should be retrievable straight away
3106 DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
3108 bool signalReceived(false);
3109 AnimationFinishCheck finishCheck(signalReceived);
3110 animation.FinishedSignal().Connect(&application, finishCheck);
3112 application.SendNotification();
3113 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3115 // We didn't expect the animation to finish yet
3116 application.SendNotification();
3117 finishCheck.CheckSignalNotReceived();
3118 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
3120 application.SendNotification();
3121 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3123 // We did expect the animation to finish
3124 application.SendNotification();
3125 finishCheck.CheckSignalReceived();
3126 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3128 // Check that nothing has changed after a couple of buffer swaps
3129 application.Render(0);
3130 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3131 application.Render(0);
3132 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3136 int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void)
3138 TestApplication application;
3140 Actor actor = Actor::New();
3142 // Register a float property
3143 float startValue(10.0f);
3144 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3145 Stage::GetCurrent().Add(actor);
3146 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3147 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
3149 // Build the animation
3150 float durationSeconds(1.0f);
3151 Animation animation = Animation::New(durationSeconds);
3152 float targetValue(90.0f);
3153 float relativeValue(targetValue - startValue);
3154 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3156 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3158 // Start the animation
3161 bool signalReceived(false);
3162 AnimationFinishCheck finishCheck(signalReceived);
3163 animation.FinishedSignal().Connect(&application, finishCheck);
3165 application.SendNotification();
3166 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3168 // We didn't expect the animation to finish yet
3169 application.SendNotification();
3170 finishCheck.CheckSignalNotReceived();
3172 // The position should have moved more, than with a linear alpha function
3173 float current( DevelHandle::GetCurrentProperty< float >( actor, index ) );
3174 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3176 application.SendNotification();
3177 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3179 // We did expect the animation to finish
3180 application.SendNotification();
3181 finishCheck.CheckSignalReceived();
3182 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3184 // Check that nothing has changed after a couple of buffer swaps
3185 application.Render(0);
3186 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3187 application.Render(0);
3188 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3192 int UtcDaliAnimationAnimateByFloatTimePeriodP(void)
3194 TestApplication application;
3196 Actor actor = Actor::New();
3198 // Register a float property
3199 float startValue(10.0f);
3200 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3201 Stage::GetCurrent().Add(actor);
3202 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3203 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
3205 // Build the animation
3206 float durationSeconds(1.0f);
3207 Animation animation = Animation::New(durationSeconds);
3208 float targetValue(30.0f);
3209 float relativeValue(targetValue - startValue);
3211 animation.AnimateBy(Property(actor, index),
3213 TimePeriod(delay, durationSeconds - delay));
3215 // Start the animation
3218 bool signalReceived(false);
3219 AnimationFinishCheck finishCheck(signalReceived);
3220 animation.FinishedSignal().Connect(&application, finishCheck);
3222 application.SendNotification();
3223 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3225 // We didn't expect the animation to finish yet
3226 application.SendNotification();
3227 finishCheck.CheckSignalNotReceived();
3228 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
3230 application.SendNotification();
3231 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3233 // We didn't expect the animation to finish yet
3234 application.SendNotification();
3235 finishCheck.CheckSignalNotReceived();
3236 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3238 application.SendNotification();
3239 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3241 // We did expect the animation to finish
3242 application.SendNotification();
3243 finishCheck.CheckSignalReceived();
3244 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3246 // Check that nothing has changed after a couple of buffer swaps
3247 application.Render(0);
3248 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3249 application.Render(0);
3250 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3254 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void)
3256 TestApplication application;
3258 Actor actor = Actor::New();
3260 // Register a float property
3261 float startValue(10.0f);
3262 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3263 Stage::GetCurrent().Add(actor);
3264 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3265 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
3267 // Build the animation
3268 float durationSeconds(1.0f);
3269 Animation animation = Animation::New(durationSeconds);
3270 float targetValue(30.0f);
3271 float relativeValue(targetValue - startValue);
3273 animation.AnimateBy(Property(actor, index),
3275 AlphaFunction::LINEAR,
3276 TimePeriod(delay, durationSeconds - delay));
3278 // Start the animation
3281 bool signalReceived(false);
3282 AnimationFinishCheck finishCheck(signalReceived);
3283 animation.FinishedSignal().Connect(&application, finishCheck);
3285 application.SendNotification();
3286 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3288 // We didn't expect the animation to finish yet
3289 application.SendNotification();
3290 finishCheck.CheckSignalNotReceived();
3291 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
3293 application.SendNotification();
3294 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3296 // We didn't expect the animation to finish yet
3297 application.SendNotification();
3298 finishCheck.CheckSignalNotReceived();
3299 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3301 application.SendNotification();
3302 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3304 // We did expect the animation to finish
3305 application.SendNotification();
3306 finishCheck.CheckSignalReceived();
3307 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3309 // Check that nothing has changed after a couple of buffer swaps
3310 application.Render(0);
3311 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3312 application.Render(0);
3313 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3317 int UtcDaliAnimationAnimateByIntegerP(void)
3319 TestApplication application;
3321 Actor actor = Actor::New();
3323 // Register an integer property
3325 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3326 Stage::GetCurrent().Add(actor);
3327 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3328 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
3330 // Build the animation
3331 float durationSeconds(2.0f);
3332 Animation animation = Animation::New(durationSeconds);
3333 int targetValue(50);
3334 int relativeValue(targetValue - startValue);
3335 animation.AnimateBy(Property(actor, index), relativeValue);
3337 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3339 // Start the animation
3342 // Target value should be retrievable straight away
3343 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), targetValue, TEST_LOCATION );
3345 bool signalReceived(false);
3346 AnimationFinishCheck finishCheck(signalReceived);
3347 animation.FinishedSignal().Connect(&application, finishCheck);
3349 application.SendNotification();
3350 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3352 // We didn't expect the animation to finish yet
3353 application.SendNotification();
3354 finishCheck.CheckSignalNotReceived();
3355 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
3357 application.SendNotification();
3358 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3360 // We did expect the animation to finish
3361 application.SendNotification();
3362 finishCheck.CheckSignalReceived();
3363 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3365 // Check that nothing has changed after a couple of buffer swaps
3366 application.Render(0);
3367 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3368 application.Render(0);
3369 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3373 int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void)
3375 TestApplication application;
3377 Actor actor = Actor::New();
3379 // Register an integer property
3381 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3382 Stage::GetCurrent().Add(actor);
3383 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3384 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
3386 // Build the animation
3387 float durationSeconds(1.0f);
3388 Animation animation = Animation::New(durationSeconds);
3389 int targetValue(90);
3390 int relativeValue(targetValue - startValue);
3391 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3393 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3395 // Start the animation
3398 bool signalReceived(false);
3399 AnimationFinishCheck finishCheck(signalReceived);
3400 animation.FinishedSignal().Connect(&application, finishCheck);
3402 application.SendNotification();
3403 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3405 // We didn't expect the animation to finish yet
3406 application.SendNotification();
3407 finishCheck.CheckSignalNotReceived();
3409 // The position should have moved more, than with a linear alpha function
3410 int current( DevelHandle::GetCurrentProperty< int >( actor, index ) );
3411 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3413 application.SendNotification();
3414 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3416 // We did expect the animation to finish
3417 application.SendNotification();
3418 finishCheck.CheckSignalReceived();
3419 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3421 // Check that nothing has changed after a couple of buffer swaps
3422 application.Render(0);
3423 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3424 application.Render(0);
3425 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3429 int UtcDaliAnimationAnimateByIntegerTimePeriodP(void)
3431 TestApplication application;
3433 Actor actor = Actor::New();
3435 // Register an integer property
3437 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3438 Stage::GetCurrent().Add(actor);
3439 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3440 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
3442 // Build the animation
3443 float durationSeconds(1.0f);
3444 Animation animation = Animation::New(durationSeconds);
3445 int targetValue(30);
3446 int relativeValue(targetValue - startValue);
3448 animation.AnimateBy(Property(actor, index),
3450 TimePeriod(delay, durationSeconds - delay));
3452 // Start the animation
3455 bool signalReceived(false);
3456 AnimationFinishCheck finishCheck(signalReceived);
3457 animation.FinishedSignal().Connect(&application, finishCheck);
3459 application.SendNotification();
3460 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3462 // We didn't expect the animation to finish yet
3463 application.SendNotification();
3464 finishCheck.CheckSignalNotReceived();
3465 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
3467 application.SendNotification();
3468 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3470 // We didn't expect the animation to finish yet
3471 application.SendNotification();
3472 finishCheck.CheckSignalNotReceived();
3473 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3475 application.SendNotification();
3476 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3478 // We did expect the animation to finish
3479 application.SendNotification();
3480 finishCheck.CheckSignalReceived();
3481 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3483 // Check that nothing has changed after a couple of buffer swaps
3484 application.Render(0);
3485 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3486 application.Render(0);
3487 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3491 int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void)
3493 TestApplication application;
3495 Actor actor = Actor::New();
3497 // Register an integer property
3499 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3500 Stage::GetCurrent().Add(actor);
3501 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3502 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
3504 // Build the animation
3505 float durationSeconds(1.0f);
3506 Animation animation = Animation::New(durationSeconds);
3507 int targetValue(30);
3508 int relativeValue(targetValue - startValue);
3510 animation.AnimateBy(Property(actor, index),
3512 AlphaFunction::LINEAR,
3513 TimePeriod(delay, durationSeconds - delay));
3515 // Start the animation
3518 bool signalReceived(false);
3519 AnimationFinishCheck finishCheck(signalReceived);
3520 animation.FinishedSignal().Connect(&application, finishCheck);
3522 application.SendNotification();
3523 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3525 // We didn't expect the animation to finish yet
3526 application.SendNotification();
3527 finishCheck.CheckSignalNotReceived();
3528 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
3530 application.SendNotification();
3531 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3533 // We didn't expect the animation to finish yet
3534 application.SendNotification();
3535 finishCheck.CheckSignalNotReceived();
3536 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3538 application.SendNotification();
3539 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3541 // We did expect the animation to finish
3542 application.SendNotification();
3543 finishCheck.CheckSignalReceived();
3544 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3546 // Check that nothing has changed after a couple of buffer swaps
3547 application.Render(0);
3548 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3549 application.Render(0);
3550 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3554 int UtcDaliAnimationAnimateByVector2P(void)
3556 TestApplication application;
3558 Actor actor = Actor::New();
3560 // Register a Vector2 property
3561 Vector2 startValue(10.0f, 10.0f);
3562 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3563 Stage::GetCurrent().Add(actor);
3564 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3565 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
3567 // Build the animation
3568 float durationSeconds(2.0f);
3569 Animation animation = Animation::New(durationSeconds);
3570 Vector2 targetValue(60.0f, 60.0f);
3571 Vector2 relativeValue(targetValue - startValue);
3572 animation.AnimateBy(Property(actor, index), relativeValue);
3574 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3576 // Start the animation
3579 // Target value should be retrievable straight away
3580 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3582 bool signalReceived(false);
3583 AnimationFinishCheck finishCheck(signalReceived);
3584 animation.FinishedSignal().Connect(&application, finishCheck);
3586 application.SendNotification();
3587 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3589 // We didn't expect the animation to finish yet
3590 application.SendNotification();
3591 finishCheck.CheckSignalNotReceived();
3592 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
3594 application.SendNotification();
3595 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3597 // We did expect the animation to finish
3598 application.SendNotification();
3599 finishCheck.CheckSignalReceived();
3600 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3602 // Check that nothing has changed after a couple of buffer swaps
3603 application.Render(0);
3604 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3605 application.Render(0);
3606 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3610 int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void)
3612 TestApplication application;
3614 Actor actor = Actor::New();
3616 // Register a Vector2 property
3617 Vector2 startValue(100.0f, 100.0f);
3618 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3619 Stage::GetCurrent().Add(actor);
3620 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3621 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
3623 // Build the animation
3624 float durationSeconds(1.0f);
3625 Animation animation = Animation::New(durationSeconds);
3626 Vector2 targetValue(20.0f, 20.0f);
3627 Vector2 relativeValue(targetValue - startValue);
3628 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3630 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3632 // Start the animation
3635 bool signalReceived(false);
3636 AnimationFinishCheck finishCheck(signalReceived);
3637 animation.FinishedSignal().Connect(&application, finishCheck);
3639 application.SendNotification();
3640 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3642 // We didn't expect the animation to finish yet
3643 application.SendNotification();
3644 finishCheck.CheckSignalNotReceived();
3646 // The position should have moved more, than with a linear alpha function
3647 Vector2 current( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ) );
3648 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3649 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3651 application.SendNotification();
3652 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3654 // We did expect the animation to finish
3655 application.SendNotification();
3656 finishCheck.CheckSignalReceived();
3657 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3659 // Check that nothing has changed after a couple of buffer swaps
3660 application.Render(0);
3661 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3662 application.Render(0);
3663 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3667 int UtcDaliAnimationAnimateByVector2TimePeriodP(void)
3669 TestApplication application;
3671 Actor actor = Actor::New();
3673 // Register a Vector2 property
3674 Vector2 startValue(10.0f, 10.0f);
3675 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3676 Stage::GetCurrent().Add(actor);
3677 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3678 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
3680 // Build the animation
3681 float durationSeconds(1.0f);
3682 Animation animation = Animation::New(durationSeconds);
3683 Vector2 targetValue(30.0f, 30.0f);
3684 Vector2 relativeValue(targetValue - startValue);
3686 animation.AnimateBy(Property(actor, index),
3688 TimePeriod(delay, durationSeconds - delay));
3690 // Start the animation
3693 bool signalReceived(false);
3694 AnimationFinishCheck finishCheck(signalReceived);
3695 animation.FinishedSignal().Connect(&application, finishCheck);
3697 application.SendNotification();
3698 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3700 // We didn't expect the animation to finish yet
3701 application.SendNotification();
3702 finishCheck.CheckSignalNotReceived();
3703 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
3705 application.SendNotification();
3706 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3708 // We didn't expect the animation to finish yet
3709 application.SendNotification();
3710 finishCheck.CheckSignalNotReceived();
3711 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3713 application.SendNotification();
3714 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3716 // We did expect the animation to finish
3717 application.SendNotification();
3718 finishCheck.CheckSignalReceived();
3719 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3721 // Check that nothing has changed after a couple of buffer swaps
3722 application.Render(0);
3723 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3724 application.Render(0);
3725 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3729 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void)
3731 TestApplication application;
3733 Actor actor = Actor::New();
3735 // Register a Vector2 property
3736 Vector2 startValue(5.0f, 5.0f);
3737 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3738 Stage::GetCurrent().Add(actor);
3739 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3740 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
3742 // Build the animation
3743 float durationSeconds(1.0f);
3744 Animation animation = Animation::New(durationSeconds);
3745 Vector2 targetValue(10.0f, 10.0f);
3746 Vector2 relativeValue(targetValue - startValue);
3748 animation.AnimateBy(Property(actor, index),
3750 AlphaFunction::LINEAR,
3751 TimePeriod(delay, durationSeconds - delay));
3753 // Start the animation
3756 bool signalReceived(false);
3757 AnimationFinishCheck finishCheck(signalReceived);
3758 animation.FinishedSignal().Connect(&application, finishCheck);
3760 application.SendNotification();
3761 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3763 // We didn't expect the animation to finish yet
3764 application.SendNotification();
3765 finishCheck.CheckSignalNotReceived();
3766 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
3768 application.SendNotification();
3769 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3771 // We didn't expect the animation to finish yet
3772 application.SendNotification();
3773 finishCheck.CheckSignalNotReceived();
3774 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3776 application.SendNotification();
3777 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3779 // We did expect the animation to finish
3780 application.SendNotification();
3781 finishCheck.CheckSignalReceived();
3782 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3784 // Check that nothing has changed after a couple of buffer swaps
3785 application.Render(0);
3786 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3787 application.Render(0);
3788 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3792 int UtcDaliAnimationAnimateByVector3P(void)
3794 TestApplication application;
3796 Actor actor = Actor::New();
3798 // Register a Vector3 property
3799 Vector3 startValue(10.0f, 10.0f, 10.0f);
3800 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3801 Stage::GetCurrent().Add(actor);
3802 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3803 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
3805 // Build the animation
3806 float durationSeconds(2.0f);
3807 Animation animation = Animation::New(durationSeconds);
3808 Vector3 targetValue(60.0f, 60.0f, 60.0f);
3809 Vector3 relativeValue(targetValue - startValue);
3810 animation.AnimateBy(Property(actor, index), relativeValue);
3812 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3814 // Start the animation
3817 // Target value should be retrievable straight away
3818 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3820 bool signalReceived(false);
3821 AnimationFinishCheck finishCheck(signalReceived);
3822 animation.FinishedSignal().Connect(&application, finishCheck);
3824 application.SendNotification();
3825 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3827 // We didn't expect the animation to finish yet
3828 application.SendNotification();
3829 finishCheck.CheckSignalNotReceived();
3830 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
3832 application.SendNotification();
3833 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3835 // We did expect the animation to finish
3836 application.SendNotification();
3837 finishCheck.CheckSignalReceived();
3838 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3840 // Check that nothing has changed after a couple of buffer swaps
3841 application.Render(0);
3842 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3843 application.Render(0);
3844 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3848 int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void)
3850 TestApplication application;
3852 Actor actor = Actor::New();
3854 // Register a Vector3 property
3855 Vector3 startValue(100.0f, 100.0f, 100.0f);
3856 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3857 Stage::GetCurrent().Add(actor);
3858 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3859 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
3861 // Build the animation
3862 float durationSeconds(1.0f);
3863 Animation animation = Animation::New(durationSeconds);
3864 Vector3 targetValue(20.0f, 20.0f, 20.0f);
3865 Vector3 relativeValue(targetValue - startValue);
3866 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3868 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3870 // Start the animation
3873 bool signalReceived(false);
3874 AnimationFinishCheck finishCheck(signalReceived);
3875 animation.FinishedSignal().Connect(&application, finishCheck);
3877 application.SendNotification();
3878 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3880 // We didn't expect the animation to finish yet
3881 application.SendNotification();
3882 finishCheck.CheckSignalNotReceived();
3884 // The position should have moved more, than with a linear alpha function
3885 Vector3 current(DevelHandle::GetCurrentProperty< Vector3 >( actor, index ));
3886 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3887 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3888 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
3890 application.SendNotification();
3891 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3893 // We did expect the animation to finish
3894 application.SendNotification();
3895 finishCheck.CheckSignalReceived();
3896 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3898 // Check that nothing has changed after a couple of buffer swaps
3899 application.Render(0);
3900 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3901 application.Render(0);
3902 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3906 int UtcDaliAnimationAnimateByVector3TimePeriodP(void)
3908 TestApplication application;
3910 Actor actor = Actor::New();
3912 // Register a Vector3 property
3913 Vector3 startValue(10.0f, 10.0f, 10.0f);
3914 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3915 Stage::GetCurrent().Add(actor);
3916 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3917 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
3919 // Build the animation
3920 float durationSeconds(1.0f);
3921 Animation animation = Animation::New(durationSeconds);
3922 Vector3 targetValue(30.0f, 30.0f, 30.0f);
3923 Vector3 relativeValue(targetValue - startValue);
3925 animation.AnimateBy(Property(actor, index),
3927 TimePeriod(delay, durationSeconds - delay));
3929 // Start the animation
3932 bool signalReceived(false);
3933 AnimationFinishCheck finishCheck(signalReceived);
3934 animation.FinishedSignal().Connect(&application, finishCheck);
3936 application.SendNotification();
3937 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3939 // We didn't expect the animation to finish yet
3940 application.SendNotification();
3941 finishCheck.CheckSignalNotReceived();
3942 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
3944 application.SendNotification();
3945 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3947 // We didn't expect the animation to finish yet
3948 application.SendNotification();
3949 finishCheck.CheckSignalNotReceived();
3950 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3952 application.SendNotification();
3953 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3955 // We did expect the animation to finish
3956 application.SendNotification();
3957 finishCheck.CheckSignalReceived();
3958 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3960 // Check that nothing has changed after a couple of buffer swaps
3961 application.Render(0);
3962 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3963 application.Render(0);
3964 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3968 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void)
3970 TestApplication application;
3972 Actor actor = Actor::New();
3974 // Register a Vector3 property
3975 Vector3 startValue(5.0f, 5.0f, 5.0f);
3976 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3977 Stage::GetCurrent().Add(actor);
3978 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3979 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
3981 // Build the animation
3982 float durationSeconds(1.0f);
3983 Animation animation = Animation::New(durationSeconds);
3984 Vector3 targetValue(10.0f, 10.0f, 10.0f);
3985 Vector3 relativeValue(targetValue - startValue);
3987 animation.AnimateBy(Property(actor, index),
3989 AlphaFunction::LINEAR,
3990 TimePeriod(delay, durationSeconds - delay));
3992 // Start the animation
3995 bool signalReceived(false);
3996 AnimationFinishCheck finishCheck(signalReceived);
3997 animation.FinishedSignal().Connect(&application, finishCheck);
3999 application.SendNotification();
4000 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4002 // We didn't expect the animation to finish yet
4003 application.SendNotification();
4004 finishCheck.CheckSignalNotReceived();
4005 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
4007 application.SendNotification();
4008 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4010 // We didn't expect the animation to finish yet
4011 application.SendNotification();
4012 finishCheck.CheckSignalNotReceived();
4013 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4015 application.SendNotification();
4016 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4018 // We did expect the animation to finish
4019 application.SendNotification();
4020 finishCheck.CheckSignalReceived();
4021 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
4023 // Check that nothing has changed after a couple of buffer swaps
4024 application.Render(0);
4025 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
4026 application.Render(0);
4027 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
4031 int UtcDaliAnimationAnimateByVector4P(void)
4033 TestApplication application;
4035 Actor actor = Actor::New();
4037 // Register a Vector4 property
4038 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4039 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4040 Stage::GetCurrent().Add(actor);
4041 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4042 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
4044 // Build the animation
4045 float durationSeconds(2.0f);
4046 Animation animation = Animation::New(durationSeconds);
4047 Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f);
4048 Vector4 relativeValue(targetValue - startValue);
4049 animation.AnimateBy(Property(actor, index), relativeValue);
4051 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4053 // Start the animation
4056 // Target value should be retrievable straight away
4057 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4059 bool signalReceived(false);
4060 AnimationFinishCheck finishCheck(signalReceived);
4061 animation.FinishedSignal().Connect(&application, finishCheck);
4063 application.SendNotification();
4064 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4066 // We didn't expect the animation to finish yet
4067 application.SendNotification();
4068 finishCheck.CheckSignalNotReceived();
4069 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
4071 application.SendNotification();
4072 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4074 // We did expect the animation to finish
4075 application.SendNotification();
4076 finishCheck.CheckSignalReceived();
4077 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4079 // Check that nothing has changed after a couple of buffer swaps
4080 application.Render(0);
4081 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4082 application.Render(0);
4083 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4087 int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void)
4089 TestApplication application;
4091 Actor actor = Actor::New();
4093 // Register a Vector4 property
4094 Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f);
4095 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4096 Stage::GetCurrent().Add(actor);
4097 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4098 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
4100 // Build the animation
4101 float durationSeconds(1.0f);
4102 Animation animation = Animation::New(durationSeconds);
4103 Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
4104 Vector4 relativeValue(targetValue - startValue);
4105 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4107 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4109 // Start the animation
4112 bool signalReceived(false);
4113 AnimationFinishCheck finishCheck(signalReceived);
4114 animation.FinishedSignal().Connect(&application, finishCheck);
4116 application.SendNotification();
4117 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4119 // We didn't expect the animation to finish yet
4120 application.SendNotification();
4121 finishCheck.CheckSignalNotReceived();
4123 // The position should have moved more, than with a linear alpha function
4124 Vector4 current( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ) );
4125 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
4126 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
4127 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
4128 DALI_TEST_CHECK( current.w < ninetyFivePercentProgress.w );
4130 application.SendNotification();
4131 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4133 // We did expect the animation to finish
4134 application.SendNotification();
4135 finishCheck.CheckSignalReceived();
4136 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4138 // Check that nothing has changed after a couple of buffer swaps
4139 application.Render(0);
4140 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4141 application.Render(0);
4142 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4146 int UtcDaliAnimationAnimateByVector4TimePeriodP(void)
4148 TestApplication application;
4150 Actor actor = Actor::New();
4152 // Register a Vector4 property
4153 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4154 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4155 Stage::GetCurrent().Add(actor);
4156 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4157 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
4159 // Build the animation
4160 float durationSeconds(1.0f);
4161 Animation animation = Animation::New(durationSeconds);
4162 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
4163 Vector4 relativeValue(targetValue - startValue);
4165 animation.AnimateBy(Property(actor, index),
4167 TimePeriod(delay, durationSeconds - delay));
4169 // Start the animation
4172 bool signalReceived(false);
4173 AnimationFinishCheck finishCheck(signalReceived);
4174 animation.FinishedSignal().Connect(&application, finishCheck);
4176 application.SendNotification();
4177 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4179 // We didn't expect the animation to finish yet
4180 application.SendNotification();
4181 finishCheck.CheckSignalNotReceived();
4182 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
4184 application.SendNotification();
4185 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4187 // We didn't expect the animation to finish yet
4188 application.SendNotification();
4189 finishCheck.CheckSignalNotReceived();
4190 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4192 application.SendNotification();
4193 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4195 // We did expect the animation to finish
4196 application.SendNotification();
4197 finishCheck.CheckSignalReceived();
4198 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4200 // Check that nothing has changed after a couple of buffer swaps
4201 application.Render(0);
4202 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4203 application.Render(0);
4204 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4208 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void)
4210 TestApplication application;
4212 Actor actor = Actor::New();
4214 // Register a Vector4 property
4215 Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f);
4216 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4217 Stage::GetCurrent().Add(actor);
4218 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4219 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
4221 // Build the animation
4222 float durationSeconds(1.0f);
4223 Animation animation = Animation::New(durationSeconds);
4224 Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f);
4225 Vector4 relativeValue(targetValue - startValue);
4227 animation.AnimateBy(Property(actor, index),
4229 AlphaFunction::LINEAR,
4230 TimePeriod(delay, durationSeconds - delay));
4232 // Start the animation
4235 bool signalReceived(false);
4236 AnimationFinishCheck finishCheck(signalReceived);
4237 animation.FinishedSignal().Connect(&application, finishCheck);
4239 application.SendNotification();
4240 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4242 // We didn't expect the animation to finish yet
4243 application.SendNotification();
4244 finishCheck.CheckSignalNotReceived();
4245 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
4247 application.SendNotification();
4248 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4250 // We didn't expect the animation to finish yet
4251 application.SendNotification();
4252 finishCheck.CheckSignalNotReceived();
4253 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4255 application.SendNotification();
4256 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4258 // We did expect the animation to finish
4259 application.SendNotification();
4260 finishCheck.CheckSignalReceived();
4261 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4263 // Check that nothing has changed after a couple of buffer swaps
4264 application.Render(0);
4265 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4266 application.Render(0);
4267 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4271 int UtcDaliAnimationAnimateByActorPositionP(void)
4273 TestApplication application;
4275 Actor actor = Actor::New();
4276 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4277 actor.SetPosition(startPosition);
4278 Stage::GetCurrent().Add(actor);
4279 application.SendNotification();
4280 application.Render(0);
4281 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4283 // Build the animation
4284 float durationSeconds(1.0f);
4285 Animation animation = Animation::New(durationSeconds);
4286 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4287 Vector3 relativePosition(targetPosition - startPosition);
4288 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition);
4290 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4292 // Start the animation
4295 // Target value should be retrievable straight away
4296 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4298 bool signalReceived(false);
4299 AnimationFinishCheck finishCheck(signalReceived);
4300 animation.FinishedSignal().Connect(&application, finishCheck);
4302 application.SendNotification();
4303 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4305 // We didn't expect the animation to finish yet
4306 application.SendNotification();
4307 finishCheck.CheckSignalNotReceived();
4308 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ninetyFivePercentProgress, TEST_LOCATION );
4310 application.SendNotification();
4311 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4313 // We did expect the animation to finish
4314 application.SendNotification();
4315 finishCheck.CheckSignalReceived();
4316 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4318 // Check that nothing has changed after a couple of buffer swaps
4319 application.Render(0);
4320 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4321 application.Render(0);
4322 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4326 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
4328 TestApplication application;
4330 Actor actor = Actor::New();
4331 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4332 actor.SetPosition(startPosition);
4333 Stage::GetCurrent().Add(actor);
4334 application.SendNotification();
4335 application.Render(0);
4336 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4338 // Build the animation
4339 float durationSeconds(1.0f);
4340 Animation animation = Animation::New(durationSeconds);
4341 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4342 Vector3 relativePosition(targetPosition - startPosition);
4343 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
4345 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4347 // Start the animation
4350 bool signalReceived(false);
4351 AnimationFinishCheck finishCheck(signalReceived);
4352 animation.FinishedSignal().Connect(&application, finishCheck);
4354 application.SendNotification();
4355 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4357 // We didn't expect the animation to finish yet
4358 application.SendNotification();
4359 finishCheck.CheckSignalNotReceived();
4361 // The position should have moved more, than with a linear alpha function
4362 Vector3 current(actor.GetCurrentPosition());
4363 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
4364 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
4365 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
4367 application.SendNotification();
4368 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4370 // We did expect the animation to finish
4371 application.SendNotification();
4372 finishCheck.CheckSignalReceived();
4373 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4375 // Check that nothing has changed after a couple of buffer swaps
4376 application.Render(0);
4377 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4378 application.Render(0);
4379 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4383 int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void)
4385 TestApplication application;
4387 Actor actor = Actor::New();
4388 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4389 actor.SetPosition(startPosition);
4390 Stage::GetCurrent().Add(actor);
4391 application.SendNotification();
4392 application.Render(0);
4393 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4395 // Build the animation
4396 float durationSeconds(1.0f);
4397 Animation animation = Animation::New(durationSeconds);
4398 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4399 Vector3 relativePosition(targetPosition - startPosition);
4401 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4403 TimePeriod(delay, durationSeconds - delay));
4405 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4407 // Start the animation
4410 bool signalReceived(false);
4411 AnimationFinishCheck finishCheck(signalReceived);
4412 animation.FinishedSignal().Connect(&application, finishCheck);
4414 application.SendNotification();
4415 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4417 // We didn't expect the animation to finish yet
4418 application.SendNotification();
4419 finishCheck.CheckSignalNotReceived();
4420 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4422 application.SendNotification();
4423 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4425 // We did expect the animation to finish
4426 application.SendNotification();
4427 finishCheck.CheckSignalReceived();
4428 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4430 // Check that nothing has changed after a couple of buffer swaps
4431 application.Render(0);
4432 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4433 application.Render(0);
4434 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4438 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void)
4440 TestApplication application;
4442 Actor actor = Actor::New();
4443 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4444 actor.SetPosition(startPosition);
4445 Stage::GetCurrent().Add(actor);
4446 application.SendNotification();
4447 application.Render(0);
4448 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4450 // Build the animation
4451 float durationSeconds(1.0f);
4452 Animation animation = Animation::New(durationSeconds);
4453 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4454 Vector3 relativePosition(targetPosition - startPosition);
4456 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4458 AlphaFunction::LINEAR,
4459 TimePeriod(delay, durationSeconds - delay));
4461 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4463 // Start the animation
4466 bool signalReceived(false);
4467 AnimationFinishCheck finishCheck(signalReceived);
4468 animation.FinishedSignal().Connect(&application, finishCheck);
4470 application.SendNotification();
4471 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4473 // We didn't expect the animation to finish yet
4474 application.SendNotification();
4475 finishCheck.CheckSignalNotReceived();
4476 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4478 application.SendNotification();
4479 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4481 // We did expect the animation to finish
4482 application.SendNotification();
4483 finishCheck.CheckSignalReceived();
4484 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4486 // Check that nothing has changed after a couple of buffer swaps
4487 application.Render(0);
4488 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4489 application.Render(0);
4490 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4494 int UtcDaliAnimationAnimateByActorOrientationP1(void)
4496 TestApplication application;
4498 Actor actor = Actor::New();
4499 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4500 Stage::GetCurrent().Add(actor);
4501 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4503 // Build the animation
4504 float durationSeconds(1.0f);
4505 Animation animation = Animation::New(durationSeconds);
4506 Degree relativeRotationDegrees(360.0f);
4507 Radian relativeRotationRadians(relativeRotationDegrees);
4508 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ) );
4510 // Start the animation
4513 // Target value should be retrievable straight away
4514 DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::YAXIS), TEST_LOCATION );
4516 bool signalReceived(false);
4517 AnimationFinishCheck finishCheck(signalReceived);
4518 animation.FinishedSignal().Connect(&application, finishCheck);
4520 application.SendNotification();
4521 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4523 // We didn't expect the animation to finish yet
4524 application.SendNotification();
4525 finishCheck.CheckSignalNotReceived();
4526 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4528 application.SendNotification();
4529 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4531 // We didn't expect the animation to finish yet
4532 application.SendNotification();
4533 finishCheck.CheckSignalNotReceived();
4534 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4536 application.SendNotification();
4537 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4539 // We didn't expect the animation to finish yet
4540 application.SendNotification();
4541 finishCheck.CheckSignalNotReceived();
4542 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4544 application.SendNotification();
4545 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4547 // We did expect the animation to finish
4548 application.SendNotification();
4549 finishCheck.CheckSignalReceived();
4550 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4554 int UtcDaliAnimationAnimateByActorOrientationP2(void)
4556 TestApplication application;
4558 tet_printf("Testing that rotation angle > 360 performs full rotations\n");
4560 Actor actor = Actor::New();
4561 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
4562 Stage::GetCurrent().Add(actor);
4563 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4565 // Build the animation
4566 float durationSeconds(1.0f);
4567 Animation animation = Animation::New(durationSeconds);
4568 Degree relativeRotationDegrees(710.0f);
4569 Radian relativeRotationRadians(relativeRotationDegrees);
4571 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), AngleAxis( relativeRotationRadians, Vector3::ZAXIS ) );
4573 // Start the animation
4576 bool signalReceived(false);
4577 AnimationFinishCheck finishCheck(signalReceived);
4578 animation.FinishedSignal().Connect(&application, finishCheck);
4580 application.SendNotification();
4581 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4583 // We didn't expect the animation to finish yet
4584 application.SendNotification();
4585 finishCheck.CheckSignalNotReceived();
4586 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4588 application.SendNotification();
4589 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4591 // We didn't expect the animation to finish yet
4592 application.SendNotification();
4593 finishCheck.CheckSignalNotReceived();
4594 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4596 application.SendNotification();
4597 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4599 // We didn't expect the animation to finish yet
4600 application.SendNotification();
4601 finishCheck.CheckSignalNotReceived();
4602 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4604 application.SendNotification();
4605 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4607 // We did expect the animation to finish
4608 application.SendNotification();
4609 finishCheck.CheckSignalReceived();
4610 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4615 int UtcDaliAnimationAnimateByActorOrientationP3(void)
4617 TestApplication application;
4619 tet_printf("Testing that rotation angle > 360 performs partial rotations when cast to Quaternion\n");
4621 Actor actor = Actor::New();
4622 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
4623 Stage::GetCurrent().Add(actor);
4624 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4626 // Build the animation
4627 float durationSeconds(1.0f);
4628 Animation animation = Animation::New(durationSeconds);
4629 Degree relativeRotationDegrees(730.0f);
4630 Radian relativeRotationRadians(relativeRotationDegrees);
4632 Radian actualRotationRadians( Degree(10.0f) );
4634 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::ZAXIS ) );
4636 // Start the animation
4639 bool signalReceived(false);
4640 AnimationFinishCheck finishCheck(signalReceived);
4641 animation.FinishedSignal().Connect(&application, finishCheck);
4643 application.SendNotification();
4644 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4646 // We didn't expect the animation to finish yet
4647 application.SendNotification();
4648 finishCheck.CheckSignalNotReceived();
4649 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4651 application.SendNotification();
4652 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4654 // We didn't expect the animation to finish yet
4655 application.SendNotification();
4656 finishCheck.CheckSignalNotReceived();
4657 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4659 application.SendNotification();
4660 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4662 // We didn't expect the animation to finish yet
4663 application.SendNotification();
4664 finishCheck.CheckSignalNotReceived();
4665 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4667 application.SendNotification();
4668 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4670 // We did expect the animation to finish
4671 application.SendNotification();
4672 finishCheck.CheckSignalReceived();
4673 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4674 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4679 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
4681 TestApplication application;
4683 Actor actor = Actor::New();
4684 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4685 Stage::GetCurrent().Add(actor);
4686 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4688 // Build the animation
4689 float durationSeconds(1.0f);
4690 Animation animation = Animation::New(durationSeconds);
4691 Degree relativeRotationDegrees(360.0f);
4692 Radian relativeRotationRadians(relativeRotationDegrees);
4693 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ), AlphaFunction::EASE_IN );
4695 // Start the animation
4698 bool signalReceived(false);
4699 AnimationFinishCheck finishCheck(signalReceived);
4700 animation.FinishedSignal().Connect(&application, finishCheck);
4702 application.SendNotification();
4703 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4705 // We didn't expect the animation to finish yet
4706 application.SendNotification();
4707 finishCheck.CheckSignalNotReceived();
4708 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4710 application.SendNotification();
4711 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4713 // We didn't expect the animation to finish yet
4714 application.SendNotification();
4715 finishCheck.CheckSignalNotReceived();
4716 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4718 application.SendNotification();
4719 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4721 // We didn't expect the animation to finish yet
4722 application.SendNotification();
4723 finishCheck.CheckSignalNotReceived();
4724 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4726 application.SendNotification();
4727 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4729 // We did expect the animation to finish
4730 application.SendNotification();
4731 finishCheck.CheckSignalReceived();
4732 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4736 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void)
4738 TestApplication application;
4740 Actor actor = Actor::New();
4741 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4742 Stage::GetCurrent().Add(actor);
4743 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4745 // Build the animation
4746 float durationSeconds(1.0f);
4747 Animation animation = Animation::New(durationSeconds);
4748 Degree relativeRotationDegrees(360.0f);
4749 Radian relativeRotationRadians(relativeRotationDegrees);
4751 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ),
4752 AlphaFunction::EASE_IN, TimePeriod( delay, durationSeconds - delay ) );
4754 // Start the animation
4757 bool signalReceived(false);
4758 AnimationFinishCheck finishCheck(signalReceived);
4759 animation.FinishedSignal().Connect(&application, finishCheck);
4761 application.SendNotification();
4762 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4764 // We didn't expect the animation to finish yet
4765 application.SendNotification();
4766 finishCheck.CheckSignalNotReceived();
4767 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
4768 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4770 application.SendNotification();
4771 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4773 // We didn't expect the animation to finish yet
4774 application.SendNotification();
4775 finishCheck.CheckSignalNotReceived();
4776 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
4777 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4779 application.SendNotification();
4780 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4782 // We didn't expect the animation to finish yet
4783 application.SendNotification();
4784 finishCheck.CheckSignalNotReceived();
4785 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
4786 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4788 application.SendNotification();
4789 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4791 // We did expect the animation to finish
4792 application.SendNotification();
4793 finishCheck.CheckSignalReceived();
4794 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4798 int UtcDaliAnimationAnimateByActorScaleP(void)
4800 TestApplication application;
4802 Actor actor = Actor::New();
4803 Stage::GetCurrent().Add(actor);
4804 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4806 // Build the animation
4807 float durationSeconds(1.0f);
4808 Animation animation = Animation::New(durationSeconds);
4809 Vector3 targetScale(2.0f, 2.0f, 2.0f);
4810 Vector3 relativeScale(targetScale - Vector3::ONE);
4811 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), Vector3( relativeScale.x, relativeScale.y, relativeScale.z ) );
4813 Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale*0.99f);
4815 // Start the animation
4818 // Target value should be retrievable straight away
4819 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
4821 bool signalReceived(false);
4822 AnimationFinishCheck finishCheck(signalReceived);
4823 animation.FinishedSignal().Connect(&application, finishCheck);
4825 application.SendNotification();
4826 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4828 // We didn't expect the animation to finish yet
4829 application.SendNotification();
4830 finishCheck.CheckSignalNotReceived();
4831 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
4833 application.SendNotification();
4834 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4836 // We did expect the animation to finish
4837 application.SendNotification();
4838 finishCheck.CheckSignalReceived();
4839 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4842 finishCheck.Reset();
4843 actor.SetScale(Vector3::ONE);
4844 application.SendNotification();
4845 application.Render(0);
4846 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4848 // Repeat with a different (ease-in) alpha function
4849 animation = Animation::New(durationSeconds);
4850 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::EASE_IN );
4851 animation.FinishedSignal().Connect(&application, finishCheck);
4854 application.SendNotification();
4855 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4857 // We didn't expect the animation to finish yet
4858 application.SendNotification();
4859 finishCheck.CheckSignalNotReceived();
4861 // The scale should have grown less, than with a linear alpha function
4862 Vector3 current(actor.GetCurrentScale());
4863 DALI_TEST_CHECK( current.x > 1.0f );
4864 DALI_TEST_CHECK( current.y > 1.0f );
4865 DALI_TEST_CHECK( current.z > 1.0f );
4866 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
4867 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
4868 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
4870 application.SendNotification();
4871 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4873 // We did expect the animation to finish
4874 application.SendNotification();
4875 finishCheck.CheckSignalReceived();
4876 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4879 finishCheck.Reset();
4880 actor.SetScale(Vector3::ONE);
4881 application.SendNotification();
4882 application.Render(0);
4883 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4885 // Repeat with a delay
4887 animation = Animation::New(durationSeconds);
4888 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
4889 animation.FinishedSignal().Connect(&application, finishCheck);
4892 application.SendNotification();
4893 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4895 // We didn't expect the animation to finish yet
4896 application.SendNotification();
4897 finishCheck.CheckSignalNotReceived();
4898 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4900 application.SendNotification();
4901 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4903 // We did expect the animation to finish
4904 application.SendNotification();
4905 finishCheck.CheckSignalReceived();
4906 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4910 int UtcDaliAnimationAnimateToBooleanP(void)
4912 TestApplication application;
4914 Actor actor = Actor::New();
4916 // Register a boolean property
4917 const bool startValue(false);
4918 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4919 Stage::GetCurrent().Add(actor);
4920 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4921 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
4923 // Build the animation
4924 float durationSeconds(2.0f);
4925 Animation animation = Animation::New(durationSeconds);
4926 const bool targetValue( !startValue );
4927 animation.AnimateTo(Property(actor, index), targetValue);
4929 // Start the animation
4932 bool signalReceived(false);
4933 AnimationFinishCheck finishCheck(signalReceived);
4934 animation.FinishedSignal().Connect(&application, finishCheck);
4936 application.SendNotification();
4937 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4939 // We didn't expect the animation to finish yet
4940 application.SendNotification();
4941 finishCheck.CheckSignalNotReceived();
4942 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
4944 application.SendNotification();
4945 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4947 // We did expect the animation to finish
4948 application.SendNotification();
4949 finishCheck.CheckSignalReceived();
4950 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
4952 // Check that nothing has changed after a couple of buffer swaps
4953 application.Render(0);
4954 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
4955 application.Render(0);
4956 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
4958 // Repeat with target value "false"
4959 animation = Animation::New(durationSeconds);
4960 const bool finalValue( !targetValue );
4961 animation.AnimateTo(Property(actor, index), finalValue);
4963 // Start the animation
4966 finishCheck.Reset();
4967 animation.FinishedSignal().Connect(&application, finishCheck);
4969 application.SendNotification();
4970 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4972 // We didn't expect the animation to finish yet
4973 application.SendNotification();
4974 finishCheck.CheckSignalNotReceived();
4975 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
4977 application.SendNotification();
4978 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4980 // We did expect the animation to finish
4981 application.SendNotification();
4982 finishCheck.CheckSignalReceived();
4983 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
4985 // Check that nothing has changed after a couple of buffer swaps
4986 application.Render(0);
4987 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
4988 application.Render(0);
4989 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
4993 int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void)
4995 TestApplication application;
4997 Actor actor = Actor::New();
4999 // Register a boolean property
5000 const bool startValue(false);
5001 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5002 Stage::GetCurrent().Add(actor);
5003 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5004 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
5006 // Build the animation
5007 float durationSeconds(2.0f);
5008 Animation animation = Animation::New(durationSeconds);
5009 const bool targetValue( !startValue );
5010 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
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*950.0f)/* 95% progress */);
5022 // We didn't expect the animation to finish yet
5023 application.SendNotification();
5024 finishCheck.CheckSignalNotReceived();
5025 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
5027 application.SendNotification();
5028 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5030 // We did expect the animation to finish
5031 application.SendNotification();
5032 finishCheck.CheckSignalReceived();
5033 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
5035 // Check that nothing has changed after a couple of buffer swaps
5036 application.Render(0);
5037 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
5038 application.Render(0);
5039 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
5041 // Repeat with target value "false"
5042 animation = Animation::New(durationSeconds);
5043 const bool finalValue( !targetValue );
5044 animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
5046 // Start the animation
5049 finishCheck.Reset();
5050 animation.FinishedSignal().Connect(&application, finishCheck);
5052 application.SendNotification();
5053 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5055 // We didn't expect the animation to finish yet
5056 application.SendNotification();
5057 finishCheck.CheckSignalNotReceived();
5058 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
5060 application.SendNotification();
5061 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5063 // We did expect the animation to finish
5064 application.SendNotification();
5065 finishCheck.CheckSignalReceived();
5066 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5068 // Check that nothing has changed after a couple of buffer swaps
5069 application.Render(0);
5070 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5071 application.Render(0);
5072 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5076 int UtcDaliAnimationAnimateToBooleanTimePeriodP(void)
5078 TestApplication application;
5080 Actor actor = Actor::New();
5082 // Register a boolean property
5083 bool startValue(false);
5084 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5085 Stage::GetCurrent().Add(actor);
5086 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5087 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
5089 // Build the animation
5090 float durationSeconds(2.0f);
5091 Animation animation = Animation::New(durationSeconds);
5092 bool finalValue( !startValue );
5093 float animatorDurationSeconds(durationSeconds * 0.5f);
5094 animation.AnimateTo( Property(actor, index),
5096 TimePeriod( animatorDurationSeconds ) );
5098 // Start the animation
5101 bool signalReceived(false);
5102 AnimationFinishCheck finishCheck(signalReceived);
5103 animation.FinishedSignal().Connect(&application, finishCheck);
5105 application.SendNotification();
5106 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5108 // We didn't expect the animation to finish yet
5109 application.SendNotification();
5110 finishCheck.CheckSignalNotReceived();
5111 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
5113 application.SendNotification();
5114 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5116 // We didn't expect the animation to finish yet...
5117 application.SendNotification();
5118 finishCheck.CheckSignalNotReceived();
5120 // ...however we should have reached the final value
5121 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5123 application.SendNotification();
5124 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5126 // We did expect the animation to finish
5127 application.SendNotification();
5128 finishCheck.CheckSignalReceived();
5129 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5131 // Check that nothing has changed after a couple of buffer swaps
5132 application.Render(0);
5133 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5134 application.Render(0);
5135 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5139 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void)
5141 TestApplication application;
5143 Actor actor = Actor::New();
5145 // Register a boolean property
5146 bool startValue(false);
5147 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5148 Stage::GetCurrent().Add(actor);
5149 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5150 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
5152 // Build the animation
5153 float durationSeconds(2.0f);
5154 Animation animation = Animation::New(durationSeconds);
5155 bool finalValue( !startValue );
5156 float animatorDurationSeconds(durationSeconds * 0.5f);
5157 animation.AnimateTo( Property(actor, index),
5159 AlphaFunction::LINEAR,
5160 TimePeriod( animatorDurationSeconds ) );
5162 // Start the animation
5165 bool signalReceived(false);
5166 AnimationFinishCheck finishCheck(signalReceived);
5167 animation.FinishedSignal().Connect(&application, finishCheck);
5169 application.SendNotification();
5170 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5172 // We didn't expect the animation to finish yet
5173 application.SendNotification();
5174 finishCheck.CheckSignalNotReceived();
5175 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
5177 application.SendNotification();
5178 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5180 // We didn't expect the animation to finish yet...
5181 application.SendNotification();
5182 finishCheck.CheckSignalNotReceived();
5184 // ...however we should have reached the final value
5185 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5187 application.SendNotification();
5188 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5190 // We did expect the animation to finish
5191 application.SendNotification();
5192 finishCheck.CheckSignalReceived();
5193 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5195 // Check that nothing has changed after a couple of buffer swaps
5196 application.Render(0);
5197 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5198 application.Render(0);
5199 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5203 int UtcDaliAnimationAnimateToFloatP(void)
5205 TestApplication application;
5207 Actor actor = Actor::New();
5209 // Register a float property
5210 float startValue(10.0f);
5211 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5212 Stage::GetCurrent().Add(actor);
5213 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5214 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
5216 // Build the animation
5217 float durationSeconds(2.0f);
5218 Animation animation = Animation::New(durationSeconds);
5219 float targetValue(50.0f);
5220 float relativeValue(targetValue - startValue);
5221 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5223 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5225 // Start the animation
5228 bool signalReceived(false);
5229 AnimationFinishCheck finishCheck(signalReceived);
5230 animation.FinishedSignal().Connect(&application, finishCheck);
5232 application.SendNotification();
5233 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5235 // We didn't expect the animation to finish yet
5236 application.SendNotification();
5237 finishCheck.CheckSignalNotReceived();
5238 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
5240 application.SendNotification();
5241 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5243 // We did expect the animation to finish
5244 application.SendNotification();
5245 finishCheck.CheckSignalReceived();
5246 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
5250 int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void)
5252 TestApplication application;
5254 Actor actor = Actor::New();
5256 // Register a float property
5257 float startValue(10.0f);
5258 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5259 Stage::GetCurrent().Add(actor);
5260 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5261 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
5263 // Build the animation
5264 float durationSeconds(1.0f);
5265 Animation animation = Animation::New(durationSeconds);
5266 float targetValue(90.0f);
5267 float relativeValue(targetValue - startValue);
5268 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5270 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5272 // Start the animation
5275 bool signalReceived(false);
5276 AnimationFinishCheck finishCheck(signalReceived);
5277 animation.FinishedSignal().Connect(&application, finishCheck);
5279 application.SendNotification();
5280 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5282 // We didn't expect the animation to finish yet
5283 application.SendNotification();
5284 finishCheck.CheckSignalNotReceived();
5286 // The position should have moved more, than with a linear alpha function
5287 float current( DevelHandle::GetCurrentProperty< float >( actor, index ) );
5288 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
5290 application.SendNotification();
5291 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5293 // We did expect the animation to finish
5294 application.SendNotification();
5295 finishCheck.CheckSignalReceived();
5296 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
5300 int UtcDaliAnimationAnimateToFloatTimePeriodP(void)
5302 TestApplication application;
5304 Actor actor = Actor::New();
5306 // Register a float property
5307 float startValue(10.0f);
5308 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5309 Stage::GetCurrent().Add(actor);
5310 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5311 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
5313 // Build the animation
5314 float durationSeconds(1.0f);
5315 Animation animation = Animation::New(durationSeconds);
5316 float targetValue(30.0f);
5317 float relativeValue(targetValue - startValue);
5319 animation.AnimateTo(Property(actor, index),
5321 TimePeriod(delay, durationSeconds - delay));
5323 // Start the animation
5326 bool signalReceived(false);
5327 AnimationFinishCheck finishCheck(signalReceived);
5328 animation.FinishedSignal().Connect(&application, finishCheck);
5330 application.SendNotification();
5331 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5333 // We didn't expect the animation to finish yet
5334 application.SendNotification();
5335 finishCheck.CheckSignalNotReceived();
5336 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
5338 application.SendNotification();
5339 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5341 // We didn't expect the animation to finish yet
5342 application.SendNotification();
5343 finishCheck.CheckSignalNotReceived();
5344 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5346 application.SendNotification();
5347 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5349 // We did expect the animation to finish
5350 application.SendNotification();
5351 finishCheck.CheckSignalReceived();
5352 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
5356 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void)
5358 TestApplication application;
5360 Actor actor = Actor::New();
5362 // Register a float property
5363 float startValue(10.0f);
5364 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5365 Stage::GetCurrent().Add(actor);
5366 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5367 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
5369 // Build the animation
5370 float durationSeconds(1.0f);
5371 Animation animation = Animation::New(durationSeconds);
5372 float targetValue(30.0f);
5373 float relativeValue(targetValue - startValue);
5375 animation.AnimateTo(Property(actor, index),
5377 AlphaFunction::LINEAR,
5378 TimePeriod(delay, durationSeconds - delay));
5380 // Start the animation
5383 bool signalReceived(false);
5384 AnimationFinishCheck finishCheck(signalReceived);
5385 animation.FinishedSignal().Connect(&application, finishCheck);
5387 application.SendNotification();
5388 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5390 // We didn't expect the animation to finish yet
5391 application.SendNotification();
5392 finishCheck.CheckSignalNotReceived();
5393 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
5395 application.SendNotification();
5396 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5398 // We didn't expect the animation to finish yet
5399 application.SendNotification();
5400 finishCheck.CheckSignalNotReceived();
5401 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5403 application.SendNotification();
5404 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5406 // We did expect the animation to finish
5407 application.SendNotification();
5408 finishCheck.CheckSignalReceived();
5409 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
5413 int UtcDaliAnimationAnimateToIntegerP(void)
5415 TestApplication application;
5417 Actor actor = Actor::New();
5419 // Register an integer property
5421 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5422 Stage::GetCurrent().Add(actor);
5423 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5424 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
5426 // Build the animation
5427 float durationSeconds(2.0f);
5428 Animation animation = Animation::New(durationSeconds);
5429 int targetValue(50);
5430 int relativeValue(targetValue - startValue);
5431 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5433 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
5435 // Start the animation
5438 bool signalReceived(false);
5439 AnimationFinishCheck finishCheck(signalReceived);
5440 animation.FinishedSignal().Connect(&application, finishCheck);
5442 application.SendNotification();
5443 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5445 // We didn't expect the animation to finish yet
5446 application.SendNotification();
5447 finishCheck.CheckSignalNotReceived();
5448 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
5450 application.SendNotification();
5451 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5453 // We did expect the animation to finish
5454 application.SendNotification();
5455 finishCheck.CheckSignalReceived();
5456 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
5460 int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void)
5462 TestApplication application;
5464 Actor actor = Actor::New();
5466 // Register an integer property
5468 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5469 Stage::GetCurrent().Add(actor);
5470 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5471 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
5473 // Build the animation
5474 float durationSeconds(1.0f);
5475 Animation animation = Animation::New(durationSeconds);
5476 int targetValue(90);
5477 int relativeValue(targetValue - startValue);
5478 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5480 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
5482 // Start the animation
5485 bool signalReceived(false);
5486 AnimationFinishCheck finishCheck(signalReceived);
5487 animation.FinishedSignal().Connect(&application, finishCheck);
5489 application.SendNotification();
5490 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5492 // We didn't expect the animation to finish yet
5493 application.SendNotification();
5494 finishCheck.CheckSignalNotReceived();
5496 // The position should have moved more, than with a linear alpha function
5497 int current( DevelHandle::GetCurrentProperty< int >( actor, index ) );
5498 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
5500 application.SendNotification();
5501 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5503 // We did expect the animation to finish
5504 application.SendNotification();
5505 finishCheck.CheckSignalReceived();
5506 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
5510 int UtcDaliAnimationAnimateToIntegerTimePeriodP(void)
5512 TestApplication application;
5514 Actor actor = Actor::New();
5516 // Register an integer property
5518 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5519 Stage::GetCurrent().Add(actor);
5520 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5521 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
5523 // Build the animation
5524 float durationSeconds(1.0f);
5525 Animation animation = Animation::New(durationSeconds);
5526 int targetValue(30);
5527 int relativeValue(targetValue - startValue);
5529 animation.AnimateTo(Property(actor, index),
5531 TimePeriod(delay, durationSeconds - delay));
5533 // Start the animation
5536 bool signalReceived(false);
5537 AnimationFinishCheck finishCheck(signalReceived);
5538 animation.FinishedSignal().Connect(&application, finishCheck);
5540 application.SendNotification();
5541 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5543 // We didn't expect the animation to finish yet
5544 application.SendNotification();
5545 finishCheck.CheckSignalNotReceived();
5546 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
5548 application.SendNotification();
5549 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5551 // We didn't expect the animation to finish yet
5552 application.SendNotification();
5553 finishCheck.CheckSignalNotReceived();
5554 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
5556 application.SendNotification();
5557 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5559 // We did expect the animation to finish
5560 application.SendNotification();
5561 finishCheck.CheckSignalReceived();
5562 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
5566 int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void)
5568 TestApplication application;
5570 Actor actor = Actor::New();
5572 // Register an integer property
5574 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5575 Stage::GetCurrent().Add(actor);
5576 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5577 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
5579 // Build the animation
5580 float durationSeconds(1.0f);
5581 Animation animation = Animation::New(durationSeconds);
5582 int targetValue(30);
5583 int relativeValue(targetValue - startValue);
5585 animation.AnimateTo(Property(actor, index),
5587 AlphaFunction::LINEAR,
5588 TimePeriod(delay, durationSeconds - delay));
5590 // Start the animation
5593 bool signalReceived(false);
5594 AnimationFinishCheck finishCheck(signalReceived);
5595 animation.FinishedSignal().Connect(&application, finishCheck);
5597 application.SendNotification();
5598 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5600 // We didn't expect the animation to finish yet
5601 application.SendNotification();
5602 finishCheck.CheckSignalNotReceived();
5603 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
5605 application.SendNotification();
5606 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5608 // We didn't expect the animation to finish yet
5609 application.SendNotification();
5610 finishCheck.CheckSignalNotReceived();
5611 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
5613 application.SendNotification();
5614 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5616 // We did expect the animation to finish
5617 application.SendNotification();
5618 finishCheck.CheckSignalReceived();
5619 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
5623 int UtcDaliAnimationAnimateToVector2P(void)
5625 TestApplication application;
5627 Actor actor = Actor::New();
5629 // Register a Vector2 property
5630 Vector2 startValue(-50.0f, -50.0f);
5631 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5632 Stage::GetCurrent().Add(actor);
5633 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5634 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
5636 // Build the animation
5637 float durationSeconds(2.0f);
5638 Animation animation = Animation::New(durationSeconds);
5639 Vector2 targetValue(50.0f, 50.0f);
5640 Vector2 relativeValue(targetValue - startValue);
5641 animation.AnimateTo(Property(actor, index), targetValue);
5643 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5645 // Start the animation
5648 bool signalReceived(false);
5649 AnimationFinishCheck finishCheck(signalReceived);
5650 animation.FinishedSignal().Connect(&application, finishCheck);
5652 application.SendNotification();
5653 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5655 // We didn't expect the animation to finish yet
5656 application.SendNotification();
5657 finishCheck.CheckSignalNotReceived();
5658 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
5660 application.SendNotification();
5661 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5663 // We did expect the animation to finish
5664 application.SendNotification();
5665 finishCheck.CheckSignalReceived();
5666 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
5670 int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void)
5672 TestApplication application;
5674 Actor actor = Actor::New();
5676 // Register a Vector2 property
5677 Vector2 startValue(1000.0f, 1000.0f);
5678 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5679 Stage::GetCurrent().Add(actor);
5680 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5681 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
5683 // Build the animation
5684 float durationSeconds(1.0f);
5685 Animation animation = Animation::New(durationSeconds);
5686 Vector2 targetValue(9000.0f, 9000.0f);
5687 Vector2 relativeValue(targetValue - startValue);
5688 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
5690 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5692 // Start the animation
5695 bool signalReceived(false);
5696 AnimationFinishCheck finishCheck(signalReceived);
5697 animation.FinishedSignal().Connect(&application, finishCheck);
5699 application.SendNotification();
5700 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5702 // We didn't expect the animation to finish yet
5703 application.SendNotification();
5704 finishCheck.CheckSignalNotReceived();
5706 // The position should have moved more, than with a linear alpha function
5707 Vector2 current( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ) );
5708 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
5709 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
5711 application.SendNotification();
5712 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5714 // We did expect the animation to finish
5715 application.SendNotification();
5716 finishCheck.CheckSignalReceived();
5717 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
5721 int UtcDaliAnimationAnimateToVector2TimePeriodP(void)
5723 TestApplication application;
5725 Actor actor = Actor::New();
5727 // Register a Vector2 property
5728 Vector2 startValue(10.0f, 10.0f);
5729 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5730 Stage::GetCurrent().Add(actor);
5731 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5732 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
5734 // Build the animation
5735 float durationSeconds(1.0f);
5736 Animation animation = Animation::New(durationSeconds);
5737 Vector2 targetValue(-10.0f, 20.0f);
5738 Vector2 relativeValue(targetValue - startValue);
5740 animation.AnimateTo(Property(actor, index),
5742 TimePeriod(delay, durationSeconds - delay));
5744 // Start the animation
5747 bool signalReceived(false);
5748 AnimationFinishCheck finishCheck(signalReceived);
5749 animation.FinishedSignal().Connect(&application, finishCheck);
5751 application.SendNotification();
5752 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5754 // We didn't expect the animation to finish yet
5755 application.SendNotification();
5756 finishCheck.CheckSignalNotReceived();
5757 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
5759 application.SendNotification();
5760 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5762 // We didn't expect the animation to finish yet
5763 application.SendNotification();
5764 finishCheck.CheckSignalNotReceived();
5765 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5767 application.SendNotification();
5768 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5770 // We did expect the animation to finish
5771 application.SendNotification();
5772 finishCheck.CheckSignalReceived();
5773 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
5777 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void)
5779 TestApplication application;
5781 Actor actor = Actor::New();
5783 // Register a Vector2 property
5784 Vector2 startValue(10.0f, 10.0f);
5785 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5786 Stage::GetCurrent().Add(actor);
5787 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5788 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
5790 // Build the animation
5791 float durationSeconds(1.0f);
5792 Animation animation = Animation::New(durationSeconds);
5793 Vector2 targetValue(30.0f, 30.0f);
5794 Vector2 relativeValue(targetValue - startValue);
5796 animation.AnimateTo(Property(actor, index),
5798 AlphaFunction::LINEAR,
5799 TimePeriod(delay, durationSeconds - delay));
5801 // Start the animation
5804 bool signalReceived(false);
5805 AnimationFinishCheck finishCheck(signalReceived);
5806 animation.FinishedSignal().Connect(&application, finishCheck);
5808 application.SendNotification();
5809 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5811 // We didn't expect the animation to finish yet, but cached value should be the final one
5812 application.SendNotification();
5813 finishCheck.CheckSignalNotReceived();
5814 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
5815 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty<Vector2>( actor, index ), startValue, TEST_LOCATION );
5817 application.SendNotification();
5818 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5820 // We didn't expect the animation to finish yet
5821 application.SendNotification();
5822 finishCheck.CheckSignalNotReceived();
5823 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5825 application.SendNotification();
5826 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5828 // We did expect the animation to finish
5829 application.SendNotification();
5830 finishCheck.CheckSignalReceived();
5831 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
5832 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
5836 int UtcDaliAnimationAnimateToVector3P(void)
5838 TestApplication application;
5840 Actor actor = Actor::New();
5842 // Register a Vector3 property
5843 Vector3 startValue(-50.0f, -50.0f, -50.0f);
5844 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5845 Stage::GetCurrent().Add(actor);
5846 DALI_TEST_EQUALS( actor.GetProperty<Vector3>( index ), startValue, TEST_LOCATION );
5847 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
5849 // Build the animation
5850 float durationSeconds(2.0f);
5851 Animation animation = Animation::New(durationSeconds);
5852 Vector3 targetValue(50.0f, 50.0f, 50.0f);
5853 Vector3 relativeValue(targetValue - startValue);
5854 animation.AnimateTo(Property(actor, index), targetValue);
5856 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5858 // Start the animation
5861 bool signalReceived(false);
5862 AnimationFinishCheck finishCheck(signalReceived);
5863 animation.FinishedSignal().Connect(&application, finishCheck);
5865 application.SendNotification();
5866 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5868 // We didn't expect the animation to finish yet
5869 application.SendNotification();
5870 finishCheck.CheckSignalNotReceived();
5871 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
5873 application.SendNotification();
5874 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5876 // We did expect the animation to finish
5877 application.SendNotification();
5878 finishCheck.CheckSignalReceived();
5879 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
5883 int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void)
5885 TestApplication application;
5887 Actor actor = Actor::New();
5889 // Register a Vector3 property
5890 Vector3 startValue(1000.0f, 1000.0f, 1000.0f);
5891 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5892 Stage::GetCurrent().Add(actor);
5893 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5894 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
5896 // Build the animation
5897 float durationSeconds(1.0f);
5898 Animation animation = Animation::New(durationSeconds);
5899 Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
5900 Vector3 relativeValue(targetValue - startValue);
5901 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5903 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
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*950.0f)/* 95% progress */);
5915 // We didn't expect the animation to finish yet
5916 application.SendNotification();
5917 finishCheck.CheckSignalNotReceived();
5919 // The position should have moved more, than with a linear alpha function
5920 Vector3 current( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ) );
5921 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
5922 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
5923 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
5925 application.SendNotification();
5926 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5928 // We did expect the animation to finish
5929 application.SendNotification();
5930 finishCheck.CheckSignalReceived();
5931 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
5935 int UtcDaliAnimationAnimateToVector3TimePeriodP(void)
5937 TestApplication application;
5939 Actor actor = Actor::New();
5941 // Register a Vector3 property
5942 Vector3 startValue(10.0f, 10.0f, 10.0f);
5943 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5944 Stage::GetCurrent().Add(actor);
5945 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5946 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
5948 // Build the animation
5949 float durationSeconds(1.0f);
5950 Animation animation = Animation::New(durationSeconds);
5951 Vector3 targetValue(-10.0f, 20.0f, 100.0f);
5952 Vector3 relativeValue(targetValue - startValue);
5954 animation.AnimateTo(Property(actor, index),
5956 TimePeriod(delay, durationSeconds - delay));
5958 // Start the animation
5961 bool signalReceived(false);
5962 AnimationFinishCheck finishCheck(signalReceived);
5963 animation.FinishedSignal().Connect(&application, finishCheck);
5965 application.SendNotification();
5966 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5968 // We didn't expect the animation to finish yet
5969 application.SendNotification();
5970 finishCheck.CheckSignalNotReceived();
5971 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
5973 application.SendNotification();
5974 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5976 // We didn't expect the animation to finish yet
5977 application.SendNotification();
5978 finishCheck.CheckSignalNotReceived();
5979 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5981 application.SendNotification();
5982 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5984 // We did expect the animation to finish
5985 application.SendNotification();
5986 finishCheck.CheckSignalReceived();
5987 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
5991 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void)
5993 TestApplication application;
5995 Actor actor = Actor::New();
5997 // Register a Vector3 property
5998 Vector3 startValue(10.0f, 10.0f, 10.0f);
5999 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6000 Stage::GetCurrent().Add(actor);
6001 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6002 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
6004 // Build the animation
6005 float durationSeconds(1.0f);
6006 Animation animation = Animation::New(durationSeconds);
6007 Vector3 targetValue(30.0f, 30.0f, 30.0f);
6008 Vector3 relativeValue(targetValue - startValue);
6010 animation.AnimateTo(Property(actor, "testProperty"),
6012 AlphaFunction::LINEAR,
6013 TimePeriod(delay, durationSeconds - delay));
6015 // Start the animation
6018 bool signalReceived(false);
6019 AnimationFinishCheck finishCheck(signalReceived);
6020 animation.FinishedSignal().Connect(&application, finishCheck);
6022 application.SendNotification();
6023 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6025 // We didn't expect the animation to finish yet
6026 application.SendNotification();
6027 finishCheck.CheckSignalNotReceived();
6028 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
6030 application.SendNotification();
6031 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6033 // We didn't expect the animation to finish yet
6034 application.SendNotification();
6035 finishCheck.CheckSignalNotReceived();
6036 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6038 application.SendNotification();
6039 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6041 // We did expect the animation to finish
6042 application.SendNotification();
6043 finishCheck.CheckSignalReceived();
6044 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
6048 int UtcDaliAnimationAnimateToVector3ComponentP(void)
6050 TestApplication application;
6052 Actor actor = Actor::New();
6054 // Register a Vector3 property
6055 Vector3 startValue(10.0f, 10.0f, 10.0f);
6056 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6057 Stage::GetCurrent().Add(actor);
6058 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6059 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
6061 // Build the animation
6062 float durationSeconds(1.0f);
6063 Animation animation = Animation::New(durationSeconds);
6064 Vector3 targetValue(30.0f, 30.0f, 10.0f);
6065 Vector3 relativeValue(targetValue - startValue);
6067 animation.AnimateTo(Property(actor, "testProperty", 0),
6069 AlphaFunction::LINEAR,
6070 TimePeriod(delay, durationSeconds - delay));
6071 animation.AnimateTo(Property(actor, index, 1),
6073 AlphaFunction::LINEAR,
6074 TimePeriod(delay, durationSeconds - delay));
6076 // Start the animation
6079 bool signalReceived(false);
6080 AnimationFinishCheck finishCheck(signalReceived);
6081 animation.FinishedSignal().Connect(&application, finishCheck);
6083 application.SendNotification();
6084 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6086 // We didn't expect the animation to finish yet
6087 application.SendNotification();
6088 finishCheck.CheckSignalNotReceived();
6089 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
6091 application.SendNotification();
6092 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6094 // We didn't expect the animation to finish yet
6095 application.SendNotification();
6096 finishCheck.CheckSignalNotReceived();
6097 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6099 application.SendNotification();
6100 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6102 // We did expect the animation to finish
6103 application.SendNotification();
6104 finishCheck.CheckSignalReceived();
6105 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
6109 int UtcDaliAnimationAnimateToVector4P(void)
6111 TestApplication application;
6113 Actor actor = Actor::New();
6115 // Register a Vector4 property
6116 Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f);
6117 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6118 Stage::GetCurrent().Add(actor);
6119 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6120 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
6122 // Build the animation
6123 float durationSeconds(2.0f);
6124 Animation animation = Animation::New(durationSeconds);
6125 Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f);
6126 Vector4 relativeValue(targetValue - startValue);
6127 animation.AnimateTo(Property(actor, index), targetValue);
6129 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6131 // Start the animation
6134 bool signalReceived(false);
6135 AnimationFinishCheck finishCheck(signalReceived);
6136 animation.FinishedSignal().Connect(&application, finishCheck);
6138 application.SendNotification();
6139 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6141 // We didn't expect the animation to finish yet
6142 application.SendNotification();
6143 finishCheck.CheckSignalNotReceived();
6144 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
6146 application.SendNotification();
6147 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6149 // We did expect the animation to finish
6150 application.SendNotification();
6151 finishCheck.CheckSignalReceived();
6152 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
6156 int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void)
6158 TestApplication application;
6160 Actor actor = Actor::New();
6162 // Register a Vector4 property
6163 Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
6164 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6165 Stage::GetCurrent().Add(actor);
6166 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6167 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
6169 // Build the animation
6170 float durationSeconds(1.0f);
6171 Animation animation = Animation::New(durationSeconds);
6172 Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
6173 Vector4 relativeValue(targetValue - startValue);
6174 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6176 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6178 // Start the animation
6181 bool signalReceived(false);
6182 AnimationFinishCheck finishCheck(signalReceived);
6183 animation.FinishedSignal().Connect(&application, finishCheck);
6185 application.SendNotification();
6186 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6188 // We didn't expect the animation to finish yet
6189 application.SendNotification();
6190 finishCheck.CheckSignalNotReceived();
6192 // The position should have moved more, than with a linear alpha function
6193 Vector4 current( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ) );
6194 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6195 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6196 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
6197 DALI_TEST_CHECK( current.w > ninetyFivePercentProgress.w );
6199 application.SendNotification();
6200 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6202 // We did expect the animation to finish
6203 application.SendNotification();
6204 finishCheck.CheckSignalReceived();
6205 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
6209 int UtcDaliAnimationAnimateToVector4TimePeriodP(void)
6211 TestApplication application;
6213 Actor actor = Actor::New();
6215 // Register a Vector4 property
6216 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6217 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6218 Stage::GetCurrent().Add(actor);
6219 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6220 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6222 // Build the animation
6223 float durationSeconds(1.0f);
6224 Animation animation = Animation::New(durationSeconds);
6225 Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
6226 Vector4 relativeValue(targetValue - startValue);
6228 animation.AnimateTo(Property(actor, index),
6230 TimePeriod(delay, durationSeconds - delay));
6232 // Start the animation
6235 bool signalReceived(false);
6236 AnimationFinishCheck finishCheck(signalReceived);
6237 animation.FinishedSignal().Connect(&application, finishCheck);
6239 application.SendNotification();
6240 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6242 // We didn't expect the animation to finish yet
6243 application.SendNotification();
6244 finishCheck.CheckSignalNotReceived();
6245 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6247 application.SendNotification();
6248 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6250 // We didn't expect the animation to finish yet
6251 application.SendNotification();
6252 finishCheck.CheckSignalNotReceived();
6253 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue+(relativeValue*0.5f), VECTOR4_EPSILON, TEST_LOCATION );
6255 application.SendNotification();
6256 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6258 // We did expect the animation to finish
6259 application.SendNotification();
6260 finishCheck.CheckSignalReceived();
6261 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, VECTOR4_EPSILON, TEST_LOCATION );
6265 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void)
6267 TestApplication application;
6269 Actor actor = Actor::New();
6271 // Register a Vector4 property
6272 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6273 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6274 Stage::GetCurrent().Add(actor);
6275 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6276 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
6278 // Build the animation
6279 float durationSeconds(1.0f);
6280 Animation animation = Animation::New(durationSeconds);
6281 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
6282 Vector4 relativeValue(targetValue - startValue);
6284 animation.AnimateTo(Property(actor, index),
6286 AlphaFunction::LINEAR,
6287 TimePeriod(delay, durationSeconds - delay));
6289 // Start the animation
6292 bool signalReceived(false);
6293 AnimationFinishCheck finishCheck(signalReceived);
6294 animation.FinishedSignal().Connect(&application, finishCheck);
6296 application.SendNotification();
6297 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6299 // We didn't expect the animation to finish yet
6300 application.SendNotification();
6301 finishCheck.CheckSignalNotReceived();
6302 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
6304 application.SendNotification();
6305 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6307 // We didn't expect the animation to finish yet
6308 application.SendNotification();
6309 finishCheck.CheckSignalNotReceived();
6310 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6312 application.SendNotification();
6313 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6315 // We did expect the animation to finish
6316 application.SendNotification();
6317 finishCheck.CheckSignalReceived();
6318 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
6322 int UtcDaliAnimationAnimateToActorParentOriginP(void)
6324 TestApplication application;
6326 Actor actor = Actor::New();
6327 Stage::GetCurrent().Add(actor);
6328 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_LEFT, TEST_LOCATION );
6330 // Build the animation
6331 float durationSeconds(1.0f);
6332 Animation animation = Animation::New(durationSeconds);
6333 Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
6337 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin );
6339 catch (Dali::DaliException& e)
6341 DALI_TEST_PRINT_ASSERT( e );
6342 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6347 int UtcDaliAnimationAnimateToActorParentOriginXP(void)
6349 TestApplication application;
6351 Actor actor = Actor::New();
6352 Stage::GetCurrent().Add(actor);
6353 float startValue(0.0f);
6354 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().x, startValue, TEST_LOCATION );
6355 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION );
6357 // Build the animation
6358 float durationSeconds(1.0f);
6359 Animation animation = Animation::New(durationSeconds);
6360 float targetX(1.0f);
6364 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX );
6366 catch (Dali::DaliException& e)
6368 DALI_TEST_PRINT_ASSERT( e );
6369 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6374 int UtcDaliAnimationAnimateToActorParentOriginYP(void)
6376 TestApplication application;
6378 Actor actor = Actor::New();
6379 Stage::GetCurrent().Add(actor);
6380 float startValue(0.0f);
6381 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().y, startValue, TEST_LOCATION );
6382 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION );
6384 // Build the animation
6385 float durationSeconds(1.0f);
6386 Animation animation = Animation::New(durationSeconds);
6387 float targetY(1.0f);
6391 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY );
6393 catch (Dali::DaliException& e)
6395 DALI_TEST_PRINT_ASSERT( e );
6396 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6401 int UtcDaliAnimationAnimateToActorParentOriginZP(void)
6403 TestApplication application;
6405 Actor actor = Actor::New();
6406 Stage::GetCurrent().Add(actor);
6407 float startValue(0.5f);
6408 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().z, startValue, TEST_LOCATION );
6409 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION );
6411 // Build the animation
6412 float durationSeconds(1.0f);
6413 Animation animation = Animation::New(durationSeconds);
6414 float targetZ(1.0f);
6418 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ );
6420 catch (Dali::DaliException& e)
6422 DALI_TEST_PRINT_ASSERT( e );
6423 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6428 int UtcDaliAnimationAnimateToActorAnchorPointP(void)
6430 TestApplication application;
6432 Actor actor = Actor::New();
6433 Stage::GetCurrent().Add(actor);
6434 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), AnchorPoint::CENTER, TEST_LOCATION );
6436 // Build the animation
6437 float durationSeconds(1.0f);
6438 Animation animation = Animation::New(durationSeconds);
6439 Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT);
6443 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
6445 catch (Dali::DaliException& e)
6447 DALI_TEST_PRINT_ASSERT( e );
6448 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6453 int UtcDaliAnimationAnimateToActorAnchorPointXP(void)
6455 TestApplication application;
6457 Actor actor = Actor::New();
6458 Stage::GetCurrent().Add(actor);
6459 float startValue(0.5f);
6460 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().x, startValue, TEST_LOCATION );
6461 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION );
6463 // Build the animation
6464 float durationSeconds(1.0f);
6465 Animation animation = Animation::New(durationSeconds);
6466 float targetX(1.0f);
6470 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_X), targetX );
6472 catch (Dali::DaliException& e)
6474 DALI_TEST_PRINT_ASSERT( e );
6475 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6480 int UtcDaliAnimationAnimateToActorAnchorPointYP(void)
6482 TestApplication application;
6484 Actor actor = Actor::New();
6485 Stage::GetCurrent().Add(actor);
6486 float startValue(0.5f);
6487 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().y, startValue, TEST_LOCATION );
6488 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION );
6490 // Build the animation
6491 float durationSeconds(1.0f);
6492 Animation animation = Animation::New(durationSeconds);
6493 float targetY(0.0f);
6497 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY );
6499 catch (Dali::DaliException& e)
6501 DALI_TEST_PRINT_ASSERT( e );
6502 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6507 int UtcDaliAnimationAnimateToActorAnchorPointZP(void)
6509 TestApplication application;
6511 Actor actor = Actor::New();
6512 Stage::GetCurrent().Add(actor);
6513 float startValue(0.5f);
6514 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().z, startValue, TEST_LOCATION );
6515 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION );
6517 // Build the animation
6518 float durationSeconds(1.0f);
6519 Animation animation = Animation::New(durationSeconds);
6520 float targetZ(100.0f);
6524 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ );
6526 catch (Dali::DaliException& e)
6528 DALI_TEST_PRINT_ASSERT( e );
6529 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6534 int UtcDaliAnimationAnimateToActorSizeP(void)
6536 TestApplication application;
6538 Actor actor = Actor::New();
6539 Stage::GetCurrent().Add(actor);
6540 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6542 // Build the animation
6543 float durationSeconds(1.0f);
6544 Animation animation = Animation::New(durationSeconds);
6545 Vector3 targetSize(100.0f, 100.0f, 100.0f);
6546 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize );
6548 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
6550 // Should return the initial properties before play
6551 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
6552 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), 0.0f, TEST_LOCATION );
6553 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), 0.0f, TEST_LOCATION );
6554 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), 0.0f, TEST_LOCATION );
6556 // Start the animation
6559 // Should return the target property after play
6560 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
6561 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
6562 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
6563 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
6565 bool signalReceived(false);
6566 AnimationFinishCheck finishCheck(signalReceived);
6567 animation.FinishedSignal().Connect(&application, finishCheck);
6569 application.SendNotification();
6570 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6572 // We didn't expect the animation to finish yet
6573 application.SendNotification();
6574 finishCheck.CheckSignalNotReceived();
6575 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
6577 application.SendNotification();
6578 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6580 // We did expect the animation to finish
6581 application.SendNotification();
6582 finishCheck.CheckSignalReceived();
6583 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6586 finishCheck.Reset();
6587 actor.SetSize(Vector3::ZERO);
6588 application.SendNotification();
6589 application.Render(0);
6590 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6592 // Repeat with a different (ease-in) alpha function
6593 animation = Animation::New(durationSeconds);
6594 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
6595 animation.FinishedSignal().Connect(&application, finishCheck);
6598 application.SendNotification();
6599 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6601 // We didn't expect the animation to finish yet
6602 application.SendNotification();
6603 finishCheck.CheckSignalNotReceived();
6605 // The size should have travelled less, than with a linear alpha function
6606 Vector3 current(actor.GetCurrentSize());
6607 DALI_TEST_CHECK( current.x > 0.0f );
6608 DALI_TEST_CHECK( current.y > 0.0f );
6609 DALI_TEST_CHECK( current.z > 0.0f );
6610 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
6611 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
6612 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
6614 application.SendNotification();
6615 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6617 // We did expect the animation to finish
6618 application.SendNotification();
6619 finishCheck.CheckSignalReceived();
6620 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6623 finishCheck.Reset();
6624 actor.SetSize(Vector3::ZERO);
6625 application.SendNotification();
6626 application.Render(0);
6627 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6629 // Repeat with a delay
6631 animation = Animation::New(durationSeconds);
6632 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
6633 animation.FinishedSignal().Connect(&application, finishCheck);
6636 application.SendNotification();
6637 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6639 // We didn't expect the animation to finish yet
6640 application.SendNotification();
6641 finishCheck.CheckSignalNotReceived();
6642 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6644 application.SendNotification();
6645 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6647 // We did expect the animation to finish
6648 application.SendNotification();
6649 finishCheck.CheckSignalReceived();
6650 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6654 int UtcDaliAnimationAnimateToActorSizeWidthP(void)
6656 TestApplication application;
6658 Actor actor = Actor::New();
6659 Stage::GetCurrent().Add(actor);
6660 float startValue(0.0f);
6661 DALI_TEST_EQUALS( actor.GetCurrentSize().width, startValue, TEST_LOCATION );
6662 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION );
6664 // Build the animation
6665 float durationSeconds(1.0f);
6666 Animation animation = Animation::New(durationSeconds);
6667 float targetWidth(10.0f);
6668 animation.AnimateTo( Property(actor, Actor::Property::SIZE_WIDTH), targetWidth );
6670 float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f);
6672 // Should return the initial properties before play
6673 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
6674 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), startValue, TEST_LOCATION );
6676 // Start the animation
6679 // Should return the target property after play
6680 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( targetWidth, 0.0f, 0.0f ), TEST_LOCATION );
6681 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetWidth, TEST_LOCATION );
6683 bool signalReceived(false);
6684 AnimationFinishCheck finishCheck(signalReceived);
6685 animation.FinishedSignal().Connect(&application, finishCheck);
6687 application.SendNotification();
6688 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6690 // We didn't expect the animation to finish yet
6691 application.SendNotification();
6692 finishCheck.CheckSignalNotReceived();
6693 DALI_TEST_EQUALS( actor.GetCurrentSize().width, fiftyPercentProgress, TEST_LOCATION );
6695 application.SendNotification();
6696 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6698 // We did expect the animation to finish
6699 application.SendNotification();
6700 finishCheck.CheckSignalReceived();
6701 DALI_TEST_EQUALS( actor.GetCurrentSize().width, targetWidth, TEST_LOCATION );
6702 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION );
6706 int UtcDaliAnimationAnimateToActorSizeHeightP(void)
6708 TestApplication application;
6710 Actor actor = Actor::New();
6711 Stage::GetCurrent().Add(actor);
6712 float startValue(0.0f);
6713 DALI_TEST_EQUALS( actor.GetCurrentSize().height, startValue, TEST_LOCATION );
6714 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION );
6716 // Build the animation
6717 float durationSeconds(1.0f);
6718 Animation animation = Animation::New(durationSeconds);
6719 float targetHeight(-10.0f);
6720 animation.AnimateTo( Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight );
6722 float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f);
6724 // Should return the initial properties before play
6725 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
6726 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), startValue, TEST_LOCATION );
6728 // Start the animation
6731 // Should return the target property after play
6732 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, targetHeight, 0.0f ), TEST_LOCATION );
6733 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetHeight, TEST_LOCATION );
6735 bool signalReceived(false);
6736 AnimationFinishCheck finishCheck(signalReceived);
6737 animation.FinishedSignal().Connect(&application, finishCheck);
6739 application.SendNotification();
6740 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6742 // We didn't expect the animation to finish yet
6743 application.SendNotification();
6744 finishCheck.CheckSignalNotReceived();
6745 DALI_TEST_EQUALS( actor.GetCurrentSize().height, fiftyPercentProgress, TEST_LOCATION );
6747 application.SendNotification();
6748 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6750 // We did expect the animation to finish
6751 application.SendNotification();
6752 finishCheck.CheckSignalReceived();
6753 DALI_TEST_EQUALS( actor.GetCurrentSize().height, targetHeight, TEST_LOCATION );
6754 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION );
6758 int UtcDaliAnimationAnimateToActorSizeDepthP(void)
6760 TestApplication application;
6762 Actor actor = Actor::New();
6763 Stage::GetCurrent().Add(actor);
6764 float startValue(0.0f);
6765 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, startValue, TEST_LOCATION );
6766 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION );
6768 // Build the animation
6769 float durationSeconds(1.0f);
6770 Animation animation = Animation::New(durationSeconds);
6771 float targetDepth(-10.0f);
6772 animation.AnimateTo( Property(actor, Actor::Property::SIZE_DEPTH), targetDepth );
6774 float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f);
6776 // Should return the initial properties before play
6777 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
6778 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), startValue, TEST_LOCATION );
6780 // Start the animation
6783 // Should return the target property after play
6784 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, 0.0f, targetDepth ), TEST_LOCATION );
6785 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetDepth, TEST_LOCATION );
6787 bool signalReceived(false);
6788 AnimationFinishCheck finishCheck(signalReceived);
6789 animation.FinishedSignal().Connect(&application, finishCheck);
6791 application.SendNotification();
6792 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6794 // We didn't expect the animation to finish yet
6795 application.SendNotification();
6796 finishCheck.CheckSignalNotReceived();
6797 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, fiftyPercentProgress, TEST_LOCATION );
6799 application.SendNotification();
6800 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6802 // We did expect the animation to finish
6803 application.SendNotification();
6804 finishCheck.CheckSignalReceived();
6805 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, targetDepth, TEST_LOCATION );
6806 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION );
6810 int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void)
6812 TestApplication application;
6814 Actor actor = Actor::New();
6815 Stage::GetCurrent().Add(actor);
6816 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6818 // Build the animation
6819 float durationSeconds(1.0f);
6820 Animation animation = Animation::New(durationSeconds);
6821 Vector3 targetSize(100.0f, 100.0f, 100.0f);
6822 animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetSize );
6824 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
6826 // Start the animation
6829 bool signalReceived(false);
6830 AnimationFinishCheck finishCheck(signalReceived);
6831 animation.FinishedSignal().Connect(&application, finishCheck);
6833 application.SendNotification();
6834 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6836 // We didn't expect the animation to finish yet
6837 application.SendNotification();
6838 finishCheck.CheckSignalNotReceived();
6839 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
6841 application.SendNotification();
6842 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6844 // We did expect the animation to finish
6845 application.SendNotification();
6846 finishCheck.CheckSignalReceived();
6847 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6850 finishCheck.Reset();
6851 actor.SetSize(Vector3::ZERO);
6852 application.SendNotification();
6853 application.Render(0);
6854 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6856 // Repeat with a different (ease-in) alpha function
6857 animation = Animation::New(durationSeconds);
6858 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::EASE_IN );
6859 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::EASE_IN );
6860 animation.FinishedSignal().Connect(&application, finishCheck);
6863 application.SendNotification();
6864 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6866 // We didn't expect the animation to finish yet
6867 application.SendNotification();
6868 finishCheck.CheckSignalNotReceived();
6870 // The size should have travelled less, than with a linear alpha function
6871 Vector3 current(actor.GetCurrentSize());
6872 DALI_TEST_CHECK( current.x > 0.0f );
6873 DALI_TEST_CHECK( current.y > 0.0f );
6874 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
6875 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
6877 application.SendNotification();
6878 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6880 // We did expect the animation to finish
6881 application.SendNotification();
6882 finishCheck.CheckSignalReceived();
6883 DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
6884 DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
6887 finishCheck.Reset();
6888 actor.SetSize(Vector3::ZERO);
6889 application.SendNotification();
6890 application.Render(0);
6891 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6893 // Repeat with a delay
6895 animation = Animation::New(durationSeconds);
6896 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
6897 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
6898 animation.FinishedSignal().Connect(&application, finishCheck);
6901 application.SendNotification();
6902 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6904 // We didn't expect the animation to finish yet
6905 application.SendNotification();
6906 finishCheck.CheckSignalNotReceived();
6907 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6909 application.SendNotification();
6910 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6912 // We did expect the animation to finish
6913 application.SendNotification();
6914 finishCheck.CheckSignalReceived();
6915 DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
6916 DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
6920 int UtcDaliAnimationAnimateToActorPositionP(void)
6922 TestApplication application;
6924 Actor actor = Actor::New();
6925 Stage::GetCurrent().Add(actor);
6926 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6928 // Build the animation
6929 float durationSeconds(1.0f);
6930 Animation animation = Animation::New(durationSeconds);
6931 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6932 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
6934 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6936 // Should return the initial properties before play
6937 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
6938 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
6939 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), 0.0f, TEST_LOCATION );
6940 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), 0.0f, TEST_LOCATION );
6942 // Start the animation
6945 // Should return the target property after play
6946 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
6947 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetPosition.x, TEST_LOCATION );
6948 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetPosition.y, TEST_LOCATION );
6949 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetPosition.z, TEST_LOCATION );
6951 bool signalReceived(false);
6952 AnimationFinishCheck finishCheck(signalReceived);
6953 animation.FinishedSignal().Connect(&application, finishCheck);
6955 application.SendNotification();
6956 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
6958 // We didn't expect the animation to finish yet
6959 application.SendNotification();
6960 finishCheck.CheckSignalNotReceived();
6961 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
6963 application.SendNotification();
6964 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6966 // We did expect the animation to finish
6967 application.SendNotification();
6968 finishCheck.CheckSignalReceived();
6969 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6973 int UtcDaliAnimationAnimateToActorPositionXP(void)
6975 TestApplication application;
6977 Actor actor = Actor::New();
6978 Stage::GetCurrent().Add(actor);
6979 float startValue(0.0f);
6980 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, startValue, TEST_LOCATION );
6981 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6982 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6983 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6985 // Build the animation
6986 float durationSeconds(1.0f);
6987 Animation animation = Animation::New(durationSeconds);
6988 float targetX(1.0f);
6989 animation.AnimateTo( Property(actor, Actor::Property::POSITION_X), targetX );
6991 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
6993 // Should return the initial properties before play
6994 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
6995 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), startValue, TEST_LOCATION );
6997 // Start the animation
7000 // Should return the target property after play
7001 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( targetX, 0.0f, 0.0f ), TEST_LOCATION );
7002 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetX, TEST_LOCATION );
7004 bool signalReceived(false);
7005 AnimationFinishCheck finishCheck(signalReceived);
7006 animation.FinishedSignal().Connect(&application, finishCheck);
7008 application.SendNotification();
7009 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7011 // We didn't expect the animation to finish yet
7012 application.SendNotification();
7013 finishCheck.CheckSignalNotReceived();
7014 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, fiftyPercentProgress, TEST_LOCATION );
7016 application.SendNotification();
7017 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7019 // We did expect the animation to finish
7020 application.SendNotification();
7021 finishCheck.CheckSignalReceived();
7022 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, targetX, TEST_LOCATION );
7023 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION );
7024 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7025 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7029 int UtcDaliAnimationAnimateToActorPositionYP(void)
7031 TestApplication application;
7033 Actor actor = Actor::New();
7034 Stage::GetCurrent().Add(actor);
7035 float startValue(0.0f);
7036 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, startValue, TEST_LOCATION );
7037 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7038 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7039 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7041 // Build the animation
7042 float durationSeconds(1.0f);
7043 Animation animation = Animation::New(durationSeconds);
7044 float targetY(10.0f);
7045 animation.AnimateTo( Property(actor, Actor::Property::POSITION_Y), targetY );
7047 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
7049 // Should return the initial properties before play
7050 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7051 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), startValue, TEST_LOCATION );
7053 // Start the animation
7056 // Should return the target property after play
7057 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, targetY, 0.0f ), TEST_LOCATION );
7058 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetY, TEST_LOCATION );
7060 bool signalReceived(false);
7061 AnimationFinishCheck finishCheck(signalReceived);
7062 animation.FinishedSignal().Connect(&application, finishCheck);
7064 application.SendNotification();
7065 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7067 // We didn't expect the animation to finish yet
7068 application.SendNotification();
7069 finishCheck.CheckSignalNotReceived();
7070 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, fiftyPercentProgress, TEST_LOCATION );
7072 application.SendNotification();
7073 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7075 // We did expect the animation to finish
7076 application.SendNotification();
7077 finishCheck.CheckSignalReceived();
7078 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, targetY, TEST_LOCATION );
7079 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7080 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION );
7081 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7085 int UtcDaliAnimationAnimateToActorPositionZP(void)
7087 TestApplication application;
7089 Actor actor = Actor::New();
7090 Stage::GetCurrent().Add(actor);
7091 float startValue(0.0f);
7092 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, startValue, TEST_LOCATION );
7093 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7094 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7095 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7097 // Build the animation
7098 float durationSeconds(1.0f);
7099 Animation animation = Animation::New(durationSeconds);
7100 float targetZ(-5.0f);
7101 animation.AnimateTo( Property(actor, Actor::Property::POSITION_Z), targetZ );
7103 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
7105 // Should return the initial properties before play
7106 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7107 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), startValue, TEST_LOCATION );
7109 // Start the animation
7112 // Should return the target property after play
7113 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, targetZ ), TEST_LOCATION );
7114 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetZ, TEST_LOCATION );
7116 bool signalReceived(false);
7117 AnimationFinishCheck finishCheck(signalReceived);
7118 animation.FinishedSignal().Connect(&application, finishCheck);
7120 application.SendNotification();
7121 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7123 // We didn't expect the animation to finish yet
7124 application.SendNotification();
7125 finishCheck.CheckSignalNotReceived();
7126 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, fiftyPercentProgress, TEST_LOCATION );
7128 application.SendNotification();
7129 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7131 // We did expect the animation to finish
7132 application.SendNotification();
7133 finishCheck.CheckSignalReceived();
7134 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, targetZ, TEST_LOCATION );
7135 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7136 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7137 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION );
7141 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void)
7143 TestApplication application;
7145 Actor actor = Actor::New();
7146 Stage::GetCurrent().Add(actor);
7147 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7149 // Build the animation
7150 float durationSeconds(1.0f);
7151 Animation animation = Animation::New(durationSeconds);
7152 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7153 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
7155 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7157 // Start the animation
7160 bool signalReceived(false);
7161 AnimationFinishCheck finishCheck(signalReceived);
7162 animation.FinishedSignal().Connect(&application, finishCheck);
7164 application.SendNotification();
7165 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
7167 // We didn't expect the animation to finish yet
7168 application.SendNotification();
7169 finishCheck.CheckSignalNotReceived();
7171 // The position should have moved less, than with a linear alpha function
7172 Vector3 current(actor.GetCurrentPosition());
7173 DALI_TEST_CHECK( current.x > Vector3::ZERO.x );
7174 DALI_TEST_CHECK( current.y > Vector3::ZERO.y );
7175 DALI_TEST_CHECK( current.z > Vector3::ZERO.z );
7176 DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x );
7177 DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y );
7178 DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z );
7180 application.SendNotification();
7181 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7183 // We did expect the animation to finish
7184 application.SendNotification();
7185 finishCheck.CheckSignalReceived();
7186 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7190 int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void)
7192 TestApplication application;
7194 Actor actor = Actor::New();
7195 Stage::GetCurrent().Add(actor);
7196 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7198 // Build the animation
7199 float durationSeconds(1.0f);
7200 Animation animation = Animation::New(durationSeconds);
7201 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7203 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7205 TimePeriod( delay, durationSeconds - delay ) );
7207 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7209 // Start the animation
7212 bool signalReceived(false);
7213 AnimationFinishCheck finishCheck(signalReceived);
7214 animation.FinishedSignal().Connect(&application, finishCheck);
7216 application.SendNotification();
7217 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7219 // We didn't expect the animation to finish yet
7220 application.SendNotification();
7221 finishCheck.CheckSignalNotReceived();
7222 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7224 application.SendNotification();
7225 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7227 // We didn't expect the animation to finish yet
7228 application.SendNotification();
7229 finishCheck.CheckSignalNotReceived();
7230 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7232 application.SendNotification();
7233 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7235 // We did expect the animation to finish
7236 application.SendNotification();
7237 finishCheck.CheckSignalReceived();
7238 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7242 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void)
7244 TestApplication application;
7246 Actor actor = Actor::New();
7247 Stage::GetCurrent().Add(actor);
7248 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7250 // Build the animation
7251 float durationSeconds(1.0f);
7252 Animation animation = Animation::New(durationSeconds);
7253 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7255 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7257 AlphaFunction::LINEAR,
7258 TimePeriod( delay, durationSeconds - delay ) );
7260 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7262 // Start the animation
7265 bool signalReceived(false);
7266 AnimationFinishCheck finishCheck(signalReceived);
7267 animation.FinishedSignal().Connect(&application, finishCheck);
7269 application.SendNotification();
7270 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7272 // We didn't expect the animation to finish yet
7273 application.SendNotification();
7274 finishCheck.CheckSignalNotReceived();
7275 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7277 application.SendNotification();
7278 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7280 // We didn't expect the animation to finish yet
7281 application.SendNotification();
7282 finishCheck.CheckSignalNotReceived();
7283 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7285 application.SendNotification();
7286 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7288 // We did expect the animation to finish
7289 application.SendNotification();
7290 finishCheck.CheckSignalReceived();
7291 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7295 int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void)
7297 TestApplication application;
7299 Actor actor = Actor::New();
7300 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7301 Stage::GetCurrent().Add(actor);
7302 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7304 // Build the animation
7305 float durationSeconds(1.0f);
7306 Animation animation = Animation::New(durationSeconds);
7307 Degree targetRotationDegrees(90.0f);
7308 Radian targetRotationRadians(targetRotationDegrees);
7309 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS) );
7311 // Start the animation
7314 // Target value should be retrievable straight away
7315 DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7317 bool signalReceived(false);
7318 AnimationFinishCheck finishCheck(signalReceived);
7319 animation.FinishedSignal().Connect(&application, finishCheck);
7321 application.SendNotification();
7322 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7324 // We didn't expect the animation to finish yet
7325 application.SendNotification();
7326 finishCheck.CheckSignalNotReceived();
7327 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7329 application.SendNotification();
7330 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7332 // We didn't expect the animation to finish yet
7333 application.SendNotification();
7334 finishCheck.CheckSignalNotReceived();
7335 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7337 application.SendNotification();
7338 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7340 // We didn't expect the animation to finish yet
7341 application.SendNotification();
7342 finishCheck.CheckSignalNotReceived();
7343 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7345 application.SendNotification();
7346 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7348 // We did expect the animation to finish
7349 application.SendNotification();
7350 finishCheck.CheckSignalReceived();
7351 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7355 int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void)
7357 TestApplication application;
7359 Actor actor = Actor::New();
7360 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7361 Stage::GetCurrent().Add(actor);
7362 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7364 // Build the animation
7365 float durationSeconds(1.0f);
7366 Animation animation = Animation::New(durationSeconds);
7367 Degree targetRotationDegrees(90.0f);
7368 Radian targetRotationRadians(targetRotationDegrees);
7369 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
7370 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), targetRotation );
7372 // Start the animation
7375 bool signalReceived(false);
7376 AnimationFinishCheck finishCheck(signalReceived);
7377 animation.FinishedSignal().Connect(&application, finishCheck);
7379 application.SendNotification();
7380 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7382 // We didn't expect the animation to finish yet
7383 application.SendNotification();
7384 finishCheck.CheckSignalNotReceived();
7385 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7387 application.SendNotification();
7388 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7390 // We didn't expect the animation to finish yet
7391 application.SendNotification();
7392 finishCheck.CheckSignalNotReceived();
7393 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7395 application.SendNotification();
7396 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7398 // We didn't expect the animation to finish yet
7399 application.SendNotification();
7400 finishCheck.CheckSignalNotReceived();
7401 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7403 application.SendNotification();
7404 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7406 // We did expect the animation to finish
7407 application.SendNotification();
7408 finishCheck.CheckSignalReceived();
7409 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7413 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void)
7415 TestApplication application;
7417 Actor actor = Actor::New();
7418 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7419 Stage::GetCurrent().Add(actor);
7420 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7422 // Build the animation
7423 float durationSeconds(1.0f);
7424 Animation animation = Animation::New(durationSeconds);
7425 Degree targetRotationDegrees(90.0f);
7426 Radian targetRotationRadians(targetRotationDegrees);
7427 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
7429 // Start the animation
7432 bool signalReceived(false);
7433 AnimationFinishCheck finishCheck(signalReceived);
7434 animation.FinishedSignal().Connect(&application, finishCheck);
7436 application.SendNotification();
7437 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7439 // We didn't expect the animation to finish yet
7440 application.SendNotification();
7441 finishCheck.CheckSignalNotReceived();
7442 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7444 application.SendNotification();
7445 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7447 // We didn't expect the animation to finish yet
7448 application.SendNotification();
7449 finishCheck.CheckSignalNotReceived();
7450 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7452 application.SendNotification();
7453 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7455 // We didn't expect the animation to finish yet
7456 application.SendNotification();
7457 finishCheck.CheckSignalNotReceived();
7458 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7460 application.SendNotification();
7461 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7463 // We did expect the animation to finish
7464 application.SendNotification();
7465 finishCheck.CheckSignalReceived();
7466 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7470 int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void)
7472 TestApplication application;
7474 Actor actor = Actor::New();
7475 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7476 Stage::GetCurrent().Add(actor);
7477 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7479 // Build the animation
7480 float durationSeconds(1.0f);
7481 Animation animation = Animation::New(durationSeconds);
7482 Degree targetRotationDegrees(90.0f);
7483 Radian targetRotationRadians(targetRotationDegrees);
7485 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
7487 // Start the animation
7490 bool signalReceived(false);
7491 AnimationFinishCheck finishCheck(signalReceived);
7492 animation.FinishedSignal().Connect(&application, finishCheck);
7494 application.SendNotification();
7495 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7497 // We didn't expect the animation to finish yet
7498 application.SendNotification();
7499 finishCheck.CheckSignalNotReceived();
7500 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7501 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7503 application.SendNotification();
7504 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7506 // We didn't expect the animation to finish yet
7507 application.SendNotification();
7508 finishCheck.CheckSignalNotReceived();
7509 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7510 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7512 application.SendNotification();
7513 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7515 // We didn't expect the animation to finish yet
7516 application.SendNotification();
7517 finishCheck.CheckSignalNotReceived();
7518 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7519 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7521 application.SendNotification();
7522 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7524 // We did expect the animation to finish
7525 application.SendNotification();
7526 finishCheck.CheckSignalReceived();
7527 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7531 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void)
7533 TestApplication application;
7535 Actor actor = Actor::New();
7536 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7537 Stage::GetCurrent().Add(actor);
7538 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7540 // Build the animation
7541 float durationSeconds(1.0f);
7542 Animation animation = Animation::New(durationSeconds);
7543 Degree targetRotationDegrees(90.0f);
7544 Radian targetRotationRadians(targetRotationDegrees);
7546 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
7548 // Start the animation
7551 bool signalReceived(false);
7552 AnimationFinishCheck finishCheck(signalReceived);
7553 animation.FinishedSignal().Connect(&application, finishCheck);
7555 application.SendNotification();
7556 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7558 // We didn't expect the animation to finish yet
7559 application.SendNotification();
7560 finishCheck.CheckSignalNotReceived();
7561 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7562 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7564 application.SendNotification();
7565 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7567 // We didn't expect the animation to finish yet
7568 application.SendNotification();
7569 finishCheck.CheckSignalNotReceived();
7570 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7571 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7573 application.SendNotification();
7574 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7576 // We didn't expect the animation to finish yet
7577 application.SendNotification();
7578 finishCheck.CheckSignalNotReceived();
7579 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7580 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7582 application.SendNotification();
7583 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7585 // We did expect the animation to finish
7586 application.SendNotification();
7587 finishCheck.CheckSignalReceived();
7588 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7592 int UtcDaliAnimationAnimateToActorScaleP(void)
7594 TestApplication application;
7596 Actor actor = Actor::New();
7597 Stage::GetCurrent().Add(actor);
7598 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7600 // Build the animation
7601 float durationSeconds(1.0f);
7602 Animation animation = Animation::New(durationSeconds);
7603 Vector3 targetScale(2.0f, 2.0f, 2.0f);
7604 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale );
7606 Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f);
7608 // Start the animation
7611 // Target value should be retrievable straight away
7612 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
7613 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetScale.x, TEST_LOCATION );
7614 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetScale.y, TEST_LOCATION );
7615 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetScale.z, TEST_LOCATION );
7617 bool signalReceived(false);
7618 AnimationFinishCheck finishCheck(signalReceived);
7619 animation.FinishedSignal().Connect(&application, finishCheck);
7621 application.SendNotification();
7622 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7624 // We didn't expect the animation to finish yet
7625 application.SendNotification();
7626 finishCheck.CheckSignalNotReceived();
7627 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
7629 application.SendNotification();
7630 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7632 // We did expect the animation to finish
7633 application.SendNotification();
7634 finishCheck.CheckSignalReceived();
7635 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7638 finishCheck.Reset();
7639 actor.SetScale(Vector3::ONE);
7640 application.SendNotification();
7641 application.Render(0);
7642 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7644 // Repeat with a different (ease-in) alpha function
7645 animation = Animation::New(durationSeconds);
7646 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
7647 animation.FinishedSignal().Connect(&application, finishCheck);
7650 application.SendNotification();
7651 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7653 // We didn't expect the animation to finish yet
7654 application.SendNotification();
7655 finishCheck.CheckSignalNotReceived();
7657 // The scale should have grown less, than with a linear alpha function
7658 Vector3 current(actor.GetCurrentScale());
7659 DALI_TEST_CHECK( current.x > 1.0f );
7660 DALI_TEST_CHECK( current.y > 1.0f );
7661 DALI_TEST_CHECK( current.z > 1.0f );
7662 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
7663 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
7664 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
7666 application.SendNotification();
7667 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7669 // We did expect the animation to finish
7670 application.SendNotification();
7671 finishCheck.CheckSignalReceived();
7672 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7675 finishCheck.Reset();
7676 actor.SetScale(Vector3::ONE);
7677 application.SendNotification();
7678 application.Render(0);
7679 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7681 // Repeat with a delay
7683 animation = Animation::New(durationSeconds);
7684 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7685 animation.FinishedSignal().Connect(&application, finishCheck);
7688 application.SendNotification();
7689 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7691 // We didn't expect the animation to finish yet
7692 application.SendNotification();
7693 finishCheck.CheckSignalNotReceived();
7694 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7696 application.SendNotification();
7697 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7699 // We did expect the animation to finish
7700 application.SendNotification();
7701 finishCheck.CheckSignalReceived();
7702 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7706 int UtcDaliAnimationAnimateToActorScaleXP(void)
7708 TestApplication application;
7710 Actor actor = Actor::New();
7711 Stage::GetCurrent().Add(actor);
7712 float startValue(1.0f);
7713 DALI_TEST_EQUALS( actor.GetCurrentScale().x, startValue, TEST_LOCATION );
7714 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7715 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7716 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7717 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7718 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7719 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7721 // Build the animation
7722 float durationSeconds(1.0f);
7723 Animation animation = Animation::New(durationSeconds);
7724 float targetX(10.0f);
7725 animation.AnimateTo( Property(actor, Actor::Property::SCALE_X), targetX );
7727 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
7729 // Start the animation
7732 // Target value should be retrievable straight away
7733 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( targetX, startValue, startValue ), TEST_LOCATION );
7734 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetX, TEST_LOCATION );
7736 bool signalReceived(false);
7737 AnimationFinishCheck finishCheck(signalReceived);
7738 animation.FinishedSignal().Connect(&application, finishCheck);
7740 application.SendNotification();
7741 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7743 // We didn't expect the animation to finish yet
7744 application.SendNotification();
7745 finishCheck.CheckSignalNotReceived();
7746 DALI_TEST_EQUALS( actor.GetCurrentScale().x, fiftyPercentProgress, TEST_LOCATION );
7747 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), fiftyPercentProgress, TEST_LOCATION );
7748 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7749 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7751 application.SendNotification();
7752 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7754 // We did expect the animation to finish
7755 application.SendNotification();
7756 finishCheck.CheckSignalReceived();
7757 DALI_TEST_EQUALS( actor.GetCurrentScale().x, targetX, TEST_LOCATION );
7758 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), targetX, TEST_LOCATION );
7759 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7760 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7764 int UtcDaliAnimationAnimateToActorScaleYP(void)
7766 TestApplication application;
7768 Actor actor = Actor::New();
7769 Stage::GetCurrent().Add(actor);
7770 float startValue(1.0f);
7771 DALI_TEST_EQUALS( actor.GetCurrentScale().y, startValue, TEST_LOCATION );
7772 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7773 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7774 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7775 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7776 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7777 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7779 // Build the animation
7780 float durationSeconds(1.0f);
7781 Animation animation = Animation::New(durationSeconds);
7782 float targetY(1000.0f);
7783 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Y), targetY );
7785 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
7787 // Start the animation
7790 // Target value should be retrievable straight away
7791 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, targetY, startValue ), TEST_LOCATION );
7792 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetY, TEST_LOCATION );
7794 bool signalReceived(false);
7795 AnimationFinishCheck finishCheck(signalReceived);
7796 animation.FinishedSignal().Connect(&application, finishCheck);
7798 application.SendNotification();
7799 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7801 // We didn't expect the animation to finish yet
7802 application.SendNotification();
7803 finishCheck.CheckSignalNotReceived();
7804 DALI_TEST_EQUALS( actor.GetCurrentScale().y, fiftyPercentProgress, TEST_LOCATION );
7805 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7806 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), fiftyPercentProgress, TEST_LOCATION );
7807 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7809 application.SendNotification();
7810 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7812 // We did expect the animation to finish
7813 application.SendNotification();
7814 finishCheck.CheckSignalReceived();
7815 DALI_TEST_EQUALS( actor.GetCurrentScale().y, targetY, TEST_LOCATION );
7816 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7817 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), targetY, TEST_LOCATION );
7818 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7822 int UtcDaliAnimationAnimateToActorScaleZP(void)
7824 TestApplication application;
7826 Actor actor = Actor::New();
7827 Stage::GetCurrent().Add(actor);
7828 float startValue(1.0f);
7829 DALI_TEST_EQUALS( actor.GetCurrentScale().z, startValue, TEST_LOCATION );
7830 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7831 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7832 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7833 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7834 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7835 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7837 // Build the animation
7838 float durationSeconds(1.0f);
7839 Animation animation = Animation::New(durationSeconds);
7840 float targetZ(-1000.0f);
7841 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Z), targetZ );
7843 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
7845 // Start the animation
7848 // Target value should be retrievable straight away
7849 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, startValue, targetZ ), TEST_LOCATION );
7850 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION );
7852 bool signalReceived(false);
7853 AnimationFinishCheck finishCheck(signalReceived);
7854 animation.FinishedSignal().Connect(&application, finishCheck);
7856 application.SendNotification();
7857 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7859 // We didn't expect the animation to finish yet
7860 application.SendNotification();
7861 finishCheck.CheckSignalNotReceived();
7862 DALI_TEST_EQUALS( actor.GetCurrentScale().z, fiftyPercentProgress, TEST_LOCATION );
7863 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7864 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7865 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), fiftyPercentProgress, TEST_LOCATION );
7867 application.SendNotification();
7868 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7870 // We did expect the animation to finish
7871 application.SendNotification();
7872 finishCheck.CheckSignalReceived();
7873 DALI_TEST_EQUALS( actor.GetCurrentScale().z, targetZ, TEST_LOCATION );
7874 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7875 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7876 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION );
7880 int UtcDaliAnimationAnimateToActorColorP(void)
7882 TestApplication application;
7884 Actor actor = Actor::New();
7885 Stage::GetCurrent().Add(actor);
7886 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7888 // Build the animation
7889 float durationSeconds(1.0f);
7890 Animation animation = Animation::New(durationSeconds);
7891 Vector4 targetColor(Color::RED);
7892 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor );
7894 Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
7895 Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
7897 // Start the animation
7900 // Target value should be retrievable straight away
7901 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
7902 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
7903 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
7904 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
7905 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
7906 DALI_TEST_EQUALS( actor.GetProperty< float >( DevelActor::Property::OPACITY ), targetColor.a, TEST_LOCATION );
7908 bool signalReceived(false);
7909 AnimationFinishCheck finishCheck(signalReceived);
7910 animation.FinishedSignal().Connect(&application, finishCheck);
7912 application.SendNotification();
7913 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7915 // We didn't expect the animation to finish yet
7916 application.SendNotification();
7917 finishCheck.CheckSignalNotReceived();
7918 DALI_TEST_EQUALS( actor.GetCurrentColor(), tenPercentProgress, TEST_LOCATION );
7920 application.SendNotification();
7921 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7923 // We did expect the animation to finish
7924 application.SendNotification();
7925 finishCheck.CheckSignalReceived();
7926 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7929 finishCheck.Reset();
7930 actor.SetColor(Color::WHITE);
7931 application.SendNotification();
7932 application.Render(0);
7933 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7935 // Repeat with a different (ease-in) alpha function
7936 animation = Animation::New(durationSeconds);
7937 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
7938 animation.FinishedSignal().Connect(&application, finishCheck);
7941 application.SendNotification();
7942 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7944 // We didn't expect the animation to finish yet
7945 application.SendNotification();
7946 finishCheck.CheckSignalNotReceived();
7948 // The color should have changed less, than with a linear alpha function
7949 Vector4 current(actor.GetCurrentColor());
7950 DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change
7951 DALI_TEST_CHECK( current.y < 1.0f );
7952 DALI_TEST_CHECK( current.y > tenPercentProgress.y );
7953 DALI_TEST_CHECK( current.z < 1.0f );
7954 DALI_TEST_CHECK( current.z > tenPercentProgress.z );
7955 DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
7957 application.SendNotification();
7958 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7960 // We did expect the animation to finish
7961 application.SendNotification();
7962 finishCheck.CheckSignalReceived();
7963 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7966 finishCheck.Reset();
7967 actor.SetColor(Color::WHITE);
7968 application.SendNotification();
7969 application.Render(0);
7970 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7972 // Repeat with a shorter animator duration
7973 float animatorDuration = 0.5f;
7974 animation = Animation::New(durationSeconds);
7975 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
7976 animation.FinishedSignal().Connect(&application, finishCheck);
7979 application.SendNotification();
7980 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
7982 // We didn't expect the animation to finish yet
7983 application.SendNotification();
7984 finishCheck.CheckSignalNotReceived();
7985 DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION );
7987 application.SendNotification();
7988 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
7990 // We didn't expect the animation to finish yet
7991 application.SendNotification();
7992 finishCheck.CheckSignalNotReceived();
7993 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7995 application.SendNotification();
7996 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7998 // We did expect the animation to finish
7999 application.SendNotification();
8000 finishCheck.CheckSignalReceived();
8001 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8005 int UtcDaliAnimationAnimateToActorColorRedP(void)
8007 TestApplication application;
8009 Actor actor = Actor::New();
8010 Stage::GetCurrent().Add(actor);
8011 float startValue(1.0f);
8012 DALI_TEST_EQUALS( actor.GetCurrentColor().r, startValue, TEST_LOCATION );
8013 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8014 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8015 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8016 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8017 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8018 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8019 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8020 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8022 // Build the animation
8023 float durationSeconds(1.0f);
8024 Animation animation = Animation::New(durationSeconds);
8025 float targetRed(0.5f);
8026 animation.AnimateTo( Property(actor, Actor::Property::COLOR_RED), targetRed );
8028 float fiftyPercentProgress(startValue + (targetRed - startValue)*0.5f);
8030 // Start the animation
8033 // Target value should be retrievable straight away
8034 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( targetRed, startValue, startValue, startValue ), TEST_LOCATION );
8035 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetRed, TEST_LOCATION );
8037 bool signalReceived(false);
8038 AnimationFinishCheck finishCheck(signalReceived);
8039 animation.FinishedSignal().Connect(&application, finishCheck);
8041 application.SendNotification();
8042 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8044 // We didn't expect the animation to finish yet
8045 application.SendNotification();
8046 finishCheck.CheckSignalNotReceived();
8047 DALI_TEST_EQUALS( actor.GetCurrentColor().r, fiftyPercentProgress, TEST_LOCATION );
8048 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION );
8049 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8050 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8051 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8053 application.SendNotification();
8054 application.Render(static_cast<unsigned int>(durationSeconds*500.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.GetCurrentColor().r, targetRed, TEST_LOCATION );
8060 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED), targetRed, TEST_LOCATION );
8061 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8062 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8063 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8067 int UtcDaliAnimationAnimateToActorColorGreenP(void)
8069 TestApplication application;
8071 Actor actor = Actor::New();
8072 Stage::GetCurrent().Add(actor);
8073 float startValue(1.0f);
8074 DALI_TEST_EQUALS( actor.GetCurrentColor().g, startValue, TEST_LOCATION );
8075 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8076 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8077 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8078 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8079 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8080 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8081 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8082 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8084 // Build the animation
8085 float durationSeconds(1.0f);
8086 Animation animation = Animation::New(durationSeconds);
8087 float targetGreen(0.5f);
8088 animation.AnimateTo( Property(actor, Actor::Property::COLOR_GREEN), targetGreen );
8090 float fiftyPercentProgress(startValue + (targetGreen - startValue)*0.5f);
8092 // Start the animation
8095 // Target value should be retrievable straight away
8096 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, targetGreen, startValue, startValue ), TEST_LOCATION );
8097 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetGreen, TEST_LOCATION );
8099 bool signalReceived(false);
8100 AnimationFinishCheck finishCheck(signalReceived);
8101 animation.FinishedSignal().Connect(&application, finishCheck);
8103 application.SendNotification();
8104 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8106 // We didn't expect the animation to finish yet
8107 application.SendNotification();
8108 finishCheck.CheckSignalNotReceived();
8109 DALI_TEST_EQUALS( actor.GetCurrentColor().g, fiftyPercentProgress, TEST_LOCATION );
8110 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8111 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION );
8112 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8113 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8115 application.SendNotification();
8116 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8118 // We did expect the animation to finish
8119 application.SendNotification();
8120 finishCheck.CheckSignalReceived();
8121 DALI_TEST_EQUALS( actor.GetCurrentColor().g, targetGreen, TEST_LOCATION );
8122 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8123 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION );
8124 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8125 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8129 int UtcDaliAnimationAnimateToActorColorBlueP(void)
8131 TestApplication application;
8133 Actor actor = Actor::New();
8134 Stage::GetCurrent().Add(actor);
8135 float startValue(1.0f);
8136 DALI_TEST_EQUALS( actor.GetCurrentColor().b, startValue, TEST_LOCATION );
8137 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8138 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8139 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8140 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8141 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8142 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8143 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8144 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8146 // Build the animation
8147 float durationSeconds(1.0f);
8148 Animation animation = Animation::New(durationSeconds);
8149 float targetBlue(0.5f);
8150 animation.AnimateTo( Property(actor, Actor::Property::COLOR_BLUE), targetBlue );
8152 float fiftyPercentProgress(startValue + (targetBlue - startValue)*0.5f);
8154 // Start the animation
8157 // Target value should be retrievable straight away
8158 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, targetBlue, startValue ), TEST_LOCATION );
8159 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetBlue, TEST_LOCATION );
8161 bool signalReceived(false);
8162 AnimationFinishCheck finishCheck(signalReceived);
8163 animation.FinishedSignal().Connect(&application, finishCheck);
8165 application.SendNotification();
8166 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8168 // We didn't expect the animation to finish yet
8169 application.SendNotification();
8170 finishCheck.CheckSignalNotReceived();
8171 DALI_TEST_EQUALS( actor.GetCurrentColor().b, fiftyPercentProgress, TEST_LOCATION );
8172 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8173 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8174 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), fiftyPercentProgress, TEST_LOCATION );
8175 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8177 application.SendNotification();
8178 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8180 // We did expect the animation to finish
8181 application.SendNotification();
8182 finishCheck.CheckSignalReceived();
8183 DALI_TEST_EQUALS( actor.GetCurrentColor().b, targetBlue, TEST_LOCATION );
8184 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8185 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8186 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), targetBlue, TEST_LOCATION );
8187 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8191 int UtcDaliAnimationAnimateToActorColorAlphaP(void)
8193 TestApplication application;
8195 Actor actor = Actor::New();
8196 Stage::GetCurrent().Add(actor);
8197 float startValue(1.0f);
8198 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8199 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8200 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8201 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8202 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8203 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8204 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8205 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8206 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8208 // Build the animation
8209 float durationSeconds(1.0f);
8210 Animation animation = Animation::New(durationSeconds);
8211 float targetAlpha(0.5f);
8212 animation.AnimateTo( Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha );
8214 float fiftyPercentProgress(startValue + (targetAlpha - startValue)*0.5f);
8216 // Start the animation
8219 // Target value should be retrievable straight away
8220 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, startValue, targetAlpha ), TEST_LOCATION );
8221 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
8222 DALI_TEST_EQUALS( actor.GetProperty< float >( DevelActor::Property::OPACITY ), targetAlpha, TEST_LOCATION );
8224 bool signalReceived(false);
8225 AnimationFinishCheck finishCheck(signalReceived);
8226 animation.FinishedSignal().Connect(&application, finishCheck);
8228 application.SendNotification();
8229 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8231 // We didn't expect the animation to finish yet
8232 application.SendNotification();
8233 finishCheck.CheckSignalNotReceived();
8234 DALI_TEST_EQUALS( actor.GetCurrentColor().a, fiftyPercentProgress, TEST_LOCATION );
8235 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8236 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8237 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8238 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), fiftyPercentProgress, TEST_LOCATION );
8240 application.SendNotification();
8241 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8243 // We did expect the animation to finish
8244 application.SendNotification();
8245 finishCheck.CheckSignalReceived();
8246 DALI_TEST_EQUALS( actor.GetCurrentColor().a, targetAlpha, TEST_LOCATION );
8247 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8248 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8249 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8250 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
8254 int UtcDaliAnimationKeyFrames01P(void)
8256 TestApplication application;
8258 KeyFrames keyFrames = KeyFrames::New();
8259 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8261 keyFrames.Add(0.0f, 0.1f);
8263 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8265 KeyFrames keyFrames2( keyFrames);
8266 DALI_TEST_CHECK( keyFrames2 );
8267 DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
8269 KeyFrames keyFrames3 = KeyFrames::New();
8270 keyFrames3.Add(0.6f, true);
8271 DALI_TEST_CHECK( keyFrames3 );
8272 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
8274 keyFrames3 = keyFrames;
8275 DALI_TEST_CHECK( keyFrames3 );
8276 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
8281 int UtcDaliAnimationKeyFrames02P(void)
8283 TestApplication application;
8285 KeyFrames keyFrames = KeyFrames::New();
8286 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8288 keyFrames.Add(0.0f, 0.1f);
8289 keyFrames.Add(0.2f, 0.5f);
8290 keyFrames.Add(0.4f, 0.0f);
8291 keyFrames.Add(0.6f, 1.0f);
8292 keyFrames.Add(0.8f, 0.7f);
8293 keyFrames.Add(1.0f, 0.9f);
8295 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8299 keyFrames.Add(1.9f, false);
8301 catch (Dali::DaliException& e)
8303 DALI_TEST_PRINT_ASSERT( e );
8304 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8309 int UtcDaliAnimationKeyFrames03P(void)
8311 TestApplication application;
8313 KeyFrames keyFrames = KeyFrames::New();
8314 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8316 keyFrames.Add(0.0f, true);
8317 keyFrames.Add(0.2f, false);
8318 keyFrames.Add(0.4f, false);
8319 keyFrames.Add(0.6f, true);
8320 keyFrames.Add(0.8f, true);
8321 keyFrames.Add(1.0f, false);
8323 DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
8327 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8329 catch (Dali::DaliException& e)
8331 DALI_TEST_PRINT_ASSERT( e );
8332 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8337 int UtcDaliAnimationKeyFrames04P(void)
8339 TestApplication application;
8341 KeyFrames keyFrames = KeyFrames::New();
8342 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8344 keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
8345 keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
8346 keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
8347 keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
8348 keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
8349 keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
8351 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
8355 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8357 catch (Dali::DaliException& e)
8359 DALI_TEST_PRINT_ASSERT( e );
8360 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8365 int UtcDaliAnimationKeyFrames05P(void)
8367 TestApplication application;
8369 KeyFrames keyFrames = KeyFrames::New();
8370 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8372 keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
8373 keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
8374 keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
8375 keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
8376 keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
8377 keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
8379 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
8383 keyFrames.Add(0.7f, 1.0f);
8385 catch (Dali::DaliException& e)
8387 DALI_TEST_PRINT_ASSERT( e );
8388 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8393 int UtcDaliAnimationKeyFrames06P(void)
8395 TestApplication application;
8397 KeyFrames keyFrames = KeyFrames::New();
8398 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8400 keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
8401 keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8402 keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
8403 keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
8404 keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
8405 keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
8407 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
8411 keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
8413 catch (Dali::DaliException& e)
8415 DALI_TEST_PRINT_ASSERT( e );
8416 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8421 int UtcDaliAnimationKeyFrames07P(void)
8423 TestApplication application;
8425 KeyFrames keyFrames = KeyFrames::New();
8426 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8428 keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
8429 keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
8430 keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
8431 keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
8432 keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
8433 keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
8435 DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
8439 keyFrames.Add(0.7f, 1.1f);
8441 catch (Dali::DaliException& e)
8443 DALI_TEST_PRINT_ASSERT( e );
8444 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8449 int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
8451 TestApplication application;
8453 float startValue(1.0f);
8454 Actor actor = Actor::New();
8455 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8456 Stage::GetCurrent().Add(actor);
8458 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8459 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8460 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8461 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8462 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8463 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8464 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8465 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8466 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8468 // Build the animation
8469 float durationSeconds(1.0f);
8470 Animation animation = Animation::New(durationSeconds);
8472 KeyFrames keyFrames = KeyFrames::New();
8473 keyFrames.Add(0.0f, 0.1f);
8474 keyFrames.Add(0.2f, 0.5f);
8475 keyFrames.Add(0.4f, 0.0f);
8476 keyFrames.Add(0.6f, 1.0f);
8477 keyFrames.Add(0.8f, 0.7f);
8478 keyFrames.Add(1.0f, 0.9f);
8480 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames );
8482 // Start the animation
8485 // Final key frame value should be retrievable straight away
8486 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), 0.9f, TEST_LOCATION );
8488 bool signalReceived(false);
8489 AnimationFinishCheck finishCheck(signalReceived);
8490 animation.FinishedSignal().Connect(&application, finishCheck);
8491 application.SendNotification();
8492 application.Render(0);
8493 application.SendNotification();
8494 finishCheck.CheckSignalNotReceived();
8495 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
8497 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8498 application.SendNotification();
8499 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8500 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8501 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8502 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION );
8503 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.3f, 0.01f, TEST_LOCATION );
8505 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
8506 application.SendNotification();
8507 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8508 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8509 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8510 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION );
8511 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.25f, 0.01f, TEST_LOCATION );
8513 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
8514 application.SendNotification();
8515 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8516 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8517 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8518 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
8519 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
8521 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
8522 application.SendNotification();
8523 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8524 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8525 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8526 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
8527 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
8529 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
8530 application.SendNotification();
8531 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8532 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8533 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8534 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION );
8535 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.8f, 0.01f, TEST_LOCATION );
8537 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
8538 application.SendNotification();
8539 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8540 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8541 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8542 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
8543 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
8545 // We did expect the animation to finish
8547 finishCheck.CheckSignalReceived();
8551 int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
8553 TestApplication application;
8555 float startValue(1.0f);
8556 Actor actor = Actor::New();
8557 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8558 Stage::GetCurrent().Add(actor);
8560 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8561 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8562 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8563 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8564 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8565 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8566 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8567 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8568 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8570 // Build the animation
8571 float durationSeconds(1.0f);
8572 Animation animation = Animation::New(durationSeconds);
8574 KeyFrames keyFrames = KeyFrames::New();
8575 keyFrames.Add(0.0f, 0.1f);
8576 keyFrames.Add(0.2f, 0.5f);
8577 keyFrames.Add(0.4f, 0.0f);
8578 keyFrames.Add(0.6f, 1.0f);
8579 keyFrames.Add(0.8f, 0.7f);
8580 keyFrames.Add(1.0f, 0.9f);
8582 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::Cubic );
8584 // Start the animation
8587 bool signalReceived(false);
8588 AnimationFinishCheck finishCheck(signalReceived);
8589 animation.FinishedSignal().Connect(&application, finishCheck);
8590 application.SendNotification();
8591 application.Render(0);
8592 application.SendNotification();
8593 finishCheck.CheckSignalNotReceived();
8594 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
8596 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8597 application.SendNotification();
8598 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8599 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8600 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8601 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.36f, 0.01f, TEST_LOCATION );
8602 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.36f, 0.01f, TEST_LOCATION );
8604 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
8605 application.SendNotification();
8606 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8607 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8608 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8609 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.21f, 0.01f, TEST_LOCATION );
8610 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.21f, 0.01f, TEST_LOCATION );
8612 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
8613 application.SendNotification();
8614 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8615 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8616 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8617 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.0f, 0.01f, TEST_LOCATION );
8618 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
8620 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
8621 application.SendNotification();
8622 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8623 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8624 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8625 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.7f, 0.01f, TEST_LOCATION );
8626 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
8628 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
8629 application.SendNotification();
8630 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8631 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8632 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8633 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.76f, 0.01f, TEST_LOCATION );
8634 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.76f, 0.01f, TEST_LOCATION );
8636 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
8637 application.SendNotification();
8638 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8639 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8640 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8641 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.9f, 0.01f, TEST_LOCATION );
8642 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
8644 // We did expect the animation to finish
8646 finishCheck.CheckSignalReceived();
8650 int UtcDaliAnimationAnimateBetweenActorColorP(void)
8652 TestApplication application;
8654 float startValue(1.0f);
8655 Actor actor = Actor::New();
8656 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8657 Stage::GetCurrent().Add(actor);
8659 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8660 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8661 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8662 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8663 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8664 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8665 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8666 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8667 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8669 // Build the animation
8670 float durationSeconds(1.0f);
8671 Animation animation = Animation::New(durationSeconds);
8673 KeyFrames keyFrames = KeyFrames::New();
8674 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8675 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8676 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8678 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames );
8680 // Start the animation
8683 bool signalReceived(false);
8684 AnimationFinishCheck finishCheck(signalReceived);
8685 animation.FinishedSignal().Connect(&application, finishCheck);
8686 application.SendNotification();
8687 application.Render(0);
8688 application.SendNotification();
8689 finishCheck.CheckSignalNotReceived();
8690 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
8691 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
8692 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
8693 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
8695 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8696 application.SendNotification();
8697 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
8698 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
8699 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
8700 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
8702 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8703 application.SendNotification();
8704 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
8705 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
8706 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
8707 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
8709 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8710 application.SendNotification();
8711 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
8712 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
8713 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
8714 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
8716 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8717 application.SendNotification();
8718 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
8719 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
8720 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
8721 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
8723 // We did expect the animation to finish
8725 finishCheck.CheckSignalReceived();
8729 int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
8731 TestApplication application;
8733 float startValue(1.0f);
8734 Actor actor = Actor::New();
8735 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8736 Stage::GetCurrent().Add(actor);
8738 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8739 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8740 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8741 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8742 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8743 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8744 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8745 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8746 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8748 // Build the animation
8749 float durationSeconds(1.0f);
8750 Animation animation = Animation::New(durationSeconds);
8752 KeyFrames keyFrames = KeyFrames::New();
8753 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8754 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8755 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8757 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, Animation::Cubic );
8759 // Start the animation
8762 bool signalReceived(false);
8763 AnimationFinishCheck finishCheck(signalReceived);
8764 animation.FinishedSignal().Connect(&application, finishCheck);
8765 application.SendNotification();
8766 application.Render(0);
8767 application.SendNotification();
8768 finishCheck.CheckSignalNotReceived();
8769 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
8770 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
8771 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
8772 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
8774 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8775 application.SendNotification();
8776 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
8777 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
8778 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
8779 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
8781 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8782 application.SendNotification();
8783 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
8784 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
8785 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
8786 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
8788 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8789 application.SendNotification();
8790 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
8791 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
8792 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
8793 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
8795 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8796 application.SendNotification();
8797 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
8798 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
8799 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
8800 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
8802 // We did expect the animation to finish
8804 finishCheck.CheckSignalReceived();
8808 int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
8810 TestApplication application;
8812 Actor actor = Actor::New();
8813 AngleAxis aa(Degree(90), Vector3::XAXIS);
8814 actor.SetOrientation(aa.angle, aa.axis);
8815 Stage::GetCurrent().Add(actor);
8817 application.SendNotification();
8818 application.Render(0);
8820 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
8822 // Build the animation
8823 float durationSeconds(1.0f);
8824 Animation animation = Animation::New(durationSeconds);
8826 KeyFrames keyFrames = KeyFrames::New();
8827 keyFrames.Add(0.0f, false);
8828 keyFrames.Add(0.2f, true);
8829 keyFrames.Add(0.4f, true);
8830 keyFrames.Add(0.8f, false);
8831 keyFrames.Add(1.0f, true);
8833 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames );
8835 // Start the animation
8838 bool signalReceived(false);
8839 AnimationFinishCheck finishCheck(signalReceived);
8840 animation.FinishedSignal().Connect(&application, finishCheck);
8841 application.SendNotification();
8842 application.SendNotification();
8843 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8844 application.SendNotification();
8845 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8846 application.SendNotification();
8848 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
8849 finishCheck.CheckSignalReceived();
8853 int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
8855 TestApplication application;
8857 Actor actor = Actor::New();
8858 AngleAxis aa(Degree(90), Vector3::XAXIS);
8859 actor.SetOrientation(aa.angle, aa.axis);
8860 Stage::GetCurrent().Add(actor);
8862 application.SendNotification();
8863 application.Render(0);
8865 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
8867 // Build the animation
8868 float durationSeconds(1.0f);
8869 Animation animation = Animation::New(durationSeconds);
8871 KeyFrames keyFrames = KeyFrames::New();
8872 keyFrames.Add(0.0f, false);
8873 keyFrames.Add(0.2f, true);
8874 keyFrames.Add(0.4f, true);
8875 keyFrames.Add(0.8f, false);
8876 keyFrames.Add(1.0f, true);
8878 //Cubic interpolation for boolean values should be ignored
8879 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::Cubic );
8881 // Start the animation
8884 bool signalReceived(false);
8885 AnimationFinishCheck finishCheck(signalReceived);
8886 animation.FinishedSignal().Connect(&application, finishCheck);
8887 application.SendNotification();
8888 application.SendNotification();
8889 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8890 application.SendNotification();
8891 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8892 application.SendNotification();
8894 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
8895 finishCheck.CheckSignalReceived();
8899 int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
8901 TestApplication application;
8903 Actor actor = Actor::New();
8904 AngleAxis aa(Degree(90), Vector3::XAXIS);
8905 actor.SetOrientation(aa.angle, aa.axis);
8906 Stage::GetCurrent().Add(actor);
8908 application.SendNotification();
8909 application.Render(0);
8910 Quaternion start(Radian(aa.angle), aa.axis);
8911 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8913 // Build the animation
8914 float durationSeconds(1.0f);
8915 Animation animation = Animation::New(durationSeconds);
8917 KeyFrames keyFrames = KeyFrames::New();
8918 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
8920 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
8922 // Start the animation
8925 bool signalReceived(false);
8926 AnimationFinishCheck finishCheck(signalReceived);
8927 animation.FinishedSignal().Connect(&application, finishCheck);
8928 application.SendNotification();
8929 application.SendNotification();
8930 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8931 application.SendNotification();
8932 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8933 application.SendNotification();
8935 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
8937 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8938 finishCheck.CheckSignalReceived();
8942 int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
8944 TestApplication application;
8946 Actor actor = Actor::New();
8947 AngleAxis aa(Degree(90), Vector3::XAXIS);
8948 actor.SetOrientation(aa.angle, aa.axis);
8949 application.SendNotification();
8950 application.Render(0);
8951 Stage::GetCurrent().Add(actor);
8953 Quaternion start(Radian(aa.angle), aa.axis);
8954 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8956 // Build the animation
8957 float durationSeconds(1.0f);
8958 Animation animation = Animation::New(durationSeconds);
8960 KeyFrames keyFrames = KeyFrames::New();
8961 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
8962 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
8963 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
8965 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
8967 // Start the animation
8970 bool signalReceived(false);
8971 AnimationFinishCheck finishCheck(signalReceived);
8972 animation.FinishedSignal().Connect(&application, finishCheck);
8973 application.SendNotification();
8974 application.Render(0);
8975 application.SendNotification();
8976 finishCheck.CheckSignalNotReceived();
8978 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
8979 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8981 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8982 application.SendNotification();
8983 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
8984 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8986 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8987 application.SendNotification();
8988 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
8989 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8991 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8992 application.SendNotification();
8993 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f) );
8994 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8996 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8997 application.SendNotification();
8998 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
8999 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9001 // We did expect the animation to finish
9003 finishCheck.CheckSignalReceived();
9007 int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
9009 TestApplication application;
9011 Actor actor = Actor::New();
9012 AngleAxis aa(Degree(90), Vector3::XAXIS);
9013 actor.SetOrientation(aa.angle, aa.axis);
9014 Stage::GetCurrent().Add(actor);
9016 application.SendNotification();
9017 application.Render(0);
9018 Quaternion start(Radian(aa.angle), aa.axis);
9019 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
9021 // Build the animation
9022 float durationSeconds(1.0f);
9023 Animation animation = Animation::New(durationSeconds);
9025 KeyFrames keyFrames = KeyFrames::New();
9026 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9028 //Cubic interpolation should be ignored for quaternions
9029 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
9031 // Start the animation
9034 bool signalReceived(false);
9035 AnimationFinishCheck finishCheck(signalReceived);
9036 animation.FinishedSignal().Connect(&application, finishCheck);
9037 application.SendNotification();
9038 application.SendNotification();
9039 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9040 application.SendNotification();
9041 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9042 application.SendNotification();
9044 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
9046 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9047 finishCheck.CheckSignalReceived();
9051 int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
9053 TestApplication application;
9055 Actor actor = Actor::New();
9056 AngleAxis aa(Degree(90), Vector3::XAXIS);
9057 actor.SetOrientation(aa.angle, aa.axis);
9058 application.SendNotification();
9059 application.Render(0);
9060 Stage::GetCurrent().Add(actor);
9062 Quaternion start(Radian(aa.angle), aa.axis);
9063 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
9065 // Build the animation
9066 float durationSeconds(1.0f);
9067 Animation animation = Animation::New(durationSeconds);
9069 KeyFrames keyFrames = KeyFrames::New();
9070 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9071 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9072 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9074 //Cubic interpolation should be ignored for quaternions
9075 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
9077 // Start the animation
9080 bool signalReceived(false);
9081 AnimationFinishCheck finishCheck(signalReceived);
9082 animation.FinishedSignal().Connect(&application, finishCheck);
9083 application.SendNotification();
9084 application.Render(0);
9085 application.SendNotification();
9086 finishCheck.CheckSignalNotReceived();
9088 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9089 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9091 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9092 application.SendNotification();
9093 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
9094 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9096 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9097 application.SendNotification();
9098 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
9099 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9101 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9102 application.SendNotification();
9103 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f ) );
9104 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9106 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9107 application.SendNotification();
9108 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
9109 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9111 // We did expect the animation to finish
9113 finishCheck.CheckSignalReceived();
9117 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
9119 TestApplication application;
9121 float startValue(1.0f);
9122 Actor actor = Actor::New();
9123 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9124 Stage::GetCurrent().Add(actor);
9126 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9127 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9128 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9129 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9130 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9131 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9132 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9133 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9134 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9136 // Build the animation
9137 float durationSeconds(1.0f);
9138 Animation animation = Animation::New(durationSeconds);
9140 KeyFrames keyFrames = KeyFrames::New();
9141 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9142 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9143 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9145 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR );
9147 // Start the animation
9150 bool signalReceived(false);
9151 AnimationFinishCheck finishCheck(signalReceived);
9152 animation.FinishedSignal().Connect(&application, finishCheck);
9153 application.SendNotification();
9154 application.Render(0);
9155 application.SendNotification();
9156 finishCheck.CheckSignalNotReceived();
9157 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9158 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9159 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9160 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9162 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9163 application.SendNotification();
9164 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9165 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9166 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9167 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9169 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9170 application.SendNotification();
9171 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9172 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9173 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9174 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9176 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9177 application.SendNotification();
9178 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9179 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9180 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9181 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9183 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9184 application.SendNotification();
9185 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9186 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9187 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9188 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9190 // We did expect the animation to finish
9192 finishCheck.CheckSignalReceived();
9196 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
9198 TestApplication application;
9200 float startValue(1.0f);
9201 Actor actor = Actor::New();
9202 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9203 Stage::GetCurrent().Add(actor);
9205 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9206 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9207 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9208 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9209 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9210 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9211 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9212 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9213 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9215 // Build the animation
9216 float durationSeconds(1.0f);
9217 Animation animation = Animation::New(durationSeconds);
9219 KeyFrames keyFrames = KeyFrames::New();
9220 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9221 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9222 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9224 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::Cubic );
9226 // Start the animation
9229 bool signalReceived(false);
9230 AnimationFinishCheck finishCheck(signalReceived);
9231 animation.FinishedSignal().Connect(&application, finishCheck);
9232 application.SendNotification();
9233 application.Render(0);
9234 application.SendNotification();
9235 finishCheck.CheckSignalNotReceived();
9236 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9237 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9238 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9239 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9241 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9242 application.SendNotification();
9243 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9244 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9245 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9246 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9248 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9249 application.SendNotification();
9250 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9251 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9252 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9253 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9255 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9256 application.SendNotification();
9257 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9258 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9259 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9260 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9262 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9263 application.SendNotification();
9264 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9265 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9266 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9267 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9269 // We did expect the animation to finish
9271 finishCheck.CheckSignalReceived();
9275 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void)
9277 TestApplication application;
9279 float startValue(1.0f);
9280 Actor actor = Actor::New();
9281 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9282 Stage::GetCurrent().Add(actor);
9284 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9285 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9286 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9287 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9288 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9289 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9290 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9291 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9292 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9294 // Build the animation
9295 float durationSeconds(1.0f);
9297 Animation animation = Animation::New(durationSeconds);
9299 KeyFrames keyFrames = KeyFrames::New();
9300 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9301 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9302 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9304 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ) );
9306 // Start the animation
9309 bool signalReceived(false);
9310 AnimationFinishCheck finishCheck(signalReceived);
9311 animation.FinishedSignal().Connect(&application, finishCheck);
9312 application.SendNotification();
9314 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9315 application.SendNotification();
9316 finishCheck.CheckSignalNotReceived();
9317 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9318 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9319 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9320 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9322 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9323 application.SendNotification();
9324 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9325 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9326 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9327 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9329 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9330 application.SendNotification();
9331 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9332 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9333 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9334 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9336 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9337 application.SendNotification();
9338 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9339 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9340 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9341 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9343 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9344 application.SendNotification();
9345 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9346 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9347 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9348 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9350 // We did expect the animation to finish
9352 finishCheck.CheckSignalReceived();
9356 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
9358 TestApplication application;
9360 float startValue(1.0f);
9361 Actor actor = Actor::New();
9362 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9363 Stage::GetCurrent().Add(actor);
9365 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9366 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9367 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9368 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9369 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9370 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9371 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9372 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9373 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9375 // Build the animation
9376 float durationSeconds(1.0f);
9378 Animation animation = Animation::New(durationSeconds);
9380 KeyFrames keyFrames = KeyFrames::New();
9381 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9382 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9383 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9385 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
9387 // Start the animation
9390 bool signalReceived(false);
9391 AnimationFinishCheck finishCheck(signalReceived);
9392 animation.FinishedSignal().Connect(&application, finishCheck);
9393 application.SendNotification();
9395 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9396 application.SendNotification();
9397 finishCheck.CheckSignalNotReceived();
9398 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9399 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9400 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9401 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9403 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9404 application.SendNotification();
9405 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9406 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9407 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9408 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9410 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9411 application.SendNotification();
9412 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9413 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
9414 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9415 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9417 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9418 application.SendNotification();
9419 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9420 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9421 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9422 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9424 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9425 application.SendNotification();
9426 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9427 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9428 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9429 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9431 // We did expect the animation to finish
9433 finishCheck.CheckSignalReceived();
9437 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
9439 TestApplication application;
9441 float startValue(1.0f);
9443 Actor actor = Actor::New();
9444 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9445 Stage::GetCurrent().Add(actor);
9447 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9448 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9449 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9450 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9451 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9452 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9453 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9454 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9455 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9457 // Build the animation
9458 float durationSeconds(1.0f);
9459 Animation animation = Animation::New(durationSeconds);
9461 KeyFrames keyFrames = KeyFrames::New();
9462 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9463 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9464 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9466 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
9468 // Start the animation
9471 bool signalReceived(false);
9472 AnimationFinishCheck finishCheck(signalReceived);
9473 animation.FinishedSignal().Connect(&application, finishCheck);
9474 application.SendNotification();
9476 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9477 application.SendNotification();
9478 finishCheck.CheckSignalNotReceived();
9479 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9480 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9481 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9482 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9484 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9485 application.SendNotification();
9486 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9487 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9488 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9489 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9491 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9492 application.SendNotification();
9493 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9494 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9495 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9496 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9498 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9499 application.SendNotification();
9500 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9501 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9502 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9503 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9505 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9506 application.SendNotification();
9507 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9508 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9509 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9510 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9512 // We did expect the animation to finish
9514 finishCheck.CheckSignalReceived();
9518 int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void)
9520 TestApplication application;
9522 float startValue(1.0f);
9523 Actor actor = Actor::New();
9524 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9525 Stage::GetCurrent().Add(actor);
9527 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9528 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9529 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9530 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9531 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9532 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9533 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9534 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9535 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9538 // Build the animation
9539 float durationSeconds(1.0f);
9541 Animation animation = Animation::New(durationSeconds);
9543 KeyFrames keyFrames = KeyFrames::New();
9544 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9545 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9546 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9548 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
9550 // Start the animation
9553 bool signalReceived(false);
9554 AnimationFinishCheck finishCheck(signalReceived);
9555 animation.FinishedSignal().Connect(&application, finishCheck);
9556 application.SendNotification();
9558 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9559 application.SendNotification();
9560 finishCheck.CheckSignalNotReceived();
9561 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9562 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9563 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9564 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9566 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9567 application.SendNotification();
9568 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9569 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9570 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9571 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9573 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9574 application.SendNotification();
9575 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9576 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9577 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9578 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9580 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9581 application.SendNotification();
9582 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9583 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9584 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9585 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9587 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9588 application.SendNotification();
9589 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9590 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9591 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9592 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9594 // We did expect the animation to finish
9596 finishCheck.CheckSignalReceived();
9600 int UtcDaliAnimationAnimateP(void)
9602 TestApplication application;
9604 Actor actor = Actor::New();
9605 Stage::GetCurrent().Add(actor);
9608 Vector3 position0( 30.0, 80.0, 0.0);
9609 Vector3 position1( 70.0, 120.0, 0.0);
9610 Vector3 position2( 100.0, 100.0, 0.0);
9612 Dali::Path path = Dali::Path::New();
9613 path.AddPoint(position0);
9614 path.AddPoint(position1);
9615 path.AddPoint(position2);
9617 //Control points for first segment
9618 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9619 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9621 //Control points for second segment
9622 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9623 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9625 // Build the animation
9626 float durationSeconds( 1.0f );
9627 Animation animation = Animation::New(durationSeconds);
9628 animation.Animate(actor, path, Vector3::XAXIS);
9630 // Start the animation
9633 bool signalReceived(false);
9634 AnimationFinishCheck finishCheck(signalReceived);
9635 animation.FinishedSignal().Connect(&application, finishCheck);
9636 application.SendNotification();
9637 application.Render(0);
9638 application.SendNotification();
9639 finishCheck.CheckSignalNotReceived();
9640 Vector3 position, tangent;
9641 Quaternion rotation;
9642 path.Sample( 0.0f, position, tangent );
9643 rotation = Quaternion( Vector3::XAXIS, tangent );
9644 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9645 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9647 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9648 application.SendNotification();
9649 path.Sample( 0.25f, position, tangent );
9650 rotation = Quaternion( Vector3::XAXIS, tangent );
9651 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9652 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9654 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9655 application.SendNotification();
9656 path.Sample( 0.5f, position, tangent );
9657 rotation = Quaternion( Vector3::XAXIS, tangent );
9658 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9659 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9661 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9662 application.SendNotification();
9663 path.Sample( 0.75f, position, tangent );
9664 rotation = Quaternion( Vector3::XAXIS, tangent );
9665 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9666 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9668 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9669 application.SendNotification();
9670 path.Sample( 1.0f, position, tangent );
9671 rotation = Quaternion( Vector3::XAXIS, tangent );
9672 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9673 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9675 finishCheck.CheckSignalReceived();
9679 int UtcDaliAnimationAnimateAlphaFunctionP(void)
9681 TestApplication application;
9683 Actor actor = Actor::New();
9684 Stage::GetCurrent().Add(actor);
9687 Vector3 position0( 30.0, 80.0, 0.0);
9688 Vector3 position1( 70.0, 120.0, 0.0);
9689 Vector3 position2( 100.0, 100.0, 0.0);
9691 Dali::Path path = Dali::Path::New();
9692 path.AddPoint(position0);
9693 path.AddPoint(position1);
9694 path.AddPoint(position2);
9696 //Control points for first segment
9697 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9698 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9700 //Control points for second segment
9701 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9702 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9704 // Build the animation
9705 float durationSeconds( 1.0f );
9706 Animation animation = Animation::New(durationSeconds);
9707 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
9709 // Start the animation
9712 bool signalReceived(false);
9713 AnimationFinishCheck finishCheck(signalReceived);
9714 animation.FinishedSignal().Connect(&application, finishCheck);
9715 application.SendNotification();
9716 application.Render(0);
9717 application.SendNotification();
9718 finishCheck.CheckSignalNotReceived();
9719 Vector3 position, tangent;
9720 Quaternion rotation;
9721 path.Sample( 0.0f, position, tangent );
9722 rotation = Quaternion( Vector3::XAXIS, tangent );
9723 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9724 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9726 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9727 application.SendNotification();
9728 path.Sample( 0.25f, position, tangent );
9729 rotation = Quaternion( Vector3::XAXIS, tangent );
9730 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9731 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9733 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9734 application.SendNotification();
9735 path.Sample( 0.5f, position, tangent );
9736 rotation = Quaternion( Vector3::XAXIS, tangent );
9737 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9738 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9740 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9741 application.SendNotification();
9742 path.Sample( 0.75f, position, tangent );
9743 rotation = Quaternion( Vector3::XAXIS, tangent );
9744 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9745 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9747 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9748 application.SendNotification();
9749 path.Sample( 1.0f, position, tangent );
9750 rotation = Quaternion( Vector3::XAXIS, tangent );
9751 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9752 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9754 finishCheck.CheckSignalReceived();
9758 int UtcDaliAnimationAnimateTimePeriodP(void)
9760 TestApplication application;
9762 Actor actor = Actor::New();
9763 Stage::GetCurrent().Add(actor);
9766 Vector3 position0( 30.0, 80.0, 0.0);
9767 Vector3 position1( 70.0, 120.0, 0.0);
9768 Vector3 position2( 100.0, 100.0, 0.0);
9770 Dali::Path path = Dali::Path::New();
9771 path.AddPoint(position0);
9772 path.AddPoint(position1);
9773 path.AddPoint(position2);
9775 //Control points for first segment
9776 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9777 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9779 //Control points for second segment
9780 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9781 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9783 // Build the animation
9784 float durationSeconds( 1.0f );
9785 Animation animation = Animation::New(durationSeconds);
9786 animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
9788 // Start the animation
9791 bool signalReceived(false);
9792 AnimationFinishCheck finishCheck(signalReceived);
9793 animation.FinishedSignal().Connect(&application, finishCheck);
9794 application.SendNotification();
9795 application.Render(0);
9796 application.SendNotification();
9797 finishCheck.CheckSignalNotReceived();
9798 Vector3 position, tangent;
9799 Quaternion rotation;
9800 path.Sample( 0.0f, position, tangent );
9801 rotation = Quaternion( Vector3::XAXIS, tangent );
9802 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9803 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9805 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9806 application.SendNotification();
9807 path.Sample( 0.25f, position, tangent );
9808 rotation = Quaternion( Vector3::XAXIS, tangent );
9809 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9810 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9812 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9813 application.SendNotification();
9814 path.Sample( 0.5f, position, tangent );
9815 rotation = Quaternion( Vector3::XAXIS, tangent );
9816 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9817 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9819 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9820 application.SendNotification();
9821 path.Sample( 0.75f, position, tangent );
9822 rotation = Quaternion( Vector3::XAXIS, tangent );
9823 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9824 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9826 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9827 application.SendNotification();
9828 path.Sample( 1.0f, position, tangent );
9829 rotation = Quaternion( Vector3::XAXIS, tangent );
9830 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9831 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9833 finishCheck.CheckSignalReceived();
9837 int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
9839 TestApplication application;
9841 Actor actor = Actor::New();
9842 Stage::GetCurrent().Add(actor);
9845 Vector3 position0( 30.0, 80.0, 0.0);
9846 Vector3 position1( 70.0, 120.0, 0.0);
9847 Vector3 position2( 100.0, 100.0, 0.0);
9849 Dali::Path path = Dali::Path::New();
9850 path.AddPoint(position0);
9851 path.AddPoint(position1);
9852 path.AddPoint(position2);
9854 //Control points for first segment
9855 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9856 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9858 //Control points for second segment
9859 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9860 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9862 // Build the animation
9863 float durationSeconds( 1.0f );
9864 Animation animation = Animation::New(durationSeconds);
9865 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
9867 // Start the animation
9870 bool signalReceived(false);
9871 AnimationFinishCheck finishCheck(signalReceived);
9872 animation.FinishedSignal().Connect(&application, finishCheck);
9873 application.SendNotification();
9874 application.Render(0);
9875 application.SendNotification();
9876 finishCheck.CheckSignalNotReceived();
9877 Vector3 position, tangent;
9878 Quaternion rotation;
9879 path.Sample( 0.0f, position, tangent );
9880 rotation = Quaternion( Vector3::XAXIS, tangent );
9881 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9882 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9884 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9885 application.SendNotification();
9886 path.Sample( 0.25f, position, tangent );
9887 rotation = Quaternion( Vector3::XAXIS, tangent );
9888 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9889 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9891 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9892 application.SendNotification();
9893 path.Sample( 0.5f, position, tangent );
9894 rotation = Quaternion( Vector3::XAXIS, tangent );
9895 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9896 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9898 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9899 application.SendNotification();
9900 path.Sample( 0.75f, position, tangent );
9901 rotation = Quaternion( Vector3::XAXIS, tangent );
9902 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9903 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9905 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9906 application.SendNotification();
9907 path.Sample( 1.0f, position, tangent );
9908 rotation = Quaternion( Vector3::XAXIS, tangent );
9909 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9910 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9912 finishCheck.CheckSignalReceived();
9916 int UtcDaliAnimationShowP(void)
9918 TestApplication application;
9920 Actor actor = Actor::New();
9921 actor.SetVisible(false);
9922 application.SendNotification();
9923 application.Render(0);
9924 DALI_TEST_CHECK( !actor.IsVisible() );
9925 Stage::GetCurrent().Add(actor);
9927 // Start the animation
9928 float durationSeconds(10.0f);
9929 Animation animation = Animation::New(durationSeconds);
9930 animation.Show(actor, durationSeconds*0.5f);
9933 bool signalReceived(false);
9934 AnimationFinishCheck finishCheck(signalReceived);
9935 animation.FinishedSignal().Connect(&application, finishCheck);
9937 application.SendNotification();
9938 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
9940 // We didn't expect the animation to finish yet
9941 application.SendNotification();
9942 finishCheck.CheckSignalNotReceived();
9943 DALI_TEST_CHECK( !actor.IsVisible() );
9945 application.SendNotification();
9946 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be shown now*/);
9948 // We didn't expect the animation to finish yet
9949 application.SendNotification();
9950 finishCheck.CheckSignalNotReceived();
9951 DALI_TEST_CHECK( actor.IsVisible() );
9953 application.SendNotification();
9954 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
9956 // We did expect the animation to finish
9957 application.SendNotification();
9958 finishCheck.CheckSignalReceived();
9959 DALI_TEST_CHECK( actor.IsVisible() );
9963 int UtcDaliAnimationHideP(void)
9965 TestApplication application;
9967 Actor actor = Actor::New();
9968 DALI_TEST_CHECK( actor.IsVisible() );
9969 Stage::GetCurrent().Add(actor);
9971 // Start the animation
9972 float durationSeconds(10.0f);
9973 Animation animation = Animation::New(durationSeconds);
9974 animation.Hide(actor, durationSeconds*0.5f);
9977 bool signalReceived(false);
9978 AnimationFinishCheck finishCheck(signalReceived);
9979 animation.FinishedSignal().Connect(&application, finishCheck);
9981 application.SendNotification();
9982 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
9984 // We didn't expect the animation to finish yet
9985 application.SendNotification();
9986 finishCheck.CheckSignalNotReceived();
9987 DALI_TEST_CHECK( actor.IsVisible() );
9989 application.SendNotification();
9990 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be hidden now*/);
9992 // We didn't expect the animation to finish yet
9993 application.SendNotification();
9994 finishCheck.CheckSignalNotReceived();
9995 DALI_TEST_CHECK( !actor.IsVisible() );
9997 application.SendNotification();
9998 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10000 // We did expect the animation to finish
10001 application.SendNotification();
10002 finishCheck.CheckSignalReceived();
10003 DALI_TEST_CHECK( !actor.IsVisible() );
10007 int UtcDaliAnimationShowHideAtEndP(void)
10009 // Test that show/hide delay can be the same as animation duration
10010 // i.e. to show/hide at the end of the animation
10012 TestApplication application;
10014 Actor actor = Actor::New();
10015 DALI_TEST_CHECK( actor.IsVisible() );
10016 Stage::GetCurrent().Add(actor);
10018 // Start Hide animation
10019 float durationSeconds(10.0f);
10020 Animation animation = Animation::New(durationSeconds);
10021 animation.Hide(actor, durationSeconds/*Hide at end*/);
10024 bool signalReceived(false);
10025 AnimationFinishCheck finishCheck(signalReceived);
10026 animation.FinishedSignal().Connect(&application, finishCheck);
10028 application.SendNotification();
10029 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
10031 // We did expect the animation to finish
10032 application.SendNotification();
10033 finishCheck.CheckSignalReceived();
10034 DALI_TEST_CHECK( !actor.IsVisible() );
10036 // Start Show animation
10037 animation = Animation::New(durationSeconds);
10038 animation.Show(actor, durationSeconds/*Show at end*/);
10039 animation.FinishedSignal().Connect(&application, finishCheck);
10042 application.SendNotification();
10043 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
10045 // We did expect the animation to finish
10046 application.SendNotification();
10047 finishCheck.CheckSignalReceived();
10048 DALI_TEST_CHECK( actor.IsVisible() );
10052 int UtcDaliKeyFramesCreateDestroyP(void)
10054 tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
10056 KeyFrames* keyFrames = new KeyFrames;
10058 DALI_TEST_CHECK( true );
10062 int UtcDaliKeyFramesDownCastP(void)
10064 TestApplication application;
10065 tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
10067 KeyFrames keyFrames = KeyFrames::New();
10068 BaseHandle object(keyFrames);
10070 KeyFrames keyFrames2 = KeyFrames::DownCast(object);
10071 DALI_TEST_CHECK(keyFrames2);
10073 KeyFrames keyFrames3 = DownCast< KeyFrames >(object);
10074 DALI_TEST_CHECK(keyFrames3);
10076 BaseHandle unInitializedObject;
10077 KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
10078 DALI_TEST_CHECK(!keyFrames4);
10080 KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject);
10081 DALI_TEST_CHECK(!keyFrames5);
10085 int UtcDaliAnimationCreateDestroyP(void)
10087 TestApplication application;
10088 Animation* animation = new Animation;
10089 DALI_TEST_CHECK( animation );
10094 struct UpdateManagerTestConstraint
10096 UpdateManagerTestConstraint(TestApplication& application)
10097 : mApplication(application)
10101 void operator()( Vector3& current, const PropertyInputContainer& /* inputs */)
10103 mApplication.SendNotification(); // Process events
10106 TestApplication& mApplication;
10109 int UtcDaliAnimationUpdateManagerP(void)
10111 TestApplication application;
10113 Actor actor = Actor::New();
10114 Stage::GetCurrent().Add( actor );
10116 // Build the animation
10117 Animation animation = Animation::New( 0.0f );
10119 bool signalReceived = false;
10120 AnimationFinishCheck finishCheck( signalReceived );
10121 animation.FinishedSignal().Connect( &application, finishCheck );
10123 Vector3 startValue(1.0f, 1.0f, 1.0f);
10124 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10125 Constraint constraint = Constraint::New<Vector3>( actor, index, UpdateManagerTestConstraint( application ) );
10126 constraint.Apply();
10128 // Apply animation to actor
10129 animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunction::LINEAR );
10130 animation.AnimateTo( Property(actor, DevelActor::Property::OPACITY), 0.3f, AlphaFunction::LINEAR );
10134 application.SendNotification();
10135 application.UpdateOnly( 16 );
10137 finishCheck.CheckSignalNotReceived();
10139 application.SendNotification(); // Process events
10141 finishCheck.CheckSignalReceived();
10146 int UtcDaliAnimationSignalOrderP(void)
10148 TestApplication application;
10150 Actor actor = Actor::New();
10151 Stage::GetCurrent().Add( actor );
10153 // Build the animations
10154 Animation animation1 = Animation::New( 0.0f ); // finishes first frame
10155 Animation animation2 = Animation::New( 0.02f ); // finishes in 20 ms
10157 bool signal1Received = false;
10158 animation1.FinishedSignal().Connect( &application, AnimationFinishCheck( signal1Received ) );
10160 bool signal2Received = false;
10161 animation2.FinishedSignal().Connect( &application, AnimationFinishCheck( signal2Received ) );
10163 // Apply animations to actor
10164 animation1.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 3.0f, 2.0f, 1.0f ), AlphaFunction::LINEAR );
10166 animation2.AnimateTo( Property(actor, Actor::Property::SIZE ), Vector3( 10.0f, 20.0f, 30.0f ), AlphaFunction::LINEAR );
10169 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10170 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10172 application.SendNotification();
10173 application.UpdateOnly( 10 ); // 10ms progress
10175 // no notifications yet
10176 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10177 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10179 application.SendNotification();
10182 DALI_TEST_EQUALS( signal1Received, true, TEST_LOCATION );
10183 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10184 signal1Received = false;
10186 // 1st animation is complete now, do another update with no ProcessEvents in between
10187 application.UpdateOnly( 20 ); // 20ms progress
10190 application.SendNotification();
10192 // 2nd should complete now
10193 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10194 DALI_TEST_EQUALS( signal2Received, true, TEST_LOCATION );
10199 int UtcDaliAnimationExtendDurationP(void)
10201 TestApplication application;
10203 Actor actor = Actor::New();
10205 // Register a float property
10206 float startValue(10.0f);
10207 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10208 Stage::GetCurrent().Add(actor);
10209 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
10210 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
10212 // Build the animation
10213 float initialDurationSeconds(1.0f);
10214 float animatorDelay = 5.0f;
10215 float animatorDurationSeconds(5.0f);
10216 float extendedDurationSeconds(animatorDelay+animatorDurationSeconds);
10217 Animation animation = Animation::New(initialDurationSeconds);
10218 float targetValue(30.0f);
10219 float relativeValue(targetValue - startValue);
10221 animation.AnimateTo(Property(actor, index),
10223 TimePeriod(animatorDelay, animatorDurationSeconds));
10225 // The duration should have been extended
10226 DALI_TEST_EQUALS( animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION );
10228 // Start the animation
10231 bool signalReceived(false);
10232 AnimationFinishCheck finishCheck(signalReceived);
10233 animation.FinishedSignal().Connect(&application, finishCheck);
10235 application.SendNotification();
10236 application.Render(static_cast<unsigned int>(extendedDurationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
10238 // We didn't expect the animation to finish yet, but cached value should be the final one
10239 application.SendNotification();
10240 finishCheck.CheckSignalNotReceived();
10241 DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
10242 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
10244 application.SendNotification();
10245 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
10247 // We didn't expect the animation to finish yet
10248 application.SendNotification();
10249 finishCheck.CheckSignalNotReceived();
10250 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
10252 application.SendNotification();
10253 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
10255 // We did expect the animation to finish
10256 application.SendNotification();
10257 finishCheck.CheckSignalReceived();
10258 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
10259 DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
10263 int UtcDaliAnimationCustomIntProperty(void)
10265 TestApplication application;
10267 Actor actor = Actor::New();
10268 Stage::GetCurrent().Add(actor);
10269 int startValue(0u);
10271 Property::Index index = actor.RegisterProperty("anIndex", startValue);
10272 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
10273 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), startValue, TEST_LOCATION );
10275 // Build the animation
10276 float durationSeconds(1.0f);
10277 Animation animation = Animation::New(durationSeconds);
10278 animation.AnimateTo( Property(actor, index), 20 );
10280 // Start the animation
10283 // Target value should be retrievable straight away
10284 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION );
10286 bool signalReceived(false);
10287 AnimationFinishCheck finishCheck(signalReceived);
10288 animation.FinishedSignal().Connect(&application, finishCheck);
10290 application.SendNotification();
10291 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
10293 // We didn't expect the animation to finish yet
10294 application.SendNotification();
10295 finishCheck.CheckSignalNotReceived();
10296 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), 10, TEST_LOCATION );
10298 application.SendNotification();
10299 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10301 // We did expect the animation to finish
10302 application.SendNotification();
10303 finishCheck.CheckSignalReceived();
10304 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), 20, TEST_LOCATION );
10305 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION );
10309 int UtcDaliAnimationDuration(void)
10311 TestApplication application;
10313 Actor actor = Actor::New();
10314 Stage::GetCurrent().Add(actor);
10316 Animation animation = Animation::New( 0.0f );
10317 DALI_TEST_EQUALS( 0.0f, animation.GetDuration(), TEST_LOCATION );
10319 // The animation duration should automatically increase depending on the animator time period
10321 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 0.0f, 1.0f ) );
10322 DALI_TEST_EQUALS( 1.0f, animation.GetDuration(), TEST_LOCATION );
10324 animation.AnimateTo( Property( actor, Actor::Property::POSITION_Y ), 200.0f, TimePeriod( 10.0f, 1.0f ) );
10325 DALI_TEST_EQUALS( 11.0f, animation.GetDuration(), TEST_LOCATION );
10330 int UtcDaliAnimationAnimateByNonAnimateableTypeN(void)
10332 TestApplication application;
10334 Actor actor = Actor::New();
10336 // Register an integer property
10338 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10339 Stage::GetCurrent().Add(actor);
10340 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10344 // Build the animation
10345 Animation animation = Animation::New( 2.0f );
10346 std::string relativeValue = "relative string";
10347 animation.AnimateBy( Property(actor, index), relativeValue );
10348 tet_result(TET_FAIL);
10350 catch ( Dali::DaliException& e )
10352 DALI_TEST_ASSERT( e, "Animated value and Property type don't match", TEST_LOCATION );
10360 int UtcDaliAnimationAnimateToNonAnimateableTypeN(void)
10362 TestApplication application;
10364 Actor actor = Actor::New();
10366 // Register an integer property
10368 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10369 Stage::GetCurrent().Add(actor);
10370 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10374 // Build the animation
10375 Animation animation = Animation::New( 2.0f );
10376 std::string relativeValue = "relative string";
10377 animation.AnimateTo( Property(actor, index), relativeValue );
10379 tet_result(TET_FAIL);
10381 catch ( Dali::DaliException& e )
10383 DALI_TEST_ASSERT( e, "Animated value and Property type don't match", TEST_LOCATION );
10389 int UtcDaliAnimationAnimateBetweenNonAnimateableTypeN(void)
10391 TestApplication application;
10393 Actor actor = Actor::New();
10395 // Register an integer property
10397 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10398 Stage::GetCurrent().Add(actor);
10399 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10403 // Build the animation
10404 KeyFrames keyFrames = KeyFrames::New();
10405 keyFrames.Add( 0.0f, std::string("relative string1") );
10406 keyFrames.Add( 1.0f, std::string("relative string2") );
10407 // no need to really create the animation as keyframes do the check
10409 tet_result(TET_FAIL);
10411 catch ( Dali::DaliException& e )
10413 DALI_TEST_ASSERT( e, "Type not animateable", TEST_LOCATION );
10419 int UtcDaliAnimationSetAndGetTargetBeforePlayP(void)
10421 tet_infoline("Setting up an animation should not effect it's position property until the animation plays");
10423 TestApplication application;
10425 tet_infoline("Set initial position and set up animation to re-position actor");
10427 Actor actor = Actor::New();
10428 Stage::GetCurrent().Add(actor);
10429 Vector3 initialPosition(0.0f, 0.0f, 0.0f);
10430 actor.SetProperty( Actor::Property::POSITION, initialPosition );
10432 // Build the animation
10433 Animation animation = Animation::New(2.0f);
10435 //Test GetCurrentProgress return 0.0 as the duration is 0.0
10436 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
10437 DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentPosition(), TEST_LOCATION );
10439 tet_infoline("Set target position in animation without intiating play");
10441 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
10442 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
10444 application.SendNotification();
10445 application.Render();
10447 tet_infoline("Ensure position of actor is still at intial value");
10449 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
10450 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
10451 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
10453 tet_infoline("Play animation and ensure actor position is now target");
10456 application.SendNotification();
10457 application.Render(1000u);
10459 tet_infoline("Ensure position of actor is at target value when aninmation half way");
10461 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
10462 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
10463 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
10465 tet_printf( "x position at half way point(%f)\n", actor.GetCurrentPosition().x );
10467 application.Render(2000u);
10469 tet_infoline("Ensure position of actor is still at target value when aninmation complete");
10471 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
10472 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
10473 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
10478 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsPositionP(void)
10480 tet_infoline("Setting up an animation should not effect it's position property until the animation plays even with mulitple animators");
10482 TestApplication application;
10484 std::vector<Vector3> targetPositions;
10486 targetPositions.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
10487 targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
10488 targetPositions.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
10490 tet_infoline("Set initial position and set up animation to re-position actor");
10492 Actor actor = Actor::New();
10493 Stage::GetCurrent().Add(actor);
10494 Vector3 initialPosition(0.0f, 0.0f, 0.0f);
10495 actor.SetProperty( Actor::Property::POSITION, initialPosition );
10497 // Build the animation
10498 Animation animation = Animation::New(2.0f);
10500 //Test GetCurrentProgress return 0.0 as the duration is 0.0
10501 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
10502 DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentPosition(), TEST_LOCATION );
10504 tet_infoline("Set target position in animation without intiating play");
10506 for ( unsigned int i = 0; i < targetPositions.size(); i++ )
10508 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[i], AlphaFunction::LINEAR);
10511 application.SendNotification();
10512 application.Render();
10514 tet_infoline("Ensure position of actor is still at intial value");
10516 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
10517 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
10518 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
10520 tet_infoline("Play animation and ensure actor position is now target");
10523 application.SendNotification();
10524 application.Render(1000u);
10526 tet_infoline("Ensure position of actor is at target value when aninmation half way");
10528 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
10529 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
10530 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
10532 tet_printf( "x position at half way point(%f)\n", actor.GetCurrentPosition().x );
10534 application.Render(2000u);
10536 tet_infoline("Ensure position of actor is still at target value when aninmation complete");
10538 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
10539 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
10540 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
10545 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionP(void)
10547 tet_infoline("Setting up an animation should not effect it's size property until the animation plays even with mulitple animators of different Property Indexes");
10549 TestApplication application;
10551 std::vector<Vector3> targetSizes;
10552 std::vector<Vector3> targetPositions;
10554 targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
10555 targetSizes.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
10557 targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
10559 tet_infoline("Set initial position and set up animation to re-position actor");
10561 Actor actor = Actor::New();
10562 Stage::GetCurrent().Add(actor);
10563 Vector3 initialSize( 10.0f, 10.0f, 10.0f);
10564 Vector3 initialPosition(10.0f, 10.0f, 10.0f);
10566 actor.SetProperty( Actor::Property::SIZE, initialSize );
10567 actor.SetProperty( Actor::Property::POSITION, initialPosition );
10569 // Build the animation
10570 Animation animation = Animation::New(2.0f);
10572 tet_infoline("Set target size in animation without intiating play");
10573 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
10574 tet_infoline("Set target position in animation without intiating play");
10575 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[0], AlphaFunction::LINEAR);
10576 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
10578 application.SendNotification();
10579 application.Render();
10581 tet_infoline("Ensure position of actor is still at intial size and position");
10583 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
10584 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
10585 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
10587 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialPosition.x, TEST_LOCATION );
10588 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialPosition.y, TEST_LOCATION );
10589 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialPosition.z, TEST_LOCATION );
10591 tet_infoline("Play animation and ensure actor position and size is now matches targets");
10594 application.SendNotification();
10595 application.Render(2000u);
10597 tet_infoline("Ensure position and size of actor is at target value when aninmation playing");
10599 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
10600 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
10601 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
10603 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[0].x, TEST_LOCATION );
10604 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[0].y, TEST_LOCATION );
10605 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[0].z, TEST_LOCATION );
10610 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionColourP(void)
10612 tet_infoline("Setting up an animation should not effect it's size property until the animation plays even if other Properties animated");
10614 TestApplication application;
10616 std::vector<Vector3> targetSizes;
10617 std::vector<float> targetColors;
10619 targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
10620 targetSizes.push_back( Vector3( 50.0f, 10.0f, 150.0f ) );
10622 targetColors.push_back( 1.0f );
10624 tet_infoline("Set initial position and set up animation to re-position actor");
10626 Actor actor = Actor::New();
10627 Stage::GetCurrent().Add(actor);
10628 Vector3 initialSize( 10.0f, 5.0f, 10.0f);
10630 actor.SetProperty( Actor::Property::SIZE, initialSize );
10632 // Build the animation
10633 Animation animation = Animation::New(2.0f);
10635 tet_infoline("Set target size in animation without initiating play");
10636 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
10637 tet_infoline("Set target position in animation without intiating play");
10638 animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetColors[0], AlphaFunction::LINEAR);
10639 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
10641 application.SendNotification();
10642 application.Render();
10644 tet_infoline("Ensure position of actor is still at initial size and position");
10646 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
10647 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
10648 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
10650 tet_infoline("Play animation and ensure actor position and size is now matches targets");
10653 application.SendNotification();
10654 application.Render(2000u);
10656 tet_infoline("Ensure position and size of actor is at target value when animation playing");
10658 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
10659 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
10660 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
10662 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColors[0], TEST_LOCATION );
10667 int UtcDaliAnimationTimePeriodOrder(void)
10669 tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place" );
10671 TestApplication application;
10673 Actor actor = Actor::New();
10674 Stage::GetCurrent().Add( actor );
10676 application.SendNotification();
10677 application.Render();
10679 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
10680 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10681 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10682 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10683 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10685 //////////////////////////////////////////////////////////////////////////////////
10687 tet_infoline( "With two AnimateTo calls" );
10689 Animation animation = Animation::New( 0.0f );
10690 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
10691 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
10694 tet_infoline( "The target position should change instantly" );
10695 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
10696 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
10698 application.SendNotification();
10699 application.Render(5000); // After the animation is complete
10701 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
10702 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
10703 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
10705 //////////////////////////////////////////////////////////////////////////////////
10707 tet_infoline( "Same animation again but in a different order - should yield the same result" );
10709 actor.SetX( 0.0f );
10710 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10711 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10713 application.SendNotification();
10714 application.Render();
10716 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
10717 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10718 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10720 animation = Animation::New( 0.0f );
10721 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
10722 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
10725 tet_infoline( "The target position should change instantly" );
10726 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
10727 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
10729 application.SendNotification();
10730 application.Render(5000); // After the animation is complete
10732 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
10733 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
10734 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
10739 int UtcDaliAnimationTimePeriodOrderSeveralAnimateToCalls(void)
10741 tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place with several AnimateTo calls" );
10743 TestApplication application;
10745 Actor actor = Actor::New();
10746 Stage::GetCurrent().Add( actor );
10748 application.SendNotification();
10749 application.Render();
10751 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
10752 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10753 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10754 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10755 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10757 //////////////////////////////////////////////////////////////////////////////////
10759 tet_infoline( "" );
10761 Animation animation = Animation::New( 0.0f );
10762 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
10763 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
10764 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
10765 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) );
10766 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) );
10767 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
10770 tet_infoline( "The target position should change instantly" );
10771 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
10772 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
10774 application.SendNotification();
10775 application.Render(14000); // After the animation is complete
10777 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
10778 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
10779 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
10781 //////////////////////////////////////////////////////////////////////////////////
10783 tet_infoline( "Same animation again but in a different order - should end up at the same point" );
10785 actor.SetX( 0.0f );
10787 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10788 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10790 application.SendNotification();
10791 application.Render();
10793 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
10794 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10795 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10797 animation = Animation::New( 0.0f );
10798 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) );
10799 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
10800 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
10801 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
10802 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) );
10803 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
10806 tet_infoline( "The target position should change instantly" );
10807 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
10808 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
10810 application.SendNotification();
10811 application.Render(14000); // After the animation is complete
10813 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
10814 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
10815 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );