Merge "Add KeyFrames APIs" into devel/master
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-Animation.cpp
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 #include <dali-test-suite-utils.h>
19 #include <dali/devel-api/actors/actor-devel.h>
20 #include <dali/devel-api/animation/animation-devel.h>
21 #include <dali/devel-api/animation/key-frames-devel.h>
22 #include <dali/public-api/dali-core.h>
23 #include <stdlib.h>
24
25 #include <algorithm>
26 #include <iostream>
27
28 using std::max;
29 using namespace Dali;
30
31 void utc_dali_animation_startuP(void)
32 {
33   test_return_value = TET_UNDEF;
34 }
35
36 void utc_dali_animation_cleanuP(void)
37 {
38   test_return_value = TET_PASS;
39 }
40
41 namespace
42 {
43 static const float ROTATION_EPSILON = 0.0001f;
44 static const float VECTOR4_EPSILON  = 0.0001f;
45 static const float VECTOR3_EPSILON  = 0.0001f;
46
47 // Functor to test whether a Finish signal is emitted
48 struct AnimationFinishCheck
49 {
50   AnimationFinishCheck(bool& signalReceived)
51   : mSignalReceived(signalReceived)
52   {
53   }
54
55   void operator()(Animation& animation)
56   {
57     mSignalReceived = true;
58   }
59
60   void Reset()
61   {
62     mSignalReceived = false;
63   }
64
65   void CheckSignalReceived()
66   {
67     if(!mSignalReceived)
68     {
69       tet_printf("Expected Finish signal was not received\n");
70       tet_result(TET_FAIL);
71     }
72     else
73     {
74       tet_result(TET_PASS);
75     }
76   }
77
78   void CheckSignalNotReceived()
79   {
80     if(mSignalReceived)
81     {
82       tet_printf("Unexpected Finish signal was received\n");
83       tet_result(TET_FAIL);
84     }
85     else
86     {
87       tet_result(TET_PASS);
88     }
89   }
90
91   bool& mSignalReceived; // owned by individual tests
92 };
93
94 // Functor to test whether a Progress signal is emitted
95 struct AnimationProgressCheck
96 {
97   AnimationProgressCheck(bool& signalReceived, std::string name = " ")
98   : mSignalReceived(signalReceived),
99     mName(name)
100   {
101   }
102
103   void operator()(Animation& animation)
104   {
105     mSignalReceived = true;
106   }
107
108   void Reset()
109   {
110     mSignalReceived = false;
111   }
112
113   void CheckSignalReceived()
114   {
115     if(!mSignalReceived)
116     {
117       tet_printf("Expected Progress reached signal was not received %s \n", mName.c_str());
118       tet_result(TET_FAIL);
119     }
120     else
121     {
122       tet_result(TET_PASS);
123     }
124   }
125
126   void CheckSignalNotReceived()
127   {
128     if(mSignalReceived)
129     {
130       tet_printf("Unexpected Progress reached signal was received %s \n", mName.c_str());
131       tet_result(TET_FAIL);
132     }
133     else
134     {
135       tet_result(TET_PASS);
136     }
137   }
138
139   bool&       mSignalReceived; // owned by individual tests
140   std::string mName;
141 };
142
143 } // namespace
144
145 int UtcDaliAnimationConstructorP(void)
146 {
147   TestApplication application;
148
149   Animation animation;
150
151   DALI_TEST_CHECK(!animation);
152   END_TEST;
153 }
154
155 int UtcDaliAnimationNewP(void)
156 {
157   TestApplication application;
158
159   Animation animation = Animation::New(1.0f);
160
161   DALI_TEST_CHECK(animation);
162   END_TEST;
163 }
164
165 int UtcDaliAnimationNewN(void)
166 {
167   TestApplication application;
168
169   Animation animation = Animation::New(-1.0f);
170
171   DALI_TEST_CHECK(animation);
172   DALI_TEST_EQUALS(animation.GetDuration(), 0.0f, TEST_LOCATION);
173   END_TEST;
174 }
175
176 int UtcDaliAnimationDownCastP(void)
177 {
178   TestApplication application;
179
180   tet_infoline("Testing Dali::Animation::DownCast()");
181
182   float     durationSeconds(1.0f);
183   Animation animation = Animation::New(durationSeconds);
184
185   BaseHandle object(animation);
186
187   Animation animation2 = Animation::DownCast(object);
188   DALI_TEST_CHECK(animation2);
189
190   Animation animation3 = DownCast<Animation>(object);
191   DALI_TEST_CHECK(animation3);
192   END_TEST;
193 }
194
195 int UtcDaliAnimationDownCastN(void)
196 {
197   TestApplication application;
198
199   BaseHandle unInitializedObject;
200
201   Animation animation1 = Animation::DownCast(unInitializedObject);
202   DALI_TEST_CHECK(!animation1);
203
204   Animation animation2 = DownCast<Animation>(unInitializedObject);
205   DALI_TEST_CHECK(!animation2);
206   END_TEST;
207 }
208
209 int UtcDaliAnimationCopyConstructorP(void)
210 {
211   TestApplication application;
212
213   // Initialize an object, ref count == 1
214   Animation animation = Animation::New(1.0f);
215
216   Animation copy(animation);
217   DALI_TEST_CHECK(copy);
218
219   DALI_TEST_CHECK(copy.GetDuration() == animation.GetDuration());
220   END_TEST;
221 }
222
223 int UtcDaliAnimationAssignmentOperatorP(void)
224 {
225   TestApplication application;
226
227   Animation animation = Animation::New(1.0f);
228
229   Animation copy = animation;
230   DALI_TEST_CHECK(copy);
231
232   DALI_TEST_CHECK(animation == copy);
233
234   DALI_TEST_CHECK(copy.GetDuration() == animation.GetDuration());
235   END_TEST;
236 }
237
238 int UtcDaliAnimationMoveConstructor(void)
239 {
240   TestApplication application;
241
242   //Animation
243
244   Animation animation = Animation::New(1.0f);
245   DALI_TEST_CHECK(animation);
246   DALI_TEST_EQUALS(1, animation.GetBaseObject().ReferenceCount(), TEST_LOCATION);
247   DALI_TEST_EQUALS(1.0f, animation.GetDuration(), 0.001f, TEST_LOCATION);
248
249   Animation movedAnimation = std::move(animation);
250   DALI_TEST_CHECK(movedAnimation);
251   DALI_TEST_EQUALS(1, movedAnimation.GetBaseObject().ReferenceCount(), TEST_LOCATION);
252   DALI_TEST_EQUALS(1.0f, movedAnimation.GetDuration(), 0.001f, TEST_LOCATION);
253   DALI_TEST_CHECK(!animation);
254
255   // KeyFrames
256
257   KeyFrames keyframes = KeyFrames::New();
258   DALI_TEST_CHECK(keyframes);
259   DALI_TEST_EQUALS(1, keyframes.GetBaseObject().ReferenceCount(), TEST_LOCATION);
260   DALI_TEST_EQUALS(Property::Type::NONE, keyframes.GetType(), TEST_LOCATION);
261
262   keyframes.Add(0.0f, Vector3(0.0f, 0.0f, 0.0f));
263   keyframes.Add(1.0f, Vector3(100.0f, 100.0f, 100.0f));
264   DALI_TEST_EQUALS(Property::Type::VECTOR3, keyframes.GetType(), TEST_LOCATION);
265
266   KeyFrames movedKeyFrames = std::move(keyframes);
267   DALI_TEST_CHECK(movedKeyFrames);
268   DALI_TEST_EQUALS(1, movedKeyFrames.GetBaseObject().ReferenceCount(), TEST_LOCATION);
269   DALI_TEST_EQUALS(Property::Type::VECTOR3, movedKeyFrames.GetType(), TEST_LOCATION);
270   DALI_TEST_CHECK(!keyframes);
271
272   END_TEST;
273 }
274
275 int UtcDaliAnimationMoveAssignment(void)
276 {
277   TestApplication application;
278
279   // Animation
280
281   Animation animation = Animation::New(1.0f);
282   DALI_TEST_CHECK(animation);
283   DALI_TEST_EQUALS(1, animation.GetBaseObject().ReferenceCount(), TEST_LOCATION);
284   DALI_TEST_EQUALS(1.0f, animation.GetDuration(), 0.001f, TEST_LOCATION);
285
286   Animation move;
287   move = std::move(animation);
288   DALI_TEST_CHECK(move);
289   DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
290   DALI_TEST_EQUALS(1.0f, move.GetDuration(), 0.001f, TEST_LOCATION);
291   DALI_TEST_CHECK(!animation);
292
293   // KeyFrames
294
295   KeyFrames keyframes = KeyFrames::New();
296   DALI_TEST_CHECK(keyframes);
297   DALI_TEST_EQUALS(1, keyframes.GetBaseObject().ReferenceCount(), TEST_LOCATION);
298   DALI_TEST_EQUALS(Property::Type::NONE, keyframes.GetType(), TEST_LOCATION);
299
300   keyframes.Add(0.0f, Vector3(0.0f, 0.0f, 0.0f));
301   keyframes.Add(1.0f, Vector3(100.0f, 100.0f, 100.0f));
302   DALI_TEST_EQUALS(Property::Type::VECTOR3, keyframes.GetType(), TEST_LOCATION);
303
304   KeyFrames movedKeyFrames;
305   movedKeyFrames = std::move(keyframes);
306   DALI_TEST_CHECK(movedKeyFrames);
307   DALI_TEST_EQUALS(1, movedKeyFrames.GetBaseObject().ReferenceCount(), TEST_LOCATION);
308   DALI_TEST_EQUALS(Property::Type::VECTOR3, movedKeyFrames.GetType(), TEST_LOCATION);
309   DALI_TEST_CHECK(!keyframes);
310
311   END_TEST;
312 }
313
314 int UtcDaliAnimationSetDurationP(void)
315 {
316   TestApplication application;
317
318   Actor actor = Actor::New();
319   application.GetScene().Add(actor);
320
321   // Build the animation
322   float     durationSeconds(1.0f);
323   Animation animation = Animation::New(durationSeconds);
324   DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
325
326   // Start the animation
327   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
328   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
329   animation.Play();
330
331   bool                 signalReceived(false);
332   AnimationFinishCheck finishCheck(signalReceived);
333   animation.FinishedSignal().Connect(&application, finishCheck);
334
335   application.SendNotification();
336   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
337
338   // We didn't expect the animation to finish yet
339   application.SendNotification();
340   finishCheck.CheckSignalNotReceived();
341
342   application.Render(2u /*just beyond the animation duration*/);
343
344   // We did expect the animation to finish
345   application.SendNotification();
346   finishCheck.CheckSignalReceived();
347   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
348
349   // Restart the animation, with a different duration
350   finishCheck.Reset();
351   actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO);
352   durationSeconds = 3.5f;
353   animation.SetDuration(durationSeconds);
354   DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
355   animation.Play();
356
357   application.SendNotification();
358   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
359
360   // We didn't expect the animation to finish yet
361   application.SendNotification();
362   finishCheck.CheckSignalNotReceived();
363
364   application.Render(2u /*just beyond the animation duration*/);
365
366   // We did expect the animation to finish
367   application.SendNotification();
368   finishCheck.CheckSignalReceived();
369   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
370
371   // Check that nothing has changed after a couple of buffer swaps
372   application.Render(0);
373   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
374   application.Render(0);
375   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
376   END_TEST;
377 }
378
379 int UtcDaliAnimationSetDurationN(void)
380 {
381   TestApplication application;
382
383   Animation animation = Animation::New(1.0f);
384   DALI_TEST_EQUALS(animation.GetDuration(), 1.0f, TEST_LOCATION);
385
386   animation.SetDuration(-1.0f);
387   DALI_TEST_EQUALS(animation.GetDuration(), 0.0f, TEST_LOCATION);
388   END_TEST;
389 }
390
391 int UtcDaliAnimationGetDurationP(void)
392 {
393   TestApplication application;
394
395   Animation animation = Animation::New(1.0f);
396   DALI_TEST_EQUALS(animation.GetDuration(), 1.0f, TEST_LOCATION);
397
398   animation.SetDuration(2.0f);
399   DALI_TEST_EQUALS(animation.GetDuration(), 2.0f, TEST_LOCATION);
400   END_TEST;
401 }
402
403 int UtcDaliAnimationSetLoopingP(void)
404 {
405   TestApplication application;
406
407   Actor actor = Actor::New();
408   application.GetScene().Add(actor);
409
410   // Build the animation
411   float     durationSeconds(1.0f);
412   Animation animation = Animation::New(durationSeconds);
413   Vector3   targetPosition(10.0f, 10.0f, 10.0f);
414   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
415
416   // Start the animation
417   animation.SetLooping(true);
418   DALI_TEST_CHECK(animation.IsLooping());
419   animation.Play();
420
421   bool                 signalReceived(false);
422   AnimationFinishCheck finishCheck(signalReceived);
423   animation.FinishedSignal().Connect(&application, finishCheck);
424
425   application.SendNotification();
426
427   // Loop 5 times
428   float intervalSeconds = 0.25f;
429   float progress        = 0.0f;
430   for(int iterations = 0; iterations < 5;)
431   {
432     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
433
434     progress += intervalSeconds;
435     DALI_TEST_EQUALS(targetPosition * progress, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.001f, TEST_LOCATION);
436
437     if(progress >= 1.0f)
438     {
439       progress = progress - 1.0f;
440       ++iterations;
441     }
442   }
443
444   // We didn't expect the animation to finish yet
445   application.SendNotification();
446   finishCheck.CheckSignalNotReceived();
447
448   animation.SetLooping(false);
449   DALI_TEST_CHECK(!animation.IsLooping());
450
451   application.SendNotification();
452   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
453
454   // We did expect the animation to finish
455   application.SendNotification();
456   finishCheck.CheckSignalReceived();
457   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
458
459   // Check that nothing has changed after a couple of buffer swaps
460   application.Render(0);
461   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
462   application.Render(0);
463   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
464   END_TEST;
465 }
466
467 int UtcDaliAnimationSetLoopCountP(void)
468 {
469   TestApplication application;
470
471   Actor actor = Actor::New();
472   application.GetScene().Add(actor);
473
474   // Build the animation
475   float     durationSeconds(1.0f);
476   Animation animation = Animation::New(durationSeconds);
477   Vector3   targetPosition(10.0f, 10.0f, 10.0f);
478   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
479
480   // Start the animation
481   animation.SetLoopCount(3);
482   DALI_TEST_CHECK(animation.IsLooping());
483   animation.Play();
484
485   bool                 signalReceived(false);
486   AnimationFinishCheck finishCheck(signalReceived);
487   animation.FinishedSignal().Connect(&application, finishCheck);
488
489   application.Render(0);
490   application.SendNotification();
491   application.Render(0);
492   application.SendNotification();
493   application.Render(0);
494   application.SendNotification();
495   application.Render(0);
496   application.SendNotification();
497
498   // Loop
499   float intervalSeconds = 3.0f;
500
501   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
502   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
503
504   application.Render(0);
505   application.SendNotification();
506   application.Render(0);
507   application.SendNotification();
508   application.Render(0);
509   application.SendNotification();
510   application.Render(0);
511   application.SendNotification();
512   finishCheck.CheckSignalNotReceived();
513
514   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
515
516   application.SendNotification();
517   finishCheck.CheckSignalReceived();
518   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
519
520   finishCheck.Reset();
521
522   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
523   application.SendNotification();
524   finishCheck.CheckSignalNotReceived();
525
526   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
527   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
528   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
529   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
530   application.SendNotification();
531   finishCheck.CheckSignalNotReceived();
532
533   END_TEST;
534 }
535
536 int UtcDaliAnimationSetLoopCountP2(void)
537 {
538   TestApplication application;
539
540   //
541   // switching between forever and loop count
542   //
543
544   Actor actor = Actor::New();
545   application.GetScene().Add(actor);
546
547   // Build the animation
548   float     durationSeconds(1.0f);
549   Animation animation = Animation::New(durationSeconds);
550   Vector3   targetPosition(10.0f, 10.0f, 10.0f);
551   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
552   animation.SetEndAction(Animation::DISCARD);
553
554   // Start the animation
555   animation.SetLoopCount(3);
556   DALI_TEST_CHECK(animation.IsLooping());
557   animation.Play();
558
559   bool                 signalReceived(false);
560   AnimationFinishCheck finishCheck(signalReceived);
561   animation.FinishedSignal().Connect(&application, finishCheck);
562
563   float intervalSeconds = 3.0f;
564
565   application.SendNotification();
566   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
567   application.SendNotification();
568   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
569   application.SendNotification();
570   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
571   application.SendNotification();
572
573   application.SendNotification();
574   finishCheck.CheckSignalReceived();
575
576   finishCheck.Reset();
577
578   // Loop forever
579   animation.SetLooping(true);
580   DALI_TEST_CHECK(animation.IsLooping());
581
582   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
583   application.SendNotification();
584   finishCheck.CheckSignalNotReceived();
585
586   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
587   application.SendNotification();
588   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
589   application.SendNotification();
590   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
591   application.SendNotification();
592   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
593   application.SendNotification();
594   application.SendNotification();
595   finishCheck.CheckSignalNotReceived();
596
597   finishCheck.Reset();
598
599   // Loop N again
600   animation.SetLoopCount(3);
601   DALI_TEST_CHECK(animation.IsLooping());
602   animation.Play();
603
604   application.SendNotification();
605   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
606   application.SendNotification();
607   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
608   application.SendNotification();
609   finishCheck.CheckSignalNotReceived();
610
611   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
612   application.SendNotification();
613   finishCheck.CheckSignalReceived();
614
615   finishCheck.Reset();
616
617   // loop forever
618   animation.SetLooping(true);
619   DALI_TEST_CHECK(animation.IsLooping());
620
621   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
622   application.SendNotification();
623   finishCheck.CheckSignalNotReceived();
624
625   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
626   application.SendNotification();
627   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
628   application.SendNotification();
629   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
630   application.SendNotification();
631   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
632   application.SendNotification();
633   finishCheck.CheckSignalNotReceived();
634
635   finishCheck.Reset();
636
637   // Loop N again
638   animation.SetLoopCount(3);
639   DALI_TEST_CHECK(animation.IsLooping());
640
641   application.SendNotification();
642   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
643   application.SendNotification();
644   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
645   application.SendNotification();
646   finishCheck.CheckSignalNotReceived();
647
648   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
649   application.SendNotification();
650   finishCheck.CheckSignalNotReceived(); // we never hit play
651
652   finishCheck.Reset();
653
654   END_TEST;
655 }
656
657 int UtcDaliAnimationSetLoopCountP3(void)
658 {
659   TestApplication application;
660
661   //
662   // switching between forever and loop count
663   //
664   Actor actor = Actor::New();
665   application.GetScene().Add(actor);
666
667   // Build the animation
668   float     durationSeconds(1.0f);
669   Animation animation = Animation::New(durationSeconds);
670   Vector3   targetPosition(10.0f, 10.0f, 10.0f);
671   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
672   animation.SetEndAction(Animation::DISCARD);
673
674   float intervalSeconds = 3.0f;
675
676   bool                 signalReceived(false);
677   AnimationFinishCheck finishCheck(signalReceived);
678   animation.FinishedSignal().Connect(&application, finishCheck);
679
680   // loop forever
681   animation.SetLooping(true);
682   DALI_TEST_CHECK(animation.IsLooping());
683
684   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
685   application.SendNotification();
686   finishCheck.CheckSignalNotReceived();
687
688   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
689   application.SendNotification();
690   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
691   application.SendNotification();
692   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
693   application.SendNotification();
694   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
695   application.SendNotification();
696   finishCheck.CheckSignalNotReceived();
697
698   finishCheck.Reset();
699
700   // Loop N again
701   animation.SetLoopCount(3);
702   DALI_TEST_CHECK(animation.IsLooping());
703
704   application.SendNotification();
705   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
706   application.SendNotification();
707   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
708   application.SendNotification();
709   finishCheck.CheckSignalNotReceived();
710
711   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
712   application.SendNotification();
713   finishCheck.CheckSignalNotReceived(); // we never hit play
714
715   finishCheck.Reset();
716
717   END_TEST;
718 }
719
720 int UtcDaliAnimationSetLoopCountP4(void)
721 {
722   TestApplication application;
723
724   //
725   // ..and play again
726   //
727   Actor actor = Actor::New();
728   application.GetScene().Add(actor);
729
730   // Build the animation
731   float     durationSeconds(1.0f);
732   Animation animation = Animation::New(durationSeconds);
733   Vector3   targetPosition(10.0f, 10.0f, 10.0f);
734   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
735   animation.SetEndAction(Animation::BAKE);
736
737   float intervalSeconds = 3.0f;
738
739   bool                 signalReceived(false);
740   AnimationFinishCheck finishCheck(signalReceived);
741   animation.FinishedSignal().Connect(&application, finishCheck);
742
743   animation.SetLoopCount(1);
744   animation.Play();
745   DALI_TEST_CHECK(!animation.IsLooping());
746
747   application.SendNotification();
748   finishCheck.CheckSignalNotReceived();
749   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
750   application.SendNotification();
751   finishCheck.CheckSignalReceived();
752
753   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
754   actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
755
756   finishCheck.Reset();
757
758   animation.Play(); // again
759   DALI_TEST_CHECK(!animation.IsLooping());
760
761   application.SendNotification();
762   finishCheck.CheckSignalNotReceived();
763   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
764   application.SendNotification();
765   finishCheck.CheckSignalReceived();
766
767   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
768
769   END_TEST;
770 }
771
772 int UtcDaliAnimationGetLoopCountP(void)
773 {
774   TestApplication application;
775
776   Actor actor = Actor::New();
777   application.GetScene().Add(actor);
778
779   // Build the animation
780   float     durationSeconds(1.0f);
781   Animation animation = Animation::New(durationSeconds);
782   Vector3   targetPosition(10.0f, 10.0f, 10.0f);
783   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
784
785   DALI_TEST_CHECK(1 == animation.GetLoopCount());
786
787   // Start the animation
788   animation.SetLoopCount(3);
789   DALI_TEST_CHECK(animation.IsLooping());
790   DALI_TEST_CHECK(3 == animation.GetLoopCount());
791
792   animation.Play();
793
794   application.Render(0);
795   application.SendNotification();
796
797   // Loop
798   float intervalSeconds = 3.0f;
799
800   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
801   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
802
803   application.Render(0);
804   application.SendNotification();
805
806   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
807   application.SendNotification();
808
809   animation.SetLoopCount(0);
810   DALI_TEST_CHECK(animation.IsLooping());
811   DALI_TEST_CHECK(0 == animation.GetLoopCount());
812
813   animation.SetLoopCount(1);
814   DALI_TEST_CHECK(!animation.IsLooping());
815   DALI_TEST_CHECK(1 == animation.GetLoopCount());
816
817   END_TEST;
818 }
819
820 int UtcDaliAnimationGetCurrentLoopP(void)
821 {
822   TestApplication application;
823
824   Actor actor = Actor::New();
825   application.GetScene().Add(actor);
826
827   // Build the animation
828   float     durationSeconds(1.0f);
829   Animation animation = Animation::New(durationSeconds);
830   Vector3   targetPosition(10.0f, 10.0f, 10.0f);
831   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
832
833   // Start the animation
834   animation.SetLoopCount(3);
835   DALI_TEST_CHECK(animation.IsLooping());
836   DALI_TEST_CHECK(0 == animation.GetCurrentLoop());
837   animation.Play();
838
839   bool                 signalReceived(false);
840   AnimationFinishCheck finishCheck(signalReceived);
841   animation.FinishedSignal().Connect(&application, finishCheck);
842
843   application.SendNotification();
844
845   // Loop
846   float intervalSeconds = 3.0f;
847
848   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
849   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
850
851   application.SendNotification();
852   finishCheck.CheckSignalNotReceived();
853   DALI_TEST_CHECK(2 == animation.GetCurrentLoop());
854
855   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
856
857   application.SendNotification();
858   finishCheck.CheckSignalReceived();
859   DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
860   DALI_TEST_CHECK(animation.GetLoopCount() == animation.GetCurrentLoop());
861
862   finishCheck.Reset();
863
864   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
865   application.SendNotification();
866   finishCheck.CheckSignalNotReceived();
867   DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
868
869   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
870   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
871   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
872   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
873   application.SendNotification();
874   finishCheck.CheckSignalNotReceived();
875   DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
876
877   END_TEST;
878 }
879
880 int UtcDaliAnimationIsLoopingP(void)
881 {
882   TestApplication application;
883
884   Animation animation = Animation::New(1.0f);
885   DALI_TEST_CHECK(!animation.IsLooping());
886
887   animation.SetLooping(true);
888   DALI_TEST_CHECK(animation.IsLooping());
889   END_TEST;
890 }
891
892 int UtcDaliAnimationSetEndActionN(void)
893 {
894   TestApplication application;
895
896   Actor actor = Actor::New();
897   application.GetScene().Add(actor);
898
899   // Build the animation
900   float     durationSeconds(1.0f);
901   Animation animation = Animation::New(durationSeconds);
902   DALI_TEST_CHECK(animation.GetEndAction() == Animation::BAKE);
903
904   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
905   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
906
907   // Start the animation
908   animation.Play();
909
910   bool                 signalReceived(false);
911   AnimationFinishCheck finishCheck(signalReceived);
912   animation.FinishedSignal().Connect(&application, finishCheck);
913
914   application.SendNotification();
915   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
916
917   // We did expect the animation to finish
918   application.SendNotification();
919   finishCheck.CheckSignalReceived();
920   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
921
922   // Go back to the start
923   actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO);
924   application.SendNotification();
925   application.Render(0);
926   DALI_TEST_EQUALS(Vector3::ZERO, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
927
928   // Test BakeFinal, animate again, for half the duration
929   finishCheck.Reset();
930   animation.SetEndAction(Animation::BAKE_FINAL);
931   DALI_TEST_CHECK(animation.GetEndAction() == Animation::BAKE_FINAL);
932   animation.Play();
933
934   application.SendNotification();
935   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f * 0.5f) /*half of the animation duration*/);
936
937   // Stop the animation early
938   animation.Stop();
939
940   // We did NOT expect the animation to finish
941   application.SendNotification();
942   finishCheck.CheckSignalNotReceived();
943   DALI_TEST_EQUALS(targetPosition * 0.5f, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), VECTOR4_EPSILON, TEST_LOCATION);
944
945   // The position should be same with target position in the next frame
946   application.Render(0);
947   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
948
949   // Go back to the start
950   actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO);
951   application.SendNotification();
952   application.Render(0);
953   DALI_TEST_EQUALS(Vector3::ZERO, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
954
955   // Test EndAction::Discard, animate again, but don't bake this time
956   finishCheck.Reset();
957   animation.SetEndAction(Animation::DISCARD);
958   DALI_TEST_CHECK(animation.GetEndAction() == Animation::DISCARD);
959   animation.Play();
960
961   application.SendNotification();
962   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
963
964   // We did expect the animation to finish
965   application.SendNotification();
966   finishCheck.CheckSignalReceived();
967   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
968
969   // The position should be discarded in the next frame
970   application.Render(0);
971   DALI_TEST_EQUALS(Vector3::ZERO /*discarded*/, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
972
973   // Check that nothing has changed after a couple of buffer swaps
974   application.Render(0);
975   DALI_TEST_EQUALS(Vector3::ZERO, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
976   application.Render(0);
977   DALI_TEST_EQUALS(Vector3::ZERO, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
978   END_TEST;
979 }
980
981 int UtcDaliAnimationGetEndActionP(void)
982 {
983   TestApplication application;
984
985   Animation animation = Animation::New(1.0f);
986   DALI_TEST_CHECK(animation.GetEndAction() == Animation::BAKE);
987
988   animation.SetEndAction(Animation::DISCARD);
989   DALI_TEST_CHECK(animation.GetEndAction() == Animation::DISCARD);
990
991   animation.SetEndAction(Animation::BAKE_FINAL);
992   DALI_TEST_CHECK(animation.GetEndAction() == Animation::BAKE_FINAL);
993
994   END_TEST;
995 }
996
997 int UtcDaliAnimationSetDisconnectActionP(void)
998 {
999   TestApplication    application;
1000   Integration::Scene stage(application.GetScene());
1001
1002   // Default: BakeFinal
1003   {
1004     Actor actor = Actor::New();
1005     stage.Add(actor);
1006
1007     // Build the animation
1008     float     durationSeconds(1.0f);
1009     Animation animation = Animation::New(durationSeconds);
1010     DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BAKE_FINAL);
1011
1012     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
1013     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1014
1015     // Start the animation
1016     animation.Play();
1017
1018     application.SendNotification();
1019     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
1020
1021     actor.Unparent();
1022
1023     application.SendNotification();
1024     application.Render();
1025
1026     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
1027   }
1028
1029   // Bake
1030   {
1031     Actor actor = Actor::New();
1032     stage.Add(actor);
1033
1034     // Build the animation
1035     float     durationSeconds(1.0f);
1036     Animation animation = Animation::New(durationSeconds);
1037     animation.SetDisconnectAction(Animation::BAKE);
1038
1039     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
1040     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1041
1042     // Start the animation
1043     animation.Play();
1044
1045     application.SendNotification();
1046     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
1047
1048     actor.Unparent();
1049
1050     application.SendNotification();
1051     application.Render();
1052
1053     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition * 0.5f, TEST_LOCATION);
1054   }
1055
1056   // Discard
1057   {
1058     Actor actor = Actor::New();
1059     stage.Add(actor);
1060
1061     // Build the animation
1062     float     durationSeconds(1.0f);
1063     Animation animation = Animation::New(durationSeconds);
1064     animation.SetDisconnectAction(Animation::DISCARD);
1065
1066     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
1067     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1068
1069     // Start the animation
1070     animation.Play();
1071
1072     application.SendNotification();
1073     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
1074
1075     actor.Unparent();
1076
1077     application.SendNotification();
1078     application.Render();
1079
1080     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
1081   }
1082
1083   // Don't play the animation: disconnect action should not be applied
1084   {
1085     Actor actor = Actor::New();
1086     stage.Add(actor);
1087
1088     // Build the animation
1089     float     durationSeconds(1.0f);
1090     Animation animation = Animation::New(durationSeconds);
1091
1092     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
1093     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1094
1095     application.SendNotification();
1096     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
1097
1098     actor.Unparent();
1099
1100     application.SendNotification();
1101     application.Render();
1102
1103     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
1104   }
1105
1106   END_TEST;
1107 }
1108
1109 int UtcDaliAnimationGetDisconnectActionP(void)
1110 {
1111   TestApplication application;
1112   Animation       animation = Animation::New(1.0f);
1113   DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BAKE_FINAL); // default!
1114
1115   animation.SetDisconnectAction(Animation::DISCARD);
1116   DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::DISCARD);
1117
1118   animation.SetDisconnectAction(Animation::BAKE);
1119   DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BAKE);
1120
1121   END_TEST;
1122 }
1123
1124 int UtcDaliAnimationSetDefaultAlphaFunctionP(void)
1125 {
1126   TestApplication application;
1127
1128   Animation     animation = Animation::New(1.0f);
1129   AlphaFunction func      = animation.GetDefaultAlphaFunction();
1130   DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1131
1132   animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1133   AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1134   DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1135   END_TEST;
1136 }
1137
1138 int UtcDaliAnimationGetDefaultAlphaFunctionP(void)
1139 {
1140   TestApplication application;
1141
1142   Animation     animation = Animation::New(1.0f);
1143   AlphaFunction func      = animation.GetDefaultAlphaFunction();
1144
1145   // Test that the default is linear
1146   DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1147
1148   animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1149   AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1150   DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1151
1152   END_TEST;
1153 }
1154
1155 int UtcDaliAnimationSetCurrentProgressP(void)
1156 {
1157   TestApplication application;
1158
1159   Actor actor = Actor::New();
1160   application.GetScene().Add(actor);
1161
1162   // Build the animation
1163   Animation animation = Animation::New(0.0f);
1164
1165   //Set duration
1166   float durationSeconds(1.0f);
1167   animation.SetDuration(durationSeconds);
1168
1169   bool                 signalReceived(false);
1170   AnimationFinishCheck finishCheck(signalReceived);
1171   animation.FinishedSignal().Connect(&application, finishCheck);
1172   application.SendNotification();
1173
1174   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1175   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1176
1177   // Start the animation from 40% progress
1178   animation.SetCurrentProgress(0.4f);
1179   animation.Play();
1180
1181   application.SendNotification();
1182   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
1183
1184   // We didn't expect the animation to finish yet
1185   application.SendNotification();
1186   finishCheck.CheckSignalNotReceived();
1187   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
1188   DALI_TEST_EQUALS(0.6f, animation.GetCurrentProgress(), TEST_LOCATION);
1189
1190   animation.Play(); // Test that calling play has no effect, when animation is already playing
1191   application.SendNotification();
1192
1193   //Set the progress to 70%
1194   animation.SetCurrentProgress(0.7f);
1195   application.SendNotification();
1196   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 80% progress */);
1197   DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
1198
1199   application.SendNotification();
1200   finishCheck.CheckSignalNotReceived();
1201   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
1202   DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
1203
1204   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
1205   // We did expect the animation to finish
1206   application.SendNotification();
1207   finishCheck.CheckSignalReceived();
1208   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
1209
1210   // Check that nothing has changed after a couple of buffer swaps
1211   application.Render(0);
1212   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1213   application.Render(0);
1214   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1215   END_TEST;
1216 }
1217
1218 int UtcDaliAnimationSetCurrentProgressN(void)
1219 {
1220   TestApplication application;
1221
1222   Actor actor = Actor::New();
1223   application.GetScene().Add(actor);
1224
1225   // Build the animation
1226   Animation animation = Animation::New(0.0f);
1227
1228   //Set duration
1229   float durationSeconds(1.0f);
1230   animation.SetDuration(durationSeconds);
1231
1232   bool                 signalReceived(false);
1233   AnimationFinishCheck finishCheck(signalReceived);
1234   animation.FinishedSignal().Connect(&application, finishCheck);
1235   application.SendNotification();
1236
1237   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1238   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1239
1240   //Trying to set the current cursor outside the range [0..1] is ignored
1241   animation.SetCurrentProgress(-1.0f);
1242   application.SendNotification();
1243   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
1244
1245   animation.SetCurrentProgress(100.0f);
1246   application.SendNotification();
1247   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
1248   END_TEST;
1249 }
1250
1251 int UtcDaliAnimationGetCurrentProgressP(void)
1252 {
1253   TestApplication application;
1254
1255   Actor actor = Actor::New();
1256   application.GetScene().Add(actor);
1257
1258   // Build the animation
1259   Animation animation = Animation::New(0.0f);
1260   animation.Play();
1261
1262   //Test GetCurrentProgress return 0.0 as the duration is 0.0
1263   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
1264
1265   animation.SetCurrentProgress(0.5f);
1266   application.SendNotification();
1267   application.Render(static_cast<unsigned int>(100.0f));
1268
1269   //Progress should still be 0.0
1270   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
1271
1272   //Set duration
1273   float durationSeconds(1.0f);
1274   animation.SetDuration(durationSeconds);
1275   application.SendNotification();
1276
1277   bool                 signalReceived(false);
1278   AnimationFinishCheck finishCheck(signalReceived);
1279   animation.FinishedSignal().Connect(&application, finishCheck);
1280   application.SendNotification();
1281
1282   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1283   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1284
1285   // Start the animation from 40% progress
1286   animation.SetCurrentProgress(0.4f);
1287   animation.Play();
1288
1289   application.SendNotification();
1290   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
1291
1292   // We didn't expect the animation to finish yet
1293   application.SendNotification();
1294   finishCheck.CheckSignalNotReceived();
1295   DALI_TEST_EQUALS(0.6f, animation.GetCurrentProgress(), TEST_LOCATION);
1296
1297   animation.Play(); // Test that calling play has no effect, when animation is already playing
1298   application.SendNotification();
1299
1300   //Set the progress to 70%
1301   animation.SetCurrentProgress(0.7f);
1302   application.SendNotification();
1303   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 80% progress */);
1304   DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
1305
1306   application.SendNotification();
1307   finishCheck.CheckSignalNotReceived();
1308   DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
1309
1310   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
1311   // We did expect the animation to finish
1312   application.SendNotification();
1313   finishCheck.CheckSignalReceived();
1314   END_TEST;
1315 }
1316
1317 int UtcDaliAnimationSetSpeedFactorP1(void)
1318 {
1319   TestApplication application;
1320
1321   tet_printf("Testing that setting a speed factor of 2 takes half the time\n");
1322
1323   Actor actor = Actor::New();
1324   application.GetScene().Add(actor);
1325
1326   // Build the animation
1327   float     durationSeconds(1.0f);
1328   Animation animation = Animation::New(durationSeconds);
1329
1330   const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1331   const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1332
1333   KeyFrames keyframes = KeyFrames::New();
1334   keyframes.Add(0.0f, initialPosition);
1335   keyframes.Add(1.0f, targetPosition);
1336   animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1337
1338   //Set speed to be x2
1339   animation.SetSpeedFactor(2.0f);
1340
1341   // Start the animation
1342   animation.Play();
1343
1344   bool                 signalReceived(false);
1345   AnimationFinishCheck finishCheck(signalReceived);
1346   animation.FinishedSignal().Connect(&application, finishCheck);
1347
1348   application.SendNotification();
1349   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
1350
1351   // We didn't expect the animation to finish yet
1352   application.SendNotification();
1353   finishCheck.CheckSignalNotReceived();
1354   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION);
1355
1356   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
1357
1358   // We didn't expect the animation to finish yet
1359   application.SendNotification();
1360   finishCheck.CheckSignalNotReceived();
1361   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
1362
1363   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1u /*just beyond half the duration*/);
1364
1365   // We did expect the animation to finish
1366   application.SendNotification();
1367   finishCheck.CheckSignalReceived();
1368   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
1369
1370   // Check that nothing has changed after a couple of buffer swaps
1371   application.Render(0);
1372   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1373   application.Render(0);
1374   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1375
1376   END_TEST;
1377 }
1378
1379 int UtcDaliAnimationSetSpeedFactorP2(void)
1380 {
1381   TestApplication application;
1382
1383   Actor actor = Actor::New();
1384   application.GetScene().Add(actor);
1385
1386   // Build the animation
1387   float     durationSeconds(1.0f);
1388   Animation animation = Animation::New(durationSeconds);
1389
1390   const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1391   const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1392
1393   KeyFrames keyframes = KeyFrames::New();
1394   keyframes.Add(0.0f, initialPosition);
1395   keyframes.Add(1.0f, targetPosition);
1396   animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1397
1398   tet_printf("Test -1 speed factor. Animation will play in reverse at normal speed\n");
1399   animation.SetSpeedFactor(-1.0f);
1400
1401   // Start the animation
1402   animation.Play();
1403
1404   bool                 signalReceived(false);
1405   AnimationFinishCheck finishCheck(signalReceived);
1406   animation.FinishedSignal().Connect(&application, finishCheck);
1407
1408   application.SendNotification();
1409   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
1410
1411   // We didn't expect the animation to finish yet
1412   application.SendNotification();
1413   finishCheck.CheckSignalNotReceived();
1414   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
1415
1416   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
1417
1418   // We didn't expect the animation to finish yet
1419   application.SendNotification();
1420   finishCheck.CheckSignalNotReceived();
1421   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
1422
1423   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
1424
1425   // We didn't expect the animation to finish yet
1426   application.SendNotification();
1427   finishCheck.CheckSignalNotReceived();
1428   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION);
1429
1430   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
1431
1432   // We didn't expect the animation to finish yet
1433   application.SendNotification();
1434   finishCheck.CheckSignalNotReceived();
1435   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
1436
1437   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
1438
1439   // We did expect the animation to finish
1440   application.SendNotification();
1441   finishCheck.CheckSignalReceived();
1442   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), initialPosition, TEST_LOCATION);
1443
1444   // Check that nothing has changed after a couple of buffer swaps
1445   application.Render(0);
1446   DALI_TEST_EQUALS(initialPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1447   application.Render(0);
1448   DALI_TEST_EQUALS(initialPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1449
1450   END_TEST;
1451 }
1452
1453 int UtcDaliAnimationSetSpeedFactorP3(void)
1454 {
1455   TestApplication application;
1456
1457   Actor actor = Actor::New();
1458   application.GetScene().Add(actor);
1459
1460   // Build the animation
1461   float     durationSeconds(1.0f);
1462   Animation animation = Animation::New(durationSeconds);
1463
1464   const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1465   const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1466
1467   KeyFrames keyframes = KeyFrames::New();
1468   keyframes.Add(0.0f, initialPosition);
1469   keyframes.Add(1.0f, targetPosition);
1470   animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1471
1472   bool                 signalReceived(false);
1473   AnimationFinishCheck finishCheck(signalReceived);
1474   animation.FinishedSignal().Connect(&application, finishCheck);
1475
1476   tet_printf("Test half speed factor. Animation will take twice the duration\n");
1477
1478   //Set speed to be half of normal speed
1479   animation.SetSpeedFactor(0.5f);
1480
1481   // Start the animation
1482   animation.Play();
1483
1484   application.SendNotification();
1485   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 10% progress */);
1486
1487   // We didn't expect the animation to finish yet
1488   application.SendNotification();
1489   finishCheck.CheckSignalNotReceived();
1490   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.1f), TEST_LOCATION);
1491
1492   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
1493
1494   // We didn't expect the animation to finish yet
1495   application.SendNotification();
1496   finishCheck.CheckSignalNotReceived();
1497   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
1498
1499   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% progress */);
1500
1501   // We didn't expect the animation to finish yet
1502   application.SendNotification();
1503   finishCheck.CheckSignalNotReceived();
1504   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.3f), TEST_LOCATION);
1505
1506   application.SendNotification();
1507   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
1508
1509   // We didn't expect the animation to finish yet
1510   application.SendNotification();
1511   finishCheck.CheckSignalNotReceived();
1512   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION);
1513
1514   application.Render(static_cast<unsigned int>(durationSeconds * 1200.0f) + 1u /*just beyond the animation duration*/);
1515
1516   // We did expect the animation to finish
1517   application.SendNotification();
1518   finishCheck.CheckSignalReceived();
1519   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
1520
1521   // Check that nothing has changed after a couple of buffer swaps
1522   application.Render(0);
1523   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1524   application.Render(0);
1525   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1526   END_TEST;
1527 }
1528
1529 int UtcDaliAnimationSetSpeedFactorP4(void)
1530 {
1531   TestApplication application;
1532
1533   Actor actor = Actor::New();
1534   application.GetScene().Add(actor);
1535
1536   // Build the animation
1537   float     durationSeconds(1.0f);
1538   Animation animation = Animation::New(durationSeconds);
1539
1540   const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1541   const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1542
1543   KeyFrames keyframes = KeyFrames::New();
1544   keyframes.Add(0.0f, initialPosition);
1545   keyframes.Add(1.0f, targetPosition);
1546   animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1547
1548   bool                 signalReceived(false);
1549   AnimationFinishCheck finishCheck(signalReceived);
1550   animation.FinishedSignal().Connect(&application, finishCheck);
1551
1552   tet_printf("Test half speed factor. Animation will take twice the duration\n");
1553
1554   tet_printf("Set speed to be half of normal speed\n");
1555   tet_printf("SetSpeedFactor(0.5f)\n");
1556   animation.SetSpeedFactor(0.5f);
1557
1558   // Start the animation
1559   animation.Play();
1560
1561   application.SendNotification();
1562   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 10% progress */);
1563
1564   // We didn't expect the animation to finish yet
1565   application.SendNotification();
1566   finishCheck.CheckSignalNotReceived();
1567   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.1f), TEST_LOCATION);
1568
1569   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
1570
1571   // We didn't expect the animation to finish yet
1572   application.SendNotification();
1573   finishCheck.CheckSignalNotReceived();
1574   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
1575
1576   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% progress */);
1577
1578   // We didn't expect the animation to finish yet
1579   application.SendNotification();
1580   finishCheck.CheckSignalNotReceived();
1581   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.3f), TEST_LOCATION);
1582
1583   tet_printf("Reverse direction of animation whilst playing\n");
1584   tet_printf("SetSpeedFactor(-0.5f)\n");
1585   animation.SetSpeedFactor(-0.5f);
1586
1587   application.SendNotification();
1588   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
1589
1590   // We didn't expect the animation to finish yet
1591   application.SendNotification();
1592   finishCheck.CheckSignalNotReceived();
1593   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
1594
1595   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 10% progress */);
1596
1597   // We didn't expect the animation to finish yet
1598   application.SendNotification();
1599   finishCheck.CheckSignalNotReceived();
1600   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.1f), 0.0001, TEST_LOCATION);
1601
1602   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
1603
1604   // We did expect the animation to finish
1605   application.SendNotification();
1606   finishCheck.CheckSignalReceived();
1607   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), initialPosition, TEST_LOCATION);
1608
1609   // Check that nothing has changed after a couple of buffer swaps
1610   application.Render(0);
1611   DALI_TEST_EQUALS(initialPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1612   application.Render(0);
1613   DALI_TEST_EQUALS(initialPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1614   END_TEST;
1615 }
1616
1617 int UtcDaliAnimationSetSpeedFactorAndRange(void)
1618 {
1619   TestApplication application;
1620
1621   const unsigned int NUM_FRAMES(15);
1622
1623   struct TestData
1624   {
1625     float startTime;
1626     float endTime;
1627     float startX;
1628     float endX;
1629     float expected[NUM_FRAMES];
1630   };
1631
1632   TestData testData[] = {
1633     // ACTOR 0
1634     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1635     /*                       |----------PlayRange---------------|                 */
1636     /*                                            | reverse                       */
1637     {0.0f, 1.0f, // TimePeriod
1638      0.0f,
1639      100.0f, // POS
1640      {
1641        /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1642        /**/ 30.0f,
1643        40.0f,
1644        50.0f,
1645        60.0f, /* Reverse direction */
1646        /**/ 50.0f,
1647        /**/ 40.0f,
1648        /**/ 30.0f,
1649        /**/ 70.0f,
1650        /**/ 60.0f,
1651        /**/ 50.0f,
1652        /**/
1653      }},
1654
1655     // ACTOR 1 - Across start of range
1656     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1657     /*                       |----------PlayRange---------------|                 */
1658     /*                                            | reverse                       */
1659     {0.2f, 0.5f, // TimePeriod
1660      20.0f,
1661      50.0f,                                   // POS
1662      {/**/ 30.0f, 40.0f, 50.0f, 50.0f, 50.0f, /* Loop */
1663       /**/ 30.0f,
1664       40.0f,
1665       50.0f,
1666       50.0f, /* Reverse direction @ frame #9 */
1667       /**/ 50.0f,
1668       /**/ 40.0f,
1669       /**/ 30.0f,
1670       /**/ 50.0f,
1671       /**/ 50.0f,
1672       /**/ 50.0f}},
1673
1674     // ACTOR 2 - Across end of range
1675     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1676     /*                       |----------PlayRange---------------|                 */
1677     /*                                            | reverse                       */
1678     {/**/ 0.5f, 0.9f, // TimePeriod
1679      /**/ 50.0f,
1680      90.0f, // POS
1681      {
1682        /**/ 50.0f,
1683        50.0f,
1684        50.0f,
1685        60.0f,
1686        70.0f, /* Loop */
1687        /**/ 50.0f,
1688        50.0f,
1689        50.0f,
1690        60.0f, /* Reverse direction @ frame #9 */
1691        /**/ 50.0f,
1692        /**/ 50.0f,
1693        /**/ 50.0f,
1694        70.0f,
1695        /**/ 60.0f,
1696        /**/ 50.0f,
1697      }},
1698
1699     // ACTOR 3 - Before beginning of range
1700     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1701     /*                       |----------PlayRange---------------|                 */
1702     /*                                            | reverse                       */
1703     {/**/ 0.1f, 0.25f, // TimePeriod
1704      /**/ 10.0f,
1705      25.0f, // POS
1706      {
1707        /**/
1708        /**/ 25.0f,
1709        25.0f,
1710        25.0f,
1711        25.0f,
1712        25.0f,
1713        25.0f,
1714        25.0f,
1715        25.0f,
1716        25.0f,
1717        25.0f,
1718        25.0f,
1719        25.0f,
1720        25.0f,
1721        25.0f,
1722        25.0f
1723        /**/
1724      }},
1725
1726     // ACTOR 4 - After end of range
1727     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1728     /*                       |----------PlayRange---------------|                 */
1729     /*                                            | reverse                       */
1730     {/**/ 0.85f, 1.0f, // TimePeriod
1731      /**/ 85.0f,
1732      100.0f, // POS
1733      {
1734        /**/
1735        /**/ 85.0f,
1736        85.0f,
1737        85.0f,
1738        85.0f,
1739        85.0f,
1740        85.0f,
1741        85.0f,
1742        85.0f,
1743        85.0f,
1744        85.0f,
1745        85.0f,
1746        85.0f,
1747        85.0f,
1748        85.0f,
1749        85.0f
1750        /**/
1751      }},
1752     // Actor 5 - Middle of range
1753     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1754     /*                       |----------PlayRange---------------|                 */
1755     /*                                            | reverse                       */
1756     {/**/ 0.4f, 0.65f, // Time Period
1757      /**/ 40.0f,
1758      65.0f, // Position
1759      {
1760        /**/ 40.0f,
1761        40.0f,
1762        50.0f,
1763        60.0f,
1764        65.0f,
1765        /**/ 40.0f,
1766        40.0f,
1767        50.0f,
1768        60.0f, // Reverse
1769        /**/ 50.0f,
1770        /**/ 40.0f,
1771        /**/ 40.0f,
1772        /**/ 65.0f,
1773        /**/ 60.0f,
1774        /**/ 50.0f,
1775      }}};
1776
1777   const size_t NUM_ENTRIES(sizeof(testData) / sizeof(TestData));
1778
1779   // Build the animation
1780   float                durationSeconds(1.0f);
1781   Animation            animation = Animation::New(durationSeconds);
1782   bool                 signalReceived(false);
1783   AnimationFinishCheck finishCheck(signalReceived);
1784   animation.FinishedSignal().Connect(&application, finishCheck);
1785
1786   std::vector<Dali::Actor> actors;
1787
1788   for(unsigned int actorIndex = 0; actorIndex < NUM_ENTRIES; ++actorIndex)
1789   {
1790     Actor actor = Actor::New();
1791     actor.SetProperty(Actor::Property::POSITION, Vector3(testData[actorIndex].startX, 0, 0));
1792     actors.push_back(actor);
1793     application.GetScene().Add(actor);
1794
1795     if(actorIndex == 0 || actorIndex == NUM_ENTRIES - 1)
1796     {
1797       KeyFrames keyframes = KeyFrames::New();
1798       keyframes.Add(testData[actorIndex].startTime, Vector3(testData[actorIndex].startX, 0, 0));
1799       keyframes.Add(testData[actorIndex].endTime, Vector3(testData[actorIndex].endX, 0, 0));
1800       animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1801     }
1802     else
1803     {
1804       animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(testData[actorIndex].endX, 0, 0), TimePeriod(testData[actorIndex].startTime, testData[actorIndex].endTime - testData[actorIndex].startTime));
1805     }
1806   }
1807
1808   tet_printf("Test half speed factor. Animation will take twice the duration\n");
1809   tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1810   tet_printf("SetSpeedFactor(0.5f)\n");
1811   animation.SetSpeedFactor(0.5f);
1812   animation.SetPlayRange(Vector2(0.3f, 0.8f));
1813   animation.SetLooping(true);
1814
1815   // Start the animation
1816   animation.Play();
1817   application.SendNotification();
1818   application.Render(0); // Frame 0 tests initial values
1819
1820   for(unsigned int frame = 0; frame < NUM_FRAMES; ++frame)
1821   {
1822     unsigned int actorIndex = 0u;
1823     for(actorIndex = 0u; actorIndex < NUM_ENTRIES; ++actorIndex)
1824     {
1825       DALI_TEST_EQUALS(actors[actorIndex].GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, testData[actorIndex].expected[frame], 0.001, TEST_LOCATION);
1826       if(!Equals(actors[actorIndex].GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, testData[actorIndex].expected[frame]))
1827       {
1828         tet_printf("Failed at frame %u, actorIndex %u\n", frame, actorIndex);
1829       }
1830     }
1831
1832     if(frame == 8)
1833     {
1834       tet_printf("Reverse direction of animation whilst playing after frame 8\n");
1835       tet_printf("SetSpeedFactor(-0.5f)\n");
1836       animation.SetSpeedFactor(-0.5f);
1837       application.SendNotification();
1838     }
1839     application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1840
1841     // We didn't expect the animation to finish yet
1842     application.SendNotification();
1843     finishCheck.CheckSignalNotReceived();
1844   }
1845
1846   END_TEST;
1847 }
1848
1849 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount01(void)
1850 {
1851   TestApplication application;
1852
1853   const unsigned int NUM_FRAMES(15);
1854
1855   struct TestData
1856   {
1857     float startTime;
1858     float endTime;
1859     float startX;
1860     float endX;
1861     float expected[NUM_FRAMES];
1862   };
1863
1864   TestData testData =
1865     // ACTOR 0
1866     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1867     /*                       |----------PlayRange---------------|                 */
1868     {0.0f, 1.0f, // TimePeriod
1869      0.0f,
1870      100.0f, // POS
1871      {
1872        /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1873        /**/ 30.0f,
1874        40.0f,
1875        50.0f,
1876        60.0f,
1877        70.0f,
1878        /**/ 30.0f,
1879        40.0f,
1880        50.0f,
1881        60.0f,
1882        70.0f,
1883        /**/
1884      }};
1885
1886   // Build the animation
1887   float                durationSeconds(1.0f);
1888   Animation            animation = Animation::New(durationSeconds);
1889   bool                 signalReceived(false);
1890   AnimationFinishCheck finishCheck(signalReceived);
1891   animation.FinishedSignal().Connect(&application, finishCheck);
1892
1893   std::vector<Dali::Actor> actors;
1894
1895   Actor actor = Actor::New();
1896   actor.SetProperty(Actor::Property::POSITION, Vector3(testData.startX, 0, 0));
1897   actors.push_back(actor);
1898   application.GetScene().Add(actor);
1899
1900   KeyFrames keyframes = KeyFrames::New();
1901   keyframes.Add(testData.startTime, Vector3(testData.startX, 0, 0));
1902   keyframes.Add(testData.endTime, Vector3(testData.endX, 0, 0));
1903   animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1904
1905   tet_printf("Test half speed factor. Animation will take twice the duration\n");
1906   tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1907   tet_printf("SetSpeedFactor(0.5f)\n");
1908   tet_printf("SetLoopCount(3)\n");
1909   animation.SetSpeedFactor(0.5f);
1910   animation.SetPlayRange(Vector2(0.3f, 0.8f));
1911   animation.SetLoopCount(3);
1912
1913   // Start the animation
1914   animation.Play();
1915   application.SendNotification();
1916   application.Render(0); // Frame 0 tests initial values
1917
1918   for(unsigned int frame = 0; frame < NUM_FRAMES; ++frame)
1919   {
1920     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, testData.expected[frame], 0.001, TEST_LOCATION);
1921
1922     application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1923
1924     if(frame < NUM_FRAMES - 1)
1925     {
1926       // We didn't expect the animation to finish yet
1927       application.SendNotification();
1928       finishCheck.CheckSignalNotReceived();
1929     }
1930   }
1931
1932   // We did expect the animation to finish
1933   application.SendNotification();
1934   finishCheck.CheckSignalReceived();
1935   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, 80.0f, 0.001, TEST_LOCATION);
1936
1937   END_TEST;
1938 }
1939
1940 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount02(void)
1941 {
1942   TestApplication application;
1943
1944   const unsigned int NUM_FRAMES(15);
1945
1946   struct TestData
1947   {
1948     float startTime;
1949     float endTime;
1950     float startX;
1951     float endX;
1952     float expected[NUM_FRAMES];
1953   };
1954
1955   TestData testData =
1956     // ACTOR 0
1957     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1958     /*                       |----------PlayRange---------------|                 */
1959     {0.0f, 1.0f, // TimePeriod
1960      0.0f,
1961      100.0f, // POS
1962      {
1963        /**/ 80.0f,
1964        70.0f,
1965        60.0f,
1966        50.0f,
1967        40.0f,
1968        /**/ 80.0f,
1969        70.0f,
1970        60.0f,
1971        50.0f,
1972        40.0f,
1973        /**/ 80.0f,
1974        70.0f,
1975        60.0f,
1976        50.0f,
1977        40.0f,
1978      }};
1979
1980   // Build the animation
1981   float                durationSeconds(1.0f);
1982   Animation            animation = Animation::New(durationSeconds);
1983   bool                 signalReceived(false);
1984   AnimationFinishCheck finishCheck(signalReceived);
1985   animation.FinishedSignal().Connect(&application, finishCheck);
1986
1987   std::vector<Dali::Actor> actors;
1988
1989   Actor actor = Actor::New();
1990   actor.SetProperty(Actor::Property::POSITION, Vector3(testData.startX, 0, 0));
1991   actors.push_back(actor);
1992   application.GetScene().Add(actor);
1993
1994   KeyFrames keyframes = KeyFrames::New();
1995   keyframes.Add(testData.startTime, Vector3(testData.startX, 0, 0));
1996   keyframes.Add(testData.endTime, Vector3(testData.endX, 0, 0));
1997   animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1998
1999   tet_printf("Test reverse half speed factor. Animation will take twice the duration\n");
2000   tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
2001   tet_printf("SetSpeedFactor(-0.5f)\n");
2002   tet_printf("SetLoopCount(3)\n");
2003   animation.SetSpeedFactor(-0.5f);
2004   animation.SetPlayRange(Vector2(0.3f, 0.8f));
2005   animation.SetLoopCount(3);
2006
2007   // Start the animation
2008   animation.Play();
2009   application.SendNotification();
2010   application.Render(0); // Frame 0 tests initial values
2011
2012   for(unsigned int frame = 0; frame < NUM_FRAMES; ++frame)
2013   {
2014     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, testData.expected[frame], 0.001, TEST_LOCATION);
2015
2016     application.Render(200); // 200 ms at half speed corresponds to 0.1 s
2017
2018     if(frame < NUM_FRAMES - 1)
2019     {
2020       // We didn't expect the animation to finish yet
2021       application.SendNotification();
2022       finishCheck.CheckSignalNotReceived();
2023     }
2024   }
2025
2026   // We did expect the animation to finish
2027   application.SendNotification();
2028   finishCheck.CheckSignalReceived();
2029   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, 30.0f, 0.001, TEST_LOCATION);
2030
2031   END_TEST;
2032 }
2033
2034 int UtcDaliAnimationGetSpeedFactorP(void)
2035 {
2036   TestApplication application;
2037
2038   Animation animation = Animation::New(1.0f);
2039   animation.SetSpeedFactor(0.5f);
2040   DALI_TEST_EQUALS(animation.GetSpeedFactor(), 0.5f, TEST_LOCATION);
2041
2042   animation.SetSpeedFactor(-2.5f);
2043   DALI_TEST_EQUALS(animation.GetSpeedFactor(), -2.5f, TEST_LOCATION);
2044   END_TEST;
2045 }
2046
2047 int UtcDaliAnimationSetPlayRangeP(void)
2048 {
2049   TestApplication application;
2050
2051   Actor actor = Actor::New();
2052   application.GetScene().Add(actor);
2053
2054   // Build the animation
2055   float     durationSeconds(1.0f);
2056   Animation animation = Animation::New(durationSeconds);
2057
2058   bool                 signalReceived(false);
2059   AnimationFinishCheck finishCheck(signalReceived);
2060   animation.FinishedSignal().Connect(&application, finishCheck);
2061   application.SendNotification();
2062
2063   // Set range between 0.4 and 0.8
2064   animation.SetPlayRange(Vector2(0.4f, 0.9f));
2065   application.SendNotification();
2066   DALI_TEST_EQUALS(Vector2(0.4f, 0.9f), animation.GetPlayRange(), TEST_LOCATION);
2067
2068   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2069   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2070
2071   // Start the animation from 40% progress
2072   animation.Play();
2073
2074   application.SendNotification();
2075   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2076
2077   // We didn't expect the animation to finish yet
2078   application.SendNotification();
2079   finishCheck.CheckSignalNotReceived();
2080   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
2081
2082   application.SendNotification();
2083   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2084
2085   application.SendNotification();
2086   finishCheck.CheckSignalNotReceived();
2087   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
2088
2089   application.SendNotification();
2090   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1u /*just beyond the animation duration*/);
2091
2092   // We did expect the animation to finish
2093   application.SendNotification();
2094   finishCheck.CheckSignalReceived();
2095   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.9f), TEST_LOCATION);
2096   END_TEST;
2097 }
2098
2099 int UtcDaliAnimationSetPlayRangeN(void)
2100 {
2101   TestApplication application;
2102
2103   Actor actor = Actor::New();
2104   application.GetScene().Add(actor);
2105
2106   // Build the animation
2107   Animation animation = Animation::New(0);
2108   application.SendNotification();
2109
2110   //PlayRange out of bounds
2111   animation.SetPlayRange(Vector2(-1.0f, 1.0f));
2112   application.SendNotification();
2113   DALI_TEST_EQUALS(Vector2(0.0f, 1.0f), animation.GetPlayRange(), TEST_LOCATION);
2114   animation.SetPlayRange(Vector2(0.0f, 2.0f));
2115   application.SendNotification();
2116   DALI_TEST_EQUALS(Vector2(0.0f, 1.0f), animation.GetPlayRange(), TEST_LOCATION);
2117
2118   //If playRange is not in the correct order it has to be ordered
2119   animation.SetPlayRange(Vector2(0.8f, 0.2f));
2120   application.SendNotification();
2121   DALI_TEST_EQUALS(Vector2(0.2f, 0.8f), animation.GetPlayRange(), TEST_LOCATION);
2122
2123   END_TEST;
2124 }
2125
2126 int UtcDaliAnimationGetPlayRangeP(void)
2127 {
2128   TestApplication application;
2129
2130   Actor actor = Actor::New();
2131   application.GetScene().Add(actor);
2132
2133   // Build the animation
2134   Animation animation = Animation::New(1.0f);
2135   application.SendNotification();
2136
2137   //If PlayRange not specified it should be 0.0-1.0 by default
2138   DALI_TEST_EQUALS(Vector2(0.0f, 1.0f), animation.GetPlayRange(), TEST_LOCATION);
2139
2140   // Set range between 0.4 and 0.8
2141   animation.SetPlayRange(Vector2(0.4f, 0.8f));
2142   application.SendNotification();
2143   DALI_TEST_EQUALS(Vector2(0.4f, 0.8f), animation.GetPlayRange(), TEST_LOCATION);
2144
2145   END_TEST;
2146 }
2147
2148 int UtcDaliAnimationPlayP(void)
2149 {
2150   TestApplication application;
2151
2152   Actor actor = Actor::New();
2153   application.GetScene().Add(actor);
2154
2155   // Build the animation
2156   float     durationSeconds(1.0f);
2157   Animation animation = Animation::New(durationSeconds);
2158   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2159   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2160
2161   // Start the animation
2162   animation.Play();
2163
2164   bool                 signalReceived(false);
2165   AnimationFinishCheck finishCheck(signalReceived);
2166   animation.FinishedSignal().Connect(&application, finishCheck);
2167
2168   application.SendNotification();
2169   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2170
2171   // We didn't expect the animation to finish yet
2172   application.SendNotification();
2173   finishCheck.CheckSignalNotReceived();
2174   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2175
2176   animation.Play(); // Test that calling play has no effect, when animation is already playing
2177   application.SendNotification();
2178   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2179
2180   // We didn't expect the animation to finish yet
2181   application.SendNotification();
2182   finishCheck.CheckSignalNotReceived();
2183   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION);
2184
2185   animation.Play(); // Test that calling play has no effect, when animation is already playing
2186   application.SendNotification();
2187   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2188
2189   // We didn't expect the animation to finish yet
2190   application.SendNotification();
2191   finishCheck.CheckSignalNotReceived();
2192   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
2193
2194   animation.Play(); // Test that calling play has no effect, when animation is already playing
2195   application.SendNotification();
2196   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2197
2198   // We didn't expect the animation to finish yet
2199   application.SendNotification();
2200   finishCheck.CheckSignalNotReceived();
2201   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
2202
2203   animation.Play(); // Test that calling play has no effect, when animation is already playing
2204   application.SendNotification();
2205   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2206
2207   // We did expect the animation to finish
2208   application.SendNotification();
2209   finishCheck.CheckSignalReceived();
2210   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2211
2212   // Check that nothing has changed after a couple of buffer swaps
2213   application.Render(0);
2214   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2215   application.Render(0);
2216   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2217   END_TEST;
2218 }
2219
2220 int UtcDaliAnimationPlayOffSceneP(void)
2221 {
2222   // Test that an animation cannot be played, when the actor is off-stage.
2223   // And the property value and the current property value should not be changed in the case.
2224
2225   TestApplication application;
2226
2227   Actor   actor = Actor::New();
2228   Vector3 basePosition(Vector3::ZERO);
2229   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2230   // Not added to the stage yet!
2231
2232   // Build the animation
2233   float     durationSeconds(1.0f);
2234   Animation animation = Animation::New(durationSeconds);
2235   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2236   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2237
2238   // Start the animation
2239   animation.Play();
2240
2241   bool                 signalReceived(false);
2242   AnimationFinishCheck finishCheck(signalReceived);
2243   animation.FinishedSignal().Connect(&application, finishCheck);
2244
2245   application.SendNotification();
2246   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
2247
2248   application.SendNotification();
2249   finishCheck.CheckSignalReceived();
2250
2251   // An animation can't be played. The position shouldn't be changed.
2252   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2253   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2254
2255   // Add to the stage
2256   application.GetScene().Add(actor);
2257
2258   // Start the animation again
2259   animation.Play();
2260
2261   application.SendNotification();
2262   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
2263
2264   // We did expect the animation to finish
2265   application.SendNotification();
2266   finishCheck.CheckSignalReceived();
2267
2268   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2269   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2270
2271   // Reset the position
2272   actor[Actor::Property::POSITION] = basePosition;
2273
2274   application.SendNotification();
2275   application.Render();
2276
2277   // Create an animator again
2278   animation.Clear();
2279   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2280
2281   // Remove from the stage
2282   application.GetScene().Remove(actor);
2283
2284   signalReceived = false;
2285
2286   // Start the animation again
2287   animation.Play();
2288
2289   application.SendNotification();
2290   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
2291
2292   application.SendNotification();
2293   finishCheck.CheckSignalReceived();
2294
2295   // An animation can't be played. The position shouldn't be changed.
2296   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2297   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2298
2299   END_TEST;
2300 }
2301
2302 int UtcDaliAnimationPlayOffSceneDiscardP(void)
2303 {
2304   // Test that an animation cannot be played, when the actor is off-stage.
2305   // When the actor is added to the stage, it should appear at the current position
2306   // i.e. where it would have been anyway, if on-stage from the beginning.
2307
2308   TestApplication application;
2309
2310   Actor   actor = Actor::New();
2311   Vector3 basePosition(Vector3::ZERO);
2312   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2313   // Not added to the stage yet!
2314
2315   // Build the animation
2316   float     durationSeconds(1.0f);
2317   Animation animation = Animation::New(durationSeconds);
2318   animation.SetDisconnectAction(Animation::DISCARD);
2319   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2320   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2321
2322   // Start the animation
2323   animation.Play();
2324
2325   bool                 signalReceived(false);
2326   AnimationFinishCheck finishCheck(signalReceived);
2327   animation.FinishedSignal().Connect(&application, finishCheck);
2328
2329   application.SendNotification();
2330   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2331
2332   // We didn't expect the animation to finish yet
2333   application.SendNotification();
2334   finishCheck.CheckSignalNotReceived();
2335
2336   // An animation can't be played. The position shouldn't be changed.
2337   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2338
2339   // Add to the stage
2340   application.GetScene().Add(actor);
2341
2342   application.SendNotification();
2343   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2344
2345   // We didn't expect the animation to finish yet
2346   application.SendNotification();
2347   finishCheck.CheckSignalNotReceived();
2348   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(40, 40, 40) /*on-stage*/, TEST_LOCATION);
2349
2350   // Remove from the stage
2351   application.GetScene().Remove(actor);
2352
2353   application.SendNotification();
2354   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2355
2356   // We didn't expect the animation to finish yet
2357   application.SendNotification();
2358   finishCheck.CheckSignalNotReceived();
2359   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO /*back to start position as disconnect behaviour is discard*/, TEST_LOCATION);
2360   // Check that nothing has changed after a couple of buffer swaps
2361   application.Render(0);
2362   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
2363   application.Render(0);
2364   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
2365   application.Render(0);
2366   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
2367
2368   // Add to the stage
2369   application.GetScene().Add(actor);
2370
2371   application.SendNotification();
2372   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2373
2374   // We didn't expect the animation to finish yet
2375   application.SendNotification();
2376   finishCheck.CheckSignalNotReceived();
2377   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(80, 80, 80), TEST_LOCATION);
2378
2379   application.SendNotification();
2380   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2381
2382   // We did expect the animation to finish
2383   application.SendNotification();
2384   finishCheck.CheckSignalReceived();
2385   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2386
2387   // Check that nothing has changed after a couple of buffer swaps
2388   application.Render(0);
2389   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2390
2391   application.Render(0);
2392   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2393   END_TEST;
2394 }
2395
2396 int UtcDaliAnimationPlayOffSceneBakeFinalP(void)
2397 {
2398   // Test that an animation cannot be played, when the actor is off-stage.
2399   // When the actor is added to the stage, it should appear at the current position
2400   // i.e. where it would have been anyway, if on-stage from the beginning.
2401
2402   TestApplication application;
2403
2404   Actor   actor = Actor::New();
2405   Vector3 basePosition(Vector3::ZERO);
2406   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2407   // Not added to the stage!
2408
2409   // Build the animation
2410   float     durationSeconds(1.0f);
2411   Animation animation = Animation::New(durationSeconds);
2412   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2413   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2414
2415   // Start the animation
2416   animation.Play();
2417
2418   bool                 signalReceived(false);
2419   AnimationFinishCheck finishCheck(signalReceived);
2420   animation.FinishedSignal().Connect(&application, finishCheck);
2421
2422   application.SendNotification();
2423   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2424
2425   // We didn't expect the animation to finish yet
2426   application.SendNotification();
2427   finishCheck.CheckSignalNotReceived();
2428
2429   // An animation can't be played. The position shouldn't be changed.
2430   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2431
2432   // Add to the stage
2433   application.GetScene().Add(actor);
2434
2435   application.SendNotification();
2436   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2437
2438   // We didn't expect the animation to finish yet
2439   application.SendNotification();
2440   finishCheck.CheckSignalNotReceived();
2441   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(40, 40, 40) /*on-stage*/, TEST_LOCATION);
2442
2443   // Remove from the stage
2444   application.GetScene().Remove(actor);
2445
2446   application.SendNotification();
2447   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2448
2449   // We didn't expect the animation to finish yet
2450   application.SendNotification();
2451   finishCheck.CheckSignalNotReceived();
2452   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition /*bake final*/, TEST_LOCATION);
2453
2454   // Add to the stage
2455   application.GetScene().Add(actor);
2456
2457   application.SendNotification();
2458   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2459
2460   // We didn't expect the animation to finish yet
2461   application.SendNotification();
2462   finishCheck.CheckSignalNotReceived();
2463   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition /*bake final removed the */, TEST_LOCATION);
2464
2465   application.SendNotification();
2466   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2467
2468   // We did expect the animation to finish
2469   application.SendNotification();
2470   finishCheck.CheckSignalReceived();
2471   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2472
2473   // Check that nothing has changed after a couple of buffer swaps
2474   application.Render(0);
2475   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2476
2477   application.Render(0);
2478   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2479   END_TEST;
2480 }
2481
2482 int UtcDaliAnimationPlayOffSceneBakeP(void)
2483 {
2484   // Test that an animation cannot be played, when the actor is off-stage.
2485   // When the actor is added to the stage, it should appear at the current position
2486   // i.e. where it would have been anyway, if on-stage from the beginning.
2487
2488   TestApplication application;
2489
2490   Actor   actor = Actor::New();
2491   Vector3 basePosition(Vector3::ZERO);
2492   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2493   // Not added to the stage!
2494
2495   // Build the animation
2496   float     durationSeconds(1.0f);
2497   Animation animation = Animation::New(durationSeconds);
2498   animation.SetDisconnectAction(Animation::BAKE);
2499   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2500   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2501
2502   // Start the animation
2503   animation.Play();
2504
2505   bool                 signalReceived(false);
2506   AnimationFinishCheck finishCheck(signalReceived);
2507   animation.FinishedSignal().Connect(&application, finishCheck);
2508
2509   application.SendNotification();
2510   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2511
2512   // We didn't expect the animation to finish yet
2513   application.SendNotification();
2514   finishCheck.CheckSignalNotReceived();
2515
2516   // An animation can't be played. The position shouldn't be changed.
2517   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2518
2519   // Add to the stage
2520   application.GetScene().Add(actor);
2521
2522   application.SendNotification();
2523   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2524
2525   // We didn't expect the animation to finish yet
2526   application.SendNotification();
2527   finishCheck.CheckSignalNotReceived();
2528   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(40, 40, 40) /*on-stage*/, TEST_LOCATION);
2529
2530   // Remove from the stage
2531   application.GetScene().Remove(actor); // baked here
2532
2533   application.SendNotification();
2534   // this render is a no-op in this case as animator is disabled while off stage
2535   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2536   // We didn't expect the animation to finish yet
2537   application.SendNotification();
2538   finishCheck.CheckSignalNotReceived();
2539   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(40, 40, 40) /*baked value*/, TEST_LOCATION);
2540
2541   // Add back to the stage
2542   application.GetScene().Add(actor);
2543
2544   application.SendNotification();
2545   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2546   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /* animation restarted at 40,40,40 + 80%*60 */, TEST_LOCATION);
2547   application.Render(static_cast<unsigned int>(0.0f));
2548   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2549   application.Render(static_cast<unsigned int>(0.0f));
2550   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2551
2552   // Remove from the stage
2553   application.GetScene().Remove(actor); // baked here
2554
2555   application.SendNotification();
2556   // this render is a no-op in this case as animator is disabled while off stage
2557   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 100% progress */);
2558   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2559   application.Render(static_cast<unsigned int>(0.0f));
2560   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2561   application.Render(static_cast<unsigned int>(0.0f));
2562   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2563
2564   // Add back to the stage
2565   application.GetScene().Add(actor);
2566
2567   // We didn't expect the animation to finish yet
2568   application.SendNotification();
2569   finishCheck.CheckSignalNotReceived();
2570   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88), TEST_LOCATION);
2571
2572   application.SendNotification();
2573   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2574
2575   // We did expect the animation to finish
2576   application.SendNotification();
2577   finishCheck.CheckSignalReceived();
2578   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2579
2580   // Check that nothing has changed after a couple of buffer swaps
2581   application.Render(0);
2582   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2583
2584   application.Render(0);
2585   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2586   END_TEST;
2587 }
2588
2589 int UtcDaliAnimationPlayDiscardHandleP(void)
2590 {
2591   TestApplication application;
2592
2593   Actor actor = Actor::New();
2594   application.GetScene().Add(actor);
2595
2596   // Build the animation
2597   float     durationSeconds(1.0f);
2598   Animation animation = Animation::New(durationSeconds);
2599   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2600   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2601
2602   bool                 signalReceived(false);
2603   AnimationFinishCheck finishCheck(signalReceived);
2604   animation.FinishedSignal().Connect(&application, finishCheck);
2605
2606   // Start the animation
2607   animation.Play();
2608
2609   // This is a test of the "Fire and Forget" behaviour
2610   // Discard the animation handle!
2611   animation.Reset();
2612   DALI_TEST_CHECK(!animation);
2613
2614   application.SendNotification();
2615   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2616
2617   // We didn't expect the animation to finish yet
2618   application.SendNotification();
2619   finishCheck.CheckSignalNotReceived();
2620   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2621
2622   application.SendNotification();
2623   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2624
2625   // We didn't expect the animation to finish yet
2626   application.SendNotification();
2627   finishCheck.CheckSignalNotReceived();
2628   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION);
2629
2630   application.SendNotification();
2631   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2632
2633   // We didn't expect the animation to finish yet
2634   application.SendNotification();
2635   finishCheck.CheckSignalNotReceived();
2636   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
2637
2638   application.SendNotification();
2639   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2640
2641   // We didn't expect the animation to finish yet
2642   application.SendNotification();
2643   finishCheck.CheckSignalNotReceived();
2644   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
2645
2646   application.SendNotification();
2647   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2648
2649   // We did expect the animation to finish
2650   application.SendNotification();
2651   finishCheck.CheckSignalReceived();
2652   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2653
2654   // Check that nothing has changed after a couple of buffer swaps
2655   application.Render(0);
2656   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2657   application.Render(0);
2658   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2659   END_TEST;
2660 }
2661
2662 int UtcDaliAnimationPlayStopDiscardHandleP(void)
2663 {
2664   TestApplication application;
2665
2666   Actor actor = Actor::New();
2667   application.GetScene().Add(actor);
2668
2669   // Build the animation
2670   float     durationSeconds(1.0f);
2671   Animation animation = Animation::New(durationSeconds);
2672   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2673   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2674
2675   // Start the animation
2676   animation.Play();
2677
2678   bool                 signalReceived(false);
2679   AnimationFinishCheck finishCheck(signalReceived);
2680   animation.FinishedSignal().Connect(&application, finishCheck);
2681
2682   application.SendNotification();
2683   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2684
2685   // We didn't expect the animation to finish yet
2686   application.SendNotification();
2687   finishCheck.CheckSignalNotReceived();
2688   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2689
2690   // This is a test of the "Fire and Forget" behaviour
2691   // Stop the animation, and Discard the animation handle!
2692   animation.Stop();
2693   animation.Reset();
2694   DALI_TEST_CHECK(!animation);
2695
2696   application.SendNotification();
2697   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2698
2699   // We expect the animation to finish at 20% progress
2700   application.SendNotification();
2701   finishCheck.CheckSignalReceived();
2702   finishCheck.Reset();
2703   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2704
2705   application.SendNotification();
2706   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2707
2708   // Check that nothing has changed
2709   application.SendNotification();
2710   finishCheck.CheckSignalNotReceived();
2711   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2712
2713   application.SendNotification();
2714   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2715
2716   // Check that nothing has changed
2717   application.SendNotification();
2718   finishCheck.CheckSignalNotReceived();
2719   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2720
2721   application.SendNotification();
2722   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 100% progress */);
2723
2724   // Check that nothing has changed
2725   application.SendNotification();
2726   finishCheck.CheckSignalNotReceived();
2727   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2728   END_TEST;
2729 }
2730
2731 int UtcDaliAnimationPlayRangeP(void)
2732 {
2733   TestApplication application;
2734
2735   Actor actor = Actor::New();
2736   application.GetScene().Add(actor);
2737
2738   // Build the animation
2739   float     durationSeconds(1.0f);
2740   Animation animation = Animation::New(durationSeconds);
2741   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2742   KeyFrames keyframes = KeyFrames::New();
2743   keyframes.Add(0.0f, Vector3(0.0f, 0.0f, 0.0f));
2744   keyframes.Add(1.0f, Vector3(100.0f, 100.0f, 100.0f));
2745
2746   animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes);
2747
2748   // Set range between 0.4 and 0.8
2749   animation.SetPlayRange(Vector2(0.4f, 0.8f));
2750   animation.Play();
2751
2752   bool                 signalReceived(false);
2753   AnimationFinishCheck finishCheck(signalReceived);
2754   animation.FinishedSignal().Connect(&application, finishCheck);
2755
2756   //Test that setting progress outside the range doesn't work
2757   animation.SetCurrentProgress(0.9f);
2758   application.SendNotification();
2759   application.Render(0);
2760   DALI_TEST_EQUALS(animation.GetCurrentProgress(), 0.4f, TEST_LOCATION);
2761   animation.SetCurrentProgress(0.2f);
2762   application.SendNotification();
2763   application.Render(0);
2764   DALI_TEST_EQUALS(animation.GetCurrentProgress(), 0.4f, TEST_LOCATION);
2765
2766   application.SendNotification();
2767   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2768
2769   // We didn't expect the animation to finish yet
2770   application.SendNotification();
2771   finishCheck.CheckSignalNotReceived();
2772   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
2773
2774   animation.Play(); // Test that calling play has no effect, when animation is already playing
2775   application.SendNotification();
2776   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /* 80% progress */);
2777
2778   // We did expect the animation to finish
2779   application.SendNotification();
2780   finishCheck.CheckSignalReceived();
2781   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
2782
2783   // Check that nothing has changed after a couple of buffer swaps
2784   application.Render(0);
2785   DALI_TEST_EQUALS(targetPosition * 0.8f, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2786   application.Render(0);
2787   DALI_TEST_EQUALS(targetPosition * 0.8f, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2788
2789   //Loop inside the range
2790   finishCheck.Reset();
2791   animation.SetLooping(true);
2792   animation.Play();
2793   application.SendNotification();
2794   float intervalSeconds = 0.1f;
2795   float progress        = 0.4f;
2796   for(int iterations = 0; iterations < 10; ++iterations)
2797   {
2798     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
2799
2800     progress += intervalSeconds;
2801     if(progress > 0.8f)
2802     {
2803       progress = progress - 0.4f;
2804     }
2805
2806     DALI_TEST_EQUALS(targetPosition * progress, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.001f, TEST_LOCATION);
2807   }
2808
2809   // We didn't expect the animation to finish yet
2810   application.SendNotification();
2811   finishCheck.CheckSignalNotReceived();
2812
2813   //Test change range on the fly
2814   animation.SetPlayRange(Vector2(0.2f, 0.9f));
2815   application.SendNotification();
2816
2817   for(int iterations = 0; iterations < 10; ++iterations)
2818   {
2819     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
2820
2821     progress += intervalSeconds;
2822     if(progress > 0.9f)
2823     {
2824       progress = progress - 0.7f;
2825     }
2826
2827     DALI_TEST_EQUALS(targetPosition * progress, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.001f, TEST_LOCATION);
2828   }
2829
2830   END_TEST;
2831 }
2832
2833 int UtcDaliAnimationPlayFromP(void)
2834 {
2835   TestApplication application;
2836
2837   Actor actor = Actor::New();
2838   application.GetScene().Add(actor);
2839
2840   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
2841
2842   // Build the animation
2843   float     durationSeconds(1.0f);
2844   Animation animation = Animation::New(durationSeconds);
2845   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2846   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2847
2848   // Start the animation from 40% progress
2849   animation.PlayFrom(0.4f);
2850
2851   // Target value should be updated straight away
2852   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2853
2854   bool                 signalReceived(false);
2855   AnimationFinishCheck finishCheck(signalReceived);
2856   animation.FinishedSignal().Connect(&application, finishCheck);
2857
2858   application.SendNotification();
2859   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2860
2861   // We didn't expect the animation to finish yet
2862   application.SendNotification();
2863   finishCheck.CheckSignalNotReceived();
2864   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
2865
2866   animation.Play(); // Test that calling play has no effect, when animation is already playing
2867   application.SendNotification();
2868   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2869
2870   // We didn't expect the animation to finish yet
2871   application.SendNotification();
2872   finishCheck.CheckSignalNotReceived();
2873   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
2874
2875   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2876   // We did expect the animation to finish
2877   application.SendNotification();
2878   finishCheck.CheckSignalReceived();
2879   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2880
2881   // Check that nothing has changed after a couple of buffer swaps
2882   application.Render(0);
2883   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2884   application.Render(0);
2885   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2886   END_TEST;
2887 }
2888
2889 int UtcDaliAnimationPlayFromN(void)
2890 {
2891   TestApplication application;
2892
2893   Actor actor = Actor::New();
2894   application.GetScene().Add(actor);
2895
2896   // Build the animation
2897   float     durationSeconds(1.0f);
2898   Animation animation = Animation::New(durationSeconds);
2899   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2900   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2901
2902   //PlayFrom with an argument outside the range [0..1] will be ignored
2903   animation.PlayFrom(-1.0f);
2904   application.SendNotification();
2905   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
2906
2907   animation.PlayFrom(100.0f);
2908   application.SendNotification();
2909   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
2910   END_TEST;
2911 }
2912
2913 int UtcDaliAnimationPauseP(void)
2914 {
2915   TestApplication application;
2916
2917   Actor actor = Actor::New();
2918   application.GetScene().Add(actor);
2919
2920   // Build the animation
2921   float     durationSeconds(1.0f);
2922   Animation animation = Animation::New(durationSeconds);
2923   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2924   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2925
2926   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2927
2928   // Start the animation
2929   animation.Play();
2930
2931   bool                 signalReceived(false);
2932   AnimationFinishCheck finishCheck(signalReceived);
2933   animation.FinishedSignal().Connect(&application, finishCheck);
2934
2935   application.SendNotification();
2936   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
2937
2938   // We didn't expect the animation to finish yet
2939   application.SendNotification();
2940   finishCheck.CheckSignalNotReceived();
2941   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
2942
2943   // Pause the animation
2944   animation.Pause();
2945   application.SendNotification();
2946
2947   // Loop 5 times
2948   for(int i = 0; i < 5; ++i)
2949   {
2950     application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
2951
2952     // We didn't expect the animation to finish yet
2953     application.SendNotification();
2954     finishCheck.CheckSignalNotReceived();
2955     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress when paused */, TEST_LOCATION);
2956   }
2957
2958   // Keep going
2959   animation.Play();
2960   application.SendNotification();
2961   application.Render(static_cast<unsigned int>(durationSeconds * 490.0f) /*slightly less than the animation duration*/);
2962
2963   // We didn't expect the animation to finish yet
2964   application.SendNotification();
2965   finishCheck.CheckSignalNotReceived();
2966
2967   application.SendNotification();
2968   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
2969
2970   // We did expect the animation to finish
2971   application.SendNotification();
2972   finishCheck.CheckSignalReceived();
2973   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2974
2975   // Check that nothing has changed after a couple of buffer swaps
2976   application.Render(0);
2977   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2978   application.Render(0);
2979   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2980   END_TEST;
2981 }
2982
2983 int UtcDaliAnimationGetStateP(void)
2984 {
2985   TestApplication application;
2986
2987   Actor actor = Actor::New();
2988   application.GetScene().Add(actor);
2989
2990   // Build the animation
2991   float     durationSeconds(1.0f);
2992   Animation animation = Animation::New(durationSeconds);
2993   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2994   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2995   DALI_TEST_EQUALS(animation.GetState(), Animation::STOPPED, TEST_LOCATION);
2996
2997   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2998
2999   // Start the animation
3000   animation.Play();
3001
3002   DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
3003
3004   bool                 signalReceived(false);
3005   AnimationFinishCheck finishCheck(signalReceived);
3006   animation.FinishedSignal().Connect(&application, finishCheck);
3007
3008   application.SendNotification();
3009   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3010
3011   // We didn't expect the animation to finish yet
3012   application.SendNotification();
3013   finishCheck.CheckSignalNotReceived();
3014   DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
3015   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
3016
3017   // Pause the animation
3018   animation.Pause();
3019   DALI_TEST_EQUALS(animation.GetState(), Animation::PAUSED, TEST_LOCATION);
3020   application.SendNotification();
3021   application.Render(0.f);
3022
3023   // Loop 5 times
3024   for(int i = 0; i < 5; ++i)
3025   {
3026     application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
3027
3028     // We didn't expect the animation to finish yet
3029     application.SendNotification();
3030     finishCheck.CheckSignalNotReceived();
3031     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress when paused */, TEST_LOCATION);
3032     DALI_TEST_EQUALS(animation.GetState(), Animation::PAUSED, TEST_LOCATION);
3033   }
3034
3035   // Keep going
3036   finishCheck.Reset();
3037   animation.Play();
3038   DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
3039   application.SendNotification();
3040   application.Render(static_cast<unsigned int>(durationSeconds * 490.0f) /*slightly less than the animation duration*/);
3041   // We didn't expect the animation to finish yet
3042   application.SendNotification();
3043   finishCheck.CheckSignalNotReceived();
3044   DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
3045
3046   application.SendNotification();
3047   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
3048
3049   // We did expect the animation to finish
3050   application.SendNotification();
3051   finishCheck.CheckSignalReceived();
3052   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
3053   DALI_TEST_EQUALS(animation.GetState(), Animation::STOPPED, TEST_LOCATION);
3054
3055   // Check that nothing has changed after a couple of buffer swaps
3056   application.Render(0);
3057   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
3058   application.Render(0);
3059   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
3060   DALI_TEST_EQUALS(animation.GetState(), Animation::STOPPED, TEST_LOCATION);
3061
3062   // re-play
3063   finishCheck.Reset();
3064   animation.Play();
3065   DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
3066   application.SendNotification();
3067   application.Render(static_cast<unsigned int>(durationSeconds * 490.0f) /*slightly less than the animation duration*/);
3068   application.SendNotification();
3069   finishCheck.CheckSignalNotReceived();
3070   DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
3071
3072   END_TEST;
3073 }
3074
3075 int UtcDaliAnimationStopP(void)
3076 {
3077   TestApplication application;
3078
3079   Actor actor = Actor::New();
3080   application.GetScene().Add(actor);
3081
3082   // Build the animation
3083   float     durationSeconds(1.0f);
3084   Animation animation = Animation::New(durationSeconds);
3085   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
3086   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
3087
3088   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
3089
3090   // Start the animation
3091   animation.Play();
3092
3093   bool                 signalReceived(false);
3094   AnimationFinishCheck finishCheck(signalReceived);
3095   animation.FinishedSignal().Connect(&application, finishCheck);
3096
3097   application.SendNotification();
3098   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3099
3100   // We didn't expect the animation to finish yet
3101   application.SendNotification();
3102   finishCheck.CheckSignalNotReceived();
3103   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
3104
3105   // Stop the animation
3106   animation.Stop();
3107   application.SendNotification();
3108
3109   // Loop 5 times
3110   for(int i = 0; i < 5; ++i)
3111   {
3112     application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
3113
3114     // We did expect the animation to finish
3115     application.SendNotification();
3116     finishCheck.CheckSignalReceived();
3117     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress when stopped */, TEST_LOCATION);
3118   }
3119   END_TEST;
3120 }
3121
3122 int UtcDaliAnimationStopSetPositionP(void)
3123 {
3124   // Test that Animation::Stop & Actor::SetPosition can be used in conjunction
3125   // i.e. to check that the animation does not interfere with the position set.
3126
3127   TestApplication application;
3128
3129   Actor actor = Actor::New();
3130   application.GetScene().Add(actor);
3131
3132   // Build the animation
3133   float     durationSeconds(1.0f);
3134   Animation animation = Animation::New(durationSeconds);
3135   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
3136   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
3137
3138   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
3139
3140   // Start the animation
3141   animation.Play();
3142
3143   bool                 signalReceived(false);
3144   AnimationFinishCheck finishCheck(signalReceived);
3145   animation.FinishedSignal().Connect(&application, finishCheck);
3146
3147   application.SendNotification();
3148   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3149
3150   // We didn't expect the animation to finish yet
3151   application.SendNotification();
3152   finishCheck.CheckSignalNotReceived();
3153   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
3154
3155   // Stop the animation
3156   animation.Stop();
3157   Vector3 positionSet(2.0f, 3.0f, 4.0f);
3158   actor.SetProperty(Actor::Property::POSITION, positionSet);
3159   application.SendNotification();
3160
3161   // Loop 5 times
3162   for(int i = 0; i < 5; ++i)
3163   {
3164     application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
3165
3166     // We did expect the animation to finish
3167     application.SendNotification();
3168     finishCheck.CheckSignalReceived();
3169     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), positionSet /*Animation should not interfere with this*/, TEST_LOCATION);
3170   }
3171   END_TEST;
3172 }
3173
3174 int UtcDaliAnimationClearP(void)
3175 {
3176   TestApplication application;
3177
3178   Actor actor = Actor::New();
3179   application.GetScene().Add(actor);
3180
3181   // Build the animation
3182   float     durationSeconds(1.0f);
3183   Animation animation = Animation::New(durationSeconds);
3184   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
3185   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
3186
3187   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
3188
3189   // Start the animation
3190   animation.Play();
3191
3192   bool                 signalReceived(false);
3193   AnimationFinishCheck finishCheck(signalReceived);
3194   animation.FinishedSignal().Connect(&application, finishCheck);
3195
3196   application.SendNotification();
3197   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3198
3199   // We didn't expect the animation to finish yet
3200   application.SendNotification();
3201   finishCheck.CheckSignalNotReceived();
3202   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
3203
3204   // Clear the animation
3205   animation.Clear();
3206   application.SendNotification();
3207
3208   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
3209
3210   // We don't expect the animation to finish now
3211   application.SendNotification();
3212   finishCheck.CheckSignalNotReceived();
3213   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress since the animator was destroyed */, TEST_LOCATION);
3214
3215   // Restart as a scale animation; this should not move the actor's position
3216   finishCheck.Reset();
3217   actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO);
3218   Vector3 targetScale(3.0f, 3.0f, 3.0f);
3219   animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR);
3220   animation.Play();
3221
3222   application.SendNotification();
3223   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3224
3225   // We didn't expect the animation to finish yet
3226   application.SendNotification();
3227   finishCheck.CheckSignalNotReceived();
3228   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO /*Check move-animator was destroyed*/, TEST_LOCATION);
3229   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION);
3230
3231   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
3232
3233   // We did expect the animation to finish
3234   application.SendNotification();
3235   finishCheck.CheckSignalReceived();
3236   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO /*Check move-animator was destroyed*/, TEST_LOCATION);
3237   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
3238   END_TEST;
3239 }
3240
3241 int UtcDaliAnimationFinishedSignalP(void)
3242 {
3243   TestApplication application;
3244
3245   // Start the empty animation
3246   float     durationSeconds(1.0f);
3247   Animation animation = Animation::New(durationSeconds);
3248   animation.Play();
3249
3250   bool                 signalReceived(false);
3251   AnimationFinishCheck finishCheck(signalReceived);
3252   animation.FinishedSignal().Connect(&application, finishCheck);
3253
3254   application.SendNotification();
3255   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*beyond the animation duration*/);
3256
3257   // We did expect the animation to finish
3258   application.SendNotification();
3259   finishCheck.CheckSignalReceived();
3260   END_TEST;
3261 }
3262
3263 int UtcDaliAnimationAnimateByBooleanP(void)
3264 {
3265   TestApplication application;
3266
3267   Actor actor = Actor::New();
3268
3269   // Register a boolean property
3270   bool            startValue(false);
3271   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3272   application.GetScene().Add(actor);
3273   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3274   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3275
3276   // Build the animation
3277   float      durationSeconds(2.0f);
3278   Animation  animation = Animation::New(durationSeconds);
3279   const bool relativeValue(true);
3280   const bool finalValue(false || relativeValue);
3281   animation.AnimateBy(Property(actor, index), relativeValue);
3282
3283   // Start the animation
3284   animation.Play();
3285
3286   // Target value should be retrievable straight away
3287   DALI_TEST_EQUALS(actor.GetProperty<bool>(index), finalValue, TEST_LOCATION);
3288
3289   bool                 signalReceived(false);
3290   AnimationFinishCheck finishCheck(signalReceived);
3291   animation.FinishedSignal().Connect(&application, finishCheck);
3292
3293   application.SendNotification();
3294   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3295
3296   // We didn't expect the animation to finish yet
3297   application.SendNotification();
3298   finishCheck.CheckSignalNotReceived();
3299   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3300
3301   application.SendNotification();
3302   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3303
3304   // We did expect the animation to finish
3305   application.SendNotification();
3306   finishCheck.CheckSignalReceived();
3307   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3308
3309   // Check that nothing has changed after a couple of buffer swaps
3310   application.Render(0);
3311   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3312   application.Render(0);
3313   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3314
3315   // Repeat with relative value "false" - this should be an NOOP
3316   animation = Animation::New(durationSeconds);
3317   bool noOpValue(false);
3318   animation.AnimateBy(Property(actor, index), noOpValue);
3319
3320   // Start the animation
3321   animation.Play();
3322
3323   finishCheck.Reset();
3324   animation.FinishedSignal().Connect(&application, finishCheck);
3325
3326   application.SendNotification();
3327   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3328
3329   // We didn't expect the animation to finish yet
3330   application.SendNotification();
3331   finishCheck.CheckSignalNotReceived();
3332   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3333
3334   application.SendNotification();
3335   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3336
3337   // We did expect the animation to finish
3338   application.SendNotification();
3339   finishCheck.CheckSignalReceived();
3340   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3341
3342   // Check that nothing has changed after a couple of buffer swaps
3343   application.Render(0);
3344   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3345   application.Render(0);
3346   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3347   END_TEST;
3348 }
3349
3350 int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void)
3351 {
3352   TestApplication application;
3353
3354   Actor actor = Actor::New();
3355
3356   // Register a boolean property
3357   bool            startValue(false);
3358   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3359   application.GetScene().Add(actor);
3360   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3361   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3362
3363   // Build the animation
3364   float     durationSeconds(2.0f);
3365   Animation animation = Animation::New(durationSeconds);
3366   bool      relativeValue(true);
3367   bool      finalValue(false || relativeValue);
3368   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN);
3369
3370   // Start the animation
3371   animation.Play();
3372
3373   bool                 signalReceived(false);
3374   AnimationFinishCheck finishCheck(signalReceived);
3375   animation.FinishedSignal().Connect(&application, finishCheck);
3376
3377   application.SendNotification();
3378   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3379
3380   // We didn't expect the animation to finish yet
3381   application.SendNotification();
3382   finishCheck.CheckSignalNotReceived();
3383   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3384
3385   application.SendNotification();
3386   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3387
3388   // We did expect the animation to finish
3389   application.SendNotification();
3390   finishCheck.CheckSignalReceived();
3391   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3392
3393   // Check that nothing has changed after a couple of buffer swaps
3394   application.Render(0);
3395   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3396   application.Render(0);
3397   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3398
3399   // Repeat with relative value "false" - this should be an NOOP
3400   animation = Animation::New(durationSeconds);
3401   bool noOpValue(false);
3402   animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunction::EASE_IN);
3403
3404   // Start the animation
3405   animation.Play();
3406
3407   finishCheck.Reset();
3408   animation.FinishedSignal().Connect(&application, finishCheck);
3409
3410   application.SendNotification();
3411   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3412
3413   // We didn't expect the animation to finish yet
3414   application.SendNotification();
3415   finishCheck.CheckSignalNotReceived();
3416   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3417
3418   application.SendNotification();
3419   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3420
3421   // We did expect the animation to finish
3422   application.SendNotification();
3423   finishCheck.CheckSignalReceived();
3424   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3425   END_TEST;
3426 }
3427
3428 int UtcDaliAnimationAnimateByBooleanTimePeriodP(void)
3429 {
3430   TestApplication application;
3431
3432   Actor actor = Actor::New();
3433
3434   // Register a boolean property
3435   bool            startValue(false);
3436   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3437   application.GetScene().Add(actor);
3438   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3439   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3440
3441   // Build the animation
3442   float     durationSeconds(2.0f);
3443   Animation animation = Animation::New(durationSeconds);
3444   bool      relativeValue(true);
3445   bool      finalValue(false || relativeValue);
3446   float     animatorDurationSeconds(durationSeconds * 0.5f);
3447   animation.AnimateBy(Property(actor, index),
3448                       relativeValue,
3449                       TimePeriod(animatorDurationSeconds));
3450
3451   // Start the animation
3452   animation.Play();
3453
3454   bool                 signalReceived(false);
3455   AnimationFinishCheck finishCheck(signalReceived);
3456   animation.FinishedSignal().Connect(&application, finishCheck);
3457
3458   application.SendNotification();
3459   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
3460
3461   // We didn't expect the animation to finish yet
3462   application.SendNotification();
3463   finishCheck.CheckSignalNotReceived();
3464   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3465
3466   application.SendNotification();
3467   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
3468
3469   // We didn't expect the animation to finish yet...
3470   application.SendNotification();
3471   finishCheck.CheckSignalNotReceived();
3472
3473   // ...however we should have reached the final value
3474   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3475
3476   application.SendNotification();
3477   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
3478
3479   // We did expect the animation to finish
3480   application.SendNotification();
3481   finishCheck.CheckSignalReceived();
3482   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3483
3484   // Check that nothing has changed after a couple of buffer swaps
3485   application.Render(0);
3486   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3487   application.Render(0);
3488   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3489   END_TEST;
3490 }
3491
3492 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void)
3493 {
3494   TestApplication application;
3495
3496   Actor actor = Actor::New();
3497
3498   // Register a boolean property
3499   bool            startValue(false);
3500   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3501   application.GetScene().Add(actor);
3502   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3503   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3504
3505   // Build the animation
3506   float     durationSeconds(2.0f);
3507   Animation animation = Animation::New(durationSeconds);
3508   bool      relativeValue(true);
3509   bool      finalValue(false || relativeValue);
3510   float     animatorDurationSeconds(durationSeconds * 0.5f);
3511   animation.AnimateBy(Property(actor, index),
3512                       relativeValue,
3513                       AlphaFunction::EASE_IN_OUT,
3514                       TimePeriod(animatorDurationSeconds));
3515
3516   // Start the animation
3517   animation.Play();
3518
3519   bool                 signalReceived(false);
3520   AnimationFinishCheck finishCheck(signalReceived);
3521   animation.FinishedSignal().Connect(&application, finishCheck);
3522
3523   application.SendNotification();
3524   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
3525
3526   // We didn't expect the animation to finish yet
3527   application.SendNotification();
3528   finishCheck.CheckSignalNotReceived();
3529   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3530
3531   application.SendNotification();
3532   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
3533
3534   // We didn't expect the animation to finish yet...
3535   application.SendNotification();
3536   finishCheck.CheckSignalNotReceived();
3537
3538   // ...however we should have reached the final value
3539   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3540
3541   application.SendNotification();
3542   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
3543
3544   // We did expect the animation to finish
3545   application.SendNotification();
3546   finishCheck.CheckSignalReceived();
3547   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3548
3549   // Check that nothing has changed after a couple of buffer swaps
3550   application.Render(0);
3551   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3552   application.Render(0);
3553   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3554   END_TEST;
3555 }
3556
3557 int UtcDaliAnimationAnimateByFloatP(void)
3558 {
3559   TestApplication application;
3560
3561   Actor actor = Actor::New();
3562
3563   // Register a float property
3564   float           startValue(10.0f);
3565   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3566   application.GetScene().Add(actor);
3567   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3568   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3569
3570   // Build the animation
3571   float     durationSeconds(2.0f);
3572   Animation animation = Animation::New(durationSeconds);
3573   float     targetValue(50.0f);
3574   float     relativeValue(targetValue - startValue);
3575   animation.AnimateBy(Property(actor, index), relativeValue);
3576
3577   float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
3578
3579   // Start the animation
3580   animation.Play();
3581
3582   // Target value should be retrievable straight away
3583   DALI_TEST_EQUALS(actor.GetProperty<float>(index), targetValue, TEST_LOCATION);
3584
3585   bool                 signalReceived(false);
3586   AnimationFinishCheck finishCheck(signalReceived);
3587   animation.FinishedSignal().Connect(&application, finishCheck);
3588
3589   application.SendNotification();
3590   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3591
3592   // We didn't expect the animation to finish yet
3593   application.SendNotification();
3594   finishCheck.CheckSignalNotReceived();
3595   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION);
3596
3597   application.SendNotification();
3598   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3599
3600   // We did expect the animation to finish
3601   application.SendNotification();
3602   finishCheck.CheckSignalReceived();
3603   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3604
3605   // Check that nothing has changed after a couple of buffer swaps
3606   application.Render(0);
3607   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3608   application.Render(0);
3609   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3610   END_TEST;
3611 }
3612
3613 int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void)
3614 {
3615   TestApplication application;
3616
3617   Actor actor = Actor::New();
3618
3619   // Register a float property
3620   float           startValue(10.0f);
3621   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3622   application.GetScene().Add(actor);
3623   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3624   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3625
3626   // Build the animation
3627   float     durationSeconds(1.0f);
3628   Animation animation = Animation::New(durationSeconds);
3629   float     targetValue(90.0f);
3630   float     relativeValue(targetValue - startValue);
3631   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3632
3633   float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
3634
3635   // Start the animation
3636   animation.Play();
3637
3638   bool                 signalReceived(false);
3639   AnimationFinishCheck finishCheck(signalReceived);
3640   animation.FinishedSignal().Connect(&application, finishCheck);
3641
3642   application.SendNotification();
3643   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3644
3645   // We didn't expect the animation to finish yet
3646   application.SendNotification();
3647   finishCheck.CheckSignalNotReceived();
3648
3649   // The position should have moved more, than with a linear alpha function
3650   float current(actor.GetCurrentProperty<float>(index));
3651   DALI_TEST_CHECK(current > ninetyFivePercentProgress);
3652
3653   application.SendNotification();
3654   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3655
3656   // We did expect the animation to finish
3657   application.SendNotification();
3658   finishCheck.CheckSignalReceived();
3659   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3660
3661   // Check that nothing has changed after a couple of buffer swaps
3662   application.Render(0);
3663   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3664   application.Render(0);
3665   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3666   END_TEST;
3667 }
3668
3669 int UtcDaliAnimationAnimateByFloatTimePeriodP(void)
3670 {
3671   TestApplication application;
3672
3673   Actor actor = Actor::New();
3674
3675   // Register a float property
3676   float           startValue(10.0f);
3677   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3678   application.GetScene().Add(actor);
3679   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3680   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3681
3682   // Build the animation
3683   float     durationSeconds(1.0f);
3684   Animation animation = Animation::New(durationSeconds);
3685   float     targetValue(30.0f);
3686   float     relativeValue(targetValue - startValue);
3687   float     delay = 0.5f;
3688   animation.AnimateBy(Property(actor, index),
3689                       relativeValue,
3690                       TimePeriod(delay, durationSeconds - delay));
3691
3692   // Start the animation
3693   animation.Play();
3694
3695   bool                 signalReceived(false);
3696   AnimationFinishCheck finishCheck(signalReceived);
3697   animation.FinishedSignal().Connect(&application, finishCheck);
3698
3699   application.SendNotification();
3700   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
3701
3702   // We didn't expect the animation to finish yet
3703   application.SendNotification();
3704   finishCheck.CheckSignalNotReceived();
3705   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3706
3707   application.SendNotification();
3708   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
3709
3710   // We didn't expect the animation to finish yet
3711   application.SendNotification();
3712   finishCheck.CheckSignalNotReceived();
3713   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
3714
3715   application.SendNotification();
3716   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
3717
3718   // We did expect the animation to finish
3719   application.SendNotification();
3720   finishCheck.CheckSignalReceived();
3721   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3722
3723   // Check that nothing has changed after a couple of buffer swaps
3724   application.Render(0);
3725   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3726   application.Render(0);
3727   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3728   END_TEST;
3729 }
3730
3731 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void)
3732 {
3733   TestApplication application;
3734
3735   Actor actor = Actor::New();
3736
3737   // Register a float property
3738   float           startValue(10.0f);
3739   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3740   application.GetScene().Add(actor);
3741   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3742   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3743
3744   // Build the animation
3745   float     durationSeconds(1.0f);
3746   Animation animation = Animation::New(durationSeconds);
3747   float     targetValue(30.0f);
3748   float     relativeValue(targetValue - startValue);
3749   float     delay = 0.5f;
3750   animation.AnimateBy(Property(actor, index),
3751                       relativeValue,
3752                       AlphaFunction::LINEAR,
3753                       TimePeriod(delay, durationSeconds - delay));
3754
3755   // Start the animation
3756   animation.Play();
3757
3758   bool                 signalReceived(false);
3759   AnimationFinishCheck finishCheck(signalReceived);
3760   animation.FinishedSignal().Connect(&application, finishCheck);
3761
3762   application.SendNotification();
3763   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
3764
3765   // We didn't expect the animation to finish yet
3766   application.SendNotification();
3767   finishCheck.CheckSignalNotReceived();
3768   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3769
3770   application.SendNotification();
3771   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
3772
3773   // We didn't expect the animation to finish yet
3774   application.SendNotification();
3775   finishCheck.CheckSignalNotReceived();
3776   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
3777
3778   application.SendNotification();
3779   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
3780
3781   // We did expect the animation to finish
3782   application.SendNotification();
3783   finishCheck.CheckSignalReceived();
3784   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3785
3786   // Check that nothing has changed after a couple of buffer swaps
3787   application.Render(0);
3788   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3789   application.Render(0);
3790   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3791   END_TEST;
3792 }
3793
3794 int UtcDaliAnimationAnimateByIntegerP(void)
3795 {
3796   TestApplication application;
3797
3798   Actor actor = Actor::New();
3799
3800   // Register an integer property
3801   int             startValue(1);
3802   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3803   application.GetScene().Add(actor);
3804   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
3805   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3806
3807   // Build the animation
3808   float     durationSeconds(2.0f);
3809   Animation animation = Animation::New(durationSeconds);
3810   int       targetValue(50);
3811   int       relativeValue(targetValue - startValue);
3812   animation.AnimateBy(Property(actor, index), relativeValue);
3813
3814   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
3815
3816   // Start the animation
3817   animation.Play();
3818
3819   // Target value should be retrievable straight away
3820   DALI_TEST_EQUALS(actor.GetProperty<int>(index), targetValue, TEST_LOCATION);
3821
3822   bool                 signalReceived(false);
3823   AnimationFinishCheck finishCheck(signalReceived);
3824   animation.FinishedSignal().Connect(&application, finishCheck);
3825
3826   application.SendNotification();
3827   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3828
3829   // We didn't expect the animation to finish yet
3830   application.SendNotification();
3831   finishCheck.CheckSignalNotReceived();
3832   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION);
3833
3834   application.SendNotification();
3835   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3836
3837   // We did expect the animation to finish
3838   application.SendNotification();
3839   finishCheck.CheckSignalReceived();
3840   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3841
3842   // Check that nothing has changed after a couple of buffer swaps
3843   application.Render(0);
3844   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3845   application.Render(0);
3846   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3847   END_TEST;
3848 }
3849
3850 int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void)
3851 {
3852   TestApplication application;
3853
3854   Actor actor = Actor::New();
3855
3856   // Register an integer property
3857   int             startValue(1);
3858   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3859   application.GetScene().Add(actor);
3860   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
3861   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3862
3863   // Build the animation
3864   float     durationSeconds(1.0f);
3865   Animation animation = Animation::New(durationSeconds);
3866   int       targetValue(90);
3867   int       relativeValue(targetValue - startValue);
3868   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3869
3870   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
3871
3872   // Start the animation
3873   animation.Play();
3874
3875   bool                 signalReceived(false);
3876   AnimationFinishCheck finishCheck(signalReceived);
3877   animation.FinishedSignal().Connect(&application, finishCheck);
3878
3879   application.SendNotification();
3880   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3881
3882   // We didn't expect the animation to finish yet
3883   application.SendNotification();
3884   finishCheck.CheckSignalNotReceived();
3885
3886   // The position should have moved more, than with a linear alpha function
3887   int current(actor.GetCurrentProperty<int>(index));
3888   DALI_TEST_CHECK(current > ninetyFivePercentProgress);
3889
3890   application.SendNotification();
3891   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3892
3893   // We did expect the animation to finish
3894   application.SendNotification();
3895   finishCheck.CheckSignalReceived();
3896   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3897
3898   // Check that nothing has changed after a couple of buffer swaps
3899   application.Render(0);
3900   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3901   application.Render(0);
3902   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3903   END_TEST;
3904 }
3905
3906 int UtcDaliAnimationAnimateByIntegerTimePeriodP(void)
3907 {
3908   TestApplication application;
3909
3910   Actor actor = Actor::New();
3911
3912   // Register an integer property
3913   int             startValue(10);
3914   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3915   application.GetScene().Add(actor);
3916   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
3917   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3918
3919   // Build the animation
3920   float     durationSeconds(1.0f);
3921   Animation animation = Animation::New(durationSeconds);
3922   int       targetValue(30);
3923   int       relativeValue(targetValue - startValue);
3924   float     delay = 0.5f;
3925   animation.AnimateBy(Property(actor, index),
3926                       relativeValue,
3927                       TimePeriod(delay, durationSeconds - delay));
3928
3929   // Start the animation
3930   animation.Play();
3931
3932   bool                 signalReceived(false);
3933   AnimationFinishCheck finishCheck(signalReceived);
3934   animation.FinishedSignal().Connect(&application, finishCheck);
3935
3936   application.SendNotification();
3937   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
3938
3939   // We didn't expect the animation to finish yet
3940   application.SendNotification();
3941   finishCheck.CheckSignalNotReceived();
3942   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3943
3944   application.SendNotification();
3945   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
3946
3947   // We didn't expect the animation to finish yet
3948   application.SendNotification();
3949   finishCheck.CheckSignalNotReceived();
3950   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
3951
3952   application.SendNotification();
3953   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
3954
3955   // We did expect the animation to finish
3956   application.SendNotification();
3957   finishCheck.CheckSignalReceived();
3958   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3959
3960   // Check that nothing has changed after a couple of buffer swaps
3961   application.Render(0);
3962   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3963   application.Render(0);
3964   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3965   END_TEST;
3966 }
3967
3968 int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void)
3969 {
3970   TestApplication application;
3971
3972   Actor actor = Actor::New();
3973
3974   // Register an integer property
3975   int             startValue(10);
3976   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3977   application.GetScene().Add(actor);
3978   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
3979   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3980
3981   // Build the animation
3982   float     durationSeconds(1.0f);
3983   Animation animation = Animation::New(durationSeconds);
3984   int       targetValue(30);
3985   int       relativeValue(targetValue - startValue);
3986   float     delay = 0.5f;
3987   animation.AnimateBy(Property(actor, index),
3988                       relativeValue,
3989                       AlphaFunction::LINEAR,
3990                       TimePeriod(delay, durationSeconds - delay));
3991
3992   // Start the animation
3993   animation.Play();
3994
3995   bool                 signalReceived(false);
3996   AnimationFinishCheck finishCheck(signalReceived);
3997   animation.FinishedSignal().Connect(&application, finishCheck);
3998
3999   application.SendNotification();
4000   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4001
4002   // We didn't expect the animation to finish yet
4003   application.SendNotification();
4004   finishCheck.CheckSignalNotReceived();
4005   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
4006
4007   application.SendNotification();
4008   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4009
4010   // We didn't expect the animation to finish yet
4011   application.SendNotification();
4012   finishCheck.CheckSignalNotReceived();
4013   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
4014
4015   application.SendNotification();
4016   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4017
4018   // We did expect the animation to finish
4019   application.SendNotification();
4020   finishCheck.CheckSignalReceived();
4021   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4022
4023   // Check that nothing has changed after a couple of buffer swaps
4024   application.Render(0);
4025   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4026   application.Render(0);
4027   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4028   END_TEST;
4029 }
4030
4031 int UtcDaliAnimationAnimateByQuaternionP(void)
4032 {
4033   TestApplication application;
4034
4035   Actor actor = Actor::New();
4036
4037   // Register a quaternion property
4038   const Quaternion startValue(Degree(90), Vector3::XAXIS);
4039   Property::Index  index = actor.RegisterProperty("testProperty", startValue);
4040   application.GetScene().Add(actor);
4041   DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == startValue);
4042   DALI_TEST_CHECK(actor.GetCurrentProperty<Quaternion>(index) == startValue);
4043
4044   // Build the animation
4045   float            durationSeconds(2.0f);
4046   Animation        animation = Animation::New(durationSeconds);
4047   const Quaternion relativeValue(Degree(90), Vector3::ZAXIS);
4048   const Quaternion finalValue(startValue * relativeValue);
4049   animation.AnimateBy(Property(actor, index), relativeValue);
4050
4051   DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == startValue);
4052   DALI_TEST_CHECK(actor.GetCurrentProperty<Quaternion>(index) == startValue);
4053
4054   // Start the animation
4055   animation.Play();
4056
4057   // Target value should be retrievable straight away
4058   DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == finalValue);
4059
4060   application.SendNotification();
4061   application.Render(2000); // animation complete
4062
4063   DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == finalValue);
4064   DALI_TEST_CHECK(actor.GetCurrentProperty<Quaternion>(index) == finalValue);
4065
4066   END_TEST;
4067 }
4068
4069 int UtcDaliAnimationAnimateByVector2P(void)
4070 {
4071   TestApplication application;
4072
4073   Actor actor = Actor::New();
4074
4075   // Register a Vector2 property
4076   Vector2         startValue(10.0f, 10.0f);
4077   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4078   application.GetScene().Add(actor);
4079   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4080   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4081
4082   // Build the animation
4083   float     durationSeconds(2.0f);
4084   Animation animation = Animation::New(durationSeconds);
4085   Vector2   targetValue(60.0f, 60.0f);
4086   Vector2   relativeValue(targetValue - startValue);
4087   animation.AnimateBy(Property(actor, index), relativeValue);
4088
4089   Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4090
4091   // Start the animation
4092   animation.Play();
4093
4094   // Target value should be retrievable straight away
4095   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION);
4096
4097   bool                 signalReceived(false);
4098   AnimationFinishCheck finishCheck(signalReceived);
4099   animation.FinishedSignal().Connect(&application, finishCheck);
4100
4101   application.SendNotification();
4102   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4103
4104   // We didn't expect the animation to finish yet
4105   application.SendNotification();
4106   finishCheck.CheckSignalNotReceived();
4107   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION);
4108
4109   application.SendNotification();
4110   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4111
4112   // We did expect the animation to finish
4113   application.SendNotification();
4114   finishCheck.CheckSignalReceived();
4115   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4116
4117   // Check that nothing has changed after a couple of buffer swaps
4118   application.Render(0);
4119   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4120   application.Render(0);
4121   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4122   END_TEST;
4123 }
4124
4125 int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void)
4126 {
4127   TestApplication application;
4128
4129   Actor actor = Actor::New();
4130
4131   // Register a Vector2 property
4132   Vector2         startValue(100.0f, 100.0f);
4133   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4134   application.GetScene().Add(actor);
4135   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4136   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4137
4138   // Build the animation
4139   float     durationSeconds(1.0f);
4140   Animation animation = Animation::New(durationSeconds);
4141   Vector2   targetValue(20.0f, 20.0f);
4142   Vector2   relativeValue(targetValue - startValue);
4143   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4144
4145   Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4146
4147   // Start the animation
4148   animation.Play();
4149
4150   bool                 signalReceived(false);
4151   AnimationFinishCheck finishCheck(signalReceived);
4152   animation.FinishedSignal().Connect(&application, finishCheck);
4153
4154   application.SendNotification();
4155   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4156
4157   // We didn't expect the animation to finish yet
4158   application.SendNotification();
4159   finishCheck.CheckSignalNotReceived();
4160
4161   // The position should have moved more, than with a linear alpha function
4162   Vector2 current(actor.GetCurrentProperty<Vector2>(index));
4163   DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x);
4164   DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y);
4165
4166   application.SendNotification();
4167   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4168
4169   // We did expect the animation to finish
4170   application.SendNotification();
4171   finishCheck.CheckSignalReceived();
4172   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4173
4174   // Check that nothing has changed after a couple of buffer swaps
4175   application.Render(0);
4176   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4177   application.Render(0);
4178   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4179   END_TEST;
4180 }
4181
4182 int UtcDaliAnimationAnimateByVector2TimePeriodP(void)
4183 {
4184   TestApplication application;
4185
4186   Actor actor = Actor::New();
4187
4188   // Register a Vector2 property
4189   Vector2         startValue(10.0f, 10.0f);
4190   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4191   application.GetScene().Add(actor);
4192   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4193   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4194
4195   // Build the animation
4196   float     durationSeconds(1.0f);
4197   Animation animation = Animation::New(durationSeconds);
4198   Vector2   targetValue(30.0f, 30.0f);
4199   Vector2   relativeValue(targetValue - startValue);
4200   float     delay = 0.5f;
4201   animation.AnimateBy(Property(actor, index),
4202                       relativeValue,
4203                       TimePeriod(delay, durationSeconds - delay));
4204
4205   // Start the animation
4206   animation.Play();
4207
4208   bool                 signalReceived(false);
4209   AnimationFinishCheck finishCheck(signalReceived);
4210   animation.FinishedSignal().Connect(&application, finishCheck);
4211
4212   application.SendNotification();
4213   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4214
4215   // We didn't expect the animation to finish yet
4216   application.SendNotification();
4217   finishCheck.CheckSignalNotReceived();
4218   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4219
4220   application.SendNotification();
4221   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4222
4223   // We didn't expect the animation to finish yet
4224   application.SendNotification();
4225   finishCheck.CheckSignalNotReceived();
4226   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4227
4228   application.SendNotification();
4229   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4230
4231   // We did expect the animation to finish
4232   application.SendNotification();
4233   finishCheck.CheckSignalReceived();
4234   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4235
4236   // Check that nothing has changed after a couple of buffer swaps
4237   application.Render(0);
4238   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4239   application.Render(0);
4240   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4241   END_TEST;
4242 }
4243
4244 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void)
4245 {
4246   TestApplication application;
4247
4248   Actor actor = Actor::New();
4249
4250   // Register a Vector2 property
4251   Vector2         startValue(5.0f, 5.0f);
4252   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4253   application.GetScene().Add(actor);
4254   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4255   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4256
4257   // Build the animation
4258   float     durationSeconds(1.0f);
4259   Animation animation = Animation::New(durationSeconds);
4260   Vector2   targetValue(10.0f, 10.0f);
4261   Vector2   relativeValue(targetValue - startValue);
4262   float     delay = 0.5f;
4263   animation.AnimateBy(Property(actor, index),
4264                       relativeValue,
4265                       AlphaFunction::LINEAR,
4266                       TimePeriod(delay, durationSeconds - delay));
4267
4268   // Start the animation
4269   animation.Play();
4270
4271   bool                 signalReceived(false);
4272   AnimationFinishCheck finishCheck(signalReceived);
4273   animation.FinishedSignal().Connect(&application, finishCheck);
4274
4275   application.SendNotification();
4276   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4277
4278   // We didn't expect the animation to finish yet
4279   application.SendNotification();
4280   finishCheck.CheckSignalNotReceived();
4281   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4282
4283   application.SendNotification();
4284   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4285
4286   // We didn't expect the animation to finish yet
4287   application.SendNotification();
4288   finishCheck.CheckSignalNotReceived();
4289   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4290
4291   application.SendNotification();
4292   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4293
4294   // We did expect the animation to finish
4295   application.SendNotification();
4296   finishCheck.CheckSignalReceived();
4297   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4298
4299   // Check that nothing has changed after a couple of buffer swaps
4300   application.Render(0);
4301   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4302   application.Render(0);
4303   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4304   END_TEST;
4305 }
4306
4307 int UtcDaliAnimationAnimateByVector3P(void)
4308 {
4309   TestApplication application;
4310
4311   Actor actor = Actor::New();
4312
4313   // Register a Vector3 property
4314   Vector3         startValue(10.0f, 10.0f, 10.0f);
4315   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4316   application.GetScene().Add(actor);
4317   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4318   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4319
4320   // Build the animation
4321   float     durationSeconds(2.0f);
4322   Animation animation = Animation::New(durationSeconds);
4323   Vector3   targetValue(60.0f, 60.0f, 60.0f);
4324   Vector3   relativeValue(targetValue - startValue);
4325   animation.AnimateBy(Property(actor, index), relativeValue);
4326
4327   Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4328
4329   // Start the animation
4330   animation.Play();
4331
4332   // Target value should be retrievable straight away
4333   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION);
4334
4335   bool                 signalReceived(false);
4336   AnimationFinishCheck finishCheck(signalReceived);
4337   animation.FinishedSignal().Connect(&application, finishCheck);
4338
4339   application.SendNotification();
4340   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4341
4342   // We didn't expect the animation to finish yet
4343   application.SendNotification();
4344   finishCheck.CheckSignalNotReceived();
4345   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION);
4346
4347   application.SendNotification();
4348   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4349
4350   // We did expect the animation to finish
4351   application.SendNotification();
4352   finishCheck.CheckSignalReceived();
4353   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4354
4355   // Check that nothing has changed after a couple of buffer swaps
4356   application.Render(0);
4357   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4358   application.Render(0);
4359   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4360   END_TEST;
4361 }
4362
4363 int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void)
4364 {
4365   TestApplication application;
4366
4367   Actor actor = Actor::New();
4368
4369   // Register a Vector3 property
4370   Vector3         startValue(100.0f, 100.0f, 100.0f);
4371   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4372   application.GetScene().Add(actor);
4373   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4374   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4375
4376   // Build the animation
4377   float     durationSeconds(1.0f);
4378   Animation animation = Animation::New(durationSeconds);
4379   Vector3   targetValue(20.0f, 20.0f, 20.0f);
4380   Vector3   relativeValue(targetValue - startValue);
4381   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4382
4383   Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4384
4385   // Start the animation
4386   animation.Play();
4387
4388   bool                 signalReceived(false);
4389   AnimationFinishCheck finishCheck(signalReceived);
4390   animation.FinishedSignal().Connect(&application, finishCheck);
4391
4392   application.SendNotification();
4393   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4394
4395   // We didn't expect the animation to finish yet
4396   application.SendNotification();
4397   finishCheck.CheckSignalNotReceived();
4398
4399   // The position should have moved more, than with a linear alpha function
4400   Vector3 current(actor.GetCurrentProperty<Vector3>(index));
4401   DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x);
4402   DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y);
4403   DALI_TEST_CHECK(current.z < ninetyFivePercentProgress.z);
4404
4405   application.SendNotification();
4406   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4407
4408   // We did expect the animation to finish
4409   application.SendNotification();
4410   finishCheck.CheckSignalReceived();
4411   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4412
4413   // Check that nothing has changed after a couple of buffer swaps
4414   application.Render(0);
4415   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4416   application.Render(0);
4417   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4418   END_TEST;
4419 }
4420
4421 int UtcDaliAnimationAnimateByVector3TimePeriodP(void)
4422 {
4423   TestApplication application;
4424
4425   Actor actor = Actor::New();
4426
4427   // Register a Vector3 property
4428   Vector3         startValue(10.0f, 10.0f, 10.0f);
4429   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4430   application.GetScene().Add(actor);
4431   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4432   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4433
4434   // Build the animation
4435   float     durationSeconds(1.0f);
4436   Animation animation = Animation::New(durationSeconds);
4437   Vector3   targetValue(30.0f, 30.0f, 30.0f);
4438   Vector3   relativeValue(targetValue - startValue);
4439   float     delay = 0.5f;
4440   animation.AnimateBy(Property(actor, index),
4441                       relativeValue,
4442                       TimePeriod(delay, durationSeconds - delay));
4443
4444   // Start the animation
4445   animation.Play();
4446
4447   bool                 signalReceived(false);
4448   AnimationFinishCheck finishCheck(signalReceived);
4449   animation.FinishedSignal().Connect(&application, finishCheck);
4450
4451   application.SendNotification();
4452   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4453
4454   // We didn't expect the animation to finish yet
4455   application.SendNotification();
4456   finishCheck.CheckSignalNotReceived();
4457   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4458
4459   application.SendNotification();
4460   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4461
4462   // We didn't expect the animation to finish yet
4463   application.SendNotification();
4464   finishCheck.CheckSignalNotReceived();
4465   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4466
4467   application.SendNotification();
4468   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4469
4470   // We did expect the animation to finish
4471   application.SendNotification();
4472   finishCheck.CheckSignalReceived();
4473   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4474
4475   // Check that nothing has changed after a couple of buffer swaps
4476   application.Render(0);
4477   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4478   application.Render(0);
4479   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4480   END_TEST;
4481 }
4482
4483 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void)
4484 {
4485   TestApplication application;
4486
4487   Actor actor = Actor::New();
4488
4489   // Register a Vector3 property
4490   Vector3         startValue(5.0f, 5.0f, 5.0f);
4491   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4492   application.GetScene().Add(actor);
4493   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4494   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4495
4496   // Build the animation
4497   float     durationSeconds(1.0f);
4498   Animation animation = Animation::New(durationSeconds);
4499   Vector3   targetValue(10.0f, 10.0f, 10.0f);
4500   Vector3   relativeValue(targetValue - startValue);
4501   float     delay = 0.5f;
4502   animation.AnimateBy(Property(actor, index),
4503                       relativeValue,
4504                       AlphaFunction::LINEAR,
4505                       TimePeriod(delay, durationSeconds - delay));
4506
4507   // Start the animation
4508   animation.Play();
4509
4510   bool                 signalReceived(false);
4511   AnimationFinishCheck finishCheck(signalReceived);
4512   animation.FinishedSignal().Connect(&application, finishCheck);
4513
4514   application.SendNotification();
4515   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4516
4517   // We didn't expect the animation to finish yet
4518   application.SendNotification();
4519   finishCheck.CheckSignalNotReceived();
4520   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4521
4522   application.SendNotification();
4523   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4524
4525   // We didn't expect the animation to finish yet
4526   application.SendNotification();
4527   finishCheck.CheckSignalNotReceived();
4528   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4529
4530   application.SendNotification();
4531   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4532
4533   // We did expect the animation to finish
4534   application.SendNotification();
4535   finishCheck.CheckSignalReceived();
4536   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4537
4538   // Check that nothing has changed after a couple of buffer swaps
4539   application.Render(0);
4540   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4541   application.Render(0);
4542   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4543   END_TEST;
4544 }
4545
4546 int UtcDaliAnimationAnimateByVector4P(void)
4547 {
4548   TestApplication application;
4549
4550   Actor actor = Actor::New();
4551
4552   // Register a Vector4 property
4553   Vector4         startValue(10.0f, 10.0f, 10.0f, 10.0f);
4554   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4555   application.GetScene().Add(actor);
4556   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4557   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4558
4559   // Build the animation
4560   float     durationSeconds(2.0f);
4561   Animation animation = Animation::New(durationSeconds);
4562   Vector4   targetValue(60.0f, 60.0f, 60.0f, 60.0f);
4563   Vector4   relativeValue(targetValue - startValue);
4564   animation.AnimateBy(Property(actor, index), relativeValue);
4565
4566   Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4567
4568   // Start the animation
4569   animation.Play();
4570
4571   // Target value should be retrievable straight away
4572   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION);
4573
4574   bool                 signalReceived(false);
4575   AnimationFinishCheck finishCheck(signalReceived);
4576   animation.FinishedSignal().Connect(&application, finishCheck);
4577
4578   application.SendNotification();
4579   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4580
4581   // We didn't expect the animation to finish yet
4582   application.SendNotification();
4583   finishCheck.CheckSignalNotReceived();
4584   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION);
4585
4586   application.SendNotification();
4587   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4588
4589   // We did expect the animation to finish
4590   application.SendNotification();
4591   finishCheck.CheckSignalReceived();
4592   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4593
4594   // Check that nothing has changed after a couple of buffer swaps
4595   application.Render(0);
4596   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4597   application.Render(0);
4598   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4599   END_TEST;
4600 }
4601
4602 int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void)
4603 {
4604   TestApplication application;
4605
4606   Actor actor = Actor::New();
4607
4608   // Register a Vector4 property
4609   Vector4         startValue(100.0f, 100.0f, 100.0f, 100.0f);
4610   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4611   application.GetScene().Add(actor);
4612   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4613   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4614
4615   // Build the animation
4616   float     durationSeconds(1.0f);
4617   Animation animation = Animation::New(durationSeconds);
4618   Vector4   targetValue(20.0f, 20.0f, 20.0f, 20.0f);
4619   Vector4   relativeValue(targetValue - startValue);
4620   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4621
4622   Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4623
4624   // Start the animation
4625   animation.Play();
4626
4627   bool                 signalReceived(false);
4628   AnimationFinishCheck finishCheck(signalReceived);
4629   animation.FinishedSignal().Connect(&application, finishCheck);
4630
4631   application.SendNotification();
4632   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4633
4634   // We didn't expect the animation to finish yet
4635   application.SendNotification();
4636   finishCheck.CheckSignalNotReceived();
4637
4638   // The position should have moved more, than with a linear alpha function
4639   Vector4 current(actor.GetCurrentProperty<Vector4>(index));
4640   DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x);
4641   DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y);
4642   DALI_TEST_CHECK(current.z < ninetyFivePercentProgress.z);
4643   DALI_TEST_CHECK(current.w < ninetyFivePercentProgress.w);
4644
4645   application.SendNotification();
4646   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4647
4648   // We did expect the animation to finish
4649   application.SendNotification();
4650   finishCheck.CheckSignalReceived();
4651   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4652
4653   // Check that nothing has changed after a couple of buffer swaps
4654   application.Render(0);
4655   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4656   application.Render(0);
4657   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4658   END_TEST;
4659 }
4660
4661 int UtcDaliAnimationAnimateByVector4TimePeriodP(void)
4662 {
4663   TestApplication application;
4664
4665   Actor actor = Actor::New();
4666
4667   // Register a Vector4 property
4668   Vector4         startValue(10.0f, 10.0f, 10.0f, 10.0f);
4669   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4670   application.GetScene().Add(actor);
4671   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4672   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4673
4674   // Build the animation
4675   float     durationSeconds(1.0f);
4676   Animation animation = Animation::New(durationSeconds);
4677   Vector4   targetValue(30.0f, 30.0f, 30.0f, 30.0f);
4678   Vector4   relativeValue(targetValue - startValue);
4679   float     delay = 0.5f;
4680   animation.AnimateBy(Property(actor, index),
4681                       relativeValue,
4682                       TimePeriod(delay, durationSeconds - delay));
4683
4684   // Start the animation
4685   animation.Play();
4686
4687   bool                 signalReceived(false);
4688   AnimationFinishCheck finishCheck(signalReceived);
4689   animation.FinishedSignal().Connect(&application, finishCheck);
4690
4691   application.SendNotification();
4692   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4693
4694   // We didn't expect the animation to finish yet
4695   application.SendNotification();
4696   finishCheck.CheckSignalNotReceived();
4697   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4698
4699   application.SendNotification();
4700   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4701
4702   // We didn't expect the animation to finish yet
4703   application.SendNotification();
4704   finishCheck.CheckSignalNotReceived();
4705   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4706
4707   application.SendNotification();
4708   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4709
4710   // We did expect the animation to finish
4711   application.SendNotification();
4712   finishCheck.CheckSignalReceived();
4713   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4714
4715   // Check that nothing has changed after a couple of buffer swaps
4716   application.Render(0);
4717   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4718   application.Render(0);
4719   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4720   END_TEST;
4721 }
4722
4723 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void)
4724 {
4725   TestApplication application;
4726
4727   Actor actor = Actor::New();
4728
4729   // Register a Vector4 property
4730   Vector4         startValue(5.0f, 5.0f, 5.0f, 5.0f);
4731   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4732   application.GetScene().Add(actor);
4733   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4734   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4735
4736   // Build the animation
4737   float     durationSeconds(1.0f);
4738   Animation animation = Animation::New(durationSeconds);
4739   Vector4   targetValue(10.0f, 10.0f, 10.0f, 10.0f);
4740   Vector4   relativeValue(targetValue - startValue);
4741   float     delay = 0.5f;
4742   animation.AnimateBy(Property(actor, index),
4743                       relativeValue,
4744                       AlphaFunction::LINEAR,
4745                       TimePeriod(delay, durationSeconds - delay));
4746
4747   // Start the animation
4748   animation.Play();
4749
4750   bool                 signalReceived(false);
4751   AnimationFinishCheck finishCheck(signalReceived);
4752   animation.FinishedSignal().Connect(&application, finishCheck);
4753
4754   application.SendNotification();
4755   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4756
4757   // We didn't expect the animation to finish yet
4758   application.SendNotification();
4759   finishCheck.CheckSignalNotReceived();
4760   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4761
4762   application.SendNotification();
4763   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4764
4765   // We didn't expect the animation to finish yet
4766   application.SendNotification();
4767   finishCheck.CheckSignalNotReceived();
4768   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4769
4770   application.SendNotification();
4771   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4772
4773   // We did expect the animation to finish
4774   application.SendNotification();
4775   finishCheck.CheckSignalReceived();
4776   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4777
4778   // Check that nothing has changed after a couple of buffer swaps
4779   application.Render(0);
4780   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4781   application.Render(0);
4782   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4783   END_TEST;
4784 }
4785
4786 int UtcDaliAnimationAnimateByActorPositionP(void)
4787 {
4788   TestApplication application;
4789
4790   Actor   actor = Actor::New();
4791   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4792   actor.SetProperty(Actor::Property::POSITION, startPosition);
4793   application.GetScene().Add(actor);
4794   application.SendNotification();
4795   application.Render(0);
4796   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4797
4798   // Build the animation
4799   float     durationSeconds(1.0f);
4800   Animation animation = Animation::New(durationSeconds);
4801   Vector3   targetPosition(20.0f, 20.0f, 20.0f);
4802   Vector3   relativePosition(targetPosition - startPosition);
4803   animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition);
4804
4805   Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
4806
4807   // Start the animation
4808   animation.Play();
4809
4810   // Target value should be retrievable straight away
4811   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4812
4813   bool                 signalReceived(false);
4814   AnimationFinishCheck finishCheck(signalReceived);
4815   animation.FinishedSignal().Connect(&application, finishCheck);
4816
4817   application.SendNotification();
4818   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4819
4820   // We didn't expect the animation to finish yet
4821   application.SendNotification();
4822   finishCheck.CheckSignalNotReceived();
4823   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), ninetyFivePercentProgress, TEST_LOCATION);
4824
4825   application.SendNotification();
4826   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4827
4828   // We did expect the animation to finish
4829   application.SendNotification();
4830   finishCheck.CheckSignalReceived();
4831   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4832
4833   // Check that nothing has changed after a couple of buffer swaps
4834   application.Render(0);
4835   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4836   application.Render(0);
4837   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4838   END_TEST;
4839 }
4840
4841 int UtcDaliAnimationAnimateByActorPositionComponentsP(void)
4842 {
4843   TestApplication application;
4844
4845   Actor actor = Actor::New();
4846   application.GetScene().Add(actor);
4847   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
4848
4849   // Build the animation
4850   float     durationSeconds(1.0f);
4851   Animation animation = Animation::New(durationSeconds);
4852   Vector3   targetPosition(200.0f, 300.0f, 400.0f);
4853   Vector3   relativePosition(targetPosition - Vector3::ZERO);
4854   animation.AnimateBy(Property(actor, Actor::Property::POSITION_X), relativePosition.x);
4855   animation.AnimateBy(Property(actor, Actor::Property::POSITION_Y), relativePosition.y);
4856   animation.AnimateBy(Property(actor, Actor::Property::POSITION_Z), relativePosition.z);
4857
4858   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
4859   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
4860
4861   // Start the animation
4862   animation.Play();
4863
4864   // Target value should be retrievable straight away
4865   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4866   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
4867   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
4868   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
4869
4870   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); // Not changed yet
4871
4872   application.SendNotification();
4873   application.Render(1000); // 1 second progress
4874
4875   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4876
4877   END_TEST;
4878 }
4879
4880 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
4881 {
4882   TestApplication application;
4883
4884   Actor   actor = Actor::New();
4885   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4886   actor.SetProperty(Actor::Property::POSITION, startPosition);
4887   application.GetScene().Add(actor);
4888   application.SendNotification();
4889   application.Render(0);
4890   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4891
4892   // Build the animation
4893   float     durationSeconds(1.0f);
4894   Animation animation = Animation::New(durationSeconds);
4895   Vector3   targetPosition(20.0f, 20.0f, 20.0f);
4896   Vector3   relativePosition(targetPosition - startPosition);
4897   animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
4898
4899   Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
4900
4901   // Start the animation
4902   animation.Play();
4903
4904   bool                 signalReceived(false);
4905   AnimationFinishCheck finishCheck(signalReceived);
4906   animation.FinishedSignal().Connect(&application, finishCheck);
4907
4908   application.SendNotification();
4909   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4910
4911   // We didn't expect the animation to finish yet
4912   application.SendNotification();
4913   finishCheck.CheckSignalNotReceived();
4914
4915   // The position should have moved more, than with a linear alpha function
4916   Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
4917   DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
4918   DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
4919   DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z);
4920
4921   application.SendNotification();
4922   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4923
4924   // We did expect the animation to finish
4925   application.SendNotification();
4926   finishCheck.CheckSignalReceived();
4927   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4928
4929   // Check that nothing has changed after a couple of buffer swaps
4930   application.Render(0);
4931   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4932   application.Render(0);
4933   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4934   END_TEST;
4935 }
4936
4937 int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void)
4938 {
4939   TestApplication application;
4940
4941   Actor   actor = Actor::New();
4942   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4943   actor.SetProperty(Actor::Property::POSITION, startPosition);
4944   application.GetScene().Add(actor);
4945   application.SendNotification();
4946   application.Render(0);
4947   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4948
4949   // Build the animation
4950   float     durationSeconds(1.0f);
4951   Animation animation = Animation::New(durationSeconds);
4952   Vector3   targetPosition(20.0f, 20.0f, 20.0f);
4953   Vector3   relativePosition(targetPosition - startPosition);
4954   float     delay = 0.5f;
4955   animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4956                       relativePosition,
4957                       TimePeriod(delay, durationSeconds - delay));
4958
4959   Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
4960
4961   // Start the animation
4962   animation.Play();
4963
4964   bool                 signalReceived(false);
4965   AnimationFinishCheck finishCheck(signalReceived);
4966   animation.FinishedSignal().Connect(&application, finishCheck);
4967
4968   application.SendNotification();
4969   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4970
4971   // We didn't expect the animation to finish yet
4972   application.SendNotification();
4973   finishCheck.CheckSignalNotReceived();
4974   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4975
4976   application.SendNotification();
4977   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
4978
4979   // We did expect the animation to finish
4980   application.SendNotification();
4981   finishCheck.CheckSignalReceived();
4982   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4983
4984   // Check that nothing has changed after a couple of buffer swaps
4985   application.Render(0);
4986   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4987   application.Render(0);
4988   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4989   END_TEST;
4990 }
4991
4992 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void)
4993 {
4994   TestApplication application;
4995
4996   Actor   actor = Actor::New();
4997   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4998   actor.SetProperty(Actor::Property::POSITION, startPosition);
4999   application.GetScene().Add(actor);
5000   application.SendNotification();
5001   application.Render(0);
5002   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
5003
5004   // Build the animation
5005   float     durationSeconds(1.0f);
5006   Animation animation = Animation::New(durationSeconds);
5007   Vector3   targetPosition(20.0f, 20.0f, 20.0f);
5008   Vector3   relativePosition(targetPosition - startPosition);
5009   float     delay = 0.5f;
5010   animation.AnimateBy(Property(actor, Actor::Property::POSITION),
5011                       relativePosition,
5012                       AlphaFunction::LINEAR,
5013                       TimePeriod(delay, durationSeconds - delay));
5014
5015   Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
5016
5017   // Start the animation
5018   animation.Play();
5019
5020   bool                 signalReceived(false);
5021   AnimationFinishCheck finishCheck(signalReceived);
5022   animation.FinishedSignal().Connect(&application, finishCheck);
5023
5024   application.SendNotification();
5025   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
5026
5027   // We didn't expect the animation to finish yet
5028   application.SendNotification();
5029   finishCheck.CheckSignalNotReceived();
5030   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
5031
5032   application.SendNotification();
5033   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
5034
5035   // We did expect the animation to finish
5036   application.SendNotification();
5037   finishCheck.CheckSignalReceived();
5038   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5039
5040   // Check that nothing has changed after a couple of buffer swaps
5041   application.Render(0);
5042   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5043   application.Render(0);
5044   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5045   END_TEST;
5046 }
5047
5048 int UtcDaliAnimationAnimateByActorOrientationP1(void)
5049 {
5050   TestApplication application;
5051
5052   Actor actor = Actor::New();
5053   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
5054   application.GetScene().Add(actor);
5055   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5056
5057   // Build the animation
5058   float     durationSeconds(1.0f);
5059   Animation animation = Animation::New(durationSeconds);
5060   Degree    relativeRotationDegrees(360.0f);
5061   Radian    relativeRotationRadians(relativeRotationDegrees);
5062   animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS));
5063
5064   // Start the animation
5065   animation.Play();
5066
5067   // Target value should be retrievable straight away
5068   DALI_TEST_EQUALS(actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), TEST_LOCATION);
5069
5070   bool                 signalReceived(false);
5071   AnimationFinishCheck finishCheck(signalReceived);
5072   animation.FinishedSignal().Connect(&application, finishCheck);
5073
5074   application.SendNotification();
5075   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5076
5077   // We didn't expect the animation to finish yet
5078   application.SendNotification();
5079   finishCheck.CheckSignalNotReceived();
5080   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5081
5082   application.SendNotification();
5083   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5084
5085   // We didn't expect the animation to finish yet
5086   application.SendNotification();
5087   finishCheck.CheckSignalNotReceived();
5088   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5089
5090   application.SendNotification();
5091   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5092
5093   // We didn't expect the animation to finish yet
5094   application.SendNotification();
5095   finishCheck.CheckSignalNotReceived();
5096   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5097
5098   application.SendNotification();
5099   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5100
5101   // We did expect the animation to finish
5102   application.SendNotification();
5103   finishCheck.CheckSignalReceived();
5104   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5105   END_TEST;
5106 }
5107
5108 int UtcDaliAnimationAnimateByActorOrientationP2(void)
5109 {
5110   TestApplication application;
5111
5112   tet_printf("Testing that rotation angle > 360 performs full rotations\n");
5113
5114   Actor actor = Actor::New();
5115   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::ZAXIS));
5116   application.GetScene().Add(actor);
5117   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5118
5119   // Build the animation
5120   float     durationSeconds(1.0f);
5121   Animation animation = Animation::New(durationSeconds);
5122   Degree    relativeRotationDegrees(710.0f);
5123   Radian    relativeRotationRadians(relativeRotationDegrees);
5124
5125   animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), AngleAxis(relativeRotationRadians, Vector3::ZAXIS));
5126
5127   // Start the animation
5128   animation.Play();
5129
5130   bool                 signalReceived(false);
5131   AnimationFinishCheck finishCheck(signalReceived);
5132   animation.FinishedSignal().Connect(&application, finishCheck);
5133
5134   application.SendNotification();
5135   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5136
5137   // We didn't expect the animation to finish yet
5138   application.SendNotification();
5139   finishCheck.CheckSignalNotReceived();
5140   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5141
5142   application.SendNotification();
5143   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5144
5145   // We didn't expect the animation to finish yet
5146   application.SendNotification();
5147   finishCheck.CheckSignalNotReceived();
5148   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5149
5150   application.SendNotification();
5151   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5152
5153   // We didn't expect the animation to finish yet
5154   application.SendNotification();
5155   finishCheck.CheckSignalNotReceived();
5156   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5157
5158   application.SendNotification();
5159   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5160
5161   // We did expect the animation to finish
5162   application.SendNotification();
5163   finishCheck.CheckSignalReceived();
5164   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5165   END_TEST;
5166 }
5167
5168 int UtcDaliAnimationAnimateByActorOrientationP3(void)
5169 {
5170   TestApplication application;
5171
5172   tet_printf("Testing that rotation angle > 360 performs partial rotations when cast to Quaternion\n");
5173
5174   Actor actor = Actor::New();
5175   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::ZAXIS));
5176   application.GetScene().Add(actor);
5177   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5178
5179   // Build the animation
5180   float     durationSeconds(1.0f);
5181   Animation animation = Animation::New(durationSeconds);
5182   Degree    relativeRotationDegrees(730.0f);
5183   Radian    relativeRotationRadians(relativeRotationDegrees);
5184
5185   Radian actualRotationRadians(Degree(10.0f));
5186
5187   animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS));
5188
5189   // Start the animation
5190   animation.Play();
5191
5192   bool                 signalReceived(false);
5193   AnimationFinishCheck finishCheck(signalReceived);
5194   animation.FinishedSignal().Connect(&application, finishCheck);
5195
5196   application.SendNotification();
5197   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5198
5199   // We didn't expect the animation to finish yet
5200   application.SendNotification();
5201   finishCheck.CheckSignalNotReceived();
5202   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5203
5204   application.SendNotification();
5205   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5206
5207   // We didn't expect the animation to finish yet
5208   application.SendNotification();
5209   finishCheck.CheckSignalNotReceived();
5210   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5211
5212   application.SendNotification();
5213   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5214
5215   // We didn't expect the animation to finish yet
5216   application.SendNotification();
5217   finishCheck.CheckSignalNotReceived();
5218   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5219
5220   application.SendNotification();
5221   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5222
5223   // We did expect the animation to finish
5224   application.SendNotification();
5225   finishCheck.CheckSignalReceived();
5226   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5227   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5228   END_TEST;
5229 }
5230
5231 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
5232 {
5233   TestApplication application;
5234
5235   Actor actor = Actor::New();
5236   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
5237   application.GetScene().Add(actor);
5238   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5239
5240   // Build the animation
5241   float     durationSeconds(1.0f);
5242   Animation animation = Animation::New(durationSeconds);
5243   Degree    relativeRotationDegrees(360.0f);
5244   Radian    relativeRotationRadians(relativeRotationDegrees);
5245   animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), AlphaFunction::EASE_IN);
5246
5247   // Start the animation
5248   animation.Play();
5249
5250   bool                 signalReceived(false);
5251   AnimationFinishCheck finishCheck(signalReceived);
5252   animation.FinishedSignal().Connect(&application, finishCheck);
5253
5254   application.SendNotification();
5255   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5256
5257   // We didn't expect the animation to finish yet
5258   application.SendNotification();
5259   finishCheck.CheckSignalNotReceived();
5260   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f * 0.25f * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5261
5262   application.SendNotification();
5263   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5264
5265   // We didn't expect the animation to finish yet
5266   application.SendNotification();
5267   finishCheck.CheckSignalNotReceived();
5268   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f * 0.5f * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5269
5270   application.SendNotification();
5271   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5272
5273   // We didn't expect the animation to finish yet
5274   application.SendNotification();
5275   finishCheck.CheckSignalNotReceived();
5276   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f * 0.75f * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5277
5278   application.SendNotification();
5279   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5280
5281   // We did expect the animation to finish
5282   application.SendNotification();
5283   finishCheck.CheckSignalReceived();
5284   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5285   END_TEST;
5286 }
5287
5288 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void)
5289 {
5290   TestApplication application;
5291
5292   Actor actor = Actor::New();
5293   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
5294   application.GetScene().Add(actor);
5295   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5296
5297   // Build the animation
5298   float     durationSeconds(1.0f);
5299   Animation animation = Animation::New(durationSeconds);
5300   Degree    relativeRotationDegrees(360.0f);
5301   Radian    relativeRotationRadians(relativeRotationDegrees);
5302   float     delay = 0.3f;
5303   animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
5304
5305   // Start the animation
5306   animation.Play();
5307
5308   bool                 signalReceived(false);
5309   AnimationFinishCheck finishCheck(signalReceived);
5310   animation.FinishedSignal().Connect(&application, finishCheck);
5311
5312   application.SendNotification();
5313   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5314
5315   // We didn't expect the animation to finish yet
5316   application.SendNotification();
5317   finishCheck.CheckSignalNotReceived();
5318   float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
5319   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5320
5321   application.SendNotification();
5322   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5323
5324   // We didn't expect the animation to finish yet
5325   application.SendNotification();
5326   finishCheck.CheckSignalNotReceived();
5327   progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
5328   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5329
5330   application.SendNotification();
5331   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5332
5333   // We didn't expect the animation to finish yet
5334   application.SendNotification();
5335   finishCheck.CheckSignalNotReceived();
5336   progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
5337   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5338
5339   application.SendNotification();
5340   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5341
5342   // We did expect the animation to finish
5343   application.SendNotification();
5344   finishCheck.CheckSignalReceived();
5345   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5346   END_TEST;
5347 }
5348
5349 int UtcDaliAnimationAnimateByActorScaleP(void)
5350 {
5351   TestApplication application;
5352
5353   Actor actor = Actor::New();
5354   application.GetScene().Add(actor);
5355   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5356
5357   // Build the animation
5358   float     durationSeconds(1.0f);
5359   Animation animation = Animation::New(durationSeconds);
5360   Vector3   targetScale(2.0f, 2.0f, 2.0f);
5361   Vector3   relativeScale(targetScale - Vector3::ONE);
5362   animation.AnimateBy(Property(actor, Actor::Property::SCALE), Vector3(relativeScale.x, relativeScale.y, relativeScale.z));
5363
5364   Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale * 0.99f);
5365
5366   // Start the animation
5367   animation.Play();
5368
5369   // Target value should be retrievable straight away
5370   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5371
5372   bool                 signalReceived(false);
5373   AnimationFinishCheck finishCheck(signalReceived);
5374   animation.FinishedSignal().Connect(&application, finishCheck);
5375
5376   application.SendNotification();
5377   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
5378
5379   // We didn't expect the animation to finish yet
5380   application.SendNotification();
5381   finishCheck.CheckSignalNotReceived();
5382   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), ninetyNinePercentProgress, TEST_LOCATION);
5383
5384   application.SendNotification();
5385   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
5386
5387   // We did expect the animation to finish
5388   application.SendNotification();
5389   finishCheck.CheckSignalReceived();
5390   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5391
5392   // Reset everything
5393   finishCheck.Reset();
5394   actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
5395   application.SendNotification();
5396   application.Render(0);
5397   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5398
5399   // Repeat with a different (ease-in) alpha function
5400   animation = Animation::New(durationSeconds);
5401   animation.AnimateBy(Property(actor, Actor::Property::SCALE), relativeScale, AlphaFunction::EASE_IN);
5402   animation.FinishedSignal().Connect(&application, finishCheck);
5403   animation.Play();
5404
5405   application.SendNotification();
5406   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
5407
5408   // We didn't expect the animation to finish yet
5409   application.SendNotification();
5410   finishCheck.CheckSignalNotReceived();
5411
5412   // The scale should have grown less, than with a linear alpha function
5413   Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
5414   DALI_TEST_CHECK(current.x > 1.0f);
5415   DALI_TEST_CHECK(current.y > 1.0f);
5416   DALI_TEST_CHECK(current.z > 1.0f);
5417   DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
5418   DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
5419   DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z);
5420
5421   application.SendNotification();
5422   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
5423
5424   // We did expect the animation to finish
5425   application.SendNotification();
5426   finishCheck.CheckSignalReceived();
5427   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5428
5429   // Reset everything
5430   finishCheck.Reset();
5431   actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
5432   application.SendNotification();
5433   application.Render(0);
5434   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5435
5436   // Repeat with a delay
5437   float delay = 0.5f;
5438   animation   = Animation::New(durationSeconds);
5439   animation.AnimateBy(Property(actor, Actor::Property::SCALE), relativeScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
5440   animation.FinishedSignal().Connect(&application, finishCheck);
5441   animation.Play();
5442
5443   application.SendNotification();
5444   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
5445
5446   // We didn't expect the animation to finish yet
5447   application.SendNotification();
5448   finishCheck.CheckSignalNotReceived();
5449   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5450
5451   application.SendNotification();
5452   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
5453
5454   // We did expect the animation to finish
5455   application.SendNotification();
5456   finishCheck.CheckSignalReceived();
5457   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5458   END_TEST;
5459 }
5460
5461 int UtcDaliAnimationAnimateByActorScaleComponentsP(void)
5462 {
5463   TestApplication application;
5464
5465   Actor actor = Actor::New();
5466   application.GetScene().Add(actor);
5467   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5468
5469   // Build the animation
5470   float     durationSeconds(1.0f);
5471   Animation animation = Animation::New(durationSeconds);
5472   Vector3   targetScale(2.0f, 3.0f, 4.0f);
5473   Vector3   relativeScale(targetScale - Vector3::ONE);
5474   animation.AnimateBy(Property(actor, Actor::Property::SCALE_X), relativeScale.x);
5475   animation.AnimateBy(Property(actor, Actor::Property::SCALE_Y), relativeScale.y);
5476   animation.AnimateBy(Property(actor, Actor::Property::SCALE_Z), relativeScale.z);
5477
5478   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5479   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5480
5481   // Start the animation
5482   animation.Play();
5483
5484   // Target value should be retrievable straight away
5485   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5486   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), targetScale.x, TEST_LOCATION);
5487   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), targetScale.y, TEST_LOCATION);
5488   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), targetScale.z, TEST_LOCATION);
5489
5490   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION); // Not changed yet
5491
5492   application.SendNotification();
5493   application.Render(1000); // 1 second progress
5494
5495   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5496
5497   END_TEST;
5498 }
5499
5500 int UtcDaliAnimationAnimateByActorColorP(void)
5501 {
5502   TestApplication application;
5503
5504   Actor actor = Actor::New();
5505   application.GetScene().Add(actor);
5506   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5507
5508   // Build the animation
5509   float     durationSeconds(1.0f);
5510   Animation animation = Animation::New(durationSeconds);
5511   Vector4   targetColor(0.5f, 0.75f, 0.8f, 0.1f);
5512   Vector4   relativeColor(targetColor - Color::WHITE);
5513   animation.AnimateBy(Property(actor, Actor::Property::COLOR), relativeColor);
5514
5515   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5516   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5517
5518   // Start the animation
5519   animation.Play();
5520
5521   // Target value should be retrievable straight away
5522   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5523   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION);
5524   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION);
5525   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION);
5526   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION);
5527
5528   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); // Not changed yet
5529
5530   application.SendNotification();
5531   application.Render(1000); // 1 second progress
5532
5533   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5534
5535   END_TEST;
5536 }
5537
5538 int UtcDaliAnimationAnimateByActorColorComponentsP(void)
5539 {
5540   TestApplication application;
5541
5542   Actor actor = Actor::New();
5543   application.GetScene().Add(actor);
5544   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5545
5546   // Build the animation
5547   float     durationSeconds(1.0f);
5548   Animation animation = Animation::New(durationSeconds);
5549   Vector4   targetColor(0.5f, 0.75f, 0.8f, 0.1f);
5550   Vector4   relativeColor(targetColor - Color::WHITE);
5551   animation.AnimateBy(Property(actor, Actor::Property::COLOR_RED), relativeColor.r);
5552   animation.AnimateBy(Property(actor, Actor::Property::COLOR_GREEN), relativeColor.g);
5553   animation.AnimateBy(Property(actor, Actor::Property::COLOR_BLUE), relativeColor.b);
5554   animation.AnimateBy(Property(actor, Actor::Property::COLOR_ALPHA), relativeColor.a);
5555
5556   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5557   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5558
5559   // Start the animation
5560   animation.Play();
5561
5562   // Target value should be retrievable straight away
5563   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5564   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION);
5565   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION);
5566   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION);
5567   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION);
5568
5569   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); // Not changed yet
5570
5571   application.SendNotification();
5572   application.Render(1000); // 1 second progress
5573
5574   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5575
5576   END_TEST;
5577 }
5578
5579 int UtcDaliAnimationAnimateByActorSizeP(void)
5580 {
5581   TestApplication application;
5582
5583   Actor actor = Actor::New();
5584   application.GetScene().Add(actor);
5585   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5586
5587   // Build the animation
5588   float     durationSeconds(1.0f);
5589   Animation animation = Animation::New(durationSeconds);
5590   Vector3   targetSize(100.0f, 200.0f, 300.0f);
5591   Vector3   relativeSize(targetSize - Vector3::ZERO);
5592   animation.AnimateBy(Property(actor, Actor::Property::SIZE), relativeSize);
5593
5594   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5595   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5596
5597   // Start the animation
5598   animation.Play();
5599
5600   // Target value should be retrievable straight away
5601   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5602   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION);
5603   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION);
5604   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION);
5605
5606   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Not changed yet
5607
5608   application.SendNotification();
5609   application.Render(1000); // 1 second progress
5610
5611   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5612
5613   END_TEST;
5614 }
5615
5616 int UtcDaliAnimationAnimateByActorSizeComponentsP(void)
5617 {
5618   TestApplication application;
5619
5620   Actor actor = Actor::New();
5621   application.GetScene().Add(actor);
5622   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5623
5624   // Build the animation
5625   float     durationSeconds(1.0f);
5626   Animation animation = Animation::New(durationSeconds);
5627   Vector3   targetSize(100.0f, 200.0f, 300.0f);
5628   Vector3   relativeSize(targetSize - Vector3::ZERO);
5629   animation.AnimateBy(Property(actor, Actor::Property::SIZE_WIDTH), relativeSize.width);
5630   animation.AnimateBy(Property(actor, Actor::Property::SIZE_HEIGHT), relativeSize.height);
5631   animation.AnimateBy(Property(actor, Actor::Property::SIZE_DEPTH), relativeSize.depth);
5632
5633   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5634   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5635
5636   // Start the animation
5637   animation.Play();
5638
5639   // Target value should be retrievable straight away
5640   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5641   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION);
5642   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION);
5643   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION);
5644
5645   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Not changed yet
5646
5647   application.SendNotification();
5648   application.Render(1000); // 1 second progress
5649
5650   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5651
5652   END_TEST;
5653 }
5654
5655 int UtcDaliAnimationAnimateByActorVisibilityP(void)
5656 {
5657   TestApplication application;
5658
5659   Actor actor = Actor::New();
5660   application.GetScene().Add(actor);
5661   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
5662
5663   actor.SetProperty(Actor::Property::VISIBLE, false);
5664
5665   application.SendNotification();
5666   application.Render();
5667
5668   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
5669
5670   // Build the animation
5671   float     durationSeconds(1.0f);
5672   Animation animation = Animation::New(durationSeconds);
5673   bool      targetVisibility(true);
5674   bool      relativeVisibility(targetVisibility);
5675   animation.AnimateBy(Property(actor, Actor::Property::VISIBLE), relativeVisibility);
5676
5677   DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
5678
5679   // Start the animation
5680   animation.Play();
5681
5682   // Target value should be retrievable straight away
5683   DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), targetVisibility, TEST_LOCATION);
5684   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION); // Not changed yet
5685
5686   application.SendNotification();
5687   application.Render(1000); // 1 second progress
5688
5689   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
5690
5691   END_TEST;
5692 }
5693
5694 int UtcDaliAnimationAnimateToBooleanP(void)
5695 {
5696   TestApplication application;
5697
5698   Actor actor = Actor::New();
5699
5700   // Register a boolean property
5701   const bool      startValue(false);
5702   Property::Index index = actor.RegisterProperty("testProperty", startValue);
5703   application.GetScene().Add(actor);
5704   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5705   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5706
5707   // Build the animation
5708   float      durationSeconds(2.0f);
5709   Animation  animation = Animation::New(durationSeconds);
5710   const bool targetValue(!startValue);
5711   animation.AnimateTo(Property(actor, index), targetValue);
5712
5713   // Start the animation
5714   animation.Play();
5715
5716   bool                 signalReceived(false);
5717   AnimationFinishCheck finishCheck(signalReceived);
5718   animation.FinishedSignal().Connect(&application, finishCheck);
5719
5720   application.SendNotification();
5721   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5722
5723   // We didn't expect the animation to finish yet
5724   application.SendNotification();
5725   finishCheck.CheckSignalNotReceived();
5726   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5727
5728   application.SendNotification();
5729   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5730
5731   // We did expect the animation to finish
5732   application.SendNotification();
5733   finishCheck.CheckSignalReceived();
5734   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5735
5736   // Check that nothing has changed after a couple of buffer swaps
5737   application.Render(0);
5738   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5739   application.Render(0);
5740   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5741
5742   // Repeat with target value "false"
5743   animation = Animation::New(durationSeconds);
5744   const bool finalValue(!targetValue);
5745   animation.AnimateTo(Property(actor, index), finalValue);
5746
5747   // Start the animation
5748   animation.Play();
5749
5750   finishCheck.Reset();
5751   animation.FinishedSignal().Connect(&application, finishCheck);
5752
5753   application.SendNotification();
5754   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5755
5756   // We didn't expect the animation to finish yet
5757   application.SendNotification();
5758   finishCheck.CheckSignalNotReceived();
5759   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5760
5761   application.SendNotification();
5762   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5763
5764   // We did expect the animation to finish
5765   application.SendNotification();
5766   finishCheck.CheckSignalReceived();
5767   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5768
5769   // Check that nothing has changed after a couple of buffer swaps
5770   application.Render(0);
5771   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5772   application.Render(0);
5773   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5774   END_TEST;
5775 }
5776
5777 int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void)
5778 {
5779   TestApplication application;
5780
5781   Actor actor = Actor::New();
5782
5783   // Register a boolean property
5784   const bool      startValue(false);
5785   Property::Index index = actor.RegisterProperty("testProperty", startValue);
5786   application.GetScene().Add(actor);
5787   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5788   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5789
5790   // Build the animation
5791   float      durationSeconds(2.0f);
5792   Animation  animation = Animation::New(durationSeconds);
5793   const bool targetValue(!startValue);
5794   animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
5795
5796   // Start the animation
5797   animation.Play();
5798
5799   bool                 signalReceived(false);
5800   AnimationFinishCheck finishCheck(signalReceived);
5801   animation.FinishedSignal().Connect(&application, finishCheck);
5802
5803   application.SendNotification();
5804   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5805
5806   // We didn't expect the animation to finish yet
5807   application.SendNotification();
5808   finishCheck.CheckSignalNotReceived();
5809   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5810
5811   application.SendNotification();
5812   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5813
5814   // We did expect the animation to finish
5815   application.SendNotification();
5816   finishCheck.CheckSignalReceived();
5817   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5818
5819   // Check that nothing has changed after a couple of buffer swaps
5820   application.Render(0);
5821   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5822   application.Render(0);
5823   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5824
5825   // Repeat with target value "false"
5826   animation = Animation::New(durationSeconds);
5827   const bool finalValue(!targetValue);
5828   animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
5829
5830   // Start the animation
5831   animation.Play();
5832
5833   finishCheck.Reset();
5834   animation.FinishedSignal().Connect(&application, finishCheck);
5835
5836   application.SendNotification();
5837   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5838
5839   // We didn't expect the animation to finish yet
5840   application.SendNotification();
5841   finishCheck.CheckSignalNotReceived();
5842   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5843
5844   application.SendNotification();
5845   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5846
5847   // We did expect the animation to finish
5848   application.SendNotification();
5849   finishCheck.CheckSignalReceived();
5850   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5851
5852   // Check that nothing has changed after a couple of buffer swaps
5853   application.Render(0);
5854   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5855   application.Render(0);
5856   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5857   END_TEST;
5858 }
5859
5860 int UtcDaliAnimationAnimateToBooleanTimePeriodP(void)
5861 {
5862   TestApplication application;
5863
5864   Actor actor = Actor::New();
5865
5866   // Register a boolean property
5867   bool            startValue(false);
5868   Property::Index index = actor.RegisterProperty("testProperty", startValue);
5869   application.GetScene().Add(actor);
5870   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5871   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5872
5873   // Build the animation
5874   float     durationSeconds(2.0f);
5875   Animation animation = Animation::New(durationSeconds);
5876   bool      finalValue(!startValue);
5877   float     animatorDurationSeconds(durationSeconds * 0.5f);
5878   animation.AnimateTo(Property(actor, index),
5879                       finalValue,
5880                       TimePeriod(animatorDurationSeconds));
5881
5882   // Start the animation
5883   animation.Play();
5884
5885   bool                 signalReceived(false);
5886   AnimationFinishCheck finishCheck(signalReceived);
5887   animation.FinishedSignal().Connect(&application, finishCheck);
5888
5889   application.SendNotification();
5890   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
5891
5892   // We didn't expect the animation to finish yet
5893   application.SendNotification();
5894   finishCheck.CheckSignalNotReceived();
5895   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5896
5897   application.SendNotification();
5898   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
5899
5900   // We didn't expect the animation to finish yet...
5901   application.SendNotification();
5902   finishCheck.CheckSignalNotReceived();
5903
5904   // ...however we should have reached the final value
5905   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5906
5907   application.SendNotification();
5908   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
5909
5910   // We did expect the animation to finish
5911   application.SendNotification();
5912   finishCheck.CheckSignalReceived();
5913   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5914
5915   // Check that nothing has changed after a couple of buffer swaps
5916   application.Render(0);
5917   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5918   application.Render(0);
5919   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5920   END_TEST;
5921 }
5922
5923 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void)
5924 {
5925   TestApplication application;
5926
5927   Actor actor = Actor::New();
5928
5929   // Register a boolean property
5930   bool            startValue(false);
5931   Property::Index index = actor.RegisterProperty("testProperty", startValue);
5932   application.GetScene().Add(actor);
5933   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5934   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5935
5936   // Build the animation
5937   float     durationSeconds(2.0f);
5938   Animation animation = Animation::New(durationSeconds);
5939   bool      finalValue(!startValue);
5940   float     animatorDurationSeconds(durationSeconds * 0.5f);
5941   animation.AnimateTo(Property(actor, index),
5942                       finalValue,
5943                       AlphaFunction::LINEAR,
5944                       TimePeriod(animatorDurationSeconds));
5945
5946   // Start the animation
5947   animation.Play();
5948
5949   bool                 signalReceived(false);
5950   AnimationFinishCheck finishCheck(signalReceived);
5951   animation.FinishedSignal().Connect(&application, finishCheck);
5952
5953   application.SendNotification();
5954   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
5955
5956   // We didn't expect the animation to finish yet
5957   application.SendNotification();
5958   finishCheck.CheckSignalNotReceived();
5959   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5960
5961   application.SendNotification();
5962   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
5963
5964   // We didn't expect the animation to finish yet...
5965   application.SendNotification();
5966   finishCheck.CheckSignalNotReceived();
5967
5968   // ...however we should have reached the final value
5969   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5970
5971   application.SendNotification();
5972   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
5973
5974   // We did expect the animation to finish
5975   application.SendNotification();
5976   finishCheck.CheckSignalReceived();
5977   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5978
5979   // Check that nothing has changed after a couple of buffer swaps
5980   application.Render(0);
5981   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5982   application.Render(0);
5983   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5984   END_TEST;
5985 }
5986
5987 int UtcDaliAnimationAnimateToFloatP(void)
5988 {
5989   TestApplication application;
5990
5991   Actor actor = Actor::New();
5992
5993   // Register a float property
5994   float           startValue(10.0f);
5995   Property::Index index = actor.RegisterProperty("testProperty", startValue);
5996   application.GetScene().Add(actor);
5997   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
5998   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
5999
6000   // Build the animation
6001   float     durationSeconds(2.0f);
6002   Animation animation = Animation::New(durationSeconds);
6003   float     targetValue(50.0f);
6004   float     relativeValue(targetValue - startValue);
6005   animation.AnimateTo(Property(actor, "testProperty"), targetValue);
6006
6007   float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6008
6009   // Start the animation
6010   animation.Play();
6011
6012   bool                 signalReceived(false);
6013   AnimationFinishCheck finishCheck(signalReceived);
6014   animation.FinishedSignal().Connect(&application, finishCheck);
6015
6016   application.SendNotification();
6017   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6018
6019   // We didn't expect the animation to finish yet
6020   application.SendNotification();
6021   finishCheck.CheckSignalNotReceived();
6022   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION);
6023
6024   application.SendNotification();
6025   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6026
6027   // We did expect the animation to finish
6028   application.SendNotification();
6029   finishCheck.CheckSignalReceived();
6030   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6031   END_TEST;
6032 }
6033
6034 int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void)
6035 {
6036   TestApplication application;
6037
6038   Actor actor = Actor::New();
6039
6040   // Register a float property
6041   float           startValue(10.0f);
6042   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6043   application.GetScene().Add(actor);
6044   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
6045   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6046
6047   // Build the animation
6048   float     durationSeconds(1.0f);
6049   Animation animation = Animation::New(durationSeconds);
6050   float     targetValue(90.0f);
6051   float     relativeValue(targetValue - startValue);
6052   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6053
6054   float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6055
6056   // Start the animation
6057   animation.Play();
6058
6059   bool                 signalReceived(false);
6060   AnimationFinishCheck finishCheck(signalReceived);
6061   animation.FinishedSignal().Connect(&application, finishCheck);
6062
6063   application.SendNotification();
6064   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6065
6066   // We didn't expect the animation to finish yet
6067   application.SendNotification();
6068   finishCheck.CheckSignalNotReceived();
6069
6070   // The position should have moved more, than with a linear alpha function
6071   float current(actor.GetCurrentProperty<float>(index));
6072   DALI_TEST_CHECK(current > ninetyFivePercentProgress);
6073
6074   application.SendNotification();
6075   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6076
6077   // We did expect the animation to finish
6078   application.SendNotification();
6079   finishCheck.CheckSignalReceived();
6080   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6081   END_TEST;
6082 }
6083
6084 int UtcDaliAnimationAnimateToFloatTimePeriodP(void)
6085 {
6086   TestApplication application;
6087
6088   Actor actor = Actor::New();
6089
6090   // Register a float property
6091   float           startValue(10.0f);
6092   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6093   application.GetScene().Add(actor);
6094   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
6095   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6096
6097   // Build the animation
6098   float     durationSeconds(1.0f);
6099   Animation animation = Animation::New(durationSeconds);
6100   float     targetValue(30.0f);
6101   float     relativeValue(targetValue - startValue);
6102   float     delay = 0.5f;
6103   animation.AnimateTo(Property(actor, index),
6104                       targetValue,
6105                       TimePeriod(delay, durationSeconds - delay));
6106
6107   // Start the animation
6108   animation.Play();
6109
6110   bool                 signalReceived(false);
6111   AnimationFinishCheck finishCheck(signalReceived);
6112   animation.FinishedSignal().Connect(&application, finishCheck);
6113
6114   application.SendNotification();
6115   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6116
6117   // We didn't expect the animation to finish yet
6118   application.SendNotification();
6119   finishCheck.CheckSignalNotReceived();
6120   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6121
6122   application.SendNotification();
6123   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6124
6125   // We didn't expect the animation to finish yet
6126   application.SendNotification();
6127   finishCheck.CheckSignalNotReceived();
6128   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6129
6130   application.SendNotification();
6131   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6132
6133   // We did expect the animation to finish
6134   application.SendNotification();
6135   finishCheck.CheckSignalReceived();
6136   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6137   END_TEST;
6138 }
6139
6140 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void)
6141 {
6142   TestApplication application;
6143
6144   Actor actor = Actor::New();
6145
6146   // Register a float property
6147   float           startValue(10.0f);
6148   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6149   application.GetScene().Add(actor);
6150   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
6151   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6152
6153   // Build the animation
6154   float     durationSeconds(1.0f);
6155   Animation animation = Animation::New(durationSeconds);
6156   float     targetValue(30.0f);
6157   float     relativeValue(targetValue - startValue);
6158   float     delay = 0.5f;
6159   animation.AnimateTo(Property(actor, index),
6160                       targetValue,
6161                       AlphaFunction::LINEAR,
6162                       TimePeriod(delay, durationSeconds - delay));
6163
6164   // Start the animation
6165   animation.Play();
6166
6167   bool                 signalReceived(false);
6168   AnimationFinishCheck finishCheck(signalReceived);
6169   animation.FinishedSignal().Connect(&application, finishCheck);
6170
6171   application.SendNotification();
6172   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6173
6174   // We didn't expect the animation to finish yet
6175   application.SendNotification();
6176   finishCheck.CheckSignalNotReceived();
6177   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6178
6179   application.SendNotification();
6180   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6181
6182   // We didn't expect the animation to finish yet
6183   application.SendNotification();
6184   finishCheck.CheckSignalNotReceived();
6185   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6186
6187   application.SendNotification();
6188   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6189
6190   // We did expect the animation to finish
6191   application.SendNotification();
6192   finishCheck.CheckSignalReceived();
6193   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6194   END_TEST;
6195 }
6196
6197 int UtcDaliAnimationAnimateToIntegerP(void)
6198 {
6199   TestApplication application;
6200
6201   Actor actor = Actor::New();
6202
6203   // Register an integer property
6204   int             startValue(10);
6205   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6206   application.GetScene().Add(actor);
6207   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6208   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6209
6210   // Build the animation
6211   float     durationSeconds(2.0f);
6212   Animation animation = Animation::New(durationSeconds);
6213   int       targetValue(50);
6214   int       relativeValue(targetValue - startValue);
6215   animation.AnimateTo(Property(actor, "testProperty"), targetValue);
6216
6217   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
6218
6219   // Start the animation
6220   animation.Play();
6221
6222   bool                 signalReceived(false);
6223   AnimationFinishCheck finishCheck(signalReceived);
6224   animation.FinishedSignal().Connect(&application, finishCheck);
6225
6226   application.SendNotification();
6227   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6228
6229   // We didn't expect the animation to finish yet
6230   application.SendNotification();
6231   finishCheck.CheckSignalNotReceived();
6232   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION);
6233
6234   application.SendNotification();
6235   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6236
6237   // We did expect the animation to finish
6238   application.SendNotification();
6239   finishCheck.CheckSignalReceived();
6240   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6241   END_TEST;
6242 }
6243
6244 int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void)
6245 {
6246   TestApplication application;
6247
6248   Actor actor = Actor::New();
6249
6250   // Register an integer property
6251   int             startValue(10);
6252   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6253   application.GetScene().Add(actor);
6254   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6255   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6256
6257   // Build the animation
6258   float     durationSeconds(1.0f);
6259   Animation animation = Animation::New(durationSeconds);
6260   int       targetValue(90);
6261   int       relativeValue(targetValue - startValue);
6262   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6263
6264   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
6265
6266   // Start the animation
6267   animation.Play();
6268
6269   bool                 signalReceived(false);
6270   AnimationFinishCheck finishCheck(signalReceived);
6271   animation.FinishedSignal().Connect(&application, finishCheck);
6272
6273   application.SendNotification();
6274   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6275
6276   // We didn't expect the animation to finish yet
6277   application.SendNotification();
6278   finishCheck.CheckSignalNotReceived();
6279
6280   // The position should have moved more, than with a linear alpha function
6281   int current(actor.GetCurrentProperty<int>(index));
6282   DALI_TEST_CHECK(current > ninetyFivePercentProgress);
6283
6284   application.SendNotification();
6285   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6286
6287   // We did expect the animation to finish
6288   application.SendNotification();
6289   finishCheck.CheckSignalReceived();
6290   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6291   END_TEST;
6292 }
6293
6294 int UtcDaliAnimationAnimateToIntegerTimePeriodP(void)
6295 {
6296   TestApplication application;
6297
6298   Actor actor = Actor::New();
6299
6300   // Register an integer property
6301   int             startValue(10);
6302   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6303   application.GetScene().Add(actor);
6304   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6305   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6306
6307   // Build the animation
6308   float     durationSeconds(1.0f);
6309   Animation animation = Animation::New(durationSeconds);
6310   int       targetValue(30);
6311   int       relativeValue(targetValue - startValue);
6312   float     delay = 0.5f;
6313   animation.AnimateTo(Property(actor, index),
6314                       targetValue,
6315                       TimePeriod(delay, durationSeconds - delay));
6316
6317   // Start the animation
6318   animation.Play();
6319
6320   bool                 signalReceived(false);
6321   AnimationFinishCheck finishCheck(signalReceived);
6322   animation.FinishedSignal().Connect(&application, finishCheck);
6323
6324   application.SendNotification();
6325   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6326
6327   // We didn't expect the animation to finish yet
6328   application.SendNotification();
6329   finishCheck.CheckSignalNotReceived();
6330   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6331
6332   application.SendNotification();
6333   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6334
6335   // We didn't expect the animation to finish yet
6336   application.SendNotification();
6337   finishCheck.CheckSignalNotReceived();
6338   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
6339
6340   application.SendNotification();
6341   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6342
6343   // We did expect the animation to finish
6344   application.SendNotification();
6345   finishCheck.CheckSignalReceived();
6346   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6347   END_TEST;
6348 }
6349
6350 int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void)
6351 {
6352   TestApplication application;
6353
6354   Actor actor = Actor::New();
6355
6356   // Register an integer property
6357   int             startValue(10);
6358   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6359   application.GetScene().Add(actor);
6360   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6361   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6362
6363   // Build the animation
6364   float     durationSeconds(1.0f);
6365   Animation animation = Animation::New(durationSeconds);
6366   int       targetValue(30);
6367   int       relativeValue(targetValue - startValue);
6368   float     delay = 0.5f;
6369   animation.AnimateTo(Property(actor, index),
6370                       targetValue,
6371                       AlphaFunction::LINEAR,
6372                       TimePeriod(delay, durationSeconds - delay));
6373
6374   // Start the animation
6375   animation.Play();
6376
6377   bool                 signalReceived(false);
6378   AnimationFinishCheck finishCheck(signalReceived);
6379   animation.FinishedSignal().Connect(&application, finishCheck);
6380
6381   application.SendNotification();
6382   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6383
6384   // We didn't expect the animation to finish yet
6385   application.SendNotification();
6386   finishCheck.CheckSignalNotReceived();
6387   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6388
6389   application.SendNotification();
6390   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6391
6392   // We didn't expect the animation to finish yet
6393   application.SendNotification();
6394   finishCheck.CheckSignalNotReceived();
6395   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
6396
6397   application.SendNotification();
6398   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6399
6400   // We did expect the animation to finish
6401   application.SendNotification();
6402   finishCheck.CheckSignalReceived();
6403   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6404   END_TEST;
6405 }
6406
6407 int UtcDaliAnimationAnimateToVector2P(void)
6408 {
6409   TestApplication application;
6410
6411   Actor actor = Actor::New();
6412
6413   // Register a Vector2 property
6414   Vector2         startValue(-50.0f, -50.0f);
6415   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6416   application.GetScene().Add(actor);
6417   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6418   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6419
6420   // Build the animation
6421   float     durationSeconds(2.0f);
6422   Animation animation = Animation::New(durationSeconds);
6423   Vector2   targetValue(50.0f, 50.0f);
6424   Vector2   relativeValue(targetValue - startValue);
6425   animation.AnimateTo(Property(actor, index), targetValue);
6426
6427   Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6428
6429   // Start the animation
6430   animation.Play();
6431
6432   bool                 signalReceived(false);
6433   AnimationFinishCheck finishCheck(signalReceived);
6434   animation.FinishedSignal().Connect(&application, finishCheck);
6435
6436   application.SendNotification();
6437   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6438
6439   // We didn't expect the animation to finish yet
6440   application.SendNotification();
6441   finishCheck.CheckSignalNotReceived();
6442   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION);
6443
6444   application.SendNotification();
6445   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6446
6447   // We did expect the animation to finish
6448   application.SendNotification();
6449   finishCheck.CheckSignalReceived();
6450   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6451   END_TEST;
6452 }
6453
6454 int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void)
6455 {
6456   TestApplication application;
6457
6458   Actor actor = Actor::New();
6459
6460   // Register a Vector2 property
6461   Vector2         startValue(1000.0f, 1000.0f);
6462   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6463   application.GetScene().Add(actor);
6464   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6465   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6466
6467   // Build the animation
6468   float     durationSeconds(1.0f);
6469   Animation animation = Animation::New(durationSeconds);
6470   Vector2   targetValue(9000.0f, 9000.0f);
6471   Vector2   relativeValue(targetValue - startValue);
6472   animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
6473
6474   Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6475
6476   // Start the animation
6477   animation.Play();
6478
6479   bool                 signalReceived(false);
6480   AnimationFinishCheck finishCheck(signalReceived);
6481   animation.FinishedSignal().Connect(&application, finishCheck);
6482
6483   application.SendNotification();
6484   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6485
6486   // We didn't expect the animation to finish yet
6487   application.SendNotification();
6488   finishCheck.CheckSignalNotReceived();
6489
6490   // The position should have moved more, than with a linear alpha function
6491   Vector2 current(actor.GetCurrentProperty<Vector2>(index));
6492   DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
6493   DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
6494
6495   application.SendNotification();
6496   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6497
6498   // We did expect the animation to finish
6499   application.SendNotification();
6500   finishCheck.CheckSignalReceived();
6501   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6502   END_TEST;
6503 }
6504
6505 int UtcDaliAnimationAnimateToVector2TimePeriodP(void)
6506 {
6507   TestApplication application;
6508
6509   Actor actor = Actor::New();
6510
6511   // Register a Vector2 property
6512   Vector2         startValue(10.0f, 10.0f);
6513   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6514   application.GetScene().Add(actor);
6515   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6516   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6517
6518   // Build the animation
6519   float     durationSeconds(1.0f);
6520   Animation animation = Animation::New(durationSeconds);
6521   Vector2   targetValue(-10.0f, 20.0f);
6522   Vector2   relativeValue(targetValue - startValue);
6523   float     delay = 0.5f;
6524   animation.AnimateTo(Property(actor, index),
6525                       targetValue,
6526                       TimePeriod(delay, durationSeconds - delay));
6527
6528   // Start the animation
6529   animation.Play();
6530
6531   bool                 signalReceived(false);
6532   AnimationFinishCheck finishCheck(signalReceived);
6533   animation.FinishedSignal().Connect(&application, finishCheck);
6534
6535   application.SendNotification();
6536   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6537
6538   // We didn't expect the animation to finish yet
6539   application.SendNotification();
6540   finishCheck.CheckSignalNotReceived();
6541   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6542
6543   application.SendNotification();
6544   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6545
6546   // We didn't expect the animation to finish yet
6547   application.SendNotification();
6548   finishCheck.CheckSignalNotReceived();
6549   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6550
6551   application.SendNotification();
6552   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6553
6554   // We did expect the animation to finish
6555   application.SendNotification();
6556   finishCheck.CheckSignalReceived();
6557   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6558   END_TEST;
6559 }
6560
6561 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void)
6562 {
6563   TestApplication application;
6564
6565   Actor actor = Actor::New();
6566
6567   // Register a Vector2 property
6568   Vector2         startValue(10.0f, 10.0f);
6569   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6570   application.GetScene().Add(actor);
6571   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6572   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6573
6574   // Build the animation
6575   float     durationSeconds(1.0f);
6576   Animation animation = Animation::New(durationSeconds);
6577   Vector2   targetValue(30.0f, 30.0f);
6578   Vector2   relativeValue(targetValue - startValue);
6579   float     delay = 0.5f;
6580   animation.AnimateTo(Property(actor, index),
6581                       targetValue,
6582                       AlphaFunction::LINEAR,
6583                       TimePeriod(delay, durationSeconds - delay));
6584
6585   // Start the animation
6586   animation.Play();
6587
6588   bool                 signalReceived(false);
6589   AnimationFinishCheck finishCheck(signalReceived);
6590   animation.FinishedSignal().Connect(&application, finishCheck);
6591
6592   application.SendNotification();
6593   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6594
6595   // We didn't expect the animation to finish yet, but cached value should be the final one
6596   application.SendNotification();
6597   finishCheck.CheckSignalNotReceived();
6598   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION);
6599   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6600
6601   application.SendNotification();
6602   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6603
6604   // We didn't expect the animation to finish yet
6605   application.SendNotification();
6606   finishCheck.CheckSignalNotReceived();
6607   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6608
6609   application.SendNotification();
6610   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6611
6612   // We did expect the animation to finish
6613   application.SendNotification();
6614   finishCheck.CheckSignalReceived();
6615   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6616   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION);
6617   END_TEST;
6618 }
6619
6620 int UtcDaliAnimationAnimateToVector3P(void)
6621 {
6622   TestApplication application;
6623
6624   Actor actor = Actor::New();
6625
6626   // Register a Vector3 property
6627   Vector3         startValue(-50.0f, -50.0f, -50.0f);
6628   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6629   application.GetScene().Add(actor);
6630   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6631   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6632
6633   // Build the animation
6634   float     durationSeconds(2.0f);
6635   Animation animation = Animation::New(durationSeconds);
6636   Vector3   targetValue(50.0f, 50.0f, 50.0f);
6637   Vector3   relativeValue(targetValue - startValue);
6638   animation.AnimateTo(Property(actor, index), targetValue);
6639
6640   Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6641
6642   // Start the animation
6643   animation.Play();
6644
6645   bool                 signalReceived(false);
6646   AnimationFinishCheck finishCheck(signalReceived);
6647   animation.FinishedSignal().Connect(&application, finishCheck);
6648
6649   application.SendNotification();
6650   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6651
6652   // We didn't expect the animation to finish yet
6653   application.SendNotification();
6654   finishCheck.CheckSignalNotReceived();
6655   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION);
6656
6657   application.SendNotification();
6658   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6659
6660   // We did expect the animation to finish
6661   application.SendNotification();
6662   finishCheck.CheckSignalReceived();
6663   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6664   END_TEST;
6665 }
6666
6667 int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void)
6668 {
6669   TestApplication application;
6670
6671   Actor actor = Actor::New();
6672
6673   // Register a Vector3 property
6674   Vector3         startValue(1000.0f, 1000.0f, 1000.0f);
6675   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6676   application.GetScene().Add(actor);
6677   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6678   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6679
6680   // Build the animation
6681   float     durationSeconds(1.0f);
6682   Animation animation = Animation::New(durationSeconds);
6683   Vector3   targetValue(9000.0f, 9000.0f, 9000.0f);
6684   Vector3   relativeValue(targetValue - startValue);
6685   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6686
6687   Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6688
6689   // Start the animation
6690   animation.Play();
6691
6692   bool                 signalReceived(false);
6693   AnimationFinishCheck finishCheck(signalReceived);
6694   animation.FinishedSignal().Connect(&application, finishCheck);
6695
6696   application.SendNotification();
6697   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6698
6699   // We didn't expect the animation to finish yet
6700   application.SendNotification();
6701   finishCheck.CheckSignalNotReceived();
6702
6703   // The position should have moved more, than with a linear alpha function
6704   Vector3 current(actor.GetCurrentProperty<Vector3>(index));
6705   DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
6706   DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
6707   DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z);
6708
6709   application.SendNotification();
6710   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6711
6712   // We did expect the animation to finish
6713   application.SendNotification();
6714   finishCheck.CheckSignalReceived();
6715   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6716   END_TEST;
6717 }
6718
6719 int UtcDaliAnimationAnimateToVector3TimePeriodP(void)
6720 {
6721   TestApplication application;
6722
6723   Actor actor = Actor::New();
6724
6725   // Register a Vector3 property
6726   Vector3         startValue(10.0f, 10.0f, 10.0f);
6727   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6728   application.GetScene().Add(actor);
6729   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6730   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6731
6732   // Build the animation
6733   float     durationSeconds(1.0f);
6734   Animation animation = Animation::New(durationSeconds);
6735   Vector3   targetValue(-10.0f, 20.0f, 100.0f);
6736   Vector3   relativeValue(targetValue - startValue);
6737   float     delay = 0.5f;
6738   animation.AnimateTo(Property(actor, index),
6739                       targetValue,
6740                       TimePeriod(delay, durationSeconds - delay));
6741
6742   // Start the animation
6743   animation.Play();
6744
6745   bool                 signalReceived(false);
6746   AnimationFinishCheck finishCheck(signalReceived);
6747   animation.FinishedSignal().Connect(&application, finishCheck);
6748
6749   application.SendNotification();
6750   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6751
6752   // We didn't expect the animation to finish yet
6753   application.SendNotification();
6754   finishCheck.CheckSignalNotReceived();
6755   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6756
6757   application.SendNotification();
6758   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6759
6760   // We didn't expect the animation to finish yet
6761   application.SendNotification();
6762   finishCheck.CheckSignalNotReceived();
6763   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6764
6765   application.SendNotification();
6766   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6767
6768   // We did expect the animation to finish
6769   application.SendNotification();
6770   finishCheck.CheckSignalReceived();
6771   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6772   END_TEST;
6773 }
6774
6775 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void)
6776 {
6777   TestApplication application;
6778
6779   Actor actor = Actor::New();
6780
6781   // Register a Vector3 property
6782   Vector3         startValue(10.0f, 10.0f, 10.0f);
6783   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6784   application.GetScene().Add(actor);
6785   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6786   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6787
6788   // Build the animation
6789   float     durationSeconds(1.0f);
6790   Animation animation = Animation::New(durationSeconds);
6791   Vector3   targetValue(30.0f, 30.0f, 30.0f);
6792   Vector3   relativeValue(targetValue - startValue);
6793   float     delay = 0.5f;
6794   animation.AnimateTo(Property(actor, "testProperty"),
6795                       targetValue,
6796                       AlphaFunction::LINEAR,
6797                       TimePeriod(delay, durationSeconds - delay));
6798
6799   // Start the animation
6800   animation.Play();
6801
6802   bool                 signalReceived(false);
6803   AnimationFinishCheck finishCheck(signalReceived);
6804   animation.FinishedSignal().Connect(&application, finishCheck);
6805
6806   application.SendNotification();
6807   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6808
6809   // We didn't expect the animation to finish yet
6810   application.SendNotification();
6811   finishCheck.CheckSignalNotReceived();
6812   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6813
6814   application.SendNotification();
6815   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6816
6817   // We didn't expect the animation to finish yet
6818   application.SendNotification();
6819   finishCheck.CheckSignalNotReceived();
6820   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6821
6822   application.SendNotification();
6823   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6824
6825   // We did expect the animation to finish
6826   application.SendNotification();
6827   finishCheck.CheckSignalReceived();
6828   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6829   END_TEST;
6830 }
6831
6832 int UtcDaliAnimationAnimateToVector3ComponentP(void)
6833 {
6834   TestApplication application;
6835
6836   Actor actor = Actor::New();
6837
6838   // Register a Vector3 property
6839   Vector3         startValue(10.0f, 10.0f, 10.0f);
6840   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6841   application.GetScene().Add(actor);
6842   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6843   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6844
6845   // Build the animation
6846   float     durationSeconds(1.0f);
6847   Animation animation = Animation::New(durationSeconds);
6848   Vector3   targetValue(30.0f, 30.0f, 10.0f);
6849   Vector3   relativeValue(targetValue - startValue);
6850   float     delay = 0.5f;
6851   animation.AnimateTo(Property(actor, "testProperty", 0),
6852                       30.0f,
6853                       AlphaFunction::LINEAR,
6854                       TimePeriod(delay, durationSeconds - delay));
6855   animation.AnimateTo(Property(actor, index, 1),
6856                       30.0f,
6857                       AlphaFunction::LINEAR,
6858                       TimePeriod(delay, durationSeconds - delay));
6859
6860   // Start the animation
6861   animation.Play();
6862
6863   bool                 signalReceived(false);
6864   AnimationFinishCheck finishCheck(signalReceived);
6865   animation.FinishedSignal().Connect(&application, finishCheck);
6866
6867   application.SendNotification();
6868   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6869
6870   // We didn't expect the animation to finish yet
6871   application.SendNotification();
6872   finishCheck.CheckSignalNotReceived();
6873   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6874
6875   application.SendNotification();
6876   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6877
6878   // We didn't expect the animation to finish yet
6879   application.SendNotification();
6880   finishCheck.CheckSignalNotReceived();
6881   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6882
6883   application.SendNotification();
6884   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6885
6886   // We did expect the animation to finish
6887   application.SendNotification();
6888   finishCheck.CheckSignalReceived();
6889   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6890   END_TEST;
6891 }
6892
6893 int UtcDaliAnimationAnimateToVector4P(void)
6894 {
6895   TestApplication application;
6896
6897   Actor actor = Actor::New();
6898
6899   // Register a Vector4 property
6900   Vector4         startValue(-50.0f, -40.0f, -30.0f, -20.0f);
6901   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6902   application.GetScene().Add(actor);
6903   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
6904   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
6905
6906   // Build the animation
6907   float     durationSeconds(2.0f);
6908   Animation animation = Animation::New(durationSeconds);
6909   Vector4   targetValue(50.0f, 50.0f, 50.0f, 50.0f);
6910   Vector4   relativeValue(targetValue - startValue);
6911   animation.AnimateTo(Property(actor, index), targetValue);
6912
6913   Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6914
6915   // Start the animation
6916   animation.Play();
6917
6918   bool                 signalReceived(false);
6919   AnimationFinishCheck finishCheck(signalReceived);
6920   animation.FinishedSignal().Connect(&application, finishCheck);
6921
6922   application.SendNotification();
6923   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6924
6925   // We didn't expect the animation to finish yet
6926   application.SendNotification();
6927   finishCheck.CheckSignalNotReceived();
6928   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION);
6929
6930   application.SendNotification();
6931   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6932
6933   // We did expect the animation to finish
6934   application.SendNotification();
6935   finishCheck.CheckSignalReceived();
6936   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
6937   END_TEST;
6938 }
6939
6940 int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void)
6941 {
6942   TestApplication application;
6943
6944   Actor actor = Actor::New();
6945
6946   // Register a Vector4 property
6947   Vector4         startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
6948   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6949   application.GetScene().Add(actor);
6950   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
6951   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
6952
6953   // Build the animation
6954   float     durationSeconds(1.0f);
6955   Animation animation = Animation::New(durationSeconds);
6956   Vector4   targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
6957   Vector4   relativeValue(targetValue - startValue);
6958   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6959
6960   Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6961
6962   // Start the animation
6963   animation.Play();
6964
6965   bool                 signalReceived(false);
6966   AnimationFinishCheck finishCheck(signalReceived);
6967   animation.FinishedSignal().Connect(&application, finishCheck);
6968
6969   application.SendNotification();
6970   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6971
6972   // We didn't expect the animation to finish yet
6973   application.SendNotification();
6974   finishCheck.CheckSignalNotReceived();
6975
6976   // The position should have moved more, than with a linear alpha function
6977   Vector4 current(actor.GetCurrentProperty<Vector4>(index));
6978   DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
6979   DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
6980   DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z);
6981   DALI_TEST_CHECK(current.w > ninetyFivePercentProgress.w);
6982
6983   application.SendNotification();
6984   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6985
6986   // We did expect the animation to finish
6987   application.SendNotification();
6988   finishCheck.CheckSignalReceived();
6989   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
6990   END_TEST;
6991 }
6992
6993 int UtcDaliAnimationAnimateToVector4TimePeriodP(void)
6994 {
6995   TestApplication application;
6996
6997   Actor actor = Actor::New();
6998
6999   // Register a Vector4 property
7000   Vector4         startValue(10.0f, 10.0f, 10.0f, 10.0f);
7001   Property::Index index = actor.RegisterProperty("testProperty", startValue);
7002   application.GetScene().Add(actor);
7003   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
7004   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION);
7005
7006   // Build the animation
7007   float     durationSeconds(1.0f);
7008   Animation animation = Animation::New(durationSeconds);
7009   Vector4   targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
7010   Vector4   relativeValue(targetValue - startValue);
7011   float     delay = 0.5f;
7012   animation.AnimateTo(Property(actor, index),
7013                       targetValue,
7014                       TimePeriod(delay, durationSeconds - delay));
7015
7016   // Start the animation
7017   animation.Play();
7018
7019   bool                 signalReceived(false);
7020   AnimationFinishCheck finishCheck(signalReceived);
7021   animation.FinishedSignal().Connect(&application, finishCheck);
7022
7023   application.SendNotification();
7024   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7025
7026   // We didn't expect the animation to finish yet
7027   application.SendNotification();
7028   finishCheck.CheckSignalNotReceived();
7029   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION);
7030
7031   application.SendNotification();
7032   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
7033
7034   // We didn't expect the animation to finish yet
7035   application.SendNotification();
7036   finishCheck.CheckSignalNotReceived();
7037   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), VECTOR4_EPSILON, TEST_LOCATION);
7038
7039   application.SendNotification();
7040   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7041
7042   // We did expect the animation to finish
7043   application.SendNotification();
7044   finishCheck.CheckSignalReceived();
7045   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, VECTOR4_EPSILON, TEST_LOCATION);
7046   END_TEST;
7047 }
7048
7049 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void)
7050 {
7051   TestApplication application;
7052
7053   Actor actor = Actor::New();
7054
7055   // Register a Vector4 property
7056   Vector4         startValue(10.0f, 10.0f, 10.0f, 10.0f);
7057   Property::Index index = actor.RegisterProperty("testProperty", startValue);
7058   application.GetScene().Add(actor);
7059   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
7060   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
7061
7062   // Build the animation
7063   float     durationSeconds(1.0f);
7064   Animation animation = Animation::New(durationSeconds);
7065   Vector4   targetValue(30.0f, 30.0f, 30.0f, 30.0f);
7066   Vector4   relativeValue(targetValue - startValue);
7067   float     delay = 0.5f;
7068   animation.AnimateTo(Property(actor, index),
7069                       targetValue,
7070                       AlphaFunction::LINEAR,
7071                       TimePeriod(delay, durationSeconds - delay));
7072
7073   // Start the animation
7074   animation.Play();
7075
7076   bool                 signalReceived(false);
7077   AnimationFinishCheck finishCheck(signalReceived);
7078   animation.FinishedSignal().Connect(&application, finishCheck);
7079
7080   application.SendNotification();
7081   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7082
7083   // We didn't expect the animation to finish yet
7084   application.SendNotification();
7085   finishCheck.CheckSignalNotReceived();
7086   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
7087
7088   application.SendNotification();
7089   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
7090
7091   // We didn't expect the animation to finish yet
7092   application.SendNotification();
7093   finishCheck.CheckSignalNotReceived();
7094   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
7095
7096   application.SendNotification();
7097   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7098
7099   // We did expect the animation to finish
7100   application.SendNotification();
7101   finishCheck.CheckSignalReceived();
7102   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
7103   END_TEST;
7104 }
7105
7106 int UtcDaliAnimationAnimateToActorParentOriginP(void)
7107 {
7108   TestApplication application;
7109
7110   Actor actor = Actor::New();
7111   application.GetScene().Add(actor);
7112   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_LEFT, TEST_LOCATION);
7113
7114   // Build the animation
7115   float     durationSeconds(1.0f);
7116   Animation animation = Animation::New(durationSeconds);
7117   Vector3   targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
7118
7119   DALI_TEST_ASSERTION(
7120     {
7121       animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin);
7122     },
7123     "Property is not animatable");
7124
7125   END_TEST;
7126 }
7127
7128 int UtcDaliAnimationAnimateToActorParentOriginXN(void)
7129 {
7130   TestApplication application;
7131
7132   Actor actor = Actor::New();
7133   application.GetScene().Add(actor);
7134   float startValue(0.0f);
7135   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).x, startValue, TEST_LOCATION);
7136   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION);
7137
7138   // Build the animation
7139   float     durationSeconds(1.0f);
7140   Animation animation = Animation::New(durationSeconds);
7141   float     targetX(1.0f);
7142
7143   DALI_TEST_ASSERTION(
7144     {
7145       animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX);
7146     },
7147     "Property is not animatable");
7148
7149   END_TEST;
7150 }
7151
7152 int UtcDaliAnimationAnimateToActorParentOriginYN(void)
7153 {
7154   TestApplication application;
7155
7156   Actor actor = Actor::New();
7157   application.GetScene().Add(actor);
7158   float startValue(0.0f);
7159   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).y, startValue, TEST_LOCATION);
7160   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION);
7161
7162   // Build the animation
7163   float     durationSeconds(1.0f);
7164   Animation animation = Animation::New(durationSeconds);
7165   float     targetY(1.0f);
7166
7167   DALI_TEST_ASSERTION(
7168     {
7169       animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY);
7170     },
7171     "Property is not animatable");
7172
7173   END_TEST;
7174 }
7175
7176 int UtcDaliAnimationAnimateToActorParentOriginZN(void)
7177 {
7178   TestApplication application;
7179
7180   Actor actor = Actor::New();
7181   application.GetScene().Add(actor);
7182   float startValue(0.5f);
7183   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).z, startValue, TEST_LOCATION);
7184   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION);
7185
7186   // Build the animation
7187   float     durationSeconds(1.0f);
7188   Animation animation = Animation::New(durationSeconds);
7189   float     targetZ(1.0f);
7190
7191   DALI_TEST_ASSERTION(
7192     {
7193       animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ);
7194     },
7195     "Property is not animatable");
7196
7197   END_TEST;
7198 }
7199
7200 int UtcDaliAnimationAnimateToActorAnchorPointN(void)
7201 {
7202   TestApplication application;
7203
7204   Actor actor = Actor::New();
7205   application.GetScene().Add(actor);
7206   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), AnchorPoint::CENTER, TEST_LOCATION);
7207
7208   // Build the animation
7209   float     durationSeconds(1.0f);
7210   Animation animation = Animation::New(durationSeconds);
7211   Vector3   targetAnchorPoint(AnchorPoint::TOP_LEFT);
7212
7213   DALI_TEST_ASSERTION(
7214     {
7215       animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
7216     },
7217     "Property is not animatable");
7218
7219   END_TEST;
7220 }
7221
7222 int UtcDaliAnimationAnimateToActorAnchorPointXN(void)
7223 {
7224   TestApplication application;
7225
7226   Actor actor = Actor::New();
7227   application.GetScene().Add(actor);
7228   float startValue(0.5f);
7229   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).x, startValue, TEST_LOCATION);
7230   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION);
7231
7232   // Build the animation
7233   float     durationSeconds(1.0f);
7234   Animation animation = Animation::New(durationSeconds);
7235   float     targetX(1.0f);
7236
7237   DALI_TEST_ASSERTION(
7238     {
7239       animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_X), targetX);
7240     },
7241     "Property is not animatable");
7242
7243   END_TEST;
7244 }
7245
7246 int UtcDaliAnimationAnimateToActorAnchorPointYN(void)
7247 {
7248   TestApplication application;
7249
7250   Actor actor = Actor::New();
7251   application.GetScene().Add(actor);
7252   float startValue(0.5f);
7253   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).y, startValue, TEST_LOCATION);
7254   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION);
7255
7256   // Build the animation
7257   float     durationSeconds(1.0f);
7258   Animation animation = Animation::New(durationSeconds);
7259   float     targetY(0.0f);
7260
7261   DALI_TEST_ASSERTION(
7262     {
7263       animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY);
7264     },
7265     "Property is not animatable");
7266
7267   END_TEST;
7268 }
7269
7270 int UtcDaliAnimationAnimateToActorAnchorPointZN(void)
7271 {
7272   TestApplication application;
7273
7274   Actor actor = Actor::New();
7275   application.GetScene().Add(actor);
7276   float startValue(0.5f);
7277   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).z, startValue, TEST_LOCATION);
7278   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION);
7279
7280   // Build the animation
7281   float     durationSeconds(1.0f);
7282   Animation animation = Animation::New(durationSeconds);
7283   float     targetZ(100.0f);
7284
7285   DALI_TEST_ASSERTION(
7286     {
7287       animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ);
7288     },
7289     "Property is not animatable");
7290
7291   END_TEST;
7292 }
7293
7294 int UtcDaliAnimationAnimateToActorSizeP(void)
7295 {
7296   TestApplication application;
7297
7298   Actor actor = Actor::New();
7299   application.GetScene().Add(actor);
7300   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7301
7302   // Build the animation
7303   float     durationSeconds(1.0f);
7304   Animation animation = Animation::New(durationSeconds);
7305   Vector3   targetSize(100.0f, 100.0f, 100.0f);
7306   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize);
7307
7308   Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7309
7310   // Should return the initial properties before play
7311   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7312   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), 0.0f, TEST_LOCATION);
7313   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), 0.0f, TEST_LOCATION);
7314   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), 0.0f, TEST_LOCATION);
7315
7316   // Start the animation
7317   animation.Play();
7318
7319   // Should return the target property after play
7320   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7321   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION);
7322   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION);
7323   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION);
7324
7325   bool                 signalReceived(false);
7326   AnimationFinishCheck finishCheck(signalReceived);
7327   animation.FinishedSignal().Connect(&application, finishCheck);
7328
7329   application.SendNotification();
7330   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7331
7332   // We didn't expect the animation to finish yet
7333   application.SendNotification();
7334   finishCheck.CheckSignalNotReceived();
7335   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), ninetyNinePercentProgress, TEST_LOCATION);
7336
7337   application.SendNotification();
7338   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7339
7340   // We did expect the animation to finish
7341   application.SendNotification();
7342   finishCheck.CheckSignalReceived();
7343   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7344
7345   // Reset everything
7346   finishCheck.Reset();
7347   actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7348   application.SendNotification();
7349   application.Render(0);
7350   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7351
7352   // Repeat with a different (ease-in) alpha function
7353   animation = Animation::New(durationSeconds);
7354   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
7355   animation.FinishedSignal().Connect(&application, finishCheck);
7356   animation.Play();
7357
7358   application.SendNotification();
7359   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7360
7361   // We didn't expect the animation to finish yet
7362   application.SendNotification();
7363   finishCheck.CheckSignalNotReceived();
7364
7365   // The size should have travelled less, than with a linear alpha function
7366   Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
7367   DALI_TEST_CHECK(current.x > 0.0f);
7368   DALI_TEST_CHECK(current.y > 0.0f);
7369   DALI_TEST_CHECK(current.z > 0.0f);
7370   DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
7371   DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
7372   DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z);
7373
7374   application.SendNotification();
7375   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7376
7377   // We did expect the animation to finish
7378   application.SendNotification();
7379   finishCheck.CheckSignalReceived();
7380   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7381
7382   // Reset everything
7383   finishCheck.Reset();
7384   actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7385   application.SendNotification();
7386   application.Render(0);
7387   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7388
7389   // Repeat with a delay
7390   float delay = 0.5f;
7391   animation   = Animation::New(durationSeconds);
7392   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7393   animation.FinishedSignal().Connect(&application, finishCheck);
7394   animation.Play();
7395
7396   application.SendNotification();
7397   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7398
7399   // We didn't expect the animation to finish yet
7400   application.SendNotification();
7401   finishCheck.CheckSignalNotReceived();
7402   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7403
7404   application.SendNotification();
7405   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7406
7407   // We did expect the animation to finish
7408   application.SendNotification();
7409   finishCheck.CheckSignalReceived();
7410   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7411   END_TEST;
7412 }
7413
7414 int UtcDaliAnimationAnimateToActorSizeWidthP(void)
7415 {
7416   TestApplication application;
7417
7418   Actor actor = Actor::New();
7419   application.GetScene().Add(actor);
7420   float startValue(0.0f);
7421   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, startValue, TEST_LOCATION);
7422   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION);
7423
7424   // Build the animation
7425   float     durationSeconds(1.0f);
7426   Animation animation = Animation::New(durationSeconds);
7427   float     targetWidth(10.0f);
7428   animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetWidth);
7429
7430   float fiftyPercentProgress(startValue + (targetWidth - startValue) * 0.5f);
7431
7432   // Should return the initial properties before play
7433   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7434   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION);
7435
7436   // Start the animation
7437   animation.Play();
7438
7439   // Should return the target property after play
7440   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(targetWidth, 0.0f, 0.0f), TEST_LOCATION);
7441   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION);
7442
7443   bool                 signalReceived(false);
7444   AnimationFinishCheck finishCheck(signalReceived);
7445   animation.FinishedSignal().Connect(&application, finishCheck);
7446
7447   application.SendNotification();
7448   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7449
7450   // We didn't expect the animation to finish yet
7451   application.SendNotification();
7452   finishCheck.CheckSignalNotReceived();
7453   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, fiftyPercentProgress, TEST_LOCATION);
7454
7455   application.SendNotification();
7456   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7457
7458   // We did expect the animation to finish
7459   application.SendNotification();
7460   finishCheck.CheckSignalReceived();
7461   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, targetWidth, TEST_LOCATION);
7462   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION);
7463   END_TEST;
7464 }
7465
7466 int UtcDaliAnimationAnimateToActorSizeHeightP(void)
7467 {
7468   TestApplication application;
7469
7470   Actor actor = Actor::New();
7471   application.GetScene().Add(actor);
7472   float startValue(0.0f);
7473   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, startValue, TEST_LOCATION);
7474   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION);
7475
7476   // Build the animation
7477   float     durationSeconds(1.0f);
7478   Animation animation = Animation::New(durationSeconds);
7479   float     targetHeight(-10.0f);
7480   animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight);
7481
7482   float fiftyPercentProgress(startValue + (targetHeight - startValue) * 0.5f);
7483
7484   // Should return the initial properties before play
7485   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7486   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION);
7487
7488   // Start the animation
7489   animation.Play();
7490
7491   // Should return the target property after play
7492   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(0.0f, targetHeight, 0.0f), TEST_LOCATION);
7493   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION);
7494
7495   bool                 signalReceived(false);
7496   AnimationFinishCheck finishCheck(signalReceived);
7497   animation.FinishedSignal().Connect(&application, finishCheck);
7498
7499   application.SendNotification();
7500   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7501
7502   // We didn't expect the animation to finish yet
7503   application.SendNotification();
7504   finishCheck.CheckSignalNotReceived();
7505   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, fiftyPercentProgress, TEST_LOCATION);
7506
7507   application.SendNotification();
7508   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7509
7510   // We did expect the animation to finish
7511   application.SendNotification();
7512   finishCheck.CheckSignalReceived();
7513   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, targetHeight, TEST_LOCATION);
7514   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION);
7515   END_TEST;
7516 }
7517
7518 int UtcDaliAnimationAnimateToActorSizeDepthP(void)
7519 {
7520   TestApplication application;
7521
7522   Actor actor = Actor::New();
7523   application.GetScene().Add(actor);
7524   float startValue(0.0f);
7525   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, startValue, TEST_LOCATION);
7526   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION);
7527
7528   // Build the animation
7529   float     durationSeconds(1.0f);
7530   Animation animation = Animation::New(durationSeconds);
7531   float     targetDepth(-10.0f);
7532   animation.AnimateTo(Property(actor, Actor::Property::SIZE_DEPTH), targetDepth);
7533
7534   float fiftyPercentProgress(startValue + (targetDepth - startValue) * 0.5f);
7535
7536   // Should return the initial properties before play
7537   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7538   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION);
7539
7540   // Start the animation
7541   animation.Play();
7542
7543   // Should return the target property after play
7544   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(0.0f, 0.0f, targetDepth), TEST_LOCATION);
7545   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION);
7546
7547   bool                 signalReceived(false);
7548   AnimationFinishCheck finishCheck(signalReceived);
7549   animation.FinishedSignal().Connect(&application, finishCheck);
7550
7551   application.SendNotification();
7552   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7553
7554   // We didn't expect the animation to finish yet
7555   application.SendNotification();
7556   finishCheck.CheckSignalNotReceived();
7557   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, fiftyPercentProgress, TEST_LOCATION);
7558
7559   application.SendNotification();
7560   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7561
7562   // We did expect the animation to finish
7563   application.SendNotification();
7564   finishCheck.CheckSignalReceived();
7565   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, targetDepth, TEST_LOCATION);
7566   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION);
7567   END_TEST;
7568 }
7569
7570 int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void)
7571 {
7572   TestApplication application;
7573
7574   Actor actor = Actor::New();
7575   application.GetScene().Add(actor);
7576   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7577
7578   // Build the animation
7579   float     durationSeconds(1.0f);
7580   Animation animation = Animation::New(durationSeconds);
7581   Vector3   targetSize(100.0f, 100.0f, 100.0f);
7582   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize);
7583
7584   Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7585
7586   // Start the animation
7587   animation.Play();
7588
7589   bool                 signalReceived(false);
7590   AnimationFinishCheck finishCheck(signalReceived);
7591   animation.FinishedSignal().Connect(&application, finishCheck);
7592
7593   application.SendNotification();
7594   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7595
7596   // We didn't expect the animation to finish yet
7597   application.SendNotification();
7598   finishCheck.CheckSignalNotReceived();
7599   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), ninetyNinePercentProgress, TEST_LOCATION);
7600
7601   application.SendNotification();
7602   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7603
7604   // We did expect the animation to finish
7605   application.SendNotification();
7606   finishCheck.CheckSignalReceived();
7607   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7608
7609   // Reset everything
7610   finishCheck.Reset();
7611   actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7612   application.SendNotification();
7613   application.Render(0);
7614   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7615
7616   // Repeat with a different (ease-in) alpha function
7617   animation = Animation::New(durationSeconds);
7618   animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetSize.x, AlphaFunction::EASE_IN);
7619   animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetSize.y, AlphaFunction::EASE_IN);
7620   animation.FinishedSignal().Connect(&application, finishCheck);
7621   animation.Play();
7622
7623   application.SendNotification();
7624   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7625
7626   // We didn't expect the animation to finish yet
7627   application.SendNotification();
7628   finishCheck.CheckSignalNotReceived();
7629
7630   // The size should have travelled less, than with a linear alpha function
7631   Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
7632   DALI_TEST_CHECK(current.x > 0.0f);
7633   DALI_TEST_CHECK(current.y > 0.0f);
7634   DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
7635   DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
7636
7637   application.SendNotification();
7638   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7639
7640   // We did expect the animation to finish
7641   application.SendNotification();
7642   finishCheck.CheckSignalReceived();
7643   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).x, targetSize.x, TEST_LOCATION);
7644   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).y, targetSize.y, TEST_LOCATION);
7645
7646   // Reset everything
7647   finishCheck.Reset();
7648   actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7649   application.SendNotification();
7650   application.Render(0);
7651   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7652
7653   // Repeat with a delay
7654   float delay = 0.5f;
7655   animation   = Animation::New(durationSeconds);
7656   animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetSize.x, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7657   animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetSize.y, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7658   animation.FinishedSignal().Connect(&application, finishCheck);
7659   animation.Play();
7660
7661   application.SendNotification();
7662   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7663
7664   // We didn't expect the animation to finish yet
7665   application.SendNotification();
7666   finishCheck.CheckSignalNotReceived();
7667   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7668
7669   application.SendNotification();
7670   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7671
7672   // We did expect the animation to finish
7673   application.SendNotification();
7674   finishCheck.CheckSignalReceived();
7675   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).x, targetSize.x, TEST_LOCATION);
7676   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).y, targetSize.y, TEST_LOCATION);
7677   END_TEST;
7678 }
7679
7680 int UtcDaliAnimationAnimateToActorPositionP(void)
7681 {
7682   TestApplication application;
7683
7684   Actor actor = Actor::New();
7685   application.GetScene().Add(actor);
7686   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7687
7688   // Build the animation
7689   float     durationSeconds(1.0f);
7690   Animation animation = Animation::New(durationSeconds);
7691   Vector3   targetPosition(200.0f, 200.0f, 200.0f);
7692   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
7693
7694   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7695
7696   // Should return the initial properties before play
7697   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7698   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
7699   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), 0.0f, TEST_LOCATION);
7700   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), 0.0f, TEST_LOCATION);
7701
7702   // Start the animation
7703   animation.Play();
7704
7705   // Should return the target property after play
7706   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7707   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
7708   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
7709   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
7710
7711   bool                 signalReceived(false);
7712   AnimationFinishCheck finishCheck(signalReceived);
7713   animation.FinishedSignal().Connect(&application, finishCheck);
7714
7715   application.SendNotification();
7716   application.Render(static_cast<unsigned int>(durationSeconds * 750.0f) /* 75% progress */);
7717
7718   // We didn't expect the animation to finish yet
7719   application.SendNotification();
7720   finishCheck.CheckSignalNotReceived();
7721   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION);
7722
7723   application.SendNotification();
7724   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7725
7726   // We did expect the animation to finish
7727   application.SendNotification();
7728   finishCheck.CheckSignalReceived();
7729   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7730   END_TEST;
7731 }
7732
7733 int UtcDaliAnimationAnimateToActorPositionXP(void)
7734 {
7735   TestApplication application;
7736
7737   Actor actor = Actor::New();
7738   application.GetScene().Add(actor);
7739   float startValue(0.0f);
7740   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, startValue, TEST_LOCATION);
7741   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7742   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7743   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7744
7745   // Build the animation
7746   float     durationSeconds(1.0f);
7747   Animation animation = Animation::New(durationSeconds);
7748   float     targetX(1.0f);
7749   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), targetX);
7750
7751   float fiftyPercentProgress(startValue + (targetX - startValue) * 0.5f);
7752
7753   // Should return the initial properties before play
7754   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7755   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7756
7757   // Start the animation
7758   animation.Play();
7759
7760   // Should return the target property after play
7761   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(targetX, 0.0f, 0.0f), TEST_LOCATION);
7762   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION);
7763
7764   bool                 signalReceived(false);
7765   AnimationFinishCheck finishCheck(signalReceived);
7766   animation.FinishedSignal().Connect(&application, finishCheck);
7767
7768   application.SendNotification();
7769   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7770
7771   // We didn't expect the animation to finish yet
7772   application.SendNotification();
7773   finishCheck.CheckSignalNotReceived();
7774   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, fiftyPercentProgress, TEST_LOCATION);
7775
7776   application.SendNotification();
7777   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7778
7779   // We did expect the animation to finish
7780   application.SendNotification();
7781   finishCheck.CheckSignalReceived();
7782   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, targetX, TEST_LOCATION);
7783   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION);
7784   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7785   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7786   END_TEST;
7787 }
7788
7789 int UtcDaliAnimationAnimateToActorPositionYP(void)
7790 {
7791   TestApplication application;
7792
7793   Actor actor = Actor::New();
7794   application.GetScene().Add(actor);
7795   float startValue(0.0f);
7796   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, startValue, TEST_LOCATION);
7797   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7798   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7799   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7800
7801   // Build the animation
7802   float     durationSeconds(1.0f);
7803   Animation animation = Animation::New(durationSeconds);
7804   float     targetY(10.0f);
7805   animation.AnimateTo(Property(actor, Actor::Property::POSITION_Y), targetY);
7806
7807   float fiftyPercentProgress(startValue + (targetY - startValue) * 0.5f);
7808
7809   // Should return the initial properties before play
7810   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7811   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7812
7813   // Start the animation
7814   animation.Play();
7815
7816   // Should return the target property after play
7817   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, targetY, 0.0f), TEST_LOCATION);
7818   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION);
7819
7820   bool                 signalReceived(false);
7821   AnimationFinishCheck finishCheck(signalReceived);
7822   animation.FinishedSignal().Connect(&application, finishCheck);
7823
7824   application.SendNotification();
7825   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7826
7827   // We didn't expect the animation to finish yet
7828   application.SendNotification();
7829   finishCheck.CheckSignalNotReceived();
7830   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, fiftyPercentProgress, TEST_LOCATION);
7831
7832   application.SendNotification();
7833   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7834
7835   // We did expect the animation to finish
7836   application.SendNotification();
7837   finishCheck.CheckSignalReceived();
7838   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, targetY, TEST_LOCATION);
7839   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7840   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION);
7841   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7842   END_TEST;
7843 }
7844
7845 int UtcDaliAnimationAnimateToActorPositionZP(void)
7846 {
7847   TestApplication application;
7848
7849   Actor actor = Actor::New();
7850   application.GetScene().Add(actor);
7851   float startValue(0.0f);
7852   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, startValue, TEST_LOCATION);
7853   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7854   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7855   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7856
7857   // Build the animation
7858   float     durationSeconds(1.0f);
7859   Animation animation = Animation::New(durationSeconds);
7860   float     targetZ(-5.0f);
7861   animation.AnimateTo(Property(actor, Actor::Property::POSITION_Z), targetZ);
7862
7863   float fiftyPercentProgress(startValue + (targetZ - startValue) * 0.5f);
7864
7865   // Should return the initial properties before play
7866   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7867   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7868
7869   // Start the animation
7870   animation.Play();
7871
7872   // Should return the target property after play
7873   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, targetZ), TEST_LOCATION);
7874   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION);
7875
7876   bool                 signalReceived(false);
7877   AnimationFinishCheck finishCheck(signalReceived);
7878   animation.FinishedSignal().Connect(&application, finishCheck);
7879
7880   application.SendNotification();
7881   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7882
7883   // We didn't expect the animation to finish yet
7884   application.SendNotification();
7885   finishCheck.CheckSignalNotReceived();
7886   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, fiftyPercentProgress, TEST_LOCATION);
7887
7888   application.SendNotification();
7889   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7890
7891   // We did expect the animation to finish
7892   application.SendNotification();
7893   finishCheck.CheckSignalReceived();
7894   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, targetZ, TEST_LOCATION);
7895   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7896   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7897   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION);
7898   END_TEST;
7899 }
7900
7901 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void)
7902 {
7903   TestApplication application;
7904
7905   Actor actor = Actor::New();
7906   application.GetScene().Add(actor);
7907   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7908
7909   // Build the animation
7910   float     durationSeconds(1.0f);
7911   Animation animation = Animation::New(durationSeconds);
7912   Vector3   targetPosition(200.0f, 200.0f, 200.0f);
7913   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
7914
7915   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7916
7917   // Start the animation
7918   animation.Play();
7919
7920   bool                 signalReceived(false);
7921   AnimationFinishCheck finishCheck(signalReceived);
7922   animation.FinishedSignal().Connect(&application, finishCheck);
7923
7924   application.SendNotification();
7925   application.Render(static_cast<unsigned int>(durationSeconds * 750.0f) /* 75% progress */);
7926
7927   // We didn't expect the animation to finish yet
7928   application.SendNotification();
7929   finishCheck.CheckSignalNotReceived();
7930
7931   // The position should have moved less, than with a linear alpha function
7932   Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
7933   DALI_TEST_CHECK(current.x > Vector3::ZERO.x);
7934   DALI_TEST_CHECK(current.y > Vector3::ZERO.y);
7935   DALI_TEST_CHECK(current.z > Vector3::ZERO.z);
7936   DALI_TEST_CHECK(current.x < seventyFivePercentProgress.x);
7937   DALI_TEST_CHECK(current.y < seventyFivePercentProgress.y);
7938   DALI_TEST_CHECK(current.z < seventyFivePercentProgress.z);
7939
7940   application.SendNotification();
7941   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7942
7943   // We did expect the animation to finish
7944   application.SendNotification();
7945   finishCheck.CheckSignalReceived();
7946   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7947   END_TEST;
7948 }
7949
7950 int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void)
7951 {
7952   TestApplication application;
7953
7954   Actor actor = Actor::New();
7955   application.GetScene().Add(actor);
7956   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7957
7958   // Build the animation
7959   float     durationSeconds(1.0f);
7960   Animation animation = Animation::New(durationSeconds);
7961   Vector3   targetPosition(200.0f, 200.0f, 200.0f);
7962   float     delay = 0.5f;
7963   animation.AnimateTo(Property(actor, Actor::Property::POSITION),
7964                       targetPosition,
7965                       TimePeriod(delay, durationSeconds - delay));
7966
7967   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7968
7969   // Start the animation
7970   animation.Play();
7971
7972   bool                 signalReceived(false);
7973   AnimationFinishCheck finishCheck(signalReceived);
7974   animation.FinishedSignal().Connect(&application, finishCheck);
7975
7976   application.SendNotification();
7977   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7978
7979   // We didn't expect the animation to finish yet
7980   application.SendNotification();
7981   finishCheck.CheckSignalNotReceived();
7982   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7983
7984   application.SendNotification();
7985   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.75) /* 7/8 animation progress, 3/4 animator progress */);
7986
7987   // We didn't expect the animation to finish yet
7988   application.SendNotification();
7989   finishCheck.CheckSignalNotReceived();
7990   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION);
7991
7992   application.SendNotification();
7993   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.25) + 1u /*just beyond the animation duration*/);
7994
7995   // We did expect the animation to finish
7996   application.SendNotification();
7997   finishCheck.CheckSignalReceived();
7998   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7999   END_TEST;
8000 }
8001
8002 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void)
8003 {
8004   TestApplication application;
8005
8006   Actor actor = Actor::New();
8007   application.GetScene().Add(actor);
8008   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
8009
8010   // Build the animation
8011   float     durationSeconds(1.0f);
8012   Animation animation = Animation::New(durationSeconds);
8013   Vector3   targetPosition(200.0f, 200.0f, 200.0f);
8014   float     delay = 0.5f;
8015   animation.AnimateTo(Property(actor, Actor::Property::POSITION),
8016                       targetPosition,
8017                       AlphaFunction::LINEAR,
8018                       TimePeriod(delay, durationSeconds - delay));
8019
8020   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
8021
8022   // Start the animation
8023   animation.Play();
8024
8025   bool                 signalReceived(false);
8026   AnimationFinishCheck finishCheck(signalReceived);
8027   animation.FinishedSignal().Connect(&application, finishCheck);
8028
8029   application.SendNotification();
8030   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
8031
8032   // We didn't expect the animation to finish yet
8033   application.SendNotification();
8034   finishCheck.CheckSignalNotReceived();
8035   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
8036
8037   application.SendNotification();
8038   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.75) /* 7/8 animation progress, 3/4 animator progress */);
8039
8040   // We didn't expect the animation to finish yet
8041   application.SendNotification();
8042   finishCheck.CheckSignalNotReceived();
8043   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION);
8044
8045   application.SendNotification();
8046   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.25) + 1u /*just beyond the animation duration*/);
8047
8048   // We did expect the animation to finish
8049   application.SendNotification();
8050   finishCheck.CheckSignalReceived();
8051   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
8052   END_TEST;
8053 }
8054
8055 int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void)
8056 {
8057   TestApplication application;
8058
8059   Actor actor = Actor::New();
8060   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8061   application.GetScene().Add(actor);
8062   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8063
8064   // Build the animation
8065   float     durationSeconds(1.0f);
8066   Animation animation = Animation::New(durationSeconds);
8067   Degree    targetRotationDegrees(90.0f);
8068   Radian    targetRotationRadians(targetRotationDegrees);
8069   animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS));
8070
8071   // Start the animation
8072   animation.Play();
8073
8074   // Target value should be retrievable straight away
8075   DALI_TEST_EQUALS(actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8076
8077   bool                 signalReceived(false);
8078   AnimationFinishCheck finishCheck(signalReceived);
8079   animation.FinishedSignal().Connect(&application, finishCheck);
8080
8081   application.SendNotification();
8082   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8083
8084   // We didn't expect the animation to finish yet
8085   application.SendNotification();
8086   finishCheck.CheckSignalNotReceived();
8087   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8088
8089   application.SendNotification();
8090   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8091
8092   // We didn't expect the animation to finish yet
8093   application.SendNotification();
8094   finishCheck.CheckSignalNotReceived();
8095   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8096
8097   application.SendNotification();
8098   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8099
8100   // We didn't expect the animation to finish yet
8101   application.SendNotification();
8102   finishCheck.CheckSignalNotReceived();
8103   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8104
8105   application.SendNotification();
8106   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8107
8108   // We did expect the animation to finish
8109   application.SendNotification();
8110   finishCheck.CheckSignalReceived();
8111   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8112   END_TEST;
8113 }
8114
8115 int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void)
8116 {
8117   TestApplication application;
8118
8119   Actor actor = Actor::New();
8120   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8121   application.GetScene().Add(actor);
8122   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8123
8124   // Build the animation
8125   float      durationSeconds(1.0f);
8126   Animation  animation = Animation::New(durationSeconds);
8127   Degree     targetRotationDegrees(90.0f);
8128   Radian     targetRotationRadians(targetRotationDegrees);
8129   Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
8130   animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), targetRotation);
8131
8132   // Start the animation
8133   animation.Play();
8134
8135   bool                 signalReceived(false);
8136   AnimationFinishCheck finishCheck(signalReceived);
8137   animation.FinishedSignal().Connect(&application, finishCheck);
8138
8139   application.SendNotification();
8140   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8141
8142   // We didn't expect the animation to finish yet
8143   application.SendNotification();
8144   finishCheck.CheckSignalNotReceived();
8145   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8146
8147   application.SendNotification();
8148   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8149
8150   // We didn't expect the animation to finish yet
8151   application.SendNotification();
8152   finishCheck.CheckSignalNotReceived();
8153   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8154
8155   application.SendNotification();
8156   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8157
8158   // We didn't expect the animation to finish yet
8159   application.SendNotification();
8160   finishCheck.CheckSignalNotReceived();
8161   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8162
8163   application.SendNotification();
8164   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8165
8166   // We did expect the animation to finish
8167   application.SendNotification();
8168   finishCheck.CheckSignalReceived();
8169   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8170   END_TEST;
8171 }
8172
8173 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void)
8174 {
8175   TestApplication application;
8176
8177   Actor actor = Actor::New();
8178   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8179   application.GetScene().Add(actor);
8180   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8181
8182   // Build the animation
8183   float     durationSeconds(1.0f);
8184   Animation animation = Animation::New(durationSeconds);
8185   Degree    targetRotationDegrees(90.0f);
8186   Radian    targetRotationRadians(targetRotationDegrees);
8187   animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
8188
8189   // Start the animation
8190   animation.Play();
8191
8192   bool                 signalReceived(false);
8193   AnimationFinishCheck finishCheck(signalReceived);
8194   animation.FinishedSignal().Connect(&application, finishCheck);
8195
8196   application.SendNotification();
8197   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8198
8199   // We didn't expect the animation to finish yet
8200   application.SendNotification();
8201   finishCheck.CheckSignalNotReceived();
8202   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f * 0.25f * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8203
8204   application.SendNotification();
8205   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8206
8207   // We didn't expect the animation to finish yet
8208   application.SendNotification();
8209   finishCheck.CheckSignalNotReceived();
8210   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f * 0.5f * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8211
8212   application.SendNotification();
8213   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8214
8215   // We didn't expect the animation to finish yet
8216   application.SendNotification();
8217   finishCheck.CheckSignalNotReceived();
8218   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f * 0.75f * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8219
8220   application.SendNotification();
8221   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8222
8223   // We did expect the animation to finish
8224   application.SendNotification();
8225   finishCheck.CheckSignalReceived();
8226   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8227   END_TEST;
8228 }
8229
8230 int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void)
8231 {
8232   TestApplication application;
8233
8234   Actor actor = Actor::New();
8235   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8236   application.GetScene().Add(actor);
8237   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8238
8239   // Build the animation
8240   float     durationSeconds(1.0f);
8241   Animation animation = Animation::New(durationSeconds);
8242   Degree    targetRotationDegrees(90.0f);
8243   Radian    targetRotationRadians(targetRotationDegrees);
8244   float     delay(0.1f);
8245   animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
8246
8247   // Start the animation
8248   animation.Play();
8249
8250   bool                 signalReceived(false);
8251   AnimationFinishCheck finishCheck(signalReceived);
8252   animation.FinishedSignal().Connect(&application, finishCheck);
8253
8254   application.SendNotification();
8255   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8256
8257   // We didn't expect the animation to finish yet
8258   application.SendNotification();
8259   finishCheck.CheckSignalNotReceived();
8260   float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
8261   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8262
8263   application.SendNotification();
8264   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8265
8266   // We didn't expect the animation to finish yet
8267   application.SendNotification();
8268   finishCheck.CheckSignalNotReceived();
8269   progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
8270   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8271
8272   application.SendNotification();
8273   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8274
8275   // We didn't expect the animation to finish yet
8276   application.SendNotification();
8277   finishCheck.CheckSignalNotReceived();
8278   progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
8279   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8280
8281   application.SendNotification();
8282   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8283
8284   // We did expect the animation to finish
8285   application.SendNotification();
8286   finishCheck.CheckSignalReceived();
8287   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8288   END_TEST;
8289 }
8290
8291 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void)
8292 {
8293   TestApplication application;
8294
8295   Actor actor = Actor::New();
8296   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8297   application.GetScene().Add(actor);
8298   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8299
8300   // Build the animation
8301   float     durationSeconds(1.0f);
8302   Animation animation = Animation::New(durationSeconds);
8303   Degree    targetRotationDegrees(90.0f);
8304   Radian    targetRotationRadians(targetRotationDegrees);
8305   float     delay(0.1f);
8306   animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
8307
8308   // Start the animation
8309   animation.Play();
8310
8311   bool                 signalReceived(false);
8312   AnimationFinishCheck finishCheck(signalReceived);
8313   animation.FinishedSignal().Connect(&application, finishCheck);
8314
8315   application.SendNotification();
8316   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8317
8318   // We didn't expect the animation to finish yet
8319   application.SendNotification();
8320   finishCheck.CheckSignalNotReceived();
8321   float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
8322   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8323
8324   application.SendNotification();
8325   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8326
8327   // We didn't expect the animation to finish yet
8328   application.SendNotification();
8329   finishCheck.CheckSignalNotReceived();
8330   progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
8331   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8332
8333   application.SendNotification();
8334   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8335
8336   // We didn't expect the animation to finish yet
8337   application.SendNotification();
8338   finishCheck.CheckSignalNotReceived();
8339   progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
8340   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8341
8342   application.SendNotification();
8343   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8344
8345   // We did expect the animation to finish
8346   application.SendNotification();
8347   finishCheck.CheckSignalReceived();
8348   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8349   END_TEST;
8350 }
8351
8352 int UtcDaliAnimationAnimateToActorScaleP(void)
8353 {
8354   TestApplication application;
8355
8356   Actor actor = Actor::New();
8357   application.GetScene().Add(actor);
8358   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8359
8360   // Build the animation
8361   float     durationSeconds(1.0f);
8362   Animation animation = Animation::New(durationSeconds);
8363   Vector3   targetScale(2.0f, 2.0f, 2.0f);
8364   animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale);
8365
8366   Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE) * 0.99f);
8367
8368   // Start the animation
8369   animation.Play();
8370
8371   // Target value should be retrievable straight away
8372   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8373   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), targetScale.x, TEST_LOCATION);
8374   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), targetScale.y, TEST_LOCATION);
8375   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), targetScale.z, TEST_LOCATION);
8376
8377   bool                 signalReceived(false);
8378   AnimationFinishCheck finishCheck(signalReceived);
8379   animation.FinishedSignal().Connect(&application, finishCheck);
8380
8381   application.SendNotification();
8382   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
8383
8384   // We didn't expect the animation to finish yet
8385   application.SendNotification();
8386   finishCheck.CheckSignalNotReceived();
8387   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), ninetyNinePercentProgress, TEST_LOCATION);
8388
8389   application.SendNotification();
8390   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
8391
8392   // We did expect the animation to finish
8393   application.SendNotification();
8394   finishCheck.CheckSignalReceived();
8395   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8396
8397   // Reset everything
8398   finishCheck.Reset();
8399   actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
8400   application.SendNotification();
8401   application.Render(0);
8402   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8403
8404   // Repeat with a different (ease-in) alpha function
8405   animation = Animation::New(durationSeconds);
8406   animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
8407   animation.FinishedSignal().Connect(&application, finishCheck);
8408   animation.Play();
8409
8410   application.SendNotification();
8411   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
8412
8413   // We didn't expect the animation to finish yet
8414   application.SendNotification();
8415   finishCheck.CheckSignalNotReceived();
8416
8417   // The scale should have grown less, than with a linear alpha function
8418   Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
8419   DALI_TEST_CHECK(current.x > 1.0f);
8420   DALI_TEST_CHECK(current.y > 1.0f);
8421   DALI_TEST_CHECK(current.z > 1.0f);
8422   DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
8423   DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
8424   DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z);
8425
8426   application.SendNotification();
8427   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
8428
8429   // We did expect the animation to finish
8430   application.SendNotification();
8431   finishCheck.CheckSignalReceived();
8432   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8433
8434   // Reset everything
8435   finishCheck.Reset();
8436   actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
8437   application.SendNotification();
8438   application.Render(0);
8439   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8440
8441   // Repeat with a delay
8442   float delay = 0.5f;
8443   animation   = Animation::New(durationSeconds);
8444   animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
8445   animation.FinishedSignal().Connect(&application, finishCheck);
8446   animation.Play();
8447
8448   application.SendNotification();
8449   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
8450
8451   // We didn't expect the animation to finish yet
8452   application.SendNotification();
8453   finishCheck.CheckSignalNotReceived();
8454   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8455
8456   application.SendNotification();
8457   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8458
8459   // We did expect the animation to finish
8460   application.SendNotification();
8461   finishCheck.CheckSignalReceived();
8462   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8463   END_TEST;
8464 }
8465
8466 int UtcDaliAnimationAnimateToActorScaleXP(void)
8467 {
8468   TestApplication application;
8469
8470   Actor actor = Actor::New();
8471   application.GetScene().Add(actor);
8472   float startValue(1.0f);
8473   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, startValue, TEST_LOCATION);
8474   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8475   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8476   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8477   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8478   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8479   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8480
8481   // Build the animation
8482   float     durationSeconds(1.0f);
8483   Animation animation = Animation::New(durationSeconds);
8484   float     targetX(10.0f);
8485   animation.AnimateTo(Property(actor, Actor::Property::SCALE_X), targetX);
8486
8487   float fiftyPercentProgress(startValue + (targetX - startValue) * 0.5f);
8488
8489   // Start the animation
8490   animation.Play();
8491
8492   // Target value should be retrievable straight away
8493   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3(targetX, startValue, startValue), TEST_LOCATION);
8494   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), targetX, TEST_LOCATION);
8495
8496   bool                 signalReceived(false);
8497   AnimationFinishCheck finishCheck(signalReceived);
8498   animation.FinishedSignal().Connect(&application, finishCheck);
8499
8500   application.SendNotification();
8501   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8502
8503   // We didn't expect the animation to finish yet
8504   application.SendNotification();
8505   finishCheck.CheckSignalNotReceived();
8506   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, fiftyPercentProgress, TEST_LOCATION);
8507   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), fiftyPercentProgress, TEST_LOCATION);
8508   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8509   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8510
8511   application.SendNotification();
8512   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8513
8514   // We did expect the animation to finish
8515   application.SendNotification();
8516   finishCheck.CheckSignalReceived();
8517   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, targetX, TEST_LOCATION);
8518   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), targetX, TEST_LOCATION);
8519   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8520   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8521   END_TEST;
8522 }
8523
8524 int UtcDaliAnimationAnimateToActorScaleYP(void)
8525 {
8526   TestApplication application;
8527
8528   Actor actor = Actor::New();
8529   application.GetScene().Add(actor);
8530   float startValue(1.0f);
8531   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, startValue, TEST_LOCATION);
8532   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8533   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8534   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8535   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8536   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8537   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8538
8539   // Build the animation
8540   float     durationSeconds(1.0f);
8541   Animation animation = Animation::New(durationSeconds);
8542   float     targetY(1000.0f);
8543   animation.AnimateTo(Property(actor, Actor::Property::SCALE_Y), targetY);
8544
8545   float fiftyPercentProgress(startValue + (targetY - startValue) * 0.5f);
8546
8547   // Start the animation
8548   animation.Play();
8549
8550   // Target value should be retrievable straight away
8551   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3(startValue, targetY, startValue), TEST_LOCATION);
8552   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), targetY, TEST_LOCATION);
8553
8554   bool                 signalReceived(false);
8555   AnimationFinishCheck finishCheck(signalReceived);
8556   animation.FinishedSignal().Connect(&application, finishCheck);
8557
8558   application.SendNotification();
8559   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8560
8561   // We didn't expect the animation to finish yet
8562   application.SendNotification();
8563   finishCheck.CheckSignalNotReceived();
8564   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, fiftyPercentProgress, TEST_LOCATION);
8565   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8566   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), fiftyPercentProgress, TEST_LOCATION);
8567   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8568
8569   application.SendNotification();
8570   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8571
8572   // We did expect the animation to finish
8573   application.SendNotification();
8574   finishCheck.CheckSignalReceived();
8575   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, targetY, TEST_LOCATION);
8576   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8577   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), targetY, TEST_LOCATION);
8578   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8579   END_TEST;
8580 }
8581
8582 int UtcDaliAnimationAnimateToActorScaleZP(void)
8583 {
8584   TestApplication application;
8585
8586   Actor actor = Actor::New();
8587   application.GetScene().Add(actor);
8588   float startValue(1.0f);
8589   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, startValue, TEST_LOCATION);
8590   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8591   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8592   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8593   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8594   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8595   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8596
8597   // Build the animation
8598   float     durationSeconds(1.0f);
8599   Animation animation = Animation::New(durationSeconds);
8600   float     targetZ(-1000.0f);
8601   animation.AnimateTo(Property(actor, Actor::Property::SCALE_Z), targetZ);
8602
8603   float fiftyPercentProgress(startValue + (targetZ - startValue) * 0.5f);
8604
8605   // Start the animation
8606   animation.Play();
8607
8608   // Target value should be retrievable straight away
8609   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3(startValue, startValue, targetZ), TEST_LOCATION);
8610   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), targetZ, TEST_LOCATION);
8611
8612   bool                 signalReceived(false);
8613   AnimationFinishCheck finishCheck(signalReceived);
8614   animation.FinishedSignal().Connect(&application, finishCheck);
8615
8616   application.SendNotification();
8617   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8618
8619   // We didn't expect the animation to finish yet
8620   application.SendNotification();
8621   finishCheck.CheckSignalNotReceived();
8622   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, fiftyPercentProgress, TEST_LOCATION);
8623   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8624   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8625   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), fiftyPercentProgress, TEST_LOCATION);
8626
8627   application.SendNotification();
8628   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8629
8630   // We did expect the animation to finish
8631   application.SendNotification();
8632   finishCheck.CheckSignalReceived();
8633   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, targetZ, TEST_LOCATION);
8634   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8635   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8636   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), targetZ, TEST_LOCATION);
8637   END_TEST;
8638 }
8639
8640 int UtcDaliAnimationAnimateToActorColorP(void)
8641 {
8642   TestApplication application;
8643
8644   Actor actor = Actor::New();
8645   application.GetScene().Add(actor);
8646   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
8647
8648   // Build the animation
8649   float     durationSeconds(1.0f);
8650   Animation animation = Animation::New(durationSeconds);
8651   Vector4   targetColor(Color::RED);
8652   animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor);
8653
8654   Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
8655   Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
8656
8657   // Start the animation
8658   animation.Play();
8659
8660   // Target value should be retrievable straight away
8661   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8662   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION);
8663   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION);
8664   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION);
8665   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION);
8666   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::OPACITY), targetColor.a, TEST_LOCATION);
8667
8668   bool                 signalReceived(false);
8669   AnimationFinishCheck finishCheck(signalReceived);
8670   animation.FinishedSignal().Connect(&application, finishCheck);
8671
8672   application.SendNotification();
8673   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
8674
8675   // We didn't expect the animation to finish yet
8676   application.SendNotification();
8677   finishCheck.CheckSignalNotReceived();
8678   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), tenPercentProgress, TEST_LOCATION);
8679
8680   application.SendNotification();
8681   application.Render(static_cast<unsigned int>(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/);
8682
8683   // We did expect the animation to finish
8684   application.SendNotification();
8685   finishCheck.CheckSignalReceived();
8686   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8687
8688   // Reset everything
8689   finishCheck.Reset();
8690   actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
8691   application.SendNotification();
8692   application.Render(0);
8693   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
8694
8695   // Repeat with a different (ease-in) alpha function
8696   animation = Animation::New(durationSeconds);
8697   animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
8698   animation.FinishedSignal().Connect(&application, finishCheck);
8699   animation.Play();
8700
8701   application.SendNotification();
8702   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
8703
8704   // We didn't expect the animation to finish yet
8705   application.SendNotification();
8706   finishCheck.CheckSignalNotReceived();
8707
8708   // The color should have changed less, than with a linear alpha function
8709   Vector4 current(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
8710   DALI_TEST_CHECK(current.x == 1.0f); // doesn't change
8711   DALI_TEST_CHECK(current.y < 1.0f);
8712   DALI_TEST_CHECK(current.y > tenPercentProgress.y);
8713   DALI_TEST_CHECK(current.z < 1.0f);
8714   DALI_TEST_CHECK(current.z > tenPercentProgress.z);
8715   DALI_TEST_CHECK(current.w == 1.0f); // doesn't change
8716
8717   application.SendNotification();
8718   application.Render(static_cast<unsigned int>(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/);
8719
8720   // We did expect the animation to finish
8721   application.SendNotification();
8722   finishCheck.CheckSignalReceived();
8723   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8724
8725   // Reset everything
8726   finishCheck.Reset();
8727   actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
8728   application.SendNotification();
8729   application.Render(0);
8730   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
8731
8732   // Repeat with a shorter animator duration
8733   float animatorDuration = 0.5f;
8734   animation              = Animation::New(durationSeconds);
8735   animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
8736   animation.FinishedSignal().Connect(&application, finishCheck);
8737   animation.Play();
8738
8739   application.SendNotification();
8740   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% animation progress, 20% animator progress */);
8741
8742   // We didn't expect the animation to finish yet
8743   application.SendNotification();
8744   finishCheck.CheckSignalNotReceived();
8745   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), twentyPercentProgress, TEST_LOCATION);
8746
8747   application.SendNotification();
8748   application.Render(static_cast<unsigned int>(durationSeconds * 400.0f) /* 50% animation progress, 100% animator progress */);
8749
8750   // We didn't expect the animation to finish yet
8751   application.SendNotification();
8752   finishCheck.CheckSignalNotReceived();
8753   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8754
8755   application.SendNotification();
8756   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8757
8758   // We did expect the animation to finish
8759   application.SendNotification();
8760   finishCheck.CheckSignalReceived();
8761   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8762   END_TEST;
8763 }
8764
8765 int UtcDaliAnimationAnimateToActorColorRedP(void)
8766 {
8767   TestApplication application;
8768
8769   Actor actor = Actor::New();
8770   application.GetScene().Add(actor);
8771   float startValue(1.0f);
8772   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, startValue, TEST_LOCATION);
8773   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8774   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8775   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8776   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8777   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8778   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8779   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8780   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8781
8782   // Build the animation
8783   float     durationSeconds(1.0f);
8784   Animation animation = Animation::New(durationSeconds);
8785   float     targetRed(0.5f);
8786   animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetRed);
8787
8788   float fiftyPercentProgress(startValue + (targetRed - startValue) * 0.5f);
8789
8790   // Start the animation
8791   animation.Play();
8792
8793   // Target value should be retrievable straight away
8794   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(targetRed, startValue, startValue, startValue), TEST_LOCATION);
8795   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetRed, TEST_LOCATION);
8796
8797   bool                 signalReceived(false);
8798   AnimationFinishCheck finishCheck(signalReceived);
8799   animation.FinishedSignal().Connect(&application, finishCheck);
8800
8801   application.SendNotification();
8802   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8803
8804   // We didn't expect the animation to finish yet
8805   application.SendNotification();
8806   finishCheck.CheckSignalNotReceived();
8807   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, fiftyPercentProgress, TEST_LOCATION);
8808   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION);
8809   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8810   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8811   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8812
8813   application.SendNotification();
8814   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8815
8816   // We did expect the animation to finish
8817   application.SendNotification();
8818   finishCheck.CheckSignalReceived();
8819   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, targetRed, TEST_LOCATION);
8820   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), targetRed, TEST_LOCATION);
8821   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8822   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8823   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8824   END_TEST;
8825 }
8826
8827 int UtcDaliAnimationAnimateToActorColorGreenP(void)
8828 {
8829   TestApplication application;
8830
8831   Actor actor = Actor::New();
8832   application.GetScene().Add(actor);
8833   float startValue(1.0f);
8834   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, startValue, TEST_LOCATION);
8835   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8836   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8837   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8838   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8839   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8840   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8841   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8842   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8843
8844   // Build the animation
8845   float     durationSeconds(1.0f);
8846   Animation animation = Animation::New(durationSeconds);
8847   float     targetGreen(0.5f);
8848   animation.AnimateTo(Property(actor, Actor::Property::COLOR_GREEN), targetGreen);
8849
8850   float fiftyPercentProgress(startValue + (targetGreen - startValue) * 0.5f);
8851
8852   // Start the animation
8853   animation.Play();
8854
8855   // Target value should be retrievable straight away
8856   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(startValue, targetGreen, startValue, startValue), TEST_LOCATION);
8857   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION);
8858
8859   bool                 signalReceived(false);
8860   AnimationFinishCheck finishCheck(signalReceived);
8861   animation.FinishedSignal().Connect(&application, finishCheck);
8862
8863   application.SendNotification();
8864   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8865
8866   // We didn't expect the animation to finish yet
8867   application.SendNotification();
8868   finishCheck.CheckSignalNotReceived();
8869   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, fiftyPercentProgress, TEST_LOCATION);
8870   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8871   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION);
8872   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8873   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8874
8875   application.SendNotification();
8876   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8877
8878   // We did expect the animation to finish
8879   application.SendNotification();
8880   finishCheck.CheckSignalReceived();
8881   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, targetGreen, TEST_LOCATION);
8882   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8883   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION);
8884   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8885   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8886   END_TEST;
8887 }
8888
8889 int UtcDaliAnimationAnimateToActorColorBlueP(void)
8890 {
8891   TestApplication application;
8892
8893   Actor actor = Actor::New();
8894   application.GetScene().Add(actor);
8895   float startValue(1.0f);
8896   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, startValue, TEST_LOCATION);
8897   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8898   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8899   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8900   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8901   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8902   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8903   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8904   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8905
8906   // Build the animation
8907   float     durationSeconds(1.0f);
8908   Animation animation = Animation::New(durationSeconds);
8909   float     targetBlue(0.5f);
8910   animation.AnimateTo(Property(actor, Actor::Property::COLOR_BLUE), targetBlue);
8911
8912   float fiftyPercentProgress(startValue + (targetBlue - startValue) * 0.5f);
8913
8914   // Start the animation
8915   animation.Play();
8916
8917   // Target value should be retrievable straight away
8918   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(startValue, startValue, targetBlue, startValue), TEST_LOCATION);
8919   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetBlue, TEST_LOCATION);
8920
8921   bool                 signalReceived(false);
8922   AnimationFinishCheck finishCheck(signalReceived);
8923   animation.FinishedSignal().Connect(&application, finishCheck);
8924
8925   application.SendNotification();
8926   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8927
8928   // We didn't expect the animation to finish yet
8929   application.SendNotification();
8930   finishCheck.CheckSignalNotReceived();
8931   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, fiftyPercentProgress, TEST_LOCATION);
8932   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8933   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8934   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), fiftyPercentProgress, TEST_LOCATION);
8935   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8936
8937   application.SendNotification();
8938   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8939
8940   // We did expect the animation to finish
8941   application.SendNotification();
8942   finishCheck.CheckSignalReceived();
8943   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, targetBlue, TEST_LOCATION);
8944   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8945   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8946   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), targetBlue, TEST_LOCATION);
8947   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8948   END_TEST;
8949 }
8950
8951 int UtcDaliAnimationAnimateToActorColorAlphaP(void)
8952 {
8953   TestApplication application;
8954
8955   Actor actor = Actor::New();
8956   application.GetScene().Add(actor);
8957   float startValue(1.0f);
8958   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
8959   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8960   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8961   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8962   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8963   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8964   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8965   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8966   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8967
8968   // Build the animation
8969   float     durationSeconds(1.0f);
8970   Animation animation = Animation::New(durationSeconds);
8971   float     targetAlpha(0.5f);
8972   animation.AnimateTo(Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha);
8973
8974   float fiftyPercentProgress(startValue + (targetAlpha - startValue) * 0.5f);
8975
8976   // Start the animation
8977   animation.Play();
8978
8979   // Target value should be retrievable straight away
8980   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(startValue, startValue, startValue, targetAlpha), TEST_LOCATION);
8981   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetAlpha, TEST_LOCATION);
8982   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::OPACITY), targetAlpha, TEST_LOCATION);
8983
8984   bool                 signalReceived(false);
8985   AnimationFinishCheck finishCheck(signalReceived);
8986   animation.FinishedSignal().Connect(&application, finishCheck);
8987
8988   application.SendNotification();
8989   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8990
8991   // We didn't expect the animation to finish yet
8992   application.SendNotification();
8993   finishCheck.CheckSignalNotReceived();
8994   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, fiftyPercentProgress, TEST_LOCATION);
8995   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8996   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8997   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8998   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), fiftyPercentProgress, TEST_LOCATION);
8999
9000   application.SendNotification();
9001   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
9002
9003   // We did expect the animation to finish
9004   application.SendNotification();
9005   finishCheck.CheckSignalReceived();
9006   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, targetAlpha, TEST_LOCATION);
9007   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9008   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9009   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9010   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), targetAlpha, TEST_LOCATION);
9011   END_TEST;
9012 }
9013
9014 int UtcDaliAnimationKeyFrames01P(void)
9015 {
9016   TestApplication application;
9017
9018   KeyFrames keyFrames = KeyFrames::New();
9019   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9020
9021   keyFrames.Add(0.0f, 0.1f);
9022
9023   DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
9024
9025   KeyFrames keyFrames2(keyFrames);
9026   DALI_TEST_CHECK(keyFrames2);
9027   DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
9028
9029   KeyFrames keyFrames3 = KeyFrames::New();
9030   keyFrames3.Add(0.6f, true);
9031   DALI_TEST_CHECK(keyFrames3);
9032   DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
9033
9034   keyFrames3 = keyFrames;
9035   DALI_TEST_CHECK(keyFrames3);
9036   DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
9037
9038   END_TEST;
9039 }
9040
9041 int UtcDaliAnimationKeyFrames02N(void)
9042 {
9043   TestApplication application;
9044
9045   KeyFrames keyFrames = KeyFrames::New();
9046   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9047
9048   keyFrames.Add(0.0f, 0.1f);
9049   keyFrames.Add(0.2f, 0.5f);
9050   keyFrames.Add(0.4f, 0.0f);
9051   keyFrames.Add(0.6f, 1.0f);
9052   keyFrames.Add(0.8f, 0.7f);
9053   keyFrames.Add(1.0f, 0.9f);
9054
9055   DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
9056
9057   DALI_TEST_ASSERTION(
9058     {
9059       keyFrames.Add(1.9f, false);
9060     },
9061     "mType == value.GetType()");
9062
9063   END_TEST;
9064 }
9065
9066 int UtcDaliAnimationKeyFrames03N(void)
9067 {
9068   TestApplication application;
9069
9070   KeyFrames keyFrames = KeyFrames::New();
9071   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9072
9073   keyFrames.Add(0.0f, true);
9074   keyFrames.Add(0.2f, false);
9075   keyFrames.Add(0.4f, false);
9076   keyFrames.Add(0.6f, true);
9077   keyFrames.Add(0.8f, true);
9078   keyFrames.Add(1.0f, false);
9079
9080   DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
9081
9082   DALI_TEST_ASSERTION(
9083     {
9084       keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
9085     },
9086     "mType == value.GetType()");
9087
9088   END_TEST;
9089 }
9090
9091 int UtcDaliAnimationKeyFrames04N(void)
9092 {
9093   TestApplication application;
9094
9095   KeyFrames keyFrames = KeyFrames::New();
9096   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9097
9098   keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
9099   keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
9100   keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
9101   keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
9102   keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
9103   keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
9104
9105   DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
9106
9107   DALI_TEST_ASSERTION(
9108     {
9109       keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
9110     },
9111     "mType == value.GetType()");
9112
9113   END_TEST;
9114 }
9115
9116 int UtcDaliAnimationKeyFrames05N(void)
9117 {
9118   TestApplication application;
9119
9120   KeyFrames keyFrames = KeyFrames::New();
9121   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9122
9123   keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
9124   keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
9125   keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
9126   keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
9127   keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
9128   keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
9129
9130   DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
9131
9132   DALI_TEST_ASSERTION(
9133     {
9134       keyFrames.Add(0.7f, 1.0f);
9135     },
9136     "mType == value.GetType()");
9137
9138   END_TEST;
9139 }
9140
9141 int UtcDaliAnimationKeyFrames06N(void)
9142 {
9143   TestApplication application;
9144
9145   KeyFrames keyFrames = KeyFrames::New();
9146   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9147
9148   keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
9149   keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9150   keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
9151   keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
9152   keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
9153   keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
9154
9155   DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
9156
9157   DALI_TEST_ASSERTION(
9158     {
9159       keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
9160     },
9161     "mType == value.GetType()");
9162
9163   END_TEST;
9164 }
9165
9166 int UtcDaliAnimationKeyFrames07N(void)
9167 {
9168   TestApplication application;
9169
9170   KeyFrames keyFrames = KeyFrames::New();
9171   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9172
9173   keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
9174   keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
9175   keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
9176   keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
9177   keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
9178   keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
9179
9180   DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
9181
9182   DALI_TEST_ASSERTION(
9183     {
9184       keyFrames.Add(0.7f, 1.1f);
9185     },
9186     "mType == value.GetType()");
9187
9188   END_TEST;
9189 }
9190
9191 int UtcDaliAnimationKeyFramesGetKeyFrameCountP(void)
9192 {
9193   TestApplication application;
9194
9195   KeyFrames keyFrames = KeyFrames::New();
9196   keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.6f));
9197   keyFrames.Add(0.6f, Vector4(0.0f, 0.0f, 0.0f, 0.3f));
9198   keyFrames.Add(1.0f, Vector4(0.0f, 0.0f, 0.0f, 0.8f));
9199
9200   DALI_TEST_EQUALS(DevelKeyFrames::GetKeyFrameCount(keyFrames), 3, TEST_LOCATION);
9201
9202   END_TEST;
9203 }
9204
9205 int UtcDaliAnimationKeyFramesGetKeyFrameP(void)
9206 {
9207   TestApplication application;
9208
9209   float inputTime = 0.6f;
9210   Vector4 inputValue = Vector4(0.0f, 0.0f, 0.0f, 0.3f);
9211
9212   KeyFrames keyFrames = KeyFrames::New();
9213   keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.6f));
9214   keyFrames.Add(inputTime, inputValue);
9215   keyFrames.Add(1.0f, Vector4(0.0f, 0.0f, 0.0f, 0.8f));
9216
9217   float outputTime;
9218   Property::Value outputValue;
9219
9220   DevelKeyFrames::GetKeyFrame(keyFrames, 3, outputTime, outputValue);
9221
9222   DALI_TEST_EQUALS(outputValue.GetType(), Property::Type::NONE, TEST_LOCATION);
9223
9224   DevelKeyFrames::GetKeyFrame(keyFrames, 1, outputTime, outputValue);
9225
9226   DALI_TEST_EQUALS(outputTime, inputTime, TEST_LOCATION);
9227   DALI_TEST_EQUALS(outputValue.GetType(), Property::Type::VECTOR4, TEST_LOCATION);
9228   DALI_TEST_EQUALS(outputValue.Get<Vector4>(), inputValue, TEST_LOCATION);
9229
9230   END_TEST;
9231 }
9232
9233 int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
9234 {
9235   TestApplication application;
9236
9237   float startValue(1.0f);
9238   Actor actor = Actor::New();
9239   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9240   application.GetScene().Add(actor);
9241
9242   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9243   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9244   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9245   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9246   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9247   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9248   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9249   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9250   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9251
9252   // Build the animation
9253   float     durationSeconds(1.0f);
9254   Animation animation = Animation::New(durationSeconds);
9255
9256   KeyFrames keyFrames = KeyFrames::New();
9257   keyFrames.Add(0.0f, 0.1f);
9258   keyFrames.Add(0.2f, 0.5f);
9259   keyFrames.Add(0.4f, 0.0f);
9260   keyFrames.Add(0.6f, 1.0f);
9261   keyFrames.Add(0.8f, 0.7f);
9262   keyFrames.Add(1.0f, 0.9f);
9263
9264   animation.AnimateBetween(Property(actor, Actor::Property::COLOR_ALPHA), keyFrames);
9265
9266   // Start the animation
9267   animation.Play();
9268
9269   // Final key frame value should be retrievable straight away
9270   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, TEST_LOCATION);
9271
9272   bool                 signalReceived(false);
9273   AnimationFinishCheck finishCheck(signalReceived);
9274   animation.FinishedSignal().Connect(&application, finishCheck);
9275   application.SendNotification();
9276   application.Render(0);
9277   application.SendNotification();
9278   finishCheck.CheckSignalNotReceived();
9279   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.1f, TEST_LOCATION);
9280
9281   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
9282   application.SendNotification();
9283   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9284   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9285   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9286   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION);
9287   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.3f, 0.01f, TEST_LOCATION);
9288
9289   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% progress */);
9290   application.SendNotification();
9291   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9292   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9293   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9294   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION);
9295   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.25f, 0.01f, TEST_LOCATION);
9296
9297   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 40% progress */);
9298   application.SendNotification();
9299   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9300   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9301   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9302   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION);
9303   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.0f, 0.01f, TEST_LOCATION);
9304
9305   application.Render(static_cast<unsigned int>(durationSeconds * 400.0f) /* 80% progress */);
9306   application.SendNotification();
9307   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9308   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9309   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9310   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION);
9311   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.7f, 0.01f, TEST_LOCATION);
9312
9313   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 90% progress */);
9314   application.SendNotification();
9315   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9316   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9317   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9318   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION);
9319   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.8f, 0.01f, TEST_LOCATION);
9320
9321   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1 /* 100% progress */);
9322   application.SendNotification();
9323   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9324   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9325   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9326   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION);
9327   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.9f, 0.01f, TEST_LOCATION);
9328
9329   // We did expect the animation to finish
9330
9331   finishCheck.CheckSignalReceived();
9332   END_TEST;
9333 }
9334
9335 int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
9336 {
9337   TestApplication application;
9338
9339   float startValue(1.0f);
9340   Actor actor = Actor::New();
9341   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9342   application.GetScene().Add(actor);
9343
9344   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9345   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9346   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9347   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9348   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9349   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9350   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9351   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9352   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9353
9354   // Build the animation
9355   float     durationSeconds(1.0f);
9356   Animation animation = Animation::New(durationSeconds);
9357
9358   KeyFrames keyFrames = KeyFrames::New();
9359   keyFrames.Add(0.0f, 0.1f);
9360   keyFrames.Add(0.2f, 0.5f);
9361   keyFrames.Add(0.4f, 0.0f);
9362   keyFrames.Add(0.6f, 1.0f);
9363   keyFrames.Add(0.8f, 0.7f);
9364   keyFrames.Add(1.0f, 0.9f);
9365
9366   animation.AnimateBetween(Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::CUBIC);
9367
9368   // Start the animation
9369   animation.Play();
9370
9371   bool                 signalReceived(false);
9372   AnimationFinishCheck finishCheck(signalReceived);
9373   animation.FinishedSignal().Connect(&application, finishCheck);
9374   application.SendNotification();
9375   application.Render(0);
9376   application.SendNotification();
9377   finishCheck.CheckSignalNotReceived();
9378   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.1f, TEST_LOCATION);
9379
9380   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
9381   application.SendNotification();
9382   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9383   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9384   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9385   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.36f, 0.01f, TEST_LOCATION);
9386   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.36f, 0.01f, TEST_LOCATION);
9387
9388   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% progress */);
9389   application.SendNotification();
9390   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9391   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9392   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9393   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.21f, 0.01f, TEST_LOCATION);
9394   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.21f, 0.01f, TEST_LOCATION);
9395
9396   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 40% progress */);
9397   application.SendNotification();
9398   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9399   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9400   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9401   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION);
9402   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.0f, 0.01f, TEST_LOCATION);
9403
9404   application.Render(static_cast<unsigned int>(durationSeconds * 400.0f) /* 80% progress */);
9405   application.SendNotification();
9406   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9407   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9408   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9409   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION);
9410   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.7f, 0.01f, TEST_LOCATION);
9411
9412   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 90% progress */);
9413   application.SendNotification();
9414   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9415   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9416   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9417   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.76f, 0.01f, TEST_LOCATION);
9418   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.76f, 0.01f, TEST_LOCATION);
9419
9420   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1 /* 100% progress */);
9421   application.SendNotification();
9422   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9423   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9424   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9425   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION);
9426   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.9f, 0.01f, TEST_LOCATION);
9427
9428   // We did expect the animation to finish
9429
9430   finishCheck.CheckSignalReceived();
9431   END_TEST;
9432 }
9433
9434 int UtcDaliAnimationAnimateBetweenActorColorP(void)
9435 {
9436   TestApplication application;
9437
9438   float startValue(1.0f);
9439   Actor actor = Actor::New();
9440   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9441   application.GetScene().Add(actor);
9442
9443   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9444   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9445   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9446   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9447   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9448   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9449   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9450   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9451   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9452
9453   // Build the animation
9454   float     durationSeconds(1.0f);
9455   Animation animation = Animation::New(durationSeconds);
9456
9457   KeyFrames keyFrames = KeyFrames::New();
9458   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9459   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9460   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9461
9462   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames);
9463
9464   // Start the animation
9465   animation.Play();
9466
9467   bool                 signalReceived(false);
9468   AnimationFinishCheck finishCheck(signalReceived);
9469   animation.FinishedSignal().Connect(&application, finishCheck);
9470   application.SendNotification();
9471   application.Render(0);
9472   application.SendNotification();
9473   finishCheck.CheckSignalNotReceived();
9474   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
9475   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
9476   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
9477   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
9478
9479   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9480   application.SendNotification();
9481   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
9482   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
9483   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
9484   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
9485
9486   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9487   application.SendNotification();
9488   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
9489   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
9490   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
9491   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
9492
9493   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9494   application.SendNotification();
9495   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
9496   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
9497   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
9498   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
9499
9500   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9501   application.SendNotification();
9502   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
9503   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
9504   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
9505   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
9506
9507   // We did expect the animation to finish
9508
9509   finishCheck.CheckSignalReceived();
9510   END_TEST;
9511 }
9512
9513 int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
9514 {
9515   TestApplication application;
9516
9517   float startValue(1.0f);
9518   Actor actor = Actor::New();
9519   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9520   application.GetScene().Add(actor);
9521
9522   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9523   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9524   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9525   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9526   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9527   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9528   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9529   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9530   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9531
9532   // Build the animation
9533   float     durationSeconds(1.0f);
9534   Animation animation = Animation::New(durationSeconds);
9535
9536   KeyFrames keyFrames = KeyFrames::New();
9537   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9538   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9539   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9540
9541   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, Animation::CUBIC);
9542
9543   // Start the animation
9544   animation.Play();
9545
9546   bool                 signalReceived(false);
9547   AnimationFinishCheck finishCheck(signalReceived);
9548   animation.FinishedSignal().Connect(&application, finishCheck);
9549   application.SendNotification();
9550   application.Render(0);
9551   application.SendNotification();
9552   finishCheck.CheckSignalNotReceived();
9553   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
9554   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
9555   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
9556   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
9557
9558   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9559   application.SendNotification();
9560   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
9561   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
9562   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
9563   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
9564
9565   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9566   application.SendNotification();
9567   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
9568   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
9569   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
9570   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
9571
9572   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9573   application.SendNotification();
9574   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
9575   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
9576   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
9577   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
9578
9579   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9580   application.SendNotification();
9581   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
9582   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
9583   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
9584   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
9585
9586   // We did expect the animation to finish
9587
9588   finishCheck.CheckSignalReceived();
9589   END_TEST;
9590 }
9591
9592 int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
9593 {
9594   TestApplication application;
9595
9596   Actor     actor = Actor::New();
9597   AngleAxis aa(Degree(90), Vector3::XAXIS);
9598   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9599   application.GetScene().Add(actor);
9600
9601   application.SendNotification();
9602   application.Render(0);
9603
9604   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9605
9606   // Build the animation
9607   float     durationSeconds(1.0f);
9608   Animation animation = Animation::New(durationSeconds);
9609
9610   KeyFrames keyFrames = KeyFrames::New();
9611   keyFrames.Add(0.0f, false);
9612   keyFrames.Add(0.2f, true);
9613   keyFrames.Add(0.4f, true);
9614   keyFrames.Add(0.8f, false);
9615   keyFrames.Add(1.0f, true);
9616
9617   animation.AnimateBetween(Property(actor, Actor::Property::VISIBLE), keyFrames);
9618
9619   // Start the animation
9620   animation.Play();
9621
9622   // Final key frame value should be retrievable straight away
9623   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9624
9625   bool                 signalReceived(false);
9626   AnimationFinishCheck finishCheck(signalReceived);
9627   animation.FinishedSignal().Connect(&application, finishCheck);
9628   application.SendNotification();
9629   application.SendNotification();
9630   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9631   application.SendNotification();
9632   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9633   application.SendNotification();
9634
9635   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9636   finishCheck.CheckSignalReceived();
9637   END_TEST;
9638 }
9639
9640 int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
9641 {
9642   TestApplication application;
9643
9644   Actor     actor = Actor::New();
9645   AngleAxis aa(Degree(90), Vector3::XAXIS);
9646   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9647   application.GetScene().Add(actor);
9648
9649   application.SendNotification();
9650   application.Render(0);
9651
9652   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9653
9654   // Build the animation
9655   float     durationSeconds(1.0f);
9656   Animation animation = Animation::New(durationSeconds);
9657
9658   KeyFrames keyFrames = KeyFrames::New();
9659   keyFrames.Add(0.0f, false);
9660   keyFrames.Add(0.2f, true);
9661   keyFrames.Add(0.4f, true);
9662   keyFrames.Add(0.8f, false);
9663   keyFrames.Add(1.0f, true);
9664
9665   //Cubic interpolation for boolean values should be ignored
9666   animation.AnimateBetween(Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::CUBIC);
9667
9668   // Start the animation
9669   animation.Play();
9670
9671   bool                 signalReceived(false);
9672   AnimationFinishCheck finishCheck(signalReceived);
9673   animation.FinishedSignal().Connect(&application, finishCheck);
9674   application.SendNotification();
9675   application.SendNotification();
9676   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9677   application.SendNotification();
9678   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9679   application.SendNotification();
9680
9681   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9682   finishCheck.CheckSignalReceived();
9683   END_TEST;
9684 }
9685
9686 int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
9687 {
9688   TestApplication application;
9689
9690   Actor     actor = Actor::New();
9691   AngleAxis aa(Degree(90), Vector3::XAXIS);
9692   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9693   application.GetScene().Add(actor);
9694
9695   application.SendNotification();
9696   application.Render(0);
9697   Quaternion start(Radian(aa.angle), aa.axis);
9698   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9699
9700   // Build the animation
9701   float     durationSeconds(1.0f);
9702   Animation animation = Animation::New(durationSeconds);
9703
9704   KeyFrames keyFrames = KeyFrames::New();
9705   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9706
9707   animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames);
9708
9709   // Start the animation
9710   animation.Play();
9711
9712   // Final key frame value should be retrievable straight away
9713   DALI_TEST_EQUALS(actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Degree(60), Vector3::ZAXIS), TEST_LOCATION);
9714
9715   bool                 signalReceived(false);
9716   AnimationFinishCheck finishCheck(signalReceived);
9717   animation.FinishedSignal().Connect(&application, finishCheck);
9718   application.SendNotification();
9719   application.SendNotification();
9720   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9721   application.SendNotification();
9722   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9723   application.SendNotification();
9724
9725   Quaternion check(Radian(Degree(60)), Vector3::ZAXIS);
9726
9727   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9728   finishCheck.CheckSignalReceived();
9729   END_TEST;
9730 }
9731
9732 int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
9733 {
9734   TestApplication application;
9735
9736   Actor     actor = Actor::New();
9737   AngleAxis aa(Degree(90), Vector3::XAXIS);
9738   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9739   application.SendNotification();
9740   application.Render(0);
9741   application.GetScene().Add(actor);
9742
9743   Quaternion start(Radian(aa.angle), aa.axis);
9744   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9745
9746   // Build the animation
9747   float     durationSeconds(1.0f);
9748   Animation animation = Animation::New(durationSeconds);
9749
9750   KeyFrames keyFrames = KeyFrames::New();
9751   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9752   keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9753   keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9754
9755   animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames);
9756
9757   // Start the animation
9758   animation.Play();
9759
9760   bool                 signalReceived(false);
9761   AnimationFinishCheck finishCheck(signalReceived);
9762   animation.FinishedSignal().Connect(&application, finishCheck);
9763   application.SendNotification();
9764   application.Render(0);
9765   application.SendNotification();
9766   finishCheck.CheckSignalNotReceived();
9767
9768   Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9769   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9770
9771   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9772   application.SendNotification();
9773   check = Quaternion(Radian(Degree(90)), Vector3::XAXIS);
9774   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9775
9776   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9777   application.SendNotification();
9778   check = Quaternion(Radian(Degree(120)), Vector3::XAXIS);
9779   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9780
9781   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9782   application.SendNotification();
9783   check = Quaternion(Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f));
9784   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9785
9786   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9787   application.SendNotification();
9788   check = Quaternion(Radian(Degree(120)), Vector3::YAXIS);
9789   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9790
9791   // We did expect the animation to finish
9792
9793   finishCheck.CheckSignalReceived();
9794   END_TEST;
9795 }
9796
9797 int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
9798 {
9799   TestApplication application;
9800
9801   Actor     actor = Actor::New();
9802   AngleAxis aa(Degree(90), Vector3::XAXIS);
9803   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9804   application.GetScene().Add(actor);
9805
9806   application.SendNotification();
9807   application.Render(0);
9808   Quaternion start(Radian(aa.angle), aa.axis);
9809   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9810
9811   // Build the animation
9812   float     durationSeconds(1.0f);
9813   Animation animation = Animation::New(durationSeconds);
9814
9815   KeyFrames keyFrames = KeyFrames::New();
9816   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9817
9818   //Cubic interpolation should be ignored for quaternions
9819   animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::CUBIC);
9820
9821   // Start the animation
9822   animation.Play();
9823
9824   bool                 signalReceived(false);
9825   AnimationFinishCheck finishCheck(signalReceived);
9826   animation.FinishedSignal().Connect(&application, finishCheck);
9827   application.SendNotification();
9828   application.SendNotification();
9829   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9830   application.SendNotification();
9831   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9832   application.SendNotification();
9833
9834   Quaternion check(Radian(Degree(60)), Vector3::ZAXIS);
9835
9836   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9837   finishCheck.CheckSignalReceived();
9838   END_TEST;
9839 }
9840
9841 int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
9842 {
9843   TestApplication application;
9844
9845   Actor     actor = Actor::New();
9846   AngleAxis aa(Degree(90), Vector3::XAXIS);
9847   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9848   application.SendNotification();
9849   application.Render(0);
9850   application.GetScene().Add(actor);
9851
9852   Quaternion start(Radian(aa.angle), aa.axis);
9853   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9854
9855   // Build the animation
9856   float     durationSeconds(1.0f);
9857   Animation animation = Animation::New(durationSeconds);
9858
9859   KeyFrames keyFrames = KeyFrames::New();
9860   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9861   keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9862   keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9863
9864   //Cubic interpolation should be ignored for quaternions
9865   animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::CUBIC);
9866
9867   // Start the animation
9868   animation.Play();
9869
9870   bool                 signalReceived(false);
9871   AnimationFinishCheck finishCheck(signalReceived);
9872   animation.FinishedSignal().Connect(&application, finishCheck);
9873   application.SendNotification();
9874   application.Render(0);
9875   application.SendNotification();
9876   finishCheck.CheckSignalNotReceived();
9877
9878   Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9879   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9880
9881   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9882   application.SendNotification();
9883   check = Quaternion(Radian(Degree(90)), Vector3::XAXIS);
9884   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9885
9886   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9887   application.SendNotification();
9888   check = Quaternion(Radian(Degree(120)), Vector3::XAXIS);
9889   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9890
9891   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9892   application.SendNotification();
9893   check = Quaternion(Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f));
9894   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9895
9896   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9897   application.SendNotification();
9898   check = Quaternion(Radian(Degree(120)), Vector3::YAXIS);
9899   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9900
9901   // We did expect the animation to finish
9902
9903   finishCheck.CheckSignalReceived();
9904   END_TEST;
9905 }
9906
9907 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
9908 {
9909   TestApplication application;
9910
9911   float startValue(1.0f);
9912   Actor actor = Actor::New();
9913   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9914   application.GetScene().Add(actor);
9915
9916   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9917   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9918   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9919   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9920   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9921   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9922   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9923   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9924   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9925
9926   // Build the animation
9927   float     durationSeconds(1.0f);
9928   Animation animation = Animation::New(durationSeconds);
9929
9930   KeyFrames keyFrames = KeyFrames::New();
9931   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9932   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9933   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9934
9935   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR);
9936
9937   // Start the animation
9938   animation.Play();
9939
9940   bool                 signalReceived(false);
9941   AnimationFinishCheck finishCheck(signalReceived);
9942   animation.FinishedSignal().Connect(&application, finishCheck);
9943   application.SendNotification();
9944   application.Render(0);
9945   application.SendNotification();
9946   finishCheck.CheckSignalNotReceived();
9947   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
9948   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
9949   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
9950   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
9951
9952   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9953   application.SendNotification();
9954   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
9955   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
9956   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
9957   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
9958
9959   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9960   application.SendNotification();
9961   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
9962   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
9963   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
9964   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
9965
9966   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9967   application.SendNotification();
9968   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
9969   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
9970   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
9971   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
9972
9973   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9974   application.SendNotification();
9975   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
9976   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
9977   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
9978   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
9979
9980   // We did expect the animation to finish
9981
9982   finishCheck.CheckSignalReceived();
9983   END_TEST;
9984 }
9985
9986 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
9987 {
9988   TestApplication application;
9989
9990   float startValue(1.0f);
9991   Actor actor = Actor::New();
9992   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9993   application.GetScene().Add(actor);
9994
9995   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9996   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9997   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9998   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9999   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10000   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10001   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10002   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10003   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10004
10005   // Build the animation
10006   float     durationSeconds(1.0f);
10007   Animation animation = Animation::New(durationSeconds);
10008
10009   KeyFrames keyFrames = KeyFrames::New();
10010   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10011   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10012   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10013
10014   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::CUBIC);
10015
10016   // Start the animation
10017   animation.Play();
10018
10019   bool                 signalReceived(false);
10020   AnimationFinishCheck finishCheck(signalReceived);
10021   animation.FinishedSignal().Connect(&application, finishCheck);
10022   application.SendNotification();
10023   application.Render(0);
10024   application.SendNotification();
10025   finishCheck.CheckSignalNotReceived();
10026   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10027   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10028   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10029   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10030
10031   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10032   application.SendNotification();
10033   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
10034   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
10035   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
10036   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
10037
10038   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10039   application.SendNotification();
10040   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10041   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10042   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10043   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10044
10045   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10046   application.SendNotification();
10047   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
10048   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
10049   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
10050   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
10051
10052   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10053   application.SendNotification();
10054   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10055   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10056   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10057   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10058
10059   // We did expect the animation to finish
10060
10061   finishCheck.CheckSignalReceived();
10062   END_TEST;
10063 }
10064
10065 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void)
10066 {
10067   TestApplication application;
10068
10069   float startValue(1.0f);
10070   Actor actor = Actor::New();
10071   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10072   application.GetScene().Add(actor);
10073
10074   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10075   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10076   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10077   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10078   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10079   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10080   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10081   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10082   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10083
10084   // Build the animation
10085   float     durationSeconds(1.0f);
10086   float     delay     = 0.5f;
10087   Animation animation = Animation::New(durationSeconds);
10088
10089   KeyFrames keyFrames = KeyFrames::New();
10090   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10091   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10092   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10093
10094   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod(delay, durationSeconds - delay));
10095
10096   // Start the animation
10097   animation.Play();
10098
10099   bool                 signalReceived(false);
10100   AnimationFinishCheck finishCheck(signalReceived);
10101   animation.FinishedSignal().Connect(&application, finishCheck);
10102   application.SendNotification();
10103
10104   application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
10105   application.SendNotification();
10106   finishCheck.CheckSignalNotReceived();
10107   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10108   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10109   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10110   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10111
10112   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
10113   application.SendNotification();
10114   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
10115   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
10116   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
10117   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
10118
10119   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
10120   application.SendNotification();
10121   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10122   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10123   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10124   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10125
10126   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
10127   application.SendNotification();
10128   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
10129   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
10130   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
10131   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
10132
10133   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10134   application.SendNotification();
10135   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10136   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10137   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10138   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10139
10140   // We did expect the animation to finish
10141
10142   finishCheck.CheckSignalReceived();
10143   END_TEST;
10144 }
10145
10146 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
10147 {
10148   TestApplication application;
10149
10150   float startValue(1.0f);
10151   Actor actor = Actor::New();
10152   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10153   application.GetScene().Add(actor);
10154
10155   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10156   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10157   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10158   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10159   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10160   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10161   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10162   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10163   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10164
10165   // Build the animation
10166   float     durationSeconds(1.0f);
10167   float     delay     = 0.5f;
10168   Animation animation = Animation::New(durationSeconds);
10169
10170   KeyFrames keyFrames = KeyFrames::New();
10171   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10172   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10173   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10174
10175   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod(delay, durationSeconds - delay), Animation::CUBIC);
10176
10177   // Start the animation
10178   animation.Play();
10179
10180   bool                 signalReceived(false);
10181   AnimationFinishCheck finishCheck(signalReceived);
10182   animation.FinishedSignal().Connect(&application, finishCheck);
10183   application.SendNotification();
10184
10185   application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
10186   application.SendNotification();
10187   finishCheck.CheckSignalNotReceived();
10188   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10189   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10190   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10191   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10192
10193   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
10194   application.SendNotification();
10195   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
10196   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
10197   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
10198   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
10199
10200   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
10201   application.SendNotification();
10202   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10203   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10204   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10205   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10206
10207   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
10208   application.SendNotification();
10209   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
10210   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
10211   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
10212   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
10213
10214   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10215   application.SendNotification();
10216   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10217   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10218   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10219   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10220
10221   // We did expect the animation to finish
10222
10223   finishCheck.CheckSignalReceived();
10224   END_TEST;
10225 }
10226
10227 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
10228 {
10229   TestApplication application;
10230
10231   float startValue(1.0f);
10232   float delay = 0.5f;
10233   Actor actor = Actor::New();
10234   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10235   application.GetScene().Add(actor);
10236
10237   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10238   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10239   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10240   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10241   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10242   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10243   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10244   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10245   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10246
10247   // Build the animation
10248   float     durationSeconds(1.0f);
10249   Animation animation = Animation::New(durationSeconds);
10250
10251   KeyFrames keyFrames = KeyFrames::New();
10252   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10253   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10254   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10255
10256   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
10257
10258   // Start the animation
10259   animation.Play();
10260
10261   bool                 signalReceived(false);
10262   AnimationFinishCheck finishCheck(signalReceived);
10263   animation.FinishedSignal().Connect(&application, finishCheck);
10264   application.SendNotification();
10265
10266   application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
10267   application.SendNotification();
10268   finishCheck.CheckSignalNotReceived();
10269   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10270   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10271   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10272   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10273
10274   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
10275   application.SendNotification();
10276   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
10277   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
10278   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
10279   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
10280
10281   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
10282   application.SendNotification();
10283   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10284   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10285   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10286   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10287
10288   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
10289   application.SendNotification();
10290   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
10291   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
10292   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
10293   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
10294
10295   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10296   application.SendNotification();
10297   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10298   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10299   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10300   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10301
10302   // We did expect the animation to finish
10303
10304   finishCheck.CheckSignalReceived();
10305   END_TEST;
10306 }
10307
10308 int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void)
10309 {
10310   TestApplication application;
10311
10312   float startValue(1.0f);
10313   Actor actor = Actor::New();
10314   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10315   application.GetScene().Add(actor);
10316
10317   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10318   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10319   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10320   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10321   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10322   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10323   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10324   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10325   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10326
10327   // Build the animation
10328   float     durationSeconds(1.0f);
10329   float     delay     = 0.5f;
10330   Animation animation = Animation::New(durationSeconds);
10331
10332   KeyFrames keyFrames = KeyFrames::New();
10333   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10334   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10335   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10336
10337   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay), Animation::CUBIC);
10338
10339   // Start the animation
10340   animation.Play();
10341
10342   bool                 signalReceived(false);
10343   AnimationFinishCheck finishCheck(signalReceived);
10344   animation.FinishedSignal().Connect(&application, finishCheck);
10345   application.SendNotification();
10346
10347   application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
10348   application.SendNotification();
10349   finishCheck.CheckSignalNotReceived();
10350   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10351   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10352   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10353   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10354
10355   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
10356   application.SendNotification();
10357   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
10358   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
10359   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
10360   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
10361
10362   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
10363   application.SendNotification();
10364   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10365   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10366   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10367   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10368
10369   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
10370   application.SendNotification();
10371   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
10372   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
10373   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
10374   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
10375
10376   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10377   application.SendNotification();
10378   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10379   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10380   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10381   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10382
10383   // We did expect the animation to finish
10384
10385   finishCheck.CheckSignalReceived();
10386   END_TEST;
10387 }
10388
10389 int UtcDaliAnimationAnimateP(void)
10390 {
10391   TestApplication application;
10392
10393   Actor actor = Actor::New();
10394   application.GetScene().Add(actor);
10395
10396   //Build the path
10397   Vector3 position0(30.0, 80.0, 0.0);
10398   Vector3 position1(70.0, 120.0, 0.0);
10399   Vector3 position2(100.0, 100.0, 0.0);
10400
10401   Dali::Path path = Dali::Path::New();
10402   path.AddPoint(position0);
10403   path.AddPoint(position1);
10404   path.AddPoint(position2);
10405
10406   //Control points for first segment
10407   path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10408   path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10409
10410   //Control points for second segment
10411   path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10412   path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10413
10414   // Build the animation
10415   float     durationSeconds(1.0f);
10416   Animation animation = Animation::New(durationSeconds);
10417   animation.Animate(actor, path, Vector3::XAXIS);
10418
10419   // Start the animation
10420   animation.Play();
10421
10422   bool                 signalReceived(false);
10423   AnimationFinishCheck finishCheck(signalReceived);
10424   animation.FinishedSignal().Connect(&application, finishCheck);
10425   application.SendNotification();
10426   application.Render(0);
10427   application.SendNotification();
10428   finishCheck.CheckSignalNotReceived();
10429   Vector3    position, tangent;
10430   Quaternion rotation;
10431   path.Sample(0.0f, position, tangent);
10432   rotation = Quaternion(Vector3::XAXIS, tangent);
10433   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10434   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10435
10436   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10437   application.SendNotification();
10438   path.Sample(0.25f, position, tangent);
10439   rotation = Quaternion(Vector3::XAXIS, tangent);
10440   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10441   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10442
10443   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10444   application.SendNotification();
10445   path.Sample(0.5f, position, tangent);
10446   rotation = Quaternion(Vector3::XAXIS, tangent);
10447   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10448   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10449
10450   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10451   application.SendNotification();
10452   path.Sample(0.75f, position, tangent);
10453   rotation = Quaternion(Vector3::XAXIS, tangent);
10454   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10455   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10456
10457   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10458   application.SendNotification();
10459   path.Sample(1.0f, position, tangent);
10460   rotation = Quaternion(Vector3::XAXIS, tangent);
10461   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10462   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10463
10464   finishCheck.CheckSignalReceived();
10465   END_TEST;
10466 }
10467
10468 int UtcDaliAnimationAnimateAlphaFunctionP(void)
10469 {
10470   TestApplication application;
10471
10472   Actor actor = Actor::New();
10473   application.GetScene().Add(actor);
10474
10475   //Build the path
10476   Vector3 position0(30.0, 80.0, 0.0);
10477   Vector3 position1(70.0, 120.0, 0.0);
10478   Vector3 position2(100.0, 100.0, 0.0);
10479
10480   Dali::Path path = Dali::Path::New();
10481   path.AddPoint(position0);
10482   path.AddPoint(position1);
10483   path.AddPoint(position2);
10484
10485   //Control points for first segment
10486   path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10487   path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10488
10489   //Control points for second segment
10490   path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10491   path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10492
10493   // Build the animation
10494   float     durationSeconds(1.0f);
10495   Animation animation = Animation::New(durationSeconds);
10496   animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
10497
10498   // Start the animation
10499   animation.Play();
10500
10501   bool                 signalReceived(false);
10502   AnimationFinishCheck finishCheck(signalReceived);
10503   animation.FinishedSignal().Connect(&application, finishCheck);
10504   application.SendNotification();
10505   application.Render(0);
10506   application.SendNotification();
10507   finishCheck.CheckSignalNotReceived();
10508   Vector3    position, tangent;
10509   Quaternion rotation;
10510   path.Sample(0.0f, position, tangent);
10511   rotation = Quaternion(Vector3::XAXIS, tangent);
10512   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10513   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10514
10515   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10516   application.SendNotification();
10517   path.Sample(0.25f, position, tangent);
10518   rotation = Quaternion(Vector3::XAXIS, tangent);
10519   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10520   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10521
10522   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10523   application.SendNotification();
10524   path.Sample(0.5f, position, tangent);
10525   rotation = Quaternion(Vector3::XAXIS, tangent);
10526   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10527   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10528
10529   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10530   application.SendNotification();
10531   path.Sample(0.75f, position, tangent);
10532   rotation = Quaternion(Vector3::XAXIS, tangent);
10533   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10534   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10535
10536   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10537   application.SendNotification();
10538   path.Sample(1.0f, position, tangent);
10539   rotation = Quaternion(Vector3::XAXIS, tangent);
10540   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10541   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10542
10543   finishCheck.CheckSignalReceived();
10544   END_TEST;
10545 }
10546
10547 int UtcDaliAnimationAnimateTimePeriodP(void)
10548 {
10549   TestApplication application;
10550
10551   Actor actor = Actor::New();
10552   application.GetScene().Add(actor);
10553
10554   //Build the path
10555   Vector3 position0(30.0, 80.0, 0.0);
10556   Vector3 position1(70.0, 120.0, 0.0);
10557   Vector3 position2(100.0, 100.0, 0.0);
10558
10559   Dali::Path path = Dali::Path::New();
10560   path.AddPoint(position0);
10561   path.AddPoint(position1);
10562   path.AddPoint(position2);
10563
10564   //Control points for first segment
10565   path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10566   path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10567
10568   //Control points for second segment
10569   path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10570   path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10571
10572   // Build the animation
10573   float     durationSeconds(1.0f);
10574   Animation animation = Animation::New(durationSeconds);
10575   animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
10576
10577   // Start the animation
10578   animation.Play();
10579
10580   bool                 signalReceived(false);
10581   AnimationFinishCheck finishCheck(signalReceived);
10582   animation.FinishedSignal().Connect(&application, finishCheck);
10583   application.SendNotification();
10584   application.Render(0);
10585   application.SendNotification();
10586   finishCheck.CheckSignalNotReceived();
10587   Vector3    position, tangent;
10588   Quaternion rotation;
10589   path.Sample(0.0f, position, tangent);
10590   rotation = Quaternion(Vector3::XAXIS, tangent);
10591   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10592   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10593
10594   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10595   application.SendNotification();
10596   path.Sample(0.25f, position, tangent);
10597   rotation = Quaternion(Vector3::XAXIS, tangent);
10598   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10599   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10600
10601   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10602   application.SendNotification();
10603   path.Sample(0.5f, position, tangent);
10604   rotation = Quaternion(Vector3::XAXIS, tangent);
10605   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10606   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10607
10608   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10609   application.SendNotification();
10610   path.Sample(0.75f, position, tangent);
10611   rotation = Quaternion(Vector3::XAXIS, tangent);
10612   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10613   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10614
10615   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10616   application.SendNotification();
10617   path.Sample(1.0f, position, tangent);
10618   rotation = Quaternion(Vector3::XAXIS, tangent);
10619   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10620   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10621
10622   finishCheck.CheckSignalReceived();
10623   END_TEST;
10624 }
10625
10626 int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
10627 {
10628   TestApplication application;
10629
10630   Actor actor = Actor::New();
10631   application.GetScene().Add(actor);
10632
10633   //Build the path
10634   Vector3 position0(30.0, 80.0, 0.0);
10635   Vector3 position1(70.0, 120.0, 0.0);
10636   Vector3 position2(100.0, 100.0, 0.0);
10637
10638   Dali::Path path = Dali::Path::New();
10639   path.AddPoint(position0);
10640   path.AddPoint(position1);
10641   path.AddPoint(position2);
10642
10643   //Control points for first segment
10644   path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10645   path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10646
10647   //Control points for second segment
10648   path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10649   path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10650
10651   // Build the animation
10652   float     durationSeconds(1.0f);
10653   Animation animation = Animation::New(durationSeconds);
10654   animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
10655
10656   // Start the animation
10657   animation.Play();
10658
10659   bool                 signalReceived(false);
10660   AnimationFinishCheck finishCheck(signalReceived);
10661   animation.FinishedSignal().Connect(&application, finishCheck);
10662   application.SendNotification();
10663   application.Render(0);
10664   application.SendNotification();
10665   finishCheck.CheckSignalNotReceived();
10666   Vector3    position, tangent;
10667   Quaternion rotation;
10668   path.Sample(0.0f, position, tangent);
10669   rotation = Quaternion(Vector3::XAXIS, tangent);
10670   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10671   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10672
10673   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10674   application.SendNotification();
10675   path.Sample(0.25f, position, tangent);
10676   rotation = Quaternion(Vector3::XAXIS, tangent);
10677   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10678   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10679
10680   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10681   application.SendNotification();
10682   path.Sample(0.5f, position, tangent);
10683   rotation = Quaternion(Vector3::XAXIS, tangent);
10684   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10685   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10686
10687   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10688   application.SendNotification();
10689   path.Sample(0.75f, position, tangent);
10690   rotation = Quaternion(Vector3::XAXIS, tangent);
10691   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10692   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10693
10694   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10695   application.SendNotification();
10696   path.Sample(1.0f, position, tangent);
10697   rotation = Quaternion(Vector3::XAXIS, tangent);
10698   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10699   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10700
10701   finishCheck.CheckSignalReceived();
10702   END_TEST;
10703 }
10704
10705 int UtcDaliAnimationShowP(void)
10706 {
10707   TestApplication application;
10708
10709   Actor actor = Actor::New();
10710   actor.SetProperty(Actor::Property::VISIBLE, false);
10711   application.SendNotification();
10712   application.Render(0);
10713   DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10714   application.GetScene().Add(actor);
10715
10716   // Start the animation
10717   float     durationSeconds(10.0f);
10718   Animation animation = Animation::New(durationSeconds);
10719   animation.Show(actor, durationSeconds * 0.5f);
10720   animation.Play();
10721
10722   bool                 signalReceived(false);
10723   AnimationFinishCheck finishCheck(signalReceived);
10724   animation.FinishedSignal().Connect(&application, finishCheck);
10725
10726   application.SendNotification();
10727   application.Render(static_cast<unsigned int>(durationSeconds * 490.0f));
10728
10729   // We didn't expect the animation to finish yet
10730   application.SendNotification();
10731   finishCheck.CheckSignalNotReceived();
10732   DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10733
10734   application.SendNotification();
10735   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) /*Should be shown now*/);
10736
10737   // We didn't expect the animation to finish yet
10738   application.SendNotification();
10739   finishCheck.CheckSignalNotReceived();
10740   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10741
10742   application.SendNotification();
10743   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
10744
10745   // We did expect the animation to finish
10746   application.SendNotification();
10747   finishCheck.CheckSignalReceived();
10748   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10749   END_TEST;
10750 }
10751
10752 int UtcDaliAnimationHideP(void)
10753 {
10754   TestApplication application;
10755
10756   Actor actor = Actor::New();
10757   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10758   application.GetScene().Add(actor);
10759
10760   // Start the animation
10761   float     durationSeconds(10.0f);
10762   Animation animation = Animation::New(durationSeconds);
10763   animation.Hide(actor, durationSeconds * 0.5f);
10764   animation.Play();
10765
10766   bool                 signalReceived(false);
10767   AnimationFinishCheck finishCheck(signalReceived);
10768   animation.FinishedSignal().Connect(&application, finishCheck);
10769
10770   application.SendNotification();
10771   application.Render(static_cast<unsigned int>(durationSeconds * 490.0f));
10772
10773   // We didn't expect the animation to finish yet
10774   application.SendNotification();
10775   finishCheck.CheckSignalNotReceived();
10776   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10777
10778   application.SendNotification();
10779   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) /*Should be hidden now*/);
10780
10781   // We didn't expect the animation to finish yet
10782   application.SendNotification();
10783   finishCheck.CheckSignalNotReceived();
10784   DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10785
10786   application.SendNotification();
10787   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
10788
10789   // We did expect the animation to finish
10790   application.SendNotification();
10791   finishCheck.CheckSignalReceived();
10792   DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10793   END_TEST;
10794 }
10795
10796 int UtcDaliAnimationShowHideAtEndP(void)
10797 {
10798   // Test that show/hide delay can be the same as animation duration
10799   // i.e. to show/hide at the end of the animation
10800
10801   TestApplication application;
10802
10803   Actor actor = Actor::New();
10804   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10805   application.GetScene().Add(actor);
10806
10807   // Start Hide animation
10808   float     durationSeconds(10.0f);
10809   Animation animation = Animation::New(durationSeconds);
10810   animation.Hide(actor, durationSeconds /*Hide at end*/);
10811   animation.Play();
10812
10813   bool                 signalReceived(false);
10814   AnimationFinishCheck finishCheck(signalReceived);
10815   animation.FinishedSignal().Connect(&application, finishCheck);
10816
10817   application.SendNotification();
10818   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
10819
10820   // We did expect the animation to finish
10821   application.SendNotification();
10822   finishCheck.CheckSignalReceived();
10823   DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10824
10825   // Start Show animation
10826   animation = Animation::New(durationSeconds);
10827   animation.Show(actor, durationSeconds /*Show at end*/);
10828   animation.FinishedSignal().Connect(&application, finishCheck);
10829   animation.Play();
10830
10831   application.SendNotification();
10832   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
10833
10834   // We did expect the animation to finish
10835   application.SendNotification();
10836   finishCheck.CheckSignalReceived();
10837   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10838   END_TEST;
10839 }
10840
10841 int UtcDaliKeyFramesCreateDestroyP(void)
10842 {
10843   tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
10844
10845   KeyFrames* keyFrames = new KeyFrames;
10846   delete keyFrames;
10847   DALI_TEST_CHECK(true);
10848   END_TEST;
10849 }
10850
10851 int UtcDaliKeyFramesDownCastP(void)
10852 {
10853   TestApplication application;
10854   tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
10855
10856   KeyFrames  keyFrames = KeyFrames::New();
10857   BaseHandle object(keyFrames);
10858
10859   KeyFrames keyFrames2 = KeyFrames::DownCast(object);
10860   DALI_TEST_CHECK(keyFrames2);
10861
10862   KeyFrames keyFrames3 = DownCast<KeyFrames>(object);
10863   DALI_TEST_CHECK(keyFrames3);
10864
10865   BaseHandle unInitializedObject;
10866   KeyFrames  keyFrames4 = KeyFrames::DownCast(unInitializedObject);
10867   DALI_TEST_CHECK(!keyFrames4);
10868
10869   KeyFrames keyFrames5 = DownCast<KeyFrames>(unInitializedObject);
10870   DALI_TEST_CHECK(!keyFrames5);
10871   END_TEST;
10872 }
10873
10874 int UtcDaliAnimationCreateDestroyP(void)
10875 {
10876   TestApplication application;
10877   Animation*      animation = new Animation;
10878   DALI_TEST_CHECK(animation);
10879   delete animation;
10880   END_TEST;
10881 }
10882
10883 struct UpdateManagerTestConstraint
10884 {
10885   UpdateManagerTestConstraint(TestApplication& application)
10886   : mApplication(application)
10887   {
10888   }
10889
10890   void operator()(Vector3& current, const PropertyInputContainer& /* inputs */)
10891   {
10892     mApplication.SendNotification(); // Process events
10893   }
10894
10895   TestApplication& mApplication;
10896 };
10897
10898 int UtcDaliAnimationUpdateManagerP(void)
10899 {
10900   TestApplication application;
10901
10902   Actor actor = Actor::New();
10903   application.GetScene().Add(actor);
10904
10905   // Build the animation
10906   Animation animation = Animation::New(0.0f);
10907
10908   bool                 signalReceived = false;
10909   AnimationFinishCheck finishCheck(signalReceived);
10910   animation.FinishedSignal().Connect(&application, finishCheck);
10911
10912   Vector3         startValue(1.0f, 1.0f, 1.0f);
10913   Property::Index index      = actor.RegisterProperty("testProperty", startValue);
10914   Constraint      constraint = Constraint::New<Vector3>(actor, index, UpdateManagerTestConstraint(application));
10915   constraint.Apply();
10916
10917   // Apply animation to actor
10918   animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(100.f, 90.f, 80.f), AlphaFunction::LINEAR);
10919   animation.AnimateTo(Property(actor, Actor::Property::OPACITY), 0.3f, AlphaFunction::LINEAR);
10920
10921   animation.Play();
10922
10923   application.SendNotification();
10924   application.UpdateOnly(16);
10925
10926   finishCheck.CheckSignalNotReceived();
10927
10928   application.SendNotification(); // Process events
10929
10930   finishCheck.CheckSignalReceived();
10931
10932   END_TEST;
10933 }
10934
10935 int UtcDaliAnimationSignalOrderP(void)
10936 {
10937   TestApplication application;
10938
10939   Actor actor = Actor::New();
10940   application.GetScene().Add(actor);
10941
10942   // Build the animations
10943   Animation animation1 = Animation::New(0.0f);  // finishes first frame
10944   Animation animation2 = Animation::New(0.02f); // finishes in 20 ms
10945
10946   bool signal1Received = false;
10947   animation1.FinishedSignal().Connect(&application, AnimationFinishCheck(signal1Received));
10948
10949   bool signal2Received = false;
10950   animation2.FinishedSignal().Connect(&application, AnimationFinishCheck(signal2Received));
10951
10952   // Apply animations to actor
10953   animation1.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(3.0f, 2.0f, 1.0f), AlphaFunction::LINEAR);
10954   animation1.Play();
10955   animation2.AnimateTo(Property(actor, Actor::Property::SIZE), Vector3(10.0f, 20.0f, 30.0f), AlphaFunction::LINEAR);
10956   animation2.Play();
10957
10958   DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION);
10959   DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION);
10960
10961   application.SendNotification();
10962   application.UpdateOnly(10); // 10ms progress
10963
10964   // no notifications yet
10965   DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION);
10966   DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION);
10967
10968   application.SendNotification();
10969
10970   // first completed
10971   DALI_TEST_EQUALS(signal1Received, true, TEST_LOCATION);
10972   DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION);
10973   signal1Received = false;
10974
10975   // 1st animation is complete now, do another update with no ProcessEvents in between
10976   application.UpdateOnly(20); // 20ms progress
10977
10978   // ProcessEvents
10979   application.SendNotification();
10980
10981   // 2nd should complete now
10982   DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION);
10983   DALI_TEST_EQUALS(signal2Received, true, TEST_LOCATION);
10984
10985   END_TEST;
10986 }
10987
10988 int UtcDaliAnimationExtendDurationP(void)
10989 {
10990   TestApplication application;
10991
10992   Actor actor = Actor::New();
10993
10994   // Register a float property
10995   float           startValue(10.0f);
10996   Property::Index index = actor.RegisterProperty("testProperty", startValue);
10997   application.GetScene().Add(actor);
10998   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
10999   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
11000
11001   // Build the animation
11002   float     initialDurationSeconds(1.0f);
11003   float     animatorDelay = 5.0f;
11004   float     animatorDurationSeconds(5.0f);
11005   float     extendedDurationSeconds(animatorDelay + animatorDurationSeconds);
11006   Animation animation = Animation::New(initialDurationSeconds);
11007   float     targetValue(30.0f);
11008   float     relativeValue(targetValue - startValue);
11009
11010   animation.AnimateTo(Property(actor, index),
11011                       targetValue,
11012                       TimePeriod(animatorDelay, animatorDurationSeconds));
11013
11014   // The duration should have been extended
11015   DALI_TEST_EQUALS(animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION);
11016
11017   // Start the animation
11018   animation.Play();
11019
11020   bool                 signalReceived(false);
11021   AnimationFinishCheck finishCheck(signalReceived);
11022   animation.FinishedSignal().Connect(&application, finishCheck);
11023
11024   application.SendNotification();
11025   application.Render(static_cast<unsigned int>(extendedDurationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
11026
11027   // We didn't expect the animation to finish yet, but cached value should be the final one
11028   application.SendNotification();
11029   finishCheck.CheckSignalNotReceived();
11030   DALI_TEST_EQUALS(actor.GetProperty<float>(index), targetValue, TEST_LOCATION);
11031   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
11032
11033   application.SendNotification();
11034   application.Render(static_cast<unsigned int>(extendedDurationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
11035
11036   // We didn't expect the animation to finish yet
11037   application.SendNotification();
11038   finishCheck.CheckSignalNotReceived();
11039   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
11040
11041   application.SendNotification();
11042   application.Render(static_cast<unsigned int>(extendedDurationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
11043
11044   // We did expect the animation to finish
11045   application.SendNotification();
11046   finishCheck.CheckSignalReceived();
11047   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
11048   DALI_TEST_EQUALS(actor.GetProperty<float>(index), targetValue, TEST_LOCATION);
11049   END_TEST;
11050 }
11051
11052 int UtcDaliAnimationCustomIntProperty(void)
11053 {
11054   TestApplication application;
11055
11056   Actor actor = Actor::New();
11057   application.GetScene().Add(actor);
11058   int startValue(0u);
11059
11060   Property::Index index = actor.RegisterProperty("anIndex", startValue);
11061   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
11062   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11063
11064   // Build the animation
11065   float     durationSeconds(1.0f);
11066   Animation animation = Animation::New(durationSeconds);
11067   animation.AnimateTo(Property(actor, index), 20);
11068
11069   // Start the animation
11070   animation.Play();
11071
11072   // Target value should be retrievable straight away
11073   DALI_TEST_EQUALS(actor.GetProperty<int>(index), 20, TEST_LOCATION);
11074
11075   bool                 signalReceived(false);
11076   AnimationFinishCheck finishCheck(signalReceived);
11077   animation.FinishedSignal().Connect(&application, finishCheck);
11078
11079   application.SendNotification();
11080   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
11081
11082   // We didn't expect the animation to finish yet
11083   application.SendNotification();
11084   finishCheck.CheckSignalNotReceived();
11085   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), 10, TEST_LOCATION);
11086
11087   application.SendNotification();
11088   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
11089
11090   // We did expect the animation to finish
11091   application.SendNotification();
11092   finishCheck.CheckSignalReceived();
11093   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), 20, TEST_LOCATION);
11094   DALI_TEST_EQUALS(actor.GetProperty<int>(index), 20, TEST_LOCATION);
11095   END_TEST;
11096 }
11097
11098 int UtcDaliAnimationDuration(void)
11099 {
11100   TestApplication application;
11101
11102   Actor actor = Actor::New();
11103   application.GetScene().Add(actor);
11104
11105   Animation animation = Animation::New(0.0f);
11106   DALI_TEST_EQUALS(0.0f, animation.GetDuration(), TEST_LOCATION);
11107
11108   // The animation duration should automatically increase depending on the animator time period
11109
11110   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(0.0f, 1.0f));
11111   DALI_TEST_EQUALS(1.0f, animation.GetDuration(), TEST_LOCATION);
11112
11113   animation.AnimateTo(Property(actor, Actor::Property::POSITION_Y), 200.0f, TimePeriod(10.0f, 1.0f));
11114   DALI_TEST_EQUALS(11.0f, animation.GetDuration(), TEST_LOCATION);
11115
11116   END_TEST;
11117 }
11118
11119 int UtcDaliAnimationAnimateByNonAnimateableTypeN(void)
11120 {
11121   TestApplication application;
11122
11123   Actor actor = Actor::New();
11124
11125   // Register an integer property
11126   int             startValue(1);
11127   Property::Index index = actor.RegisterProperty("testProperty", startValue);
11128   application.GetScene().Add(actor);
11129   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11130
11131   DALI_TEST_ASSERTION(
11132     {
11133       // Build the animation
11134       Animation   animation     = Animation::New(2.0f);
11135       std::string relativeValue = "relative string";
11136       animation.AnimateBy(Property(actor, index), relativeValue);
11137       tet_result(TET_FAIL);
11138     },
11139     "Target value is not animatable");
11140
11141   END_TEST;
11142 }
11143
11144 int UtcDaliAnimationAnimateToNonAnimateableTypeN(void)
11145 {
11146   TestApplication application;
11147
11148   Actor actor = Actor::New();
11149
11150   // Register an integer property
11151   int             startValue(1);
11152   Property::Index index = actor.RegisterProperty("testProperty", startValue);
11153   application.GetScene().Add(actor);
11154   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11155
11156   DALI_TEST_ASSERTION(
11157     {
11158       // Build the animation
11159       Animation   animation     = Animation::New(2.0f);
11160       std::string relativeValue = "relative string";
11161       animation.AnimateTo(Property(actor, index), relativeValue);
11162     },
11163     "Target value is not animatable");
11164
11165   END_TEST;
11166 }
11167
11168 int UtcDaliAnimationAnimateBetweenNonAnimateableTypeN(void)
11169 {
11170   TestApplication application;
11171
11172   Actor actor = Actor::New();
11173
11174   // Register an integer property
11175   int             startValue(1);
11176   Property::Index index = actor.RegisterProperty("testProperty", startValue);
11177   application.GetScene().Add(actor);
11178   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11179
11180   DALI_TEST_ASSERTION(
11181     {
11182       // Build the animation
11183       KeyFrames keyFrames = KeyFrames::New();
11184       keyFrames.Add(0.0f, std::string("relative string1"));
11185       keyFrames.Add(1.0f, std::string("relative string2"));
11186       // no need to really create the animation as keyframes do the check
11187     },
11188     "Property type is not animatable");
11189
11190   END_TEST;
11191 }
11192
11193 int UtcDaliAnimationSetAndGetTargetBeforePlayP(void)
11194 {
11195   tet_infoline("Setting up an animation should not effect it's position property until the animation plays");
11196
11197   TestApplication application;
11198
11199   tet_infoline("Set initial position and set up animation to re-position actor");
11200
11201   Actor actor = Actor::New();
11202   application.GetScene().Add(actor);
11203   Vector3 initialPosition(0.0f, 0.0f, 0.0f);
11204   actor.SetProperty(Actor::Property::POSITION, initialPosition);
11205
11206   // Build the animation
11207   Animation animation = Animation::New(2.0f);
11208
11209   //Test GetCurrentProgress return 0.0 as the duration is 0.0
11210   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
11211   DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 0.0f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
11212
11213   tet_infoline("Set target position in animation without intiating play");
11214
11215   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11216   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
11217
11218   application.SendNotification();
11219   application.Render();
11220
11221   tet_infoline("Ensure position of actor is still at intial value");
11222
11223   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION);
11224   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION);
11225   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION);
11226
11227   tet_infoline("Play animation and ensure actor position is now target");
11228
11229   animation.Play();
11230   application.SendNotification();
11231   application.Render(1000u);
11232
11233   tet_infoline("Ensure position of actor is at target value when aninmation half way");
11234
11235   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
11236   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
11237   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
11238
11239   tet_printf("x position at half way point(%f)\n", actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x);
11240
11241   application.Render(2000u);
11242
11243   tet_infoline("Ensure position of actor is still at target value when aninmation complete");
11244
11245   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
11246   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
11247   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
11248
11249   END_TEST;
11250 }
11251
11252 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsPositionP(void)
11253 {
11254   tet_infoline("Setting up an animation should not effect it's position property until the animation plays even with mulitple animators");
11255
11256   TestApplication application;
11257
11258   std::vector<Vector3> targetPositions;
11259
11260   targetPositions.push_back(Vector3(100.0f, 100.0f, 100.0f));
11261   targetPositions.push_back(Vector3(200.0f, 1.0f, 100.0f));
11262   targetPositions.push_back(Vector3(50.0f, 10.0f, 100.0f));
11263
11264   tet_infoline("Set initial position and set up animation to re-position actor");
11265
11266   Actor actor = Actor::New();
11267   application.GetScene().Add(actor);
11268   Vector3 initialPosition(0.0f, 0.0f, 0.0f);
11269   actor.SetProperty(Actor::Property::POSITION, initialPosition);
11270
11271   // Build the animation
11272   Animation animation = Animation::New(2.0f);
11273
11274   //Test GetCurrentProgress return 0.0 as the duration is 0.0
11275   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
11276   DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 0.0f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
11277
11278   tet_infoline("Set target position in animation without intiating play");
11279
11280   for(unsigned int i = 0; i < targetPositions.size(); i++)
11281   {
11282     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[i], AlphaFunction::LINEAR);
11283   }
11284
11285   application.SendNotification();
11286   application.Render();
11287
11288   tet_infoline("Ensure position of actor is still at intial value");
11289
11290   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION);
11291   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION);
11292   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION);
11293
11294   tet_infoline("Play animation and ensure actor position is now target");
11295
11296   animation.Play();
11297   application.SendNotification();
11298   application.Render(1000u);
11299
11300   tet_infoline("Ensure position of actor is at target value when aninmation half way");
11301
11302   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION);
11303   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION);
11304   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION);
11305
11306   tet_printf("x position at half way point(%f)\n", actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x);
11307
11308   application.Render(2000u);
11309
11310   tet_infoline("Ensure position of actor is still at target value when aninmation complete");
11311
11312   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION);
11313   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION);
11314   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION);
11315
11316   END_TEST;
11317 }
11318
11319 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionP(void)
11320 {
11321   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");
11322
11323   TestApplication application;
11324
11325   std::vector<Vector3> targetSizes;
11326   std::vector<Vector3> targetPositions;
11327
11328   targetSizes.push_back(Vector3(100.0f, 100.0f, 100.0f));
11329   targetSizes.push_back(Vector3(50.0f, 10.0f, 100.0f));
11330
11331   targetPositions.push_back(Vector3(200.0f, 1.0f, 100.0f));
11332
11333   tet_infoline("Set initial position and set up animation to re-position actor");
11334
11335   Actor actor = Actor::New();
11336   application.GetScene().Add(actor);
11337   Vector3 initialSize(10.0f, 10.0f, 10.0f);
11338   Vector3 initialPosition(10.0f, 10.0f, 10.0f);
11339
11340   actor.SetProperty(Actor::Property::SIZE, initialSize);
11341   actor.SetProperty(Actor::Property::POSITION, initialPosition);
11342
11343   // Build the animation
11344   Animation animation = Animation::New(2.0f);
11345
11346   tet_infoline("Set target size in animation without intiating play");
11347   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
11348   tet_infoline("Set target position in animation without intiating play");
11349   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[0], AlphaFunction::LINEAR);
11350   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
11351
11352   application.SendNotification();
11353   application.Render();
11354
11355   tet_infoline("Ensure position of actor is still at intial size and position");
11356
11357   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION);
11358   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION);
11359   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION);
11360
11361   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialPosition.x, TEST_LOCATION);
11362   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialPosition.y, TEST_LOCATION);
11363   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialPosition.z, TEST_LOCATION);
11364
11365   tet_infoline("Play animation and ensure actor position and size is now matches targets");
11366
11367   animation.Play();
11368   application.SendNotification();
11369   application.Render(2000u);
11370
11371   tet_infoline("Ensure position and size of actor is at target value when aninmation playing");
11372
11373   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION);
11374   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION);
11375   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION);
11376
11377   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[0].x, TEST_LOCATION);
11378   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[0].y, TEST_LOCATION);
11379   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[0].z, TEST_LOCATION);
11380
11381   END_TEST;
11382 }
11383
11384 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionColourP(void)
11385 {
11386   tet_infoline("Setting up an animation should not effect it's size property until the animation plays even if other Properties animated");
11387
11388   TestApplication application;
11389
11390   std::vector<Vector3> targetSizes;
11391   std::vector<float>   targetColors;
11392
11393   targetSizes.push_back(Vector3(100.0f, 100.0f, 100.0f));
11394   targetSizes.push_back(Vector3(50.0f, 10.0f, 150.0f));
11395
11396   targetColors.push_back(1.0f);
11397
11398   tet_infoline("Set initial position and set up animation to re-position actor");
11399
11400   Actor actor = Actor::New();
11401   application.GetScene().Add(actor);
11402   Vector3 initialSize(10.0f, 5.0f, 10.0f);
11403
11404   actor.SetProperty(Actor::Property::SIZE, initialSize);
11405
11406   // Build the animation
11407   Animation animation = Animation::New(2.0f);
11408
11409   tet_infoline("Set target size in animation without initiating play");
11410   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
11411   tet_infoline("Set target position in animation without intiating play");
11412   animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetColors[0], AlphaFunction::LINEAR);
11413   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
11414
11415   application.SendNotification();
11416   application.Render();
11417
11418   tet_infoline("Ensure position of actor is still at initial size and position");
11419
11420   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION);
11421   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION);
11422   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION);
11423
11424   tet_infoline("Play animation and ensure actor position and size is now matches targets");
11425
11426   animation.Play();
11427   application.SendNotification();
11428   application.Render(2000u);
11429
11430   tet_infoline("Ensure position and size of actor is at target value when animation playing");
11431
11432   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION);
11433   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION);
11434   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION);
11435
11436   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColors[0], TEST_LOCATION);
11437
11438   END_TEST;
11439 }
11440
11441 int UtcDaliAnimationTimePeriodOrder(void)
11442 {
11443   tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place");
11444
11445   TestApplication application;
11446
11447   Actor actor = Actor::New();
11448   application.GetScene().Add(actor);
11449
11450   application.SendNotification();
11451   application.Render();
11452
11453   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11454   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11455   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11456   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11457   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11458
11459   //////////////////////////////////////////////////////////////////////////////////
11460
11461   tet_infoline("With two AnimateTo calls");
11462
11463   Animation animation = Animation::New(0.0f);
11464   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(3.0f, 1.0f));
11465   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(1.0f, 1.0f));
11466   animation.Play();
11467
11468   tet_infoline("The target position should change instantly");
11469   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11470   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11471
11472   application.SendNotification();
11473   application.Render(5000); // After the animation is complete
11474
11475   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11476   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11477   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11478
11479   //////////////////////////////////////////////////////////////////////////////////
11480
11481   tet_infoline("Same animation again but in a different order - should yield the same result");
11482
11483   actor.SetProperty(Actor::Property::POSITION_X, 0.0f);
11484   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11485   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11486
11487   application.SendNotification();
11488   application.Render();
11489
11490   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11491   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11492   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11493
11494   animation = Animation::New(0.0f);
11495   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(1.0f, 1.0f));
11496   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(3.0f, 1.0f));
11497   animation.Play();
11498
11499   tet_infoline("The target position should change instantly");
11500   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11501   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11502
11503   application.SendNotification();
11504   application.Render(5000); // After the animation is complete
11505
11506   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11507   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11508   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11509
11510   END_TEST;
11511 }
11512
11513 int UtcDaliAnimationTimePeriodOrderSeveralAnimateToCalls(void)
11514 {
11515   tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place with several AnimateTo calls");
11516
11517   TestApplication application;
11518
11519   Actor actor = Actor::New();
11520   application.GetScene().Add(actor);
11521
11522   application.SendNotification();
11523   application.Render();
11524
11525   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11526   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11527   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11528   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11529   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11530
11531   //////////////////////////////////////////////////////////////////////////////////
11532
11533   tet_infoline("");
11534
11535   Animation animation = Animation::New(0.0f);
11536   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1000.0f, TimePeriod(4.0f, 2.0f));
11537   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 145.0f, TimePeriod(3.0f, 10.0f));
11538   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 109.0f, TimePeriod(1.0f, 1.0f));
11539   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1.0f, TimePeriod(3.0f, 4.0f));
11540   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 200.0f, TimePeriod(2.0f, 5.0f));
11541   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(10.0f, 2.0f));
11542   animation.Play();
11543
11544   tet_infoline("The target position should change instantly");
11545   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11546   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11547
11548   application.SendNotification();
11549   application.Render(14000); // After the animation is complete
11550
11551   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11552   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11553   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11554
11555   //////////////////////////////////////////////////////////////////////////////////
11556
11557   tet_infoline("Same animation again but in a different order - should end up at the same point");
11558
11559   actor.SetProperty(Actor::Property::POSITION_X, 0.0f);
11560
11561   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11562   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11563
11564   application.SendNotification();
11565   application.Render();
11566
11567   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11568   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11569   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11570
11571   animation = Animation::New(0.0f);
11572   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 200.0f, TimePeriod(2.0f, 5.0f));
11573   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(10.0f, 2.0f));
11574   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 145.0f, TimePeriod(3.0f, 10.0f));
11575   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1000.0f, TimePeriod(4.0f, 2.0f));
11576   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1.0f, TimePeriod(3.0f, 4.0f));
11577   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 109.0f, TimePeriod(1.0f, 1.0f));
11578   animation.Play();
11579
11580   tet_infoline("The target position should change instantly");
11581   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11582   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11583
11584   application.SendNotification();
11585   application.Render(14000); // After the animation is complete
11586
11587   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11588   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11589   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11590
11591   END_TEST;
11592 }
11593
11594 int UtcDaliAnimationAnimateBetweenIntegerP(void)
11595 {
11596   TestApplication application;
11597
11598   int                   startValue(1);
11599   Actor                 actor = Actor::New();
11600   const Property::Index index = actor.RegisterProperty("customProperty", startValue);
11601   application.GetScene().Add(actor);
11602
11603   application.Render();
11604   application.SendNotification();
11605
11606   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11607
11608   // Build the animation
11609   float     durationSeconds(1.0f);
11610   Animation animation = Animation::New(durationSeconds);
11611
11612   KeyFrames keyFrames = KeyFrames::New();
11613   keyFrames.Add(0.0f, 10);
11614   keyFrames.Add(0.2f, 20);
11615   keyFrames.Add(0.4f, 30);
11616   keyFrames.Add(0.6f, 40);
11617   keyFrames.Add(0.8f, 50);
11618   keyFrames.Add(1.0f, 60);
11619
11620   animation.AnimateBetween(Property(actor, index), keyFrames);
11621
11622   // Start the animation
11623   animation.Play();
11624
11625   // Target value should change to the last key-frame's value straight away
11626   DALI_TEST_EQUALS(actor.GetProperty<int>(index), 60, TEST_LOCATION);
11627
11628   END_TEST;
11629 }
11630
11631 int UtcDaliAnimationAnimateBetweenVector2P(void)
11632 {
11633   TestApplication application;
11634
11635   Vector2               startValue(10.0f, 20.0f);
11636   Actor                 actor = Actor::New();
11637   const Property::Index index = actor.RegisterProperty("customProperty", startValue);
11638   application.GetScene().Add(actor);
11639
11640   application.Render();
11641   application.SendNotification();
11642
11643   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
11644
11645   // Build the animation
11646   float     durationSeconds(1.0f);
11647   Animation animation = Animation::New(durationSeconds);
11648
11649   KeyFrames keyFrames = KeyFrames::New();
11650   keyFrames.Add(0.0f, Vector2(0.0f, 5.0f));
11651   keyFrames.Add(0.2f, Vector2(30.0f, 25.0f));
11652   keyFrames.Add(0.4f, Vector2(40.0f, 35.0f));
11653   keyFrames.Add(0.6f, Vector2(50.0f, 45.0f));
11654   keyFrames.Add(0.8f, Vector2(60.0f, 55.0f));
11655   keyFrames.Add(1.0f, Vector2(70.0f, 65.0f));
11656
11657   animation.AnimateBetween(Property(actor, index), keyFrames);
11658
11659   // Start the animation
11660   animation.Play();
11661
11662   // Target value should change to the last key-frame's value straight away
11663   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), Vector2(70.0f, 65.0f), TEST_LOCATION);
11664
11665   END_TEST;
11666 }
11667
11668 int UtcDaliAnimationProgressCallbackP(void)
11669 {
11670   TestApplication application;
11671
11672   Actor actor = Actor::New();
11673   application.GetScene().Add(actor);
11674
11675   // Build the animation
11676   Animation animation = Animation::New(0.0f);
11677
11678   //Set duration
11679   float durationSeconds(1.0f);
11680   animation.SetDuration(durationSeconds);
11681
11682   bool finishedSignalReceived(false);
11683   bool progressSignalReceived(false);
11684
11685   AnimationFinishCheck finishCheck(finishedSignalReceived);
11686   animation.FinishedSignal().Connect(&application, finishCheck);
11687
11688   AnimationProgressCheck progressCheck(progressSignalReceived);
11689   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
11690   application.SendNotification();
11691
11692   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11693   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
11694
11695   tet_infoline("Animation Progress notification set to 30%");
11696   DevelAnimation::SetProgressNotification(animation, 0.3f);
11697
11698   application.SendNotification();
11699   application.Render();
11700
11701   DALI_TEST_EQUALS(0.3f, DevelAnimation::GetProgressNotification(animation), TEST_LOCATION);
11702
11703   progressCheck.CheckSignalNotReceived();
11704
11705   // Start the animation from 10% progress
11706   animation.SetCurrentProgress(0.1f);
11707   animation.Play();
11708
11709   tet_infoline("Animation Playing from 10%");
11710
11711   application.SendNotification();
11712   application.Render(0);                        // start animation
11713   application.Render(durationSeconds * 100.0f); // 20% progress
11714
11715   tet_infoline("Animation at 20%");
11716
11717   progressCheck.CheckSignalNotReceived();
11718
11719   application.SendNotification();
11720   application.Render(durationSeconds * 200.0f); // 40% progress
11721   application.SendNotification();
11722   tet_infoline("Animation at 40%");
11723   DALI_TEST_EQUALS(0.4f, animation.GetCurrentProgress(), TEST_LOCATION);
11724
11725   progressCheck.CheckSignalReceived();
11726
11727   tet_infoline("Progress check reset");
11728   progressCheck.Reset();
11729
11730   application.Render(durationSeconds * 100.0f); // 50% progress
11731   tet_infoline("Animation at 50%");
11732   application.SendNotification();
11733
11734   DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
11735
11736   progressCheck.CheckSignalNotReceived();
11737
11738   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 60% progress */);
11739   application.SendNotification();
11740
11741   tet_infoline("Animation at 60%");
11742
11743   finishCheck.CheckSignalNotReceived();
11744
11745   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
11746   application.SendNotification();
11747   DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
11748   tet_infoline("Animation at 80%");
11749
11750   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
11751   // We did expect the animation to finish
11752   application.SendNotification();
11753   finishCheck.CheckSignalReceived();
11754   tet_infoline("Animation finished");
11755   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11756
11757   END_TEST;
11758 }
11759
11760 int UtcDaliAnimationPlayAfterP(void)
11761 {
11762   TestApplication application;
11763
11764   tet_printf("Testing that playing after 2 seconds\n");
11765
11766   {
11767     Actor actor = Actor::New();
11768     application.GetScene().Add(actor);
11769
11770     // Build the animation
11771     float     durationSeconds(1.0f);
11772     Animation animation = Animation::New(durationSeconds);
11773
11774     bool                 signalReceived(false);
11775     AnimationFinishCheck finishCheck(signalReceived);
11776     animation.FinishedSignal().Connect(&application, finishCheck);
11777     application.SendNotification();
11778
11779     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11780     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
11781
11782     // Play animation after the initial delay time
11783     animation.PlayAfter(0.2f);
11784     application.SendNotification();
11785     application.Render(0); // start animation
11786
11787     application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
11788     application.SendNotification();
11789     finishCheck.CheckSignalNotReceived();
11790     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move
11791
11792     application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
11793
11794     // We didn't expect the animation to finish yet
11795     application.SendNotification();
11796     finishCheck.CheckSignalNotReceived();
11797     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
11798
11799     application.SendNotification();
11800     application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
11801
11802     application.SendNotification();
11803     finishCheck.CheckSignalNotReceived();
11804     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
11805
11806     application.SendNotification();
11807     application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
11808
11809     // We did expect the animation to finish
11810     application.SendNotification();
11811     finishCheck.CheckSignalReceived();
11812     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11813
11814     // Check that nothing has changed after a couple of buffer swaps
11815     application.Render(0);
11816     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11817   }
11818
11819   tet_printf("Testing that playing after 2 seconds with negative speedfactor\n");
11820   // SpeedFactor < 0
11821   {
11822     Actor actor = Actor::New();
11823     application.GetScene().Add(actor);
11824
11825     // Build the animation
11826     float     durationSeconds(1.0f);
11827     Animation animation = Animation::New(durationSeconds);
11828     animation.SetSpeedFactor(-1.0f); // Set SpeedFactor as < 0
11829
11830     bool                 signalReceived(false);
11831     AnimationFinishCheck finishCheck(signalReceived);
11832     animation.FinishedSignal().Connect(&application, finishCheck);
11833     application.SendNotification();
11834
11835     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11836     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
11837
11838     // Play animation after the initial delay time
11839     animation.PlayAfter(0.2f);
11840     application.SendNotification();
11841     application.Render(0); // start animation
11842
11843     application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
11844     application.SendNotification();
11845     finishCheck.CheckSignalNotReceived();
11846     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 1.0f), TEST_LOCATION); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
11847
11848     application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% animation progress, 50% animator progress */);
11849
11850     // We didn't expect the animation to finish yet
11851     application.SendNotification();
11852     finishCheck.CheckSignalNotReceived();
11853     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
11854
11855     application.SendNotification();
11856     application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% animation progress, 100% animator progress */);
11857
11858     application.SendNotification();
11859     finishCheck.CheckSignalNotReceived();
11860     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION);
11861
11862     application.SendNotification();
11863     application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
11864
11865     // We did expect the animation to finish
11866     application.SendNotification();
11867     finishCheck.CheckSignalReceived();
11868     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of Timeperiod in seconds
11869
11870     // Check that nothing has changed after a couple of buffer swaps
11871     application.Render(0);
11872     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0, 0.0, 0.0), TEST_LOCATION);
11873   }
11874
11875   END_TEST;
11876 }
11877
11878 int UtcDaliAnimationPlayAfterP2(void)
11879 {
11880   TestApplication application;
11881
11882   tet_printf("Testing that playing after 2 seconds before looping\n");
11883
11884   {
11885     Actor actor = Actor::New();
11886     application.GetScene().Add(actor);
11887
11888     // Build the animation
11889     float     durationSeconds(1.0f);
11890     Animation animation = Animation::New(durationSeconds);
11891     animation.SetLooping(true);
11892
11893     bool                 signalReceived(false);
11894     AnimationFinishCheck finishCheck(signalReceived);
11895     animation.FinishedSignal().Connect(&application, finishCheck);
11896     application.SendNotification();
11897
11898     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11899     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
11900
11901     // Play animation after the initial delay time
11902     animation.PlayAfter(0.2f);
11903     application.SendNotification();
11904     application.Render(0); // start animation
11905
11906     for(int iterations = 0; iterations < 3; ++iterations)
11907     {
11908       // The initial delay time of PlayAfter() applies only once in looping mode.
11909       if(iterations == 0)
11910       {
11911         application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
11912         application.SendNotification();
11913         finishCheck.CheckSignalNotReceived();
11914         DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move
11915       }
11916
11917       application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
11918
11919       // We didn't expect the animation to finish yet
11920       application.SendNotification();
11921       finishCheck.CheckSignalNotReceived();
11922       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
11923
11924       application.SendNotification();
11925       application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
11926
11927       application.SendNotification();
11928       finishCheck.CheckSignalNotReceived();
11929       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
11930
11931       application.SendNotification();
11932       application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% progress */);
11933
11934       // We did expect the animation to finish
11935       application.SendNotification();
11936       finishCheck.CheckSignalNotReceived();
11937       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11938     }
11939
11940     animation.SetLooping(false);
11941     application.SendNotification();
11942     application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
11943
11944     application.SendNotification();
11945     finishCheck.CheckSignalReceived();
11946     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11947   }
11948
11949   tet_printf("Testing that playing after 2 seconds before looping with negative speedfactor\n");
11950   // SpeedFactor < 0
11951   {
11952     Actor actor = Actor::New();
11953     application.GetScene().Add(actor);
11954
11955     // Build the animation
11956     float     durationSeconds(1.0f);
11957     Animation animation = Animation::New(durationSeconds);
11958     animation.SetLooping(true);
11959     animation.SetSpeedFactor(-1.0f); //Set SpeedFactor as < 0
11960
11961     bool                 signalReceived(false);
11962     AnimationFinishCheck finishCheck(signalReceived);
11963     animation.FinishedSignal().Connect(&application, finishCheck);
11964     application.SendNotification();
11965
11966     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11967     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
11968
11969     // Play animation after the initial delay time
11970     animation.PlayAfter(0.2f);
11971     application.SendNotification();
11972     application.Render(0); // start animation
11973
11974     for(int iterations = 0; iterations < 3; ++iterations)
11975     {
11976       // The initial delay time of PlayAfter() applies only once in looping mode.
11977       if(iterations == 0)
11978       {
11979         application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
11980         application.SendNotification();
11981         finishCheck.CheckSignalNotReceived();
11982         DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 1.0f), TEST_LOCATION); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
11983       }
11984
11985       application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% animation progress, 50% animator progress */);
11986
11987       // We didn't expect the animation to finish yet
11988       application.SendNotification();
11989       finishCheck.CheckSignalNotReceived();
11990       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
11991
11992       application.SendNotification();
11993       application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% animation progress, 100% animator progress */);
11994
11995       application.SendNotification();
11996       finishCheck.CheckSignalNotReceived();
11997       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION);
11998
11999       application.SendNotification();
12000       application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 100% progress */);
12001
12002       // We did expect the animation to finish
12003       application.SendNotification();
12004       finishCheck.CheckSignalNotReceived();
12005       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in second
12006     }
12007
12008     animation.SetLooping(false);
12009     application.SendNotification();
12010     application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
12011
12012     application.SendNotification();
12013     finishCheck.CheckSignalReceived();
12014     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0, 0.0, 0.0), TEST_LOCATION);
12015   }
12016
12017   END_TEST;
12018 }
12019
12020 int UtcDaliAnimationPlayAfterP3(void)
12021 {
12022   TestApplication application;
12023
12024   tet_printf("Testing that PlayAfter with the negative delay seconds\n");
12025
12026   Actor actor = Actor::New();
12027   application.GetScene().Add(actor);
12028
12029   // Build the animation
12030   float     durationSeconds(1.0f);
12031   Animation animation = Animation::New(durationSeconds);
12032
12033   bool                 signalReceived(false);
12034   AnimationFinishCheck finishCheck(signalReceived);
12035   animation.FinishedSignal().Connect(&application, finishCheck);
12036   application.SendNotification();
12037
12038   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12039   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
12040
12041   // When the delay time is negative value, it would treat as play immediately.
12042   animation.PlayAfter(-2.0f);
12043   application.SendNotification();
12044   application.Render(0); // start animation
12045
12046   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
12047
12048   // We didn't expect the animation to finish yet
12049   application.SendNotification();
12050   finishCheck.CheckSignalNotReceived();
12051   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
12052
12053   application.SendNotification();
12054   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
12055
12056   application.SendNotification();
12057   finishCheck.CheckSignalNotReceived();
12058   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
12059
12060   application.SendNotification();
12061   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
12062
12063   // We did expect the animation to finish
12064   application.SendNotification();
12065   finishCheck.CheckSignalReceived();
12066   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12067
12068   // Check that nothing has changed after a couple of buffer swaps
12069   application.Render(0);
12070   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12071   END_TEST;
12072 }
12073
12074 int UtcDaliAnimationPlayAfterP4(void)
12075 {
12076   TestApplication application;
12077
12078   tet_printf("Testing that PlayAfter with progress value\n");
12079
12080   Actor actor = Actor::New();
12081   application.GetScene().Add(actor);
12082
12083   // Build the animation
12084   float     durationSeconds(1.0f);
12085   Animation animation = Animation::New(durationSeconds);
12086
12087   bool                 signalReceived(false);
12088   AnimationFinishCheck finishCheck(signalReceived);
12089   animation.FinishedSignal().Connect(&application, finishCheck);
12090   application.SendNotification();
12091
12092   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12093   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
12094
12095   // Delay time is 0.3s. So after duration times, progress must be 70%. animation will finished at 1.3s.
12096   animation.PlayAfter(durationSeconds * 0.3f);
12097   application.SendNotification();
12098   application.Render(0); // start animation
12099
12100   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 5/6 delay progress, 0% animation progress, 0% animator progress */);
12101
12102   // We didn't expect the animation to finish yet
12103   application.SendNotification();
12104   finishCheck.CheckSignalNotReceived();
12105   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of PlayAfter
12106
12107   application.SendNotification();
12108   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 20% animation progress, 0% animator progress */);
12109
12110   application.SendNotification();
12111   finishCheck.CheckSignalNotReceived();
12112   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
12113
12114   application.SendNotification();
12115   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 45% animation progress, 0% animator progress */);
12116
12117   application.SendNotification();
12118   finishCheck.CheckSignalNotReceived();
12119   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
12120
12121   application.SendNotification();
12122   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 70% animation progress, 40% animator progress */);
12123
12124   application.SendNotification();
12125   finishCheck.CheckSignalNotReceived();
12126   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION); // 40% of animator progress
12127
12128   application.SendNotification();
12129   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 95% animation progress, 90% animator progress */);
12130
12131   application.SendNotification();
12132   finishCheck.CheckSignalNotReceived();
12133   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.9f), TEST_LOCATION); // 90% of animator progress
12134
12135   application.SendNotification();
12136   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
12137
12138   // We did expect the animation to finish
12139   application.SendNotification();
12140   finishCheck.CheckSignalReceived();
12141   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12142
12143   // Check that nothing has changed after a couple of buffer swaps
12144   application.Render(0);
12145   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12146   END_TEST;
12147 }
12148
12149 int UtcDaliAnimationSetLoopingModeP(void)
12150 {
12151   // Test Loop forever and Loop mode being set
12152   TestApplication    application;
12153   Integration::Scene stage(application.GetScene());
12154
12155   // Default: LoopingMode::RESTART
12156   {
12157     Actor actor = Actor::New();
12158     stage.Add(actor);
12159
12160     float     durationSeconds(1.0f);
12161     Animation animation = Animation::New(durationSeconds);
12162     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::RESTART);
12163
12164     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
12165     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12166
12167     // Start the animation
12168     animation.Play();
12169     application.SendNotification();
12170     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
12171
12172     actor.Unparent();
12173
12174     application.SendNotification();
12175     application.Render();
12176     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12177   }
12178
12179   // LoopingMode::AUTO_REVERSE
12180   {
12181     Actor actor = Actor::New();
12182     stage.Add(actor);
12183
12184     float     durationSeconds(1.0f);
12185     Animation animation = Animation::New(durationSeconds);
12186     animation.SetLooping(true);
12187
12188     bool                 signalReceived(false);
12189     AnimationFinishCheck finishCheck(signalReceived);
12190     animation.FinishedSignal().Connect(&application, finishCheck);
12191     application.SendNotification();
12192
12193     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12194     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12195
12196     animation.SetLoopingMode(Animation::LoopingMode::AUTO_REVERSE);
12197     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12198
12199     // Start the animation
12200     animation.Play();
12201     application.SendNotification();
12202     application.Render(0);
12203
12204     for(int iterations = 0; iterations < 3; ++iterations)
12205     {
12206       application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% time progress */);
12207       application.SendNotification();
12208       finishCheck.CheckSignalNotReceived();
12209
12210       // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12211       // and arrives at the beginning.
12212       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12213
12214       application.SendNotification();
12215       application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 100% time progress */);
12216
12217       // We did expect the animation to finish
12218       application.SendNotification();
12219       finishCheck.CheckSignalNotReceived();
12220       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12221     }
12222
12223     animation.SetLooping(false);
12224     application.SendNotification();
12225     application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
12226
12227     application.SendNotification();
12228     finishCheck.CheckSignalReceived();
12229
12230     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12231   }
12232
12233   // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12234   {
12235     Actor actor = Actor::New();
12236     stage.Add(actor);
12237
12238     float     durationSeconds(1.0f);
12239     Animation animation = Animation::New(durationSeconds);
12240     animation.SetLooping(true);
12241
12242     bool                 signalReceived(false);
12243     AnimationFinishCheck finishCheck(signalReceived);
12244     animation.FinishedSignal().Connect(&application, finishCheck);
12245     application.SendNotification();
12246
12247     // Specify a negative multiplier to play the animation in reverse
12248     animation.SetSpeedFactor(-1.0f);
12249
12250     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12251     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12252
12253     animation.SetLoopingMode(Animation::AUTO_REVERSE);
12254     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12255
12256     // Start the animation
12257     animation.Play();
12258     application.SendNotification();
12259     application.Render(0);
12260
12261     for(int iterations = 0; iterations < 3; ++iterations)
12262     {
12263       application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% time progress */);
12264       application.SendNotification();
12265       finishCheck.CheckSignalNotReceived();
12266
12267       // Setting a negative speed factor is to play the animation in reverse.
12268       // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12269       // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12270       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12271
12272       application.SendNotification();
12273       application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 100% time progress */);
12274
12275       // We did expect the animation to finish
12276       application.SendNotification();
12277       finishCheck.CheckSignalNotReceived();
12278       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12279     }
12280
12281     animation.SetLooping(false);
12282     application.SendNotification();
12283     application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
12284
12285     application.SendNotification();
12286     finishCheck.CheckSignalReceived();
12287
12288     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12289   }
12290
12291   END_TEST;
12292 }
12293
12294 int UtcDaliAnimationSetLoopingModeP2(void)
12295 {
12296   // Test Loop Count and Loop mode being set
12297   TestApplication    application;
12298   Integration::Scene stage(application.GetScene());
12299
12300   // LoopingMode::AUTO_REVERSE
12301   {
12302     Actor actor = Actor::New();
12303     stage.Add(actor);
12304
12305     float     durationSeconds(1.0f);
12306     Animation animation = Animation::New(durationSeconds);
12307     animation.SetLoopCount(3);
12308     DALI_TEST_CHECK(animation.IsLooping());
12309
12310     bool                 signalReceived(false);
12311     AnimationFinishCheck finishCheck(signalReceived);
12312     animation.FinishedSignal().Connect(&application, finishCheck);
12313     application.SendNotification();
12314
12315     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12316     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12317
12318     animation.SetLoopingMode(Animation::AUTO_REVERSE);
12319     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12320
12321     // Start the animation
12322     animation.Play();
12323
12324     application.Render(0);
12325     application.SendNotification();
12326     application.Render(0);
12327     application.SendNotification();
12328     application.Render(0);
12329     application.SendNotification();
12330     application.Render(0);
12331     application.SendNotification();
12332
12333     // Loop
12334     float intervalSeconds = 3.0f;
12335
12336     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12337     // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12338     // and arrives at the beginning.
12339     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12340
12341     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12342
12343     application.Render(0);
12344     application.SendNotification();
12345     application.Render(0);
12346     application.SendNotification();
12347     application.Render(0);
12348     application.SendNotification();
12349     application.Render(0);
12350     application.SendNotification();
12351     finishCheck.CheckSignalNotReceived();
12352
12353     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12354
12355     application.SendNotification();
12356     finishCheck.CheckSignalReceived();
12357     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12358
12359     finishCheck.Reset();
12360   }
12361
12362   // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12363   {
12364     Actor actor = Actor::New();
12365     stage.Add(actor);
12366
12367     float     durationSeconds(1.0f);
12368     Animation animation = Animation::New(durationSeconds);
12369     animation.SetLoopCount(3);
12370     DALI_TEST_CHECK(animation.IsLooping());
12371
12372     bool                 signalReceived(false);
12373     AnimationFinishCheck finishCheck(signalReceived);
12374     animation.FinishedSignal().Connect(&application, finishCheck);
12375     application.SendNotification();
12376
12377     // Specify a negative multiplier to play the animation in reverse
12378     animation.SetSpeedFactor(-1.0f);
12379
12380     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12381     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12382
12383     animation.SetLoopingMode(Animation::AUTO_REVERSE);
12384     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12385
12386     // Start the animation
12387     animation.Play();
12388
12389     application.Render(0);
12390     application.SendNotification();
12391     application.Render(0);
12392     application.SendNotification();
12393     application.Render(0);
12394     application.SendNotification();
12395     application.Render(0);
12396     application.SendNotification();
12397
12398     // Loop
12399     float intervalSeconds = 3.0f;
12400
12401     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12402     // Setting a negative speed factor is to play the animation in reverse.
12403     // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12404     // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12405     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12406
12407     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12408
12409     application.Render(0);
12410     application.SendNotification();
12411     application.Render(0);
12412     application.SendNotification();
12413     application.Render(0);
12414     application.SendNotification();
12415     application.Render(0);
12416     application.SendNotification();
12417     finishCheck.CheckSignalNotReceived();
12418
12419     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12420
12421     application.SendNotification();
12422     finishCheck.CheckSignalReceived();
12423     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12424
12425     finishCheck.Reset();
12426   }
12427
12428   END_TEST;
12429 }
12430
12431 int UtcDaliAnimationSetLoopingModeP3(void)
12432 {
12433   // Test Loop Count is 1 (== default) and Loop mode being set
12434   TestApplication    application;
12435   Integration::Scene stage(application.GetScene());
12436
12437   // LoopingMode::AUTO_REVERSE
12438   {
12439     Actor actor = Actor::New();
12440     stage.Add(actor);
12441
12442     float     durationSeconds(1.0f);
12443     Animation animation = Animation::New(durationSeconds);
12444     DALI_TEST_CHECK(1 == animation.GetLoopCount());
12445
12446     bool                 signalReceived(false);
12447     AnimationFinishCheck finishCheck(signalReceived);
12448     animation.FinishedSignal().Connect(&application, finishCheck);
12449     application.SendNotification();
12450
12451     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12452     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12453
12454     animation.SetLoopingMode(Animation::AUTO_REVERSE);
12455     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12456
12457     // Start the animation
12458     animation.Play();
12459     application.Render(0);
12460     application.SendNotification();
12461
12462     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 50% time progress */);
12463     application.SendNotification();
12464     finishCheck.CheckSignalNotReceived();
12465
12466     // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12467     // and arrives at the beginning.
12468     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12469
12470     application.SendNotification();
12471     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 100% time progress */);
12472
12473     application.SendNotification();
12474     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12475
12476     application.SendNotification();
12477     application.Render(static_cast<unsigned int>(durationSeconds * 1.0f * 1000.0f) + 1u /*just beyond the animation duration*/);
12478
12479     application.SendNotification();
12480     application.Render(0);
12481     application.SendNotification();
12482     finishCheck.CheckSignalReceived();
12483
12484     // After all animation finished, arrives at the beginning.
12485     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12486
12487     finishCheck.Reset();
12488   }
12489
12490   // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12491   {
12492     Actor actor = Actor::New();
12493     stage.Add(actor);
12494
12495     float     durationSeconds(1.0f);
12496     Animation animation = Animation::New(durationSeconds);
12497     DALI_TEST_CHECK(1 == animation.GetLoopCount());
12498
12499     bool                 signalReceived(false);
12500     AnimationFinishCheck finishCheck(signalReceived);
12501     animation.FinishedSignal().Connect(&application, finishCheck);
12502     application.SendNotification();
12503
12504     // Specify a negative multiplier to play the animation in reverse
12505     animation.SetSpeedFactor(-1.0f);
12506
12507     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12508     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12509
12510     animation.SetLoopingMode(Animation::AUTO_REVERSE);
12511     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12512
12513     // Start the animation
12514     animation.Play();
12515     application.Render(0);
12516     application.SendNotification();
12517
12518     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 50% time progress */);
12519     application.SendNotification();
12520     finishCheck.CheckSignalNotReceived();
12521
12522     // Setting a negative speed factor is to play the animation in reverse.
12523     // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12524     // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12525     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12526
12527     application.SendNotification();
12528     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 100% time progress */);
12529
12530     application.SendNotification();
12531     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12532
12533     application.SendNotification();
12534     application.Render(static_cast<unsigned int>(durationSeconds * 1.0f * 1000.0f) + 1u /*just beyond the animation duration*/);
12535
12536     application.SendNotification();
12537     application.Render(0);
12538     application.SendNotification();
12539     finishCheck.CheckSignalReceived();
12540
12541     // After all animation finished, arrives at the target.
12542     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12543
12544     finishCheck.Reset();
12545   }
12546
12547   END_TEST;
12548 }
12549
12550 int UtcDaliAnimationGetLoopingModeP(void)
12551 {
12552   TestApplication application;
12553
12554   Animation animation = Animation::New(1.0f);
12555
12556   // default mode
12557   DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::RESTART);
12558
12559   animation.SetLoopingMode(Animation::AUTO_REVERSE);
12560   DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12561
12562   END_TEST;
12563 }
12564
12565 int UtcDaliAnimationProgressSignalConnectionWithoutProgressMarkerP(void)
12566 {
12567   TestApplication application;
12568
12569   tet_infoline("Connect to ProgressReachedSignal but do not set a required Progress marker");
12570
12571   Actor actor = Actor::New();
12572   application.GetScene().Add(actor);
12573
12574   // Build the animation
12575   Animation animation = Animation::New(0.0f);
12576
12577   //Set duration
12578   float durationSeconds(1.0f);
12579   animation.SetDuration(durationSeconds);
12580
12581   bool finishedSignalReceived(false);
12582   bool progressSignalReceived(false);
12583
12584   AnimationFinishCheck finishCheck(finishedSignalReceived);
12585   animation.FinishedSignal().Connect(&application, finishCheck);
12586
12587   AnimationProgressCheck progressCheck(progressSignalReceived);
12588   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
12589   application.SendNotification();
12590
12591   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12592   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12593
12594   progressCheck.CheckSignalNotReceived();
12595
12596   animation.Play();
12597
12598   application.SendNotification();
12599   application.Render(0);                        // start animation
12600   application.Render(durationSeconds * 100.0f); // 10% progress
12601   application.SendNotification();
12602
12603   tet_infoline("Ensure after animation has started playing that ProgressReachedSignal not emitted");
12604   progressCheck.CheckSignalNotReceived();
12605
12606   application.Render(static_cast<unsigned int>(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/);
12607
12608   application.SendNotification();
12609   finishCheck.CheckSignalReceived();
12610   tet_infoline("Animation finished");
12611   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12612
12613   END_TEST;
12614 }
12615
12616 int UtcDaliAnimationMultipleProgressSignalsP(void)
12617 {
12618   tet_infoline("Multiple animations with different progress markers");
12619
12620   TestApplication application;
12621
12622   Actor actor = Actor::New();
12623   application.GetScene().Add(actor);
12624
12625   // Build the animation
12626   Animation animationAlpha = Animation::New(0.0f);
12627   Animation animationBeta  = Animation::New(0.0f);
12628
12629   //Set duration
12630   float durationSeconds(1.0f);
12631   animationAlpha.SetDuration(durationSeconds);
12632   animationBeta.SetDuration(durationSeconds);
12633
12634   bool progressSignalReceivedAlpha(false);
12635   bool progressSignalReceivedBeta(false);
12636
12637   AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12638   AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta");
12639
12640   DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha);
12641   DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta);
12642   application.SendNotification();
12643
12644   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12645   animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12646   animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12647
12648   tet_infoline("AnimationAlpha Progress notification set to 30%");
12649   DevelAnimation::SetProgressNotification(animationAlpha, 0.3f);
12650
12651   tet_infoline("AnimationBeta Progress notification set to 50%");
12652   DevelAnimation::SetProgressNotification(animationBeta, 0.5f);
12653
12654   application.SendNotification();
12655   application.Render();
12656
12657   progressCheckAlpha.CheckSignalNotReceived();
12658   progressCheckBeta.CheckSignalNotReceived();
12659
12660   // Start the animations from 10% progress
12661   animationAlpha.SetCurrentProgress(0.1f);
12662   animationBeta.SetCurrentProgress(0.1f);
12663   animationAlpha.Play();
12664   animationBeta.Play();
12665
12666   tet_infoline("Animation Playing from 10%");
12667
12668   application.SendNotification();
12669   application.Render(0);                        // start animation
12670   application.Render(durationSeconds * 100.0f); // 20% progress
12671
12672   tet_infoline("Animation at 20% - No signals to be received");
12673
12674   progressCheckAlpha.CheckSignalNotReceived();
12675   progressCheckBeta.CheckSignalNotReceived();
12676
12677   application.SendNotification();
12678   application.Render(durationSeconds * 200.0f); // 40% progress
12679   application.SendNotification();
12680   tet_infoline("Animation at 40% - Alpha signal should be received");
12681   DALI_TEST_EQUALS(0.4f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
12682
12683   progressCheckAlpha.CheckSignalReceived();
12684   progressCheckBeta.CheckSignalNotReceived();
12685
12686   tet_infoline("Progress check reset");
12687   progressCheckAlpha.Reset();
12688   progressCheckBeta.Reset();
12689
12690   application.Render(durationSeconds * 100.0f); // 50% progress
12691   tet_infoline("Animation at 50% - Beta should receive signal, Alpha should not");
12692   application.SendNotification();
12693
12694   DALI_TEST_EQUALS(0.5f, animationBeta.GetCurrentProgress(), TEST_LOCATION);
12695
12696   progressCheckAlpha.CheckSignalNotReceived();
12697   progressCheckBeta.CheckSignalReceived();
12698   tet_infoline("Progress check reset");
12699   progressCheckAlpha.Reset();
12700   progressCheckBeta.Reset();
12701
12702   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 60% progress */);
12703   application.SendNotification();
12704
12705   tet_infoline("Animation at 60%");
12706
12707   progressCheckAlpha.CheckSignalNotReceived();
12708   progressCheckBeta.CheckSignalNotReceived();
12709
12710   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
12711   application.SendNotification();
12712   tet_infoline("Animation at 80%");
12713
12714   progressCheckAlpha.CheckSignalNotReceived();
12715   progressCheckBeta.CheckSignalNotReceived();
12716
12717   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
12718   // We did expect the animation to finish
12719   tet_infoline("Animation finished");
12720
12721   END_TEST;
12722 }
12723
12724 int UtcDaliAnimationMultipleProgressSignalsP2(void)
12725 {
12726   tet_infoline("Multiple animations with different progress markers and big step time");
12727
12728   TestApplication application;
12729
12730   Actor actor = Actor::New();
12731   application.GetScene().Add(actor);
12732
12733   // Build the animation
12734   Animation animationAlpha = Animation::New(0.0f);
12735   Animation animationBeta  = Animation::New(0.0f);
12736
12737   //Set duration
12738   const float durationSeconds(1.0f);
12739   animationAlpha.SetDuration(durationSeconds);
12740   animationBeta.SetDuration(durationSeconds);
12741
12742   bool progressSignalReceivedAlpha(false);
12743   bool progressSignalReceivedBeta(false);
12744
12745   AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12746   AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta");
12747
12748   DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha);
12749   DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta);
12750   application.SendNotification();
12751
12752   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12753   animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12754   animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12755
12756   tet_infoline("AnimationAlpha Progress notification set to 1%");
12757   DevelAnimation::SetProgressNotification(animationAlpha, 0.01f);
12758
12759   tet_infoline("AnimationBeta Progress notification set to 99%");
12760   DevelAnimation::SetProgressNotification(animationBeta, 0.99f);
12761
12762   application.SendNotification();
12763   application.Render();
12764
12765   progressCheckAlpha.CheckSignalNotReceived();
12766   progressCheckBeta.CheckSignalNotReceived();
12767
12768   // Start the animations unlimited looping
12769   animationAlpha.SetLooping(true);
12770   animationBeta.SetLooping(true);
12771   animationAlpha.Play();
12772   animationBeta.Play();
12773
12774   application.SendNotification();
12775   application.Render(0);                       // start animation
12776   application.Render(durationSeconds * 20.0f); // 2% progress
12777   application.SendNotification();
12778   DALI_TEST_EQUALS(0.02f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
12779
12780   tet_infoline("Animation at 2% - Alpha signals should be received, Beta should not.");
12781
12782   progressCheckAlpha.CheckSignalReceived();
12783   progressCheckBeta.CheckSignalNotReceived();
12784
12785   tet_infoline("Progress check reset");
12786   progressCheckAlpha.Reset();
12787   progressCheckBeta.Reset();
12788
12789   application.SendNotification();
12790   application.Render(durationSeconds * 960.0f); // 98% progress
12791   application.SendNotification();
12792   tet_infoline("Animation at 98% - No signal received");
12793   DALI_TEST_EQUALS(0.98f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
12794
12795   progressCheckAlpha.CheckSignalNotReceived();
12796   progressCheckBeta.CheckSignalNotReceived();
12797
12798   application.SendNotification();
12799   application.Render(durationSeconds * 40.0f); // 2% progress
12800   application.SendNotification();
12801   tet_infoline("Animation loop once and now 2% - Alpha and Beta should receive signal");
12802   application.SendNotification();
12803
12804   DALI_TEST_EQUALS(0.02f, animationBeta.GetCurrentProgress(), TEST_LOCATION);
12805
12806   progressCheckAlpha.CheckSignalReceived();
12807   progressCheckBeta.CheckSignalReceived();
12808
12809   tet_infoline("Progress check reset");
12810   progressCheckAlpha.Reset();
12811   progressCheckBeta.Reset();
12812
12813   application.SendNotification();
12814   application.Render(durationSeconds * 980.0f); // 100% progress
12815   application.SendNotification();
12816   tet_infoline("Animation loop one more time. and now 100% - Beta should receive signal, Alhpa sholud not");
12817   application.SendNotification();
12818
12819   progressCheckAlpha.CheckSignalNotReceived();
12820   progressCheckBeta.CheckSignalReceived();
12821
12822   tet_infoline("Progress check reset");
12823   progressCheckAlpha.Reset();
12824   progressCheckBeta.Reset();
12825
12826   animationAlpha.SetLooping(false);
12827   animationBeta.SetLooping(false);
12828
12829   application.SendNotification();
12830   application.Render(static_cast<unsigned int>(durationSeconds * 2000.0f) + 1u /*just beyond the animation duration*/);
12831   application.SendNotification();
12832
12833   // We did expect the animation to finish
12834   tet_infoline("Animation finished");
12835
12836   END_TEST;
12837 }
12838
12839 int UtcDaliAnimationProgressSignalWithPlayAfterP(void)
12840 {
12841   tet_infoline("Multiple animations with different progress markers");
12842
12843   TestApplication application;
12844
12845   Actor actor = Actor::New();
12846   application.GetScene().Add(actor);
12847
12848   // Build the animation
12849   Animation animationAlpha = Animation::New(0.0f);
12850   Animation animationBeta  = Animation::New(0.0f);
12851
12852   //Set duration
12853   float durationSeconds(1.0f);
12854   float delaySeconds(0.5f);
12855   animationAlpha.SetDuration(durationSeconds);
12856   animationBeta.SetDuration(durationSeconds);
12857
12858   bool progressSignalReceivedAlpha(false);
12859   bool progressSignalReceivedBeta(false);
12860
12861   AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12862   AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta");
12863
12864   DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha);
12865   DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta);
12866   application.SendNotification();
12867
12868   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12869   animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12870   animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12871
12872   tet_infoline("AnimationAlpha Progress notification set to 30%");
12873   DevelAnimation::SetProgressNotification(animationAlpha, 0.3f);
12874
12875   tet_infoline("AnimationBeta Progress notification set to ~0% (==Notify when delay is done)");
12876   DevelAnimation::SetProgressNotification(animationBeta, Math::MACHINE_EPSILON_1);
12877
12878   application.SendNotification();
12879   application.Render();
12880
12881   progressCheckAlpha.CheckSignalNotReceived();
12882   progressCheckBeta.CheckSignalNotReceived();
12883
12884   // Start the animations from 10% progress
12885   animationAlpha.PlayAfter(delaySeconds);
12886   animationBeta.PlayAfter(delaySeconds);
12887
12888   application.SendNotification();
12889   application.Render(0);                     // start animation
12890   application.Render(delaySeconds * 500.0f); // 50% wait progress
12891
12892   tet_infoline("Delay at 50% - No signals to be received");
12893
12894   progressCheckAlpha.CheckSignalNotReceived();
12895   progressCheckBeta.CheckSignalNotReceived();
12896
12897   application.SendNotification();
12898   application.Render(delaySeconds * 500.0f + durationSeconds * 50.0f); // 100% wait, 5% progress
12899   application.SendNotification();
12900   tet_infoline("Delay at 100%, Animation at 5% - Beta signal should be received");
12901   DALI_TEST_EQUALS(0.05f, animationBeta.GetCurrentProgress(), TEST_LOCATION);
12902
12903   progressCheckBeta.CheckSignalReceived();
12904   progressCheckAlpha.CheckSignalNotReceived();
12905
12906   tet_infoline("Progress check reset");
12907   progressCheckAlpha.Reset();
12908   progressCheckBeta.Reset();
12909
12910   application.Render(durationSeconds * 200.0f); // 25% progress
12911   tet_infoline("Animation at 25% - No signals to be received");
12912   application.SendNotification();
12913
12914   progressCheckAlpha.CheckSignalNotReceived();
12915   progressCheckBeta.CheckSignalNotReceived();
12916
12917   application.Render(durationSeconds * 200.0f); // 45% progress
12918   tet_infoline("Animation at 45% - Alpha should receive signal, Beta should not");
12919   application.SendNotification();
12920
12921   DALI_TEST_EQUALS(0.45f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
12922
12923   progressCheckAlpha.CheckSignalReceived();
12924   progressCheckBeta.CheckSignalNotReceived();
12925
12926   tet_infoline("Progress check reset");
12927   progressCheckAlpha.Reset();
12928   progressCheckBeta.Reset();
12929
12930   application.Render(static_cast<unsigned int>(durationSeconds * 150.0f) /* 60% progress */);
12931   application.SendNotification();
12932
12933   tet_infoline("Animation at 60%");
12934
12935   progressCheckAlpha.CheckSignalNotReceived();
12936   progressCheckBeta.CheckSignalNotReceived();
12937
12938   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
12939   application.SendNotification();
12940   tet_infoline("Animation at 80%");
12941
12942   progressCheckAlpha.CheckSignalNotReceived();
12943   progressCheckBeta.CheckSignalNotReceived();
12944
12945   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
12946   // We did expect the animation to finish
12947   tet_infoline("Animation finished");
12948
12949   END_TEST;
12950 }
12951
12952 int UtcDaliAnimationProgressCallbackWithLoopingP(void)
12953 {
12954   TestApplication application;
12955
12956   Actor actor = Actor::New();
12957   application.GetScene().Add(actor);
12958
12959   // Build the animation
12960   Animation animation = Animation::New(0.0f);
12961
12962   //Set duration
12963   const float durationSeconds(1.0f);
12964   animation.SetDuration(durationSeconds);
12965
12966   // Set Looping Count
12967   const int loopCount(4);
12968   animation.SetLoopCount(loopCount);
12969
12970   bool finishedSignalReceived(false);
12971   bool progressSignalReceived(false);
12972
12973   AnimationFinishCheck finishCheck(finishedSignalReceived);
12974   animation.FinishedSignal().Connect(&application, finishCheck);
12975
12976   AnimationProgressCheck progressCheck(progressSignalReceived);
12977   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
12978   application.SendNotification();
12979
12980   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12981   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12982
12983   tet_infoline("Animation Progress notification set to 50% with looping count 4");
12984   DevelAnimation::SetProgressNotification(animation, 0.5f);
12985
12986   application.SendNotification();
12987   application.Render();
12988
12989   progressCheck.CheckSignalNotReceived();
12990
12991   animation.Play();
12992
12993   for(int count = 0; count < loopCount; count++)
12994   {
12995     application.SendNotification();
12996     application.Render(0);                                // start animation
12997     application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
12998     DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
12999
13000     tet_infoline("Animation at 25%");
13001
13002     progressCheck.CheckSignalNotReceived();
13003
13004     application.SendNotification();
13005     application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13006     application.SendNotification();
13007     tet_infoline("Animation at 50%");
13008     DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13009
13010     progressCheck.CheckSignalReceived();
13011
13012     tet_infoline("Progress check reset");
13013     progressCheck.Reset();
13014
13015     application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13016     tet_infoline("Animation at 75%");
13017     application.SendNotification();
13018
13019     DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13020
13021     progressCheck.CheckSignalNotReceived();
13022
13023     application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
13024     tet_infoline("Animation at 100%");
13025     application.SendNotification();
13026
13027     //Nothing check at 100% progress. cause It can be both 100% and 0%.
13028     application.SendNotification();
13029   }
13030   application.Render(10u);
13031   application.SendNotification();
13032   application.Render(0u);
13033   application.SendNotification();
13034
13035   finishCheck.CheckSignalReceived();
13036
13037   END_TEST;
13038 }
13039
13040 int UtcDaliAnimationProgressCallbackWithLoopingP2(void)
13041 {
13042   TestApplication application;
13043
13044   Actor actor = Actor::New();
13045   application.GetScene().Add(actor);
13046
13047   // Build the animation
13048   Animation animation = Animation::New(0.0f);
13049
13050   //Set duration
13051   const float durationSeconds(1.0f);
13052   animation.SetDuration(durationSeconds);
13053
13054   // Set Looping Unlmited
13055   animation.SetLooping(true);
13056
13057   bool finishedSignalReceived(false);
13058   bool progressSignalReceived(false);
13059
13060   AnimationFinishCheck finishCheck(finishedSignalReceived);
13061   animation.FinishedSignal().Connect(&application, finishCheck);
13062
13063   AnimationProgressCheck progressCheck(progressSignalReceived);
13064   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13065   application.SendNotification();
13066
13067   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13068   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13069
13070   tet_infoline("Animation Progress notification set to 50% with unlimited looping");
13071   DevelAnimation::SetProgressNotification(animation, 0.5f);
13072
13073   application.SendNotification();
13074   application.Render();
13075
13076   progressCheck.CheckSignalNotReceived();
13077
13078   animation.Play();
13079
13080   for(int count = 0; count < 4; count++)
13081   {
13082     application.SendNotification();
13083     application.Render(0);                                // start animation
13084     application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13085     DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13086
13087     tet_infoline("Animation at 25%");
13088
13089     progressCheck.CheckSignalNotReceived();
13090
13091     application.SendNotification();
13092     application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13093     application.SendNotification();
13094     tet_infoline("Animation at 50%");
13095     DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13096
13097     progressCheck.CheckSignalReceived();
13098
13099     tet_infoline("Progress check reset");
13100     progressCheck.Reset();
13101
13102     application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13103     tet_infoline("Animation at 75%");
13104     application.SendNotification();
13105
13106     DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13107
13108     progressCheck.CheckSignalNotReceived();
13109
13110     application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
13111     tet_infoline("Animation at 100%");
13112     application.SendNotification();
13113
13114     //Nothing check at 100% progress. cause It can be both 100% and 0%.
13115     finishCheck.CheckSignalNotReceived();
13116     application.SendNotification();
13117   }
13118   finishCheck.CheckSignalNotReceived();
13119
13120   animation.SetLooping(false);
13121   application.Render(0u);
13122   application.SendNotification();
13123   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 10u);
13124   application.SendNotification();
13125   application.Render(0u);
13126   application.SendNotification();
13127
13128   finishCheck.CheckSignalReceived();
13129
13130   END_TEST;
13131 }
13132
13133 int UtcDaliAnimationProgressCallbackNegativeSpeed(void)
13134 {
13135   TestApplication application;
13136
13137   Actor actor = Actor::New();
13138   application.GetScene().Add(actor);
13139
13140   // Build the animation
13141   Animation animation = Animation::New(0.0f);
13142
13143   //Set duration
13144   const float durationSeconds(1.0f);
13145   animation.SetDuration(durationSeconds);
13146
13147   //Set speed negative
13148   animation.SetSpeedFactor(-1.0f);
13149
13150   // Set Looping Unlmited
13151   animation.SetLooping(true);
13152
13153   bool finishedSignalReceived(false);
13154   bool progressSignalReceived(false);
13155
13156   AnimationFinishCheck finishCheck(finishedSignalReceived);
13157   animation.FinishedSignal().Connect(&application, finishCheck);
13158
13159   AnimationProgressCheck progressCheck(progressSignalReceived);
13160   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13161   application.SendNotification();
13162
13163   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13164   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13165
13166   tet_infoline("Animation Progress notification set to 50%");
13167   DevelAnimation::SetProgressNotification(animation, 0.5f);
13168
13169   application.SendNotification();
13170   application.Render();
13171
13172   progressCheck.CheckSignalNotReceived();
13173
13174   animation.Play();
13175
13176   for(int count = 0; count < 4; count++)
13177   {
13178     application.SendNotification();
13179     application.Render(0); // start animation
13180     progressCheck.CheckSignalNotReceived();
13181
13182     application.SendNotification();
13183     application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13184     DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13185
13186     tet_infoline("Animation at 25%");
13187
13188     progressCheck.CheckSignalNotReceived();
13189
13190     application.SendNotification();
13191     application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13192     application.SendNotification();
13193     tet_infoline("Animation at 50%");
13194     DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13195
13196     progressCheck.CheckSignalReceived();
13197
13198     tet_infoline("Progress check reset");
13199     progressCheck.Reset();
13200
13201     application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13202     tet_infoline("Animation at 75%");
13203     application.SendNotification();
13204
13205     DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13206
13207     progressCheck.CheckSignalNotReceived();
13208
13209     application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
13210     tet_infoline("Animation at 100%");
13211     application.SendNotification();
13212
13213     //Nothing check at 100% progress. cause It can be both 100% and 0%.
13214     finishCheck.CheckSignalNotReceived();
13215     application.SendNotification();
13216   }
13217   finishCheck.CheckSignalNotReceived();
13218
13219   animation.Stop();
13220   animation.SetLooping(false);
13221   animation.SetLoopCount(4);
13222   animation.Play();
13223   application.Render(0u);
13224   application.SendNotification();
13225
13226   for(int count = 0; count < 4; count++)
13227   {
13228     application.SendNotification();
13229     application.Render(0); // start animation
13230     progressCheck.CheckSignalNotReceived();
13231
13232     application.SendNotification();
13233     application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13234     DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13235
13236     tet_infoline("Animation at 25%");
13237
13238     progressCheck.CheckSignalNotReceived();
13239
13240     application.SendNotification();
13241     application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13242     application.SendNotification();
13243     tet_infoline("Animation at 50%");
13244     DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13245
13246     progressCheck.CheckSignalReceived();
13247
13248     tet_infoline("Progress check reset");
13249     progressCheck.Reset();
13250
13251     application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13252     tet_infoline("Animation at 75%");
13253     application.SendNotification();
13254
13255     DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13256
13257     progressCheck.CheckSignalNotReceived();
13258
13259     application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
13260     tet_infoline("Animation at 100%");
13261     application.SendNotification();
13262
13263     //Nothing check at 100% progress. cause It can be both 100% and 0%.
13264     application.SendNotification();
13265   }
13266   application.Render(10u);
13267   application.SendNotification();
13268   application.Render(0u);
13269   application.SendNotification();
13270
13271   finishCheck.CheckSignalReceived();
13272
13273   END_TEST;
13274 }
13275
13276 int UtcDaliAnimationProgressCallbackInvalidSignalN(void)
13277 {
13278   TestApplication application;
13279
13280   Actor actor = Actor::New();
13281   application.GetScene().Add(actor);
13282
13283   // Build the animation
13284   Animation animation = Animation::New(0.0f);
13285
13286   //Set duration
13287   const float durationSeconds(1.0f);
13288   animation.SetDuration(durationSeconds);
13289
13290   bool finishedSignalReceived(false);
13291   bool progressSignalReceived(false);
13292
13293   AnimationFinishCheck finishCheck(finishedSignalReceived);
13294   animation.FinishedSignal().Connect(&application, finishCheck);
13295
13296   AnimationProgressCheck progressCheck(progressSignalReceived);
13297   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13298   application.SendNotification();
13299
13300   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13301   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13302
13303   tet_infoline("Animation Progress PlayRange as 10% ~ 90%");
13304   animation.SetPlayRange(Vector2(0.1f, 0.9f));
13305
13306   tet_infoline("Animation Progress notification set to >90% that never can notificated");
13307   DevelAnimation::SetProgressNotification(animation, 0.9f + Math::MACHINE_EPSILON_1);
13308
13309   application.SendNotification();
13310   application.Render();
13311
13312   progressCheck.CheckSignalNotReceived();
13313
13314   animation.Play();
13315
13316   application.SendNotification();
13317   application.Render(0);                                // start animation
13318   application.Render(durationSeconds * 0.25 * 1000.0f); // 35% progress
13319   DALI_TEST_EQUALS(0.35f, animation.GetCurrentProgress(), TEST_LOCATION);
13320
13321   tet_infoline("Animation at 35%");
13322
13323   progressCheck.CheckSignalNotReceived();
13324
13325   application.SendNotification();
13326   application.Render(durationSeconds * 0.25 * 1000.0f); // 60% progress
13327   application.SendNotification();
13328   DALI_TEST_EQUALS(0.6f, animation.GetCurrentProgress(), TEST_LOCATION);
13329
13330   tet_infoline("Animation at 60%");
13331
13332   progressCheck.CheckSignalNotReceived();
13333
13334   application.Render(durationSeconds * 0.25 * 1000.0f); // 85% progress
13335   tet_infoline("Animation at 85%");
13336   application.SendNotification();
13337   DALI_TEST_EQUALS(0.85f, animation.GetCurrentProgress(), TEST_LOCATION);
13338
13339   progressCheck.CheckSignalNotReceived();
13340
13341   application.Render(durationSeconds * 0.25 * 1000.0f); // 90% progress
13342   tet_infoline("Animation over 90%");
13343   application.SendNotification();
13344
13345   // progress never signaled because playrange is 90%
13346   progressCheck.CheckSignalNotReceived();
13347
13348   END_TEST;
13349 }
13350
13351 int UtcDaliAnimationProgressCallbackLongDurationP(void)
13352 {
13353   TestApplication application;
13354
13355   Actor actor = Actor::New();
13356   application.GetScene().Add(actor);
13357
13358   // Build the animation
13359   Animation animation = Animation::New(0.0f);
13360
13361   //Set duration
13362   float durationSeconds(5.0f);
13363   animation.SetDuration(durationSeconds);
13364
13365   bool finishedSignalReceived(false);
13366   bool progressSignalReceived(false);
13367
13368   AnimationFinishCheck finishCheck(finishedSignalReceived);
13369   animation.FinishedSignal().Connect(&application, finishCheck);
13370
13371   AnimationProgressCheck progressCheck(progressSignalReceived);
13372   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13373   application.SendNotification();
13374
13375   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13376   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13377
13378   tet_infoline("Animation Progress notification set to 50%");
13379   DevelAnimation::SetProgressNotification(animation, 0.5f);
13380
13381   application.SendNotification();
13382   application.Render();
13383
13384   progressCheck.CheckSignalNotReceived();
13385
13386   animation.Play();
13387
13388   application.SendNotification();
13389   application.Render(0);                                // start animation
13390   application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13391   DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13392
13393   tet_infoline("Animation at 25%");
13394
13395   progressCheck.CheckSignalNotReceived();
13396
13397   application.SendNotification();
13398   application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13399   application.SendNotification();
13400   tet_infoline("Animation at 50%");
13401   DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13402
13403   progressCheck.CheckSignalReceived();
13404
13405   tet_infoline("Progress check reset");
13406   progressCheck.Reset();
13407
13408   application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13409   tet_infoline("Animation at 75%");
13410   application.SendNotification();
13411
13412   DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13413
13414   progressCheck.CheckSignalNotReceived();
13415
13416   END_TEST;
13417 }
13418
13419 int UtcDaliAnimationAnimateByInvalidParameters(void)
13420 {
13421   TestApplication application;
13422
13423   Actor actor = Actor::New();
13424   application.GetScene().Add(actor);
13425
13426   // Create the animation
13427   Animation animation = Animation::New(1.0f);
13428
13429   DALI_TEST_ASSERTION(
13430     {
13431       // non animateable property (STRING)
13432       animation.AnimateBy(Property(actor, Actor::Property::LAYOUT_DIRECTION), Property::Value("new direction"));
13433     },
13434     "Property type is not animatable");
13435
13436   DALI_TEST_ASSERTION(
13437     {
13438       // non animateable property (MATRIX)
13439       Property::Index index = actor.RegisterProperty("Foobar", Property::Value(Dali::Matrix()), Property::ANIMATABLE);
13440       animation.AnimateBy(Property(actor, index), Property::Value(Property::MATRIX));
13441     },
13442     "Property type is not animatable");
13443
13444   // AnimateBy
13445   DALI_TEST_ASSERTION(
13446     {
13447       // non animateable target (NONE)
13448       animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value());
13449     },
13450     "Target value is not animatable");
13451
13452   DALI_TEST_ASSERTION(
13453     {
13454       // non animateable target (STRING)
13455       animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value("foo"));
13456     },
13457     "Target value is not animatable");
13458
13459   DALI_TEST_ASSERTION(
13460     {
13461       // not mathing properties (VECTOR3, FLOAT)
13462       animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(10.f));
13463     },
13464     "Property and target types don't match");
13465
13466   DALI_TEST_ASSERTION(
13467     {
13468       // not mathing properties (VECTOR3.A, VECTOR2)
13469       animation.AnimateBy(Property(actor, Actor::Property::COLOR_ALPHA), Property::Value(Property::VECTOR2));
13470     },
13471     "Property and target types don't match");
13472
13473   DALI_TEST_ASSERTION(
13474     {
13475       // negative duration
13476       animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(Vector3(1, 2, 3)), TimePeriod(-1));
13477     },
13478     "Duration must be >=0");
13479
13480   END_TEST;
13481 }
13482
13483 int UtcDaliAnimationAnimateToInvalidParameters(void)
13484 {
13485   TestApplication application;
13486
13487   Actor actor = Actor::New();
13488   application.GetScene().Add(actor);
13489
13490   // Create the animation
13491   Animation animation = Animation::New(1.0f);
13492
13493   // AnimateTo
13494   DALI_TEST_ASSERTION(
13495     {
13496       // non animateable property (MAP)
13497       Property::Index index = actor.RegisterProperty("Foobar", Property::Value(Property::MAP), Property::ANIMATABLE);
13498       animation.AnimateTo(Property(actor, index), Property::Value(Property::MAP));
13499     },
13500     "Property type is not animatable");
13501
13502   DALI_TEST_ASSERTION(
13503     {
13504       // non animateable target (NONE)
13505       animation.AnimateTo(Property(actor, Actor::Property::CLIPPING_MODE), Property::Value());
13506     },
13507     "Property type is not animatable");
13508
13509   DALI_TEST_ASSERTION(
13510     {
13511       // non animateable target (ARRAY)
13512       animation.AnimateTo(Property(actor, Actor::Property::POSITION), Property::Value(Property::ARRAY));
13513     },
13514     "Target value is not animatable");
13515
13516   DALI_TEST_ASSERTION(
13517     {
13518       // non animateable target (RECTANGLE)
13519       animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(Rect<int32_t>()));
13520     },
13521     "Target value is not animatable");
13522
13523   DALI_TEST_ASSERTION(
13524     {
13525       // not mathing properties (FLOAT, INT)
13526       animation.AnimateTo(Property(actor, Actor::Property::SCALE_Y), Property::Value(10));
13527     },
13528     "Property and target types don't match");
13529
13530   DALI_TEST_ASSERTION(
13531     {
13532       // not mathing properties (VECTOR3, VECTOR2)
13533       animation.AnimateTo(Property(actor, Actor::Property::COLOR), Property::Value(Property::VECTOR2));
13534     },
13535     "Property and target types don't match");
13536
13537   DALI_TEST_ASSERTION(
13538     {
13539       // negative duration
13540       animation.AnimateTo(Property(actor, Actor::Property::POSITION), Property::Value(Vector3(1, 2, 3)), TimePeriod(-1));
13541     },
13542     "Duration must be >=0");
13543
13544   END_TEST;
13545 }
13546
13547 int UtcDaliAnimationAnimateBetweenInvalidParameters(void)
13548 {
13549   TestApplication application;
13550
13551   Actor actor = Actor::New();
13552   application.GetScene().Add(actor);
13553
13554   // Create the animation
13555   Animation animation = Animation::New(1.0f);
13556
13557   // AnimateBetween
13558   DALI_TEST_ASSERTION(
13559     {
13560       // non animateable property (ARRAY)
13561       Property::Index index     = actor.RegisterProperty("Foobar", Property::Value(Property::ARRAY), Property::ANIMATABLE);
13562       KeyFrames       keyframes = KeyFrames::New();
13563       keyframes.Add(0.5f, Property::Value(Property::ARRAY));
13564       animation.AnimateBetween(Property(actor, index), keyframes);
13565     },
13566     "Property type is not animatable");
13567
13568   DALI_TEST_ASSERTION(
13569     {
13570       // non animateable target (NONE)
13571       KeyFrames keyframes = KeyFrames::New();
13572       keyframes.Add(0.5f, Property::Value());
13573       animation.AnimateBetween(Property(actor, Actor::Property::CLIPPING_MODE), keyframes);
13574     },
13575     "Property type is not animatable");
13576
13577   DALI_TEST_ASSERTION(
13578     {
13579       // non animateable target (EXTENTS)
13580       KeyFrames keyframes = KeyFrames::New();
13581       keyframes.Add(0.5f, Property::Value(Property::EXTENTS)); // throws
13582       animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes);
13583     },
13584     "Property type is not animatable");
13585
13586   DALI_TEST_ASSERTION(
13587     {
13588       // non animateable target (RECTANGLE)
13589       KeyFrames keyframes = KeyFrames::New();
13590       keyframes.Add(0.5f, Property::Value(Property::MAP)); // throws
13591       animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes);
13592     },
13593     "Property type is not animatable");
13594
13595   DALI_TEST_ASSERTION(
13596     {
13597       // not mathing properties (VECTOR2, VECTOR4)
13598       KeyFrames keyframes = KeyFrames::New();
13599       keyframes.Add(0.5f, Property::Value(Vector4(1, 2, 3, 4)));
13600       animation.AnimateBetween(Property(actor, Actor::Property::MAXIMUM_SIZE), keyframes);
13601     },
13602     "Property and target types don't match");
13603
13604   DALI_TEST_ASSERTION(
13605     {
13606       // negative duration
13607       KeyFrames keyframes = KeyFrames::New();
13608       keyframes.Add(0.5f, Property::Value(Vector3(1, 2, 3)));
13609       animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, TimePeriod(-1));
13610     },
13611     "Duration must be >=0");
13612
13613   END_TEST;
13614 }
13615
13616 namespace // Purposefully left this in the middle as the values in this namespace are only used for the subsequent two test cases
13617 {
13618 enum TestFunction
13619 {
13620   STOP,
13621   CLEAR
13622 };
13623
13624 void CheckPropertyValuesWhenCallingAnimationMethod(TestFunction functionToTest, const char* testName)
13625 {
13626   tet_printf("Testing %s\n", testName);
13627
13628   // When an Animation::Stop() or Animation::Clear() is called, the event-side property needs to be updated appropriately
13629   // This test checks that that is being done
13630
13631   const float   durationSeconds(1.0f);
13632   unsigned int  halfAnimationDuration(static_cast<unsigned int>(durationSeconds * 1000.0f * 0.5f));
13633   const Vector3 originalPosition(Vector3::ZERO);
13634   const Vector3 targetPosition(10.0f, 10.0f, 10.0f);
13635   const Vector3 halfWayToTarget(targetPosition * 0.5f);
13636
13637   struct ExpectedValue
13638   {
13639     Animation::EndAction endAction;
13640     Vector3              expectedGetPropertyValue;
13641   };
13642
13643   ExpectedValue expectedValueTable[] =
13644     {
13645       {Animation::BAKE, halfWayToTarget},      // When baking, the current value is the final value.
13646       {Animation::BAKE_FINAL, targetPosition}, // When BakeFinal, we should jump to the final value when clearing or stopping.
13647       {Animation::DISCARD, originalPosition},  // When discarding, we should jump back to the original value when clearing or stopping.
13648     };
13649   const auto expectedValueTableCount = sizeof(expectedValueTable) / sizeof(ExpectedValue);
13650
13651   for(auto i = 0u; i < expectedValueTableCount; ++i)
13652   {
13653     TestApplication application;
13654
13655     Actor actor = Actor::New();
13656     application.GetScene().Add(actor);
13657
13658     // Build the animation
13659     Animation animation = Animation::New(durationSeconds);
13660     animation.SetEndAction(expectedValueTable[i].endAction);
13661     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13662
13663     // Start the animation
13664     animation.Play();
13665
13666     application.SendNotification();
13667     application.Render(halfAnimationDuration);
13668
13669     // Stop or Clear the animation early, both have the same effect
13670     if(functionToTest == TestFunction::STOP)
13671     {
13672       animation.Stop();
13673     }
13674     else
13675     {
13676       animation.Clear();
13677     }
13678
13679     // The event side property should be set the expected value immediately, the update side property will still only be halfway as we haven't run an update yet
13680     DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION);
13681     DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13682
13683     // After one frame, both values should match regardless of the End Action
13684     application.SendNotification();
13685     application.Render();
13686
13687     DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION);
13688     DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION);
13689   }
13690 }
13691 } // unnamed namespace
13692
13693 int UtcDaliAnimationStopPropertyValue(void)
13694 {
13695   CheckPropertyValuesWhenCallingAnimationMethod(TestFunction::STOP, "UtcDaliAnimationStopPropertyValue");
13696   END_TEST;
13697 }
13698
13699 int UtcDaliAnimationClearPropertyValue01(void)
13700 {
13701   CheckPropertyValuesWhenCallingAnimationMethod(TestFunction::CLEAR, "UtcDaliAnimationStopPropertyValue");
13702   END_TEST;
13703 }
13704
13705 int UtcDaliAnimationClearPropertyValue02(void)
13706 {
13707   TestApplication application;
13708
13709   Actor actor = Actor::New();
13710   application.GetScene().Add(actor);
13711
13712   const float durationSeconds(1.0f);
13713   const Vector3 targetPosition1(10.0f, 10.0f, 10.0f);
13714   const Vector3 targetPosition2(20.0f, 20.0f, 20.0f);
13715
13716   // Build the animation
13717   Animation animation1 = Animation::New(durationSeconds);
13718   animation1.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition1, AlphaFunction::LINEAR);
13719   animation1.Play();
13720
13721   application.SendNotification();
13722   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
13723
13724   // The event side property should be set the current value immediately
13725   DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), targetPosition1, VECTOR3_EPSILON, TEST_LOCATION);
13726
13727   application.SendNotification();
13728   application.Render(2u /*just beyond the animation duration*/);
13729
13730   // Build a new animation
13731   Animation animation2 = Animation::New(durationSeconds);
13732   animation2.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition2, AlphaFunction::LINEAR);
13733   animation2.Play();
13734
13735   application.SendNotification();
13736   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
13737
13738   // The event side property should be set the current value immediately
13739   DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), targetPosition2, VECTOR3_EPSILON, TEST_LOCATION);
13740
13741   // Clear the first animation after finished
13742   animation1.Clear();
13743
13744   application.SendNotification();
13745   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
13746
13747   // The property should not be changed.
13748   DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), targetPosition2, VECTOR3_EPSILON, TEST_LOCATION);
13749
13750   END_TEST;
13751 }
13752
13753 int UtcDaliAnimationPausePropertyValue(void)
13754 {
13755   const float   durationSeconds(1.0f);
13756   unsigned int  halfAnimationDuration(static_cast<unsigned int>(durationSeconds * 1000.0f * 0.5f));
13757   const Vector3 targetPosition(10.0f, 10.0f, 10.0f);
13758   const Vector3 halfWayToTarget(targetPosition * 0.5f);
13759
13760   Animation::EndAction endActions[] =
13761     {
13762       Animation::BAKE,
13763       Animation::BAKE_FINAL,
13764       Animation::DISCARD,
13765     };
13766   const auto endActionCount = sizeof(endActions) / sizeof(endActions[0]);
13767
13768   // For all end actions, when pausing, we stay at the current value
13769   for(auto i = 0u; i < endActionCount; ++i)
13770   {
13771     TestApplication application;
13772
13773     Actor actor = Actor::New();
13774     application.GetScene().Add(actor);
13775
13776     // Build the animation
13777     Animation animation = Animation::New(durationSeconds);
13778     animation.SetEndAction(endActions[i]);
13779     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13780
13781     // Start the animation
13782     animation.Play();
13783
13784     application.SendNotification();
13785     application.Render(halfAnimationDuration);
13786
13787     // Puase the animation early
13788     animation.Pause();
13789
13790     // The event side property should be set the current value immediately, the update side property will still only be halfway
13791     DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13792     DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13793
13794     // After one frame, both values should match regardless of the End Action
13795     application.SendNotification();
13796     application.Render();
13797
13798     DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13799     DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13800   }
13801
13802   END_TEST;
13803 }
13804
13805 int UtcDaliAnimationPlayFromWithLoopCount(void)
13806 {
13807   TestApplication application;
13808
13809   auto actor = Actor::New();
13810   application.GetScene().Add(actor);
13811
13812   auto animation = Animation::New(1.0f);
13813   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f);
13814   animation.SetLoopCount(2);
13815   animation.Play();
13816
13817   application.SendNotification();
13818   application.Render(1001);
13819
13820   // One loop completed
13821
13822   application.Render(2005);
13823   application.SendNotification();
13824
13825   // 2 loops should have completed
13826   DALI_TEST_EQUALS(animation.GetCurrentLoop(), 2u, TEST_LOCATION);
13827
13828   // Another render needs to occur after all the loops end
13829   application.SendNotification();
13830   application.Render(1000);
13831
13832   // Stop the animation and use PlayFrom, previously we got an Assert here
13833   animation.Stop();
13834   animation.PlayFrom(0.5f);
13835
13836   application.SendNotification();
13837   application.Render(1000);
13838
13839   DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
13840
13841   END_TEST;
13842 }
13843
13844 int UtcDaliAnimationCombineToAndByWithStop(void)
13845 {
13846   tet_infoline("Ensure the Y Position is not modified when animating the X position using AnimateTo and AnimateBy");
13847
13848   TestApplication application;
13849
13850   auto actor = Actor::New();
13851   actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
13852   application.GetScene().Add(actor);
13853
13854   auto        animation = Animation::New(1.0f);
13855   const float origY     = actor.GetProperty(Actor::Property::POSITION_Y).Get<float>();
13856   animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(150.0f, origY, 0.0f), TimePeriod(1.0f));
13857   animation.AnimateBy(Property(actor, Actor::Property::POSITION), Vector3(-30.0f, 0.0f, 0.0f), TimePeriod(1.0f, 1.0f));
13858   animation.Play();
13859
13860   application.SendNotification();
13861   application.Render(500);
13862
13863   application.SendNotification();
13864   application.Render(500);
13865
13866   application.SendNotification();
13867   application.Render(500);
13868
13869   // Stop and clear the animation using the current values
13870   animation.Stop();
13871   animation.Clear();
13872
13873   // Check the y position, it should be the same as before
13874   DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Y).Get<float>(), origY, TEST_LOCATION);
13875
13876   END_TEST;
13877 }
13878
13879 int UtcDaliAnimationCountAndGetAnimationAt(void)
13880 {
13881   tet_infoline("UtcDaliAnimationCountAndGetAnimationAt");
13882
13883   TestApplication application;
13884
13885   auto actor = Actor::New();
13886   actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
13887   application.GetScene().Add(actor);
13888
13889   auto        animation = Animation::New(1.0f);
13890   const float origY     = actor.GetProperty(Actor::Property::POSITION_Y).Get<float>();
13891   animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(150.0f, origY, 0.0f), TimePeriod(1.0f));
13892   animation.Play();
13893
13894   application.SendNotification();
13895   application.Render(500);
13896
13897   uint32_t animationCount = Dali::DevelAnimation::GetAnimationCount();
13898   DALI_TEST_EQUALS(animationCount, 1, TEST_LOCATION);
13899
13900   DALI_TEST_CHECK(!Dali::DevelAnimation::GetAnimationAt(5));
13901
13902   Dali::Animation animationReturned = Dali::DevelAnimation::GetAnimationAt(0);
13903   DALI_TEST_EQUALS(animationReturned.GetState(), Dali::Animation::State::PLAYING, TEST_LOCATION);
13904
13905   DALI_TEST_EQUALS(animation.GetDuration(), animationReturned.GetDuration(), TEST_LOCATION);
13906   DALI_TEST_EQUALS(animation.GetLoopCount(), animationReturned.GetLoopCount(), TEST_LOCATION);
13907   DALI_TEST_EQUALS(animation.IsLooping(), animationReturned.IsLooping(), TEST_LOCATION);
13908   DALI_TEST_EQUALS(animation.GetEndAction(), animationReturned.GetEndAction(), TEST_LOCATION);
13909   DALI_TEST_EQUALS(animation.GetState(), animationReturned.GetState(), TEST_LOCATION);
13910
13911   // Stop and clear the animation using the current values
13912   animation.Stop();
13913   animation.Clear();
13914
13915   END_TEST;
13916 }
13917
13918 int UtcDaliAnimationSetLoopingNegative(void)
13919 {
13920   TestApplication application;
13921   Dali::Animation instance;
13922   try
13923   {
13924     bool arg1(false);
13925     instance.SetLooping(arg1);
13926     DALI_TEST_CHECK(false); // Should not get here
13927   }
13928   catch(...)
13929   {
13930     DALI_TEST_CHECK(true); // We expect an assert
13931   }
13932   END_TEST;
13933 }
13934
13935 int UtcDaliAnimationSetDurationNegative(void)
13936 {
13937   TestApplication application;
13938   Dali::Animation instance;
13939   try
13940   {
13941     float arg1(0.0f);
13942     instance.SetDuration(arg1);
13943     DALI_TEST_CHECK(false); // Should not get here
13944   }
13945   catch(...)
13946   {
13947     DALI_TEST_CHECK(true); // We expect an assert
13948   }
13949   END_TEST;
13950 }
13951
13952 int UtcDaliAnimationGetLoopCountNegative(void)
13953 {
13954   TestApplication application;
13955   Dali::Animation instance;
13956   try
13957   {
13958     instance.GetLoopCount();
13959     DALI_TEST_CHECK(false); // Should not get here
13960   }
13961   catch(...)
13962   {
13963     DALI_TEST_CHECK(true); // We expect an assert
13964   }
13965   END_TEST;
13966 }
13967
13968 int UtcDaliAnimationSetEndActionNegative(void)
13969 {
13970   TestApplication application;
13971   Dali::Animation instance;
13972   try
13973   {
13974     Dali::Animation::EndAction arg1(Animation::BAKE);
13975     instance.SetEndAction(arg1);
13976     DALI_TEST_CHECK(false); // Should not get here
13977   }
13978   catch(...)
13979   {
13980     DALI_TEST_CHECK(true); // We expect an assert
13981   }
13982   END_TEST;
13983 }
13984
13985 int UtcDaliAnimationSetLoopCountNegative(void)
13986 {
13987   TestApplication application;
13988   Dali::Animation instance;
13989   try
13990   {
13991     int arg1(0);
13992     instance.SetLoopCount(arg1);
13993     DALI_TEST_CHECK(false); // Should not get here
13994   }
13995   catch(...)
13996   {
13997     DALI_TEST_CHECK(true); // We expect an assert
13998   }
13999   END_TEST;
14000 }
14001
14002 int UtcDaliAnimationSetPlayRangeNegative(void)
14003 {
14004   TestApplication application;
14005   Dali::Animation instance;
14006   try
14007   {
14008     Dali::Vector2 arg1;
14009     instance.SetPlayRange(arg1);
14010     DALI_TEST_CHECK(false); // Should not get here
14011   }
14012   catch(...)
14013   {
14014     DALI_TEST_CHECK(true); // We expect an assert
14015   }
14016   END_TEST;
14017 }
14018
14019 int UtcDaliAnimationAnimateBetweenNegative01(void)
14020 {
14021   TestApplication application;
14022   Dali::Animation instance;
14023   Dali::Actor     actor;
14024   try
14025   {
14026     Dali::Property  arg1(actor, Actor::Property::POSITION);
14027     Dali::KeyFrames arg2;
14028     instance.AnimateBetween(arg1, arg2);
14029     DALI_TEST_CHECK(false); // Should not get here
14030   }
14031   catch(...)
14032   {
14033     DALI_TEST_CHECK(true); // We expect an assert
14034   }
14035   END_TEST;
14036 }
14037
14038 int UtcDaliAnimationAnimateBetweenNegative02(void)
14039 {
14040   TestApplication application;
14041   Dali::Animation instance;
14042   Dali::Actor     actor;
14043   try
14044   {
14045     Dali::Property                 arg1(actor, Actor::Property::POSITION);
14046     Dali::KeyFrames                arg2;
14047     Dali::Animation::Interpolation arg3(Animation::LINEAR);
14048     instance.AnimateBetween(arg1, arg2, arg3);
14049     DALI_TEST_CHECK(false); // Should not get here
14050   }
14051   catch(...)
14052   {
14053     DALI_TEST_CHECK(true); // We expect an assert
14054   }
14055   END_TEST;
14056 }
14057
14058 int UtcDaliAnimationAnimateBetweenNegative03(void)
14059 {
14060   TestApplication application;
14061   Dali::Animation instance;
14062   Dali::Actor     actor;
14063   try
14064   {
14065     Dali::Property   arg1(actor, Actor::Property::POSITION);
14066     Dali::KeyFrames  arg2;
14067     Dali::TimePeriod arg3(1.0f);
14068     instance.AnimateBetween(arg1, arg2, arg3);
14069     DALI_TEST_CHECK(false); // Should not get here
14070   }
14071   catch(...)
14072   {
14073     DALI_TEST_CHECK(true); // We expect an assert
14074   }
14075   END_TEST;
14076 }
14077
14078 int UtcDaliAnimationAnimateBetweenNegative04(void)
14079 {
14080   TestApplication application;
14081   Dali::Animation instance;
14082   Dali::Actor     actor;
14083   try
14084   {
14085     Dali::Property                 arg1(actor, Actor::Property::POSITION);
14086     Dali::KeyFrames                arg2;
14087     Dali::TimePeriod               arg3(1.0f);
14088     Dali::Animation::Interpolation arg4(Animation::LINEAR);
14089     instance.AnimateBetween(arg1, arg2, arg3, arg4);
14090     DALI_TEST_CHECK(false); // Should not get here
14091   }
14092   catch(...)
14093   {
14094     DALI_TEST_CHECK(true); // We expect an assert
14095   }
14096   END_TEST;
14097 }
14098
14099 int UtcDaliAnimationAnimateBetweenNegative05(void)
14100 {
14101   TestApplication application;
14102   Dali::Animation instance;
14103   Dali::Actor     actor;
14104   try
14105   {
14106     Dali::Property      arg1(actor, Actor::Property::POSITION);
14107     Dali::KeyFrames     arg2;
14108     Dali::AlphaFunction arg3;
14109     instance.AnimateBetween(arg1, arg2, arg3);
14110     DALI_TEST_CHECK(false); // Should not get here
14111   }
14112   catch(...)
14113   {
14114     DALI_TEST_CHECK(true); // We expect an assert
14115   }
14116   END_TEST;
14117 }
14118
14119 int UtcDaliAnimationAnimateBetweenNegative06(void)
14120 {
14121   TestApplication application;
14122   Dali::Animation instance;
14123   Dali::Actor     actor;
14124   try
14125   {
14126     Dali::Property                 arg1(actor, Actor::Property::POSITION);
14127     Dali::KeyFrames                arg2;
14128     Dali::AlphaFunction            arg3;
14129     Dali::Animation::Interpolation arg4(Animation::LINEAR);
14130     instance.AnimateBetween(arg1, arg2, arg3, arg4);
14131     DALI_TEST_CHECK(false); // Should not get here
14132   }
14133   catch(...)
14134   {
14135     DALI_TEST_CHECK(true); // We expect an assert
14136   }
14137   END_TEST;
14138 }
14139
14140 int UtcDaliAnimationAnimateBetweenNegative07(void)
14141 {
14142   TestApplication application;
14143   Dali::Animation instance;
14144   Dali::Actor     actor;
14145   try
14146   {
14147     Dali::Property      arg1(actor, Actor::Property::POSITION);
14148     Dali::KeyFrames     arg2;
14149     Dali::AlphaFunction arg3;
14150     Dali::TimePeriod    arg4(1.0f);
14151     instance.AnimateBetween(arg1, arg2, arg3, arg4);
14152     DALI_TEST_CHECK(false); // Should not get here
14153   }
14154   catch(...)
14155   {
14156     DALI_TEST_CHECK(true); // We expect an assert
14157   }
14158   END_TEST;
14159 }
14160
14161 int UtcDaliAnimationAnimateBetweenNegative08(void)
14162 {
14163   TestApplication application;
14164   Dali::Animation instance;
14165   Dali::Actor     actor;
14166   try
14167   {
14168     Dali::Property                 arg1(actor, Actor::Property::POSITION);
14169     Dali::KeyFrames                arg2;
14170     Dali::AlphaFunction            arg3;
14171     Dali::TimePeriod               arg4(1.0f);
14172     Dali::Animation::Interpolation arg5(Animation::LINEAR);
14173     instance.AnimateBetween(arg1, arg2, arg3, arg4, arg5);
14174     DALI_TEST_CHECK(false); // Should not get here
14175   }
14176   catch(...)
14177   {
14178     DALI_TEST_CHECK(true); // We expect an assert
14179   }
14180   END_TEST;
14181 }
14182
14183 int UtcDaliAnimationFinishedSignalNegative(void)
14184 {
14185   TestApplication application;
14186   Dali::Animation instance;
14187   try
14188   {
14189     instance.FinishedSignal();
14190     DALI_TEST_CHECK(false); // Should not get here
14191   }
14192   catch(...)
14193   {
14194     DALI_TEST_CHECK(true); // We expect an assert
14195   }
14196   END_TEST;
14197 }
14198
14199 int UtcDaliAnimationGetCurrentLoopNegative(void)
14200 {
14201   TestApplication application;
14202   Dali::Animation instance;
14203   try
14204   {
14205     instance.GetCurrentLoop();
14206     DALI_TEST_CHECK(false); // Should not get here
14207   }
14208   catch(...)
14209   {
14210     DALI_TEST_CHECK(true); // We expect an assert
14211   }
14212   END_TEST;
14213 }
14214
14215 int UtcDaliAnimationSetLoopingModeNegative(void)
14216 {
14217   TestApplication application;
14218   Dali::Animation instance;
14219   try
14220   {
14221     Dali::Animation::LoopingMode arg1(Animation::RESTART);
14222     instance.SetLoopingMode(arg1);
14223     DALI_TEST_CHECK(false); // Should not get here
14224   }
14225   catch(...)
14226   {
14227     DALI_TEST_CHECK(true); // We expect an assert
14228   }
14229   END_TEST;
14230 }
14231
14232 int UtcDaliAnimationSetSpeedFactorNegative(void)
14233 {
14234   TestApplication application;
14235   Dali::Animation instance;
14236   try
14237   {
14238     float arg1(0.0f);
14239     instance.SetSpeedFactor(arg1);
14240     DALI_TEST_CHECK(false); // Should not get here
14241   }
14242   catch(...)
14243   {
14244     DALI_TEST_CHECK(true); // We expect an assert
14245   }
14246   END_TEST;
14247 }
14248
14249 int UtcDaliAnimationGetCurrentProgressNegative(void)
14250 {
14251   TestApplication application;
14252   Dali::Animation instance;
14253   try
14254   {
14255     instance.GetCurrentProgress();
14256     DALI_TEST_CHECK(false); // Should not get here
14257   }
14258   catch(...)
14259   {
14260     DALI_TEST_CHECK(true); // We expect an assert
14261   }
14262   END_TEST;
14263 }
14264
14265 int UtcDaliAnimationSetCurrentProgressNegative(void)
14266 {
14267   TestApplication application;
14268   Dali::Animation instance;
14269   try
14270   {
14271     float arg1(0.0f);
14272     instance.SetCurrentProgress(arg1);
14273     DALI_TEST_CHECK(false); // Should not get here
14274   }
14275   catch(...)
14276   {
14277     DALI_TEST_CHECK(true); // We expect an assert
14278   }
14279   END_TEST;
14280 }
14281
14282 int UtcDaliAnimationSetDisconnectActionNegative(void)
14283 {
14284   TestApplication application;
14285   Dali::Animation instance;
14286   try
14287   {
14288     Dali::Animation::EndAction arg1(Animation::BAKE);
14289     instance.SetDisconnectAction(arg1);
14290     DALI_TEST_CHECK(false); // Should not get here
14291   }
14292   catch(...)
14293   {
14294     DALI_TEST_CHECK(true); // We expect an assert
14295   }
14296   END_TEST;
14297 }
14298
14299 int UtcDaliAnimationSetDefaultAlphaFunctionNegative(void)
14300 {
14301   TestApplication application;
14302   Dali::Animation instance;
14303   try
14304   {
14305     Dali::AlphaFunction arg1;
14306     instance.SetDefaultAlphaFunction(arg1);
14307     DALI_TEST_CHECK(false); // Should not get here
14308   }
14309   catch(...)
14310   {
14311     DALI_TEST_CHECK(true); // We expect an assert
14312   }
14313   END_TEST;
14314 }
14315
14316 int UtcDaliAnimationHideNegative(void)
14317 {
14318   TestApplication application;
14319   Dali::Animation instance;
14320   try
14321   {
14322     Dali::Actor arg1;
14323     float       arg2(0.0f);
14324     instance.Hide(arg1, arg2);
14325     DALI_TEST_CHECK(false); // Should not get here
14326   }
14327   catch(...)
14328   {
14329     DALI_TEST_CHECK(true); // We expect an assert
14330   }
14331   END_TEST;
14332 }
14333
14334 int UtcDaliAnimationPlayNegative(void)
14335 {
14336   TestApplication application;
14337   Dali::Animation instance;
14338   try
14339   {
14340     instance.Play();
14341     DALI_TEST_CHECK(false); // Should not get here
14342   }
14343   catch(...)
14344   {
14345     DALI_TEST_CHECK(true); // We expect an assert
14346   }
14347   END_TEST;
14348 }
14349
14350 int UtcDaliAnimationShowNegative(void)
14351 {
14352   TestApplication application;
14353   Dali::Animation instance;
14354   try
14355   {
14356     Dali::Actor arg1;
14357     float       arg2(0.0f);
14358     instance.Show(arg1, arg2);
14359     DALI_TEST_CHECK(false); // Should not get here
14360   }
14361   catch(...)
14362   {
14363     DALI_TEST_CHECK(true); // We expect an assert
14364   }
14365   END_TEST;
14366 }
14367
14368 int UtcDaliAnimationStopNegative(void)
14369 {
14370   TestApplication application;
14371   Dali::Animation instance;
14372   try
14373   {
14374     instance.Stop();
14375     DALI_TEST_CHECK(false); // Should not get here
14376   }
14377   catch(...)
14378   {
14379     DALI_TEST_CHECK(true); // We expect an assert
14380   }
14381   END_TEST;
14382 }
14383
14384 int UtcDaliAnimationClearNegative(void)
14385 {
14386   TestApplication application;
14387   Dali::Animation instance;
14388   try
14389   {
14390     instance.Clear();
14391     DALI_TEST_CHECK(false); // Should not get here
14392   }
14393   catch(...)
14394   {
14395     DALI_TEST_CHECK(true); // We expect an assert
14396   }
14397   END_TEST;
14398 }
14399
14400 int UtcDaliAnimationPauseNegative(void)
14401 {
14402   TestApplication application;
14403   Dali::Animation instance;
14404   try
14405   {
14406     instance.Pause();
14407     DALI_TEST_CHECK(false); // Should not get here
14408   }
14409   catch(...)
14410   {
14411     DALI_TEST_CHECK(true); // We expect an assert
14412   }
14413   END_TEST;
14414 }
14415
14416 int UtcDaliAnimationAnimateNegative01(void)
14417 {
14418   TestApplication application;
14419   Dali::Animation instance;
14420   try
14421   {
14422     Dali::Actor   arg1;
14423     Dali::Path    arg2;
14424     Dali::Vector3 arg3;
14425     instance.Animate(arg1, arg2, arg3);
14426     DALI_TEST_CHECK(false); // Should not get here
14427   }
14428   catch(...)
14429   {
14430     DALI_TEST_CHECK(true); // We expect an assert
14431   }
14432   END_TEST;
14433 }
14434
14435 int UtcDaliAnimationAnimateNegative02(void)
14436 {
14437   TestApplication application;
14438   Dali::Animation instance;
14439   try
14440   {
14441     Dali::Actor      arg1;
14442     Dali::Path       arg2;
14443     Dali::Vector3    arg3;
14444     Dali::TimePeriod arg4(1.0f);
14445     instance.Animate(arg1, arg2, arg3, arg4);
14446     DALI_TEST_CHECK(false); // Should not get here
14447   }
14448   catch(...)
14449   {
14450     DALI_TEST_CHECK(true); // We expect an assert
14451   }
14452   END_TEST;
14453 }
14454
14455 int UtcDaliAnimationAnimateNegative03(void)
14456 {
14457   TestApplication application;
14458   Dali::Animation instance;
14459   try
14460   {
14461     Dali::Actor         arg1;
14462     Dali::Path          arg2;
14463     Dali::Vector3       arg3;
14464     Dali::AlphaFunction arg4;
14465     instance.Animate(arg1, arg2, arg3, arg4);
14466     DALI_TEST_CHECK(false); // Should not get here
14467   }
14468   catch(...)
14469   {
14470     DALI_TEST_CHECK(true); // We expect an assert
14471   }
14472   END_TEST;
14473 }
14474
14475 int UtcDaliAnimationAnimateNegative04(void)
14476 {
14477   TestApplication application;
14478   Dali::Animation instance;
14479   try
14480   {
14481     Dali::Actor         arg1;
14482     Dali::Path          arg2;
14483     Dali::Vector3       arg3;
14484     Dali::AlphaFunction arg4;
14485     Dali::TimePeriod    arg5(1.0f);
14486     instance.Animate(arg1, arg2, arg3, arg4, arg5);
14487     DALI_TEST_CHECK(false); // Should not get here
14488   }
14489   catch(...)
14490   {
14491     DALI_TEST_CHECK(true); // We expect an assert
14492   }
14493   END_TEST;
14494 }
14495
14496 int UtcDaliAnimationPlayFromNegative(void)
14497 {
14498   TestApplication application;
14499   Dali::Animation instance;
14500   try
14501   {
14502     float arg1(0.0f);
14503     instance.PlayFrom(arg1);
14504     DALI_TEST_CHECK(false); // Should not get here
14505   }
14506   catch(...)
14507   {
14508     DALI_TEST_CHECK(true); // We expect an assert
14509   }
14510   END_TEST;
14511 }
14512
14513 int UtcDaliAnimationAnimateByNegative01(void)
14514 {
14515   TestApplication application;
14516   Dali::Animation instance;
14517   Dali::Actor     actor;
14518   try
14519   {
14520     Dali::Property        arg1(actor, Actor::Property::POSITION);
14521     Dali::Property::Value arg2;
14522     instance.AnimateBy(arg1, arg2);
14523     DALI_TEST_CHECK(false); // Should not get here
14524   }
14525   catch(...)
14526   {
14527     DALI_TEST_CHECK(true); // We expect an assert
14528   }
14529   END_TEST;
14530 }
14531
14532 int UtcDaliAnimationAnimateByNegative02(void)
14533 {
14534   TestApplication application;
14535   Dali::Animation instance;
14536   Dali::Actor     actor;
14537   try
14538   {
14539     Dali::Property        arg1(actor, Actor::Property::POSITION);
14540     Dali::Property::Value arg2;
14541     Dali::TimePeriod      arg3(1.0f);
14542     instance.AnimateBy(arg1, arg2, arg3);
14543     DALI_TEST_CHECK(false); // Should not get here
14544   }
14545   catch(...)
14546   {
14547     DALI_TEST_CHECK(true); // We expect an assert
14548   }
14549   END_TEST;
14550 }
14551
14552 int UtcDaliAnimationAnimateByNegative03(void)
14553 {
14554   TestApplication application;
14555   Dali::Animation instance;
14556   Dali::Actor     actor;
14557   try
14558   {
14559     Dali::Property        arg1(actor, Actor::Property::POSITION);
14560     Dali::Property::Value arg2;
14561     Dali::AlphaFunction   arg3;
14562     instance.AnimateBy(arg1, arg2, arg3);
14563     DALI_TEST_CHECK(false); // Should not get here
14564   }
14565   catch(...)
14566   {
14567     DALI_TEST_CHECK(true); // We expect an assert
14568   }
14569   END_TEST;
14570 }
14571
14572 int UtcDaliAnimationAnimateByNegative04(void)
14573 {
14574   TestApplication application;
14575   Dali::Animation instance;
14576   Dali::Actor     actor;
14577   try
14578   {
14579     Dali::Property        arg1(actor, Actor::Property::POSITION);
14580     Dali::Property::Value arg2;
14581     Dali::AlphaFunction   arg3;
14582     Dali::TimePeriod      arg4(1.0f);
14583     instance.AnimateBy(arg1, arg2, arg3, arg4);
14584     DALI_TEST_CHECK(false); // Should not get here
14585   }
14586   catch(...)
14587   {
14588     DALI_TEST_CHECK(true); // We expect an assert
14589   }
14590   END_TEST;
14591 }
14592
14593 int UtcDaliAnimationAnimateToNegative01(void)
14594 {
14595   TestApplication application;
14596   Dali::Actor     actor;
14597   Dali::Animation instance;
14598   try
14599   {
14600     Dali::Property        arg1(actor, Actor::Property::POSITION);
14601     Dali::Property::Value arg2;
14602     instance.AnimateTo(arg1, arg2);
14603     DALI_TEST_CHECK(false); // Should not get here
14604   }
14605   catch(...)
14606   {
14607     DALI_TEST_CHECK(true); // We expect an assert
14608   }
14609   END_TEST;
14610 }
14611
14612 int UtcDaliAnimationAnimateToNegative02(void)
14613 {
14614   TestApplication application;
14615   Dali::Animation instance;
14616   Dali::Actor     actor;
14617   try
14618   {
14619     Dali::Property        arg1(actor, Actor::Property::POSITION);
14620     Dali::Property::Value arg2;
14621     Dali::TimePeriod      arg3(1.0f);
14622     instance.AnimateTo(arg1, arg2, arg3);
14623     DALI_TEST_CHECK(false); // Should not get here
14624   }
14625   catch(...)
14626   {
14627     DALI_TEST_CHECK(true); // We expect an assert
14628   }
14629   END_TEST;
14630 }
14631
14632 int UtcDaliAnimationAnimateToNegative03(void)
14633 {
14634   TestApplication application;
14635   Dali::Animation instance;
14636   Dali::Actor     actor;
14637   try
14638   {
14639     Dali::Property        arg1(actor, Actor::Property::POSITION);
14640     Dali::Property::Value arg2;
14641     Dali::AlphaFunction   arg3;
14642     instance.AnimateTo(arg1, arg2, arg3);
14643     DALI_TEST_CHECK(false); // Should not get here
14644   }
14645   catch(...)
14646   {
14647     DALI_TEST_CHECK(true); // We expect an assert
14648   }
14649   END_TEST;
14650 }
14651
14652 int UtcDaliAnimationAnimateToNegative04(void)
14653 {
14654   TestApplication application;
14655   Dali::Animation instance;
14656   Dali::Actor     actor;
14657   try
14658   {
14659     Dali::Property        arg1(actor, Actor::Property::POSITION);
14660     Dali::Property::Value arg2;
14661     Dali::AlphaFunction   arg3;
14662     Dali::TimePeriod      arg4(1.0f);
14663     instance.AnimateTo(arg1, arg2, arg3, arg4);
14664     DALI_TEST_CHECK(false); // Should not get here
14665   }
14666   catch(...)
14667   {
14668     DALI_TEST_CHECK(true); // We expect an assert
14669   }
14670   END_TEST;
14671 }
14672
14673 int UtcDaliAnimationPlayAfterNegative(void)
14674 {
14675   TestApplication application;
14676   Dali::Animation instance;
14677   try
14678   {
14679     float arg1(0.0f);
14680     instance.PlayAfter(arg1);
14681     DALI_TEST_CHECK(false); // Should not get here
14682   }
14683   catch(...)
14684   {
14685     DALI_TEST_CHECK(true); // We expect an assert
14686   }
14687   END_TEST;
14688 }
14689
14690 int UtcDaliAnimationGetDurationNegative(void)
14691 {
14692   TestApplication application;
14693   Dali::Animation instance;
14694   try
14695   {
14696     instance.GetDuration();
14697     DALI_TEST_CHECK(false); // Should not get here
14698   }
14699   catch(...)
14700   {
14701     DALI_TEST_CHECK(true); // We expect an assert
14702   }
14703   END_TEST;
14704 }
14705
14706 int UtcDaliAnimationGetEndActionNegative(void)
14707 {
14708   TestApplication application;
14709   Dali::Animation instance;
14710   try
14711   {
14712     instance.GetEndAction();
14713     DALI_TEST_CHECK(false); // Should not get here
14714   }
14715   catch(...)
14716   {
14717     DALI_TEST_CHECK(true); // We expect an assert
14718   }
14719   END_TEST;
14720 }
14721
14722 int UtcDaliAnimationGetPlayRangeNegative(void)
14723 {
14724   TestApplication application;
14725   Dali::Animation instance;
14726   try
14727   {
14728     instance.GetPlayRange();
14729     DALI_TEST_CHECK(false); // Should not get here
14730   }
14731   catch(...)
14732   {
14733     DALI_TEST_CHECK(true); // We expect an assert
14734   }
14735   END_TEST;
14736 }
14737
14738 int UtcDaliAnimationGetLoopingModeNegative(void)
14739 {
14740   TestApplication application;
14741   Dali::Animation instance;
14742   try
14743   {
14744     instance.GetLoopingMode();
14745     DALI_TEST_CHECK(false); // Should not get here
14746   }
14747   catch(...)
14748   {
14749     DALI_TEST_CHECK(true); // We expect an assert
14750   }
14751   END_TEST;
14752 }
14753
14754 int UtcDaliAnimationGetSpeedFactorNegative(void)
14755 {
14756   TestApplication application;
14757   Dali::Animation instance;
14758   try
14759   {
14760     instance.GetSpeedFactor();
14761     DALI_TEST_CHECK(false); // Should not get here
14762   }
14763   catch(...)
14764   {
14765     DALI_TEST_CHECK(true); // We expect an assert
14766   }
14767   END_TEST;
14768 }
14769
14770 int UtcDaliAnimationGetDisconnectActionNegative(void)
14771 {
14772   TestApplication application;
14773   Dali::Animation instance;
14774   try
14775   {
14776     instance.GetDisconnectAction();
14777     DALI_TEST_CHECK(false); // Should not get here
14778   }
14779   catch(...)
14780   {
14781     DALI_TEST_CHECK(true); // We expect an assert
14782   }
14783   END_TEST;
14784 }
14785
14786 int UtcDaliAnimationGetDefaultAlphaFunctionNegative(void)
14787 {
14788   TestApplication application;
14789   Dali::Animation instance;
14790   try
14791   {
14792     instance.GetDefaultAlphaFunction();
14793     DALI_TEST_CHECK(false); // Should not get here
14794   }
14795   catch(...)
14796   {
14797     DALI_TEST_CHECK(true); // We expect an assert
14798   }
14799   END_TEST;
14800 }
14801
14802 int UtcDaliAnimationGetStateNegative(void)
14803 {
14804   TestApplication application;
14805   Dali::Animation instance;
14806   try
14807   {
14808     instance.GetState();
14809     DALI_TEST_CHECK(false); // Should not get here
14810   }
14811   catch(...)
14812   {
14813     DALI_TEST_CHECK(true); // We expect an assert
14814   }
14815   END_TEST;
14816 }
14817
14818 int UtcDaliAnimationIsLoopingNegative(void)
14819 {
14820   TestApplication application;
14821   Dali::Animation instance;
14822   try
14823   {
14824     instance.IsLooping();
14825     DALI_TEST_CHECK(false); // Should not get here
14826   }
14827   catch(...)
14828   {
14829     DALI_TEST_CHECK(true); // We expect an assert
14830   }
14831   END_TEST;
14832 }
14833
14834 int UtcDaliKeyFramesAddNegative01(void)
14835 {
14836   TestApplication application;
14837   Dali::KeyFrames instance;
14838   try
14839   {
14840     float                 arg1(0.0f);
14841     Dali::Property::Value arg2;
14842     instance.Add(arg1, arg2);
14843     DALI_TEST_CHECK(false); // Should not get here
14844   }
14845   catch(...)
14846   {
14847     DALI_TEST_CHECK(true); // We expect an assert
14848   }
14849   END_TEST;
14850 }
14851
14852 int UtcDaliKeyFramesAddNegative02(void)
14853 {
14854   TestApplication application;
14855   Dali::KeyFrames instance;
14856   try
14857   {
14858     float                 arg1(0.0f);
14859     Dali::Property::Value arg2;
14860     Dali::AlphaFunction   arg3;
14861     instance.Add(arg1, arg2, arg3);
14862     DALI_TEST_CHECK(false); // Should not get here
14863   }
14864   catch(...)
14865   {
14866     DALI_TEST_CHECK(true); // We expect an assert
14867   }
14868   END_TEST;
14869 }
14870
14871 int UtcDaliKeyFramesGetTypeNegative(void)
14872 {
14873   TestApplication application;
14874   Dali::KeyFrames instance;
14875   try
14876   {
14877     instance.GetType();
14878     DALI_TEST_CHECK(false); // Should not get here
14879   }
14880   catch(...)
14881   {
14882     DALI_TEST_CHECK(true); // We expect an assert
14883   }
14884   END_TEST;
14885 }