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 bool signalReceived(false);
2810 AnimationFinishCheck finishCheck(signalReceived);
2811 animation.FinishedSignal().Connect(&application, finishCheck);
2813 application.SendNotification();
2814 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2816 // We didn't expect the animation to finish yet
2817 application.SendNotification();
2818 finishCheck.CheckSignalNotReceived();
2819 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
2821 application.SendNotification();
2822 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2824 // We did expect the animation to finish
2825 application.SendNotification();
2826 finishCheck.CheckSignalReceived();
2827 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2829 // Check that nothing has changed after a couple of buffer swaps
2830 application.Render(0);
2831 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2832 application.Render(0);
2833 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2835 // Repeat with relative value "false" - this should be an NOOP
2836 animation = Animation::New(durationSeconds);
2837 bool noOpValue(false);
2838 animation.AnimateBy(Property(actor, index), noOpValue);
2840 // Start the animation
2843 finishCheck.Reset();
2844 animation.FinishedSignal().Connect(&application, finishCheck);
2846 application.SendNotification();
2847 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2849 // We didn't expect the animation to finish yet
2850 application.SendNotification();
2851 finishCheck.CheckSignalNotReceived();
2852 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2854 application.SendNotification();
2855 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2857 // We did expect the animation to finish
2858 application.SendNotification();
2859 finishCheck.CheckSignalReceived();
2860 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2862 // Check that nothing has changed after a couple of buffer swaps
2863 application.Render(0);
2864 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2865 application.Render(0);
2866 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2870 int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void)
2872 TestApplication application;
2874 Actor actor = Actor::New();
2876 // Register a boolean property
2877 bool startValue(false);
2878 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2879 Stage::GetCurrent().Add(actor);
2880 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2881 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
2883 // Build the animation
2884 float durationSeconds(2.0f);
2885 Animation animation = Animation::New(durationSeconds);
2886 bool relativeValue(true);
2887 bool finalValue( false || relativeValue );
2888 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN);
2890 // Start the animation
2893 bool signalReceived(false);
2894 AnimationFinishCheck finishCheck(signalReceived);
2895 animation.FinishedSignal().Connect(&application, finishCheck);
2897 application.SendNotification();
2898 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2900 // We didn't expect the animation to finish yet
2901 application.SendNotification();
2902 finishCheck.CheckSignalNotReceived();
2903 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
2905 application.SendNotification();
2906 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2908 // We did expect the animation to finish
2909 application.SendNotification();
2910 finishCheck.CheckSignalReceived();
2911 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2913 // Check that nothing has changed after a couple of buffer swaps
2914 application.Render(0);
2915 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2916 application.Render(0);
2917 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2919 // Repeat with relative value "false" - this should be an NOOP
2920 animation = Animation::New(durationSeconds);
2921 bool noOpValue(false);
2922 animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunction::EASE_IN);
2924 // Start the animation
2927 finishCheck.Reset();
2928 animation.FinishedSignal().Connect(&application, finishCheck);
2930 application.SendNotification();
2931 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2933 // We didn't expect the animation to finish yet
2934 application.SendNotification();
2935 finishCheck.CheckSignalNotReceived();
2936 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2938 application.SendNotification();
2939 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2941 // We did expect the animation to finish
2942 application.SendNotification();
2943 finishCheck.CheckSignalReceived();
2944 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2948 int UtcDaliAnimationAnimateByBooleanTimePeriodP(void)
2950 TestApplication application;
2952 Actor actor = Actor::New();
2954 // Register a boolean property
2955 bool startValue(false);
2956 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2957 Stage::GetCurrent().Add(actor);
2958 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2959 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
2961 // Build the animation
2962 float durationSeconds(2.0f);
2963 Animation animation = Animation::New(durationSeconds);
2964 bool relativeValue(true);
2965 bool finalValue( false || relativeValue );
2966 float animatorDurationSeconds(durationSeconds * 0.5f);
2967 animation.AnimateBy( Property(actor, index),
2969 TimePeriod( animatorDurationSeconds ) );
2971 // Start the animation
2974 bool signalReceived(false);
2975 AnimationFinishCheck finishCheck(signalReceived);
2976 animation.FinishedSignal().Connect(&application, finishCheck);
2978 application.SendNotification();
2979 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
2981 // We didn't expect the animation to finish yet
2982 application.SendNotification();
2983 finishCheck.CheckSignalNotReceived();
2984 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
2986 application.SendNotification();
2987 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
2989 // We didn't expect the animation to finish yet...
2990 application.SendNotification();
2991 finishCheck.CheckSignalNotReceived();
2993 // ...however we should have reached the final value
2994 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2996 application.SendNotification();
2997 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
2999 // We did expect the animation to finish
3000 application.SendNotification();
3001 finishCheck.CheckSignalReceived();
3002 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
3004 // Check that nothing has changed after a couple of buffer swaps
3005 application.Render(0);
3006 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
3007 application.Render(0);
3008 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
3012 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void)
3014 TestApplication application;
3016 Actor actor = Actor::New();
3018 // Register a boolean property
3019 bool startValue(false);
3020 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3021 Stage::GetCurrent().Add(actor);
3022 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3023 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
3025 // Build the animation
3026 float durationSeconds(2.0f);
3027 Animation animation = Animation::New(durationSeconds);
3028 bool relativeValue(true);
3029 bool finalValue( false || relativeValue );
3030 float animatorDurationSeconds(durationSeconds * 0.5f);
3031 animation.AnimateBy( Property(actor, index),
3033 AlphaFunction::EASE_IN_OUT,
3034 TimePeriod( animatorDurationSeconds ) );
3036 // Start the animation
3039 bool signalReceived(false);
3040 AnimationFinishCheck finishCheck(signalReceived);
3041 animation.FinishedSignal().Connect(&application, finishCheck);
3043 application.SendNotification();
3044 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
3046 // We didn't expect the animation to finish yet
3047 application.SendNotification();
3048 finishCheck.CheckSignalNotReceived();
3049 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
3051 application.SendNotification();
3052 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
3054 // We didn't expect the animation to finish yet...
3055 application.SendNotification();
3056 finishCheck.CheckSignalNotReceived();
3058 // ...however we should have reached the final value
3059 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
3061 application.SendNotification();
3062 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
3064 // We did expect the animation to finish
3065 application.SendNotification();
3066 finishCheck.CheckSignalReceived();
3067 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
3069 // Check that nothing has changed after a couple of buffer swaps
3070 application.Render(0);
3071 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
3072 application.Render(0);
3073 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
3077 int UtcDaliAnimationAnimateByFloatP(void)
3079 TestApplication application;
3081 Actor actor = Actor::New();
3083 // Register a float property
3084 float startValue(10.0f);
3085 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3086 Stage::GetCurrent().Add(actor);
3087 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3088 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
3090 // Build the animation
3091 float durationSeconds(2.0f);
3092 Animation animation = Animation::New(durationSeconds);
3093 float targetValue(50.0f);
3094 float relativeValue(targetValue - startValue);
3095 animation.AnimateBy(Property(actor, index), relativeValue);
3097 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3099 // Start the animation
3102 bool signalReceived(false);
3103 AnimationFinishCheck finishCheck(signalReceived);
3104 animation.FinishedSignal().Connect(&application, finishCheck);
3106 application.SendNotification();
3107 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3109 // We didn't expect the animation to finish yet
3110 application.SendNotification();
3111 finishCheck.CheckSignalNotReceived();
3112 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
3114 application.SendNotification();
3115 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3117 // We did expect the animation to finish
3118 application.SendNotification();
3119 finishCheck.CheckSignalReceived();
3120 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3122 // Check that nothing has changed after a couple of buffer swaps
3123 application.Render(0);
3124 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3125 application.Render(0);
3126 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3130 int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void)
3132 TestApplication application;
3134 Actor actor = Actor::New();
3136 // Register a float property
3137 float startValue(10.0f);
3138 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3139 Stage::GetCurrent().Add(actor);
3140 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3141 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
3143 // Build the animation
3144 float durationSeconds(1.0f);
3145 Animation animation = Animation::New(durationSeconds);
3146 float targetValue(90.0f);
3147 float relativeValue(targetValue - startValue);
3148 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3150 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3152 // Start the animation
3155 bool signalReceived(false);
3156 AnimationFinishCheck finishCheck(signalReceived);
3157 animation.FinishedSignal().Connect(&application, finishCheck);
3159 application.SendNotification();
3160 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3162 // We didn't expect the animation to finish yet
3163 application.SendNotification();
3164 finishCheck.CheckSignalNotReceived();
3166 // The position should have moved more, than with a linear alpha function
3167 float current( DevelHandle::GetCurrentProperty< float >( actor, index ) );
3168 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3170 application.SendNotification();
3171 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3173 // We did expect the animation to finish
3174 application.SendNotification();
3175 finishCheck.CheckSignalReceived();
3176 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3178 // Check that nothing has changed after a couple of buffer swaps
3179 application.Render(0);
3180 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3181 application.Render(0);
3182 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3186 int UtcDaliAnimationAnimateByFloatTimePeriodP(void)
3188 TestApplication application;
3190 Actor actor = Actor::New();
3192 // Register a float property
3193 float startValue(10.0f);
3194 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3195 Stage::GetCurrent().Add(actor);
3196 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3197 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
3199 // Build the animation
3200 float durationSeconds(1.0f);
3201 Animation animation = Animation::New(durationSeconds);
3202 float targetValue(30.0f);
3203 float relativeValue(targetValue - startValue);
3205 animation.AnimateBy(Property(actor, index),
3207 TimePeriod(delay, durationSeconds - delay));
3209 // Start the animation
3212 bool signalReceived(false);
3213 AnimationFinishCheck finishCheck(signalReceived);
3214 animation.FinishedSignal().Connect(&application, finishCheck);
3216 application.SendNotification();
3217 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3219 // We didn't expect the animation to finish yet
3220 application.SendNotification();
3221 finishCheck.CheckSignalNotReceived();
3222 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
3224 application.SendNotification();
3225 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3227 // We didn't expect the animation to finish yet
3228 application.SendNotification();
3229 finishCheck.CheckSignalNotReceived();
3230 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3232 application.SendNotification();
3233 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3235 // We did expect the animation to finish
3236 application.SendNotification();
3237 finishCheck.CheckSignalReceived();
3238 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3240 // Check that nothing has changed after a couple of buffer swaps
3241 application.Render(0);
3242 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3243 application.Render(0);
3244 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3248 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void)
3250 TestApplication application;
3252 Actor actor = Actor::New();
3254 // Register a float property
3255 float startValue(10.0f);
3256 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3257 Stage::GetCurrent().Add(actor);
3258 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3259 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
3261 // Build the animation
3262 float durationSeconds(1.0f);
3263 Animation animation = Animation::New(durationSeconds);
3264 float targetValue(30.0f);
3265 float relativeValue(targetValue - startValue);
3267 animation.AnimateBy(Property(actor, index),
3269 AlphaFunction::LINEAR,
3270 TimePeriod(delay, durationSeconds - delay));
3272 // Start the animation
3275 bool signalReceived(false);
3276 AnimationFinishCheck finishCheck(signalReceived);
3277 animation.FinishedSignal().Connect(&application, finishCheck);
3279 application.SendNotification();
3280 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3282 // We didn't expect the animation to finish yet
3283 application.SendNotification();
3284 finishCheck.CheckSignalNotReceived();
3285 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
3287 application.SendNotification();
3288 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3290 // We didn't expect the animation to finish yet
3291 application.SendNotification();
3292 finishCheck.CheckSignalNotReceived();
3293 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3295 application.SendNotification();
3296 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3298 // We did expect the animation to finish
3299 application.SendNotification();
3300 finishCheck.CheckSignalReceived();
3301 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3303 // Check that nothing has changed after a couple of buffer swaps
3304 application.Render(0);
3305 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3306 application.Render(0);
3307 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3311 int UtcDaliAnimationAnimateByIntegerP(void)
3313 TestApplication application;
3315 Actor actor = Actor::New();
3317 // Register an integer property
3319 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3320 Stage::GetCurrent().Add(actor);
3321 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3322 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
3324 // Build the animation
3325 float durationSeconds(2.0f);
3326 Animation animation = Animation::New(durationSeconds);
3327 int targetValue(50);
3328 int relativeValue(targetValue - startValue);
3329 animation.AnimateBy(Property(actor, index), relativeValue);
3331 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3333 // Start the animation
3336 bool signalReceived(false);
3337 AnimationFinishCheck finishCheck(signalReceived);
3338 animation.FinishedSignal().Connect(&application, finishCheck);
3340 application.SendNotification();
3341 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3343 // We didn't expect the animation to finish yet
3344 application.SendNotification();
3345 finishCheck.CheckSignalNotReceived();
3346 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
3348 application.SendNotification();
3349 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3351 // We did expect the animation to finish
3352 application.SendNotification();
3353 finishCheck.CheckSignalReceived();
3354 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3356 // Check that nothing has changed after a couple of buffer swaps
3357 application.Render(0);
3358 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3359 application.Render(0);
3360 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3364 int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void)
3366 TestApplication application;
3368 Actor actor = Actor::New();
3370 // Register an integer property
3372 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3373 Stage::GetCurrent().Add(actor);
3374 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3375 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
3377 // Build the animation
3378 float durationSeconds(1.0f);
3379 Animation animation = Animation::New(durationSeconds);
3380 int targetValue(90);
3381 int relativeValue(targetValue - startValue);
3382 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3384 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3386 // Start the animation
3389 bool signalReceived(false);
3390 AnimationFinishCheck finishCheck(signalReceived);
3391 animation.FinishedSignal().Connect(&application, finishCheck);
3393 application.SendNotification();
3394 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3396 // We didn't expect the animation to finish yet
3397 application.SendNotification();
3398 finishCheck.CheckSignalNotReceived();
3400 // The position should have moved more, than with a linear alpha function
3401 int current( DevelHandle::GetCurrentProperty< int >( actor, index ) );
3402 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3404 application.SendNotification();
3405 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3407 // We did expect the animation to finish
3408 application.SendNotification();
3409 finishCheck.CheckSignalReceived();
3410 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3412 // Check that nothing has changed after a couple of buffer swaps
3413 application.Render(0);
3414 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3415 application.Render(0);
3416 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3420 int UtcDaliAnimationAnimateByIntegerTimePeriodP(void)
3422 TestApplication application;
3424 Actor actor = Actor::New();
3426 // Register an integer property
3428 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3429 Stage::GetCurrent().Add(actor);
3430 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3431 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
3433 // Build the animation
3434 float durationSeconds(1.0f);
3435 Animation animation = Animation::New(durationSeconds);
3436 int targetValue(30);
3437 int relativeValue(targetValue - startValue);
3439 animation.AnimateBy(Property(actor, index),
3441 TimePeriod(delay, durationSeconds - delay));
3443 // Start the animation
3446 bool signalReceived(false);
3447 AnimationFinishCheck finishCheck(signalReceived);
3448 animation.FinishedSignal().Connect(&application, finishCheck);
3450 application.SendNotification();
3451 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3453 // We didn't expect the animation to finish yet
3454 application.SendNotification();
3455 finishCheck.CheckSignalNotReceived();
3456 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
3458 application.SendNotification();
3459 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3461 // We didn't expect the animation to finish yet
3462 application.SendNotification();
3463 finishCheck.CheckSignalNotReceived();
3464 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3466 application.SendNotification();
3467 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3469 // We did expect the animation to finish
3470 application.SendNotification();
3471 finishCheck.CheckSignalReceived();
3472 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3474 // Check that nothing has changed after a couple of buffer swaps
3475 application.Render(0);
3476 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3477 application.Render(0);
3478 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3482 int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void)
3484 TestApplication application;
3486 Actor actor = Actor::New();
3488 // Register an integer property
3490 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3491 Stage::GetCurrent().Add(actor);
3492 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3493 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
3495 // Build the animation
3496 float durationSeconds(1.0f);
3497 Animation animation = Animation::New(durationSeconds);
3498 int targetValue(30);
3499 int relativeValue(targetValue - startValue);
3501 animation.AnimateBy(Property(actor, index),
3503 AlphaFunction::LINEAR,
3504 TimePeriod(delay, durationSeconds - delay));
3506 // Start the animation
3509 bool signalReceived(false);
3510 AnimationFinishCheck finishCheck(signalReceived);
3511 animation.FinishedSignal().Connect(&application, finishCheck);
3513 application.SendNotification();
3514 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3516 // We didn't expect the animation to finish yet
3517 application.SendNotification();
3518 finishCheck.CheckSignalNotReceived();
3519 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
3521 application.SendNotification();
3522 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3524 // We didn't expect the animation to finish yet
3525 application.SendNotification();
3526 finishCheck.CheckSignalNotReceived();
3527 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3529 application.SendNotification();
3530 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3532 // We did expect the animation to finish
3533 application.SendNotification();
3534 finishCheck.CheckSignalReceived();
3535 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3537 // Check that nothing has changed after a couple of buffer swaps
3538 application.Render(0);
3539 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3540 application.Render(0);
3541 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3545 int UtcDaliAnimationAnimateByVector2P(void)
3547 TestApplication application;
3549 Actor actor = Actor::New();
3551 // Register a Vector2 property
3552 Vector2 startValue(10.0f, 10.0f);
3553 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3554 Stage::GetCurrent().Add(actor);
3555 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3556 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
3558 // Build the animation
3559 float durationSeconds(2.0f);
3560 Animation animation = Animation::New(durationSeconds);
3561 Vector2 targetValue(60.0f, 60.0f);
3562 Vector2 relativeValue(targetValue - startValue);
3563 animation.AnimateBy(Property(actor, index), relativeValue);
3565 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3567 // Start the animation
3570 bool signalReceived(false);
3571 AnimationFinishCheck finishCheck(signalReceived);
3572 animation.FinishedSignal().Connect(&application, finishCheck);
3574 application.SendNotification();
3575 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3577 // We didn't expect the animation to finish yet
3578 application.SendNotification();
3579 finishCheck.CheckSignalNotReceived();
3580 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
3582 application.SendNotification();
3583 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3585 // We did expect the animation to finish
3586 application.SendNotification();
3587 finishCheck.CheckSignalReceived();
3588 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3590 // Check that nothing has changed after a couple of buffer swaps
3591 application.Render(0);
3592 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3593 application.Render(0);
3594 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3598 int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void)
3600 TestApplication application;
3602 Actor actor = Actor::New();
3604 // Register a Vector2 property
3605 Vector2 startValue(100.0f, 100.0f);
3606 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3607 Stage::GetCurrent().Add(actor);
3608 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3609 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
3611 // Build the animation
3612 float durationSeconds(1.0f);
3613 Animation animation = Animation::New(durationSeconds);
3614 Vector2 targetValue(20.0f, 20.0f);
3615 Vector2 relativeValue(targetValue - startValue);
3616 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3618 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3620 // Start the animation
3623 bool signalReceived(false);
3624 AnimationFinishCheck finishCheck(signalReceived);
3625 animation.FinishedSignal().Connect(&application, finishCheck);
3627 application.SendNotification();
3628 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3630 // We didn't expect the animation to finish yet
3631 application.SendNotification();
3632 finishCheck.CheckSignalNotReceived();
3634 // The position should have moved more, than with a linear alpha function
3635 Vector2 current( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ) );
3636 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3637 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3639 application.SendNotification();
3640 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3642 // We did expect the animation to finish
3643 application.SendNotification();
3644 finishCheck.CheckSignalReceived();
3645 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3647 // Check that nothing has changed after a couple of buffer swaps
3648 application.Render(0);
3649 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3650 application.Render(0);
3651 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3655 int UtcDaliAnimationAnimateByVector2TimePeriodP(void)
3657 TestApplication application;
3659 Actor actor = Actor::New();
3661 // Register a Vector2 property
3662 Vector2 startValue(10.0f, 10.0f);
3663 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3664 Stage::GetCurrent().Add(actor);
3665 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3666 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
3668 // Build the animation
3669 float durationSeconds(1.0f);
3670 Animation animation = Animation::New(durationSeconds);
3671 Vector2 targetValue(30.0f, 30.0f);
3672 Vector2 relativeValue(targetValue - startValue);
3674 animation.AnimateBy(Property(actor, index),
3676 TimePeriod(delay, durationSeconds - delay));
3678 // Start the animation
3681 bool signalReceived(false);
3682 AnimationFinishCheck finishCheck(signalReceived);
3683 animation.FinishedSignal().Connect(&application, finishCheck);
3685 application.SendNotification();
3686 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3688 // We didn't expect the animation to finish yet
3689 application.SendNotification();
3690 finishCheck.CheckSignalNotReceived();
3691 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
3693 application.SendNotification();
3694 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3696 // We didn't expect the animation to finish yet
3697 application.SendNotification();
3698 finishCheck.CheckSignalNotReceived();
3699 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3701 application.SendNotification();
3702 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3704 // We did expect the animation to finish
3705 application.SendNotification();
3706 finishCheck.CheckSignalReceived();
3707 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3709 // Check that nothing has changed after a couple of buffer swaps
3710 application.Render(0);
3711 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3712 application.Render(0);
3713 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3717 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void)
3719 TestApplication application;
3721 Actor actor = Actor::New();
3723 // Register a Vector2 property
3724 Vector2 startValue(5.0f, 5.0f);
3725 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3726 Stage::GetCurrent().Add(actor);
3727 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3728 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
3730 // Build the animation
3731 float durationSeconds(1.0f);
3732 Animation animation = Animation::New(durationSeconds);
3733 Vector2 targetValue(10.0f, 10.0f);
3734 Vector2 relativeValue(targetValue - startValue);
3736 animation.AnimateBy(Property(actor, index),
3738 AlphaFunction::LINEAR,
3739 TimePeriod(delay, durationSeconds - delay));
3741 // Start the animation
3744 bool signalReceived(false);
3745 AnimationFinishCheck finishCheck(signalReceived);
3746 animation.FinishedSignal().Connect(&application, finishCheck);
3748 application.SendNotification();
3749 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3751 // We didn't expect the animation to finish yet
3752 application.SendNotification();
3753 finishCheck.CheckSignalNotReceived();
3754 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
3756 application.SendNotification();
3757 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3759 // We didn't expect the animation to finish yet
3760 application.SendNotification();
3761 finishCheck.CheckSignalNotReceived();
3762 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3764 application.SendNotification();
3765 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3767 // We did expect the animation to finish
3768 application.SendNotification();
3769 finishCheck.CheckSignalReceived();
3770 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3772 // Check that nothing has changed after a couple of buffer swaps
3773 application.Render(0);
3774 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3775 application.Render(0);
3776 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3780 int UtcDaliAnimationAnimateByVector3P(void)
3782 TestApplication application;
3784 Actor actor = Actor::New();
3786 // Register a Vector3 property
3787 Vector3 startValue(10.0f, 10.0f, 10.0f);
3788 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3789 Stage::GetCurrent().Add(actor);
3790 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3791 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
3793 // Build the animation
3794 float durationSeconds(2.0f);
3795 Animation animation = Animation::New(durationSeconds);
3796 Vector3 targetValue(60.0f, 60.0f, 60.0f);
3797 Vector3 relativeValue(targetValue - startValue);
3798 animation.AnimateBy(Property(actor, index), relativeValue);
3800 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3802 // Start the animation
3805 bool signalReceived(false);
3806 AnimationFinishCheck finishCheck(signalReceived);
3807 animation.FinishedSignal().Connect(&application, finishCheck);
3809 application.SendNotification();
3810 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3812 // We didn't expect the animation to finish yet
3813 application.SendNotification();
3814 finishCheck.CheckSignalNotReceived();
3815 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
3817 application.SendNotification();
3818 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3820 // We did expect the animation to finish
3821 application.SendNotification();
3822 finishCheck.CheckSignalReceived();
3823 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3825 // Check that nothing has changed after a couple of buffer swaps
3826 application.Render(0);
3827 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3828 application.Render(0);
3829 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3833 int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void)
3835 TestApplication application;
3837 Actor actor = Actor::New();
3839 // Register a Vector3 property
3840 Vector3 startValue(100.0f, 100.0f, 100.0f);
3841 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3842 Stage::GetCurrent().Add(actor);
3843 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3844 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
3846 // Build the animation
3847 float durationSeconds(1.0f);
3848 Animation animation = Animation::New(durationSeconds);
3849 Vector3 targetValue(20.0f, 20.0f, 20.0f);
3850 Vector3 relativeValue(targetValue - startValue);
3851 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3853 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3855 // Start the animation
3858 bool signalReceived(false);
3859 AnimationFinishCheck finishCheck(signalReceived);
3860 animation.FinishedSignal().Connect(&application, finishCheck);
3862 application.SendNotification();
3863 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3865 // We didn't expect the animation to finish yet
3866 application.SendNotification();
3867 finishCheck.CheckSignalNotReceived();
3869 // The position should have moved more, than with a linear alpha function
3870 Vector3 current(DevelHandle::GetCurrentProperty< Vector3 >( actor, index ));
3871 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3872 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3873 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
3875 application.SendNotification();
3876 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3878 // We did expect the animation to finish
3879 application.SendNotification();
3880 finishCheck.CheckSignalReceived();
3881 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3883 // Check that nothing has changed after a couple of buffer swaps
3884 application.Render(0);
3885 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3886 application.Render(0);
3887 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3891 int UtcDaliAnimationAnimateByVector3TimePeriodP(void)
3893 TestApplication application;
3895 Actor actor = Actor::New();
3897 // Register a Vector3 property
3898 Vector3 startValue(10.0f, 10.0f, 10.0f);
3899 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3900 Stage::GetCurrent().Add(actor);
3901 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3902 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
3904 // Build the animation
3905 float durationSeconds(1.0f);
3906 Animation animation = Animation::New(durationSeconds);
3907 Vector3 targetValue(30.0f, 30.0f, 30.0f);
3908 Vector3 relativeValue(targetValue - startValue);
3910 animation.AnimateBy(Property(actor, index),
3912 TimePeriod(delay, durationSeconds - delay));
3914 // Start the animation
3917 bool signalReceived(false);
3918 AnimationFinishCheck finishCheck(signalReceived);
3919 animation.FinishedSignal().Connect(&application, finishCheck);
3921 application.SendNotification();
3922 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3924 // We didn't expect the animation to finish yet
3925 application.SendNotification();
3926 finishCheck.CheckSignalNotReceived();
3927 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
3929 application.SendNotification();
3930 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3932 // We didn't expect the animation to finish yet
3933 application.SendNotification();
3934 finishCheck.CheckSignalNotReceived();
3935 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3937 application.SendNotification();
3938 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3940 // We did expect the animation to finish
3941 application.SendNotification();
3942 finishCheck.CheckSignalReceived();
3943 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3945 // Check that nothing has changed after a couple of buffer swaps
3946 application.Render(0);
3947 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3948 application.Render(0);
3949 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3953 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void)
3955 TestApplication application;
3957 Actor actor = Actor::New();
3959 // Register a Vector3 property
3960 Vector3 startValue(5.0f, 5.0f, 5.0f);
3961 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3962 Stage::GetCurrent().Add(actor);
3963 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3964 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
3966 // Build the animation
3967 float durationSeconds(1.0f);
3968 Animation animation = Animation::New(durationSeconds);
3969 Vector3 targetValue(10.0f, 10.0f, 10.0f);
3970 Vector3 relativeValue(targetValue - startValue);
3972 animation.AnimateBy(Property(actor, index),
3974 AlphaFunction::LINEAR,
3975 TimePeriod(delay, durationSeconds - delay));
3977 // Start the animation
3980 bool signalReceived(false);
3981 AnimationFinishCheck finishCheck(signalReceived);
3982 animation.FinishedSignal().Connect(&application, finishCheck);
3984 application.SendNotification();
3985 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3987 // We didn't expect the animation to finish yet
3988 application.SendNotification();
3989 finishCheck.CheckSignalNotReceived();
3990 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
3992 application.SendNotification();
3993 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3995 // We didn't expect the animation to finish yet
3996 application.SendNotification();
3997 finishCheck.CheckSignalNotReceived();
3998 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4000 application.SendNotification();
4001 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4003 // We did expect the animation to finish
4004 application.SendNotification();
4005 finishCheck.CheckSignalReceived();
4006 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
4008 // Check that nothing has changed after a couple of buffer swaps
4009 application.Render(0);
4010 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
4011 application.Render(0);
4012 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
4016 int UtcDaliAnimationAnimateByVector4P(void)
4018 TestApplication application;
4020 Actor actor = Actor::New();
4022 // Register a Vector4 property
4023 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4024 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4025 Stage::GetCurrent().Add(actor);
4026 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4027 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
4029 // Build the animation
4030 float durationSeconds(2.0f);
4031 Animation animation = Animation::New(durationSeconds);
4032 Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f);
4033 Vector4 relativeValue(targetValue - startValue);
4034 animation.AnimateBy(Property(actor, index), relativeValue);
4036 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4038 // Start the animation
4041 bool signalReceived(false);
4042 AnimationFinishCheck finishCheck(signalReceived);
4043 animation.FinishedSignal().Connect(&application, finishCheck);
4045 application.SendNotification();
4046 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4048 // We didn't expect the animation to finish yet
4049 application.SendNotification();
4050 finishCheck.CheckSignalNotReceived();
4051 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
4053 application.SendNotification();
4054 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4056 // We did expect the animation to finish
4057 application.SendNotification();
4058 finishCheck.CheckSignalReceived();
4059 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4061 // Check that nothing has changed after a couple of buffer swaps
4062 application.Render(0);
4063 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4064 application.Render(0);
4065 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4069 int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void)
4071 TestApplication application;
4073 Actor actor = Actor::New();
4075 // Register a Vector4 property
4076 Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f);
4077 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4078 Stage::GetCurrent().Add(actor);
4079 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4080 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
4082 // Build the animation
4083 float durationSeconds(1.0f);
4084 Animation animation = Animation::New(durationSeconds);
4085 Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
4086 Vector4 relativeValue(targetValue - startValue);
4087 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4089 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4091 // Start the animation
4094 bool signalReceived(false);
4095 AnimationFinishCheck finishCheck(signalReceived);
4096 animation.FinishedSignal().Connect(&application, finishCheck);
4098 application.SendNotification();
4099 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4101 // We didn't expect the animation to finish yet
4102 application.SendNotification();
4103 finishCheck.CheckSignalNotReceived();
4105 // The position should have moved more, than with a linear alpha function
4106 Vector4 current( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ) );
4107 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
4108 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
4109 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
4110 DALI_TEST_CHECK( current.w < ninetyFivePercentProgress.w );
4112 application.SendNotification();
4113 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4115 // We did expect the animation to finish
4116 application.SendNotification();
4117 finishCheck.CheckSignalReceived();
4118 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4120 // Check that nothing has changed after a couple of buffer swaps
4121 application.Render(0);
4122 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4123 application.Render(0);
4124 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4128 int UtcDaliAnimationAnimateByVector4TimePeriodP(void)
4130 TestApplication application;
4132 Actor actor = Actor::New();
4134 // Register a Vector4 property
4135 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4136 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4137 Stage::GetCurrent().Add(actor);
4138 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4139 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
4141 // Build the animation
4142 float durationSeconds(1.0f);
4143 Animation animation = Animation::New(durationSeconds);
4144 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
4145 Vector4 relativeValue(targetValue - startValue);
4147 animation.AnimateBy(Property(actor, index),
4149 TimePeriod(delay, durationSeconds - delay));
4151 // Start the animation
4154 bool signalReceived(false);
4155 AnimationFinishCheck finishCheck(signalReceived);
4156 animation.FinishedSignal().Connect(&application, finishCheck);
4158 application.SendNotification();
4159 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4161 // We didn't expect the animation to finish yet
4162 application.SendNotification();
4163 finishCheck.CheckSignalNotReceived();
4164 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
4166 application.SendNotification();
4167 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4169 // We didn't expect the animation to finish yet
4170 application.SendNotification();
4171 finishCheck.CheckSignalNotReceived();
4172 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4174 application.SendNotification();
4175 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4177 // We did expect the animation to finish
4178 application.SendNotification();
4179 finishCheck.CheckSignalReceived();
4180 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4182 // Check that nothing has changed after a couple of buffer swaps
4183 application.Render(0);
4184 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4185 application.Render(0);
4186 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4190 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void)
4192 TestApplication application;
4194 Actor actor = Actor::New();
4196 // Register a Vector4 property
4197 Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f);
4198 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4199 Stage::GetCurrent().Add(actor);
4200 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4201 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
4203 // Build the animation
4204 float durationSeconds(1.0f);
4205 Animation animation = Animation::New(durationSeconds);
4206 Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f);
4207 Vector4 relativeValue(targetValue - startValue);
4209 animation.AnimateBy(Property(actor, index),
4211 AlphaFunction::LINEAR,
4212 TimePeriod(delay, durationSeconds - delay));
4214 // Start the animation
4217 bool signalReceived(false);
4218 AnimationFinishCheck finishCheck(signalReceived);
4219 animation.FinishedSignal().Connect(&application, finishCheck);
4221 application.SendNotification();
4222 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4224 // We didn't expect the animation to finish yet
4225 application.SendNotification();
4226 finishCheck.CheckSignalNotReceived();
4227 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
4229 application.SendNotification();
4230 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4232 // We didn't expect the animation to finish yet
4233 application.SendNotification();
4234 finishCheck.CheckSignalNotReceived();
4235 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4237 application.SendNotification();
4238 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4240 // We did expect the animation to finish
4241 application.SendNotification();
4242 finishCheck.CheckSignalReceived();
4243 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4245 // Check that nothing has changed after a couple of buffer swaps
4246 application.Render(0);
4247 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4248 application.Render(0);
4249 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4253 int UtcDaliAnimationAnimateByActorPositionP(void)
4255 TestApplication application;
4257 Actor actor = Actor::New();
4258 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4259 actor.SetPosition(startPosition);
4260 Stage::GetCurrent().Add(actor);
4261 application.SendNotification();
4262 application.Render(0);
4263 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4265 // Build the animation
4266 float durationSeconds(1.0f);
4267 Animation animation = Animation::New(durationSeconds);
4268 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4269 Vector3 relativePosition(targetPosition - startPosition);
4270 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition);
4272 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4274 // Start the animation
4277 bool signalReceived(false);
4278 AnimationFinishCheck finishCheck(signalReceived);
4279 animation.FinishedSignal().Connect(&application, finishCheck);
4281 application.SendNotification();
4282 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4284 // We didn't expect the animation to finish yet
4285 application.SendNotification();
4286 finishCheck.CheckSignalNotReceived();
4287 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ninetyFivePercentProgress, TEST_LOCATION );
4289 application.SendNotification();
4290 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4292 // We did expect the animation to finish
4293 application.SendNotification();
4294 finishCheck.CheckSignalReceived();
4295 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4297 // Check that nothing has changed after a couple of buffer swaps
4298 application.Render(0);
4299 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4300 application.Render(0);
4301 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4305 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
4307 TestApplication application;
4309 Actor actor = Actor::New();
4310 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4311 actor.SetPosition(startPosition);
4312 Stage::GetCurrent().Add(actor);
4313 application.SendNotification();
4314 application.Render(0);
4315 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4317 // Build the animation
4318 float durationSeconds(1.0f);
4319 Animation animation = Animation::New(durationSeconds);
4320 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4321 Vector3 relativePosition(targetPosition - startPosition);
4322 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
4324 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4326 // Start the animation
4329 bool signalReceived(false);
4330 AnimationFinishCheck finishCheck(signalReceived);
4331 animation.FinishedSignal().Connect(&application, finishCheck);
4333 application.SendNotification();
4334 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4336 // We didn't expect the animation to finish yet
4337 application.SendNotification();
4338 finishCheck.CheckSignalNotReceived();
4340 // The position should have moved more, than with a linear alpha function
4341 Vector3 current(actor.GetCurrentPosition());
4342 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
4343 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
4344 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
4346 application.SendNotification();
4347 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4349 // We did expect the animation to finish
4350 application.SendNotification();
4351 finishCheck.CheckSignalReceived();
4352 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4354 // Check that nothing has changed after a couple of buffer swaps
4355 application.Render(0);
4356 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4357 application.Render(0);
4358 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4362 int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void)
4364 TestApplication application;
4366 Actor actor = Actor::New();
4367 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4368 actor.SetPosition(startPosition);
4369 Stage::GetCurrent().Add(actor);
4370 application.SendNotification();
4371 application.Render(0);
4372 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4374 // Build the animation
4375 float durationSeconds(1.0f);
4376 Animation animation = Animation::New(durationSeconds);
4377 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4378 Vector3 relativePosition(targetPosition - startPosition);
4380 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4382 TimePeriod(delay, durationSeconds - delay));
4384 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4386 // Start the animation
4389 bool signalReceived(false);
4390 AnimationFinishCheck finishCheck(signalReceived);
4391 animation.FinishedSignal().Connect(&application, finishCheck);
4393 application.SendNotification();
4394 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4396 // We didn't expect the animation to finish yet
4397 application.SendNotification();
4398 finishCheck.CheckSignalNotReceived();
4399 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4401 application.SendNotification();
4402 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4404 // We did expect the animation to finish
4405 application.SendNotification();
4406 finishCheck.CheckSignalReceived();
4407 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4409 // Check that nothing has changed after a couple of buffer swaps
4410 application.Render(0);
4411 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4412 application.Render(0);
4413 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4417 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void)
4419 TestApplication application;
4421 Actor actor = Actor::New();
4422 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4423 actor.SetPosition(startPosition);
4424 Stage::GetCurrent().Add(actor);
4425 application.SendNotification();
4426 application.Render(0);
4427 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4429 // Build the animation
4430 float durationSeconds(1.0f);
4431 Animation animation = Animation::New(durationSeconds);
4432 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4433 Vector3 relativePosition(targetPosition - startPosition);
4435 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4437 AlphaFunction::LINEAR,
4438 TimePeriod(delay, durationSeconds - delay));
4440 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4442 // Start the animation
4445 bool signalReceived(false);
4446 AnimationFinishCheck finishCheck(signalReceived);
4447 animation.FinishedSignal().Connect(&application, finishCheck);
4449 application.SendNotification();
4450 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4452 // We didn't expect the animation to finish yet
4453 application.SendNotification();
4454 finishCheck.CheckSignalNotReceived();
4455 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4457 application.SendNotification();
4458 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4460 // We did expect the animation to finish
4461 application.SendNotification();
4462 finishCheck.CheckSignalReceived();
4463 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4465 // Check that nothing has changed after a couple of buffer swaps
4466 application.Render(0);
4467 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4468 application.Render(0);
4469 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4473 int UtcDaliAnimationAnimateByActorOrientationP1(void)
4475 TestApplication application;
4477 Actor actor = Actor::New();
4478 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4479 Stage::GetCurrent().Add(actor);
4480 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4482 // Build the animation
4483 float durationSeconds(1.0f);
4484 Animation animation = Animation::New(durationSeconds);
4485 Degree relativeRotationDegrees(360.0f);
4486 Radian relativeRotationRadians(relativeRotationDegrees);
4487 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ) );
4489 // Start the animation
4492 bool signalReceived(false);
4493 AnimationFinishCheck finishCheck(signalReceived);
4494 animation.FinishedSignal().Connect(&application, finishCheck);
4496 application.SendNotification();
4497 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4499 // We didn't expect the animation to finish yet
4500 application.SendNotification();
4501 finishCheck.CheckSignalNotReceived();
4502 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4504 application.SendNotification();
4505 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4507 // We didn't expect the animation to finish yet
4508 application.SendNotification();
4509 finishCheck.CheckSignalNotReceived();
4510 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4512 application.SendNotification();
4513 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4515 // We didn't expect the animation to finish yet
4516 application.SendNotification();
4517 finishCheck.CheckSignalNotReceived();
4518 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4520 application.SendNotification();
4521 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4523 // We did expect the animation to finish
4524 application.SendNotification();
4525 finishCheck.CheckSignalReceived();
4526 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4530 int UtcDaliAnimationAnimateByActorOrientationP2(void)
4532 TestApplication application;
4534 tet_printf("Testing that rotation angle > 360 performs full rotations\n");
4536 Actor actor = Actor::New();
4537 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
4538 Stage::GetCurrent().Add(actor);
4539 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4541 // Build the animation
4542 float durationSeconds(1.0f);
4543 Animation animation = Animation::New(durationSeconds);
4544 Degree relativeRotationDegrees(710.0f);
4545 Radian relativeRotationRadians(relativeRotationDegrees);
4547 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), AngleAxis( relativeRotationRadians, Vector3::ZAXIS ) );
4549 // Start the animation
4552 bool signalReceived(false);
4553 AnimationFinishCheck finishCheck(signalReceived);
4554 animation.FinishedSignal().Connect(&application, finishCheck);
4556 application.SendNotification();
4557 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4559 // We didn't expect the animation to finish yet
4560 application.SendNotification();
4561 finishCheck.CheckSignalNotReceived();
4562 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4564 application.SendNotification();
4565 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4567 // We didn't expect the animation to finish yet
4568 application.SendNotification();
4569 finishCheck.CheckSignalNotReceived();
4570 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4572 application.SendNotification();
4573 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4575 // We didn't expect the animation to finish yet
4576 application.SendNotification();
4577 finishCheck.CheckSignalNotReceived();
4578 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4580 application.SendNotification();
4581 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4583 // We did expect the animation to finish
4584 application.SendNotification();
4585 finishCheck.CheckSignalReceived();
4586 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4591 int UtcDaliAnimationAnimateByActorOrientationP3(void)
4593 TestApplication application;
4595 tet_printf("Testing that rotation angle > 360 performs partial rotations when cast to Quaternion\n");
4597 Actor actor = Actor::New();
4598 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
4599 Stage::GetCurrent().Add(actor);
4600 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4602 // Build the animation
4603 float durationSeconds(1.0f);
4604 Animation animation = Animation::New(durationSeconds);
4605 Degree relativeRotationDegrees(730.0f);
4606 Radian relativeRotationRadians(relativeRotationDegrees);
4608 Radian actualRotationRadians( Degree(10.0f) );
4610 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::ZAXIS ) );
4612 // Start the animation
4615 bool signalReceived(false);
4616 AnimationFinishCheck finishCheck(signalReceived);
4617 animation.FinishedSignal().Connect(&application, finishCheck);
4619 application.SendNotification();
4620 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4622 // We didn't expect the animation to finish yet
4623 application.SendNotification();
4624 finishCheck.CheckSignalNotReceived();
4625 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4627 application.SendNotification();
4628 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4630 // We didn't expect the animation to finish yet
4631 application.SendNotification();
4632 finishCheck.CheckSignalNotReceived();
4633 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4635 application.SendNotification();
4636 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4638 // We didn't expect the animation to finish yet
4639 application.SendNotification();
4640 finishCheck.CheckSignalNotReceived();
4641 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4643 application.SendNotification();
4644 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4646 // We did expect the animation to finish
4647 application.SendNotification();
4648 finishCheck.CheckSignalReceived();
4649 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4650 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4655 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
4657 TestApplication application;
4659 Actor actor = Actor::New();
4660 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4661 Stage::GetCurrent().Add(actor);
4662 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4664 // Build the animation
4665 float durationSeconds(1.0f);
4666 Animation animation = Animation::New(durationSeconds);
4667 Degree relativeRotationDegrees(360.0f);
4668 Radian relativeRotationRadians(relativeRotationDegrees);
4669 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ), AlphaFunction::EASE_IN );
4671 // Start the animation
4674 bool signalReceived(false);
4675 AnimationFinishCheck finishCheck(signalReceived);
4676 animation.FinishedSignal().Connect(&application, finishCheck);
4678 application.SendNotification();
4679 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4681 // We didn't expect the animation to finish yet
4682 application.SendNotification();
4683 finishCheck.CheckSignalNotReceived();
4684 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4686 application.SendNotification();
4687 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4689 // We didn't expect the animation to finish yet
4690 application.SendNotification();
4691 finishCheck.CheckSignalNotReceived();
4692 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4694 application.SendNotification();
4695 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4697 // We didn't expect the animation to finish yet
4698 application.SendNotification();
4699 finishCheck.CheckSignalNotReceived();
4700 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4702 application.SendNotification();
4703 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4705 // We did expect the animation to finish
4706 application.SendNotification();
4707 finishCheck.CheckSignalReceived();
4708 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4712 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void)
4714 TestApplication application;
4716 Actor actor = Actor::New();
4717 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4718 Stage::GetCurrent().Add(actor);
4719 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4721 // Build the animation
4722 float durationSeconds(1.0f);
4723 Animation animation = Animation::New(durationSeconds);
4724 Degree relativeRotationDegrees(360.0f);
4725 Radian relativeRotationRadians(relativeRotationDegrees);
4727 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ),
4728 AlphaFunction::EASE_IN, TimePeriod( delay, durationSeconds - delay ) );
4730 // Start the animation
4733 bool signalReceived(false);
4734 AnimationFinishCheck finishCheck(signalReceived);
4735 animation.FinishedSignal().Connect(&application, finishCheck);
4737 application.SendNotification();
4738 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4740 // We didn't expect the animation to finish yet
4741 application.SendNotification();
4742 finishCheck.CheckSignalNotReceived();
4743 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
4744 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4746 application.SendNotification();
4747 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4749 // We didn't expect the animation to finish yet
4750 application.SendNotification();
4751 finishCheck.CheckSignalNotReceived();
4752 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
4753 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4755 application.SendNotification();
4756 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4758 // We didn't expect the animation to finish yet
4759 application.SendNotification();
4760 finishCheck.CheckSignalNotReceived();
4761 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
4762 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4764 application.SendNotification();
4765 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4767 // We did expect the animation to finish
4768 application.SendNotification();
4769 finishCheck.CheckSignalReceived();
4770 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4774 int UtcDaliAnimationAnimateByActorScaleP(void)
4776 TestApplication application;
4778 Actor actor = Actor::New();
4779 Stage::GetCurrent().Add(actor);
4780 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4782 // Build the animation
4783 float durationSeconds(1.0f);
4784 Animation animation = Animation::New(durationSeconds);
4785 Vector3 targetScale(2.0f, 2.0f, 2.0f);
4786 Vector3 relativeScale(targetScale - Vector3::ONE);
4787 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), Vector3( relativeScale.x, relativeScale.y, relativeScale.z ) );
4789 Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale*0.99f);
4791 // Start the animation
4794 bool signalReceived(false);
4795 AnimationFinishCheck finishCheck(signalReceived);
4796 animation.FinishedSignal().Connect(&application, finishCheck);
4798 application.SendNotification();
4799 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4801 // We didn't expect the animation to finish yet
4802 application.SendNotification();
4803 finishCheck.CheckSignalNotReceived();
4804 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
4806 application.SendNotification();
4807 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4809 // We did expect the animation to finish
4810 application.SendNotification();
4811 finishCheck.CheckSignalReceived();
4812 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4815 finishCheck.Reset();
4816 actor.SetScale(Vector3::ONE);
4817 application.SendNotification();
4818 application.Render(0);
4819 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4821 // Repeat with a different (ease-in) alpha function
4822 animation = Animation::New(durationSeconds);
4823 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::EASE_IN );
4824 animation.FinishedSignal().Connect(&application, finishCheck);
4827 application.SendNotification();
4828 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4830 // We didn't expect the animation to finish yet
4831 application.SendNotification();
4832 finishCheck.CheckSignalNotReceived();
4834 // The scale should have grown less, than with a linear alpha function
4835 Vector3 current(actor.GetCurrentScale());
4836 DALI_TEST_CHECK( current.x > 1.0f );
4837 DALI_TEST_CHECK( current.y > 1.0f );
4838 DALI_TEST_CHECK( current.z > 1.0f );
4839 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
4840 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
4841 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
4843 application.SendNotification();
4844 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4846 // We did expect the animation to finish
4847 application.SendNotification();
4848 finishCheck.CheckSignalReceived();
4849 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4852 finishCheck.Reset();
4853 actor.SetScale(Vector3::ONE);
4854 application.SendNotification();
4855 application.Render(0);
4856 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4858 // Repeat with a delay
4860 animation = Animation::New(durationSeconds);
4861 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
4862 animation.FinishedSignal().Connect(&application, finishCheck);
4865 application.SendNotification();
4866 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4868 // We didn't expect the animation to finish yet
4869 application.SendNotification();
4870 finishCheck.CheckSignalNotReceived();
4871 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4873 application.SendNotification();
4874 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4876 // We did expect the animation to finish
4877 application.SendNotification();
4878 finishCheck.CheckSignalReceived();
4879 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4883 int UtcDaliAnimationAnimateToBooleanP(void)
4885 TestApplication application;
4887 Actor actor = Actor::New();
4889 // Register a boolean property
4890 const bool startValue(false);
4891 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4892 Stage::GetCurrent().Add(actor);
4893 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4894 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
4896 // Build the animation
4897 float durationSeconds(2.0f);
4898 Animation animation = Animation::New(durationSeconds);
4899 const bool targetValue( !startValue );
4900 animation.AnimateTo(Property(actor, index), targetValue);
4902 // Start the animation
4905 bool signalReceived(false);
4906 AnimationFinishCheck finishCheck(signalReceived);
4907 animation.FinishedSignal().Connect(&application, finishCheck);
4909 application.SendNotification();
4910 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4912 // We didn't expect the animation to finish yet
4913 application.SendNotification();
4914 finishCheck.CheckSignalNotReceived();
4915 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
4917 application.SendNotification();
4918 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4920 // We did expect the animation to finish
4921 application.SendNotification();
4922 finishCheck.CheckSignalReceived();
4923 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
4925 // Check that nothing has changed after a couple of buffer swaps
4926 application.Render(0);
4927 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
4928 application.Render(0);
4929 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
4931 // Repeat with target value "false"
4932 animation = Animation::New(durationSeconds);
4933 const bool finalValue( !targetValue );
4934 animation.AnimateTo(Property(actor, index), finalValue);
4936 // Start the animation
4939 finishCheck.Reset();
4940 animation.FinishedSignal().Connect(&application, finishCheck);
4942 application.SendNotification();
4943 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4945 // We didn't expect the animation to finish yet
4946 application.SendNotification();
4947 finishCheck.CheckSignalNotReceived();
4948 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
4950 application.SendNotification();
4951 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4953 // We did expect the animation to finish
4954 application.SendNotification();
4955 finishCheck.CheckSignalReceived();
4956 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
4958 // Check that nothing has changed after a couple of buffer swaps
4959 application.Render(0);
4960 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
4961 application.Render(0);
4962 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
4966 int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void)
4968 TestApplication application;
4970 Actor actor = Actor::New();
4972 // Register a boolean property
4973 const bool startValue(false);
4974 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4975 Stage::GetCurrent().Add(actor);
4976 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4977 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
4979 // Build the animation
4980 float durationSeconds(2.0f);
4981 Animation animation = Animation::New(durationSeconds);
4982 const bool targetValue( !startValue );
4983 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
4985 // Start the animation
4988 bool signalReceived(false);
4989 AnimationFinishCheck finishCheck(signalReceived);
4990 animation.FinishedSignal().Connect(&application, finishCheck);
4992 application.SendNotification();
4993 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4995 // We didn't expect the animation to finish yet
4996 application.SendNotification();
4997 finishCheck.CheckSignalNotReceived();
4998 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
5000 application.SendNotification();
5001 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5003 // We did expect the animation to finish
5004 application.SendNotification();
5005 finishCheck.CheckSignalReceived();
5006 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
5008 // Check that nothing has changed after a couple of buffer swaps
5009 application.Render(0);
5010 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
5011 application.Render(0);
5012 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
5014 // Repeat with target value "false"
5015 animation = Animation::New(durationSeconds);
5016 const bool finalValue( !targetValue );
5017 animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
5019 // Start the animation
5022 finishCheck.Reset();
5023 animation.FinishedSignal().Connect(&application, finishCheck);
5025 application.SendNotification();
5026 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5028 // We didn't expect the animation to finish yet
5029 application.SendNotification();
5030 finishCheck.CheckSignalNotReceived();
5031 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
5033 application.SendNotification();
5034 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5036 // We did expect the animation to finish
5037 application.SendNotification();
5038 finishCheck.CheckSignalReceived();
5039 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5041 // Check that nothing has changed after a couple of buffer swaps
5042 application.Render(0);
5043 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5044 application.Render(0);
5045 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5049 int UtcDaliAnimationAnimateToBooleanTimePeriodP(void)
5051 TestApplication application;
5053 Actor actor = Actor::New();
5055 // Register a boolean property
5056 bool startValue(false);
5057 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5058 Stage::GetCurrent().Add(actor);
5059 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5060 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
5062 // Build the animation
5063 float durationSeconds(2.0f);
5064 Animation animation = Animation::New(durationSeconds);
5065 bool finalValue( !startValue );
5066 float animatorDurationSeconds(durationSeconds * 0.5f);
5067 animation.AnimateTo( Property(actor, index),
5069 TimePeriod( animatorDurationSeconds ) );
5071 // Start the animation
5074 bool signalReceived(false);
5075 AnimationFinishCheck finishCheck(signalReceived);
5076 animation.FinishedSignal().Connect(&application, finishCheck);
5078 application.SendNotification();
5079 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5081 // We didn't expect the animation to finish yet
5082 application.SendNotification();
5083 finishCheck.CheckSignalNotReceived();
5084 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
5086 application.SendNotification();
5087 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5089 // We didn't expect the animation to finish yet...
5090 application.SendNotification();
5091 finishCheck.CheckSignalNotReceived();
5093 // ...however we should have reached the final value
5094 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5096 application.SendNotification();
5097 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5099 // We did expect the animation to finish
5100 application.SendNotification();
5101 finishCheck.CheckSignalReceived();
5102 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5104 // Check that nothing has changed after a couple of buffer swaps
5105 application.Render(0);
5106 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5107 application.Render(0);
5108 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5112 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void)
5114 TestApplication application;
5116 Actor actor = Actor::New();
5118 // Register a boolean property
5119 bool startValue(false);
5120 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5121 Stage::GetCurrent().Add(actor);
5122 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5123 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
5125 // Build the animation
5126 float durationSeconds(2.0f);
5127 Animation animation = Animation::New(durationSeconds);
5128 bool finalValue( !startValue );
5129 float animatorDurationSeconds(durationSeconds * 0.5f);
5130 animation.AnimateTo( Property(actor, index),
5132 AlphaFunction::LINEAR,
5133 TimePeriod( animatorDurationSeconds ) );
5135 // Start the animation
5138 bool signalReceived(false);
5139 AnimationFinishCheck finishCheck(signalReceived);
5140 animation.FinishedSignal().Connect(&application, finishCheck);
5142 application.SendNotification();
5143 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5145 // We didn't expect the animation to finish yet
5146 application.SendNotification();
5147 finishCheck.CheckSignalNotReceived();
5148 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
5150 application.SendNotification();
5151 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5153 // We didn't expect the animation to finish yet...
5154 application.SendNotification();
5155 finishCheck.CheckSignalNotReceived();
5157 // ...however we should have reached the final value
5158 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5160 application.SendNotification();
5161 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5163 // We did expect the animation to finish
5164 application.SendNotification();
5165 finishCheck.CheckSignalReceived();
5166 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5168 // Check that nothing has changed after a couple of buffer swaps
5169 application.Render(0);
5170 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5171 application.Render(0);
5172 DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5176 int UtcDaliAnimationAnimateToFloatP(void)
5178 TestApplication application;
5180 Actor actor = Actor::New();
5182 // Register a float property
5183 float startValue(10.0f);
5184 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5185 Stage::GetCurrent().Add(actor);
5186 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5187 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
5189 // Build the animation
5190 float durationSeconds(2.0f);
5191 Animation animation = Animation::New(durationSeconds);
5192 float targetValue(50.0f);
5193 float relativeValue(targetValue - startValue);
5194 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5196 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5198 // Start the animation
5201 bool signalReceived(false);
5202 AnimationFinishCheck finishCheck(signalReceived);
5203 animation.FinishedSignal().Connect(&application, finishCheck);
5205 application.SendNotification();
5206 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5208 // We didn't expect the animation to finish yet
5209 application.SendNotification();
5210 finishCheck.CheckSignalNotReceived();
5211 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
5213 application.SendNotification();
5214 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5216 // We did expect the animation to finish
5217 application.SendNotification();
5218 finishCheck.CheckSignalReceived();
5219 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
5223 int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void)
5225 TestApplication application;
5227 Actor actor = Actor::New();
5229 // Register a float property
5230 float startValue(10.0f);
5231 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5232 Stage::GetCurrent().Add(actor);
5233 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5234 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
5236 // Build the animation
5237 float durationSeconds(1.0f);
5238 Animation animation = Animation::New(durationSeconds);
5239 float targetValue(90.0f);
5240 float relativeValue(targetValue - startValue);
5241 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5243 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5245 // Start the animation
5248 bool signalReceived(false);
5249 AnimationFinishCheck finishCheck(signalReceived);
5250 animation.FinishedSignal().Connect(&application, finishCheck);
5252 application.SendNotification();
5253 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5255 // We didn't expect the animation to finish yet
5256 application.SendNotification();
5257 finishCheck.CheckSignalNotReceived();
5259 // The position should have moved more, than with a linear alpha function
5260 float current( DevelHandle::GetCurrentProperty< float >( actor, index ) );
5261 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
5263 application.SendNotification();
5264 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5266 // We did expect the animation to finish
5267 application.SendNotification();
5268 finishCheck.CheckSignalReceived();
5269 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
5273 int UtcDaliAnimationAnimateToFloatTimePeriodP(void)
5275 TestApplication application;
5277 Actor actor = Actor::New();
5279 // Register a float property
5280 float startValue(10.0f);
5281 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5282 Stage::GetCurrent().Add(actor);
5283 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5284 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
5286 // Build the animation
5287 float durationSeconds(1.0f);
5288 Animation animation = Animation::New(durationSeconds);
5289 float targetValue(30.0f);
5290 float relativeValue(targetValue - startValue);
5292 animation.AnimateTo(Property(actor, index),
5294 TimePeriod(delay, durationSeconds - delay));
5296 // Start the animation
5299 bool signalReceived(false);
5300 AnimationFinishCheck finishCheck(signalReceived);
5301 animation.FinishedSignal().Connect(&application, finishCheck);
5303 application.SendNotification();
5304 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5306 // We didn't expect the animation to finish yet
5307 application.SendNotification();
5308 finishCheck.CheckSignalNotReceived();
5309 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
5311 application.SendNotification();
5312 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5314 // We didn't expect the animation to finish yet
5315 application.SendNotification();
5316 finishCheck.CheckSignalNotReceived();
5317 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5319 application.SendNotification();
5320 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5322 // We did expect the animation to finish
5323 application.SendNotification();
5324 finishCheck.CheckSignalReceived();
5325 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
5329 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void)
5331 TestApplication application;
5333 Actor actor = Actor::New();
5335 // Register a float property
5336 float startValue(10.0f);
5337 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5338 Stage::GetCurrent().Add(actor);
5339 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5340 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
5342 // Build the animation
5343 float durationSeconds(1.0f);
5344 Animation animation = Animation::New(durationSeconds);
5345 float targetValue(30.0f);
5346 float relativeValue(targetValue - startValue);
5348 animation.AnimateTo(Property(actor, index),
5350 AlphaFunction::LINEAR,
5351 TimePeriod(delay, durationSeconds - delay));
5353 // Start the animation
5356 bool signalReceived(false);
5357 AnimationFinishCheck finishCheck(signalReceived);
5358 animation.FinishedSignal().Connect(&application, finishCheck);
5360 application.SendNotification();
5361 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5363 // We didn't expect the animation to finish yet
5364 application.SendNotification();
5365 finishCheck.CheckSignalNotReceived();
5366 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
5368 application.SendNotification();
5369 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5371 // We didn't expect the animation to finish yet
5372 application.SendNotification();
5373 finishCheck.CheckSignalNotReceived();
5374 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5376 application.SendNotification();
5377 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5379 // We did expect the animation to finish
5380 application.SendNotification();
5381 finishCheck.CheckSignalReceived();
5382 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
5386 int UtcDaliAnimationAnimateToIntegerP(void)
5388 TestApplication application;
5390 Actor actor = Actor::New();
5392 // Register an integer property
5394 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5395 Stage::GetCurrent().Add(actor);
5396 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5397 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
5399 // Build the animation
5400 float durationSeconds(2.0f);
5401 Animation animation = Animation::New(durationSeconds);
5402 int targetValue(50);
5403 int relativeValue(targetValue - startValue);
5404 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5406 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
5408 // Start the animation
5411 bool signalReceived(false);
5412 AnimationFinishCheck finishCheck(signalReceived);
5413 animation.FinishedSignal().Connect(&application, finishCheck);
5415 application.SendNotification();
5416 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5418 // We didn't expect the animation to finish yet
5419 application.SendNotification();
5420 finishCheck.CheckSignalNotReceived();
5421 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
5423 application.SendNotification();
5424 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5426 // We did expect the animation to finish
5427 application.SendNotification();
5428 finishCheck.CheckSignalReceived();
5429 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
5433 int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void)
5435 TestApplication application;
5437 Actor actor = Actor::New();
5439 // Register an integer property
5441 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5442 Stage::GetCurrent().Add(actor);
5443 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5444 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
5446 // Build the animation
5447 float durationSeconds(1.0f);
5448 Animation animation = Animation::New(durationSeconds);
5449 int targetValue(90);
5450 int relativeValue(targetValue - startValue);
5451 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5453 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
5455 // Start the animation
5458 bool signalReceived(false);
5459 AnimationFinishCheck finishCheck(signalReceived);
5460 animation.FinishedSignal().Connect(&application, finishCheck);
5462 application.SendNotification();
5463 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5465 // We didn't expect the animation to finish yet
5466 application.SendNotification();
5467 finishCheck.CheckSignalNotReceived();
5469 // The position should have moved more, than with a linear alpha function
5470 int current( DevelHandle::GetCurrentProperty< int >( actor, index ) );
5471 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
5473 application.SendNotification();
5474 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5476 // We did expect the animation to finish
5477 application.SendNotification();
5478 finishCheck.CheckSignalReceived();
5479 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
5483 int UtcDaliAnimationAnimateToIntegerTimePeriodP(void)
5485 TestApplication application;
5487 Actor actor = Actor::New();
5489 // Register an integer property
5491 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5492 Stage::GetCurrent().Add(actor);
5493 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5494 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
5496 // Build the animation
5497 float durationSeconds(1.0f);
5498 Animation animation = Animation::New(durationSeconds);
5499 int targetValue(30);
5500 int relativeValue(targetValue - startValue);
5502 animation.AnimateTo(Property(actor, index),
5504 TimePeriod(delay, durationSeconds - delay));
5506 // Start the animation
5509 bool signalReceived(false);
5510 AnimationFinishCheck finishCheck(signalReceived);
5511 animation.FinishedSignal().Connect(&application, finishCheck);
5513 application.SendNotification();
5514 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5516 // We didn't expect the animation to finish yet
5517 application.SendNotification();
5518 finishCheck.CheckSignalNotReceived();
5519 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
5521 application.SendNotification();
5522 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5524 // We didn't expect the animation to finish yet
5525 application.SendNotification();
5526 finishCheck.CheckSignalNotReceived();
5527 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
5529 application.SendNotification();
5530 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5532 // We did expect the animation to finish
5533 application.SendNotification();
5534 finishCheck.CheckSignalReceived();
5535 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
5539 int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void)
5541 TestApplication application;
5543 Actor actor = Actor::New();
5545 // Register an integer property
5547 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5548 Stage::GetCurrent().Add(actor);
5549 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5550 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
5552 // Build the animation
5553 float durationSeconds(1.0f);
5554 Animation animation = Animation::New(durationSeconds);
5555 int targetValue(30);
5556 int relativeValue(targetValue - startValue);
5558 animation.AnimateTo(Property(actor, index),
5560 AlphaFunction::LINEAR,
5561 TimePeriod(delay, durationSeconds - delay));
5563 // Start the animation
5566 bool signalReceived(false);
5567 AnimationFinishCheck finishCheck(signalReceived);
5568 animation.FinishedSignal().Connect(&application, finishCheck);
5570 application.SendNotification();
5571 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5573 // We didn't expect the animation to finish yet
5574 application.SendNotification();
5575 finishCheck.CheckSignalNotReceived();
5576 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
5578 application.SendNotification();
5579 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5581 // We didn't expect the animation to finish yet
5582 application.SendNotification();
5583 finishCheck.CheckSignalNotReceived();
5584 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
5586 application.SendNotification();
5587 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5589 // We did expect the animation to finish
5590 application.SendNotification();
5591 finishCheck.CheckSignalReceived();
5592 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
5596 int UtcDaliAnimationAnimateToVector2P(void)
5598 TestApplication application;
5600 Actor actor = Actor::New();
5602 // Register a Vector2 property
5603 Vector2 startValue(-50.0f, -50.0f);
5604 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5605 Stage::GetCurrent().Add(actor);
5606 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5607 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
5609 // Build the animation
5610 float durationSeconds(2.0f);
5611 Animation animation = Animation::New(durationSeconds);
5612 Vector2 targetValue(50.0f, 50.0f);
5613 Vector2 relativeValue(targetValue - startValue);
5614 animation.AnimateTo(Property(actor, index), targetValue);
5616 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5618 // Start the animation
5621 bool signalReceived(false);
5622 AnimationFinishCheck finishCheck(signalReceived);
5623 animation.FinishedSignal().Connect(&application, finishCheck);
5625 application.SendNotification();
5626 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5628 // We didn't expect the animation to finish yet
5629 application.SendNotification();
5630 finishCheck.CheckSignalNotReceived();
5631 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
5633 application.SendNotification();
5634 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5636 // We did expect the animation to finish
5637 application.SendNotification();
5638 finishCheck.CheckSignalReceived();
5639 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
5643 int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void)
5645 TestApplication application;
5647 Actor actor = Actor::New();
5649 // Register a Vector2 property
5650 Vector2 startValue(1000.0f, 1000.0f);
5651 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5652 Stage::GetCurrent().Add(actor);
5653 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5654 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
5656 // Build the animation
5657 float durationSeconds(1.0f);
5658 Animation animation = Animation::New(durationSeconds);
5659 Vector2 targetValue(9000.0f, 9000.0f);
5660 Vector2 relativeValue(targetValue - startValue);
5661 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
5663 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5665 // Start the animation
5668 bool signalReceived(false);
5669 AnimationFinishCheck finishCheck(signalReceived);
5670 animation.FinishedSignal().Connect(&application, finishCheck);
5672 application.SendNotification();
5673 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5675 // We didn't expect the animation to finish yet
5676 application.SendNotification();
5677 finishCheck.CheckSignalNotReceived();
5679 // The position should have moved more, than with a linear alpha function
5680 Vector2 current( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ) );
5681 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
5682 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
5684 application.SendNotification();
5685 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5687 // We did expect the animation to finish
5688 application.SendNotification();
5689 finishCheck.CheckSignalReceived();
5690 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
5694 int UtcDaliAnimationAnimateToVector2TimePeriodP(void)
5696 TestApplication application;
5698 Actor actor = Actor::New();
5700 // Register a Vector2 property
5701 Vector2 startValue(10.0f, 10.0f);
5702 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5703 Stage::GetCurrent().Add(actor);
5704 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5705 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
5707 // Build the animation
5708 float durationSeconds(1.0f);
5709 Animation animation = Animation::New(durationSeconds);
5710 Vector2 targetValue(-10.0f, 20.0f);
5711 Vector2 relativeValue(targetValue - startValue);
5713 animation.AnimateTo(Property(actor, index),
5715 TimePeriod(delay, durationSeconds - delay));
5717 // Start the animation
5720 bool signalReceived(false);
5721 AnimationFinishCheck finishCheck(signalReceived);
5722 animation.FinishedSignal().Connect(&application, finishCheck);
5724 application.SendNotification();
5725 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5727 // We didn't expect the animation to finish yet
5728 application.SendNotification();
5729 finishCheck.CheckSignalNotReceived();
5730 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
5732 application.SendNotification();
5733 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5735 // We didn't expect the animation to finish yet
5736 application.SendNotification();
5737 finishCheck.CheckSignalNotReceived();
5738 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5740 application.SendNotification();
5741 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5743 // We did expect the animation to finish
5744 application.SendNotification();
5745 finishCheck.CheckSignalReceived();
5746 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
5750 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void)
5752 TestApplication application;
5754 Actor actor = Actor::New();
5756 // Register a Vector2 property
5757 Vector2 startValue(10.0f, 10.0f);
5758 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5759 Stage::GetCurrent().Add(actor);
5760 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5761 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
5763 // Build the animation
5764 float durationSeconds(1.0f);
5765 Animation animation = Animation::New(durationSeconds);
5766 Vector2 targetValue(30.0f, 30.0f);
5767 Vector2 relativeValue(targetValue - startValue);
5769 animation.AnimateTo(Property(actor, index),
5771 AlphaFunction::LINEAR,
5772 TimePeriod(delay, durationSeconds - delay));
5774 // Start the animation
5777 bool signalReceived(false);
5778 AnimationFinishCheck finishCheck(signalReceived);
5779 animation.FinishedSignal().Connect(&application, finishCheck);
5781 application.SendNotification();
5782 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5784 // We didn't expect the animation to finish yet
5785 application.SendNotification();
5786 finishCheck.CheckSignalNotReceived();
5787 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
5789 application.SendNotification();
5790 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5792 // We didn't expect the animation to finish yet
5793 application.SendNotification();
5794 finishCheck.CheckSignalNotReceived();
5795 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5797 application.SendNotification();
5798 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5800 // We did expect the animation to finish
5801 application.SendNotification();
5802 finishCheck.CheckSignalReceived();
5803 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
5807 int UtcDaliAnimationAnimateToVector3P(void)
5809 TestApplication application;
5811 Actor actor = Actor::New();
5813 // Register a Vector3 property
5814 Vector3 startValue(-50.0f, -50.0f, -50.0f);
5815 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5816 Stage::GetCurrent().Add(actor);
5817 DALI_TEST_EQUALS( actor.GetProperty<Vector3>( index ), startValue, TEST_LOCATION );
5818 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
5820 // Build the animation
5821 float durationSeconds(2.0f);
5822 Animation animation = Animation::New(durationSeconds);
5823 Vector3 targetValue(50.0f, 50.0f, 50.0f);
5824 Vector3 relativeValue(targetValue - startValue);
5825 animation.AnimateTo(Property(actor, index), targetValue);
5827 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5829 // Start the animation
5832 bool signalReceived(false);
5833 AnimationFinishCheck finishCheck(signalReceived);
5834 animation.FinishedSignal().Connect(&application, finishCheck);
5836 application.SendNotification();
5837 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5839 // We didn't expect the animation to finish yet
5840 application.SendNotification();
5841 finishCheck.CheckSignalNotReceived();
5842 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
5844 application.SendNotification();
5845 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5847 // We did expect the animation to finish
5848 application.SendNotification();
5849 finishCheck.CheckSignalReceived();
5850 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
5854 int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void)
5856 TestApplication application;
5858 Actor actor = Actor::New();
5860 // Register a Vector3 property
5861 Vector3 startValue(1000.0f, 1000.0f, 1000.0f);
5862 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5863 Stage::GetCurrent().Add(actor);
5864 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5865 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
5867 // Build the animation
5868 float durationSeconds(1.0f);
5869 Animation animation = Animation::New(durationSeconds);
5870 Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
5871 Vector3 relativeValue(targetValue - startValue);
5872 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5874 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5876 // Start the animation
5879 bool signalReceived(false);
5880 AnimationFinishCheck finishCheck(signalReceived);
5881 animation.FinishedSignal().Connect(&application, finishCheck);
5883 application.SendNotification();
5884 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5886 // We didn't expect the animation to finish yet
5887 application.SendNotification();
5888 finishCheck.CheckSignalNotReceived();
5890 // The position should have moved more, than with a linear alpha function
5891 Vector3 current( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ) );
5892 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
5893 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
5894 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
5896 application.SendNotification();
5897 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5899 // We did expect the animation to finish
5900 application.SendNotification();
5901 finishCheck.CheckSignalReceived();
5902 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
5906 int UtcDaliAnimationAnimateToVector3TimePeriodP(void)
5908 TestApplication application;
5910 Actor actor = Actor::New();
5912 // Register a Vector3 property
5913 Vector3 startValue(10.0f, 10.0f, 10.0f);
5914 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5915 Stage::GetCurrent().Add(actor);
5916 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5917 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
5919 // Build the animation
5920 float durationSeconds(1.0f);
5921 Animation animation = Animation::New(durationSeconds);
5922 Vector3 targetValue(-10.0f, 20.0f, 100.0f);
5923 Vector3 relativeValue(targetValue - startValue);
5925 animation.AnimateTo(Property(actor, index),
5927 TimePeriod(delay, durationSeconds - delay));
5929 // Start the animation
5932 bool signalReceived(false);
5933 AnimationFinishCheck finishCheck(signalReceived);
5934 animation.FinishedSignal().Connect(&application, finishCheck);
5936 application.SendNotification();
5937 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5939 // We didn't expect the animation to finish yet
5940 application.SendNotification();
5941 finishCheck.CheckSignalNotReceived();
5942 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
5944 application.SendNotification();
5945 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5947 // We didn't expect the animation to finish yet
5948 application.SendNotification();
5949 finishCheck.CheckSignalNotReceived();
5950 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5952 application.SendNotification();
5953 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5955 // We did expect the animation to finish
5956 application.SendNotification();
5957 finishCheck.CheckSignalReceived();
5958 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
5962 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void)
5964 TestApplication application;
5966 Actor actor = Actor::New();
5968 // Register a Vector3 property
5969 Vector3 startValue(10.0f, 10.0f, 10.0f);
5970 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5971 Stage::GetCurrent().Add(actor);
5972 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5973 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
5975 // Build the animation
5976 float durationSeconds(1.0f);
5977 Animation animation = Animation::New(durationSeconds);
5978 Vector3 targetValue(30.0f, 30.0f, 30.0f);
5979 Vector3 relativeValue(targetValue - startValue);
5981 animation.AnimateTo(Property(actor, "testProperty"),
5983 AlphaFunction::LINEAR,
5984 TimePeriod(delay, durationSeconds - delay));
5986 // Start the animation
5989 bool signalReceived(false);
5990 AnimationFinishCheck finishCheck(signalReceived);
5991 animation.FinishedSignal().Connect(&application, finishCheck);
5993 application.SendNotification();
5994 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5996 // We didn't expect the animation to finish yet
5997 application.SendNotification();
5998 finishCheck.CheckSignalNotReceived();
5999 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
6001 application.SendNotification();
6002 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6004 // We didn't expect the animation to finish yet
6005 application.SendNotification();
6006 finishCheck.CheckSignalNotReceived();
6007 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6009 application.SendNotification();
6010 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6012 // We did expect the animation to finish
6013 application.SendNotification();
6014 finishCheck.CheckSignalReceived();
6015 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
6019 int UtcDaliAnimationAnimateToVector3ComponentP(void)
6021 TestApplication application;
6023 Actor actor = Actor::New();
6025 // Register a Vector3 property
6026 Vector3 startValue(10.0f, 10.0f, 10.0f);
6027 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6028 Stage::GetCurrent().Add(actor);
6029 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6030 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
6032 // Build the animation
6033 float durationSeconds(1.0f);
6034 Animation animation = Animation::New(durationSeconds);
6035 Vector3 targetValue(30.0f, 30.0f, 10.0f);
6036 Vector3 relativeValue(targetValue - startValue);
6038 animation.AnimateTo(Property(actor, "testProperty", 0),
6040 AlphaFunction::LINEAR,
6041 TimePeriod(delay, durationSeconds - delay));
6042 animation.AnimateTo(Property(actor, index, 1),
6044 AlphaFunction::LINEAR,
6045 TimePeriod(delay, durationSeconds - delay));
6047 // Start the animation
6050 bool signalReceived(false);
6051 AnimationFinishCheck finishCheck(signalReceived);
6052 animation.FinishedSignal().Connect(&application, finishCheck);
6054 application.SendNotification();
6055 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6057 // We didn't expect the animation to finish yet
6058 application.SendNotification();
6059 finishCheck.CheckSignalNotReceived();
6060 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
6062 application.SendNotification();
6063 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6065 // We didn't expect the animation to finish yet
6066 application.SendNotification();
6067 finishCheck.CheckSignalNotReceived();
6068 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6070 application.SendNotification();
6071 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6073 // We did expect the animation to finish
6074 application.SendNotification();
6075 finishCheck.CheckSignalReceived();
6076 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
6080 int UtcDaliAnimationAnimateToVector4P(void)
6082 TestApplication application;
6084 Actor actor = Actor::New();
6086 // Register a Vector4 property
6087 Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f);
6088 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6089 Stage::GetCurrent().Add(actor);
6090 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6091 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
6093 // Build the animation
6094 float durationSeconds(2.0f);
6095 Animation animation = Animation::New(durationSeconds);
6096 Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f);
6097 Vector4 relativeValue(targetValue - startValue);
6098 animation.AnimateTo(Property(actor, index), targetValue);
6100 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6102 // Start the animation
6105 bool signalReceived(false);
6106 AnimationFinishCheck finishCheck(signalReceived);
6107 animation.FinishedSignal().Connect(&application, finishCheck);
6109 application.SendNotification();
6110 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6112 // We didn't expect the animation to finish yet
6113 application.SendNotification();
6114 finishCheck.CheckSignalNotReceived();
6115 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
6117 application.SendNotification();
6118 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6120 // We did expect the animation to finish
6121 application.SendNotification();
6122 finishCheck.CheckSignalReceived();
6123 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
6127 int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void)
6129 TestApplication application;
6131 Actor actor = Actor::New();
6133 // Register a Vector4 property
6134 Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
6135 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6136 Stage::GetCurrent().Add(actor);
6137 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6138 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
6140 // Build the animation
6141 float durationSeconds(1.0f);
6142 Animation animation = Animation::New(durationSeconds);
6143 Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
6144 Vector4 relativeValue(targetValue - startValue);
6145 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6147 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6149 // Start the animation
6152 bool signalReceived(false);
6153 AnimationFinishCheck finishCheck(signalReceived);
6154 animation.FinishedSignal().Connect(&application, finishCheck);
6156 application.SendNotification();
6157 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6159 // We didn't expect the animation to finish yet
6160 application.SendNotification();
6161 finishCheck.CheckSignalNotReceived();
6163 // The position should have moved more, than with a linear alpha function
6164 Vector4 current( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ) );
6165 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6166 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6167 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
6168 DALI_TEST_CHECK( current.w > ninetyFivePercentProgress.w );
6170 application.SendNotification();
6171 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6173 // We did expect the animation to finish
6174 application.SendNotification();
6175 finishCheck.CheckSignalReceived();
6176 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
6180 int UtcDaliAnimationAnimateToVector4TimePeriodP(void)
6182 TestApplication application;
6184 Actor actor = Actor::New();
6186 // Register a Vector4 property
6187 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6188 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6189 Stage::GetCurrent().Add(actor);
6190 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6191 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6193 // Build the animation
6194 float durationSeconds(1.0f);
6195 Animation animation = Animation::New(durationSeconds);
6196 Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
6197 Vector4 relativeValue(targetValue - startValue);
6199 animation.AnimateTo(Property(actor, index),
6201 TimePeriod(delay, durationSeconds - delay));
6203 // Start the animation
6206 bool signalReceived(false);
6207 AnimationFinishCheck finishCheck(signalReceived);
6208 animation.FinishedSignal().Connect(&application, finishCheck);
6210 application.SendNotification();
6211 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6213 // We didn't expect the animation to finish yet
6214 application.SendNotification();
6215 finishCheck.CheckSignalNotReceived();
6216 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6218 application.SendNotification();
6219 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6221 // We didn't expect the animation to finish yet
6222 application.SendNotification();
6223 finishCheck.CheckSignalNotReceived();
6224 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue+(relativeValue*0.5f), VECTOR4_EPSILON, TEST_LOCATION );
6226 application.SendNotification();
6227 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6229 // We did expect the animation to finish
6230 application.SendNotification();
6231 finishCheck.CheckSignalReceived();
6232 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, VECTOR4_EPSILON, TEST_LOCATION );
6236 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void)
6238 TestApplication application;
6240 Actor actor = Actor::New();
6242 // Register a Vector4 property
6243 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6244 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6245 Stage::GetCurrent().Add(actor);
6246 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6247 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
6249 // Build the animation
6250 float durationSeconds(1.0f);
6251 Animation animation = Animation::New(durationSeconds);
6252 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
6253 Vector4 relativeValue(targetValue - startValue);
6255 animation.AnimateTo(Property(actor, index),
6257 AlphaFunction::LINEAR,
6258 TimePeriod(delay, durationSeconds - delay));
6260 // Start the animation
6263 bool signalReceived(false);
6264 AnimationFinishCheck finishCheck(signalReceived);
6265 animation.FinishedSignal().Connect(&application, finishCheck);
6267 application.SendNotification();
6268 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6270 // We didn't expect the animation to finish yet
6271 application.SendNotification();
6272 finishCheck.CheckSignalNotReceived();
6273 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
6275 application.SendNotification();
6276 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6278 // We didn't expect the animation to finish yet
6279 application.SendNotification();
6280 finishCheck.CheckSignalNotReceived();
6281 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6283 application.SendNotification();
6284 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6286 // We did expect the animation to finish
6287 application.SendNotification();
6288 finishCheck.CheckSignalReceived();
6289 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
6293 int UtcDaliAnimationAnimateToActorParentOriginP(void)
6295 TestApplication application;
6297 Actor actor = Actor::New();
6298 Stage::GetCurrent().Add(actor);
6299 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_LEFT, TEST_LOCATION );
6301 // Build the animation
6302 float durationSeconds(1.0f);
6303 Animation animation = Animation::New(durationSeconds);
6304 Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
6308 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin );
6310 catch (Dali::DaliException& e)
6312 DALI_TEST_PRINT_ASSERT( e );
6313 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6318 int UtcDaliAnimationAnimateToActorParentOriginXP(void)
6320 TestApplication application;
6322 Actor actor = Actor::New();
6323 Stage::GetCurrent().Add(actor);
6324 float startValue(0.0f);
6325 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().x, startValue, TEST_LOCATION );
6326 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION );
6328 // Build the animation
6329 float durationSeconds(1.0f);
6330 Animation animation = Animation::New(durationSeconds);
6331 float targetX(1.0f);
6335 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX );
6337 catch (Dali::DaliException& e)
6339 DALI_TEST_PRINT_ASSERT( e );
6340 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6345 int UtcDaliAnimationAnimateToActorParentOriginYP(void)
6347 TestApplication application;
6349 Actor actor = Actor::New();
6350 Stage::GetCurrent().Add(actor);
6351 float startValue(0.0f);
6352 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().y, startValue, TEST_LOCATION );
6353 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION );
6355 // Build the animation
6356 float durationSeconds(1.0f);
6357 Animation animation = Animation::New(durationSeconds);
6358 float targetY(1.0f);
6362 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY );
6364 catch (Dali::DaliException& e)
6366 DALI_TEST_PRINT_ASSERT( e );
6367 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6372 int UtcDaliAnimationAnimateToActorParentOriginZP(void)
6374 TestApplication application;
6376 Actor actor = Actor::New();
6377 Stage::GetCurrent().Add(actor);
6378 float startValue(0.5f);
6379 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().z, startValue, TEST_LOCATION );
6380 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION );
6382 // Build the animation
6383 float durationSeconds(1.0f);
6384 Animation animation = Animation::New(durationSeconds);
6385 float targetZ(1.0f);
6389 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ );
6391 catch (Dali::DaliException& e)
6393 DALI_TEST_PRINT_ASSERT( e );
6394 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6399 int UtcDaliAnimationAnimateToActorAnchorPointP(void)
6401 TestApplication application;
6403 Actor actor = Actor::New();
6404 Stage::GetCurrent().Add(actor);
6405 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), AnchorPoint::CENTER, TEST_LOCATION );
6407 // Build the animation
6408 float durationSeconds(1.0f);
6409 Animation animation = Animation::New(durationSeconds);
6410 Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT);
6414 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
6416 catch (Dali::DaliException& e)
6418 DALI_TEST_PRINT_ASSERT( e );
6419 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6424 int UtcDaliAnimationAnimateToActorAnchorPointXP(void)
6426 TestApplication application;
6428 Actor actor = Actor::New();
6429 Stage::GetCurrent().Add(actor);
6430 float startValue(0.5f);
6431 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().x, startValue, TEST_LOCATION );
6432 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION );
6434 // Build the animation
6435 float durationSeconds(1.0f);
6436 Animation animation = Animation::New(durationSeconds);
6437 float targetX(1.0f);
6441 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_X), targetX );
6443 catch (Dali::DaliException& e)
6445 DALI_TEST_PRINT_ASSERT( e );
6446 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6451 int UtcDaliAnimationAnimateToActorAnchorPointYP(void)
6453 TestApplication application;
6455 Actor actor = Actor::New();
6456 Stage::GetCurrent().Add(actor);
6457 float startValue(0.5f);
6458 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().y, startValue, TEST_LOCATION );
6459 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION );
6461 // Build the animation
6462 float durationSeconds(1.0f);
6463 Animation animation = Animation::New(durationSeconds);
6464 float targetY(0.0f);
6468 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY );
6470 catch (Dali::DaliException& e)
6472 DALI_TEST_PRINT_ASSERT( e );
6473 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6478 int UtcDaliAnimationAnimateToActorAnchorPointZP(void)
6480 TestApplication application;
6482 Actor actor = Actor::New();
6483 Stage::GetCurrent().Add(actor);
6484 float startValue(0.5f);
6485 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().z, startValue, TEST_LOCATION );
6486 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION );
6488 // Build the animation
6489 float durationSeconds(1.0f);
6490 Animation animation = Animation::New(durationSeconds);
6491 float targetZ(100.0f);
6495 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ );
6497 catch (Dali::DaliException& e)
6499 DALI_TEST_PRINT_ASSERT( e );
6500 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6505 int UtcDaliAnimationAnimateToActorSizeP(void)
6507 TestApplication application;
6509 Actor actor = Actor::New();
6510 Stage::GetCurrent().Add(actor);
6511 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6513 // Build the animation
6514 float durationSeconds(1.0f);
6515 Animation animation = Animation::New(durationSeconds);
6516 Vector3 targetSize(100.0f, 100.0f, 100.0f);
6517 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize );
6519 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
6521 // Start the animation
6524 bool signalReceived(false);
6525 AnimationFinishCheck finishCheck(signalReceived);
6526 animation.FinishedSignal().Connect(&application, finishCheck);
6528 application.SendNotification();
6529 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6531 // We didn't expect the animation to finish yet
6532 application.SendNotification();
6533 finishCheck.CheckSignalNotReceived();
6534 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
6536 application.SendNotification();
6537 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6539 // We did expect the animation to finish
6540 application.SendNotification();
6541 finishCheck.CheckSignalReceived();
6542 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6545 finishCheck.Reset();
6546 actor.SetSize(Vector3::ZERO);
6547 application.SendNotification();
6548 application.Render(0);
6549 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6551 // Repeat with a different (ease-in) alpha function
6552 animation = Animation::New(durationSeconds);
6553 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
6554 animation.FinishedSignal().Connect(&application, finishCheck);
6557 application.SendNotification();
6558 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6560 // We didn't expect the animation to finish yet
6561 application.SendNotification();
6562 finishCheck.CheckSignalNotReceived();
6564 // The size should have travelled less, than with a linear alpha function
6565 Vector3 current(actor.GetCurrentSize());
6566 DALI_TEST_CHECK( current.x > 0.0f );
6567 DALI_TEST_CHECK( current.y > 0.0f );
6568 DALI_TEST_CHECK( current.z > 0.0f );
6569 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
6570 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
6571 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
6573 application.SendNotification();
6574 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6576 // We did expect the animation to finish
6577 application.SendNotification();
6578 finishCheck.CheckSignalReceived();
6579 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6582 finishCheck.Reset();
6583 actor.SetSize(Vector3::ZERO);
6584 application.SendNotification();
6585 application.Render(0);
6586 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6588 // Repeat with a delay
6590 animation = Animation::New(durationSeconds);
6591 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
6592 animation.FinishedSignal().Connect(&application, finishCheck);
6595 application.SendNotification();
6596 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6598 // We didn't expect the animation to finish yet
6599 application.SendNotification();
6600 finishCheck.CheckSignalNotReceived();
6601 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6603 application.SendNotification();
6604 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6606 // We did expect the animation to finish
6607 application.SendNotification();
6608 finishCheck.CheckSignalReceived();
6609 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6613 int UtcDaliAnimationAnimateToActorSizeWidthP(void)
6615 TestApplication application;
6617 Actor actor = Actor::New();
6618 Stage::GetCurrent().Add(actor);
6619 float startValue(0.0f);
6620 DALI_TEST_EQUALS( actor.GetCurrentSize().width, startValue, TEST_LOCATION );
6621 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION );
6623 // Build the animation
6624 float durationSeconds(1.0f);
6625 Animation animation = Animation::New(durationSeconds);
6626 float targetWidth(10.0f);
6627 animation.AnimateTo( Property(actor, Actor::Property::SIZE_WIDTH), targetWidth );
6629 float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f);
6631 // Start the animation
6634 bool signalReceived(false);
6635 AnimationFinishCheck finishCheck(signalReceived);
6636 animation.FinishedSignal().Connect(&application, finishCheck);
6638 application.SendNotification();
6639 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6641 // We didn't expect the animation to finish yet
6642 application.SendNotification();
6643 finishCheck.CheckSignalNotReceived();
6644 DALI_TEST_EQUALS( actor.GetCurrentSize().width, fiftyPercentProgress, TEST_LOCATION );
6646 application.SendNotification();
6647 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6649 // We did expect the animation to finish
6650 application.SendNotification();
6651 finishCheck.CheckSignalReceived();
6652 DALI_TEST_EQUALS( actor.GetCurrentSize().width, targetWidth, TEST_LOCATION );
6653 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION );
6657 int UtcDaliAnimationAnimateToActorSizeHeightP(void)
6659 TestApplication application;
6661 Actor actor = Actor::New();
6662 Stage::GetCurrent().Add(actor);
6663 float startValue(0.0f);
6664 DALI_TEST_EQUALS( actor.GetCurrentSize().height, startValue, TEST_LOCATION );
6665 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION );
6667 // Build the animation
6668 float durationSeconds(1.0f);
6669 Animation animation = Animation::New(durationSeconds);
6670 float targetHeight(-10.0f);
6671 animation.AnimateTo( Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight );
6673 float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f);
6675 // Start the animation
6678 bool signalReceived(false);
6679 AnimationFinishCheck finishCheck(signalReceived);
6680 animation.FinishedSignal().Connect(&application, finishCheck);
6682 application.SendNotification();
6683 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6685 // We didn't expect the animation to finish yet
6686 application.SendNotification();
6687 finishCheck.CheckSignalNotReceived();
6688 DALI_TEST_EQUALS( actor.GetCurrentSize().height, fiftyPercentProgress, TEST_LOCATION );
6690 application.SendNotification();
6691 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6693 // We did expect the animation to finish
6694 application.SendNotification();
6695 finishCheck.CheckSignalReceived();
6696 DALI_TEST_EQUALS( actor.GetCurrentSize().height, targetHeight, TEST_LOCATION );
6697 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION );
6701 int UtcDaliAnimationAnimateToActorSizeDepthP(void)
6703 TestApplication application;
6705 Actor actor = Actor::New();
6706 Stage::GetCurrent().Add(actor);
6707 float startValue(0.0f);
6708 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, startValue, TEST_LOCATION );
6709 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION );
6711 // Build the animation
6712 float durationSeconds(1.0f);
6713 Animation animation = Animation::New(durationSeconds);
6714 float targetDepth(-10.0f);
6715 animation.AnimateTo( Property(actor, Actor::Property::SIZE_DEPTH), targetDepth );
6717 float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f);
6719 // Start the animation
6722 bool signalReceived(false);
6723 AnimationFinishCheck finishCheck(signalReceived);
6724 animation.FinishedSignal().Connect(&application, finishCheck);
6726 application.SendNotification();
6727 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6729 // We didn't expect the animation to finish yet
6730 application.SendNotification();
6731 finishCheck.CheckSignalNotReceived();
6732 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, fiftyPercentProgress, TEST_LOCATION );
6734 application.SendNotification();
6735 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6737 // We did expect the animation to finish
6738 application.SendNotification();
6739 finishCheck.CheckSignalReceived();
6740 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, targetDepth, TEST_LOCATION );
6741 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION );
6745 int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void)
6747 TestApplication application;
6749 Actor actor = Actor::New();
6750 Stage::GetCurrent().Add(actor);
6751 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6753 // Build the animation
6754 float durationSeconds(1.0f);
6755 Animation animation = Animation::New(durationSeconds);
6756 Vector3 targetSize(100.0f, 100.0f, 100.0f);
6757 animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetSize );
6759 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
6761 // Start the animation
6764 bool signalReceived(false);
6765 AnimationFinishCheck finishCheck(signalReceived);
6766 animation.FinishedSignal().Connect(&application, finishCheck);
6768 application.SendNotification();
6769 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6771 // We didn't expect the animation to finish yet
6772 application.SendNotification();
6773 finishCheck.CheckSignalNotReceived();
6774 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
6776 application.SendNotification();
6777 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6779 // We did expect the animation to finish
6780 application.SendNotification();
6781 finishCheck.CheckSignalReceived();
6782 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6785 finishCheck.Reset();
6786 actor.SetSize(Vector3::ZERO);
6787 application.SendNotification();
6788 application.Render(0);
6789 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6791 // Repeat with a different (ease-in) alpha function
6792 animation = Animation::New(durationSeconds);
6793 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::EASE_IN );
6794 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::EASE_IN );
6795 animation.FinishedSignal().Connect(&application, finishCheck);
6798 application.SendNotification();
6799 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6801 // We didn't expect the animation to finish yet
6802 application.SendNotification();
6803 finishCheck.CheckSignalNotReceived();
6805 // The size should have travelled less, than with a linear alpha function
6806 Vector3 current(actor.GetCurrentSize());
6807 DALI_TEST_CHECK( current.x > 0.0f );
6808 DALI_TEST_CHECK( current.y > 0.0f );
6809 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
6810 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
6812 application.SendNotification();
6813 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6815 // We did expect the animation to finish
6816 application.SendNotification();
6817 finishCheck.CheckSignalReceived();
6818 DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
6819 DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
6822 finishCheck.Reset();
6823 actor.SetSize(Vector3::ZERO);
6824 application.SendNotification();
6825 application.Render(0);
6826 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6828 // Repeat with a delay
6830 animation = Animation::New(durationSeconds);
6831 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
6832 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
6833 animation.FinishedSignal().Connect(&application, finishCheck);
6836 application.SendNotification();
6837 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6839 // We didn't expect the animation to finish yet
6840 application.SendNotification();
6841 finishCheck.CheckSignalNotReceived();
6842 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6844 application.SendNotification();
6845 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6847 // We did expect the animation to finish
6848 application.SendNotification();
6849 finishCheck.CheckSignalReceived();
6850 DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
6851 DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
6855 int UtcDaliAnimationAnimateToActorPositionP(void)
6857 TestApplication application;
6859 Actor actor = Actor::New();
6860 Stage::GetCurrent().Add(actor);
6861 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6863 // Build the animation
6864 float durationSeconds(1.0f);
6865 Animation animation = Animation::New(durationSeconds);
6866 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6867 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
6869 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6871 // Start the animation
6874 bool signalReceived(false);
6875 AnimationFinishCheck finishCheck(signalReceived);
6876 animation.FinishedSignal().Connect(&application, finishCheck);
6878 application.SendNotification();
6879 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
6881 // We didn't expect the animation to finish yet
6882 application.SendNotification();
6883 finishCheck.CheckSignalNotReceived();
6884 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
6886 application.SendNotification();
6887 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6889 // We did expect the animation to finish
6890 application.SendNotification();
6891 finishCheck.CheckSignalReceived();
6892 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6896 int UtcDaliAnimationAnimateToActorPositionXP(void)
6898 TestApplication application;
6900 Actor actor = Actor::New();
6901 Stage::GetCurrent().Add(actor);
6902 float startValue(0.0f);
6903 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, startValue, TEST_LOCATION );
6904 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6905 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6906 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6908 // Build the animation
6909 float durationSeconds(1.0f);
6910 Animation animation = Animation::New(durationSeconds);
6911 float targetX(1.0f);
6912 animation.AnimateTo( Property(actor, Actor::Property::POSITION_X), targetX );
6914 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
6916 // Start the animation
6919 bool signalReceived(false);
6920 AnimationFinishCheck finishCheck(signalReceived);
6921 animation.FinishedSignal().Connect(&application, finishCheck);
6923 application.SendNotification();
6924 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6926 // We didn't expect the animation to finish yet
6927 application.SendNotification();
6928 finishCheck.CheckSignalNotReceived();
6929 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, fiftyPercentProgress, TEST_LOCATION );
6931 application.SendNotification();
6932 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6934 // We did expect the animation to finish
6935 application.SendNotification();
6936 finishCheck.CheckSignalReceived();
6937 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, targetX, TEST_LOCATION );
6938 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION );
6939 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6940 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6944 int UtcDaliAnimationAnimateToActorPositionYP(void)
6946 TestApplication application;
6948 Actor actor = Actor::New();
6949 Stage::GetCurrent().Add(actor);
6950 float startValue(0.0f);
6951 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, startValue, TEST_LOCATION );
6952 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6953 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6954 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6956 // Build the animation
6957 float durationSeconds(1.0f);
6958 Animation animation = Animation::New(durationSeconds);
6959 float targetY(10.0f);
6960 animation.AnimateTo( Property(actor, Actor::Property::POSITION_Y), targetY );
6962 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
6964 // Start the animation
6967 bool signalReceived(false);
6968 AnimationFinishCheck finishCheck(signalReceived);
6969 animation.FinishedSignal().Connect(&application, finishCheck);
6971 application.SendNotification();
6972 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6974 // We didn't expect the animation to finish yet
6975 application.SendNotification();
6976 finishCheck.CheckSignalNotReceived();
6977 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, fiftyPercentProgress, TEST_LOCATION );
6979 application.SendNotification();
6980 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6982 // We did expect the animation to finish
6983 application.SendNotification();
6984 finishCheck.CheckSignalReceived();
6985 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, targetY, TEST_LOCATION );
6986 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6987 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION );
6988 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6992 int UtcDaliAnimationAnimateToActorPositionZP(void)
6994 TestApplication application;
6996 Actor actor = Actor::New();
6997 Stage::GetCurrent().Add(actor);
6998 float startValue(0.0f);
6999 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, startValue, TEST_LOCATION );
7000 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7001 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7002 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7004 // Build the animation
7005 float durationSeconds(1.0f);
7006 Animation animation = Animation::New(durationSeconds);
7007 float targetZ(-5.0f);
7008 animation.AnimateTo( Property(actor, Actor::Property::POSITION_Z), targetZ );
7010 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
7012 // Start the animation
7015 bool signalReceived(false);
7016 AnimationFinishCheck finishCheck(signalReceived);
7017 animation.FinishedSignal().Connect(&application, finishCheck);
7019 application.SendNotification();
7020 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7022 // We didn't expect the animation to finish yet
7023 application.SendNotification();
7024 finishCheck.CheckSignalNotReceived();
7025 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, fiftyPercentProgress, TEST_LOCATION );
7027 application.SendNotification();
7028 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7030 // We did expect the animation to finish
7031 application.SendNotification();
7032 finishCheck.CheckSignalReceived();
7033 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, targetZ, TEST_LOCATION );
7034 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7035 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7036 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION );
7040 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void)
7042 TestApplication application;
7044 Actor actor = Actor::New();
7045 Stage::GetCurrent().Add(actor);
7046 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7048 // Build the animation
7049 float durationSeconds(1.0f);
7050 Animation animation = Animation::New(durationSeconds);
7051 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7052 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
7054 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7056 // Start the animation
7059 bool signalReceived(false);
7060 AnimationFinishCheck finishCheck(signalReceived);
7061 animation.FinishedSignal().Connect(&application, finishCheck);
7063 application.SendNotification();
7064 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
7066 // We didn't expect the animation to finish yet
7067 application.SendNotification();
7068 finishCheck.CheckSignalNotReceived();
7070 // The position should have moved less, than with a linear alpha function
7071 Vector3 current(actor.GetCurrentPosition());
7072 DALI_TEST_CHECK( current.x > Vector3::ZERO.x );
7073 DALI_TEST_CHECK( current.y > Vector3::ZERO.y );
7074 DALI_TEST_CHECK( current.z > Vector3::ZERO.z );
7075 DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x );
7076 DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y );
7077 DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z );
7079 application.SendNotification();
7080 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7082 // We did expect the animation to finish
7083 application.SendNotification();
7084 finishCheck.CheckSignalReceived();
7085 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7089 int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void)
7091 TestApplication application;
7093 Actor actor = Actor::New();
7094 Stage::GetCurrent().Add(actor);
7095 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7097 // Build the animation
7098 float durationSeconds(1.0f);
7099 Animation animation = Animation::New(durationSeconds);
7100 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7102 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7104 TimePeriod( delay, durationSeconds - delay ) );
7106 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7108 // Start the animation
7111 bool signalReceived(false);
7112 AnimationFinishCheck finishCheck(signalReceived);
7113 animation.FinishedSignal().Connect(&application, finishCheck);
7115 application.SendNotification();
7116 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7118 // We didn't expect the animation to finish yet
7119 application.SendNotification();
7120 finishCheck.CheckSignalNotReceived();
7121 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7123 application.SendNotification();
7124 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7126 // We didn't expect the animation to finish yet
7127 application.SendNotification();
7128 finishCheck.CheckSignalNotReceived();
7129 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7131 application.SendNotification();
7132 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7134 // We did expect the animation to finish
7135 application.SendNotification();
7136 finishCheck.CheckSignalReceived();
7137 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7141 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(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);
7154 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7156 AlphaFunction::LINEAR,
7157 TimePeriod( delay, durationSeconds - delay ) );
7159 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7161 // Start the animation
7164 bool signalReceived(false);
7165 AnimationFinishCheck finishCheck(signalReceived);
7166 animation.FinishedSignal().Connect(&application, finishCheck);
7168 application.SendNotification();
7169 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7171 // We didn't expect the animation to finish yet
7172 application.SendNotification();
7173 finishCheck.CheckSignalNotReceived();
7174 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7176 application.SendNotification();
7177 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7179 // We didn't expect the animation to finish yet
7180 application.SendNotification();
7181 finishCheck.CheckSignalNotReceived();
7182 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7184 application.SendNotification();
7185 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7187 // We did expect the animation to finish
7188 application.SendNotification();
7189 finishCheck.CheckSignalReceived();
7190 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7194 int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void)
7196 TestApplication application;
7198 Actor actor = Actor::New();
7199 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7200 Stage::GetCurrent().Add(actor);
7201 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7203 // Build the animation
7204 float durationSeconds(1.0f);
7205 Animation animation = Animation::New(durationSeconds);
7206 Degree targetRotationDegrees(90.0f);
7207 Radian targetRotationRadians(targetRotationDegrees);
7208 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS) );
7210 // Start the animation
7213 bool signalReceived(false);
7214 AnimationFinishCheck finishCheck(signalReceived);
7215 animation.FinishedSignal().Connect(&application, finishCheck);
7217 application.SendNotification();
7218 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7220 // We didn't expect the animation to finish yet
7221 application.SendNotification();
7222 finishCheck.CheckSignalNotReceived();
7223 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7225 application.SendNotification();
7226 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7228 // We didn't expect the animation to finish yet
7229 application.SendNotification();
7230 finishCheck.CheckSignalNotReceived();
7231 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7233 application.SendNotification();
7234 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7236 // We didn't expect the animation to finish yet
7237 application.SendNotification();
7238 finishCheck.CheckSignalNotReceived();
7239 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7241 application.SendNotification();
7242 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7244 // We did expect the animation to finish
7245 application.SendNotification();
7246 finishCheck.CheckSignalReceived();
7247 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7251 int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void)
7253 TestApplication application;
7255 Actor actor = Actor::New();
7256 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7257 Stage::GetCurrent().Add(actor);
7258 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7260 // Build the animation
7261 float durationSeconds(1.0f);
7262 Animation animation = Animation::New(durationSeconds);
7263 Degree targetRotationDegrees(90.0f);
7264 Radian targetRotationRadians(targetRotationDegrees);
7265 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
7266 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), targetRotation );
7268 // Start the animation
7271 bool signalReceived(false);
7272 AnimationFinishCheck finishCheck(signalReceived);
7273 animation.FinishedSignal().Connect(&application, finishCheck);
7275 application.SendNotification();
7276 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7278 // We didn't expect the animation to finish yet
7279 application.SendNotification();
7280 finishCheck.CheckSignalNotReceived();
7281 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7283 application.SendNotification();
7284 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7286 // We didn't expect the animation to finish yet
7287 application.SendNotification();
7288 finishCheck.CheckSignalNotReceived();
7289 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7291 application.SendNotification();
7292 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7294 // We didn't expect the animation to finish yet
7295 application.SendNotification();
7296 finishCheck.CheckSignalNotReceived();
7297 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7299 application.SendNotification();
7300 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7302 // We did expect the animation to finish
7303 application.SendNotification();
7304 finishCheck.CheckSignalReceived();
7305 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7309 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void)
7311 TestApplication application;
7313 Actor actor = Actor::New();
7314 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7315 Stage::GetCurrent().Add(actor);
7316 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7318 // Build the animation
7319 float durationSeconds(1.0f);
7320 Animation animation = Animation::New(durationSeconds);
7321 Degree targetRotationDegrees(90.0f);
7322 Radian targetRotationRadians(targetRotationDegrees);
7323 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
7325 // Start the animation
7328 bool signalReceived(false);
7329 AnimationFinishCheck finishCheck(signalReceived);
7330 animation.FinishedSignal().Connect(&application, finishCheck);
7332 application.SendNotification();
7333 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7335 // We didn't expect the animation to finish yet
7336 application.SendNotification();
7337 finishCheck.CheckSignalNotReceived();
7338 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7340 application.SendNotification();
7341 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7343 // We didn't expect the animation to finish yet
7344 application.SendNotification();
7345 finishCheck.CheckSignalNotReceived();
7346 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7348 application.SendNotification();
7349 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7351 // We didn't expect the animation to finish yet
7352 application.SendNotification();
7353 finishCheck.CheckSignalNotReceived();
7354 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7356 application.SendNotification();
7357 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7359 // We did expect the animation to finish
7360 application.SendNotification();
7361 finishCheck.CheckSignalReceived();
7362 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7366 int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void)
7368 TestApplication application;
7370 Actor actor = Actor::New();
7371 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7372 Stage::GetCurrent().Add(actor);
7373 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7375 // Build the animation
7376 float durationSeconds(1.0f);
7377 Animation animation = Animation::New(durationSeconds);
7378 Degree targetRotationDegrees(90.0f);
7379 Radian targetRotationRadians(targetRotationDegrees);
7381 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
7383 // Start the animation
7386 bool signalReceived(false);
7387 AnimationFinishCheck finishCheck(signalReceived);
7388 animation.FinishedSignal().Connect(&application, finishCheck);
7390 application.SendNotification();
7391 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7393 // We didn't expect the animation to finish yet
7394 application.SendNotification();
7395 finishCheck.CheckSignalNotReceived();
7396 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7397 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7399 application.SendNotification();
7400 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7402 // We didn't expect the animation to finish yet
7403 application.SendNotification();
7404 finishCheck.CheckSignalNotReceived();
7405 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7406 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7408 application.SendNotification();
7409 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7411 // We didn't expect the animation to finish yet
7412 application.SendNotification();
7413 finishCheck.CheckSignalNotReceived();
7414 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7415 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7417 application.SendNotification();
7418 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7420 // We did expect the animation to finish
7421 application.SendNotification();
7422 finishCheck.CheckSignalReceived();
7423 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7427 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void)
7429 TestApplication application;
7431 Actor actor = Actor::New();
7432 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7433 Stage::GetCurrent().Add(actor);
7434 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7436 // Build the animation
7437 float durationSeconds(1.0f);
7438 Animation animation = Animation::New(durationSeconds);
7439 Degree targetRotationDegrees(90.0f);
7440 Radian targetRotationRadians(targetRotationDegrees);
7442 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
7444 // Start the animation
7447 bool signalReceived(false);
7448 AnimationFinishCheck finishCheck(signalReceived);
7449 animation.FinishedSignal().Connect(&application, finishCheck);
7451 application.SendNotification();
7452 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7454 // We didn't expect the animation to finish yet
7455 application.SendNotification();
7456 finishCheck.CheckSignalNotReceived();
7457 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7458 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7460 application.SendNotification();
7461 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7463 // We didn't expect the animation to finish yet
7464 application.SendNotification();
7465 finishCheck.CheckSignalNotReceived();
7466 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7467 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7469 application.SendNotification();
7470 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7472 // We didn't expect the animation to finish yet
7473 application.SendNotification();
7474 finishCheck.CheckSignalNotReceived();
7475 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7476 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7478 application.SendNotification();
7479 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7481 // We did expect the animation to finish
7482 application.SendNotification();
7483 finishCheck.CheckSignalReceived();
7484 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7488 int UtcDaliAnimationAnimateToActorScaleP(void)
7490 TestApplication application;
7492 Actor actor = Actor::New();
7493 Stage::GetCurrent().Add(actor);
7494 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7496 // Build the animation
7497 float durationSeconds(1.0f);
7498 Animation animation = Animation::New(durationSeconds);
7499 Vector3 targetScale(2.0f, 2.0f, 2.0f);
7500 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale );
7502 Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f);
7504 // Start the animation
7507 bool signalReceived(false);
7508 AnimationFinishCheck finishCheck(signalReceived);
7509 animation.FinishedSignal().Connect(&application, finishCheck);
7511 application.SendNotification();
7512 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7514 // We didn't expect the animation to finish yet
7515 application.SendNotification();
7516 finishCheck.CheckSignalNotReceived();
7517 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
7519 application.SendNotification();
7520 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7522 // We did expect the animation to finish
7523 application.SendNotification();
7524 finishCheck.CheckSignalReceived();
7525 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7528 finishCheck.Reset();
7529 actor.SetScale(Vector3::ONE);
7530 application.SendNotification();
7531 application.Render(0);
7532 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7534 // Repeat with a different (ease-in) alpha function
7535 animation = Animation::New(durationSeconds);
7536 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
7537 animation.FinishedSignal().Connect(&application, finishCheck);
7540 application.SendNotification();
7541 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7543 // We didn't expect the animation to finish yet
7544 application.SendNotification();
7545 finishCheck.CheckSignalNotReceived();
7547 // The scale should have grown less, than with a linear alpha function
7548 Vector3 current(actor.GetCurrentScale());
7549 DALI_TEST_CHECK( current.x > 1.0f );
7550 DALI_TEST_CHECK( current.y > 1.0f );
7551 DALI_TEST_CHECK( current.z > 1.0f );
7552 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
7553 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
7554 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
7556 application.SendNotification();
7557 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7559 // We did expect the animation to finish
7560 application.SendNotification();
7561 finishCheck.CheckSignalReceived();
7562 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7565 finishCheck.Reset();
7566 actor.SetScale(Vector3::ONE);
7567 application.SendNotification();
7568 application.Render(0);
7569 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7571 // Repeat with a delay
7573 animation = Animation::New(durationSeconds);
7574 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7575 animation.FinishedSignal().Connect(&application, finishCheck);
7578 application.SendNotification();
7579 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7581 // We didn't expect the animation to finish yet
7582 application.SendNotification();
7583 finishCheck.CheckSignalNotReceived();
7584 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7586 application.SendNotification();
7587 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7589 // We did expect the animation to finish
7590 application.SendNotification();
7591 finishCheck.CheckSignalReceived();
7592 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7596 int UtcDaliAnimationAnimateToActorScaleXP(void)
7598 TestApplication application;
7600 Actor actor = Actor::New();
7601 Stage::GetCurrent().Add(actor);
7602 float startValue(1.0f);
7603 DALI_TEST_EQUALS( actor.GetCurrentScale().x, startValue, TEST_LOCATION );
7604 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7605 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7606 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7607 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7608 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7609 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7611 // Build the animation
7612 float durationSeconds(1.0f);
7613 Animation animation = Animation::New(durationSeconds);
7614 float targetX(10.0f);
7615 animation.AnimateTo( Property(actor, Actor::Property::SCALE_X), targetX );
7617 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
7619 // Start the animation
7622 bool signalReceived(false);
7623 AnimationFinishCheck finishCheck(signalReceived);
7624 animation.FinishedSignal().Connect(&application, finishCheck);
7626 application.SendNotification();
7627 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7629 // We didn't expect the animation to finish yet
7630 application.SendNotification();
7631 finishCheck.CheckSignalNotReceived();
7632 DALI_TEST_EQUALS( actor.GetCurrentScale().x, fiftyPercentProgress, TEST_LOCATION );
7633 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), fiftyPercentProgress, TEST_LOCATION );
7634 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7635 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7637 application.SendNotification();
7638 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7640 // We did expect the animation to finish
7641 application.SendNotification();
7642 finishCheck.CheckSignalReceived();
7643 DALI_TEST_EQUALS( actor.GetCurrentScale().x, targetX, TEST_LOCATION );
7644 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), targetX, TEST_LOCATION );
7645 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7646 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7650 int UtcDaliAnimationAnimateToActorScaleYP(void)
7652 TestApplication application;
7654 Actor actor = Actor::New();
7655 Stage::GetCurrent().Add(actor);
7656 float startValue(1.0f);
7657 DALI_TEST_EQUALS( actor.GetCurrentScale().y, startValue, TEST_LOCATION );
7658 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7659 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7660 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7661 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7662 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7663 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7665 // Build the animation
7666 float durationSeconds(1.0f);
7667 Animation animation = Animation::New(durationSeconds);
7668 float targetY(1000.0f);
7669 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Y), targetY );
7671 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
7673 // Start the animation
7676 bool signalReceived(false);
7677 AnimationFinishCheck finishCheck(signalReceived);
7678 animation.FinishedSignal().Connect(&application, finishCheck);
7680 application.SendNotification();
7681 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7683 // We didn't expect the animation to finish yet
7684 application.SendNotification();
7685 finishCheck.CheckSignalNotReceived();
7686 DALI_TEST_EQUALS( actor.GetCurrentScale().y, fiftyPercentProgress, TEST_LOCATION );
7687 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7688 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), fiftyPercentProgress, TEST_LOCATION );
7689 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7691 application.SendNotification();
7692 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7694 // We did expect the animation to finish
7695 application.SendNotification();
7696 finishCheck.CheckSignalReceived();
7697 DALI_TEST_EQUALS( actor.GetCurrentScale().y, targetY, TEST_LOCATION );
7698 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7699 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), targetY, TEST_LOCATION );
7700 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7704 int UtcDaliAnimationAnimateToActorScaleZP(void)
7706 TestApplication application;
7708 Actor actor = Actor::New();
7709 Stage::GetCurrent().Add(actor);
7710 float startValue(1.0f);
7711 DALI_TEST_EQUALS( actor.GetCurrentScale().z, startValue, TEST_LOCATION );
7712 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7713 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7714 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7715 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7716 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7717 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7719 // Build the animation
7720 float durationSeconds(1.0f);
7721 Animation animation = Animation::New(durationSeconds);
7722 float targetZ(-1000.0f);
7723 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Z), targetZ );
7725 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
7727 // Start the animation
7730 bool signalReceived(false);
7731 AnimationFinishCheck finishCheck(signalReceived);
7732 animation.FinishedSignal().Connect(&application, finishCheck);
7734 application.SendNotification();
7735 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7737 // We didn't expect the animation to finish yet
7738 application.SendNotification();
7739 finishCheck.CheckSignalNotReceived();
7740 DALI_TEST_EQUALS( actor.GetCurrentScale().z, fiftyPercentProgress, TEST_LOCATION );
7741 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7742 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7743 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), fiftyPercentProgress, TEST_LOCATION );
7745 application.SendNotification();
7746 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7748 // We did expect the animation to finish
7749 application.SendNotification();
7750 finishCheck.CheckSignalReceived();
7751 DALI_TEST_EQUALS( actor.GetCurrentScale().z, targetZ, TEST_LOCATION );
7752 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7753 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7754 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION );
7758 int UtcDaliAnimationAnimateToActorColorP(void)
7760 TestApplication application;
7762 Actor actor = Actor::New();
7763 Stage::GetCurrent().Add(actor);
7764 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7766 // Build the animation
7767 float durationSeconds(1.0f);
7768 Animation animation = Animation::New(durationSeconds);
7769 Vector4 targetColor(Color::RED);
7770 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor );
7772 Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
7773 Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
7775 // Start the animation
7778 bool signalReceived(false);
7779 AnimationFinishCheck finishCheck(signalReceived);
7780 animation.FinishedSignal().Connect(&application, finishCheck);
7782 application.SendNotification();
7783 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7785 // We didn't expect the animation to finish yet
7786 application.SendNotification();
7787 finishCheck.CheckSignalNotReceived();
7788 DALI_TEST_EQUALS( actor.GetCurrentColor(), tenPercentProgress, TEST_LOCATION );
7790 application.SendNotification();
7791 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7793 // We did expect the animation to finish
7794 application.SendNotification();
7795 finishCheck.CheckSignalReceived();
7796 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7799 finishCheck.Reset();
7800 actor.SetColor(Color::WHITE);
7801 application.SendNotification();
7802 application.Render(0);
7803 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7805 // Repeat with a different (ease-in) alpha function
7806 animation = Animation::New(durationSeconds);
7807 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
7808 animation.FinishedSignal().Connect(&application, finishCheck);
7811 application.SendNotification();
7812 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7814 // We didn't expect the animation to finish yet
7815 application.SendNotification();
7816 finishCheck.CheckSignalNotReceived();
7818 // The color should have changed less, than with a linear alpha function
7819 Vector4 current(actor.GetCurrentColor());
7820 DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change
7821 DALI_TEST_CHECK( current.y < 1.0f );
7822 DALI_TEST_CHECK( current.y > tenPercentProgress.y );
7823 DALI_TEST_CHECK( current.z < 1.0f );
7824 DALI_TEST_CHECK( current.z > tenPercentProgress.z );
7825 DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
7827 application.SendNotification();
7828 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7830 // We did expect the animation to finish
7831 application.SendNotification();
7832 finishCheck.CheckSignalReceived();
7833 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7836 finishCheck.Reset();
7837 actor.SetColor(Color::WHITE);
7838 application.SendNotification();
7839 application.Render(0);
7840 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7842 // Repeat with a shorter animator duration
7843 float animatorDuration = 0.5f;
7844 animation = Animation::New(durationSeconds);
7845 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
7846 animation.FinishedSignal().Connect(&application, finishCheck);
7849 application.SendNotification();
7850 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
7852 // We didn't expect the animation to finish yet
7853 application.SendNotification();
7854 finishCheck.CheckSignalNotReceived();
7855 DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION );
7857 application.SendNotification();
7858 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
7860 // We didn't expect the animation to finish yet
7861 application.SendNotification();
7862 finishCheck.CheckSignalNotReceived();
7863 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7865 application.SendNotification();
7866 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7868 // We did expect the animation to finish
7869 application.SendNotification();
7870 finishCheck.CheckSignalReceived();
7871 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7875 int UtcDaliAnimationAnimateToActorColorRedP(void)
7877 TestApplication application;
7879 Actor actor = Actor::New();
7880 Stage::GetCurrent().Add(actor);
7881 float startValue(1.0f);
7882 DALI_TEST_EQUALS( actor.GetCurrentColor().r, startValue, TEST_LOCATION );
7883 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7884 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7885 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7886 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7887 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
7888 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
7889 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
7890 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
7892 // Build the animation
7893 float durationSeconds(1.0f);
7894 Animation animation = Animation::New(durationSeconds);
7895 float targetRed(0.5f);
7896 animation.AnimateTo( Property(actor, Actor::Property::COLOR_RED), targetRed );
7898 float fiftyPercentProgress(startValue + (targetRed - startValue)*0.5f);
7900 // Start the animation
7903 bool signalReceived(false);
7904 AnimationFinishCheck finishCheck(signalReceived);
7905 animation.FinishedSignal().Connect(&application, finishCheck);
7907 application.SendNotification();
7908 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7910 // We didn't expect the animation to finish yet
7911 application.SendNotification();
7912 finishCheck.CheckSignalNotReceived();
7913 DALI_TEST_EQUALS( actor.GetCurrentColor().r, fiftyPercentProgress, TEST_LOCATION );
7914 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION );
7915 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7916 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7917 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7919 application.SendNotification();
7920 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7922 // We did expect the animation to finish
7923 application.SendNotification();
7924 finishCheck.CheckSignalReceived();
7925 DALI_TEST_EQUALS( actor.GetCurrentColor().r, targetRed, TEST_LOCATION );
7926 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED), targetRed, TEST_LOCATION );
7927 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7928 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7929 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7933 int UtcDaliAnimationAnimateToActorColorGreenP(void)
7935 TestApplication application;
7937 Actor actor = Actor::New();
7938 Stage::GetCurrent().Add(actor);
7939 float startValue(1.0f);
7940 DALI_TEST_EQUALS( actor.GetCurrentColor().g, startValue, TEST_LOCATION );
7941 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7942 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7943 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7944 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7945 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
7946 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
7947 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
7948 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
7950 // Build the animation
7951 float durationSeconds(1.0f);
7952 Animation animation = Animation::New(durationSeconds);
7953 float targetGreen(0.5f);
7954 animation.AnimateTo( Property(actor, Actor::Property::COLOR_GREEN), targetGreen );
7956 float fiftyPercentProgress(startValue + (targetGreen - startValue)*0.5f);
7958 // Start the animation
7961 bool signalReceived(false);
7962 AnimationFinishCheck finishCheck(signalReceived);
7963 animation.FinishedSignal().Connect(&application, finishCheck);
7965 application.SendNotification();
7966 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7968 // We didn't expect the animation to finish yet
7969 application.SendNotification();
7970 finishCheck.CheckSignalNotReceived();
7971 DALI_TEST_EQUALS( actor.GetCurrentColor().g, fiftyPercentProgress, TEST_LOCATION );
7972 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7973 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION );
7974 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7975 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7977 application.SendNotification();
7978 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7980 // We did expect the animation to finish
7981 application.SendNotification();
7982 finishCheck.CheckSignalReceived();
7983 DALI_TEST_EQUALS( actor.GetCurrentColor().g, targetGreen, TEST_LOCATION );
7984 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7985 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION );
7986 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7987 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7991 int UtcDaliAnimationAnimateToActorColorBlueP(void)
7993 TestApplication application;
7995 Actor actor = Actor::New();
7996 Stage::GetCurrent().Add(actor);
7997 float startValue(1.0f);
7998 DALI_TEST_EQUALS( actor.GetCurrentColor().b, startValue, TEST_LOCATION );
7999 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8000 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8001 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8002 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8003 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8004 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8005 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8006 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8008 // Build the animation
8009 float durationSeconds(1.0f);
8010 Animation animation = Animation::New(durationSeconds);
8011 float targetBlue(0.5f);
8012 animation.AnimateTo( Property(actor, Actor::Property::COLOR_BLUE), targetBlue );
8014 float fiftyPercentProgress(startValue + (targetBlue - startValue)*0.5f);
8016 // Start the animation
8019 bool signalReceived(false);
8020 AnimationFinishCheck finishCheck(signalReceived);
8021 animation.FinishedSignal().Connect(&application, finishCheck);
8023 application.SendNotification();
8024 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8026 // We didn't expect the animation to finish yet
8027 application.SendNotification();
8028 finishCheck.CheckSignalNotReceived();
8029 DALI_TEST_EQUALS( actor.GetCurrentColor().b, fiftyPercentProgress, TEST_LOCATION );
8030 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8031 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8032 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), fiftyPercentProgress, TEST_LOCATION );
8033 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8035 application.SendNotification();
8036 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8038 // We did expect the animation to finish
8039 application.SendNotification();
8040 finishCheck.CheckSignalReceived();
8041 DALI_TEST_EQUALS( actor.GetCurrentColor().b, targetBlue, TEST_LOCATION );
8042 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8043 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8044 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), targetBlue, TEST_LOCATION );
8045 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8049 int UtcDaliAnimationAnimateToActorColorAlphaP(void)
8051 TestApplication application;
8053 Actor actor = Actor::New();
8054 Stage::GetCurrent().Add(actor);
8055 float startValue(1.0f);
8056 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8057 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8058 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8059 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8060 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8061 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8062 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8063 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8064 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8066 // Build the animation
8067 float durationSeconds(1.0f);
8068 Animation animation = Animation::New(durationSeconds);
8069 float targetAlpha(0.5f);
8070 animation.AnimateTo( Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha );
8072 float fiftyPercentProgress(startValue + (targetAlpha - startValue)*0.5f);
8074 // Start the animation
8077 bool signalReceived(false);
8078 AnimationFinishCheck finishCheck(signalReceived);
8079 animation.FinishedSignal().Connect(&application, finishCheck);
8081 application.SendNotification();
8082 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8084 // We didn't expect the animation to finish yet
8085 application.SendNotification();
8086 finishCheck.CheckSignalNotReceived();
8087 DALI_TEST_EQUALS( actor.GetCurrentColor().a, fiftyPercentProgress, TEST_LOCATION );
8088 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8089 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8090 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8091 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), fiftyPercentProgress, TEST_LOCATION );
8093 application.SendNotification();
8094 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8096 // We did expect the animation to finish
8097 application.SendNotification();
8098 finishCheck.CheckSignalReceived();
8099 DALI_TEST_EQUALS( actor.GetCurrentColor().a, targetAlpha, TEST_LOCATION );
8100 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8101 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8102 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8103 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
8107 int UtcDaliAnimationKeyFrames01P(void)
8109 TestApplication application;
8111 KeyFrames keyFrames = KeyFrames::New();
8112 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8114 keyFrames.Add(0.0f, 0.1f);
8116 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8118 KeyFrames keyFrames2( keyFrames);
8119 DALI_TEST_CHECK( keyFrames2 );
8120 DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
8122 KeyFrames keyFrames3 = KeyFrames::New();
8123 keyFrames3.Add(0.6f, true);
8124 DALI_TEST_CHECK( keyFrames3 );
8125 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
8127 keyFrames3 = keyFrames;
8128 DALI_TEST_CHECK( keyFrames3 );
8129 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
8134 int UtcDaliAnimationKeyFrames02P(void)
8136 TestApplication application;
8138 KeyFrames keyFrames = KeyFrames::New();
8139 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8141 keyFrames.Add(0.0f, 0.1f);
8142 keyFrames.Add(0.2f, 0.5f);
8143 keyFrames.Add(0.4f, 0.0f);
8144 keyFrames.Add(0.6f, 1.0f);
8145 keyFrames.Add(0.8f, 0.7f);
8146 keyFrames.Add(1.0f, 0.9f);
8148 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8152 keyFrames.Add(1.9f, false);
8154 catch (Dali::DaliException& e)
8156 DALI_TEST_PRINT_ASSERT( e );
8157 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8162 int UtcDaliAnimationKeyFrames03P(void)
8164 TestApplication application;
8166 KeyFrames keyFrames = KeyFrames::New();
8167 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8169 keyFrames.Add(0.0f, true);
8170 keyFrames.Add(0.2f, false);
8171 keyFrames.Add(0.4f, false);
8172 keyFrames.Add(0.6f, true);
8173 keyFrames.Add(0.8f, true);
8174 keyFrames.Add(1.0f, false);
8176 DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
8180 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8182 catch (Dali::DaliException& e)
8184 DALI_TEST_PRINT_ASSERT( e );
8185 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8190 int UtcDaliAnimationKeyFrames04P(void)
8192 TestApplication application;
8194 KeyFrames keyFrames = KeyFrames::New();
8195 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8197 keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
8198 keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
8199 keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
8200 keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
8201 keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
8202 keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
8204 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
8208 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8210 catch (Dali::DaliException& e)
8212 DALI_TEST_PRINT_ASSERT( e );
8213 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8218 int UtcDaliAnimationKeyFrames05P(void)
8220 TestApplication application;
8222 KeyFrames keyFrames = KeyFrames::New();
8223 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8225 keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
8226 keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
8227 keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
8228 keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
8229 keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
8230 keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
8232 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
8236 keyFrames.Add(0.7f, 1.0f);
8238 catch (Dali::DaliException& e)
8240 DALI_TEST_PRINT_ASSERT( e );
8241 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8246 int UtcDaliAnimationKeyFrames06P(void)
8248 TestApplication application;
8250 KeyFrames keyFrames = KeyFrames::New();
8251 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8253 keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
8254 keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8255 keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
8256 keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
8257 keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
8258 keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
8260 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
8264 keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
8266 catch (Dali::DaliException& e)
8268 DALI_TEST_PRINT_ASSERT( e );
8269 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8274 int UtcDaliAnimationKeyFrames07P(void)
8276 TestApplication application;
8278 KeyFrames keyFrames = KeyFrames::New();
8279 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8281 keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
8282 keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
8283 keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
8284 keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
8285 keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
8286 keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
8288 DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
8292 keyFrames.Add(0.7f, 1.1f);
8294 catch (Dali::DaliException& e)
8296 DALI_TEST_PRINT_ASSERT( e );
8297 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8302 int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
8304 TestApplication application;
8306 float startValue(1.0f);
8307 Actor actor = Actor::New();
8308 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8309 Stage::GetCurrent().Add(actor);
8311 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8312 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8313 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8314 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8315 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8316 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8317 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8318 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8319 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8321 // Build the animation
8322 float durationSeconds(1.0f);
8323 Animation animation = Animation::New(durationSeconds);
8325 KeyFrames keyFrames = KeyFrames::New();
8326 keyFrames.Add(0.0f, 0.1f);
8327 keyFrames.Add(0.2f, 0.5f);
8328 keyFrames.Add(0.4f, 0.0f);
8329 keyFrames.Add(0.6f, 1.0f);
8330 keyFrames.Add(0.8f, 0.7f);
8331 keyFrames.Add(1.0f, 0.9f);
8333 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames );
8335 // Start the animation
8338 bool signalReceived(false);
8339 AnimationFinishCheck finishCheck(signalReceived);
8340 animation.FinishedSignal().Connect(&application, finishCheck);
8341 application.SendNotification();
8342 application.Render(0);
8343 application.SendNotification();
8344 finishCheck.CheckSignalNotReceived();
8345 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
8347 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8348 application.SendNotification();
8349 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8350 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8351 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8352 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION );
8353 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.3f, 0.01f, TEST_LOCATION );
8355 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
8356 application.SendNotification();
8357 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8358 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8359 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8360 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION );
8361 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.25f, 0.01f, TEST_LOCATION );
8363 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
8364 application.SendNotification();
8365 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8366 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8367 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8368 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
8369 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
8371 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
8372 application.SendNotification();
8373 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8374 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8375 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8376 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
8377 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
8379 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
8380 application.SendNotification();
8381 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8382 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8383 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8384 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION );
8385 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.8f, 0.01f, TEST_LOCATION );
8387 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
8388 application.SendNotification();
8389 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8390 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8391 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8392 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
8393 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
8395 // We did expect the animation to finish
8397 finishCheck.CheckSignalReceived();
8401 int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
8403 TestApplication application;
8405 float startValue(1.0f);
8406 Actor actor = Actor::New();
8407 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8408 Stage::GetCurrent().Add(actor);
8410 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8411 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8412 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8413 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8414 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8415 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8416 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8417 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8418 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8420 // Build the animation
8421 float durationSeconds(1.0f);
8422 Animation animation = Animation::New(durationSeconds);
8424 KeyFrames keyFrames = KeyFrames::New();
8425 keyFrames.Add(0.0f, 0.1f);
8426 keyFrames.Add(0.2f, 0.5f);
8427 keyFrames.Add(0.4f, 0.0f);
8428 keyFrames.Add(0.6f, 1.0f);
8429 keyFrames.Add(0.8f, 0.7f);
8430 keyFrames.Add(1.0f, 0.9f);
8432 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::Cubic );
8434 // Start the animation
8437 bool signalReceived(false);
8438 AnimationFinishCheck finishCheck(signalReceived);
8439 animation.FinishedSignal().Connect(&application, finishCheck);
8440 application.SendNotification();
8441 application.Render(0);
8442 application.SendNotification();
8443 finishCheck.CheckSignalNotReceived();
8444 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
8446 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8447 application.SendNotification();
8448 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8449 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8450 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8451 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.36f, 0.01f, TEST_LOCATION );
8452 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.36f, 0.01f, TEST_LOCATION );
8454 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
8455 application.SendNotification();
8456 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8457 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8458 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8459 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.21f, 0.01f, TEST_LOCATION );
8460 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.21f, 0.01f, TEST_LOCATION );
8462 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
8463 application.SendNotification();
8464 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8465 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8466 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8467 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.0f, 0.01f, TEST_LOCATION );
8468 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
8470 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
8471 application.SendNotification();
8472 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8473 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8474 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8475 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.7f, 0.01f, TEST_LOCATION );
8476 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
8478 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
8479 application.SendNotification();
8480 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8481 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8482 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8483 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.76f, 0.01f, TEST_LOCATION );
8484 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.76f, 0.01f, TEST_LOCATION );
8486 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
8487 application.SendNotification();
8488 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8489 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8490 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8491 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.9f, 0.01f, TEST_LOCATION );
8492 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
8494 // We did expect the animation to finish
8496 finishCheck.CheckSignalReceived();
8500 int UtcDaliAnimationAnimateBetweenActorColorP(void)
8502 TestApplication application;
8504 float startValue(1.0f);
8505 Actor actor = Actor::New();
8506 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8507 Stage::GetCurrent().Add(actor);
8509 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8510 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8511 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8512 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8513 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8514 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8515 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8516 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8517 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8519 // Build the animation
8520 float durationSeconds(1.0f);
8521 Animation animation = Animation::New(durationSeconds);
8523 KeyFrames keyFrames = KeyFrames::New();
8524 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8525 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8526 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8528 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames );
8530 // Start the animation
8533 bool signalReceived(false);
8534 AnimationFinishCheck finishCheck(signalReceived);
8535 animation.FinishedSignal().Connect(&application, finishCheck);
8536 application.SendNotification();
8537 application.Render(0);
8538 application.SendNotification();
8539 finishCheck.CheckSignalNotReceived();
8540 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
8541 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
8542 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
8543 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
8545 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8546 application.SendNotification();
8547 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
8548 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
8549 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
8550 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
8552 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8553 application.SendNotification();
8554 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
8555 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
8556 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
8557 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
8559 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8560 application.SendNotification();
8561 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
8562 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
8563 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
8564 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
8566 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8567 application.SendNotification();
8568 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
8569 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
8570 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
8571 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
8573 // We did expect the animation to finish
8575 finishCheck.CheckSignalReceived();
8579 int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
8581 TestApplication application;
8583 float startValue(1.0f);
8584 Actor actor = Actor::New();
8585 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8586 Stage::GetCurrent().Add(actor);
8588 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8589 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8590 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8591 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8592 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8593 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8594 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8595 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8596 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8598 // Build the animation
8599 float durationSeconds(1.0f);
8600 Animation animation = Animation::New(durationSeconds);
8602 KeyFrames keyFrames = KeyFrames::New();
8603 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8604 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8605 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8607 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, Animation::Cubic );
8609 // Start the animation
8612 bool signalReceived(false);
8613 AnimationFinishCheck finishCheck(signalReceived);
8614 animation.FinishedSignal().Connect(&application, finishCheck);
8615 application.SendNotification();
8616 application.Render(0);
8617 application.SendNotification();
8618 finishCheck.CheckSignalNotReceived();
8619 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
8620 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
8621 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
8622 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
8624 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8625 application.SendNotification();
8626 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
8627 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
8628 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
8629 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
8631 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8632 application.SendNotification();
8633 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
8634 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
8635 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
8636 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
8638 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8639 application.SendNotification();
8640 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
8641 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
8642 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
8643 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
8645 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8646 application.SendNotification();
8647 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
8648 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
8649 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
8650 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
8652 // We did expect the animation to finish
8654 finishCheck.CheckSignalReceived();
8658 int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
8660 TestApplication application;
8662 Actor actor = Actor::New();
8663 AngleAxis aa(Degree(90), Vector3::XAXIS);
8664 actor.SetOrientation(aa.angle, aa.axis);
8665 Stage::GetCurrent().Add(actor);
8667 application.SendNotification();
8668 application.Render(0);
8670 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
8672 // Build the animation
8673 float durationSeconds(1.0f);
8674 Animation animation = Animation::New(durationSeconds);
8676 KeyFrames keyFrames = KeyFrames::New();
8677 keyFrames.Add(0.0f, false);
8678 keyFrames.Add(0.2f, true);
8679 keyFrames.Add(0.4f, true);
8680 keyFrames.Add(0.8f, false);
8681 keyFrames.Add(1.0f, true);
8683 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames );
8685 // Start the animation
8688 bool signalReceived(false);
8689 AnimationFinishCheck finishCheck(signalReceived);
8690 animation.FinishedSignal().Connect(&application, finishCheck);
8691 application.SendNotification();
8692 application.SendNotification();
8693 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8694 application.SendNotification();
8695 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8696 application.SendNotification();
8698 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
8699 finishCheck.CheckSignalReceived();
8703 int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
8705 TestApplication application;
8707 Actor actor = Actor::New();
8708 AngleAxis aa(Degree(90), Vector3::XAXIS);
8709 actor.SetOrientation(aa.angle, aa.axis);
8710 Stage::GetCurrent().Add(actor);
8712 application.SendNotification();
8713 application.Render(0);
8715 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
8717 // Build the animation
8718 float durationSeconds(1.0f);
8719 Animation animation = Animation::New(durationSeconds);
8721 KeyFrames keyFrames = KeyFrames::New();
8722 keyFrames.Add(0.0f, false);
8723 keyFrames.Add(0.2f, true);
8724 keyFrames.Add(0.4f, true);
8725 keyFrames.Add(0.8f, false);
8726 keyFrames.Add(1.0f, true);
8728 //Cubic interpolation for boolean values should be ignored
8729 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::Cubic );
8731 // Start the animation
8734 bool signalReceived(false);
8735 AnimationFinishCheck finishCheck(signalReceived);
8736 animation.FinishedSignal().Connect(&application, finishCheck);
8737 application.SendNotification();
8738 application.SendNotification();
8739 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8740 application.SendNotification();
8741 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8742 application.SendNotification();
8744 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
8745 finishCheck.CheckSignalReceived();
8749 int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
8751 TestApplication application;
8753 Actor actor = Actor::New();
8754 AngleAxis aa(Degree(90), Vector3::XAXIS);
8755 actor.SetOrientation(aa.angle, aa.axis);
8756 Stage::GetCurrent().Add(actor);
8758 application.SendNotification();
8759 application.Render(0);
8760 Quaternion start(Radian(aa.angle), aa.axis);
8761 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8763 // Build the animation
8764 float durationSeconds(1.0f);
8765 Animation animation = Animation::New(durationSeconds);
8767 KeyFrames keyFrames = KeyFrames::New();
8768 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
8770 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
8772 // Start the animation
8775 bool signalReceived(false);
8776 AnimationFinishCheck finishCheck(signalReceived);
8777 animation.FinishedSignal().Connect(&application, finishCheck);
8778 application.SendNotification();
8779 application.SendNotification();
8780 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8781 application.SendNotification();
8782 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8783 application.SendNotification();
8785 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
8787 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8788 finishCheck.CheckSignalReceived();
8792 int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
8794 TestApplication application;
8796 Actor actor = Actor::New();
8797 AngleAxis aa(Degree(90), Vector3::XAXIS);
8798 actor.SetOrientation(aa.angle, aa.axis);
8799 application.SendNotification();
8800 application.Render(0);
8801 Stage::GetCurrent().Add(actor);
8803 Quaternion start(Radian(aa.angle), aa.axis);
8804 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8806 // Build the animation
8807 float durationSeconds(1.0f);
8808 Animation animation = Animation::New(durationSeconds);
8810 KeyFrames keyFrames = KeyFrames::New();
8811 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
8812 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
8813 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
8815 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
8817 // Start the animation
8820 bool signalReceived(false);
8821 AnimationFinishCheck finishCheck(signalReceived);
8822 animation.FinishedSignal().Connect(&application, finishCheck);
8823 application.SendNotification();
8824 application.Render(0);
8825 application.SendNotification();
8826 finishCheck.CheckSignalNotReceived();
8828 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
8829 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8831 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8832 application.SendNotification();
8833 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
8834 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8836 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8837 application.SendNotification();
8838 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
8839 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8841 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8842 application.SendNotification();
8843 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f) );
8844 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8846 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8847 application.SendNotification();
8848 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
8849 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8851 // We did expect the animation to finish
8853 finishCheck.CheckSignalReceived();
8857 int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
8859 TestApplication application;
8861 Actor actor = Actor::New();
8862 AngleAxis aa(Degree(90), Vector3::XAXIS);
8863 actor.SetOrientation(aa.angle, aa.axis);
8864 Stage::GetCurrent().Add(actor);
8866 application.SendNotification();
8867 application.Render(0);
8868 Quaternion start(Radian(aa.angle), aa.axis);
8869 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8871 // Build the animation
8872 float durationSeconds(1.0f);
8873 Animation animation = Animation::New(durationSeconds);
8875 KeyFrames keyFrames = KeyFrames::New();
8876 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
8878 //Cubic interpolation should be ignored for quaternions
8879 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), 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 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
8896 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8897 finishCheck.CheckSignalReceived();
8901 int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
8903 TestApplication application;
8905 Actor actor = Actor::New();
8906 AngleAxis aa(Degree(90), Vector3::XAXIS);
8907 actor.SetOrientation(aa.angle, aa.axis);
8908 application.SendNotification();
8909 application.Render(0);
8910 Stage::GetCurrent().Add(actor);
8912 Quaternion start(Radian(aa.angle), aa.axis);
8913 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8915 // Build the animation
8916 float durationSeconds(1.0f);
8917 Animation animation = Animation::New(durationSeconds);
8919 KeyFrames keyFrames = KeyFrames::New();
8920 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
8921 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
8922 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
8924 //Cubic interpolation should be ignored for quaternions
8925 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
8927 // Start the animation
8930 bool signalReceived(false);
8931 AnimationFinishCheck finishCheck(signalReceived);
8932 animation.FinishedSignal().Connect(&application, finishCheck);
8933 application.SendNotification();
8934 application.Render(0);
8935 application.SendNotification();
8936 finishCheck.CheckSignalNotReceived();
8938 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
8939 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8941 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8942 application.SendNotification();
8943 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
8944 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8946 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8947 application.SendNotification();
8948 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
8949 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8951 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8952 application.SendNotification();
8953 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f ) );
8954 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8956 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8957 application.SendNotification();
8958 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
8959 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8961 // We did expect the animation to finish
8963 finishCheck.CheckSignalReceived();
8967 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
8969 TestApplication application;
8971 float startValue(1.0f);
8972 Actor actor = Actor::New();
8973 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8974 Stage::GetCurrent().Add(actor);
8976 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8977 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8978 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8979 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8980 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8981 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8982 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8983 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8984 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8986 // Build the animation
8987 float durationSeconds(1.0f);
8988 Animation animation = Animation::New(durationSeconds);
8990 KeyFrames keyFrames = KeyFrames::New();
8991 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8992 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8993 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8995 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR );
8997 // Start the animation
9000 bool signalReceived(false);
9001 AnimationFinishCheck finishCheck(signalReceived);
9002 animation.FinishedSignal().Connect(&application, finishCheck);
9003 application.SendNotification();
9004 application.Render(0);
9005 application.SendNotification();
9006 finishCheck.CheckSignalNotReceived();
9007 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9008 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9009 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9010 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9012 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9013 application.SendNotification();
9014 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9015 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9016 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9017 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9019 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9020 application.SendNotification();
9021 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9022 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9023 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9024 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9026 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9027 application.SendNotification();
9028 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9029 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9030 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9031 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9033 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9034 application.SendNotification();
9035 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9036 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9037 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9038 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9040 // We did expect the animation to finish
9042 finishCheck.CheckSignalReceived();
9046 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
9048 TestApplication application;
9050 float startValue(1.0f);
9051 Actor actor = Actor::New();
9052 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9053 Stage::GetCurrent().Add(actor);
9055 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9056 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9057 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9058 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9059 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9060 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9061 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9062 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9063 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, 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, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9071 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9072 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9074 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::Cubic );
9076 // Start the animation
9079 bool signalReceived(false);
9080 AnimationFinishCheck finishCheck(signalReceived);
9081 animation.FinishedSignal().Connect(&application, finishCheck);
9082 application.SendNotification();
9083 application.Render(0);
9084 application.SendNotification();
9085 finishCheck.CheckSignalNotReceived();
9086 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9087 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9088 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9089 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9091 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9092 application.SendNotification();
9093 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9094 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9095 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9096 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9098 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9099 application.SendNotification();
9100 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9101 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9102 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9103 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9105 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9106 application.SendNotification();
9107 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9108 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9109 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9110 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9112 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9113 application.SendNotification();
9114 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9115 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9116 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9117 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9119 // We did expect the animation to finish
9121 finishCheck.CheckSignalReceived();
9125 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void)
9127 TestApplication application;
9129 float startValue(1.0f);
9130 Actor actor = Actor::New();
9131 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9132 Stage::GetCurrent().Add(actor);
9134 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9135 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9136 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9137 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9138 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9139 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9140 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9141 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9142 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9144 // Build the animation
9145 float durationSeconds(1.0f);
9147 Animation animation = Animation::New(durationSeconds);
9149 KeyFrames keyFrames = KeyFrames::New();
9150 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9151 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9152 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9154 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ) );
9156 // Start the animation
9159 bool signalReceived(false);
9160 AnimationFinishCheck finishCheck(signalReceived);
9161 animation.FinishedSignal().Connect(&application, finishCheck);
9162 application.SendNotification();
9164 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9165 application.SendNotification();
9166 finishCheck.CheckSignalNotReceived();
9167 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9168 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9169 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9170 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9172 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9173 application.SendNotification();
9174 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9175 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9176 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9177 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9179 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9180 application.SendNotification();
9181 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9182 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9183 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9184 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9186 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9187 application.SendNotification();
9188 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9189 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9190 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9191 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9193 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9194 application.SendNotification();
9195 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9196 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9197 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9198 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9200 // We did expect the animation to finish
9202 finishCheck.CheckSignalReceived();
9206 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
9208 TestApplication application;
9210 float startValue(1.0f);
9211 Actor actor = Actor::New();
9212 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9213 Stage::GetCurrent().Add(actor);
9215 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9216 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9217 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9218 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9219 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9220 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9221 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9222 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9223 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9225 // Build the animation
9226 float durationSeconds(1.0f);
9228 Animation animation = Animation::New(durationSeconds);
9230 KeyFrames keyFrames = KeyFrames::New();
9231 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9232 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9233 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9235 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
9237 // Start the animation
9240 bool signalReceived(false);
9241 AnimationFinishCheck finishCheck(signalReceived);
9242 animation.FinishedSignal().Connect(&application, finishCheck);
9243 application.SendNotification();
9245 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9246 application.SendNotification();
9247 finishCheck.CheckSignalNotReceived();
9248 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9249 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9250 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9251 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9253 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9254 application.SendNotification();
9255 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9256 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9257 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9258 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9260 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9261 application.SendNotification();
9262 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9263 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
9264 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9265 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9267 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9268 application.SendNotification();
9269 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9270 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9271 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9272 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9274 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9275 application.SendNotification();
9276 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9277 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9278 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9279 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9281 // We did expect the animation to finish
9283 finishCheck.CheckSignalReceived();
9287 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
9289 TestApplication application;
9291 float startValue(1.0f);
9293 Actor actor = Actor::New();
9294 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9295 Stage::GetCurrent().Add(actor);
9297 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9298 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9299 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9300 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9301 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9302 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9303 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9304 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9305 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9307 // Build the animation
9308 float durationSeconds(1.0f);
9309 Animation animation = Animation::New(durationSeconds);
9311 KeyFrames keyFrames = KeyFrames::New();
9312 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9313 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9314 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9316 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
9318 // Start the animation
9321 bool signalReceived(false);
9322 AnimationFinishCheck finishCheck(signalReceived);
9323 animation.FinishedSignal().Connect(&application, finishCheck);
9324 application.SendNotification();
9326 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9327 application.SendNotification();
9328 finishCheck.CheckSignalNotReceived();
9329 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9330 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9331 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9332 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9334 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9335 application.SendNotification();
9336 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9337 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9338 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9339 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9341 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9342 application.SendNotification();
9343 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9344 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9345 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9346 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9348 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9349 application.SendNotification();
9350 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9351 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9352 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9353 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9355 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9356 application.SendNotification();
9357 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9358 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9359 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9360 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9362 // We did expect the animation to finish
9364 finishCheck.CheckSignalReceived();
9368 int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void)
9370 TestApplication application;
9372 float startValue(1.0f);
9373 Actor actor = Actor::New();
9374 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9375 Stage::GetCurrent().Add(actor);
9377 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9378 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9379 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9380 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9381 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9382 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9383 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9384 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9385 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9388 // Build the animation
9389 float durationSeconds(1.0f);
9391 Animation animation = Animation::New(durationSeconds);
9393 KeyFrames keyFrames = KeyFrames::New();
9394 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9395 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9396 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9398 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
9400 // Start the animation
9403 bool signalReceived(false);
9404 AnimationFinishCheck finishCheck(signalReceived);
9405 animation.FinishedSignal().Connect(&application, finishCheck);
9406 application.SendNotification();
9408 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9409 application.SendNotification();
9410 finishCheck.CheckSignalNotReceived();
9411 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9412 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9413 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9414 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9416 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9417 application.SendNotification();
9418 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9419 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9420 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9421 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9423 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9424 application.SendNotification();
9425 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9426 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9427 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9428 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9430 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9431 application.SendNotification();
9432 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9433 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9434 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9435 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9437 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9438 application.SendNotification();
9439 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9440 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9441 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9442 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9444 // We did expect the animation to finish
9446 finishCheck.CheckSignalReceived();
9450 int UtcDaliAnimationAnimateP(void)
9452 TestApplication application;
9454 Actor actor = Actor::New();
9455 Stage::GetCurrent().Add(actor);
9458 Vector3 position0( 30.0, 80.0, 0.0);
9459 Vector3 position1( 70.0, 120.0, 0.0);
9460 Vector3 position2( 100.0, 100.0, 0.0);
9462 Dali::Path path = Dali::Path::New();
9463 path.AddPoint(position0);
9464 path.AddPoint(position1);
9465 path.AddPoint(position2);
9467 //Control points for first segment
9468 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9469 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9471 //Control points for second segment
9472 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9473 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9475 // Build the animation
9476 float durationSeconds( 1.0f );
9477 Animation animation = Animation::New(durationSeconds);
9478 animation.Animate(actor, path, Vector3::XAXIS);
9480 // Start the animation
9483 bool signalReceived(false);
9484 AnimationFinishCheck finishCheck(signalReceived);
9485 animation.FinishedSignal().Connect(&application, finishCheck);
9486 application.SendNotification();
9487 application.Render(0);
9488 application.SendNotification();
9489 finishCheck.CheckSignalNotReceived();
9490 Vector3 position, tangent;
9491 Quaternion rotation;
9492 path.Sample( 0.0f, position, tangent );
9493 rotation = Quaternion( Vector3::XAXIS, tangent );
9494 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9495 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9497 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9498 application.SendNotification();
9499 path.Sample( 0.25f, position, tangent );
9500 rotation = Quaternion( Vector3::XAXIS, tangent );
9501 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9502 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9504 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9505 application.SendNotification();
9506 path.Sample( 0.5f, position, tangent );
9507 rotation = Quaternion( Vector3::XAXIS, tangent );
9508 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9509 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9511 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9512 application.SendNotification();
9513 path.Sample( 0.75f, position, tangent );
9514 rotation = Quaternion( Vector3::XAXIS, tangent );
9515 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9516 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9518 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9519 application.SendNotification();
9520 path.Sample( 1.0f, position, tangent );
9521 rotation = Quaternion( Vector3::XAXIS, tangent );
9522 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9523 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9525 finishCheck.CheckSignalReceived();
9529 int UtcDaliAnimationAnimateAlphaFunctionP(void)
9531 TestApplication application;
9533 Actor actor = Actor::New();
9534 Stage::GetCurrent().Add(actor);
9537 Vector3 position0( 30.0, 80.0, 0.0);
9538 Vector3 position1( 70.0, 120.0, 0.0);
9539 Vector3 position2( 100.0, 100.0, 0.0);
9541 Dali::Path path = Dali::Path::New();
9542 path.AddPoint(position0);
9543 path.AddPoint(position1);
9544 path.AddPoint(position2);
9546 //Control points for first segment
9547 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9548 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9550 //Control points for second segment
9551 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9552 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9554 // Build the animation
9555 float durationSeconds( 1.0f );
9556 Animation animation = Animation::New(durationSeconds);
9557 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
9559 // Start the animation
9562 bool signalReceived(false);
9563 AnimationFinishCheck finishCheck(signalReceived);
9564 animation.FinishedSignal().Connect(&application, finishCheck);
9565 application.SendNotification();
9566 application.Render(0);
9567 application.SendNotification();
9568 finishCheck.CheckSignalNotReceived();
9569 Vector3 position, tangent;
9570 Quaternion rotation;
9571 path.Sample( 0.0f, position, tangent );
9572 rotation = Quaternion( Vector3::XAXIS, tangent );
9573 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9574 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9576 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9577 application.SendNotification();
9578 path.Sample( 0.25f, position, tangent );
9579 rotation = Quaternion( Vector3::XAXIS, tangent );
9580 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9581 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9583 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9584 application.SendNotification();
9585 path.Sample( 0.5f, position, tangent );
9586 rotation = Quaternion( Vector3::XAXIS, tangent );
9587 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9588 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9590 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9591 application.SendNotification();
9592 path.Sample( 0.75f, position, tangent );
9593 rotation = Quaternion( Vector3::XAXIS, tangent );
9594 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9595 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9597 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9598 application.SendNotification();
9599 path.Sample( 1.0f, position, tangent );
9600 rotation = Quaternion( Vector3::XAXIS, tangent );
9601 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9602 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9604 finishCheck.CheckSignalReceived();
9608 int UtcDaliAnimationAnimateTimePeriodP(void)
9610 TestApplication application;
9612 Actor actor = Actor::New();
9613 Stage::GetCurrent().Add(actor);
9616 Vector3 position0( 30.0, 80.0, 0.0);
9617 Vector3 position1( 70.0, 120.0, 0.0);
9618 Vector3 position2( 100.0, 100.0, 0.0);
9620 Dali::Path path = Dali::Path::New();
9621 path.AddPoint(position0);
9622 path.AddPoint(position1);
9623 path.AddPoint(position2);
9625 //Control points for first segment
9626 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9627 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9629 //Control points for second segment
9630 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9631 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9633 // Build the animation
9634 float durationSeconds( 1.0f );
9635 Animation animation = Animation::New(durationSeconds);
9636 animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
9638 // Start the animation
9641 bool signalReceived(false);
9642 AnimationFinishCheck finishCheck(signalReceived);
9643 animation.FinishedSignal().Connect(&application, finishCheck);
9644 application.SendNotification();
9645 application.Render(0);
9646 application.SendNotification();
9647 finishCheck.CheckSignalNotReceived();
9648 Vector3 position, tangent;
9649 Quaternion rotation;
9650 path.Sample( 0.0f, position, tangent );
9651 rotation = Quaternion( Vector3::XAXIS, tangent );
9652 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9653 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9655 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9656 application.SendNotification();
9657 path.Sample( 0.25f, position, tangent );
9658 rotation = Quaternion( Vector3::XAXIS, tangent );
9659 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9660 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9662 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9663 application.SendNotification();
9664 path.Sample( 0.5f, position, tangent );
9665 rotation = Quaternion( Vector3::XAXIS, tangent );
9666 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9667 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9669 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9670 application.SendNotification();
9671 path.Sample( 0.75f, position, tangent );
9672 rotation = Quaternion( Vector3::XAXIS, tangent );
9673 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9674 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9676 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9677 application.SendNotification();
9678 path.Sample( 1.0f, position, tangent );
9679 rotation = Quaternion( Vector3::XAXIS, tangent );
9680 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9681 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9683 finishCheck.CheckSignalReceived();
9687 int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
9689 TestApplication application;
9691 Actor actor = Actor::New();
9692 Stage::GetCurrent().Add(actor);
9695 Vector3 position0( 30.0, 80.0, 0.0);
9696 Vector3 position1( 70.0, 120.0, 0.0);
9697 Vector3 position2( 100.0, 100.0, 0.0);
9699 Dali::Path path = Dali::Path::New();
9700 path.AddPoint(position0);
9701 path.AddPoint(position1);
9702 path.AddPoint(position2);
9704 //Control points for first segment
9705 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9706 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9708 //Control points for second segment
9709 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9710 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9712 // Build the animation
9713 float durationSeconds( 1.0f );
9714 Animation animation = Animation::New(durationSeconds);
9715 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
9717 // Start the animation
9720 bool signalReceived(false);
9721 AnimationFinishCheck finishCheck(signalReceived);
9722 animation.FinishedSignal().Connect(&application, finishCheck);
9723 application.SendNotification();
9724 application.Render(0);
9725 application.SendNotification();
9726 finishCheck.CheckSignalNotReceived();
9727 Vector3 position, tangent;
9728 Quaternion rotation;
9729 path.Sample( 0.0f, position, tangent );
9730 rotation = Quaternion( Vector3::XAXIS, tangent );
9731 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9732 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9734 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9735 application.SendNotification();
9736 path.Sample( 0.25f, position, tangent );
9737 rotation = Quaternion( Vector3::XAXIS, tangent );
9738 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9739 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9741 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9742 application.SendNotification();
9743 path.Sample( 0.5f, position, tangent );
9744 rotation = Quaternion( Vector3::XAXIS, tangent );
9745 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9746 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9748 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9749 application.SendNotification();
9750 path.Sample( 0.75f, position, tangent );
9751 rotation = Quaternion( Vector3::XAXIS, tangent );
9752 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9753 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9755 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9756 application.SendNotification();
9757 path.Sample( 1.0f, position, tangent );
9758 rotation = Quaternion( Vector3::XAXIS, tangent );
9759 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9760 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9762 finishCheck.CheckSignalReceived();
9766 int UtcDaliAnimationShowP(void)
9768 TestApplication application;
9770 Actor actor = Actor::New();
9771 actor.SetVisible(false);
9772 application.SendNotification();
9773 application.Render(0);
9774 DALI_TEST_CHECK( !actor.IsVisible() );
9775 Stage::GetCurrent().Add(actor);
9777 // Start the animation
9778 float durationSeconds(10.0f);
9779 Animation animation = Animation::New(durationSeconds);
9780 animation.Show(actor, durationSeconds*0.5f);
9783 bool signalReceived(false);
9784 AnimationFinishCheck finishCheck(signalReceived);
9785 animation.FinishedSignal().Connect(&application, finishCheck);
9787 application.SendNotification();
9788 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
9790 // We didn't expect the animation to finish yet
9791 application.SendNotification();
9792 finishCheck.CheckSignalNotReceived();
9793 DALI_TEST_CHECK( !actor.IsVisible() );
9795 application.SendNotification();
9796 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be shown now*/);
9798 // We didn't expect the animation to finish yet
9799 application.SendNotification();
9800 finishCheck.CheckSignalNotReceived();
9801 DALI_TEST_CHECK( actor.IsVisible() );
9803 application.SendNotification();
9804 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
9806 // We did expect the animation to finish
9807 application.SendNotification();
9808 finishCheck.CheckSignalReceived();
9809 DALI_TEST_CHECK( actor.IsVisible() );
9813 int UtcDaliAnimationHideP(void)
9815 TestApplication application;
9817 Actor actor = Actor::New();
9818 DALI_TEST_CHECK( actor.IsVisible() );
9819 Stage::GetCurrent().Add(actor);
9821 // Start the animation
9822 float durationSeconds(10.0f);
9823 Animation animation = Animation::New(durationSeconds);
9824 animation.Hide(actor, durationSeconds*0.5f);
9827 bool signalReceived(false);
9828 AnimationFinishCheck finishCheck(signalReceived);
9829 animation.FinishedSignal().Connect(&application, finishCheck);
9831 application.SendNotification();
9832 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
9834 // We didn't expect the animation to finish yet
9835 application.SendNotification();
9836 finishCheck.CheckSignalNotReceived();
9837 DALI_TEST_CHECK( actor.IsVisible() );
9839 application.SendNotification();
9840 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be hidden now*/);
9842 // We didn't expect the animation to finish yet
9843 application.SendNotification();
9844 finishCheck.CheckSignalNotReceived();
9845 DALI_TEST_CHECK( !actor.IsVisible() );
9847 application.SendNotification();
9848 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
9850 // We did expect the animation to finish
9851 application.SendNotification();
9852 finishCheck.CheckSignalReceived();
9853 DALI_TEST_CHECK( !actor.IsVisible() );
9857 int UtcDaliAnimationShowHideAtEndP(void)
9859 // Test that show/hide delay can be the same as animation duration
9860 // i.e. to show/hide at the end of the animation
9862 TestApplication application;
9864 Actor actor = Actor::New();
9865 DALI_TEST_CHECK( actor.IsVisible() );
9866 Stage::GetCurrent().Add(actor);
9868 // Start Hide animation
9869 float durationSeconds(10.0f);
9870 Animation animation = Animation::New(durationSeconds);
9871 animation.Hide(actor, durationSeconds/*Hide at end*/);
9874 bool signalReceived(false);
9875 AnimationFinishCheck finishCheck(signalReceived);
9876 animation.FinishedSignal().Connect(&application, finishCheck);
9878 application.SendNotification();
9879 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
9881 // We did expect the animation to finish
9882 application.SendNotification();
9883 finishCheck.CheckSignalReceived();
9884 DALI_TEST_CHECK( !actor.IsVisible() );
9886 // Start Show animation
9887 animation = Animation::New(durationSeconds);
9888 animation.Show(actor, durationSeconds/*Show at end*/);
9889 animation.FinishedSignal().Connect(&application, finishCheck);
9892 application.SendNotification();
9893 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
9895 // We did expect the animation to finish
9896 application.SendNotification();
9897 finishCheck.CheckSignalReceived();
9898 DALI_TEST_CHECK( actor.IsVisible() );
9902 int UtcDaliKeyFramesCreateDestroyP(void)
9904 tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
9906 KeyFrames* keyFrames = new KeyFrames;
9908 DALI_TEST_CHECK( true );
9912 int UtcDaliKeyFramesDownCastP(void)
9914 TestApplication application;
9915 tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
9917 KeyFrames keyFrames = KeyFrames::New();
9918 BaseHandle object(keyFrames);
9920 KeyFrames keyFrames2 = KeyFrames::DownCast(object);
9921 DALI_TEST_CHECK(keyFrames2);
9923 KeyFrames keyFrames3 = DownCast< KeyFrames >(object);
9924 DALI_TEST_CHECK(keyFrames3);
9926 BaseHandle unInitializedObject;
9927 KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
9928 DALI_TEST_CHECK(!keyFrames4);
9930 KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject);
9931 DALI_TEST_CHECK(!keyFrames5);
9935 int UtcDaliAnimationCreateDestroyP(void)
9937 TestApplication application;
9938 Animation* animation = new Animation;
9939 DALI_TEST_CHECK( animation );
9944 struct UpdateManagerTestConstraint
9946 UpdateManagerTestConstraint(TestApplication& application)
9947 : mApplication(application)
9951 void operator()( Vector3& current, const PropertyInputContainer& /* inputs */)
9953 mApplication.SendNotification(); // Process events
9956 TestApplication& mApplication;
9959 int UtcDaliAnimationUpdateManagerP(void)
9961 TestApplication application;
9963 Actor actor = Actor::New();
9964 Stage::GetCurrent().Add( actor );
9966 // Build the animation
9967 Animation animation = Animation::New( 0.0f );
9969 bool signalReceived = false;
9970 AnimationFinishCheck finishCheck( signalReceived );
9971 animation.FinishedSignal().Connect( &application, finishCheck );
9973 Vector3 startValue(1.0f, 1.0f, 1.0f);
9974 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
9975 Constraint constraint = Constraint::New<Vector3>( actor, index, UpdateManagerTestConstraint( application ) );
9978 // Apply animation to actor
9979 animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunction::LINEAR );
9980 animation.AnimateTo( Property(actor, DevelActor::Property::OPACITY), 0.3f, AlphaFunction::LINEAR );
9984 application.SendNotification();
9985 application.UpdateOnly( 16 );
9987 finishCheck.CheckSignalNotReceived();
9989 application.SendNotification(); // Process events
9991 finishCheck.CheckSignalReceived();
9996 int UtcDaliAnimationSignalOrderP(void)
9998 TestApplication application;
10000 Actor actor = Actor::New();
10001 Stage::GetCurrent().Add( actor );
10003 // Build the animations
10004 Animation animation1 = Animation::New( 0.0f ); // finishes first frame
10005 Animation animation2 = Animation::New( 0.02f ); // finishes in 20 ms
10007 bool signal1Received = false;
10008 animation1.FinishedSignal().Connect( &application, AnimationFinishCheck( signal1Received ) );
10010 bool signal2Received = false;
10011 animation2.FinishedSignal().Connect( &application, AnimationFinishCheck( signal2Received ) );
10013 // Apply animations to actor
10014 animation1.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 3.0f, 2.0f, 1.0f ), AlphaFunction::LINEAR );
10016 animation2.AnimateTo( Property(actor, Actor::Property::SIZE ), Vector3( 10.0f, 20.0f, 30.0f ), AlphaFunction::LINEAR );
10019 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10020 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10022 application.SendNotification();
10023 application.UpdateOnly( 10 ); // 10ms progress
10025 // no notifications yet
10026 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10027 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10029 application.SendNotification();
10032 DALI_TEST_EQUALS( signal1Received, true, TEST_LOCATION );
10033 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10034 signal1Received = false;
10036 // 1st animation is complete now, do another update with no ProcessEvents in between
10037 application.UpdateOnly( 20 ); // 20ms progress
10040 application.SendNotification();
10042 // 2nd should complete now
10043 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10044 DALI_TEST_EQUALS( signal2Received, true, TEST_LOCATION );
10049 int UtcDaliAnimationExtendDurationP(void)
10051 TestApplication application;
10053 Actor actor = Actor::New();
10055 // Register a float property
10056 float startValue(10.0f);
10057 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10058 Stage::GetCurrent().Add(actor);
10059 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
10060 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
10062 // Build the animation
10063 float initialDurationSeconds(1.0f);
10064 float animatorDelay = 5.0f;
10065 float animatorDurationSeconds(5.0f);
10066 float extendedDurationSeconds(animatorDelay+animatorDurationSeconds);
10067 Animation animation = Animation::New(initialDurationSeconds);
10068 float targetValue(30.0f);
10069 float relativeValue(targetValue - startValue);
10071 animation.AnimateTo(Property(actor, index),
10073 TimePeriod(animatorDelay, animatorDurationSeconds));
10075 // The duration should have been extended
10076 DALI_TEST_EQUALS( animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION );
10078 // Start the animation
10081 bool signalReceived(false);
10082 AnimationFinishCheck finishCheck(signalReceived);
10083 animation.FinishedSignal().Connect(&application, finishCheck);
10085 application.SendNotification();
10086 application.Render(static_cast<unsigned int>(extendedDurationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
10088 // We didn't expect the animation to finish yet
10089 application.SendNotification();
10090 finishCheck.CheckSignalNotReceived();
10091 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
10093 application.SendNotification();
10094 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
10096 // We didn't expect the animation to finish yet
10097 application.SendNotification();
10098 finishCheck.CheckSignalNotReceived();
10099 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
10101 application.SendNotification();
10102 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
10104 // We did expect the animation to finish
10105 application.SendNotification();
10106 finishCheck.CheckSignalReceived();
10107 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
10111 int UtcDaliAnimationCustomIntProperty(void)
10113 TestApplication application;
10115 Actor actor = Actor::New();
10116 Stage::GetCurrent().Add(actor);
10117 int startValue(0u);
10119 Property::Index index = actor.RegisterProperty("anIndex", startValue);
10120 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
10122 // Build the animation
10123 float durationSeconds(1.0f);
10124 Animation animation = Animation::New(durationSeconds);
10125 animation.AnimateTo( Property(actor, index), 20 );
10127 // Start the animation
10130 bool signalReceived(false);
10131 AnimationFinishCheck finishCheck(signalReceived);
10132 animation.FinishedSignal().Connect(&application, finishCheck);
10134 application.SendNotification();
10135 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
10137 // We didn't expect the animation to finish yet
10138 application.SendNotification();
10139 finishCheck.CheckSignalNotReceived();
10140 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), 10, TEST_LOCATION );
10142 application.SendNotification();
10143 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10145 // We did expect the animation to finish
10146 application.SendNotification();
10147 finishCheck.CheckSignalReceived();
10148 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), 20, TEST_LOCATION );
10152 int UtcDaliAnimationDuration(void)
10154 TestApplication application;
10156 Actor actor = Actor::New();
10157 Stage::GetCurrent().Add(actor);
10159 Animation animation = Animation::New( 0.0f );
10160 DALI_TEST_EQUALS( 0.0f, animation.GetDuration(), TEST_LOCATION );
10162 // The animation duration should automatically increase depending on the animator time period
10164 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 0.0f, 1.0f ) );
10165 DALI_TEST_EQUALS( 1.0f, animation.GetDuration(), TEST_LOCATION );
10167 animation.AnimateTo( Property( actor, Actor::Property::POSITION_Y ), 200.0f, TimePeriod( 10.0f, 1.0f ) );
10168 DALI_TEST_EQUALS( 11.0f, animation.GetDuration(), TEST_LOCATION );
10173 int UtcDaliAnimationAnimateByNonAnimateableTypeN(void)
10175 TestApplication application;
10177 Actor actor = Actor::New();
10179 // Register an integer property
10181 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10182 Stage::GetCurrent().Add(actor);
10183 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10187 // Build the animation
10188 Animation animation = Animation::New( 2.0f );
10189 std::string relativeValue = "relative string";
10190 animation.AnimateBy( Property(actor, index), relativeValue );
10191 tet_result(TET_FAIL);
10193 catch ( Dali::DaliException& e )
10195 DALI_TEST_ASSERT( e, "Animated value and Property type don't match", TEST_LOCATION );
10203 int UtcDaliAnimationAnimateToNonAnimateableTypeN(void)
10205 TestApplication application;
10207 Actor actor = Actor::New();
10209 // Register an integer property
10211 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10212 Stage::GetCurrent().Add(actor);
10213 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10217 // Build the animation
10218 Animation animation = Animation::New( 2.0f );
10219 std::string relativeValue = "relative string";
10220 animation.AnimateTo( Property(actor, index), relativeValue );
10222 tet_result(TET_FAIL);
10224 catch ( Dali::DaliException& e )
10226 DALI_TEST_ASSERT( e, "Animated value and Property type don't match", TEST_LOCATION );
10232 int UtcDaliAnimationAnimateBetweenNonAnimateableTypeN(void)
10234 TestApplication application;
10236 Actor actor = Actor::New();
10238 // Register an integer property
10240 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10241 Stage::GetCurrent().Add(actor);
10242 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10246 // Build the animation
10247 KeyFrames keyFrames = KeyFrames::New();
10248 keyFrames.Add( 0.0f, std::string("relative string1") );
10249 keyFrames.Add( 1.0f, std::string("relative string2") );
10250 // no need to really create the animation as keyframes do the check
10252 tet_result(TET_FAIL);
10254 catch ( Dali::DaliException& e )
10256 DALI_TEST_ASSERT( e, "Type not animateable", TEST_LOCATION );
10262 int UtcDaliAnimationSetAndGetTargetBeforePlayP(void)
10264 tet_infoline("Setting up an animation should not effect it's position property until the animation plays");
10266 TestApplication application;
10268 tet_infoline("Set initial position and set up animation to re-position actor");
10270 Actor actor = Actor::New();
10271 Stage::GetCurrent().Add(actor);
10272 Vector3 initialPosition(0.0f, 0.0f, 0.0f);
10273 actor.SetProperty( Actor::Property::POSITION, initialPosition );
10275 // Build the animation
10276 Animation animation = Animation::New(2.0f);
10278 //Test GetCurrentProgress return 0.0 as the duration is 0.0
10279 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
10280 DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentPosition(), TEST_LOCATION );
10282 tet_infoline("Set target position in animation without intiating play");
10284 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
10285 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
10287 application.SendNotification();
10288 application.Render();
10290 tet_infoline("Ensure position of actor is still at intial value");
10292 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
10293 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
10294 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
10296 tet_infoline("Play animation and ensure actor position is now target");
10299 application.SendNotification();
10300 application.Render(1000u);
10302 tet_infoline("Ensure position of actor is at target value when aninmation half way");
10304 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
10305 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
10306 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
10308 tet_printf( "x position at half way point(%f)\n", actor.GetCurrentPosition().x );
10310 application.Render(2000u);
10312 tet_infoline("Ensure position of actor is still at target value when aninmation complete");
10314 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
10315 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
10316 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
10321 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsPositionP(void)
10323 tet_infoline("Setting up an animation should not effect it's position property until the animation plays even with mulitple animators");
10325 TestApplication application;
10327 std::vector<Vector3> targetPositions;
10329 targetPositions.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
10330 targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
10331 targetPositions.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
10333 tet_infoline("Set initial position and set up animation to re-position actor");
10335 Actor actor = Actor::New();
10336 Stage::GetCurrent().Add(actor);
10337 Vector3 initialPosition(0.0f, 0.0f, 0.0f);
10338 actor.SetProperty( Actor::Property::POSITION, initialPosition );
10340 // Build the animation
10341 Animation animation = Animation::New(2.0f);
10343 //Test GetCurrentProgress return 0.0 as the duration is 0.0
10344 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
10345 DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentPosition(), TEST_LOCATION );
10347 tet_infoline("Set target position in animation without intiating play");
10349 for ( unsigned int i = 0; i < targetPositions.size(); i++ )
10351 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[i], AlphaFunction::LINEAR);
10354 application.SendNotification();
10355 application.Render();
10357 tet_infoline("Ensure position of actor is still at intial value");
10359 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
10360 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
10361 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
10363 tet_infoline("Play animation and ensure actor position is now target");
10366 application.SendNotification();
10367 application.Render(1000u);
10369 tet_infoline("Ensure position of actor is at target value when aninmation half way");
10371 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
10372 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
10373 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
10375 tet_printf( "x position at half way point(%f)\n", actor.GetCurrentPosition().x );
10377 application.Render(2000u);
10379 tet_infoline("Ensure position of actor is still at target value when aninmation complete");
10381 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
10382 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
10383 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
10388 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionP(void)
10390 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");
10392 TestApplication application;
10394 std::vector<Vector3> targetSizes;
10395 std::vector<Vector3> targetPositions;
10397 targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
10398 targetSizes.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
10400 targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
10402 tet_infoline("Set initial position and set up animation to re-position actor");
10404 Actor actor = Actor::New();
10405 Stage::GetCurrent().Add(actor);
10406 Vector3 initialSize( 10.0f, 10.0f, 10.0f);
10407 Vector3 initialPosition(10.0f, 10.0f, 10.0f);
10409 actor.SetProperty( Actor::Property::SIZE, initialSize );
10410 actor.SetProperty( Actor::Property::POSITION, initialPosition );
10412 // Build the animation
10413 Animation animation = Animation::New(2.0f);
10415 tet_infoline("Set target size in animation without intiating play");
10416 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
10417 tet_infoline("Set target position in animation without intiating play");
10418 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[0], AlphaFunction::LINEAR);
10419 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
10421 application.SendNotification();
10422 application.Render();
10424 tet_infoline("Ensure position of actor is still at intial size and position");
10426 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
10427 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
10428 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
10430 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialPosition.x, TEST_LOCATION );
10431 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialPosition.y, TEST_LOCATION );
10432 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialPosition.z, TEST_LOCATION );
10434 tet_infoline("Play animation and ensure actor position and size is now matches targets");
10437 application.SendNotification();
10438 application.Render(2000u);
10440 tet_infoline("Ensure position and size of actor is at target value when aninmation playing");
10442 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
10443 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
10444 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
10446 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[0].x, TEST_LOCATION );
10447 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[0].y, TEST_LOCATION );
10448 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[0].z, TEST_LOCATION );
10453 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionColourP(void)
10455 tet_infoline("Setting up an animation should not effect it's size property until the animation plays even if other Properties animated");
10457 TestApplication application;
10459 std::vector<Vector3> targetSizes;
10460 std::vector<float> targetColors;
10462 targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
10463 targetSizes.push_back( Vector3( 50.0f, 10.0f, 150.0f ) );
10465 targetColors.push_back( 1.0f );
10467 tet_infoline("Set initial position and set up animation to re-position actor");
10469 Actor actor = Actor::New();
10470 Stage::GetCurrent().Add(actor);
10471 Vector3 initialSize( 10.0f, 5.0f, 10.0f);
10473 actor.SetProperty( Actor::Property::SIZE, initialSize );
10475 // Build the animation
10476 Animation animation = Animation::New(2.0f);
10478 tet_infoline("Set target size in animation without intiating play");
10479 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
10480 tet_infoline("Set target position in animation without intiating play");
10481 animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetColors[0], AlphaFunction::LINEAR);
10482 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
10484 application.SendNotification();
10485 application.Render();
10487 tet_infoline("Ensure position of actor is still at intial size and position");
10489 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
10490 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
10491 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
10493 tet_infoline("Play animation and ensure actor position and size is now matches targets");
10496 application.SendNotification();
10497 application.Render(2000u);
10499 tet_infoline("Ensure position and size of actor is at target value when aninmation playing");
10501 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
10502 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
10503 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
10505 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColors[0], TEST_LOCATION );