[dali_1.9.29] Merge branch '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/public-api/dali-core.h>
22 #include <stdlib.h>
23
24 #include <algorithm>
25 #include <iostream>
26
27 using std::max;
28 using namespace Dali;
29
30 void utc_dali_animation_startuP(void)
31 {
32   test_return_value = TET_UNDEF;
33 }
34
35 void utc_dali_animation_cleanuP(void)
36 {
37   test_return_value = TET_PASS;
38 }
39
40 namespace
41 {
42 static const float ROTATION_EPSILON = 0.0001f;
43 static const float VECTOR4_EPSILON  = 0.0001f;
44 static const float VECTOR3_EPSILON  = 0.0001f;
45
46 // Functor to test whether a Finish signal is emitted
47 struct AnimationFinishCheck
48 {
49   AnimationFinishCheck(bool& signalReceived)
50   : mSignalReceived(signalReceived)
51   {
52   }
53
54   void operator()(Animation& animation)
55   {
56     mSignalReceived = true;
57   }
58
59   void Reset()
60   {
61     mSignalReceived = false;
62   }
63
64   void CheckSignalReceived()
65   {
66     if(!mSignalReceived)
67     {
68       tet_printf("Expected Finish signal was not received\n");
69       tet_result(TET_FAIL);
70     }
71     else
72     {
73       tet_result(TET_PASS);
74     }
75   }
76
77   void CheckSignalNotReceived()
78   {
79     if(mSignalReceived)
80     {
81       tet_printf("Unexpected Finish signal was received\n");
82       tet_result(TET_FAIL);
83     }
84     else
85     {
86       tet_result(TET_PASS);
87     }
88   }
89
90   bool& mSignalReceived; // owned by individual tests
91 };
92
93 // Functor to test whether a Progress signal is emitted
94 struct AnimationProgressCheck
95 {
96   AnimationProgressCheck(bool& signalReceived, std::string name = " ")
97   : mSignalReceived(signalReceived),
98     mName(name)
99   {
100   }
101
102   void operator()(Animation& animation)
103   {
104     mSignalReceived = true;
105   }
106
107   void Reset()
108   {
109     mSignalReceived = false;
110   }
111
112   void CheckSignalReceived()
113   {
114     if(!mSignalReceived)
115     {
116       tet_printf("Expected Progress reached signal was not received %s \n", mName.c_str());
117       tet_result(TET_FAIL);
118     }
119     else
120     {
121       tet_result(TET_PASS);
122     }
123   }
124
125   void CheckSignalNotReceived()
126   {
127     if(mSignalReceived)
128     {
129       tet_printf("Unexpected Progress reached signal was received %s \n", mName.c_str());
130       tet_result(TET_FAIL);
131     }
132     else
133     {
134       tet_result(TET_PASS);
135     }
136   }
137
138   bool&       mSignalReceived; // owned by individual tests
139   std::string mName;
140 };
141
142 } // namespace
143
144 int UtcDaliAnimationConstructorP(void)
145 {
146   TestApplication application;
147
148   Animation animation;
149
150   DALI_TEST_CHECK(!animation);
151   END_TEST;
152 }
153
154 int UtcDaliAnimationNewP(void)
155 {
156   TestApplication application;
157
158   Animation animation = Animation::New(1.0f);
159
160   DALI_TEST_CHECK(animation);
161   END_TEST;
162 }
163
164 int UtcDaliAnimationNewN(void)
165 {
166   TestApplication application;
167
168   Animation animation = Animation::New(-1.0f);
169
170   DALI_TEST_CHECK(animation);
171   DALI_TEST_EQUALS(animation.GetDuration(), 0.0f, TEST_LOCATION);
172   END_TEST;
173 }
174
175 int UtcDaliAnimationDownCastP(void)
176 {
177   TestApplication application;
178
179   tet_infoline("Testing Dali::Animation::DownCast()");
180
181   float     durationSeconds(1.0f);
182   Animation animation = Animation::New(durationSeconds);
183
184   BaseHandle object(animation);
185
186   Animation animation2 = Animation::DownCast(object);
187   DALI_TEST_CHECK(animation2);
188
189   Animation animation3 = DownCast<Animation>(object);
190   DALI_TEST_CHECK(animation3);
191   END_TEST;
192 }
193
194 int UtcDaliAnimationDownCastN(void)
195 {
196   TestApplication application;
197
198   BaseHandle unInitializedObject;
199
200   Animation animation1 = Animation::DownCast(unInitializedObject);
201   DALI_TEST_CHECK(!animation1);
202
203   Animation animation2 = DownCast<Animation>(unInitializedObject);
204   DALI_TEST_CHECK(!animation2);
205   END_TEST;
206 }
207
208 int UtcDaliAnimationCopyConstructorP(void)
209 {
210   TestApplication application;
211
212   // Initialize an object, ref count == 1
213   Animation animation = Animation::New(1.0f);
214
215   Animation copy(animation);
216   DALI_TEST_CHECK(copy);
217
218   DALI_TEST_CHECK(copy.GetDuration() == animation.GetDuration());
219   END_TEST;
220 }
221
222 int UtcDaliAnimationAssignmentOperatorP(void)
223 {
224   TestApplication application;
225
226   Animation animation = Animation::New(1.0f);
227
228   Animation copy = animation;
229   DALI_TEST_CHECK(copy);
230
231   DALI_TEST_CHECK(animation == copy);
232
233   DALI_TEST_CHECK(copy.GetDuration() == animation.GetDuration());
234   END_TEST;
235 }
236
237 int UtcDaliAnimationMoveConstructor(void)
238 {
239   TestApplication application;
240
241   //Animation
242
243   Animation animation = Animation::New(1.0f);
244   DALI_TEST_CHECK(animation);
245   DALI_TEST_EQUALS(1, animation.GetBaseObject().ReferenceCount(), TEST_LOCATION);
246   DALI_TEST_EQUALS(1.0f, animation.GetDuration(), 0.001f, TEST_LOCATION);
247
248   Animation movedAnimation = std::move(animation);
249   DALI_TEST_CHECK(movedAnimation);
250   DALI_TEST_EQUALS(1, movedAnimation.GetBaseObject().ReferenceCount(), TEST_LOCATION);
251   DALI_TEST_EQUALS(1.0f, movedAnimation.GetDuration(), 0.001f, TEST_LOCATION);
252   DALI_TEST_CHECK(!animation);
253
254   // KeyFrames
255
256   KeyFrames keyframes = KeyFrames::New();
257   DALI_TEST_CHECK(keyframes);
258   DALI_TEST_EQUALS(1, keyframes.GetBaseObject().ReferenceCount(), TEST_LOCATION);
259   DALI_TEST_EQUALS(Property::Type::NONE, keyframes.GetType(), TEST_LOCATION);
260
261   keyframes.Add(0.0f, Vector3(0.0f, 0.0f, 0.0f));
262   keyframes.Add(1.0f, Vector3(100.0f, 100.0f, 100.0f));
263   DALI_TEST_EQUALS(Property::Type::VECTOR3, keyframes.GetType(), TEST_LOCATION);
264
265   KeyFrames movedKeyFrames = std::move(keyframes);
266   DALI_TEST_CHECK(movedKeyFrames);
267   DALI_TEST_EQUALS(1, movedKeyFrames.GetBaseObject().ReferenceCount(), TEST_LOCATION);
268   DALI_TEST_EQUALS(Property::Type::VECTOR3, movedKeyFrames.GetType(), TEST_LOCATION);
269   DALI_TEST_CHECK(!keyframes);
270
271   END_TEST;
272 }
273
274 int UtcDaliAnimationMoveAssignment(void)
275 {
276   TestApplication application;
277
278   // Animation
279
280   Animation animation = Animation::New(1.0f);
281   DALI_TEST_CHECK(animation);
282   DALI_TEST_EQUALS(1, animation.GetBaseObject().ReferenceCount(), TEST_LOCATION);
283   DALI_TEST_EQUALS(1.0f, animation.GetDuration(), 0.001f, TEST_LOCATION);
284
285   Animation move;
286   move = std::move(animation);
287   DALI_TEST_CHECK(move);
288   DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
289   DALI_TEST_EQUALS(1.0f, move.GetDuration(), 0.001f, TEST_LOCATION);
290   DALI_TEST_CHECK(!animation);
291
292   // KeyFrames
293
294   KeyFrames keyframes = KeyFrames::New();
295   DALI_TEST_CHECK(keyframes);
296   DALI_TEST_EQUALS(1, keyframes.GetBaseObject().ReferenceCount(), TEST_LOCATION);
297   DALI_TEST_EQUALS(Property::Type::NONE, keyframes.GetType(), TEST_LOCATION);
298
299   keyframes.Add(0.0f, Vector3(0.0f, 0.0f, 0.0f));
300   keyframes.Add(1.0f, Vector3(100.0f, 100.0f, 100.0f));
301   DALI_TEST_EQUALS(Property::Type::VECTOR3, keyframes.GetType(), TEST_LOCATION);
302
303   KeyFrames movedKeyFrames;
304   movedKeyFrames = std::move(keyframes);
305   DALI_TEST_CHECK(movedKeyFrames);
306   DALI_TEST_EQUALS(1, movedKeyFrames.GetBaseObject().ReferenceCount(), TEST_LOCATION);
307   DALI_TEST_EQUALS(Property::Type::VECTOR3, movedKeyFrames.GetType(), TEST_LOCATION);
308   DALI_TEST_CHECK(!keyframes);
309
310   END_TEST;
311 }
312
313 int UtcDaliAnimationSetDurationP(void)
314 {
315   TestApplication application;
316
317   Actor actor = Actor::New();
318   application.GetScene().Add(actor);
319
320   // Build the animation
321   float     durationSeconds(1.0f);
322   Animation animation = Animation::New(durationSeconds);
323   DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
324
325   // Start the animation
326   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
327   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
328   animation.Play();
329
330   bool                 signalReceived(false);
331   AnimationFinishCheck finishCheck(signalReceived);
332   animation.FinishedSignal().Connect(&application, finishCheck);
333
334   application.SendNotification();
335   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
336
337   // We didn't expect the animation to finish yet
338   application.SendNotification();
339   finishCheck.CheckSignalNotReceived();
340
341   application.Render(2u /*just beyond the animation duration*/);
342
343   // We did expect the animation to finish
344   application.SendNotification();
345   finishCheck.CheckSignalReceived();
346   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
347
348   // Restart the animation, with a different duration
349   finishCheck.Reset();
350   actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO);
351   durationSeconds = 3.5f;
352   animation.SetDuration(durationSeconds);
353   DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
354   animation.Play();
355
356   application.SendNotification();
357   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
358
359   // We didn't expect the animation to finish yet
360   application.SendNotification();
361   finishCheck.CheckSignalNotReceived();
362
363   application.Render(2u /*just beyond the animation duration*/);
364
365   // We did expect the animation to finish
366   application.SendNotification();
367   finishCheck.CheckSignalReceived();
368   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
369
370   // Check that nothing has changed after a couple of buffer swaps
371   application.Render(0);
372   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
373   application.Render(0);
374   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
375   END_TEST;
376 }
377
378 int UtcDaliAnimationSetDurationN(void)
379 {
380   TestApplication application;
381
382   Animation animation = Animation::New(1.0f);
383   DALI_TEST_EQUALS(animation.GetDuration(), 1.0f, TEST_LOCATION);
384
385   animation.SetDuration(-1.0f);
386   DALI_TEST_EQUALS(animation.GetDuration(), 0.0f, TEST_LOCATION);
387   END_TEST;
388 }
389
390 int UtcDaliAnimationGetDurationP(void)
391 {
392   TestApplication application;
393
394   Animation animation = Animation::New(1.0f);
395   DALI_TEST_EQUALS(animation.GetDuration(), 1.0f, TEST_LOCATION);
396
397   animation.SetDuration(2.0f);
398   DALI_TEST_EQUALS(animation.GetDuration(), 2.0f, TEST_LOCATION);
399   END_TEST;
400 }
401
402 int UtcDaliAnimationSetLoopingP(void)
403 {
404   TestApplication application;
405
406   Actor actor = Actor::New();
407   application.GetScene().Add(actor);
408
409   // Build the animation
410   float     durationSeconds(1.0f);
411   Animation animation = Animation::New(durationSeconds);
412   Vector3   targetPosition(10.0f, 10.0f, 10.0f);
413   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
414
415   // Start the animation
416   animation.SetLooping(true);
417   DALI_TEST_CHECK(animation.IsLooping());
418   animation.Play();
419
420   bool                 signalReceived(false);
421   AnimationFinishCheck finishCheck(signalReceived);
422   animation.FinishedSignal().Connect(&application, finishCheck);
423
424   application.SendNotification();
425
426   // Loop 5 times
427   float intervalSeconds = 0.25f;
428   float progress        = 0.0f;
429   for(int iterations = 0; iterations < 5;)
430   {
431     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
432
433     progress += intervalSeconds;
434     DALI_TEST_EQUALS(targetPosition * progress, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.001f, TEST_LOCATION);
435
436     if(progress >= 1.0f)
437     {
438       progress = progress - 1.0f;
439       ++iterations;
440     }
441   }
442
443   // We didn't expect the animation to finish yet
444   application.SendNotification();
445   finishCheck.CheckSignalNotReceived();
446
447   animation.SetLooping(false);
448   DALI_TEST_CHECK(!animation.IsLooping());
449
450   application.SendNotification();
451   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
452
453   // We did expect the animation to finish
454   application.SendNotification();
455   finishCheck.CheckSignalReceived();
456   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
457
458   // Check that nothing has changed after a couple of buffer swaps
459   application.Render(0);
460   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
461   application.Render(0);
462   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
463   END_TEST;
464 }
465
466 int UtcDaliAnimationSetLoopCountP(void)
467 {
468   TestApplication application;
469
470   Actor actor = Actor::New();
471   application.GetScene().Add(actor);
472
473   // Build the animation
474   float     durationSeconds(1.0f);
475   Animation animation = Animation::New(durationSeconds);
476   Vector3   targetPosition(10.0f, 10.0f, 10.0f);
477   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
478
479   // Start the animation
480   animation.SetLoopCount(3);
481   DALI_TEST_CHECK(animation.IsLooping());
482   animation.Play();
483
484   bool                 signalReceived(false);
485   AnimationFinishCheck finishCheck(signalReceived);
486   animation.FinishedSignal().Connect(&application, finishCheck);
487
488   application.Render(0);
489   application.SendNotification();
490   application.Render(0);
491   application.SendNotification();
492   application.Render(0);
493   application.SendNotification();
494   application.Render(0);
495   application.SendNotification();
496
497   // Loop
498   float intervalSeconds = 3.0f;
499
500   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
501   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
502
503   application.Render(0);
504   application.SendNotification();
505   application.Render(0);
506   application.SendNotification();
507   application.Render(0);
508   application.SendNotification();
509   application.Render(0);
510   application.SendNotification();
511   finishCheck.CheckSignalNotReceived();
512
513   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
514
515   application.SendNotification();
516   finishCheck.CheckSignalReceived();
517   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
518
519   finishCheck.Reset();
520
521   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
522   application.SendNotification();
523   finishCheck.CheckSignalNotReceived();
524
525   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
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.SendNotification();
530   finishCheck.CheckSignalNotReceived();
531
532   END_TEST;
533 }
534
535 int UtcDaliAnimationSetLoopCountP2(void)
536 {
537   TestApplication application;
538
539   //
540   // switching between forever and loop count
541   //
542
543   Actor actor = Actor::New();
544   application.GetScene().Add(actor);
545
546   // Build the animation
547   float     durationSeconds(1.0f);
548   Animation animation = Animation::New(durationSeconds);
549   Vector3   targetPosition(10.0f, 10.0f, 10.0f);
550   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
551   animation.SetEndAction(Animation::DISCARD);
552
553   // Start the animation
554   animation.SetLoopCount(3);
555   DALI_TEST_CHECK(animation.IsLooping());
556   animation.Play();
557
558   bool                 signalReceived(false);
559   AnimationFinishCheck finishCheck(signalReceived);
560   animation.FinishedSignal().Connect(&application, finishCheck);
561
562   float intervalSeconds = 3.0f;
563
564   application.SendNotification();
565   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
566   application.SendNotification();
567   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
568   application.SendNotification();
569   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
570   application.SendNotification();
571
572   application.SendNotification();
573   finishCheck.CheckSignalReceived();
574
575   finishCheck.Reset();
576
577   // Loop forever
578   animation.SetLooping(true);
579   DALI_TEST_CHECK(animation.IsLooping());
580
581   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
582   application.SendNotification();
583   finishCheck.CheckSignalNotReceived();
584
585   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
586   application.SendNotification();
587   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
588   application.SendNotification();
589   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
590   application.SendNotification();
591   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
592   application.SendNotification();
593   application.SendNotification();
594   finishCheck.CheckSignalNotReceived();
595
596   finishCheck.Reset();
597
598   // Loop N again
599   animation.SetLoopCount(3);
600   DALI_TEST_CHECK(animation.IsLooping());
601   animation.Play();
602
603   application.SendNotification();
604   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
605   application.SendNotification();
606   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
607   application.SendNotification();
608   finishCheck.CheckSignalNotReceived();
609
610   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
611   application.SendNotification();
612   finishCheck.CheckSignalReceived();
613
614   finishCheck.Reset();
615
616   // loop forever
617   animation.SetLooping(true);
618   DALI_TEST_CHECK(animation.IsLooping());
619
620   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
621   application.SendNotification();
622   finishCheck.CheckSignalNotReceived();
623
624   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
625   application.SendNotification();
626   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
627   application.SendNotification();
628   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
629   application.SendNotification();
630   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
631   application.SendNotification();
632   finishCheck.CheckSignalNotReceived();
633
634   finishCheck.Reset();
635
636   // Loop N again
637   animation.SetLoopCount(3);
638   DALI_TEST_CHECK(animation.IsLooping());
639
640   application.SendNotification();
641   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
642   application.SendNotification();
643   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
644   application.SendNotification();
645   finishCheck.CheckSignalNotReceived();
646
647   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
648   application.SendNotification();
649   finishCheck.CheckSignalNotReceived(); // we never hit play
650
651   finishCheck.Reset();
652
653   END_TEST;
654 }
655
656 int UtcDaliAnimationSetLoopCountP3(void)
657 {
658   TestApplication application;
659
660   //
661   // switching between forever and loop count
662   //
663   Actor actor = Actor::New();
664   application.GetScene().Add(actor);
665
666   // Build the animation
667   float     durationSeconds(1.0f);
668   Animation animation = Animation::New(durationSeconds);
669   Vector3   targetPosition(10.0f, 10.0f, 10.0f);
670   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
671   animation.SetEndAction(Animation::DISCARD);
672
673   float intervalSeconds = 3.0f;
674
675   bool                 signalReceived(false);
676   AnimationFinishCheck finishCheck(signalReceived);
677   animation.FinishedSignal().Connect(&application, finishCheck);
678
679   // loop forever
680   animation.SetLooping(true);
681   DALI_TEST_CHECK(animation.IsLooping());
682
683   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
684   application.SendNotification();
685   finishCheck.CheckSignalNotReceived();
686
687   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
688   application.SendNotification();
689   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
690   application.SendNotification();
691   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
692   application.SendNotification();
693   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
694   application.SendNotification();
695   finishCheck.CheckSignalNotReceived();
696
697   finishCheck.Reset();
698
699   // Loop N again
700   animation.SetLoopCount(3);
701   DALI_TEST_CHECK(animation.IsLooping());
702
703   application.SendNotification();
704   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
705   application.SendNotification();
706   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
707   application.SendNotification();
708   finishCheck.CheckSignalNotReceived();
709
710   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
711   application.SendNotification();
712   finishCheck.CheckSignalNotReceived(); // we never hit play
713
714   finishCheck.Reset();
715
716   END_TEST;
717 }
718
719 int UtcDaliAnimationSetLoopCountP4(void)
720 {
721   TestApplication application;
722
723   //
724   // ..and play again
725   //
726   Actor actor = Actor::New();
727   application.GetScene().Add(actor);
728
729   // Build the animation
730   float     durationSeconds(1.0f);
731   Animation animation = Animation::New(durationSeconds);
732   Vector3   targetPosition(10.0f, 10.0f, 10.0f);
733   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
734   animation.SetEndAction(Animation::BAKE);
735
736   float intervalSeconds = 3.0f;
737
738   bool                 signalReceived(false);
739   AnimationFinishCheck finishCheck(signalReceived);
740   animation.FinishedSignal().Connect(&application, finishCheck);
741
742   animation.SetLoopCount(1);
743   animation.Play();
744   DALI_TEST_CHECK(!animation.IsLooping());
745
746   application.SendNotification();
747   finishCheck.CheckSignalNotReceived();
748   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
749   application.SendNotification();
750   finishCheck.CheckSignalReceived();
751
752   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
753   actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
754
755   finishCheck.Reset();
756
757   animation.Play(); // again
758   DALI_TEST_CHECK(!animation.IsLooping());
759
760   application.SendNotification();
761   finishCheck.CheckSignalNotReceived();
762   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
763   application.SendNotification();
764   finishCheck.CheckSignalReceived();
765
766   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
767
768   END_TEST;
769 }
770
771 int UtcDaliAnimationGetLoopCountP(void)
772 {
773   TestApplication application;
774
775   Actor actor = Actor::New();
776   application.GetScene().Add(actor);
777
778   // Build the animation
779   float     durationSeconds(1.0f);
780   Animation animation = Animation::New(durationSeconds);
781   Vector3   targetPosition(10.0f, 10.0f, 10.0f);
782   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
783
784   DALI_TEST_CHECK(1 == animation.GetLoopCount());
785
786   // Start the animation
787   animation.SetLoopCount(3);
788   DALI_TEST_CHECK(animation.IsLooping());
789   DALI_TEST_CHECK(3 == animation.GetLoopCount());
790
791   animation.Play();
792
793   application.Render(0);
794   application.SendNotification();
795
796   // Loop
797   float intervalSeconds = 3.0f;
798
799   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
800   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
801
802   application.Render(0);
803   application.SendNotification();
804
805   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
806   application.SendNotification();
807
808   animation.SetLoopCount(0);
809   DALI_TEST_CHECK(animation.IsLooping());
810   DALI_TEST_CHECK(0 == animation.GetLoopCount());
811
812   animation.SetLoopCount(1);
813   DALI_TEST_CHECK(!animation.IsLooping());
814   DALI_TEST_CHECK(1 == animation.GetLoopCount());
815
816   END_TEST;
817 }
818
819 int UtcDaliAnimationGetCurrentLoopP(void)
820 {
821   TestApplication application;
822
823   Actor actor = Actor::New();
824   application.GetScene().Add(actor);
825
826   // Build the animation
827   float     durationSeconds(1.0f);
828   Animation animation = Animation::New(durationSeconds);
829   Vector3   targetPosition(10.0f, 10.0f, 10.0f);
830   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
831
832   // Start the animation
833   animation.SetLoopCount(3);
834   DALI_TEST_CHECK(animation.IsLooping());
835   DALI_TEST_CHECK(0 == animation.GetCurrentLoop());
836   animation.Play();
837
838   bool                 signalReceived(false);
839   AnimationFinishCheck finishCheck(signalReceived);
840   animation.FinishedSignal().Connect(&application, finishCheck);
841
842   application.SendNotification();
843
844   // Loop
845   float intervalSeconds = 3.0f;
846
847   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
848   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
849
850   application.SendNotification();
851   finishCheck.CheckSignalNotReceived();
852   DALI_TEST_CHECK(2 == animation.GetCurrentLoop());
853
854   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
855
856   application.SendNotification();
857   finishCheck.CheckSignalReceived();
858   DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
859   DALI_TEST_CHECK(animation.GetLoopCount() == animation.GetCurrentLoop());
860
861   finishCheck.Reset();
862
863   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
864   application.SendNotification();
865   finishCheck.CheckSignalNotReceived();
866   DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
867
868   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
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.SendNotification();
873   finishCheck.CheckSignalNotReceived();
874   DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
875
876   END_TEST;
877 }
878
879 int UtcDaliAnimationIsLoopingP(void)
880 {
881   TestApplication application;
882
883   Animation animation = Animation::New(1.0f);
884   DALI_TEST_CHECK(!animation.IsLooping());
885
886   animation.SetLooping(true);
887   DALI_TEST_CHECK(animation.IsLooping());
888   END_TEST;
889 }
890
891 int UtcDaliAnimationSetEndActionN(void)
892 {
893   TestApplication application;
894
895   Actor actor = Actor::New();
896   application.GetScene().Add(actor);
897
898   // Build the animation
899   float     durationSeconds(1.0f);
900   Animation animation = Animation::New(durationSeconds);
901   DALI_TEST_CHECK(animation.GetEndAction() == Animation::BAKE);
902
903   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
904   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
905
906   // Start the animation
907   animation.Play();
908
909   bool                 signalReceived(false);
910   AnimationFinishCheck finishCheck(signalReceived);
911   animation.FinishedSignal().Connect(&application, finishCheck);
912
913   application.SendNotification();
914   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
915
916   // We did expect the animation to finish
917   application.SendNotification();
918   finishCheck.CheckSignalReceived();
919   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
920
921   // Go back to the start
922   actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO);
923   application.SendNotification();
924   application.Render(0);
925   DALI_TEST_EQUALS(Vector3::ZERO, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
926
927   // Test BakeFinal, animate again, for half the duration
928   finishCheck.Reset();
929   animation.SetEndAction(Animation::BAKE_FINAL);
930   DALI_TEST_CHECK(animation.GetEndAction() == Animation::BAKE_FINAL);
931   animation.Play();
932
933   application.SendNotification();
934   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f * 0.5f) /*half of the animation duration*/);
935
936   // Stop the animation early
937   animation.Stop();
938
939   // We did NOT expect the animation to finish
940   application.SendNotification();
941   finishCheck.CheckSignalNotReceived();
942   DALI_TEST_EQUALS(targetPosition * 0.5f, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), VECTOR4_EPSILON, TEST_LOCATION);
943
944   // The position should be same with target position in the next frame
945   application.Render(0);
946   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
947
948   // Go back to the start
949   actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO);
950   application.SendNotification();
951   application.Render(0);
952   DALI_TEST_EQUALS(Vector3::ZERO, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
953
954   // Test EndAction::Discard, animate again, but don't bake this time
955   finishCheck.Reset();
956   animation.SetEndAction(Animation::DISCARD);
957   DALI_TEST_CHECK(animation.GetEndAction() == Animation::DISCARD);
958   animation.Play();
959
960   application.SendNotification();
961   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
962
963   // We did expect the animation to finish
964   application.SendNotification();
965   finishCheck.CheckSignalReceived();
966   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
967
968   // The position should be discarded in the next frame
969   application.Render(0);
970   DALI_TEST_EQUALS(Vector3::ZERO /*discarded*/, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
971
972   // Check that nothing has changed after a couple of buffer swaps
973   application.Render(0);
974   DALI_TEST_EQUALS(Vector3::ZERO, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
975   application.Render(0);
976   DALI_TEST_EQUALS(Vector3::ZERO, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
977   END_TEST;
978 }
979
980 int UtcDaliAnimationGetEndActionP(void)
981 {
982   TestApplication application;
983
984   Animation animation = Animation::New(1.0f);
985   DALI_TEST_CHECK(animation.GetEndAction() == Animation::BAKE);
986
987   animation.SetEndAction(Animation::DISCARD);
988   DALI_TEST_CHECK(animation.GetEndAction() == Animation::DISCARD);
989
990   animation.SetEndAction(Animation::BAKE_FINAL);
991   DALI_TEST_CHECK(animation.GetEndAction() == Animation::BAKE_FINAL);
992
993   END_TEST;
994 }
995
996 int UtcDaliAnimationSetDisconnectActionP(void)
997 {
998   TestApplication    application;
999   Integration::Scene stage(application.GetScene());
1000
1001   // Default: BakeFinal
1002   {
1003     Actor actor = Actor::New();
1004     stage.Add(actor);
1005
1006     // Build the animation
1007     float     durationSeconds(1.0f);
1008     Animation animation = Animation::New(durationSeconds);
1009     DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BAKE_FINAL);
1010
1011     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
1012     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1013
1014     // Start the animation
1015     animation.Play();
1016
1017     application.SendNotification();
1018     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
1019
1020     actor.Unparent();
1021
1022     application.SendNotification();
1023     application.Render();
1024
1025     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
1026   }
1027
1028   // Bake
1029   {
1030     Actor actor = Actor::New();
1031     stage.Add(actor);
1032
1033     // Build the animation
1034     float     durationSeconds(1.0f);
1035     Animation animation = Animation::New(durationSeconds);
1036     animation.SetDisconnectAction(Animation::BAKE);
1037
1038     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
1039     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1040
1041     // Start the animation
1042     animation.Play();
1043
1044     application.SendNotification();
1045     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
1046
1047     actor.Unparent();
1048
1049     application.SendNotification();
1050     application.Render();
1051
1052     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition * 0.5f, TEST_LOCATION);
1053   }
1054
1055   // Discard
1056   {
1057     Actor actor = Actor::New();
1058     stage.Add(actor);
1059
1060     // Build the animation
1061     float     durationSeconds(1.0f);
1062     Animation animation = Animation::New(durationSeconds);
1063     animation.SetDisconnectAction(Animation::DISCARD);
1064
1065     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
1066     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1067
1068     // Start the animation
1069     animation.Play();
1070
1071     application.SendNotification();
1072     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
1073
1074     actor.Unparent();
1075
1076     application.SendNotification();
1077     application.Render();
1078
1079     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
1080   }
1081
1082   // Don't play the animation: disconnect action should not be applied
1083   {
1084     Actor actor = Actor::New();
1085     stage.Add(actor);
1086
1087     // Build the animation
1088     float     durationSeconds(1.0f);
1089     Animation animation = Animation::New(durationSeconds);
1090
1091     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
1092     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1093
1094     application.SendNotification();
1095     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
1096
1097     actor.Unparent();
1098
1099     application.SendNotification();
1100     application.Render();
1101
1102     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
1103   }
1104
1105   END_TEST;
1106 }
1107
1108 int UtcDaliAnimationGetDisconnectActionP(void)
1109 {
1110   TestApplication application;
1111   Animation       animation = Animation::New(1.0f);
1112   DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BAKE_FINAL); // default!
1113
1114   animation.SetDisconnectAction(Animation::DISCARD);
1115   DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::DISCARD);
1116
1117   animation.SetDisconnectAction(Animation::BAKE);
1118   DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BAKE);
1119
1120   END_TEST;
1121 }
1122
1123 int UtcDaliAnimationSetDefaultAlphaFunctionP(void)
1124 {
1125   TestApplication application;
1126
1127   Animation     animation = Animation::New(1.0f);
1128   AlphaFunction func      = animation.GetDefaultAlphaFunction();
1129   DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1130
1131   animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1132   AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1133   DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1134   END_TEST;
1135 }
1136
1137 int UtcDaliAnimationGetDefaultAlphaFunctionP(void)
1138 {
1139   TestApplication application;
1140
1141   Animation     animation = Animation::New(1.0f);
1142   AlphaFunction func      = animation.GetDefaultAlphaFunction();
1143
1144   // Test that the default is linear
1145   DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1146
1147   animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1148   AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1149   DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1150
1151   END_TEST;
1152 }
1153
1154 int UtcDaliAnimationSetCurrentProgressP(void)
1155 {
1156   TestApplication application;
1157
1158   Actor actor = Actor::New();
1159   application.GetScene().Add(actor);
1160
1161   // Build the animation
1162   Animation animation = Animation::New(0.0f);
1163
1164   //Set duration
1165   float durationSeconds(1.0f);
1166   animation.SetDuration(durationSeconds);
1167
1168   bool                 signalReceived(false);
1169   AnimationFinishCheck finishCheck(signalReceived);
1170   animation.FinishedSignal().Connect(&application, finishCheck);
1171   application.SendNotification();
1172
1173   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1174   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1175
1176   // Start the animation from 40% progress
1177   animation.SetCurrentProgress(0.4f);
1178   animation.Play();
1179
1180   application.SendNotification();
1181   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
1182
1183   // We didn't expect the animation to finish yet
1184   application.SendNotification();
1185   finishCheck.CheckSignalNotReceived();
1186   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
1187   DALI_TEST_EQUALS(0.6f, animation.GetCurrentProgress(), TEST_LOCATION);
1188
1189   animation.Play(); // Test that calling play has no effect, when animation is already playing
1190   application.SendNotification();
1191
1192   //Set the progress to 70%
1193   animation.SetCurrentProgress(0.7f);
1194   application.SendNotification();
1195   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 80% progress */);
1196   DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
1197
1198   application.SendNotification();
1199   finishCheck.CheckSignalNotReceived();
1200   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
1201   DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
1202
1203   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
1204   // We did expect the animation to finish
1205   application.SendNotification();
1206   finishCheck.CheckSignalReceived();
1207   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
1208
1209   // Check that nothing has changed after a couple of buffer swaps
1210   application.Render(0);
1211   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1212   application.Render(0);
1213   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1214   END_TEST;
1215 }
1216
1217 int UtcDaliAnimationSetCurrentProgressN(void)
1218 {
1219   TestApplication application;
1220
1221   Actor actor = Actor::New();
1222   application.GetScene().Add(actor);
1223
1224   // Build the animation
1225   Animation animation = Animation::New(0.0f);
1226
1227   //Set duration
1228   float durationSeconds(1.0f);
1229   animation.SetDuration(durationSeconds);
1230
1231   bool                 signalReceived(false);
1232   AnimationFinishCheck finishCheck(signalReceived);
1233   animation.FinishedSignal().Connect(&application, finishCheck);
1234   application.SendNotification();
1235
1236   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1237   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1238
1239   //Trying to set the current cursor outside the range [0..1] is ignored
1240   animation.SetCurrentProgress(-1.0f);
1241   application.SendNotification();
1242   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
1243
1244   animation.SetCurrentProgress(100.0f);
1245   application.SendNotification();
1246   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
1247   END_TEST;
1248 }
1249
1250 int UtcDaliAnimationGetCurrentProgressP(void)
1251 {
1252   TestApplication application;
1253
1254   Actor actor = Actor::New();
1255   application.GetScene().Add(actor);
1256
1257   // Build the animation
1258   Animation animation = Animation::New(0.0f);
1259   animation.Play();
1260
1261   //Test GetCurrentProgress return 0.0 as the duration is 0.0
1262   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
1263
1264   animation.SetCurrentProgress(0.5f);
1265   application.SendNotification();
1266   application.Render(static_cast<unsigned int>(100.0f));
1267
1268   //Progress should still be 0.0
1269   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
1270
1271   //Set duration
1272   float durationSeconds(1.0f);
1273   animation.SetDuration(durationSeconds);
1274   application.SendNotification();
1275
1276   bool                 signalReceived(false);
1277   AnimationFinishCheck finishCheck(signalReceived);
1278   animation.FinishedSignal().Connect(&application, finishCheck);
1279   application.SendNotification();
1280
1281   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1282   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1283
1284   // Start the animation from 40% progress
1285   animation.SetCurrentProgress(0.4f);
1286   animation.Play();
1287
1288   application.SendNotification();
1289   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
1290
1291   // We didn't expect the animation to finish yet
1292   application.SendNotification();
1293   finishCheck.CheckSignalNotReceived();
1294   DALI_TEST_EQUALS(0.6f, animation.GetCurrentProgress(), TEST_LOCATION);
1295
1296   animation.Play(); // Test that calling play has no effect, when animation is already playing
1297   application.SendNotification();
1298
1299   //Set the progress to 70%
1300   animation.SetCurrentProgress(0.7f);
1301   application.SendNotification();
1302   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 80% progress */);
1303   DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
1304
1305   application.SendNotification();
1306   finishCheck.CheckSignalNotReceived();
1307   DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
1308
1309   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
1310   // We did expect the animation to finish
1311   application.SendNotification();
1312   finishCheck.CheckSignalReceived();
1313   END_TEST;
1314 }
1315
1316 int UtcDaliAnimationSetSpeedFactorP1(void)
1317 {
1318   TestApplication application;
1319
1320   tet_printf("Testing that setting a speed factor of 2 takes half the time\n");
1321
1322   Actor actor = Actor::New();
1323   application.GetScene().Add(actor);
1324
1325   // Build the animation
1326   float     durationSeconds(1.0f);
1327   Animation animation = Animation::New(durationSeconds);
1328
1329   const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1330   const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1331
1332   KeyFrames keyframes = KeyFrames::New();
1333   keyframes.Add(0.0f, initialPosition);
1334   keyframes.Add(1.0f, targetPosition);
1335   animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1336
1337   //Set speed to be x2
1338   animation.SetSpeedFactor(2.0f);
1339
1340   // Start the animation
1341   animation.Play();
1342
1343   bool                 signalReceived(false);
1344   AnimationFinishCheck finishCheck(signalReceived);
1345   animation.FinishedSignal().Connect(&application, finishCheck);
1346
1347   application.SendNotification();
1348   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
1349
1350   // We didn't expect the animation to finish yet
1351   application.SendNotification();
1352   finishCheck.CheckSignalNotReceived();
1353   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION);
1354
1355   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
1356
1357   // We didn't expect the animation to finish yet
1358   application.SendNotification();
1359   finishCheck.CheckSignalNotReceived();
1360   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
1361
1362   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1u /*just beyond half the duration*/);
1363
1364   // We did expect the animation to finish
1365   application.SendNotification();
1366   finishCheck.CheckSignalReceived();
1367   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
1368
1369   // Check that nothing has changed after a couple of buffer swaps
1370   application.Render(0);
1371   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1372   application.Render(0);
1373   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1374
1375   END_TEST;
1376 }
1377
1378 int UtcDaliAnimationSetSpeedFactorP2(void)
1379 {
1380   TestApplication application;
1381
1382   Actor actor = Actor::New();
1383   application.GetScene().Add(actor);
1384
1385   // Build the animation
1386   float     durationSeconds(1.0f);
1387   Animation animation = Animation::New(durationSeconds);
1388
1389   const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1390   const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1391
1392   KeyFrames keyframes = KeyFrames::New();
1393   keyframes.Add(0.0f, initialPosition);
1394   keyframes.Add(1.0f, targetPosition);
1395   animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1396
1397   tet_printf("Test -1 speed factor. Animation will play in reverse at normal speed\n");
1398   animation.SetSpeedFactor(-1.0f);
1399
1400   // Start the animation
1401   animation.Play();
1402
1403   bool                 signalReceived(false);
1404   AnimationFinishCheck finishCheck(signalReceived);
1405   animation.FinishedSignal().Connect(&application, finishCheck);
1406
1407   application.SendNotification();
1408   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
1409
1410   // We didn't expect the animation to finish yet
1411   application.SendNotification();
1412   finishCheck.CheckSignalNotReceived();
1413   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
1414
1415   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
1416
1417   // We didn't expect the animation to finish yet
1418   application.SendNotification();
1419   finishCheck.CheckSignalNotReceived();
1420   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
1421
1422   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
1423
1424   // We didn't expect the animation to finish yet
1425   application.SendNotification();
1426   finishCheck.CheckSignalNotReceived();
1427   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION);
1428
1429   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
1430
1431   // We didn't expect the animation to finish yet
1432   application.SendNotification();
1433   finishCheck.CheckSignalNotReceived();
1434   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
1435
1436   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
1437
1438   // We did expect the animation to finish
1439   application.SendNotification();
1440   finishCheck.CheckSignalReceived();
1441   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), initialPosition, TEST_LOCATION);
1442
1443   // Check that nothing has changed after a couple of buffer swaps
1444   application.Render(0);
1445   DALI_TEST_EQUALS(initialPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1446   application.Render(0);
1447   DALI_TEST_EQUALS(initialPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1448
1449   END_TEST;
1450 }
1451
1452 int UtcDaliAnimationSetSpeedFactorP3(void)
1453 {
1454   TestApplication application;
1455
1456   Actor actor = Actor::New();
1457   application.GetScene().Add(actor);
1458
1459   // Build the animation
1460   float     durationSeconds(1.0f);
1461   Animation animation = Animation::New(durationSeconds);
1462
1463   const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1464   const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1465
1466   KeyFrames keyframes = KeyFrames::New();
1467   keyframes.Add(0.0f, initialPosition);
1468   keyframes.Add(1.0f, targetPosition);
1469   animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1470
1471   bool                 signalReceived(false);
1472   AnimationFinishCheck finishCheck(signalReceived);
1473   animation.FinishedSignal().Connect(&application, finishCheck);
1474
1475   tet_printf("Test half speed factor. Animation will take twice the duration\n");
1476
1477   //Set speed to be half of normal speed
1478   animation.SetSpeedFactor(0.5f);
1479
1480   // Start the animation
1481   animation.Play();
1482
1483   application.SendNotification();
1484   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 10% progress */);
1485
1486   // We didn't expect the animation to finish yet
1487   application.SendNotification();
1488   finishCheck.CheckSignalNotReceived();
1489   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.1f), TEST_LOCATION);
1490
1491   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
1492
1493   // We didn't expect the animation to finish yet
1494   application.SendNotification();
1495   finishCheck.CheckSignalNotReceived();
1496   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
1497
1498   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% progress */);
1499
1500   // We didn't expect the animation to finish yet
1501   application.SendNotification();
1502   finishCheck.CheckSignalNotReceived();
1503   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.3f), TEST_LOCATION);
1504
1505   application.SendNotification();
1506   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
1507
1508   // We didn't expect the animation to finish yet
1509   application.SendNotification();
1510   finishCheck.CheckSignalNotReceived();
1511   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION);
1512
1513   application.Render(static_cast<unsigned int>(durationSeconds * 1200.0f) + 1u /*just beyond the animation duration*/);
1514
1515   // We did expect the animation to finish
1516   application.SendNotification();
1517   finishCheck.CheckSignalReceived();
1518   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
1519
1520   // Check that nothing has changed after a couple of buffer swaps
1521   application.Render(0);
1522   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1523   application.Render(0);
1524   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1525   END_TEST;
1526 }
1527
1528 int UtcDaliAnimationSetSpeedFactorP4(void)
1529 {
1530   TestApplication application;
1531
1532   Actor actor = Actor::New();
1533   application.GetScene().Add(actor);
1534
1535   // Build the animation
1536   float     durationSeconds(1.0f);
1537   Animation animation = Animation::New(durationSeconds);
1538
1539   const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1540   const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1541
1542   KeyFrames keyframes = KeyFrames::New();
1543   keyframes.Add(0.0f, initialPosition);
1544   keyframes.Add(1.0f, targetPosition);
1545   animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1546
1547   bool                 signalReceived(false);
1548   AnimationFinishCheck finishCheck(signalReceived);
1549   animation.FinishedSignal().Connect(&application, finishCheck);
1550
1551   tet_printf("Test half speed factor. Animation will take twice the duration\n");
1552
1553   tet_printf("Set speed to be half of normal speed\n");
1554   tet_printf("SetSpeedFactor(0.5f)\n");
1555   animation.SetSpeedFactor(0.5f);
1556
1557   // Start the animation
1558   animation.Play();
1559
1560   application.SendNotification();
1561   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 10% progress */);
1562
1563   // We didn't expect the animation to finish yet
1564   application.SendNotification();
1565   finishCheck.CheckSignalNotReceived();
1566   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.1f), TEST_LOCATION);
1567
1568   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
1569
1570   // We didn't expect the animation to finish yet
1571   application.SendNotification();
1572   finishCheck.CheckSignalNotReceived();
1573   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
1574
1575   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% progress */);
1576
1577   // We didn't expect the animation to finish yet
1578   application.SendNotification();
1579   finishCheck.CheckSignalNotReceived();
1580   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.3f), TEST_LOCATION);
1581
1582   tet_printf("Reverse direction of animation whilst playing\n");
1583   tet_printf("SetSpeedFactor(-0.5f)\n");
1584   animation.SetSpeedFactor(-0.5f);
1585
1586   application.SendNotification();
1587   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
1588
1589   // We didn't expect the animation to finish yet
1590   application.SendNotification();
1591   finishCheck.CheckSignalNotReceived();
1592   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
1593
1594   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 10% progress */);
1595
1596   // We didn't expect the animation to finish yet
1597   application.SendNotification();
1598   finishCheck.CheckSignalNotReceived();
1599   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.1f), 0.0001, TEST_LOCATION);
1600
1601   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
1602
1603   // We did expect the animation to finish
1604   application.SendNotification();
1605   finishCheck.CheckSignalReceived();
1606   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), initialPosition, TEST_LOCATION);
1607
1608   // Check that nothing has changed after a couple of buffer swaps
1609   application.Render(0);
1610   DALI_TEST_EQUALS(initialPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1611   application.Render(0);
1612   DALI_TEST_EQUALS(initialPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1613   END_TEST;
1614 }
1615
1616 int UtcDaliAnimationSetSpeedFactorAndRange(void)
1617 {
1618   TestApplication application;
1619
1620   const unsigned int NUM_FRAMES(15);
1621
1622   struct TestData
1623   {
1624     float startTime;
1625     float endTime;
1626     float startX;
1627     float endX;
1628     float expected[NUM_FRAMES];
1629   };
1630
1631   TestData testData[] = {
1632     // ACTOR 0
1633     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1634     /*                       |----------PlayRange---------------|                 */
1635     /*                                            | reverse                       */
1636     {0.0f, 1.0f, // TimePeriod
1637      0.0f,
1638      100.0f, // POS
1639      {
1640        /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1641        /**/ 30.0f,
1642        40.0f,
1643        50.0f,
1644        60.0f, /* Reverse direction */
1645        /**/ 50.0f,
1646        /**/ 40.0f,
1647        /**/ 30.0f,
1648        /**/ 70.0f,
1649        /**/ 60.0f,
1650        /**/ 50.0f,
1651        /**/
1652      }},
1653
1654     // ACTOR 1 - Across start of range
1655     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1656     /*                       |----------PlayRange---------------|                 */
1657     /*                                            | reverse                       */
1658     {0.2f, 0.5f, // TimePeriod
1659      20.0f,
1660      50.0f,                                   // POS
1661      {/**/ 30.0f, 40.0f, 50.0f, 50.0f, 50.0f, /* Loop */
1662       /**/ 30.0f,
1663       40.0f,
1664       50.0f,
1665       50.0f, /* Reverse direction @ frame #9 */
1666       /**/ 50.0f,
1667       /**/ 40.0f,
1668       /**/ 30.0f,
1669       /**/ 50.0f,
1670       /**/ 50.0f,
1671       /**/ 50.0f}},
1672
1673     // ACTOR 2 - Across end of range
1674     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1675     /*                       |----------PlayRange---------------|                 */
1676     /*                                            | reverse                       */
1677     {/**/ 0.5f, 0.9f, // TimePeriod
1678      /**/ 50.0f,
1679      90.0f, // POS
1680      {
1681        /**/ 50.0f,
1682        50.0f,
1683        50.0f,
1684        60.0f,
1685        70.0f, /* Loop */
1686        /**/ 50.0f,
1687        50.0f,
1688        50.0f,
1689        60.0f, /* Reverse direction @ frame #9 */
1690        /**/ 50.0f,
1691        /**/ 50.0f,
1692        /**/ 50.0f,
1693        70.0f,
1694        /**/ 60.0f,
1695        /**/ 50.0f,
1696      }},
1697
1698     // ACTOR 3 - Before beginning of range
1699     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1700     /*                       |----------PlayRange---------------|                 */
1701     /*                                            | reverse                       */
1702     {/**/ 0.1f, 0.25f, // TimePeriod
1703      /**/ 10.0f,
1704      25.0f, // POS
1705      {
1706        /**/
1707        /**/ 25.0f,
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        /**/
1723      }},
1724
1725     // ACTOR 4 - After end of range
1726     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1727     /*                       |----------PlayRange---------------|                 */
1728     /*                                            | reverse                       */
1729     {/**/ 0.85f, 1.0f, // TimePeriod
1730      /**/ 85.0f,
1731      100.0f, // POS
1732      {
1733        /**/
1734        /**/ 85.0f,
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        /**/
1750      }},
1751     // Actor 5 - Middle of range
1752     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1753     /*                       |----------PlayRange---------------|                 */
1754     /*                                            | reverse                       */
1755     {/**/ 0.4f, 0.65f, // Time Period
1756      /**/ 40.0f,
1757      65.0f, // Position
1758      {
1759        /**/ 40.0f,
1760        40.0f,
1761        50.0f,
1762        60.0f,
1763        65.0f,
1764        /**/ 40.0f,
1765        40.0f,
1766        50.0f,
1767        60.0f, // Reverse
1768        /**/ 50.0f,
1769        /**/ 40.0f,
1770        /**/ 40.0f,
1771        /**/ 65.0f,
1772        /**/ 60.0f,
1773        /**/ 50.0f,
1774      }}};
1775
1776   const size_t NUM_ENTRIES(sizeof(testData) / sizeof(TestData));
1777
1778   // Build the animation
1779   float                durationSeconds(1.0f);
1780   Animation            animation = Animation::New(durationSeconds);
1781   bool                 signalReceived(false);
1782   AnimationFinishCheck finishCheck(signalReceived);
1783   animation.FinishedSignal().Connect(&application, finishCheck);
1784
1785   std::vector<Dali::Actor> actors;
1786
1787   for(unsigned int actorIndex = 0; actorIndex < NUM_ENTRIES; ++actorIndex)
1788   {
1789     Actor actor = Actor::New();
1790     actor.SetProperty(Actor::Property::POSITION, Vector3(testData[actorIndex].startX, 0, 0));
1791     actors.push_back(actor);
1792     application.GetScene().Add(actor);
1793
1794     if(actorIndex == 0 || actorIndex == NUM_ENTRIES - 1)
1795     {
1796       KeyFrames keyframes = KeyFrames::New();
1797       keyframes.Add(testData[actorIndex].startTime, Vector3(testData[actorIndex].startX, 0, 0));
1798       keyframes.Add(testData[actorIndex].endTime, Vector3(testData[actorIndex].endX, 0, 0));
1799       animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1800     }
1801     else
1802     {
1803       animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(testData[actorIndex].endX, 0, 0), TimePeriod(testData[actorIndex].startTime, testData[actorIndex].endTime - testData[actorIndex].startTime));
1804     }
1805   }
1806
1807   tet_printf("Test half speed factor. Animation will take twice the duration\n");
1808   tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1809   tet_printf("SetSpeedFactor(0.5f)\n");
1810   animation.SetSpeedFactor(0.5f);
1811   animation.SetPlayRange(Vector2(0.3f, 0.8f));
1812   animation.SetLooping(true);
1813
1814   // Start the animation
1815   animation.Play();
1816   application.SendNotification();
1817   application.Render(0); // Frame 0 tests initial values
1818
1819   for(unsigned int frame = 0; frame < NUM_FRAMES; ++frame)
1820   {
1821     unsigned int actorIndex = 0u;
1822     for(actorIndex = 0u; actorIndex < NUM_ENTRIES; ++actorIndex)
1823     {
1824       DALI_TEST_EQUALS(actors[actorIndex].GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, testData[actorIndex].expected[frame], 0.001, TEST_LOCATION);
1825       if(!Equals(actors[actorIndex].GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, testData[actorIndex].expected[frame]))
1826       {
1827         tet_printf("Failed at frame %u, actorIndex %u\n", frame, actorIndex);
1828       }
1829     }
1830
1831     if(frame == 8)
1832     {
1833       tet_printf("Reverse direction of animation whilst playing after frame 8\n");
1834       tet_printf("SetSpeedFactor(-0.5f)\n");
1835       animation.SetSpeedFactor(-0.5f);
1836       application.SendNotification();
1837     }
1838     application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1839
1840     // We didn't expect the animation to finish yet
1841     application.SendNotification();
1842     finishCheck.CheckSignalNotReceived();
1843   }
1844
1845   END_TEST;
1846 }
1847
1848 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount01(void)
1849 {
1850   TestApplication application;
1851
1852   const unsigned int NUM_FRAMES(15);
1853
1854   struct TestData
1855   {
1856     float startTime;
1857     float endTime;
1858     float startX;
1859     float endX;
1860     float expected[NUM_FRAMES];
1861   };
1862
1863   TestData testData =
1864     // ACTOR 0
1865     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1866     /*                       |----------PlayRange---------------|                 */
1867     {0.0f, 1.0f, // TimePeriod
1868      0.0f,
1869      100.0f, // POS
1870      {
1871        /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1872        /**/ 30.0f,
1873        40.0f,
1874        50.0f,
1875        60.0f,
1876        70.0f,
1877        /**/ 30.0f,
1878        40.0f,
1879        50.0f,
1880        60.0f,
1881        70.0f,
1882        /**/
1883      }};
1884
1885   // Build the animation
1886   float                durationSeconds(1.0f);
1887   Animation            animation = Animation::New(durationSeconds);
1888   bool                 signalReceived(false);
1889   AnimationFinishCheck finishCheck(signalReceived);
1890   animation.FinishedSignal().Connect(&application, finishCheck);
1891
1892   std::vector<Dali::Actor> actors;
1893
1894   Actor actor = Actor::New();
1895   actor.SetProperty(Actor::Property::POSITION, Vector3(testData.startX, 0, 0));
1896   actors.push_back(actor);
1897   application.GetScene().Add(actor);
1898
1899   KeyFrames keyframes = KeyFrames::New();
1900   keyframes.Add(testData.startTime, Vector3(testData.startX, 0, 0));
1901   keyframes.Add(testData.endTime, Vector3(testData.endX, 0, 0));
1902   animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1903
1904   tet_printf("Test half speed factor. Animation will take twice the duration\n");
1905   tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1906   tet_printf("SetSpeedFactor(0.5f)\n");
1907   tet_printf("SetLoopCount(3)\n");
1908   animation.SetSpeedFactor(0.5f);
1909   animation.SetPlayRange(Vector2(0.3f, 0.8f));
1910   animation.SetLoopCount(3);
1911
1912   // Start the animation
1913   animation.Play();
1914   application.SendNotification();
1915   application.Render(0); // Frame 0 tests initial values
1916
1917   for(unsigned int frame = 0; frame < NUM_FRAMES; ++frame)
1918   {
1919     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, testData.expected[frame], 0.001, TEST_LOCATION);
1920
1921     application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1922
1923     if(frame < NUM_FRAMES - 1)
1924     {
1925       // We didn't expect the animation to finish yet
1926       application.SendNotification();
1927       finishCheck.CheckSignalNotReceived();
1928     }
1929   }
1930
1931   // We did expect the animation to finish
1932   application.SendNotification();
1933   finishCheck.CheckSignalReceived();
1934   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, 80.0f, 0.001, TEST_LOCATION);
1935
1936   END_TEST;
1937 }
1938
1939 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount02(void)
1940 {
1941   TestApplication application;
1942
1943   const unsigned int NUM_FRAMES(15);
1944
1945   struct TestData
1946   {
1947     float startTime;
1948     float endTime;
1949     float startX;
1950     float endX;
1951     float expected[NUM_FRAMES];
1952   };
1953
1954   TestData testData =
1955     // ACTOR 0
1956     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1957     /*                       |----------PlayRange---------------|                 */
1958     {0.0f, 1.0f, // TimePeriod
1959      0.0f,
1960      100.0f, // POS
1961      {
1962        /**/ 80.0f,
1963        70.0f,
1964        60.0f,
1965        50.0f,
1966        40.0f,
1967        /**/ 80.0f,
1968        70.0f,
1969        60.0f,
1970        50.0f,
1971        40.0f,
1972        /**/ 80.0f,
1973        70.0f,
1974        60.0f,
1975        50.0f,
1976        40.0f,
1977      }};
1978
1979   // Build the animation
1980   float                durationSeconds(1.0f);
1981   Animation            animation = Animation::New(durationSeconds);
1982   bool                 signalReceived(false);
1983   AnimationFinishCheck finishCheck(signalReceived);
1984   animation.FinishedSignal().Connect(&application, finishCheck);
1985
1986   std::vector<Dali::Actor> actors;
1987
1988   Actor actor = Actor::New();
1989   actor.SetProperty(Actor::Property::POSITION, Vector3(testData.startX, 0, 0));
1990   actors.push_back(actor);
1991   application.GetScene().Add(actor);
1992
1993   KeyFrames keyframes = KeyFrames::New();
1994   keyframes.Add(testData.startTime, Vector3(testData.startX, 0, 0));
1995   keyframes.Add(testData.endTime, Vector3(testData.endX, 0, 0));
1996   animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1997
1998   tet_printf("Test reverse half speed factor. Animation will take twice the duration\n");
1999   tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
2000   tet_printf("SetSpeedFactor(-0.5f)\n");
2001   tet_printf("SetLoopCount(3)\n");
2002   animation.SetSpeedFactor(-0.5f);
2003   animation.SetPlayRange(Vector2(0.3f, 0.8f));
2004   animation.SetLoopCount(3);
2005
2006   // Start the animation
2007   animation.Play();
2008   application.SendNotification();
2009   application.Render(0); // Frame 0 tests initial values
2010
2011   for(unsigned int frame = 0; frame < NUM_FRAMES; ++frame)
2012   {
2013     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, testData.expected[frame], 0.001, TEST_LOCATION);
2014
2015     application.Render(200); // 200 ms at half speed corresponds to 0.1 s
2016
2017     if(frame < NUM_FRAMES - 1)
2018     {
2019       // We didn't expect the animation to finish yet
2020       application.SendNotification();
2021       finishCheck.CheckSignalNotReceived();
2022     }
2023   }
2024
2025   // We did expect the animation to finish
2026   application.SendNotification();
2027   finishCheck.CheckSignalReceived();
2028   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, 30.0f, 0.001, TEST_LOCATION);
2029
2030   END_TEST;
2031 }
2032
2033 int UtcDaliAnimationGetSpeedFactorP(void)
2034 {
2035   TestApplication application;
2036
2037   Animation animation = Animation::New(1.0f);
2038   animation.SetSpeedFactor(0.5f);
2039   DALI_TEST_EQUALS(animation.GetSpeedFactor(), 0.5f, TEST_LOCATION);
2040
2041   animation.SetSpeedFactor(-2.5f);
2042   DALI_TEST_EQUALS(animation.GetSpeedFactor(), -2.5f, TEST_LOCATION);
2043   END_TEST;
2044 }
2045
2046 int UtcDaliAnimationSetPlayRangeP(void)
2047 {
2048   TestApplication application;
2049
2050   Actor actor = Actor::New();
2051   application.GetScene().Add(actor);
2052
2053   // Build the animation
2054   float     durationSeconds(1.0f);
2055   Animation animation = Animation::New(durationSeconds);
2056
2057   bool                 signalReceived(false);
2058   AnimationFinishCheck finishCheck(signalReceived);
2059   animation.FinishedSignal().Connect(&application, finishCheck);
2060   application.SendNotification();
2061
2062   // Set range between 0.4 and 0.8
2063   animation.SetPlayRange(Vector2(0.4f, 0.9f));
2064   application.SendNotification();
2065   DALI_TEST_EQUALS(Vector2(0.4f, 0.9f), animation.GetPlayRange(), TEST_LOCATION);
2066
2067   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2068   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2069
2070   // Start the animation from 40% progress
2071   animation.Play();
2072
2073   application.SendNotification();
2074   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2075
2076   // We didn't expect the animation to finish yet
2077   application.SendNotification();
2078   finishCheck.CheckSignalNotReceived();
2079   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
2080
2081   application.SendNotification();
2082   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2083
2084   application.SendNotification();
2085   finishCheck.CheckSignalNotReceived();
2086   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
2087
2088   application.SendNotification();
2089   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1u /*just beyond the animation duration*/);
2090
2091   // We did expect the animation to finish
2092   application.SendNotification();
2093   finishCheck.CheckSignalReceived();
2094   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.9f), TEST_LOCATION);
2095   END_TEST;
2096 }
2097
2098 int UtcDaliAnimationSetPlayRangeN(void)
2099 {
2100   TestApplication application;
2101
2102   Actor actor = Actor::New();
2103   application.GetScene().Add(actor);
2104
2105   // Build the animation
2106   Animation animation = Animation::New(0);
2107   application.SendNotification();
2108
2109   //PlayRange out of bounds
2110   animation.SetPlayRange(Vector2(-1.0f, 1.0f));
2111   application.SendNotification();
2112   DALI_TEST_EQUALS(Vector2(0.0f, 1.0f), animation.GetPlayRange(), TEST_LOCATION);
2113   animation.SetPlayRange(Vector2(0.0f, 2.0f));
2114   application.SendNotification();
2115   DALI_TEST_EQUALS(Vector2(0.0f, 1.0f), animation.GetPlayRange(), TEST_LOCATION);
2116
2117   //If playRange is not in the correct order it has to be ordered
2118   animation.SetPlayRange(Vector2(0.8f, 0.2f));
2119   application.SendNotification();
2120   DALI_TEST_EQUALS(Vector2(0.2f, 0.8f), animation.GetPlayRange(), TEST_LOCATION);
2121
2122   END_TEST;
2123 }
2124
2125 int UtcDaliAnimationGetPlayRangeP(void)
2126 {
2127   TestApplication application;
2128
2129   Actor actor = Actor::New();
2130   application.GetScene().Add(actor);
2131
2132   // Build the animation
2133   Animation animation = Animation::New(1.0f);
2134   application.SendNotification();
2135
2136   //If PlayRange not specified it should be 0.0-1.0 by default
2137   DALI_TEST_EQUALS(Vector2(0.0f, 1.0f), animation.GetPlayRange(), TEST_LOCATION);
2138
2139   // Set range between 0.4 and 0.8
2140   animation.SetPlayRange(Vector2(0.4f, 0.8f));
2141   application.SendNotification();
2142   DALI_TEST_EQUALS(Vector2(0.4f, 0.8f), animation.GetPlayRange(), TEST_LOCATION);
2143
2144   END_TEST;
2145 }
2146
2147 int UtcDaliAnimationPlayP(void)
2148 {
2149   TestApplication application;
2150
2151   Actor actor = Actor::New();
2152   application.GetScene().Add(actor);
2153
2154   // Build the animation
2155   float     durationSeconds(1.0f);
2156   Animation animation = Animation::New(durationSeconds);
2157   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2158   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2159
2160   // Start the animation
2161   animation.Play();
2162
2163   bool                 signalReceived(false);
2164   AnimationFinishCheck finishCheck(signalReceived);
2165   animation.FinishedSignal().Connect(&application, finishCheck);
2166
2167   application.SendNotification();
2168   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2169
2170   // We didn't expect the animation to finish yet
2171   application.SendNotification();
2172   finishCheck.CheckSignalNotReceived();
2173   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2174
2175   animation.Play(); // Test that calling play has no effect, when animation is already playing
2176   application.SendNotification();
2177   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2178
2179   // We didn't expect the animation to finish yet
2180   application.SendNotification();
2181   finishCheck.CheckSignalNotReceived();
2182   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION);
2183
2184   animation.Play(); // Test that calling play has no effect, when animation is already playing
2185   application.SendNotification();
2186   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2187
2188   // We didn't expect the animation to finish yet
2189   application.SendNotification();
2190   finishCheck.CheckSignalNotReceived();
2191   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
2192
2193   animation.Play(); // Test that calling play has no effect, when animation is already playing
2194   application.SendNotification();
2195   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2196
2197   // We didn't expect the animation to finish yet
2198   application.SendNotification();
2199   finishCheck.CheckSignalNotReceived();
2200   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
2201
2202   animation.Play(); // Test that calling play has no effect, when animation is already playing
2203   application.SendNotification();
2204   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2205
2206   // We did expect the animation to finish
2207   application.SendNotification();
2208   finishCheck.CheckSignalReceived();
2209   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2210
2211   // Check that nothing has changed after a couple of buffer swaps
2212   application.Render(0);
2213   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2214   application.Render(0);
2215   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2216   END_TEST;
2217 }
2218
2219 int UtcDaliAnimationPlayOffSceneDiscardP(void)
2220 {
2221   // Test that an animation can be played, when the actor is off-stage.
2222   // When the actor is added to the stage, it should appear at the current position
2223   // i.e. where it would have been anyway, if on-stage from the beginning.
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   animation.SetDisconnectAction(Animation::DISCARD);
2236   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2237   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2238
2239   // Start the animation
2240   animation.Play();
2241
2242   bool                 signalReceived(false);
2243   AnimationFinishCheck finishCheck(signalReceived);
2244   animation.FinishedSignal().Connect(&application, finishCheck);
2245
2246   application.SendNotification();
2247   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2248
2249   // We didn't expect the animation to finish yet
2250   application.SendNotification();
2251   finishCheck.CheckSignalNotReceived();
2252   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(20, 20, 20), TEST_LOCATION);
2253
2254   // Add to the stage
2255   application.GetScene().Add(actor);
2256
2257   application.SendNotification();
2258   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2259
2260   // We didn't expect the animation to finish yet
2261   application.SendNotification();
2262   finishCheck.CheckSignalNotReceived();
2263   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(40, 40, 40) /*on-stage*/, TEST_LOCATION);
2264
2265   // Remove from the stage
2266   application.GetScene().Remove(actor);
2267
2268   application.SendNotification();
2269   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2270
2271   // We didn't expect the animation to finish yet
2272   application.SendNotification();
2273   finishCheck.CheckSignalNotReceived();
2274   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO /*back to start position as disconnect behaviour is discard*/, TEST_LOCATION);
2275   // Check that nothing has changed after a couple of buffer swaps
2276   application.Render(0);
2277   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
2278   application.Render(0);
2279   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
2280   application.Render(0);
2281   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
2282
2283   // Add to the stage
2284   application.GetScene().Add(actor);
2285
2286   application.SendNotification();
2287   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2288
2289   // We didn't expect the animation to finish yet
2290   application.SendNotification();
2291   finishCheck.CheckSignalNotReceived();
2292   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(80, 80, 80), TEST_LOCATION);
2293
2294   application.SendNotification();
2295   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2296
2297   // We did expect the animation to finish
2298   application.SendNotification();
2299   finishCheck.CheckSignalReceived();
2300   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2301
2302   // Check that nothing has changed after a couple of buffer swaps
2303   application.Render(0);
2304   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2305
2306   application.Render(0);
2307   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2308   END_TEST;
2309 }
2310
2311 int UtcDaliAnimationPlayOffSceneBakeFinalP(void)
2312 {
2313   // Test that an animation can be played, when the actor is off-stage.
2314   // When the actor is added to the stage, it should appear at the current position
2315   // i.e. where it would have been anyway, if on-stage from the beginning.
2316
2317   TestApplication application;
2318
2319   Actor   actor = Actor::New();
2320   Vector3 basePosition(Vector3::ZERO);
2321   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2322   // Not added to the stage!
2323
2324   // Build the animation
2325   float     durationSeconds(1.0f);
2326   Animation animation = Animation::New(durationSeconds);
2327   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2328   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2329
2330   // Start the animation
2331   animation.Play();
2332
2333   bool                 signalReceived(false);
2334   AnimationFinishCheck finishCheck(signalReceived);
2335   animation.FinishedSignal().Connect(&application, finishCheck);
2336
2337   application.SendNotification();
2338   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2339
2340   // We didn't expect the animation to finish yet
2341   application.SendNotification();
2342   finishCheck.CheckSignalNotReceived();
2343   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(20, 20, 20), TEST_LOCATION);
2344
2345   // Add to the stage
2346   application.GetScene().Add(actor);
2347
2348   application.SendNotification();
2349   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2350
2351   // We didn't expect the animation to finish yet
2352   application.SendNotification();
2353   finishCheck.CheckSignalNotReceived();
2354   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(40, 40, 40) /*on-stage*/, TEST_LOCATION);
2355
2356   // Remove from the stage
2357   application.GetScene().Remove(actor);
2358
2359   application.SendNotification();
2360   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2361
2362   // We didn't expect the animation to finish yet
2363   application.SendNotification();
2364   finishCheck.CheckSignalNotReceived();
2365   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition /*bake final*/, TEST_LOCATION);
2366
2367   // Add to the stage
2368   application.GetScene().Add(actor);
2369
2370   application.SendNotification();
2371   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2372
2373   // We didn't expect the animation to finish yet
2374   application.SendNotification();
2375   finishCheck.CheckSignalNotReceived();
2376   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition /*bake final removed the */, TEST_LOCATION);
2377
2378   application.SendNotification();
2379   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2380
2381   // We did expect the animation to finish
2382   application.SendNotification();
2383   finishCheck.CheckSignalReceived();
2384   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2385
2386   // Check that nothing has changed after a couple of buffer swaps
2387   application.Render(0);
2388   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2389
2390   application.Render(0);
2391   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2392   END_TEST;
2393 }
2394
2395 int UtcDaliAnimationPlayOffSceneBakeP(void)
2396 {
2397   // Test that an animation can be played, when the actor is off-stage.
2398   // When the actor is added to the stage, it should appear at the current position
2399   // i.e. where it would have been anyway, if on-stage from the beginning.
2400
2401   TestApplication application;
2402
2403   Actor   actor = Actor::New();
2404   Vector3 basePosition(Vector3::ZERO);
2405   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2406   // Not added to the stage!
2407
2408   // Build the animation
2409   float     durationSeconds(1.0f);
2410   Animation animation = Animation::New(durationSeconds);
2411   animation.SetDisconnectAction(Animation::BAKE);
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   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(20, 20, 20), TEST_LOCATION);
2429
2430   // Add to the stage
2431   application.GetScene().Add(actor);
2432
2433   application.SendNotification();
2434   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2435
2436   // We didn't expect the animation to finish yet
2437   application.SendNotification();
2438   finishCheck.CheckSignalNotReceived();
2439   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(40, 40, 40) /*on-stage*/, TEST_LOCATION);
2440
2441   // Remove from the stage
2442   application.GetScene().Remove(actor); // baked here
2443
2444   application.SendNotification();
2445   // this render is a no-op in this case as animator is disabled while off stage
2446   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2447   // We didn't expect the animation to finish yet
2448   application.SendNotification();
2449   finishCheck.CheckSignalNotReceived();
2450   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(40, 40, 40) /*baked value*/, TEST_LOCATION);
2451
2452   // Add back to the stage
2453   application.GetScene().Add(actor);
2454
2455   application.SendNotification();
2456   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2457   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /* animation restarted at 40,40,40 + 80%*60 */, TEST_LOCATION);
2458   application.Render(static_cast<unsigned int>(0.0f));
2459   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2460   application.Render(static_cast<unsigned int>(0.0f));
2461   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2462
2463   // Remove from the stage
2464   application.GetScene().Remove(actor); // baked here
2465
2466   application.SendNotification();
2467   // this render is a no-op in this case as animator is disabled while off stage
2468   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 100% progress */);
2469   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2470   application.Render(static_cast<unsigned int>(0.0f));
2471   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2472   application.Render(static_cast<unsigned int>(0.0f));
2473   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2474
2475   // Add back to the stage
2476   application.GetScene().Add(actor);
2477
2478   // We didn't expect the animation to finish yet
2479   application.SendNotification();
2480   finishCheck.CheckSignalNotReceived();
2481   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88), TEST_LOCATION);
2482
2483   application.SendNotification();
2484   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2485
2486   // We did expect the animation to finish
2487   application.SendNotification();
2488   finishCheck.CheckSignalReceived();
2489   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2490
2491   // Check that nothing has changed after a couple of buffer swaps
2492   application.Render(0);
2493   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2494
2495   application.Render(0);
2496   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2497   END_TEST;
2498 }
2499
2500 int UtcDaliAnimationPlayDiscardHandleP(void)
2501 {
2502   TestApplication application;
2503
2504   Actor actor = Actor::New();
2505   application.GetScene().Add(actor);
2506
2507   // Build the animation
2508   float     durationSeconds(1.0f);
2509   Animation animation = Animation::New(durationSeconds);
2510   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2511   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2512
2513   bool                 signalReceived(false);
2514   AnimationFinishCheck finishCheck(signalReceived);
2515   animation.FinishedSignal().Connect(&application, finishCheck);
2516
2517   // Start the animation
2518   animation.Play();
2519
2520   // This is a test of the "Fire and Forget" behaviour
2521   // Discard the animation handle!
2522   animation.Reset();
2523   DALI_TEST_CHECK(!animation);
2524
2525   application.SendNotification();
2526   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2527
2528   // We didn't expect the animation to finish yet
2529   application.SendNotification();
2530   finishCheck.CheckSignalNotReceived();
2531   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2532
2533   application.SendNotification();
2534   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2535
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), (targetPosition * 0.4f), TEST_LOCATION);
2540
2541   application.SendNotification();
2542   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2543
2544   // We didn't expect the animation to finish yet
2545   application.SendNotification();
2546   finishCheck.CheckSignalNotReceived();
2547   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
2548
2549   application.SendNotification();
2550   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2551
2552   // We didn't expect the animation to finish yet
2553   application.SendNotification();
2554   finishCheck.CheckSignalNotReceived();
2555   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
2556
2557   application.SendNotification();
2558   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2559
2560   // We did expect the animation to finish
2561   application.SendNotification();
2562   finishCheck.CheckSignalReceived();
2563   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2564
2565   // Check that nothing has changed after a couple of buffer swaps
2566   application.Render(0);
2567   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2568   application.Render(0);
2569   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2570   END_TEST;
2571 }
2572
2573 int UtcDaliAnimationPlayStopDiscardHandleP(void)
2574 {
2575   TestApplication application;
2576
2577   Actor actor = Actor::New();
2578   application.GetScene().Add(actor);
2579
2580   // Build the animation
2581   float     durationSeconds(1.0f);
2582   Animation animation = Animation::New(durationSeconds);
2583   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2584   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2585
2586   // Start the animation
2587   animation.Play();
2588
2589   bool                 signalReceived(false);
2590   AnimationFinishCheck finishCheck(signalReceived);
2591   animation.FinishedSignal().Connect(&application, finishCheck);
2592
2593   application.SendNotification();
2594   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2595
2596   // We didn't expect the animation to finish yet
2597   application.SendNotification();
2598   finishCheck.CheckSignalNotReceived();
2599   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2600
2601   // This is a test of the "Fire and Forget" behaviour
2602   // Stop the animation, and Discard the animation handle!
2603   animation.Stop();
2604   animation.Reset();
2605   DALI_TEST_CHECK(!animation);
2606
2607   application.SendNotification();
2608   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2609
2610   // We expect the animation to finish at 20% progress
2611   application.SendNotification();
2612   finishCheck.CheckSignalReceived();
2613   finishCheck.Reset();
2614   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2615
2616   application.SendNotification();
2617   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2618
2619   // Check that nothing has changed
2620   application.SendNotification();
2621   finishCheck.CheckSignalNotReceived();
2622   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2623
2624   application.SendNotification();
2625   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2626
2627   // Check that nothing has changed
2628   application.SendNotification();
2629   finishCheck.CheckSignalNotReceived();
2630   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2631
2632   application.SendNotification();
2633   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 100% progress */);
2634
2635   // Check that nothing has changed
2636   application.SendNotification();
2637   finishCheck.CheckSignalNotReceived();
2638   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2639   END_TEST;
2640 }
2641
2642 int UtcDaliAnimationPlayRangeP(void)
2643 {
2644   TestApplication application;
2645
2646   Actor actor = Actor::New();
2647   application.GetScene().Add(actor);
2648
2649   // Build the animation
2650   float     durationSeconds(1.0f);
2651   Animation animation = Animation::New(durationSeconds);
2652   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2653   KeyFrames keyframes = KeyFrames::New();
2654   keyframes.Add(0.0f, Vector3(0.0f, 0.0f, 0.0f));
2655   keyframes.Add(1.0f, Vector3(100.0f, 100.0f, 100.0f));
2656
2657   animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes);
2658
2659   // Set range between 0.4 and 0.8
2660   animation.SetPlayRange(Vector2(0.4f, 0.8f));
2661   animation.Play();
2662
2663   bool                 signalReceived(false);
2664   AnimationFinishCheck finishCheck(signalReceived);
2665   animation.FinishedSignal().Connect(&application, finishCheck);
2666
2667   //Test that setting progress outside the range doesn't work
2668   animation.SetCurrentProgress(0.9f);
2669   application.SendNotification();
2670   application.Render(0);
2671   DALI_TEST_EQUALS(animation.GetCurrentProgress(), 0.4f, TEST_LOCATION);
2672   animation.SetCurrentProgress(0.2f);
2673   application.SendNotification();
2674   application.Render(0);
2675   DALI_TEST_EQUALS(animation.GetCurrentProgress(), 0.4f, TEST_LOCATION);
2676
2677   application.SendNotification();
2678   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2679
2680   // We didn't expect the animation to finish yet
2681   application.SendNotification();
2682   finishCheck.CheckSignalNotReceived();
2683   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
2684
2685   animation.Play(); // Test that calling play has no effect, when animation is already playing
2686   application.SendNotification();
2687   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /* 80% progress */);
2688
2689   // We did expect the animation to finish
2690   application.SendNotification();
2691   finishCheck.CheckSignalReceived();
2692   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
2693
2694   // Check that nothing has changed after a couple of buffer swaps
2695   application.Render(0);
2696   DALI_TEST_EQUALS(targetPosition * 0.8f, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2697   application.Render(0);
2698   DALI_TEST_EQUALS(targetPosition * 0.8f, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2699
2700   //Loop inside the range
2701   finishCheck.Reset();
2702   animation.SetLooping(true);
2703   animation.Play();
2704   application.SendNotification();
2705   float intervalSeconds = 0.1f;
2706   float progress        = 0.4f;
2707   for(int iterations = 0; iterations < 10; ++iterations)
2708   {
2709     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
2710
2711     progress += intervalSeconds;
2712     if(progress > 0.8f)
2713     {
2714       progress = progress - 0.4f;
2715     }
2716
2717     DALI_TEST_EQUALS(targetPosition * progress, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.001f, TEST_LOCATION);
2718   }
2719
2720   // We didn't expect the animation to finish yet
2721   application.SendNotification();
2722   finishCheck.CheckSignalNotReceived();
2723
2724   //Test change range on the fly
2725   animation.SetPlayRange(Vector2(0.2f, 0.9f));
2726   application.SendNotification();
2727
2728   for(int iterations = 0; iterations < 10; ++iterations)
2729   {
2730     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
2731
2732     progress += intervalSeconds;
2733     if(progress > 0.9f)
2734     {
2735       progress = progress - 0.7f;
2736     }
2737
2738     DALI_TEST_EQUALS(targetPosition * progress, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.001f, TEST_LOCATION);
2739   }
2740
2741   END_TEST;
2742 }
2743
2744 int UtcDaliAnimationPlayFromP(void)
2745 {
2746   TestApplication application;
2747
2748   Actor actor = Actor::New();
2749   application.GetScene().Add(actor);
2750
2751   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
2752
2753   // Build the animation
2754   float     durationSeconds(1.0f);
2755   Animation animation = Animation::New(durationSeconds);
2756   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2757   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2758
2759   // Start the animation from 40% progress
2760   animation.PlayFrom(0.4f);
2761
2762   // Target value should be updated straight away
2763   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2764
2765   bool                 signalReceived(false);
2766   AnimationFinishCheck finishCheck(signalReceived);
2767   animation.FinishedSignal().Connect(&application, finishCheck);
2768
2769   application.SendNotification();
2770   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2771
2772   // We didn't expect the animation to finish yet
2773   application.SendNotification();
2774   finishCheck.CheckSignalNotReceived();
2775   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
2776
2777   animation.Play(); // Test that calling play has no effect, when animation is already playing
2778   application.SendNotification();
2779   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2780
2781   // We didn't expect the animation to finish yet
2782   application.SendNotification();
2783   finishCheck.CheckSignalNotReceived();
2784   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
2785
2786   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2787   // We did expect the animation to finish
2788   application.SendNotification();
2789   finishCheck.CheckSignalReceived();
2790   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2791
2792   // Check that nothing has changed after a couple of buffer swaps
2793   application.Render(0);
2794   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2795   application.Render(0);
2796   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2797   END_TEST;
2798 }
2799
2800 int UtcDaliAnimationPlayFromN(void)
2801 {
2802   TestApplication application;
2803
2804   Actor actor = Actor::New();
2805   application.GetScene().Add(actor);
2806
2807   // Build the animation
2808   float     durationSeconds(1.0f);
2809   Animation animation = Animation::New(durationSeconds);
2810   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2811   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2812
2813   //PlayFrom with an argument outside the range [0..1] will be ignored
2814   animation.PlayFrom(-1.0f);
2815   application.SendNotification();
2816   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
2817
2818   animation.PlayFrom(100.0f);
2819   application.SendNotification();
2820   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
2821   END_TEST;
2822 }
2823
2824 int UtcDaliAnimationPauseP(void)
2825 {
2826   TestApplication application;
2827
2828   Actor actor = Actor::New();
2829   application.GetScene().Add(actor);
2830
2831   // Build the animation
2832   float     durationSeconds(1.0f);
2833   Animation animation = Animation::New(durationSeconds);
2834   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2835   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2836
2837   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2838
2839   // Start the animation
2840   animation.Play();
2841
2842   bool                 signalReceived(false);
2843   AnimationFinishCheck finishCheck(signalReceived);
2844   animation.FinishedSignal().Connect(&application, finishCheck);
2845
2846   application.SendNotification();
2847   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
2848
2849   // We didn't expect the animation to finish yet
2850   application.SendNotification();
2851   finishCheck.CheckSignalNotReceived();
2852   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
2853
2854   // Pause the animation
2855   animation.Pause();
2856   application.SendNotification();
2857
2858   // Loop 5 times
2859   for(int i = 0; i < 5; ++i)
2860   {
2861     application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
2862
2863     // We didn't expect the animation to finish yet
2864     application.SendNotification();
2865     finishCheck.CheckSignalNotReceived();
2866     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress when paused */, TEST_LOCATION);
2867   }
2868
2869   // Keep going
2870   animation.Play();
2871   application.SendNotification();
2872   application.Render(static_cast<unsigned int>(durationSeconds * 490.0f) /*slightly less than the animation duration*/);
2873
2874   // We didn't expect the animation to finish yet
2875   application.SendNotification();
2876   finishCheck.CheckSignalNotReceived();
2877
2878   application.SendNotification();
2879   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
2880
2881   // We did expect the animation to finish
2882   application.SendNotification();
2883   finishCheck.CheckSignalReceived();
2884   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2885
2886   // Check that nothing has changed after a couple of buffer swaps
2887   application.Render(0);
2888   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2889   application.Render(0);
2890   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2891   END_TEST;
2892 }
2893
2894 int UtcDaliAnimationGetStateP(void)
2895 {
2896   TestApplication application;
2897
2898   Actor actor = Actor::New();
2899   application.GetScene().Add(actor);
2900
2901   // Build the animation
2902   float     durationSeconds(1.0f);
2903   Animation animation = Animation::New(durationSeconds);
2904   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2905   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2906   DALI_TEST_EQUALS(animation.GetState(), Animation::STOPPED, TEST_LOCATION);
2907
2908   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2909
2910   // Start the animation
2911   animation.Play();
2912
2913   DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
2914
2915   bool                 signalReceived(false);
2916   AnimationFinishCheck finishCheck(signalReceived);
2917   animation.FinishedSignal().Connect(&application, finishCheck);
2918
2919   application.SendNotification();
2920   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
2921
2922   // We didn't expect the animation to finish yet
2923   application.SendNotification();
2924   finishCheck.CheckSignalNotReceived();
2925   DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
2926   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
2927
2928   // Pause the animation
2929   animation.Pause();
2930   DALI_TEST_EQUALS(animation.GetState(), Animation::PAUSED, TEST_LOCATION);
2931   application.SendNotification();
2932   application.Render(0.f);
2933
2934   // Loop 5 times
2935   for(int i = 0; i < 5; ++i)
2936   {
2937     application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
2938
2939     // We didn't expect the animation to finish yet
2940     application.SendNotification();
2941     finishCheck.CheckSignalNotReceived();
2942     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress when paused */, TEST_LOCATION);
2943     DALI_TEST_EQUALS(animation.GetState(), Animation::PAUSED, TEST_LOCATION);
2944   }
2945
2946   // Keep going
2947   finishCheck.Reset();
2948   animation.Play();
2949   DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
2950   application.SendNotification();
2951   application.Render(static_cast<unsigned int>(durationSeconds * 490.0f) /*slightly less than the animation duration*/);
2952   // We didn't expect the animation to finish yet
2953   application.SendNotification();
2954   finishCheck.CheckSignalNotReceived();
2955   DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
2956
2957   application.SendNotification();
2958   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
2959
2960   // We did expect the animation to finish
2961   application.SendNotification();
2962   finishCheck.CheckSignalReceived();
2963   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2964   DALI_TEST_EQUALS(animation.GetState(), Animation::STOPPED, TEST_LOCATION);
2965
2966   // Check that nothing has changed after a couple of buffer swaps
2967   application.Render(0);
2968   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2969   application.Render(0);
2970   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2971   DALI_TEST_EQUALS(animation.GetState(), Animation::STOPPED, TEST_LOCATION);
2972
2973   // re-play
2974   finishCheck.Reset();
2975   animation.Play();
2976   DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
2977   application.SendNotification();
2978   application.Render(static_cast<unsigned int>(durationSeconds * 490.0f) /*slightly less than the animation duration*/);
2979   application.SendNotification();
2980   finishCheck.CheckSignalNotReceived();
2981   DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
2982
2983   END_TEST;
2984 }
2985
2986 int UtcDaliAnimationStopP(void)
2987 {
2988   TestApplication application;
2989
2990   Actor actor = Actor::New();
2991   application.GetScene().Add(actor);
2992
2993   // Build the animation
2994   float     durationSeconds(1.0f);
2995   Animation animation = Animation::New(durationSeconds);
2996   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2997   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2998
2999   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
3000
3001   // Start the animation
3002   animation.Play();
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(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
3015
3016   // Stop the animation
3017   animation.Stop();
3018   application.SendNotification();
3019
3020   // Loop 5 times
3021   for(int i = 0; i < 5; ++i)
3022   {
3023     application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
3024
3025     // We did expect the animation to finish
3026     application.SendNotification();
3027     finishCheck.CheckSignalReceived();
3028     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress when stopped */, TEST_LOCATION);
3029   }
3030   END_TEST;
3031 }
3032
3033 int UtcDaliAnimationStopSetPositionP(void)
3034 {
3035   // Test that Animation::Stop & Actor::SetPosition can be used in conjunction
3036   // i.e. to check that the animation does not interfere with the position set.
3037
3038   TestApplication application;
3039
3040   Actor actor = Actor::New();
3041   application.GetScene().Add(actor);
3042
3043   // Build the animation
3044   float     durationSeconds(1.0f);
3045   Animation animation = Animation::New(durationSeconds);
3046   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
3047   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
3048
3049   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
3050
3051   // Start the animation
3052   animation.Play();
3053
3054   bool                 signalReceived(false);
3055   AnimationFinishCheck finishCheck(signalReceived);
3056   animation.FinishedSignal().Connect(&application, finishCheck);
3057
3058   application.SendNotification();
3059   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3060
3061   // We didn't expect the animation to finish yet
3062   application.SendNotification();
3063   finishCheck.CheckSignalNotReceived();
3064   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
3065
3066   // Stop the animation
3067   animation.Stop();
3068   Vector3 positionSet(2.0f, 3.0f, 4.0f);
3069   actor.SetProperty(Actor::Property::POSITION, positionSet);
3070   application.SendNotification();
3071
3072   // Loop 5 times
3073   for(int i = 0; i < 5; ++i)
3074   {
3075     application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
3076
3077     // We did expect the animation to finish
3078     application.SendNotification();
3079     finishCheck.CheckSignalReceived();
3080     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), positionSet /*Animation should not interfere with this*/, TEST_LOCATION);
3081   }
3082   END_TEST;
3083 }
3084
3085 int UtcDaliAnimationClearP(void)
3086 {
3087   TestApplication application;
3088
3089   Actor actor = Actor::New();
3090   application.GetScene().Add(actor);
3091
3092   // Build the animation
3093   float     durationSeconds(1.0f);
3094   Animation animation = Animation::New(durationSeconds);
3095   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
3096   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
3097
3098   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
3099
3100   // Start the animation
3101   animation.Play();
3102
3103   bool                 signalReceived(false);
3104   AnimationFinishCheck finishCheck(signalReceived);
3105   animation.FinishedSignal().Connect(&application, finishCheck);
3106
3107   application.SendNotification();
3108   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3109
3110   // We didn't expect the animation to finish yet
3111   application.SendNotification();
3112   finishCheck.CheckSignalNotReceived();
3113   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
3114
3115   // Clear the animation
3116   animation.Clear();
3117   application.SendNotification();
3118
3119   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
3120
3121   // We don't expect the animation to finish now
3122   application.SendNotification();
3123   finishCheck.CheckSignalNotReceived();
3124   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress since the animator was destroyed */, TEST_LOCATION);
3125
3126   // Restart as a scale animation; this should not move the actor's position
3127   finishCheck.Reset();
3128   actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO);
3129   Vector3 targetScale(3.0f, 3.0f, 3.0f);
3130   animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR);
3131   animation.Play();
3132
3133   application.SendNotification();
3134   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3135
3136   // We didn't expect the animation to finish yet
3137   application.SendNotification();
3138   finishCheck.CheckSignalNotReceived();
3139   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO /*Check move-animator was destroyed*/, TEST_LOCATION);
3140   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION);
3141
3142   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
3143
3144   // We did expect the animation to finish
3145   application.SendNotification();
3146   finishCheck.CheckSignalReceived();
3147   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO /*Check move-animator was destroyed*/, TEST_LOCATION);
3148   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
3149   END_TEST;
3150 }
3151
3152 int UtcDaliAnimationFinishedSignalP(void)
3153 {
3154   TestApplication application;
3155
3156   // Start the empty animation
3157   float     durationSeconds(1.0f);
3158   Animation animation = Animation::New(durationSeconds);
3159   animation.Play();
3160
3161   bool                 signalReceived(false);
3162   AnimationFinishCheck finishCheck(signalReceived);
3163   animation.FinishedSignal().Connect(&application, finishCheck);
3164
3165   application.SendNotification();
3166   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*beyond the animation duration*/);
3167
3168   // We did expect the animation to finish
3169   application.SendNotification();
3170   finishCheck.CheckSignalReceived();
3171   END_TEST;
3172 }
3173
3174 int UtcDaliAnimationAnimateByBooleanP(void)
3175 {
3176   TestApplication application;
3177
3178   Actor actor = Actor::New();
3179
3180   // Register a boolean property
3181   bool            startValue(false);
3182   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3183   application.GetScene().Add(actor);
3184   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3185   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3186
3187   // Build the animation
3188   float      durationSeconds(2.0f);
3189   Animation  animation = Animation::New(durationSeconds);
3190   const bool relativeValue(true);
3191   const bool finalValue(false || relativeValue);
3192   animation.AnimateBy(Property(actor, index), relativeValue);
3193
3194   // Start the animation
3195   animation.Play();
3196
3197   // Target value should be retrievable straight away
3198   DALI_TEST_EQUALS(actor.GetProperty<bool>(index), finalValue, TEST_LOCATION);
3199
3200   bool                 signalReceived(false);
3201   AnimationFinishCheck finishCheck(signalReceived);
3202   animation.FinishedSignal().Connect(&application, finishCheck);
3203
3204   application.SendNotification();
3205   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3206
3207   // We didn't expect the animation to finish yet
3208   application.SendNotification();
3209   finishCheck.CheckSignalNotReceived();
3210   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3211
3212   application.SendNotification();
3213   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3214
3215   // We did expect the animation to finish
3216   application.SendNotification();
3217   finishCheck.CheckSignalReceived();
3218   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3219
3220   // Check that nothing has changed after a couple of buffer swaps
3221   application.Render(0);
3222   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3223   application.Render(0);
3224   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3225
3226   // Repeat with relative value "false" - this should be an NOOP
3227   animation = Animation::New(durationSeconds);
3228   bool noOpValue(false);
3229   animation.AnimateBy(Property(actor, index), noOpValue);
3230
3231   // Start the animation
3232   animation.Play();
3233
3234   finishCheck.Reset();
3235   animation.FinishedSignal().Connect(&application, finishCheck);
3236
3237   application.SendNotification();
3238   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3239
3240   // We didn't expect the animation to finish yet
3241   application.SendNotification();
3242   finishCheck.CheckSignalNotReceived();
3243   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3244
3245   application.SendNotification();
3246   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3247
3248   // We did expect the animation to finish
3249   application.SendNotification();
3250   finishCheck.CheckSignalReceived();
3251   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3252
3253   // Check that nothing has changed after a couple of buffer swaps
3254   application.Render(0);
3255   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3256   application.Render(0);
3257   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3258   END_TEST;
3259 }
3260
3261 int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void)
3262 {
3263   TestApplication application;
3264
3265   Actor actor = Actor::New();
3266
3267   // Register a boolean property
3268   bool            startValue(false);
3269   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3270   application.GetScene().Add(actor);
3271   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3272   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3273
3274   // Build the animation
3275   float     durationSeconds(2.0f);
3276   Animation animation = Animation::New(durationSeconds);
3277   bool      relativeValue(true);
3278   bool      finalValue(false || relativeValue);
3279   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN);
3280
3281   // Start the animation
3282   animation.Play();
3283
3284   bool                 signalReceived(false);
3285   AnimationFinishCheck finishCheck(signalReceived);
3286   animation.FinishedSignal().Connect(&application, finishCheck);
3287
3288   application.SendNotification();
3289   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3290
3291   // We didn't expect the animation to finish yet
3292   application.SendNotification();
3293   finishCheck.CheckSignalNotReceived();
3294   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3295
3296   application.SendNotification();
3297   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3298
3299   // We did expect the animation to finish
3300   application.SendNotification();
3301   finishCheck.CheckSignalReceived();
3302   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3303
3304   // Check that nothing has changed after a couple of buffer swaps
3305   application.Render(0);
3306   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3307   application.Render(0);
3308   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3309
3310   // Repeat with relative value "false" - this should be an NOOP
3311   animation = Animation::New(durationSeconds);
3312   bool noOpValue(false);
3313   animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunction::EASE_IN);
3314
3315   // Start the animation
3316   animation.Play();
3317
3318   finishCheck.Reset();
3319   animation.FinishedSignal().Connect(&application, finishCheck);
3320
3321   application.SendNotification();
3322   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3323
3324   // We didn't expect the animation to finish yet
3325   application.SendNotification();
3326   finishCheck.CheckSignalNotReceived();
3327   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3328
3329   application.SendNotification();
3330   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3331
3332   // We did expect the animation to finish
3333   application.SendNotification();
3334   finishCheck.CheckSignalReceived();
3335   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3336   END_TEST;
3337 }
3338
3339 int UtcDaliAnimationAnimateByBooleanTimePeriodP(void)
3340 {
3341   TestApplication application;
3342
3343   Actor actor = Actor::New();
3344
3345   // Register a boolean property
3346   bool            startValue(false);
3347   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3348   application.GetScene().Add(actor);
3349   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3350   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3351
3352   // Build the animation
3353   float     durationSeconds(2.0f);
3354   Animation animation = Animation::New(durationSeconds);
3355   bool      relativeValue(true);
3356   bool      finalValue(false || relativeValue);
3357   float     animatorDurationSeconds(durationSeconds * 0.5f);
3358   animation.AnimateBy(Property(actor, index),
3359                       relativeValue,
3360                       TimePeriod(animatorDurationSeconds));
3361
3362   // Start the animation
3363   animation.Play();
3364
3365   bool                 signalReceived(false);
3366   AnimationFinishCheck finishCheck(signalReceived);
3367   animation.FinishedSignal().Connect(&application, finishCheck);
3368
3369   application.SendNotification();
3370   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
3371
3372   // We didn't expect the animation to finish yet
3373   application.SendNotification();
3374   finishCheck.CheckSignalNotReceived();
3375   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3376
3377   application.SendNotification();
3378   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
3379
3380   // We didn't expect the animation to finish yet...
3381   application.SendNotification();
3382   finishCheck.CheckSignalNotReceived();
3383
3384   // ...however we should have reached the final value
3385   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3386
3387   application.SendNotification();
3388   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
3389
3390   // We did expect the animation to finish
3391   application.SendNotification();
3392   finishCheck.CheckSignalReceived();
3393   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3394
3395   // Check that nothing has changed after a couple of buffer swaps
3396   application.Render(0);
3397   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3398   application.Render(0);
3399   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3400   END_TEST;
3401 }
3402
3403 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void)
3404 {
3405   TestApplication application;
3406
3407   Actor actor = Actor::New();
3408
3409   // Register a boolean property
3410   bool            startValue(false);
3411   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3412   application.GetScene().Add(actor);
3413   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3414   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3415
3416   // Build the animation
3417   float     durationSeconds(2.0f);
3418   Animation animation = Animation::New(durationSeconds);
3419   bool      relativeValue(true);
3420   bool      finalValue(false || relativeValue);
3421   float     animatorDurationSeconds(durationSeconds * 0.5f);
3422   animation.AnimateBy(Property(actor, index),
3423                       relativeValue,
3424                       AlphaFunction::EASE_IN_OUT,
3425                       TimePeriod(animatorDurationSeconds));
3426
3427   // Start the animation
3428   animation.Play();
3429
3430   bool                 signalReceived(false);
3431   AnimationFinishCheck finishCheck(signalReceived);
3432   animation.FinishedSignal().Connect(&application, finishCheck);
3433
3434   application.SendNotification();
3435   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
3436
3437   // We didn't expect the animation to finish yet
3438   application.SendNotification();
3439   finishCheck.CheckSignalNotReceived();
3440   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3441
3442   application.SendNotification();
3443   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
3444
3445   // We didn't expect the animation to finish yet...
3446   application.SendNotification();
3447   finishCheck.CheckSignalNotReceived();
3448
3449   // ...however we should have reached the final value
3450   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3451
3452   application.SendNotification();
3453   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
3454
3455   // We did expect the animation to finish
3456   application.SendNotification();
3457   finishCheck.CheckSignalReceived();
3458   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3459
3460   // Check that nothing has changed after a couple of buffer swaps
3461   application.Render(0);
3462   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3463   application.Render(0);
3464   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3465   END_TEST;
3466 }
3467
3468 int UtcDaliAnimationAnimateByFloatP(void)
3469 {
3470   TestApplication application;
3471
3472   Actor actor = Actor::New();
3473
3474   // Register a float property
3475   float           startValue(10.0f);
3476   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3477   application.GetScene().Add(actor);
3478   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3479   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3480
3481   // Build the animation
3482   float     durationSeconds(2.0f);
3483   Animation animation = Animation::New(durationSeconds);
3484   float     targetValue(50.0f);
3485   float     relativeValue(targetValue - startValue);
3486   animation.AnimateBy(Property(actor, index), relativeValue);
3487
3488   float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
3489
3490   // Start the animation
3491   animation.Play();
3492
3493   // Target value should be retrievable straight away
3494   DALI_TEST_EQUALS(actor.GetProperty<float>(index), targetValue, TEST_LOCATION);
3495
3496   bool                 signalReceived(false);
3497   AnimationFinishCheck finishCheck(signalReceived);
3498   animation.FinishedSignal().Connect(&application, finishCheck);
3499
3500   application.SendNotification();
3501   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3502
3503   // We didn't expect the animation to finish yet
3504   application.SendNotification();
3505   finishCheck.CheckSignalNotReceived();
3506   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION);
3507
3508   application.SendNotification();
3509   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3510
3511   // We did expect the animation to finish
3512   application.SendNotification();
3513   finishCheck.CheckSignalReceived();
3514   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3515
3516   // Check that nothing has changed after a couple of buffer swaps
3517   application.Render(0);
3518   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3519   application.Render(0);
3520   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3521   END_TEST;
3522 }
3523
3524 int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void)
3525 {
3526   TestApplication application;
3527
3528   Actor actor = Actor::New();
3529
3530   // Register a float property
3531   float           startValue(10.0f);
3532   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3533   application.GetScene().Add(actor);
3534   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3535   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3536
3537   // Build the animation
3538   float     durationSeconds(1.0f);
3539   Animation animation = Animation::New(durationSeconds);
3540   float     targetValue(90.0f);
3541   float     relativeValue(targetValue - startValue);
3542   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3543
3544   float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
3545
3546   // Start the animation
3547   animation.Play();
3548
3549   bool                 signalReceived(false);
3550   AnimationFinishCheck finishCheck(signalReceived);
3551   animation.FinishedSignal().Connect(&application, finishCheck);
3552
3553   application.SendNotification();
3554   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3555
3556   // We didn't expect the animation to finish yet
3557   application.SendNotification();
3558   finishCheck.CheckSignalNotReceived();
3559
3560   // The position should have moved more, than with a linear alpha function
3561   float current(actor.GetCurrentProperty<float>(index));
3562   DALI_TEST_CHECK(current > ninetyFivePercentProgress);
3563
3564   application.SendNotification();
3565   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3566
3567   // We did expect the animation to finish
3568   application.SendNotification();
3569   finishCheck.CheckSignalReceived();
3570   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3571
3572   // Check that nothing has changed after a couple of buffer swaps
3573   application.Render(0);
3574   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3575   application.Render(0);
3576   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3577   END_TEST;
3578 }
3579
3580 int UtcDaliAnimationAnimateByFloatTimePeriodP(void)
3581 {
3582   TestApplication application;
3583
3584   Actor actor = Actor::New();
3585
3586   // Register a float property
3587   float           startValue(10.0f);
3588   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3589   application.GetScene().Add(actor);
3590   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3591   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3592
3593   // Build the animation
3594   float     durationSeconds(1.0f);
3595   Animation animation = Animation::New(durationSeconds);
3596   float     targetValue(30.0f);
3597   float     relativeValue(targetValue - startValue);
3598   float     delay = 0.5f;
3599   animation.AnimateBy(Property(actor, index),
3600                       relativeValue,
3601                       TimePeriod(delay, durationSeconds - delay));
3602
3603   // Start the animation
3604   animation.Play();
3605
3606   bool                 signalReceived(false);
3607   AnimationFinishCheck finishCheck(signalReceived);
3608   animation.FinishedSignal().Connect(&application, finishCheck);
3609
3610   application.SendNotification();
3611   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
3612
3613   // We didn't expect the animation to finish yet
3614   application.SendNotification();
3615   finishCheck.CheckSignalNotReceived();
3616   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3617
3618   application.SendNotification();
3619   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
3620
3621   // We didn't expect the animation to finish yet
3622   application.SendNotification();
3623   finishCheck.CheckSignalNotReceived();
3624   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
3625
3626   application.SendNotification();
3627   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
3628
3629   // We did expect the animation to finish
3630   application.SendNotification();
3631   finishCheck.CheckSignalReceived();
3632   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3633
3634   // Check that nothing has changed after a couple of buffer swaps
3635   application.Render(0);
3636   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3637   application.Render(0);
3638   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3639   END_TEST;
3640 }
3641
3642 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void)
3643 {
3644   TestApplication application;
3645
3646   Actor actor = Actor::New();
3647
3648   // Register a float property
3649   float           startValue(10.0f);
3650   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3651   application.GetScene().Add(actor);
3652   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3653   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3654
3655   // Build the animation
3656   float     durationSeconds(1.0f);
3657   Animation animation = Animation::New(durationSeconds);
3658   float     targetValue(30.0f);
3659   float     relativeValue(targetValue - startValue);
3660   float     delay = 0.5f;
3661   animation.AnimateBy(Property(actor, index),
3662                       relativeValue,
3663                       AlphaFunction::LINEAR,
3664                       TimePeriod(delay, durationSeconds - delay));
3665
3666   // Start the animation
3667   animation.Play();
3668
3669   bool                 signalReceived(false);
3670   AnimationFinishCheck finishCheck(signalReceived);
3671   animation.FinishedSignal().Connect(&application, finishCheck);
3672
3673   application.SendNotification();
3674   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
3675
3676   // We didn't expect the animation to finish yet
3677   application.SendNotification();
3678   finishCheck.CheckSignalNotReceived();
3679   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3680
3681   application.SendNotification();
3682   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
3683
3684   // We didn't expect the animation to finish yet
3685   application.SendNotification();
3686   finishCheck.CheckSignalNotReceived();
3687   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
3688
3689   application.SendNotification();
3690   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
3691
3692   // We did expect the animation to finish
3693   application.SendNotification();
3694   finishCheck.CheckSignalReceived();
3695   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3696
3697   // Check that nothing has changed after a couple of buffer swaps
3698   application.Render(0);
3699   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3700   application.Render(0);
3701   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3702   END_TEST;
3703 }
3704
3705 int UtcDaliAnimationAnimateByIntegerP(void)
3706 {
3707   TestApplication application;
3708
3709   Actor actor = Actor::New();
3710
3711   // Register an integer property
3712   int             startValue(1);
3713   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3714   application.GetScene().Add(actor);
3715   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
3716   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3717
3718   // Build the animation
3719   float     durationSeconds(2.0f);
3720   Animation animation = Animation::New(durationSeconds);
3721   int       targetValue(50);
3722   int       relativeValue(targetValue - startValue);
3723   animation.AnimateBy(Property(actor, index), relativeValue);
3724
3725   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
3726
3727   // Start the animation
3728   animation.Play();
3729
3730   // Target value should be retrievable straight away
3731   DALI_TEST_EQUALS(actor.GetProperty<int>(index), targetValue, TEST_LOCATION);
3732
3733   bool                 signalReceived(false);
3734   AnimationFinishCheck finishCheck(signalReceived);
3735   animation.FinishedSignal().Connect(&application, finishCheck);
3736
3737   application.SendNotification();
3738   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3739
3740   // We didn't expect the animation to finish yet
3741   application.SendNotification();
3742   finishCheck.CheckSignalNotReceived();
3743   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION);
3744
3745   application.SendNotification();
3746   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3747
3748   // We did expect the animation to finish
3749   application.SendNotification();
3750   finishCheck.CheckSignalReceived();
3751   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3752
3753   // Check that nothing has changed after a couple of buffer swaps
3754   application.Render(0);
3755   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3756   application.Render(0);
3757   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3758   END_TEST;
3759 }
3760
3761 int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void)
3762 {
3763   TestApplication application;
3764
3765   Actor actor = Actor::New();
3766
3767   // Register an integer property
3768   int             startValue(1);
3769   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3770   application.GetScene().Add(actor);
3771   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
3772   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3773
3774   // Build the animation
3775   float     durationSeconds(1.0f);
3776   Animation animation = Animation::New(durationSeconds);
3777   int       targetValue(90);
3778   int       relativeValue(targetValue - startValue);
3779   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3780
3781   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
3782
3783   // Start the animation
3784   animation.Play();
3785
3786   bool                 signalReceived(false);
3787   AnimationFinishCheck finishCheck(signalReceived);
3788   animation.FinishedSignal().Connect(&application, finishCheck);
3789
3790   application.SendNotification();
3791   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3792
3793   // We didn't expect the animation to finish yet
3794   application.SendNotification();
3795   finishCheck.CheckSignalNotReceived();
3796
3797   // The position should have moved more, than with a linear alpha function
3798   int current(actor.GetCurrentProperty<int>(index));
3799   DALI_TEST_CHECK(current > ninetyFivePercentProgress);
3800
3801   application.SendNotification();
3802   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3803
3804   // We did expect the animation to finish
3805   application.SendNotification();
3806   finishCheck.CheckSignalReceived();
3807   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3808
3809   // Check that nothing has changed after a couple of buffer swaps
3810   application.Render(0);
3811   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3812   application.Render(0);
3813   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3814   END_TEST;
3815 }
3816
3817 int UtcDaliAnimationAnimateByIntegerTimePeriodP(void)
3818 {
3819   TestApplication application;
3820
3821   Actor actor = Actor::New();
3822
3823   // Register an integer property
3824   int             startValue(10);
3825   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3826   application.GetScene().Add(actor);
3827   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
3828   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3829
3830   // Build the animation
3831   float     durationSeconds(1.0f);
3832   Animation animation = Animation::New(durationSeconds);
3833   int       targetValue(30);
3834   int       relativeValue(targetValue - startValue);
3835   float     delay = 0.5f;
3836   animation.AnimateBy(Property(actor, index),
3837                       relativeValue,
3838                       TimePeriod(delay, durationSeconds - delay));
3839
3840   // Start the animation
3841   animation.Play();
3842
3843   bool                 signalReceived(false);
3844   AnimationFinishCheck finishCheck(signalReceived);
3845   animation.FinishedSignal().Connect(&application, finishCheck);
3846
3847   application.SendNotification();
3848   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
3849
3850   // We didn't expect the animation to finish yet
3851   application.SendNotification();
3852   finishCheck.CheckSignalNotReceived();
3853   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3854
3855   application.SendNotification();
3856   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
3857
3858   // We didn't expect the animation to finish yet
3859   application.SendNotification();
3860   finishCheck.CheckSignalNotReceived();
3861   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
3862
3863   application.SendNotification();
3864   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
3865
3866   // We did expect the animation to finish
3867   application.SendNotification();
3868   finishCheck.CheckSignalReceived();
3869   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3870
3871   // Check that nothing has changed after a couple of buffer swaps
3872   application.Render(0);
3873   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3874   application.Render(0);
3875   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3876   END_TEST;
3877 }
3878
3879 int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void)
3880 {
3881   TestApplication application;
3882
3883   Actor actor = Actor::New();
3884
3885   // Register an integer property
3886   int             startValue(10);
3887   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3888   application.GetScene().Add(actor);
3889   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
3890   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3891
3892   // Build the animation
3893   float     durationSeconds(1.0f);
3894   Animation animation = Animation::New(durationSeconds);
3895   int       targetValue(30);
3896   int       relativeValue(targetValue - startValue);
3897   float     delay = 0.5f;
3898   animation.AnimateBy(Property(actor, index),
3899                       relativeValue,
3900                       AlphaFunction::LINEAR,
3901                       TimePeriod(delay, durationSeconds - delay));
3902
3903   // Start the animation
3904   animation.Play();
3905
3906   bool                 signalReceived(false);
3907   AnimationFinishCheck finishCheck(signalReceived);
3908   animation.FinishedSignal().Connect(&application, finishCheck);
3909
3910   application.SendNotification();
3911   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
3912
3913   // We didn't expect the animation to finish yet
3914   application.SendNotification();
3915   finishCheck.CheckSignalNotReceived();
3916   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3917
3918   application.SendNotification();
3919   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
3920
3921   // We didn't expect the animation to finish yet
3922   application.SendNotification();
3923   finishCheck.CheckSignalNotReceived();
3924   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
3925
3926   application.SendNotification();
3927   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
3928
3929   // We did expect the animation to finish
3930   application.SendNotification();
3931   finishCheck.CheckSignalReceived();
3932   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3933
3934   // Check that nothing has changed after a couple of buffer swaps
3935   application.Render(0);
3936   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3937   application.Render(0);
3938   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3939   END_TEST;
3940 }
3941
3942 int UtcDaliAnimationAnimateByQuaternionP(void)
3943 {
3944   TestApplication application;
3945
3946   Actor actor = Actor::New();
3947
3948   // Register a quaternion property
3949   const Quaternion startValue(Degree(90), Vector3::XAXIS);
3950   Property::Index  index = actor.RegisterProperty("testProperty", startValue);
3951   application.GetScene().Add(actor);
3952   DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == startValue);
3953   DALI_TEST_CHECK(actor.GetCurrentProperty<Quaternion>(index) == startValue);
3954
3955   // Build the animation
3956   float            durationSeconds(2.0f);
3957   Animation        animation = Animation::New(durationSeconds);
3958   const Quaternion relativeValue(Degree(90), Vector3::ZAXIS);
3959   const Quaternion finalValue(startValue * relativeValue);
3960   animation.AnimateBy(Property(actor, index), relativeValue);
3961
3962   DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == startValue);
3963   DALI_TEST_CHECK(actor.GetCurrentProperty<Quaternion>(index) == startValue);
3964
3965   // Start the animation
3966   animation.Play();
3967
3968   // Target value should be retrievable straight away
3969   DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == finalValue);
3970
3971   application.SendNotification();
3972   application.Render(2000); // animation complete
3973
3974   DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == finalValue);
3975   DALI_TEST_CHECK(actor.GetCurrentProperty<Quaternion>(index) == finalValue);
3976
3977   END_TEST;
3978 }
3979
3980 int UtcDaliAnimationAnimateByVector2P(void)
3981 {
3982   TestApplication application;
3983
3984   Actor actor = Actor::New();
3985
3986   // Register a Vector2 property
3987   Vector2         startValue(10.0f, 10.0f);
3988   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3989   application.GetScene().Add(actor);
3990   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
3991   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
3992
3993   // Build the animation
3994   float     durationSeconds(2.0f);
3995   Animation animation = Animation::New(durationSeconds);
3996   Vector2   targetValue(60.0f, 60.0f);
3997   Vector2   relativeValue(targetValue - startValue);
3998   animation.AnimateBy(Property(actor, index), relativeValue);
3999
4000   Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4001
4002   // Start the animation
4003   animation.Play();
4004
4005   // Target value should be retrievable straight away
4006   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION);
4007
4008   bool                 signalReceived(false);
4009   AnimationFinishCheck finishCheck(signalReceived);
4010   animation.FinishedSignal().Connect(&application, finishCheck);
4011
4012   application.SendNotification();
4013   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4014
4015   // We didn't expect the animation to finish yet
4016   application.SendNotification();
4017   finishCheck.CheckSignalNotReceived();
4018   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION);
4019
4020   application.SendNotification();
4021   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4022
4023   // We did expect the animation to finish
4024   application.SendNotification();
4025   finishCheck.CheckSignalReceived();
4026   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4027
4028   // Check that nothing has changed after a couple of buffer swaps
4029   application.Render(0);
4030   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4031   application.Render(0);
4032   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4033   END_TEST;
4034 }
4035
4036 int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void)
4037 {
4038   TestApplication application;
4039
4040   Actor actor = Actor::New();
4041
4042   // Register a Vector2 property
4043   Vector2         startValue(100.0f, 100.0f);
4044   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4045   application.GetScene().Add(actor);
4046   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4047   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4048
4049   // Build the animation
4050   float     durationSeconds(1.0f);
4051   Animation animation = Animation::New(durationSeconds);
4052   Vector2   targetValue(20.0f, 20.0f);
4053   Vector2   relativeValue(targetValue - startValue);
4054   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4055
4056   Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4057
4058   // Start the animation
4059   animation.Play();
4060
4061   bool                 signalReceived(false);
4062   AnimationFinishCheck finishCheck(signalReceived);
4063   animation.FinishedSignal().Connect(&application, finishCheck);
4064
4065   application.SendNotification();
4066   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4067
4068   // We didn't expect the animation to finish yet
4069   application.SendNotification();
4070   finishCheck.CheckSignalNotReceived();
4071
4072   // The position should have moved more, than with a linear alpha function
4073   Vector2 current(actor.GetCurrentProperty<Vector2>(index));
4074   DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x);
4075   DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y);
4076
4077   application.SendNotification();
4078   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4079
4080   // We did expect the animation to finish
4081   application.SendNotification();
4082   finishCheck.CheckSignalReceived();
4083   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4084
4085   // Check that nothing has changed after a couple of buffer swaps
4086   application.Render(0);
4087   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4088   application.Render(0);
4089   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4090   END_TEST;
4091 }
4092
4093 int UtcDaliAnimationAnimateByVector2TimePeriodP(void)
4094 {
4095   TestApplication application;
4096
4097   Actor actor = Actor::New();
4098
4099   // Register a Vector2 property
4100   Vector2         startValue(10.0f, 10.0f);
4101   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4102   application.GetScene().Add(actor);
4103   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4104   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4105
4106   // Build the animation
4107   float     durationSeconds(1.0f);
4108   Animation animation = Animation::New(durationSeconds);
4109   Vector2   targetValue(30.0f, 30.0f);
4110   Vector2   relativeValue(targetValue - startValue);
4111   float     delay = 0.5f;
4112   animation.AnimateBy(Property(actor, index),
4113                       relativeValue,
4114                       TimePeriod(delay, durationSeconds - delay));
4115
4116   // Start the animation
4117   animation.Play();
4118
4119   bool                 signalReceived(false);
4120   AnimationFinishCheck finishCheck(signalReceived);
4121   animation.FinishedSignal().Connect(&application, finishCheck);
4122
4123   application.SendNotification();
4124   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4125
4126   // We didn't expect the animation to finish yet
4127   application.SendNotification();
4128   finishCheck.CheckSignalNotReceived();
4129   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4130
4131   application.SendNotification();
4132   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4133
4134   // We didn't expect the animation to finish yet
4135   application.SendNotification();
4136   finishCheck.CheckSignalNotReceived();
4137   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4138
4139   application.SendNotification();
4140   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4141
4142   // We did expect the animation to finish
4143   application.SendNotification();
4144   finishCheck.CheckSignalReceived();
4145   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4146
4147   // Check that nothing has changed after a couple of buffer swaps
4148   application.Render(0);
4149   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4150   application.Render(0);
4151   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4152   END_TEST;
4153 }
4154
4155 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void)
4156 {
4157   TestApplication application;
4158
4159   Actor actor = Actor::New();
4160
4161   // Register a Vector2 property
4162   Vector2         startValue(5.0f, 5.0f);
4163   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4164   application.GetScene().Add(actor);
4165   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4166   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4167
4168   // Build the animation
4169   float     durationSeconds(1.0f);
4170   Animation animation = Animation::New(durationSeconds);
4171   Vector2   targetValue(10.0f, 10.0f);
4172   Vector2   relativeValue(targetValue - startValue);
4173   float     delay = 0.5f;
4174   animation.AnimateBy(Property(actor, index),
4175                       relativeValue,
4176                       AlphaFunction::LINEAR,
4177                       TimePeriod(delay, durationSeconds - delay));
4178
4179   // Start the animation
4180   animation.Play();
4181
4182   bool                 signalReceived(false);
4183   AnimationFinishCheck finishCheck(signalReceived);
4184   animation.FinishedSignal().Connect(&application, finishCheck);
4185
4186   application.SendNotification();
4187   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4188
4189   // We didn't expect the animation to finish yet
4190   application.SendNotification();
4191   finishCheck.CheckSignalNotReceived();
4192   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4193
4194   application.SendNotification();
4195   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4196
4197   // We didn't expect the animation to finish yet
4198   application.SendNotification();
4199   finishCheck.CheckSignalNotReceived();
4200   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4201
4202   application.SendNotification();
4203   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4204
4205   // We did expect the animation to finish
4206   application.SendNotification();
4207   finishCheck.CheckSignalReceived();
4208   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4209
4210   // Check that nothing has changed after a couple of buffer swaps
4211   application.Render(0);
4212   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4213   application.Render(0);
4214   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4215   END_TEST;
4216 }
4217
4218 int UtcDaliAnimationAnimateByVector3P(void)
4219 {
4220   TestApplication application;
4221
4222   Actor actor = Actor::New();
4223
4224   // Register a Vector3 property
4225   Vector3         startValue(10.0f, 10.0f, 10.0f);
4226   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4227   application.GetScene().Add(actor);
4228   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4229   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4230
4231   // Build the animation
4232   float     durationSeconds(2.0f);
4233   Animation animation = Animation::New(durationSeconds);
4234   Vector3   targetValue(60.0f, 60.0f, 60.0f);
4235   Vector3   relativeValue(targetValue - startValue);
4236   animation.AnimateBy(Property(actor, index), relativeValue);
4237
4238   Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4239
4240   // Start the animation
4241   animation.Play();
4242
4243   // Target value should be retrievable straight away
4244   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION);
4245
4246   bool                 signalReceived(false);
4247   AnimationFinishCheck finishCheck(signalReceived);
4248   animation.FinishedSignal().Connect(&application, finishCheck);
4249
4250   application.SendNotification();
4251   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4252
4253   // We didn't expect the animation to finish yet
4254   application.SendNotification();
4255   finishCheck.CheckSignalNotReceived();
4256   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION);
4257
4258   application.SendNotification();
4259   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4260
4261   // We did expect the animation to finish
4262   application.SendNotification();
4263   finishCheck.CheckSignalReceived();
4264   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4265
4266   // Check that nothing has changed after a couple of buffer swaps
4267   application.Render(0);
4268   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4269   application.Render(0);
4270   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4271   END_TEST;
4272 }
4273
4274 int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void)
4275 {
4276   TestApplication application;
4277
4278   Actor actor = Actor::New();
4279
4280   // Register a Vector3 property
4281   Vector3         startValue(100.0f, 100.0f, 100.0f);
4282   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4283   application.GetScene().Add(actor);
4284   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4285   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4286
4287   // Build the animation
4288   float     durationSeconds(1.0f);
4289   Animation animation = Animation::New(durationSeconds);
4290   Vector3   targetValue(20.0f, 20.0f, 20.0f);
4291   Vector3   relativeValue(targetValue - startValue);
4292   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4293
4294   Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4295
4296   // Start the animation
4297   animation.Play();
4298
4299   bool                 signalReceived(false);
4300   AnimationFinishCheck finishCheck(signalReceived);
4301   animation.FinishedSignal().Connect(&application, finishCheck);
4302
4303   application.SendNotification();
4304   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4305
4306   // We didn't expect the animation to finish yet
4307   application.SendNotification();
4308   finishCheck.CheckSignalNotReceived();
4309
4310   // The position should have moved more, than with a linear alpha function
4311   Vector3 current(actor.GetCurrentProperty<Vector3>(index));
4312   DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x);
4313   DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y);
4314   DALI_TEST_CHECK(current.z < ninetyFivePercentProgress.z);
4315
4316   application.SendNotification();
4317   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4318
4319   // We did expect the animation to finish
4320   application.SendNotification();
4321   finishCheck.CheckSignalReceived();
4322   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4323
4324   // Check that nothing has changed after a couple of buffer swaps
4325   application.Render(0);
4326   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4327   application.Render(0);
4328   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4329   END_TEST;
4330 }
4331
4332 int UtcDaliAnimationAnimateByVector3TimePeriodP(void)
4333 {
4334   TestApplication application;
4335
4336   Actor actor = Actor::New();
4337
4338   // Register a Vector3 property
4339   Vector3         startValue(10.0f, 10.0f, 10.0f);
4340   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4341   application.GetScene().Add(actor);
4342   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4343   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4344
4345   // Build the animation
4346   float     durationSeconds(1.0f);
4347   Animation animation = Animation::New(durationSeconds);
4348   Vector3   targetValue(30.0f, 30.0f, 30.0f);
4349   Vector3   relativeValue(targetValue - startValue);
4350   float     delay = 0.5f;
4351   animation.AnimateBy(Property(actor, index),
4352                       relativeValue,
4353                       TimePeriod(delay, durationSeconds - delay));
4354
4355   // Start the animation
4356   animation.Play();
4357
4358   bool                 signalReceived(false);
4359   AnimationFinishCheck finishCheck(signalReceived);
4360   animation.FinishedSignal().Connect(&application, finishCheck);
4361
4362   application.SendNotification();
4363   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4364
4365   // We didn't expect the animation to finish yet
4366   application.SendNotification();
4367   finishCheck.CheckSignalNotReceived();
4368   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4369
4370   application.SendNotification();
4371   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4372
4373   // We didn't expect the animation to finish yet
4374   application.SendNotification();
4375   finishCheck.CheckSignalNotReceived();
4376   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4377
4378   application.SendNotification();
4379   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4380
4381   // We did expect the animation to finish
4382   application.SendNotification();
4383   finishCheck.CheckSignalReceived();
4384   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4385
4386   // Check that nothing has changed after a couple of buffer swaps
4387   application.Render(0);
4388   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4389   application.Render(0);
4390   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4391   END_TEST;
4392 }
4393
4394 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void)
4395 {
4396   TestApplication application;
4397
4398   Actor actor = Actor::New();
4399
4400   // Register a Vector3 property
4401   Vector3         startValue(5.0f, 5.0f, 5.0f);
4402   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4403   application.GetScene().Add(actor);
4404   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4405   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4406
4407   // Build the animation
4408   float     durationSeconds(1.0f);
4409   Animation animation = Animation::New(durationSeconds);
4410   Vector3   targetValue(10.0f, 10.0f, 10.0f);
4411   Vector3   relativeValue(targetValue - startValue);
4412   float     delay = 0.5f;
4413   animation.AnimateBy(Property(actor, index),
4414                       relativeValue,
4415                       AlphaFunction::LINEAR,
4416                       TimePeriod(delay, durationSeconds - delay));
4417
4418   // Start the animation
4419   animation.Play();
4420
4421   bool                 signalReceived(false);
4422   AnimationFinishCheck finishCheck(signalReceived);
4423   animation.FinishedSignal().Connect(&application, finishCheck);
4424
4425   application.SendNotification();
4426   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4427
4428   // We didn't expect the animation to finish yet
4429   application.SendNotification();
4430   finishCheck.CheckSignalNotReceived();
4431   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4432
4433   application.SendNotification();
4434   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4435
4436   // We didn't expect the animation to finish yet
4437   application.SendNotification();
4438   finishCheck.CheckSignalNotReceived();
4439   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4440
4441   application.SendNotification();
4442   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4443
4444   // We did expect the animation to finish
4445   application.SendNotification();
4446   finishCheck.CheckSignalReceived();
4447   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4448
4449   // Check that nothing has changed after a couple of buffer swaps
4450   application.Render(0);
4451   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4452   application.Render(0);
4453   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4454   END_TEST;
4455 }
4456
4457 int UtcDaliAnimationAnimateByVector4P(void)
4458 {
4459   TestApplication application;
4460
4461   Actor actor = Actor::New();
4462
4463   // Register a Vector4 property
4464   Vector4         startValue(10.0f, 10.0f, 10.0f, 10.0f);
4465   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4466   application.GetScene().Add(actor);
4467   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4468   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4469
4470   // Build the animation
4471   float     durationSeconds(2.0f);
4472   Animation animation = Animation::New(durationSeconds);
4473   Vector4   targetValue(60.0f, 60.0f, 60.0f, 60.0f);
4474   Vector4   relativeValue(targetValue - startValue);
4475   animation.AnimateBy(Property(actor, index), relativeValue);
4476
4477   Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4478
4479   // Start the animation
4480   animation.Play();
4481
4482   // Target value should be retrievable straight away
4483   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION);
4484
4485   bool                 signalReceived(false);
4486   AnimationFinishCheck finishCheck(signalReceived);
4487   animation.FinishedSignal().Connect(&application, finishCheck);
4488
4489   application.SendNotification();
4490   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4491
4492   // We didn't expect the animation to finish yet
4493   application.SendNotification();
4494   finishCheck.CheckSignalNotReceived();
4495   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION);
4496
4497   application.SendNotification();
4498   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4499
4500   // We did expect the animation to finish
4501   application.SendNotification();
4502   finishCheck.CheckSignalReceived();
4503   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4504
4505   // Check that nothing has changed after a couple of buffer swaps
4506   application.Render(0);
4507   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4508   application.Render(0);
4509   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4510   END_TEST;
4511 }
4512
4513 int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void)
4514 {
4515   TestApplication application;
4516
4517   Actor actor = Actor::New();
4518
4519   // Register a Vector4 property
4520   Vector4         startValue(100.0f, 100.0f, 100.0f, 100.0f);
4521   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4522   application.GetScene().Add(actor);
4523   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4524   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4525
4526   // Build the animation
4527   float     durationSeconds(1.0f);
4528   Animation animation = Animation::New(durationSeconds);
4529   Vector4   targetValue(20.0f, 20.0f, 20.0f, 20.0f);
4530   Vector4   relativeValue(targetValue - startValue);
4531   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4532
4533   Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4534
4535   // Start the animation
4536   animation.Play();
4537
4538   bool                 signalReceived(false);
4539   AnimationFinishCheck finishCheck(signalReceived);
4540   animation.FinishedSignal().Connect(&application, finishCheck);
4541
4542   application.SendNotification();
4543   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4544
4545   // We didn't expect the animation to finish yet
4546   application.SendNotification();
4547   finishCheck.CheckSignalNotReceived();
4548
4549   // The position should have moved more, than with a linear alpha function
4550   Vector4 current(actor.GetCurrentProperty<Vector4>(index));
4551   DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x);
4552   DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y);
4553   DALI_TEST_CHECK(current.z < ninetyFivePercentProgress.z);
4554   DALI_TEST_CHECK(current.w < ninetyFivePercentProgress.w);
4555
4556   application.SendNotification();
4557   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4558
4559   // We did expect the animation to finish
4560   application.SendNotification();
4561   finishCheck.CheckSignalReceived();
4562   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4563
4564   // Check that nothing has changed after a couple of buffer swaps
4565   application.Render(0);
4566   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4567   application.Render(0);
4568   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4569   END_TEST;
4570 }
4571
4572 int UtcDaliAnimationAnimateByVector4TimePeriodP(void)
4573 {
4574   TestApplication application;
4575
4576   Actor actor = Actor::New();
4577
4578   // Register a Vector4 property
4579   Vector4         startValue(10.0f, 10.0f, 10.0f, 10.0f);
4580   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4581   application.GetScene().Add(actor);
4582   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4583   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4584
4585   // Build the animation
4586   float     durationSeconds(1.0f);
4587   Animation animation = Animation::New(durationSeconds);
4588   Vector4   targetValue(30.0f, 30.0f, 30.0f, 30.0f);
4589   Vector4   relativeValue(targetValue - startValue);
4590   float     delay = 0.5f;
4591   animation.AnimateBy(Property(actor, index),
4592                       relativeValue,
4593                       TimePeriod(delay, durationSeconds - delay));
4594
4595   // Start the animation
4596   animation.Play();
4597
4598   bool                 signalReceived(false);
4599   AnimationFinishCheck finishCheck(signalReceived);
4600   animation.FinishedSignal().Connect(&application, finishCheck);
4601
4602   application.SendNotification();
4603   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4604
4605   // We didn't expect the animation to finish yet
4606   application.SendNotification();
4607   finishCheck.CheckSignalNotReceived();
4608   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4609
4610   application.SendNotification();
4611   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4612
4613   // We didn't expect the animation to finish yet
4614   application.SendNotification();
4615   finishCheck.CheckSignalNotReceived();
4616   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4617
4618   application.SendNotification();
4619   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4620
4621   // We did expect the animation to finish
4622   application.SendNotification();
4623   finishCheck.CheckSignalReceived();
4624   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4625
4626   // Check that nothing has changed after a couple of buffer swaps
4627   application.Render(0);
4628   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4629   application.Render(0);
4630   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4631   END_TEST;
4632 }
4633
4634 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void)
4635 {
4636   TestApplication application;
4637
4638   Actor actor = Actor::New();
4639
4640   // Register a Vector4 property
4641   Vector4         startValue(5.0f, 5.0f, 5.0f, 5.0f);
4642   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4643   application.GetScene().Add(actor);
4644   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4645   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4646
4647   // Build the animation
4648   float     durationSeconds(1.0f);
4649   Animation animation = Animation::New(durationSeconds);
4650   Vector4   targetValue(10.0f, 10.0f, 10.0f, 10.0f);
4651   Vector4   relativeValue(targetValue - startValue);
4652   float     delay = 0.5f;
4653   animation.AnimateBy(Property(actor, index),
4654                       relativeValue,
4655                       AlphaFunction::LINEAR,
4656                       TimePeriod(delay, durationSeconds - delay));
4657
4658   // Start the animation
4659   animation.Play();
4660
4661   bool                 signalReceived(false);
4662   AnimationFinishCheck finishCheck(signalReceived);
4663   animation.FinishedSignal().Connect(&application, finishCheck);
4664
4665   application.SendNotification();
4666   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4667
4668   // We didn't expect the animation to finish yet
4669   application.SendNotification();
4670   finishCheck.CheckSignalNotReceived();
4671   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4672
4673   application.SendNotification();
4674   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4675
4676   // We didn't expect the animation to finish yet
4677   application.SendNotification();
4678   finishCheck.CheckSignalNotReceived();
4679   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4680
4681   application.SendNotification();
4682   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4683
4684   // We did expect the animation to finish
4685   application.SendNotification();
4686   finishCheck.CheckSignalReceived();
4687   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4688
4689   // Check that nothing has changed after a couple of buffer swaps
4690   application.Render(0);
4691   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4692   application.Render(0);
4693   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4694   END_TEST;
4695 }
4696
4697 int UtcDaliAnimationAnimateByActorPositionP(void)
4698 {
4699   TestApplication application;
4700
4701   Actor   actor = Actor::New();
4702   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4703   actor.SetProperty(Actor::Property::POSITION, startPosition);
4704   application.GetScene().Add(actor);
4705   application.SendNotification();
4706   application.Render(0);
4707   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4708
4709   // Build the animation
4710   float     durationSeconds(1.0f);
4711   Animation animation = Animation::New(durationSeconds);
4712   Vector3   targetPosition(20.0f, 20.0f, 20.0f);
4713   Vector3   relativePosition(targetPosition - startPosition);
4714   animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition);
4715
4716   Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
4717
4718   // Start the animation
4719   animation.Play();
4720
4721   // Target value should be retrievable straight away
4722   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4723
4724   bool                 signalReceived(false);
4725   AnimationFinishCheck finishCheck(signalReceived);
4726   animation.FinishedSignal().Connect(&application, finishCheck);
4727
4728   application.SendNotification();
4729   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4730
4731   // We didn't expect the animation to finish yet
4732   application.SendNotification();
4733   finishCheck.CheckSignalNotReceived();
4734   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), ninetyFivePercentProgress, TEST_LOCATION);
4735
4736   application.SendNotification();
4737   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4738
4739   // We did expect the animation to finish
4740   application.SendNotification();
4741   finishCheck.CheckSignalReceived();
4742   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4743
4744   // Check that nothing has changed after a couple of buffer swaps
4745   application.Render(0);
4746   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4747   application.Render(0);
4748   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4749   END_TEST;
4750 }
4751
4752 int UtcDaliAnimationAnimateByActorPositionComponentsP(void)
4753 {
4754   TestApplication application;
4755
4756   Actor actor = Actor::New();
4757   application.GetScene().Add(actor);
4758   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
4759
4760   // Build the animation
4761   float     durationSeconds(1.0f);
4762   Animation animation = Animation::New(durationSeconds);
4763   Vector3   targetPosition(200.0f, 300.0f, 400.0f);
4764   Vector3   relativePosition(targetPosition - Vector3::ZERO);
4765   animation.AnimateBy(Property(actor, Actor::Property::POSITION_X), relativePosition.x);
4766   animation.AnimateBy(Property(actor, Actor::Property::POSITION_Y), relativePosition.y);
4767   animation.AnimateBy(Property(actor, Actor::Property::POSITION_Z), relativePosition.z);
4768
4769   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
4770   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
4771
4772   // Start the animation
4773   animation.Play();
4774
4775   // Target value should be retrievable straight away
4776   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4777   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
4778   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
4779   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
4780
4781   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); // Not changed yet
4782
4783   application.SendNotification();
4784   application.Render(1000); // 1 second progress
4785
4786   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4787
4788   END_TEST;
4789 }
4790
4791 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
4792 {
4793   TestApplication application;
4794
4795   Actor   actor = Actor::New();
4796   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4797   actor.SetProperty(Actor::Property::POSITION, startPosition);
4798   application.GetScene().Add(actor);
4799   application.SendNotification();
4800   application.Render(0);
4801   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4802
4803   // Build the animation
4804   float     durationSeconds(1.0f);
4805   Animation animation = Animation::New(durationSeconds);
4806   Vector3   targetPosition(20.0f, 20.0f, 20.0f);
4807   Vector3   relativePosition(targetPosition - startPosition);
4808   animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
4809
4810   Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
4811
4812   // Start the animation
4813   animation.Play();
4814
4815   bool                 signalReceived(false);
4816   AnimationFinishCheck finishCheck(signalReceived);
4817   animation.FinishedSignal().Connect(&application, finishCheck);
4818
4819   application.SendNotification();
4820   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4821
4822   // We didn't expect the animation to finish yet
4823   application.SendNotification();
4824   finishCheck.CheckSignalNotReceived();
4825
4826   // The position should have moved more, than with a linear alpha function
4827   Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
4828   DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
4829   DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
4830   DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z);
4831
4832   application.SendNotification();
4833   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4834
4835   // We did expect the animation to finish
4836   application.SendNotification();
4837   finishCheck.CheckSignalReceived();
4838   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4839
4840   // Check that nothing has changed after a couple of buffer swaps
4841   application.Render(0);
4842   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4843   application.Render(0);
4844   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4845   END_TEST;
4846 }
4847
4848 int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void)
4849 {
4850   TestApplication application;
4851
4852   Actor   actor = Actor::New();
4853   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4854   actor.SetProperty(Actor::Property::POSITION, startPosition);
4855   application.GetScene().Add(actor);
4856   application.SendNotification();
4857   application.Render(0);
4858   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4859
4860   // Build the animation
4861   float     durationSeconds(1.0f);
4862   Animation animation = Animation::New(durationSeconds);
4863   Vector3   targetPosition(20.0f, 20.0f, 20.0f);
4864   Vector3   relativePosition(targetPosition - startPosition);
4865   float     delay = 0.5f;
4866   animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4867                       relativePosition,
4868                       TimePeriod(delay, durationSeconds - delay));
4869
4870   Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
4871
4872   // Start the animation
4873   animation.Play();
4874
4875   bool                 signalReceived(false);
4876   AnimationFinishCheck finishCheck(signalReceived);
4877   animation.FinishedSignal().Connect(&application, finishCheck);
4878
4879   application.SendNotification();
4880   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4881
4882   // We didn't expect the animation to finish yet
4883   application.SendNotification();
4884   finishCheck.CheckSignalNotReceived();
4885   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4886
4887   application.SendNotification();
4888   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
4889
4890   // We did expect the animation to finish
4891   application.SendNotification();
4892   finishCheck.CheckSignalReceived();
4893   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4894
4895   // Check that nothing has changed after a couple of buffer swaps
4896   application.Render(0);
4897   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4898   application.Render(0);
4899   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4900   END_TEST;
4901 }
4902
4903 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void)
4904 {
4905   TestApplication application;
4906
4907   Actor   actor = Actor::New();
4908   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4909   actor.SetProperty(Actor::Property::POSITION, startPosition);
4910   application.GetScene().Add(actor);
4911   application.SendNotification();
4912   application.Render(0);
4913   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4914
4915   // Build the animation
4916   float     durationSeconds(1.0f);
4917   Animation animation = Animation::New(durationSeconds);
4918   Vector3   targetPosition(20.0f, 20.0f, 20.0f);
4919   Vector3   relativePosition(targetPosition - startPosition);
4920   float     delay = 0.5f;
4921   animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4922                       relativePosition,
4923                       AlphaFunction::LINEAR,
4924                       TimePeriod(delay, durationSeconds - delay));
4925
4926   Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
4927
4928   // Start the animation
4929   animation.Play();
4930
4931   bool                 signalReceived(false);
4932   AnimationFinishCheck finishCheck(signalReceived);
4933   animation.FinishedSignal().Connect(&application, finishCheck);
4934
4935   application.SendNotification();
4936   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4937
4938   // We didn't expect the animation to finish yet
4939   application.SendNotification();
4940   finishCheck.CheckSignalNotReceived();
4941   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4942
4943   application.SendNotification();
4944   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
4945
4946   // We did expect the animation to finish
4947   application.SendNotification();
4948   finishCheck.CheckSignalReceived();
4949   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4950
4951   // Check that nothing has changed after a couple of buffer swaps
4952   application.Render(0);
4953   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4954   application.Render(0);
4955   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4956   END_TEST;
4957 }
4958
4959 int UtcDaliAnimationAnimateByActorOrientationP1(void)
4960 {
4961   TestApplication application;
4962
4963   Actor actor = Actor::New();
4964   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
4965   application.GetScene().Add(actor);
4966   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
4967
4968   // Build the animation
4969   float     durationSeconds(1.0f);
4970   Animation animation = Animation::New(durationSeconds);
4971   Degree    relativeRotationDegrees(360.0f);
4972   Radian    relativeRotationRadians(relativeRotationDegrees);
4973   animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS));
4974
4975   // Start the animation
4976   animation.Play();
4977
4978   // Target value should be retrievable straight away
4979   DALI_TEST_EQUALS(actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), TEST_LOCATION);
4980
4981   bool                 signalReceived(false);
4982   AnimationFinishCheck finishCheck(signalReceived);
4983   animation.FinishedSignal().Connect(&application, finishCheck);
4984
4985   application.SendNotification();
4986   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
4987
4988   // We didn't expect the animation to finish yet
4989   application.SendNotification();
4990   finishCheck.CheckSignalNotReceived();
4991   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
4992
4993   application.SendNotification();
4994   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
4995
4996   // We didn't expect the animation to finish yet
4997   application.SendNotification();
4998   finishCheck.CheckSignalNotReceived();
4999   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5000
5001   application.SendNotification();
5002   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5003
5004   // We didn't expect the animation to finish yet
5005   application.SendNotification();
5006   finishCheck.CheckSignalNotReceived();
5007   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5008
5009   application.SendNotification();
5010   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5011
5012   // We did expect the animation to finish
5013   application.SendNotification();
5014   finishCheck.CheckSignalReceived();
5015   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5016   END_TEST;
5017 }
5018
5019 int UtcDaliAnimationAnimateByActorOrientationP2(void)
5020 {
5021   TestApplication application;
5022
5023   tet_printf("Testing that rotation angle > 360 performs full rotations\n");
5024
5025   Actor actor = Actor::New();
5026   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::ZAXIS));
5027   application.GetScene().Add(actor);
5028   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5029
5030   // Build the animation
5031   float     durationSeconds(1.0f);
5032   Animation animation = Animation::New(durationSeconds);
5033   Degree    relativeRotationDegrees(710.0f);
5034   Radian    relativeRotationRadians(relativeRotationDegrees);
5035
5036   animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), AngleAxis(relativeRotationRadians, Vector3::ZAXIS));
5037
5038   // Start the animation
5039   animation.Play();
5040
5041   bool                 signalReceived(false);
5042   AnimationFinishCheck finishCheck(signalReceived);
5043   animation.FinishedSignal().Connect(&application, finishCheck);
5044
5045   application.SendNotification();
5046   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5047
5048   // We didn't expect the animation to finish yet
5049   application.SendNotification();
5050   finishCheck.CheckSignalNotReceived();
5051   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5052
5053   application.SendNotification();
5054   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5055
5056   // We didn't expect the animation to finish yet
5057   application.SendNotification();
5058   finishCheck.CheckSignalNotReceived();
5059   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5060
5061   application.SendNotification();
5062   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5063
5064   // We didn't expect the animation to finish yet
5065   application.SendNotification();
5066   finishCheck.CheckSignalNotReceived();
5067   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5068
5069   application.SendNotification();
5070   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5071
5072   // We did expect the animation to finish
5073   application.SendNotification();
5074   finishCheck.CheckSignalReceived();
5075   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5076   END_TEST;
5077 }
5078
5079 int UtcDaliAnimationAnimateByActorOrientationP3(void)
5080 {
5081   TestApplication application;
5082
5083   tet_printf("Testing that rotation angle > 360 performs partial rotations when cast to Quaternion\n");
5084
5085   Actor actor = Actor::New();
5086   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::ZAXIS));
5087   application.GetScene().Add(actor);
5088   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5089
5090   // Build the animation
5091   float     durationSeconds(1.0f);
5092   Animation animation = Animation::New(durationSeconds);
5093   Degree    relativeRotationDegrees(730.0f);
5094   Radian    relativeRotationRadians(relativeRotationDegrees);
5095
5096   Radian actualRotationRadians(Degree(10.0f));
5097
5098   animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS));
5099
5100   // Start the animation
5101   animation.Play();
5102
5103   bool                 signalReceived(false);
5104   AnimationFinishCheck finishCheck(signalReceived);
5105   animation.FinishedSignal().Connect(&application, finishCheck);
5106
5107   application.SendNotification();
5108   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5109
5110   // We didn't expect the animation to finish yet
5111   application.SendNotification();
5112   finishCheck.CheckSignalNotReceived();
5113   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5114
5115   application.SendNotification();
5116   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5117
5118   // We didn't expect the animation to finish yet
5119   application.SendNotification();
5120   finishCheck.CheckSignalNotReceived();
5121   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5122
5123   application.SendNotification();
5124   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5125
5126   // We didn't expect the animation to finish yet
5127   application.SendNotification();
5128   finishCheck.CheckSignalNotReceived();
5129   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5130
5131   application.SendNotification();
5132   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5133
5134   // We did expect the animation to finish
5135   application.SendNotification();
5136   finishCheck.CheckSignalReceived();
5137   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5138   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5139   END_TEST;
5140 }
5141
5142 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
5143 {
5144   TestApplication application;
5145
5146   Actor actor = Actor::New();
5147   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
5148   application.GetScene().Add(actor);
5149   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5150
5151   // Build the animation
5152   float     durationSeconds(1.0f);
5153   Animation animation = Animation::New(durationSeconds);
5154   Degree    relativeRotationDegrees(360.0f);
5155   Radian    relativeRotationRadians(relativeRotationDegrees);
5156   animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), AlphaFunction::EASE_IN);
5157
5158   // Start the animation
5159   animation.Play();
5160
5161   bool                 signalReceived(false);
5162   AnimationFinishCheck finishCheck(signalReceived);
5163   animation.FinishedSignal().Connect(&application, finishCheck);
5164
5165   application.SendNotification();
5166   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5167
5168   // We didn't expect the animation to finish yet
5169   application.SendNotification();
5170   finishCheck.CheckSignalNotReceived();
5171   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f * 0.25f * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5172
5173   application.SendNotification();
5174   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5175
5176   // We didn't expect the animation to finish yet
5177   application.SendNotification();
5178   finishCheck.CheckSignalNotReceived();
5179   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f * 0.5f * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5180
5181   application.SendNotification();
5182   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5183
5184   // We didn't expect the animation to finish yet
5185   application.SendNotification();
5186   finishCheck.CheckSignalNotReceived();
5187   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f * 0.75f * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5188
5189   application.SendNotification();
5190   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5191
5192   // We did expect the animation to finish
5193   application.SendNotification();
5194   finishCheck.CheckSignalReceived();
5195   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5196   END_TEST;
5197 }
5198
5199 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void)
5200 {
5201   TestApplication application;
5202
5203   Actor actor = Actor::New();
5204   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
5205   application.GetScene().Add(actor);
5206   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5207
5208   // Build the animation
5209   float     durationSeconds(1.0f);
5210   Animation animation = Animation::New(durationSeconds);
5211   Degree    relativeRotationDegrees(360.0f);
5212   Radian    relativeRotationRadians(relativeRotationDegrees);
5213   float     delay = 0.3f;
5214   animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
5215
5216   // Start the animation
5217   animation.Play();
5218
5219   bool                 signalReceived(false);
5220   AnimationFinishCheck finishCheck(signalReceived);
5221   animation.FinishedSignal().Connect(&application, finishCheck);
5222
5223   application.SendNotification();
5224   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5225
5226   // We didn't expect the animation to finish yet
5227   application.SendNotification();
5228   finishCheck.CheckSignalNotReceived();
5229   float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
5230   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5231
5232   application.SendNotification();
5233   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5234
5235   // We didn't expect the animation to finish yet
5236   application.SendNotification();
5237   finishCheck.CheckSignalNotReceived();
5238   progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
5239   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5240
5241   application.SendNotification();
5242   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5243
5244   // We didn't expect the animation to finish yet
5245   application.SendNotification();
5246   finishCheck.CheckSignalNotReceived();
5247   progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
5248   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5249
5250   application.SendNotification();
5251   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5252
5253   // We did expect the animation to finish
5254   application.SendNotification();
5255   finishCheck.CheckSignalReceived();
5256   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5257   END_TEST;
5258 }
5259
5260 int UtcDaliAnimationAnimateByActorScaleP(void)
5261 {
5262   TestApplication application;
5263
5264   Actor actor = Actor::New();
5265   application.GetScene().Add(actor);
5266   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5267
5268   // Build the animation
5269   float     durationSeconds(1.0f);
5270   Animation animation = Animation::New(durationSeconds);
5271   Vector3   targetScale(2.0f, 2.0f, 2.0f);
5272   Vector3   relativeScale(targetScale - Vector3::ONE);
5273   animation.AnimateBy(Property(actor, Actor::Property::SCALE), Vector3(relativeScale.x, relativeScale.y, relativeScale.z));
5274
5275   Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale * 0.99f);
5276
5277   // Start the animation
5278   animation.Play();
5279
5280   // Target value should be retrievable straight away
5281   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5282
5283   bool                 signalReceived(false);
5284   AnimationFinishCheck finishCheck(signalReceived);
5285   animation.FinishedSignal().Connect(&application, finishCheck);
5286
5287   application.SendNotification();
5288   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
5289
5290   // We didn't expect the animation to finish yet
5291   application.SendNotification();
5292   finishCheck.CheckSignalNotReceived();
5293   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), ninetyNinePercentProgress, TEST_LOCATION);
5294
5295   application.SendNotification();
5296   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
5297
5298   // We did expect the animation to finish
5299   application.SendNotification();
5300   finishCheck.CheckSignalReceived();
5301   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5302
5303   // Reset everything
5304   finishCheck.Reset();
5305   actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
5306   application.SendNotification();
5307   application.Render(0);
5308   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5309
5310   // Repeat with a different (ease-in) alpha function
5311   animation = Animation::New(durationSeconds);
5312   animation.AnimateBy(Property(actor, Actor::Property::SCALE), relativeScale, AlphaFunction::EASE_IN);
5313   animation.FinishedSignal().Connect(&application, finishCheck);
5314   animation.Play();
5315
5316   application.SendNotification();
5317   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
5318
5319   // We didn't expect the animation to finish yet
5320   application.SendNotification();
5321   finishCheck.CheckSignalNotReceived();
5322
5323   // The scale should have grown less, than with a linear alpha function
5324   Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
5325   DALI_TEST_CHECK(current.x > 1.0f);
5326   DALI_TEST_CHECK(current.y > 1.0f);
5327   DALI_TEST_CHECK(current.z > 1.0f);
5328   DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
5329   DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
5330   DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z);
5331
5332   application.SendNotification();
5333   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
5334
5335   // We did expect the animation to finish
5336   application.SendNotification();
5337   finishCheck.CheckSignalReceived();
5338   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5339
5340   // Reset everything
5341   finishCheck.Reset();
5342   actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
5343   application.SendNotification();
5344   application.Render(0);
5345   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5346
5347   // Repeat with a delay
5348   float delay = 0.5f;
5349   animation   = Animation::New(durationSeconds);
5350   animation.AnimateBy(Property(actor, Actor::Property::SCALE), relativeScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
5351   animation.FinishedSignal().Connect(&application, finishCheck);
5352   animation.Play();
5353
5354   application.SendNotification();
5355   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
5356
5357   // We didn't expect the animation to finish yet
5358   application.SendNotification();
5359   finishCheck.CheckSignalNotReceived();
5360   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5361
5362   application.SendNotification();
5363   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
5364
5365   // We did expect the animation to finish
5366   application.SendNotification();
5367   finishCheck.CheckSignalReceived();
5368   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5369   END_TEST;
5370 }
5371
5372 int UtcDaliAnimationAnimateByActorScaleComponentsP(void)
5373 {
5374   TestApplication application;
5375
5376   Actor actor = Actor::New();
5377   application.GetScene().Add(actor);
5378   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5379
5380   // Build the animation
5381   float     durationSeconds(1.0f);
5382   Animation animation = Animation::New(durationSeconds);
5383   Vector3   targetScale(2.0f, 3.0f, 4.0f);
5384   Vector3   relativeScale(targetScale - Vector3::ONE);
5385   animation.AnimateBy(Property(actor, Actor::Property::SCALE_X), relativeScale.x);
5386   animation.AnimateBy(Property(actor, Actor::Property::SCALE_Y), relativeScale.y);
5387   animation.AnimateBy(Property(actor, Actor::Property::SCALE_Z), relativeScale.z);
5388
5389   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5390   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5391
5392   // Start the animation
5393   animation.Play();
5394
5395   // Target value should be retrievable straight away
5396   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5397   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), targetScale.x, TEST_LOCATION);
5398   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), targetScale.y, TEST_LOCATION);
5399   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), targetScale.z, TEST_LOCATION);
5400
5401   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION); // Not changed yet
5402
5403   application.SendNotification();
5404   application.Render(1000); // 1 second progress
5405
5406   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5407
5408   END_TEST;
5409 }
5410
5411 int UtcDaliAnimationAnimateByActorColorP(void)
5412 {
5413   TestApplication application;
5414
5415   Actor actor = Actor::New();
5416   application.GetScene().Add(actor);
5417   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5418
5419   // Build the animation
5420   float     durationSeconds(1.0f);
5421   Animation animation = Animation::New(durationSeconds);
5422   Vector4   targetColor(0.5f, 0.75f, 0.8f, 0.1f);
5423   Vector4   relativeColor(targetColor - Color::WHITE);
5424   animation.AnimateBy(Property(actor, Actor::Property::COLOR), relativeColor);
5425
5426   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5427   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5428
5429   // Start the animation
5430   animation.Play();
5431
5432   // Target value should be retrievable straight away
5433   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5434   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION);
5435   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION);
5436   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION);
5437   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION);
5438
5439   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); // Not changed yet
5440
5441   application.SendNotification();
5442   application.Render(1000); // 1 second progress
5443
5444   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5445
5446   END_TEST;
5447 }
5448
5449 int UtcDaliAnimationAnimateByActorColorComponentsP(void)
5450 {
5451   TestApplication application;
5452
5453   Actor actor = Actor::New();
5454   application.GetScene().Add(actor);
5455   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5456
5457   // Build the animation
5458   float     durationSeconds(1.0f);
5459   Animation animation = Animation::New(durationSeconds);
5460   Vector4   targetColor(0.5f, 0.75f, 0.8f, 0.1f);
5461   Vector4   relativeColor(targetColor - Color::WHITE);
5462   animation.AnimateBy(Property(actor, Actor::Property::COLOR_RED), relativeColor.r);
5463   animation.AnimateBy(Property(actor, Actor::Property::COLOR_GREEN), relativeColor.g);
5464   animation.AnimateBy(Property(actor, Actor::Property::COLOR_BLUE), relativeColor.b);
5465   animation.AnimateBy(Property(actor, Actor::Property::COLOR_ALPHA), relativeColor.a);
5466
5467   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5468   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5469
5470   // Start the animation
5471   animation.Play();
5472
5473   // Target value should be retrievable straight away
5474   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5475   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION);
5476   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION);
5477   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION);
5478   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION);
5479
5480   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); // Not changed yet
5481
5482   application.SendNotification();
5483   application.Render(1000); // 1 second progress
5484
5485   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5486
5487   END_TEST;
5488 }
5489
5490 int UtcDaliAnimationAnimateByActorSizeP(void)
5491 {
5492   TestApplication application;
5493
5494   Actor actor = Actor::New();
5495   application.GetScene().Add(actor);
5496   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5497
5498   // Build the animation
5499   float     durationSeconds(1.0f);
5500   Animation animation = Animation::New(durationSeconds);
5501   Vector3   targetSize(100.0f, 200.0f, 300.0f);
5502   Vector3   relativeSize(targetSize - Vector3::ZERO);
5503   animation.AnimateBy(Property(actor, Actor::Property::SIZE), relativeSize);
5504
5505   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5506   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5507
5508   // Start the animation
5509   animation.Play();
5510
5511   // Target value should be retrievable straight away
5512   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5513   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION);
5514   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION);
5515   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION);
5516
5517   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Not changed yet
5518
5519   application.SendNotification();
5520   application.Render(1000); // 1 second progress
5521
5522   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5523
5524   END_TEST;
5525 }
5526
5527 int UtcDaliAnimationAnimateByActorSizeComponentsP(void)
5528 {
5529   TestApplication application;
5530
5531   Actor actor = Actor::New();
5532   application.GetScene().Add(actor);
5533   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5534
5535   // Build the animation
5536   float     durationSeconds(1.0f);
5537   Animation animation = Animation::New(durationSeconds);
5538   Vector3   targetSize(100.0f, 200.0f, 300.0f);
5539   Vector3   relativeSize(targetSize - Vector3::ZERO);
5540   animation.AnimateBy(Property(actor, Actor::Property::SIZE_WIDTH), relativeSize.width);
5541   animation.AnimateBy(Property(actor, Actor::Property::SIZE_HEIGHT), relativeSize.height);
5542   animation.AnimateBy(Property(actor, Actor::Property::SIZE_DEPTH), relativeSize.depth);
5543
5544   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5545   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5546
5547   // Start the animation
5548   animation.Play();
5549
5550   // Target value should be retrievable straight away
5551   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5552   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION);
5553   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION);
5554   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION);
5555
5556   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Not changed yet
5557
5558   application.SendNotification();
5559   application.Render(1000); // 1 second progress
5560
5561   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5562
5563   END_TEST;
5564 }
5565
5566 int UtcDaliAnimationAnimateByActorVisibilityP(void)
5567 {
5568   TestApplication application;
5569
5570   Actor actor = Actor::New();
5571   application.GetScene().Add(actor);
5572   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
5573
5574   actor.SetProperty(Actor::Property::VISIBLE, false);
5575
5576   application.SendNotification();
5577   application.Render();
5578
5579   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
5580
5581   // Build the animation
5582   float     durationSeconds(1.0f);
5583   Animation animation = Animation::New(durationSeconds);
5584   bool      targetVisibility(true);
5585   bool      relativeVisibility(targetVisibility);
5586   animation.AnimateBy(Property(actor, Actor::Property::VISIBLE), relativeVisibility);
5587
5588   DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
5589
5590   // Start the animation
5591   animation.Play();
5592
5593   // Target value should be retrievable straight away
5594   DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), targetVisibility, TEST_LOCATION);
5595   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION); // Not changed yet
5596
5597   application.SendNotification();
5598   application.Render(1000); // 1 second progress
5599
5600   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
5601
5602   END_TEST;
5603 }
5604
5605 int UtcDaliAnimationAnimateToBooleanP(void)
5606 {
5607   TestApplication application;
5608
5609   Actor actor = Actor::New();
5610
5611   // Register a boolean property
5612   const bool      startValue(false);
5613   Property::Index index = actor.RegisterProperty("testProperty", startValue);
5614   application.GetScene().Add(actor);
5615   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5616   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5617
5618   // Build the animation
5619   float      durationSeconds(2.0f);
5620   Animation  animation = Animation::New(durationSeconds);
5621   const bool targetValue(!startValue);
5622   animation.AnimateTo(Property(actor, index), targetValue);
5623
5624   // Start the animation
5625   animation.Play();
5626
5627   bool                 signalReceived(false);
5628   AnimationFinishCheck finishCheck(signalReceived);
5629   animation.FinishedSignal().Connect(&application, finishCheck);
5630
5631   application.SendNotification();
5632   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5633
5634   // We didn't expect the animation to finish yet
5635   application.SendNotification();
5636   finishCheck.CheckSignalNotReceived();
5637   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5638
5639   application.SendNotification();
5640   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5641
5642   // We did expect the animation to finish
5643   application.SendNotification();
5644   finishCheck.CheckSignalReceived();
5645   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5646
5647   // Check that nothing has changed after a couple of buffer swaps
5648   application.Render(0);
5649   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5650   application.Render(0);
5651   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5652
5653   // Repeat with target value "false"
5654   animation = Animation::New(durationSeconds);
5655   const bool finalValue(!targetValue);
5656   animation.AnimateTo(Property(actor, index), finalValue);
5657
5658   // Start the animation
5659   animation.Play();
5660
5661   finishCheck.Reset();
5662   animation.FinishedSignal().Connect(&application, finishCheck);
5663
5664   application.SendNotification();
5665   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5666
5667   // We didn't expect the animation to finish yet
5668   application.SendNotification();
5669   finishCheck.CheckSignalNotReceived();
5670   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5671
5672   application.SendNotification();
5673   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5674
5675   // We did expect the animation to finish
5676   application.SendNotification();
5677   finishCheck.CheckSignalReceived();
5678   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5679
5680   // Check that nothing has changed after a couple of buffer swaps
5681   application.Render(0);
5682   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5683   application.Render(0);
5684   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5685   END_TEST;
5686 }
5687
5688 int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void)
5689 {
5690   TestApplication application;
5691
5692   Actor actor = Actor::New();
5693
5694   // Register a boolean property
5695   const bool      startValue(false);
5696   Property::Index index = actor.RegisterProperty("testProperty", startValue);
5697   application.GetScene().Add(actor);
5698   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5699   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5700
5701   // Build the animation
5702   float      durationSeconds(2.0f);
5703   Animation  animation = Animation::New(durationSeconds);
5704   const bool targetValue(!startValue);
5705   animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
5706
5707   // Start the animation
5708   animation.Play();
5709
5710   bool                 signalReceived(false);
5711   AnimationFinishCheck finishCheck(signalReceived);
5712   animation.FinishedSignal().Connect(&application, finishCheck);
5713
5714   application.SendNotification();
5715   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5716
5717   // We didn't expect the animation to finish yet
5718   application.SendNotification();
5719   finishCheck.CheckSignalNotReceived();
5720   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5721
5722   application.SendNotification();
5723   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5724
5725   // We did expect the animation to finish
5726   application.SendNotification();
5727   finishCheck.CheckSignalReceived();
5728   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5729
5730   // Check that nothing has changed after a couple of buffer swaps
5731   application.Render(0);
5732   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5733   application.Render(0);
5734   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5735
5736   // Repeat with target value "false"
5737   animation = Animation::New(durationSeconds);
5738   const bool finalValue(!targetValue);
5739   animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
5740
5741   // Start the animation
5742   animation.Play();
5743
5744   finishCheck.Reset();
5745   animation.FinishedSignal().Connect(&application, finishCheck);
5746
5747   application.SendNotification();
5748   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5749
5750   // We didn't expect the animation to finish yet
5751   application.SendNotification();
5752   finishCheck.CheckSignalNotReceived();
5753   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5754
5755   application.SendNotification();
5756   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5757
5758   // We did expect the animation to finish
5759   application.SendNotification();
5760   finishCheck.CheckSignalReceived();
5761   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5762
5763   // Check that nothing has changed after a couple of buffer swaps
5764   application.Render(0);
5765   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5766   application.Render(0);
5767   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5768   END_TEST;
5769 }
5770
5771 int UtcDaliAnimationAnimateToBooleanTimePeriodP(void)
5772 {
5773   TestApplication application;
5774
5775   Actor actor = Actor::New();
5776
5777   // Register a boolean property
5778   bool            startValue(false);
5779   Property::Index index = actor.RegisterProperty("testProperty", startValue);
5780   application.GetScene().Add(actor);
5781   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5782   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5783
5784   // Build the animation
5785   float     durationSeconds(2.0f);
5786   Animation animation = Animation::New(durationSeconds);
5787   bool      finalValue(!startValue);
5788   float     animatorDurationSeconds(durationSeconds * 0.5f);
5789   animation.AnimateTo(Property(actor, index),
5790                       finalValue,
5791                       TimePeriod(animatorDurationSeconds));
5792
5793   // Start the animation
5794   animation.Play();
5795
5796   bool                 signalReceived(false);
5797   AnimationFinishCheck finishCheck(signalReceived);
5798   animation.FinishedSignal().Connect(&application, finishCheck);
5799
5800   application.SendNotification();
5801   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
5802
5803   // We didn't expect the animation to finish yet
5804   application.SendNotification();
5805   finishCheck.CheckSignalNotReceived();
5806   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5807
5808   application.SendNotification();
5809   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
5810
5811   // We didn't expect the animation to finish yet...
5812   application.SendNotification();
5813   finishCheck.CheckSignalNotReceived();
5814
5815   // ...however we should have reached the final value
5816   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5817
5818   application.SendNotification();
5819   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
5820
5821   // We did expect the animation to finish
5822   application.SendNotification();
5823   finishCheck.CheckSignalReceived();
5824   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5825
5826   // Check that nothing has changed after a couple of buffer swaps
5827   application.Render(0);
5828   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5829   application.Render(0);
5830   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5831   END_TEST;
5832 }
5833
5834 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void)
5835 {
5836   TestApplication application;
5837
5838   Actor actor = Actor::New();
5839
5840   // Register a boolean property
5841   bool            startValue(false);
5842   Property::Index index = actor.RegisterProperty("testProperty", startValue);
5843   application.GetScene().Add(actor);
5844   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5845   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5846
5847   // Build the animation
5848   float     durationSeconds(2.0f);
5849   Animation animation = Animation::New(durationSeconds);
5850   bool      finalValue(!startValue);
5851   float     animatorDurationSeconds(durationSeconds * 0.5f);
5852   animation.AnimateTo(Property(actor, index),
5853                       finalValue,
5854                       AlphaFunction::LINEAR,
5855                       TimePeriod(animatorDurationSeconds));
5856
5857   // Start the animation
5858   animation.Play();
5859
5860   bool                 signalReceived(false);
5861   AnimationFinishCheck finishCheck(signalReceived);
5862   animation.FinishedSignal().Connect(&application, finishCheck);
5863
5864   application.SendNotification();
5865   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
5866
5867   // We didn't expect the animation to finish yet
5868   application.SendNotification();
5869   finishCheck.CheckSignalNotReceived();
5870   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5871
5872   application.SendNotification();
5873   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
5874
5875   // We didn't expect the animation to finish yet...
5876   application.SendNotification();
5877   finishCheck.CheckSignalNotReceived();
5878
5879   // ...however we should have reached the final value
5880   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5881
5882   application.SendNotification();
5883   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
5884
5885   // We did expect the animation to finish
5886   application.SendNotification();
5887   finishCheck.CheckSignalReceived();
5888   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5889
5890   // Check that nothing has changed after a couple of buffer swaps
5891   application.Render(0);
5892   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5893   application.Render(0);
5894   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5895   END_TEST;
5896 }
5897
5898 int UtcDaliAnimationAnimateToFloatP(void)
5899 {
5900   TestApplication application;
5901
5902   Actor actor = Actor::New();
5903
5904   // Register a float property
5905   float           startValue(10.0f);
5906   Property::Index index = actor.RegisterProperty("testProperty", startValue);
5907   application.GetScene().Add(actor);
5908   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
5909   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
5910
5911   // Build the animation
5912   float     durationSeconds(2.0f);
5913   Animation animation = Animation::New(durationSeconds);
5914   float     targetValue(50.0f);
5915   float     relativeValue(targetValue - startValue);
5916   animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5917
5918   float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
5919
5920   // Start the animation
5921   animation.Play();
5922
5923   bool                 signalReceived(false);
5924   AnimationFinishCheck finishCheck(signalReceived);
5925   animation.FinishedSignal().Connect(&application, finishCheck);
5926
5927   application.SendNotification();
5928   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5929
5930   // We didn't expect the animation to finish yet
5931   application.SendNotification();
5932   finishCheck.CheckSignalNotReceived();
5933   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION);
5934
5935   application.SendNotification();
5936   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5937
5938   // We did expect the animation to finish
5939   application.SendNotification();
5940   finishCheck.CheckSignalReceived();
5941   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
5942   END_TEST;
5943 }
5944
5945 int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void)
5946 {
5947   TestApplication application;
5948
5949   Actor actor = Actor::New();
5950
5951   // Register a float property
5952   float           startValue(10.0f);
5953   Property::Index index = actor.RegisterProperty("testProperty", startValue);
5954   application.GetScene().Add(actor);
5955   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
5956   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
5957
5958   // Build the animation
5959   float     durationSeconds(1.0f);
5960   Animation animation = Animation::New(durationSeconds);
5961   float     targetValue(90.0f);
5962   float     relativeValue(targetValue - startValue);
5963   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5964
5965   float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
5966
5967   // Start the animation
5968   animation.Play();
5969
5970   bool                 signalReceived(false);
5971   AnimationFinishCheck finishCheck(signalReceived);
5972   animation.FinishedSignal().Connect(&application, finishCheck);
5973
5974   application.SendNotification();
5975   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5976
5977   // We didn't expect the animation to finish yet
5978   application.SendNotification();
5979   finishCheck.CheckSignalNotReceived();
5980
5981   // The position should have moved more, than with a linear alpha function
5982   float current(actor.GetCurrentProperty<float>(index));
5983   DALI_TEST_CHECK(current > ninetyFivePercentProgress);
5984
5985   application.SendNotification();
5986   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5987
5988   // We did expect the animation to finish
5989   application.SendNotification();
5990   finishCheck.CheckSignalReceived();
5991   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
5992   END_TEST;
5993 }
5994
5995 int UtcDaliAnimationAnimateToFloatTimePeriodP(void)
5996 {
5997   TestApplication application;
5998
5999   Actor actor = Actor::New();
6000
6001   // Register a float property
6002   float           startValue(10.0f);
6003   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6004   application.GetScene().Add(actor);
6005   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
6006   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6007
6008   // Build the animation
6009   float     durationSeconds(1.0f);
6010   Animation animation = Animation::New(durationSeconds);
6011   float     targetValue(30.0f);
6012   float     relativeValue(targetValue - startValue);
6013   float     delay = 0.5f;
6014   animation.AnimateTo(Property(actor, index),
6015                       targetValue,
6016                       TimePeriod(delay, durationSeconds - delay));
6017
6018   // Start the animation
6019   animation.Play();
6020
6021   bool                 signalReceived(false);
6022   AnimationFinishCheck finishCheck(signalReceived);
6023   animation.FinishedSignal().Connect(&application, finishCheck);
6024
6025   application.SendNotification();
6026   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6027
6028   // We didn't expect the animation to finish yet
6029   application.SendNotification();
6030   finishCheck.CheckSignalNotReceived();
6031   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6032
6033   application.SendNotification();
6034   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6035
6036   // We didn't expect the animation to finish yet
6037   application.SendNotification();
6038   finishCheck.CheckSignalNotReceived();
6039   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6040
6041   application.SendNotification();
6042   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6043
6044   // We did expect the animation to finish
6045   application.SendNotification();
6046   finishCheck.CheckSignalReceived();
6047   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6048   END_TEST;
6049 }
6050
6051 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void)
6052 {
6053   TestApplication application;
6054
6055   Actor actor = Actor::New();
6056
6057   // Register a float property
6058   float           startValue(10.0f);
6059   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6060   application.GetScene().Add(actor);
6061   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
6062   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6063
6064   // Build the animation
6065   float     durationSeconds(1.0f);
6066   Animation animation = Animation::New(durationSeconds);
6067   float     targetValue(30.0f);
6068   float     relativeValue(targetValue - startValue);
6069   float     delay = 0.5f;
6070   animation.AnimateTo(Property(actor, index),
6071                       targetValue,
6072                       AlphaFunction::LINEAR,
6073                       TimePeriod(delay, durationSeconds - delay));
6074
6075   // Start the animation
6076   animation.Play();
6077
6078   bool                 signalReceived(false);
6079   AnimationFinishCheck finishCheck(signalReceived);
6080   animation.FinishedSignal().Connect(&application, finishCheck);
6081
6082   application.SendNotification();
6083   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6084
6085   // We didn't expect the animation to finish yet
6086   application.SendNotification();
6087   finishCheck.CheckSignalNotReceived();
6088   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6089
6090   application.SendNotification();
6091   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6092
6093   // We didn't expect the animation to finish yet
6094   application.SendNotification();
6095   finishCheck.CheckSignalNotReceived();
6096   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6097
6098   application.SendNotification();
6099   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6100
6101   // We did expect the animation to finish
6102   application.SendNotification();
6103   finishCheck.CheckSignalReceived();
6104   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6105   END_TEST;
6106 }
6107
6108 int UtcDaliAnimationAnimateToIntegerP(void)
6109 {
6110   TestApplication application;
6111
6112   Actor actor = Actor::New();
6113
6114   // Register an integer property
6115   int             startValue(10);
6116   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6117   application.GetScene().Add(actor);
6118   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6119   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6120
6121   // Build the animation
6122   float     durationSeconds(2.0f);
6123   Animation animation = Animation::New(durationSeconds);
6124   int       targetValue(50);
6125   int       relativeValue(targetValue - startValue);
6126   animation.AnimateTo(Property(actor, "testProperty"), targetValue);
6127
6128   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
6129
6130   // Start the animation
6131   animation.Play();
6132
6133   bool                 signalReceived(false);
6134   AnimationFinishCheck finishCheck(signalReceived);
6135   animation.FinishedSignal().Connect(&application, finishCheck);
6136
6137   application.SendNotification();
6138   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6139
6140   // We didn't expect the animation to finish yet
6141   application.SendNotification();
6142   finishCheck.CheckSignalNotReceived();
6143   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION);
6144
6145   application.SendNotification();
6146   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6147
6148   // We did expect the animation to finish
6149   application.SendNotification();
6150   finishCheck.CheckSignalReceived();
6151   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6152   END_TEST;
6153 }
6154
6155 int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void)
6156 {
6157   TestApplication application;
6158
6159   Actor actor = Actor::New();
6160
6161   // Register an integer property
6162   int             startValue(10);
6163   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6164   application.GetScene().Add(actor);
6165   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6166   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6167
6168   // Build the animation
6169   float     durationSeconds(1.0f);
6170   Animation animation = Animation::New(durationSeconds);
6171   int       targetValue(90);
6172   int       relativeValue(targetValue - startValue);
6173   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6174
6175   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
6176
6177   // Start the animation
6178   animation.Play();
6179
6180   bool                 signalReceived(false);
6181   AnimationFinishCheck finishCheck(signalReceived);
6182   animation.FinishedSignal().Connect(&application, finishCheck);
6183
6184   application.SendNotification();
6185   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6186
6187   // We didn't expect the animation to finish yet
6188   application.SendNotification();
6189   finishCheck.CheckSignalNotReceived();
6190
6191   // The position should have moved more, than with a linear alpha function
6192   int current(actor.GetCurrentProperty<int>(index));
6193   DALI_TEST_CHECK(current > ninetyFivePercentProgress);
6194
6195   application.SendNotification();
6196   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6197
6198   // We did expect the animation to finish
6199   application.SendNotification();
6200   finishCheck.CheckSignalReceived();
6201   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6202   END_TEST;
6203 }
6204
6205 int UtcDaliAnimationAnimateToIntegerTimePeriodP(void)
6206 {
6207   TestApplication application;
6208
6209   Actor actor = Actor::New();
6210
6211   // Register an integer property
6212   int             startValue(10);
6213   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6214   application.GetScene().Add(actor);
6215   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6216   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6217
6218   // Build the animation
6219   float     durationSeconds(1.0f);
6220   Animation animation = Animation::New(durationSeconds);
6221   int       targetValue(30);
6222   int       relativeValue(targetValue - startValue);
6223   float     delay = 0.5f;
6224   animation.AnimateTo(Property(actor, index),
6225                       targetValue,
6226                       TimePeriod(delay, durationSeconds - delay));
6227
6228   // Start the animation
6229   animation.Play();
6230
6231   bool                 signalReceived(false);
6232   AnimationFinishCheck finishCheck(signalReceived);
6233   animation.FinishedSignal().Connect(&application, finishCheck);
6234
6235   application.SendNotification();
6236   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6237
6238   // We didn't expect the animation to finish yet
6239   application.SendNotification();
6240   finishCheck.CheckSignalNotReceived();
6241   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6242
6243   application.SendNotification();
6244   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6245
6246   // We didn't expect the animation to finish yet
6247   application.SendNotification();
6248   finishCheck.CheckSignalNotReceived();
6249   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
6250
6251   application.SendNotification();
6252   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6253
6254   // We did expect the animation to finish
6255   application.SendNotification();
6256   finishCheck.CheckSignalReceived();
6257   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6258   END_TEST;
6259 }
6260
6261 int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void)
6262 {
6263   TestApplication application;
6264
6265   Actor actor = Actor::New();
6266
6267   // Register an integer property
6268   int             startValue(10);
6269   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6270   application.GetScene().Add(actor);
6271   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6272   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6273
6274   // Build the animation
6275   float     durationSeconds(1.0f);
6276   Animation animation = Animation::New(durationSeconds);
6277   int       targetValue(30);
6278   int       relativeValue(targetValue - startValue);
6279   float     delay = 0.5f;
6280   animation.AnimateTo(Property(actor, index),
6281                       targetValue,
6282                       AlphaFunction::LINEAR,
6283                       TimePeriod(delay, durationSeconds - delay));
6284
6285   // Start the animation
6286   animation.Play();
6287
6288   bool                 signalReceived(false);
6289   AnimationFinishCheck finishCheck(signalReceived);
6290   animation.FinishedSignal().Connect(&application, finishCheck);
6291
6292   application.SendNotification();
6293   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6294
6295   // We didn't expect the animation to finish yet
6296   application.SendNotification();
6297   finishCheck.CheckSignalNotReceived();
6298   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6299
6300   application.SendNotification();
6301   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6302
6303   // We didn't expect the animation to finish yet
6304   application.SendNotification();
6305   finishCheck.CheckSignalNotReceived();
6306   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
6307
6308   application.SendNotification();
6309   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6310
6311   // We did expect the animation to finish
6312   application.SendNotification();
6313   finishCheck.CheckSignalReceived();
6314   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6315   END_TEST;
6316 }
6317
6318 int UtcDaliAnimationAnimateToVector2P(void)
6319 {
6320   TestApplication application;
6321
6322   Actor actor = Actor::New();
6323
6324   // Register a Vector2 property
6325   Vector2         startValue(-50.0f, -50.0f);
6326   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6327   application.GetScene().Add(actor);
6328   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6329   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6330
6331   // Build the animation
6332   float     durationSeconds(2.0f);
6333   Animation animation = Animation::New(durationSeconds);
6334   Vector2   targetValue(50.0f, 50.0f);
6335   Vector2   relativeValue(targetValue - startValue);
6336   animation.AnimateTo(Property(actor, index), targetValue);
6337
6338   Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6339
6340   // Start the animation
6341   animation.Play();
6342
6343   bool                 signalReceived(false);
6344   AnimationFinishCheck finishCheck(signalReceived);
6345   animation.FinishedSignal().Connect(&application, finishCheck);
6346
6347   application.SendNotification();
6348   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6349
6350   // We didn't expect the animation to finish yet
6351   application.SendNotification();
6352   finishCheck.CheckSignalNotReceived();
6353   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION);
6354
6355   application.SendNotification();
6356   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6357
6358   // We did expect the animation to finish
6359   application.SendNotification();
6360   finishCheck.CheckSignalReceived();
6361   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6362   END_TEST;
6363 }
6364
6365 int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void)
6366 {
6367   TestApplication application;
6368
6369   Actor actor = Actor::New();
6370
6371   // Register a Vector2 property
6372   Vector2         startValue(1000.0f, 1000.0f);
6373   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6374   application.GetScene().Add(actor);
6375   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6376   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6377
6378   // Build the animation
6379   float     durationSeconds(1.0f);
6380   Animation animation = Animation::New(durationSeconds);
6381   Vector2   targetValue(9000.0f, 9000.0f);
6382   Vector2   relativeValue(targetValue - startValue);
6383   animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
6384
6385   Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6386
6387   // Start the animation
6388   animation.Play();
6389
6390   bool                 signalReceived(false);
6391   AnimationFinishCheck finishCheck(signalReceived);
6392   animation.FinishedSignal().Connect(&application, finishCheck);
6393
6394   application.SendNotification();
6395   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6396
6397   // We didn't expect the animation to finish yet
6398   application.SendNotification();
6399   finishCheck.CheckSignalNotReceived();
6400
6401   // The position should have moved more, than with a linear alpha function
6402   Vector2 current(actor.GetCurrentProperty<Vector2>(index));
6403   DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
6404   DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
6405
6406   application.SendNotification();
6407   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6408
6409   // We did expect the animation to finish
6410   application.SendNotification();
6411   finishCheck.CheckSignalReceived();
6412   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6413   END_TEST;
6414 }
6415
6416 int UtcDaliAnimationAnimateToVector2TimePeriodP(void)
6417 {
6418   TestApplication application;
6419
6420   Actor actor = Actor::New();
6421
6422   // Register a Vector2 property
6423   Vector2         startValue(10.0f, 10.0f);
6424   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6425   application.GetScene().Add(actor);
6426   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6427   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6428
6429   // Build the animation
6430   float     durationSeconds(1.0f);
6431   Animation animation = Animation::New(durationSeconds);
6432   Vector2   targetValue(-10.0f, 20.0f);
6433   Vector2   relativeValue(targetValue - startValue);
6434   float     delay = 0.5f;
6435   animation.AnimateTo(Property(actor, index),
6436                       targetValue,
6437                       TimePeriod(delay, durationSeconds - delay));
6438
6439   // Start the animation
6440   animation.Play();
6441
6442   bool                 signalReceived(false);
6443   AnimationFinishCheck finishCheck(signalReceived);
6444   animation.FinishedSignal().Connect(&application, finishCheck);
6445
6446   application.SendNotification();
6447   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6448
6449   // We didn't expect the animation to finish yet
6450   application.SendNotification();
6451   finishCheck.CheckSignalNotReceived();
6452   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6453
6454   application.SendNotification();
6455   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6456
6457   // We didn't expect the animation to finish yet
6458   application.SendNotification();
6459   finishCheck.CheckSignalNotReceived();
6460   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6461
6462   application.SendNotification();
6463   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6464
6465   // We did expect the animation to finish
6466   application.SendNotification();
6467   finishCheck.CheckSignalReceived();
6468   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6469   END_TEST;
6470 }
6471
6472 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void)
6473 {
6474   TestApplication application;
6475
6476   Actor actor = Actor::New();
6477
6478   // Register a Vector2 property
6479   Vector2         startValue(10.0f, 10.0f);
6480   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6481   application.GetScene().Add(actor);
6482   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6483   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6484
6485   // Build the animation
6486   float     durationSeconds(1.0f);
6487   Animation animation = Animation::New(durationSeconds);
6488   Vector2   targetValue(30.0f, 30.0f);
6489   Vector2   relativeValue(targetValue - startValue);
6490   float     delay = 0.5f;
6491   animation.AnimateTo(Property(actor, index),
6492                       targetValue,
6493                       AlphaFunction::LINEAR,
6494                       TimePeriod(delay, durationSeconds - delay));
6495
6496   // Start the animation
6497   animation.Play();
6498
6499   bool                 signalReceived(false);
6500   AnimationFinishCheck finishCheck(signalReceived);
6501   animation.FinishedSignal().Connect(&application, finishCheck);
6502
6503   application.SendNotification();
6504   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6505
6506   // We didn't expect the animation to finish yet, but cached value should be the final one
6507   application.SendNotification();
6508   finishCheck.CheckSignalNotReceived();
6509   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION);
6510   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6511
6512   application.SendNotification();
6513   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6514
6515   // We didn't expect the animation to finish yet
6516   application.SendNotification();
6517   finishCheck.CheckSignalNotReceived();
6518   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6519
6520   application.SendNotification();
6521   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6522
6523   // We did expect the animation to finish
6524   application.SendNotification();
6525   finishCheck.CheckSignalReceived();
6526   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6527   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION);
6528   END_TEST;
6529 }
6530
6531 int UtcDaliAnimationAnimateToVector3P(void)
6532 {
6533   TestApplication application;
6534
6535   Actor actor = Actor::New();
6536
6537   // Register a Vector3 property
6538   Vector3         startValue(-50.0f, -50.0f, -50.0f);
6539   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6540   application.GetScene().Add(actor);
6541   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6542   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6543
6544   // Build the animation
6545   float     durationSeconds(2.0f);
6546   Animation animation = Animation::New(durationSeconds);
6547   Vector3   targetValue(50.0f, 50.0f, 50.0f);
6548   Vector3   relativeValue(targetValue - startValue);
6549   animation.AnimateTo(Property(actor, index), targetValue);
6550
6551   Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6552
6553   // Start the animation
6554   animation.Play();
6555
6556   bool                 signalReceived(false);
6557   AnimationFinishCheck finishCheck(signalReceived);
6558   animation.FinishedSignal().Connect(&application, finishCheck);
6559
6560   application.SendNotification();
6561   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6562
6563   // We didn't expect the animation to finish yet
6564   application.SendNotification();
6565   finishCheck.CheckSignalNotReceived();
6566   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION);
6567
6568   application.SendNotification();
6569   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6570
6571   // We did expect the animation to finish
6572   application.SendNotification();
6573   finishCheck.CheckSignalReceived();
6574   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6575   END_TEST;
6576 }
6577
6578 int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void)
6579 {
6580   TestApplication application;
6581
6582   Actor actor = Actor::New();
6583
6584   // Register a Vector3 property
6585   Vector3         startValue(1000.0f, 1000.0f, 1000.0f);
6586   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6587   application.GetScene().Add(actor);
6588   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6589   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6590
6591   // Build the animation
6592   float     durationSeconds(1.0f);
6593   Animation animation = Animation::New(durationSeconds);
6594   Vector3   targetValue(9000.0f, 9000.0f, 9000.0f);
6595   Vector3   relativeValue(targetValue - startValue);
6596   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6597
6598   Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6599
6600   // Start the animation
6601   animation.Play();
6602
6603   bool                 signalReceived(false);
6604   AnimationFinishCheck finishCheck(signalReceived);
6605   animation.FinishedSignal().Connect(&application, finishCheck);
6606
6607   application.SendNotification();
6608   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6609
6610   // We didn't expect the animation to finish yet
6611   application.SendNotification();
6612   finishCheck.CheckSignalNotReceived();
6613
6614   // The position should have moved more, than with a linear alpha function
6615   Vector3 current(actor.GetCurrentProperty<Vector3>(index));
6616   DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
6617   DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
6618   DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z);
6619
6620   application.SendNotification();
6621   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6622
6623   // We did expect the animation to finish
6624   application.SendNotification();
6625   finishCheck.CheckSignalReceived();
6626   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6627   END_TEST;
6628 }
6629
6630 int UtcDaliAnimationAnimateToVector3TimePeriodP(void)
6631 {
6632   TestApplication application;
6633
6634   Actor actor = Actor::New();
6635
6636   // Register a Vector3 property
6637   Vector3         startValue(10.0f, 10.0f, 10.0f);
6638   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6639   application.GetScene().Add(actor);
6640   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6641   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6642
6643   // Build the animation
6644   float     durationSeconds(1.0f);
6645   Animation animation = Animation::New(durationSeconds);
6646   Vector3   targetValue(-10.0f, 20.0f, 100.0f);
6647   Vector3   relativeValue(targetValue - startValue);
6648   float     delay = 0.5f;
6649   animation.AnimateTo(Property(actor, index),
6650                       targetValue,
6651                       TimePeriod(delay, durationSeconds - delay));
6652
6653   // Start the animation
6654   animation.Play();
6655
6656   bool                 signalReceived(false);
6657   AnimationFinishCheck finishCheck(signalReceived);
6658   animation.FinishedSignal().Connect(&application, finishCheck);
6659
6660   application.SendNotification();
6661   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6662
6663   // We didn't expect the animation to finish yet
6664   application.SendNotification();
6665   finishCheck.CheckSignalNotReceived();
6666   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6667
6668   application.SendNotification();
6669   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6670
6671   // We didn't expect the animation to finish yet
6672   application.SendNotification();
6673   finishCheck.CheckSignalNotReceived();
6674   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6675
6676   application.SendNotification();
6677   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6678
6679   // We did expect the animation to finish
6680   application.SendNotification();
6681   finishCheck.CheckSignalReceived();
6682   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6683   END_TEST;
6684 }
6685
6686 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void)
6687 {
6688   TestApplication application;
6689
6690   Actor actor = Actor::New();
6691
6692   // Register a Vector3 property
6693   Vector3         startValue(10.0f, 10.0f, 10.0f);
6694   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6695   application.GetScene().Add(actor);
6696   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6697   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6698
6699   // Build the animation
6700   float     durationSeconds(1.0f);
6701   Animation animation = Animation::New(durationSeconds);
6702   Vector3   targetValue(30.0f, 30.0f, 30.0f);
6703   Vector3   relativeValue(targetValue - startValue);
6704   float     delay = 0.5f;
6705   animation.AnimateTo(Property(actor, "testProperty"),
6706                       targetValue,
6707                       AlphaFunction::LINEAR,
6708                       TimePeriod(delay, durationSeconds - delay));
6709
6710   // Start the animation
6711   animation.Play();
6712
6713   bool                 signalReceived(false);
6714   AnimationFinishCheck finishCheck(signalReceived);
6715   animation.FinishedSignal().Connect(&application, finishCheck);
6716
6717   application.SendNotification();
6718   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6719
6720   // We didn't expect the animation to finish yet
6721   application.SendNotification();
6722   finishCheck.CheckSignalNotReceived();
6723   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6724
6725   application.SendNotification();
6726   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6727
6728   // We didn't expect the animation to finish yet
6729   application.SendNotification();
6730   finishCheck.CheckSignalNotReceived();
6731   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6732
6733   application.SendNotification();
6734   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6735
6736   // We did expect the animation to finish
6737   application.SendNotification();
6738   finishCheck.CheckSignalReceived();
6739   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6740   END_TEST;
6741 }
6742
6743 int UtcDaliAnimationAnimateToVector3ComponentP(void)
6744 {
6745   TestApplication application;
6746
6747   Actor actor = Actor::New();
6748
6749   // Register a Vector3 property
6750   Vector3         startValue(10.0f, 10.0f, 10.0f);
6751   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6752   application.GetScene().Add(actor);
6753   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6754   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6755
6756   // Build the animation
6757   float     durationSeconds(1.0f);
6758   Animation animation = Animation::New(durationSeconds);
6759   Vector3   targetValue(30.0f, 30.0f, 10.0f);
6760   Vector3   relativeValue(targetValue - startValue);
6761   float     delay = 0.5f;
6762   animation.AnimateTo(Property(actor, "testProperty", 0),
6763                       30.0f,
6764                       AlphaFunction::LINEAR,
6765                       TimePeriod(delay, durationSeconds - delay));
6766   animation.AnimateTo(Property(actor, index, 1),
6767                       30.0f,
6768                       AlphaFunction::LINEAR,
6769                       TimePeriod(delay, durationSeconds - delay));
6770
6771   // Start the animation
6772   animation.Play();
6773
6774   bool                 signalReceived(false);
6775   AnimationFinishCheck finishCheck(signalReceived);
6776   animation.FinishedSignal().Connect(&application, finishCheck);
6777
6778   application.SendNotification();
6779   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6780
6781   // We didn't expect the animation to finish yet
6782   application.SendNotification();
6783   finishCheck.CheckSignalNotReceived();
6784   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6785
6786   application.SendNotification();
6787   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6788
6789   // We didn't expect the animation to finish yet
6790   application.SendNotification();
6791   finishCheck.CheckSignalNotReceived();
6792   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6793
6794   application.SendNotification();
6795   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6796
6797   // We did expect the animation to finish
6798   application.SendNotification();
6799   finishCheck.CheckSignalReceived();
6800   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6801   END_TEST;
6802 }
6803
6804 int UtcDaliAnimationAnimateToVector4P(void)
6805 {
6806   TestApplication application;
6807
6808   Actor actor = Actor::New();
6809
6810   // Register a Vector4 property
6811   Vector4         startValue(-50.0f, -40.0f, -30.0f, -20.0f);
6812   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6813   application.GetScene().Add(actor);
6814   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
6815   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
6816
6817   // Build the animation
6818   float     durationSeconds(2.0f);
6819   Animation animation = Animation::New(durationSeconds);
6820   Vector4   targetValue(50.0f, 50.0f, 50.0f, 50.0f);
6821   Vector4   relativeValue(targetValue - startValue);
6822   animation.AnimateTo(Property(actor, index), targetValue);
6823
6824   Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6825
6826   // Start the animation
6827   animation.Play();
6828
6829   bool                 signalReceived(false);
6830   AnimationFinishCheck finishCheck(signalReceived);
6831   animation.FinishedSignal().Connect(&application, finishCheck);
6832
6833   application.SendNotification();
6834   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6835
6836   // We didn't expect the animation to finish yet
6837   application.SendNotification();
6838   finishCheck.CheckSignalNotReceived();
6839   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION);
6840
6841   application.SendNotification();
6842   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6843
6844   // We did expect the animation to finish
6845   application.SendNotification();
6846   finishCheck.CheckSignalReceived();
6847   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
6848   END_TEST;
6849 }
6850
6851 int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void)
6852 {
6853   TestApplication application;
6854
6855   Actor actor = Actor::New();
6856
6857   // Register a Vector4 property
6858   Vector4         startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
6859   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6860   application.GetScene().Add(actor);
6861   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
6862   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
6863
6864   // Build the animation
6865   float     durationSeconds(1.0f);
6866   Animation animation = Animation::New(durationSeconds);
6867   Vector4   targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
6868   Vector4   relativeValue(targetValue - startValue);
6869   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6870
6871   Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6872
6873   // Start the animation
6874   animation.Play();
6875
6876   bool                 signalReceived(false);
6877   AnimationFinishCheck finishCheck(signalReceived);
6878   animation.FinishedSignal().Connect(&application, finishCheck);
6879
6880   application.SendNotification();
6881   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6882
6883   // We didn't expect the animation to finish yet
6884   application.SendNotification();
6885   finishCheck.CheckSignalNotReceived();
6886
6887   // The position should have moved more, than with a linear alpha function
6888   Vector4 current(actor.GetCurrentProperty<Vector4>(index));
6889   DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
6890   DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
6891   DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z);
6892   DALI_TEST_CHECK(current.w > ninetyFivePercentProgress.w);
6893
6894   application.SendNotification();
6895   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6896
6897   // We did expect the animation to finish
6898   application.SendNotification();
6899   finishCheck.CheckSignalReceived();
6900   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
6901   END_TEST;
6902 }
6903
6904 int UtcDaliAnimationAnimateToVector4TimePeriodP(void)
6905 {
6906   TestApplication application;
6907
6908   Actor actor = Actor::New();
6909
6910   // Register a Vector4 property
6911   Vector4         startValue(10.0f, 10.0f, 10.0f, 10.0f);
6912   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6913   application.GetScene().Add(actor);
6914   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
6915   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION);
6916
6917   // Build the animation
6918   float     durationSeconds(1.0f);
6919   Animation animation = Animation::New(durationSeconds);
6920   Vector4   targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
6921   Vector4   relativeValue(targetValue - startValue);
6922   float     delay = 0.5f;
6923   animation.AnimateTo(Property(actor, index),
6924                       targetValue,
6925                       TimePeriod(delay, durationSeconds - delay));
6926
6927   // Start the animation
6928   animation.Play();
6929
6930   bool                 signalReceived(false);
6931   AnimationFinishCheck finishCheck(signalReceived);
6932   animation.FinishedSignal().Connect(&application, finishCheck);
6933
6934   application.SendNotification();
6935   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6936
6937   // We didn't expect the animation to finish yet
6938   application.SendNotification();
6939   finishCheck.CheckSignalNotReceived();
6940   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION);
6941
6942   application.SendNotification();
6943   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6944
6945   // We didn't expect the animation to finish yet
6946   application.SendNotification();
6947   finishCheck.CheckSignalNotReceived();
6948   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), VECTOR4_EPSILON, TEST_LOCATION);
6949
6950   application.SendNotification();
6951   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6952
6953   // We did expect the animation to finish
6954   application.SendNotification();
6955   finishCheck.CheckSignalReceived();
6956   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, VECTOR4_EPSILON, TEST_LOCATION);
6957   END_TEST;
6958 }
6959
6960 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void)
6961 {
6962   TestApplication application;
6963
6964   Actor actor = Actor::New();
6965
6966   // Register a Vector4 property
6967   Vector4         startValue(10.0f, 10.0f, 10.0f, 10.0f);
6968   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6969   application.GetScene().Add(actor);
6970   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
6971   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
6972
6973   // Build the animation
6974   float     durationSeconds(1.0f);
6975   Animation animation = Animation::New(durationSeconds);
6976   Vector4   targetValue(30.0f, 30.0f, 30.0f, 30.0f);
6977   Vector4   relativeValue(targetValue - startValue);
6978   float     delay = 0.5f;
6979   animation.AnimateTo(Property(actor, index),
6980                       targetValue,
6981                       AlphaFunction::LINEAR,
6982                       TimePeriod(delay, durationSeconds - delay));
6983
6984   // Start the animation
6985   animation.Play();
6986
6987   bool                 signalReceived(false);
6988   AnimationFinishCheck finishCheck(signalReceived);
6989   animation.FinishedSignal().Connect(&application, finishCheck);
6990
6991   application.SendNotification();
6992   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6993
6994   // We didn't expect the animation to finish yet
6995   application.SendNotification();
6996   finishCheck.CheckSignalNotReceived();
6997   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
6998
6999   application.SendNotification();
7000   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
7001
7002   // We didn't expect the animation to finish yet
7003   application.SendNotification();
7004   finishCheck.CheckSignalNotReceived();
7005   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
7006
7007   application.SendNotification();
7008   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7009
7010   // We did expect the animation to finish
7011   application.SendNotification();
7012   finishCheck.CheckSignalReceived();
7013   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
7014   END_TEST;
7015 }
7016
7017 int UtcDaliAnimationAnimateToActorParentOriginP(void)
7018 {
7019   TestApplication application;
7020
7021   Actor actor = Actor::New();
7022   application.GetScene().Add(actor);
7023   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_LEFT, TEST_LOCATION);
7024
7025   // Build the animation
7026   float     durationSeconds(1.0f);
7027   Animation animation = Animation::New(durationSeconds);
7028   Vector3   targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
7029
7030   DALI_TEST_ASSERTION(
7031     {
7032       animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin);
7033     },
7034     "Property is not animatable");
7035
7036   END_TEST;
7037 }
7038
7039 int UtcDaliAnimationAnimateToActorParentOriginXN(void)
7040 {
7041   TestApplication application;
7042
7043   Actor actor = Actor::New();
7044   application.GetScene().Add(actor);
7045   float startValue(0.0f);
7046   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).x, startValue, TEST_LOCATION);
7047   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION);
7048
7049   // Build the animation
7050   float     durationSeconds(1.0f);
7051   Animation animation = Animation::New(durationSeconds);
7052   float     targetX(1.0f);
7053
7054   DALI_TEST_ASSERTION(
7055     {
7056       animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX);
7057     },
7058     "Property is not animatable");
7059
7060   END_TEST;
7061 }
7062
7063 int UtcDaliAnimationAnimateToActorParentOriginYN(void)
7064 {
7065   TestApplication application;
7066
7067   Actor actor = Actor::New();
7068   application.GetScene().Add(actor);
7069   float startValue(0.0f);
7070   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).y, startValue, TEST_LOCATION);
7071   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION);
7072
7073   // Build the animation
7074   float     durationSeconds(1.0f);
7075   Animation animation = Animation::New(durationSeconds);
7076   float     targetY(1.0f);
7077
7078   DALI_TEST_ASSERTION(
7079     {
7080       animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY);
7081     },
7082     "Property is not animatable");
7083
7084   END_TEST;
7085 }
7086
7087 int UtcDaliAnimationAnimateToActorParentOriginZN(void)
7088 {
7089   TestApplication application;
7090
7091   Actor actor = Actor::New();
7092   application.GetScene().Add(actor);
7093   float startValue(0.5f);
7094   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).z, startValue, TEST_LOCATION);
7095   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION);
7096
7097   // Build the animation
7098   float     durationSeconds(1.0f);
7099   Animation animation = Animation::New(durationSeconds);
7100   float     targetZ(1.0f);
7101
7102   DALI_TEST_ASSERTION(
7103     {
7104       animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ);
7105     },
7106     "Property is not animatable");
7107
7108   END_TEST;
7109 }
7110
7111 int UtcDaliAnimationAnimateToActorAnchorPointN(void)
7112 {
7113   TestApplication application;
7114
7115   Actor actor = Actor::New();
7116   application.GetScene().Add(actor);
7117   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), AnchorPoint::CENTER, TEST_LOCATION);
7118
7119   // Build the animation
7120   float     durationSeconds(1.0f);
7121   Animation animation = Animation::New(durationSeconds);
7122   Vector3   targetAnchorPoint(AnchorPoint::TOP_LEFT);
7123
7124   DALI_TEST_ASSERTION(
7125     {
7126       animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
7127     },
7128     "Property is not animatable");
7129
7130   END_TEST;
7131 }
7132
7133 int UtcDaliAnimationAnimateToActorAnchorPointXN(void)
7134 {
7135   TestApplication application;
7136
7137   Actor actor = Actor::New();
7138   application.GetScene().Add(actor);
7139   float startValue(0.5f);
7140   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).x, startValue, TEST_LOCATION);
7141   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION);
7142
7143   // Build the animation
7144   float     durationSeconds(1.0f);
7145   Animation animation = Animation::New(durationSeconds);
7146   float     targetX(1.0f);
7147
7148   DALI_TEST_ASSERTION(
7149     {
7150       animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_X), targetX);
7151     },
7152     "Property is not animatable");
7153
7154   END_TEST;
7155 }
7156
7157 int UtcDaliAnimationAnimateToActorAnchorPointYN(void)
7158 {
7159   TestApplication application;
7160
7161   Actor actor = Actor::New();
7162   application.GetScene().Add(actor);
7163   float startValue(0.5f);
7164   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).y, startValue, TEST_LOCATION);
7165   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION);
7166
7167   // Build the animation
7168   float     durationSeconds(1.0f);
7169   Animation animation = Animation::New(durationSeconds);
7170   float     targetY(0.0f);
7171
7172   DALI_TEST_ASSERTION(
7173     {
7174       animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY);
7175     },
7176     "Property is not animatable");
7177
7178   END_TEST;
7179 }
7180
7181 int UtcDaliAnimationAnimateToActorAnchorPointZN(void)
7182 {
7183   TestApplication application;
7184
7185   Actor actor = Actor::New();
7186   application.GetScene().Add(actor);
7187   float startValue(0.5f);
7188   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).z, startValue, TEST_LOCATION);
7189   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION);
7190
7191   // Build the animation
7192   float     durationSeconds(1.0f);
7193   Animation animation = Animation::New(durationSeconds);
7194   float     targetZ(100.0f);
7195
7196   DALI_TEST_ASSERTION(
7197     {
7198       animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ);
7199     },
7200     "Property is not animatable");
7201
7202   END_TEST;
7203 }
7204
7205 int UtcDaliAnimationAnimateToActorSizeP(void)
7206 {
7207   TestApplication application;
7208
7209   Actor actor = Actor::New();
7210   application.GetScene().Add(actor);
7211   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7212
7213   // Build the animation
7214   float     durationSeconds(1.0f);
7215   Animation animation = Animation::New(durationSeconds);
7216   Vector3   targetSize(100.0f, 100.0f, 100.0f);
7217   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize);
7218
7219   Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7220
7221   // Should return the initial properties before play
7222   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7223   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), 0.0f, TEST_LOCATION);
7224   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), 0.0f, TEST_LOCATION);
7225   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), 0.0f, TEST_LOCATION);
7226
7227   // Start the animation
7228   animation.Play();
7229
7230   // Should return the target property after play
7231   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7232   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION);
7233   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION);
7234   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION);
7235
7236   bool                 signalReceived(false);
7237   AnimationFinishCheck finishCheck(signalReceived);
7238   animation.FinishedSignal().Connect(&application, finishCheck);
7239
7240   application.SendNotification();
7241   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7242
7243   // We didn't expect the animation to finish yet
7244   application.SendNotification();
7245   finishCheck.CheckSignalNotReceived();
7246   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), ninetyNinePercentProgress, TEST_LOCATION);
7247
7248   application.SendNotification();
7249   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7250
7251   // We did expect the animation to finish
7252   application.SendNotification();
7253   finishCheck.CheckSignalReceived();
7254   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7255
7256   // Reset everything
7257   finishCheck.Reset();
7258   actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7259   application.SendNotification();
7260   application.Render(0);
7261   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7262
7263   // Repeat with a different (ease-in) alpha function
7264   animation = Animation::New(durationSeconds);
7265   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
7266   animation.FinishedSignal().Connect(&application, finishCheck);
7267   animation.Play();
7268
7269   application.SendNotification();
7270   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7271
7272   // We didn't expect the animation to finish yet
7273   application.SendNotification();
7274   finishCheck.CheckSignalNotReceived();
7275
7276   // The size should have travelled less, than with a linear alpha function
7277   Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
7278   DALI_TEST_CHECK(current.x > 0.0f);
7279   DALI_TEST_CHECK(current.y > 0.0f);
7280   DALI_TEST_CHECK(current.z > 0.0f);
7281   DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
7282   DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
7283   DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z);
7284
7285   application.SendNotification();
7286   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7287
7288   // We did expect the animation to finish
7289   application.SendNotification();
7290   finishCheck.CheckSignalReceived();
7291   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7292
7293   // Reset everything
7294   finishCheck.Reset();
7295   actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7296   application.SendNotification();
7297   application.Render(0);
7298   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7299
7300   // Repeat with a delay
7301   float delay = 0.5f;
7302   animation   = Animation::New(durationSeconds);
7303   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7304   animation.FinishedSignal().Connect(&application, finishCheck);
7305   animation.Play();
7306
7307   application.SendNotification();
7308   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7309
7310   // We didn't expect the animation to finish yet
7311   application.SendNotification();
7312   finishCheck.CheckSignalNotReceived();
7313   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7314
7315   application.SendNotification();
7316   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7317
7318   // We did expect the animation to finish
7319   application.SendNotification();
7320   finishCheck.CheckSignalReceived();
7321   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7322   END_TEST;
7323 }
7324
7325 int UtcDaliAnimationAnimateToActorSizeWidthP(void)
7326 {
7327   TestApplication application;
7328
7329   Actor actor = Actor::New();
7330   application.GetScene().Add(actor);
7331   float startValue(0.0f);
7332   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, startValue, TEST_LOCATION);
7333   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION);
7334
7335   // Build the animation
7336   float     durationSeconds(1.0f);
7337   Animation animation = Animation::New(durationSeconds);
7338   float     targetWidth(10.0f);
7339   animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetWidth);
7340
7341   float fiftyPercentProgress(startValue + (targetWidth - startValue) * 0.5f);
7342
7343   // Should return the initial properties before play
7344   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7345   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION);
7346
7347   // Start the animation
7348   animation.Play();
7349
7350   // Should return the target property after play
7351   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(targetWidth, 0.0f, 0.0f), TEST_LOCATION);
7352   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION);
7353
7354   bool                 signalReceived(false);
7355   AnimationFinishCheck finishCheck(signalReceived);
7356   animation.FinishedSignal().Connect(&application, finishCheck);
7357
7358   application.SendNotification();
7359   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7360
7361   // We didn't expect the animation to finish yet
7362   application.SendNotification();
7363   finishCheck.CheckSignalNotReceived();
7364   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, fiftyPercentProgress, TEST_LOCATION);
7365
7366   application.SendNotification();
7367   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7368
7369   // We did expect the animation to finish
7370   application.SendNotification();
7371   finishCheck.CheckSignalReceived();
7372   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, targetWidth, TEST_LOCATION);
7373   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION);
7374   END_TEST;
7375 }
7376
7377 int UtcDaliAnimationAnimateToActorSizeHeightP(void)
7378 {
7379   TestApplication application;
7380
7381   Actor actor = Actor::New();
7382   application.GetScene().Add(actor);
7383   float startValue(0.0f);
7384   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, startValue, TEST_LOCATION);
7385   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION);
7386
7387   // Build the animation
7388   float     durationSeconds(1.0f);
7389   Animation animation = Animation::New(durationSeconds);
7390   float     targetHeight(-10.0f);
7391   animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight);
7392
7393   float fiftyPercentProgress(startValue + (targetHeight - startValue) * 0.5f);
7394
7395   // Should return the initial properties before play
7396   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7397   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION);
7398
7399   // Start the animation
7400   animation.Play();
7401
7402   // Should return the target property after play
7403   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(0.0f, targetHeight, 0.0f), TEST_LOCATION);
7404   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION);
7405
7406   bool                 signalReceived(false);
7407   AnimationFinishCheck finishCheck(signalReceived);
7408   animation.FinishedSignal().Connect(&application, finishCheck);
7409
7410   application.SendNotification();
7411   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7412
7413   // We didn't expect the animation to finish yet
7414   application.SendNotification();
7415   finishCheck.CheckSignalNotReceived();
7416   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, fiftyPercentProgress, TEST_LOCATION);
7417
7418   application.SendNotification();
7419   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7420
7421   // We did expect the animation to finish
7422   application.SendNotification();
7423   finishCheck.CheckSignalReceived();
7424   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, targetHeight, TEST_LOCATION);
7425   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION);
7426   END_TEST;
7427 }
7428
7429 int UtcDaliAnimationAnimateToActorSizeDepthP(void)
7430 {
7431   TestApplication application;
7432
7433   Actor actor = Actor::New();
7434   application.GetScene().Add(actor);
7435   float startValue(0.0f);
7436   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, startValue, TEST_LOCATION);
7437   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION);
7438
7439   // Build the animation
7440   float     durationSeconds(1.0f);
7441   Animation animation = Animation::New(durationSeconds);
7442   float     targetDepth(-10.0f);
7443   animation.AnimateTo(Property(actor, Actor::Property::SIZE_DEPTH), targetDepth);
7444
7445   float fiftyPercentProgress(startValue + (targetDepth - startValue) * 0.5f);
7446
7447   // Should return the initial properties before play
7448   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7449   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION);
7450
7451   // Start the animation
7452   animation.Play();
7453
7454   // Should return the target property after play
7455   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(0.0f, 0.0f, targetDepth), TEST_LOCATION);
7456   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION);
7457
7458   bool                 signalReceived(false);
7459   AnimationFinishCheck finishCheck(signalReceived);
7460   animation.FinishedSignal().Connect(&application, finishCheck);
7461
7462   application.SendNotification();
7463   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7464
7465   // We didn't expect the animation to finish yet
7466   application.SendNotification();
7467   finishCheck.CheckSignalNotReceived();
7468   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, fiftyPercentProgress, TEST_LOCATION);
7469
7470   application.SendNotification();
7471   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7472
7473   // We did expect the animation to finish
7474   application.SendNotification();
7475   finishCheck.CheckSignalReceived();
7476   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, targetDepth, TEST_LOCATION);
7477   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION);
7478   END_TEST;
7479 }
7480
7481 int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void)
7482 {
7483   TestApplication application;
7484
7485   Actor actor = Actor::New();
7486   application.GetScene().Add(actor);
7487   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7488
7489   // Build the animation
7490   float     durationSeconds(1.0f);
7491   Animation animation = Animation::New(durationSeconds);
7492   Vector3   targetSize(100.0f, 100.0f, 100.0f);
7493   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize);
7494
7495   Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7496
7497   // Start the animation
7498   animation.Play();
7499
7500   bool                 signalReceived(false);
7501   AnimationFinishCheck finishCheck(signalReceived);
7502   animation.FinishedSignal().Connect(&application, finishCheck);
7503
7504   application.SendNotification();
7505   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7506
7507   // We didn't expect the animation to finish yet
7508   application.SendNotification();
7509   finishCheck.CheckSignalNotReceived();
7510   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), ninetyNinePercentProgress, TEST_LOCATION);
7511
7512   application.SendNotification();
7513   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7514
7515   // We did expect the animation to finish
7516   application.SendNotification();
7517   finishCheck.CheckSignalReceived();
7518   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7519
7520   // Reset everything
7521   finishCheck.Reset();
7522   actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7523   application.SendNotification();
7524   application.Render(0);
7525   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7526
7527   // Repeat with a different (ease-in) alpha function
7528   animation = Animation::New(durationSeconds);
7529   animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetSize.x, AlphaFunction::EASE_IN);
7530   animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetSize.y, AlphaFunction::EASE_IN);
7531   animation.FinishedSignal().Connect(&application, finishCheck);
7532   animation.Play();
7533
7534   application.SendNotification();
7535   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7536
7537   // We didn't expect the animation to finish yet
7538   application.SendNotification();
7539   finishCheck.CheckSignalNotReceived();
7540
7541   // The size should have travelled less, than with a linear alpha function
7542   Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
7543   DALI_TEST_CHECK(current.x > 0.0f);
7544   DALI_TEST_CHECK(current.y > 0.0f);
7545   DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
7546   DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
7547
7548   application.SendNotification();
7549   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7550
7551   // We did expect the animation to finish
7552   application.SendNotification();
7553   finishCheck.CheckSignalReceived();
7554   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).x, targetSize.x, TEST_LOCATION);
7555   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).y, targetSize.y, TEST_LOCATION);
7556
7557   // Reset everything
7558   finishCheck.Reset();
7559   actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7560   application.SendNotification();
7561   application.Render(0);
7562   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7563
7564   // Repeat with a delay
7565   float delay = 0.5f;
7566   animation   = Animation::New(durationSeconds);
7567   animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetSize.x, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7568   animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetSize.y, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7569   animation.FinishedSignal().Connect(&application, finishCheck);
7570   animation.Play();
7571
7572   application.SendNotification();
7573   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7574
7575   // We didn't expect the animation to finish yet
7576   application.SendNotification();
7577   finishCheck.CheckSignalNotReceived();
7578   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7579
7580   application.SendNotification();
7581   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7582
7583   // We did expect the animation to finish
7584   application.SendNotification();
7585   finishCheck.CheckSignalReceived();
7586   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).x, targetSize.x, TEST_LOCATION);
7587   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).y, targetSize.y, TEST_LOCATION);
7588   END_TEST;
7589 }
7590
7591 int UtcDaliAnimationAnimateToActorPositionP(void)
7592 {
7593   TestApplication application;
7594
7595   Actor actor = Actor::New();
7596   application.GetScene().Add(actor);
7597   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7598
7599   // Build the animation
7600   float     durationSeconds(1.0f);
7601   Animation animation = Animation::New(durationSeconds);
7602   Vector3   targetPosition(200.0f, 200.0f, 200.0f);
7603   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
7604
7605   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7606
7607   // Should return the initial properties before play
7608   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7609   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
7610   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), 0.0f, TEST_LOCATION);
7611   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), 0.0f, TEST_LOCATION);
7612
7613   // Start the animation
7614   animation.Play();
7615
7616   // Should return the target property after play
7617   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7618   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
7619   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
7620   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
7621
7622   bool                 signalReceived(false);
7623   AnimationFinishCheck finishCheck(signalReceived);
7624   animation.FinishedSignal().Connect(&application, finishCheck);
7625
7626   application.SendNotification();
7627   application.Render(static_cast<unsigned int>(durationSeconds * 750.0f) /* 75% progress */);
7628
7629   // We didn't expect the animation to finish yet
7630   application.SendNotification();
7631   finishCheck.CheckSignalNotReceived();
7632   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION);
7633
7634   application.SendNotification();
7635   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7636
7637   // We did expect the animation to finish
7638   application.SendNotification();
7639   finishCheck.CheckSignalReceived();
7640   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7641   END_TEST;
7642 }
7643
7644 int UtcDaliAnimationAnimateToActorPositionXP(void)
7645 {
7646   TestApplication application;
7647
7648   Actor actor = Actor::New();
7649   application.GetScene().Add(actor);
7650   float startValue(0.0f);
7651   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, startValue, TEST_LOCATION);
7652   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7653   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7654   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7655
7656   // Build the animation
7657   float     durationSeconds(1.0f);
7658   Animation animation = Animation::New(durationSeconds);
7659   float     targetX(1.0f);
7660   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), targetX);
7661
7662   float fiftyPercentProgress(startValue + (targetX - startValue) * 0.5f);
7663
7664   // Should return the initial properties before play
7665   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7666   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7667
7668   // Start the animation
7669   animation.Play();
7670
7671   // Should return the target property after play
7672   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(targetX, 0.0f, 0.0f), TEST_LOCATION);
7673   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION);
7674
7675   bool                 signalReceived(false);
7676   AnimationFinishCheck finishCheck(signalReceived);
7677   animation.FinishedSignal().Connect(&application, finishCheck);
7678
7679   application.SendNotification();
7680   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7681
7682   // We didn't expect the animation to finish yet
7683   application.SendNotification();
7684   finishCheck.CheckSignalNotReceived();
7685   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, fiftyPercentProgress, TEST_LOCATION);
7686
7687   application.SendNotification();
7688   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7689
7690   // We did expect the animation to finish
7691   application.SendNotification();
7692   finishCheck.CheckSignalReceived();
7693   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, targetX, TEST_LOCATION);
7694   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION);
7695   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7696   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7697   END_TEST;
7698 }
7699
7700 int UtcDaliAnimationAnimateToActorPositionYP(void)
7701 {
7702   TestApplication application;
7703
7704   Actor actor = Actor::New();
7705   application.GetScene().Add(actor);
7706   float startValue(0.0f);
7707   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, startValue, TEST_LOCATION);
7708   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7709   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7710   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7711
7712   // Build the animation
7713   float     durationSeconds(1.0f);
7714   Animation animation = Animation::New(durationSeconds);
7715   float     targetY(10.0f);
7716   animation.AnimateTo(Property(actor, Actor::Property::POSITION_Y), targetY);
7717
7718   float fiftyPercentProgress(startValue + (targetY - startValue) * 0.5f);
7719
7720   // Should return the initial properties before play
7721   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7722   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7723
7724   // Start the animation
7725   animation.Play();
7726
7727   // Should return the target property after play
7728   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, targetY, 0.0f), TEST_LOCATION);
7729   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION);
7730
7731   bool                 signalReceived(false);
7732   AnimationFinishCheck finishCheck(signalReceived);
7733   animation.FinishedSignal().Connect(&application, finishCheck);
7734
7735   application.SendNotification();
7736   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7737
7738   // We didn't expect the animation to finish yet
7739   application.SendNotification();
7740   finishCheck.CheckSignalNotReceived();
7741   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, fiftyPercentProgress, TEST_LOCATION);
7742
7743   application.SendNotification();
7744   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7745
7746   // We did expect the animation to finish
7747   application.SendNotification();
7748   finishCheck.CheckSignalReceived();
7749   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, targetY, TEST_LOCATION);
7750   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7751   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION);
7752   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7753   END_TEST;
7754 }
7755
7756 int UtcDaliAnimationAnimateToActorPositionZP(void)
7757 {
7758   TestApplication application;
7759
7760   Actor actor = Actor::New();
7761   application.GetScene().Add(actor);
7762   float startValue(0.0f);
7763   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, startValue, TEST_LOCATION);
7764   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7765   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7766   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7767
7768   // Build the animation
7769   float     durationSeconds(1.0f);
7770   Animation animation = Animation::New(durationSeconds);
7771   float     targetZ(-5.0f);
7772   animation.AnimateTo(Property(actor, Actor::Property::POSITION_Z), targetZ);
7773
7774   float fiftyPercentProgress(startValue + (targetZ - startValue) * 0.5f);
7775
7776   // Should return the initial properties before play
7777   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7778   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7779
7780   // Start the animation
7781   animation.Play();
7782
7783   // Should return the target property after play
7784   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, targetZ), TEST_LOCATION);
7785   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION);
7786
7787   bool                 signalReceived(false);
7788   AnimationFinishCheck finishCheck(signalReceived);
7789   animation.FinishedSignal().Connect(&application, finishCheck);
7790
7791   application.SendNotification();
7792   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7793
7794   // We didn't expect the animation to finish yet
7795   application.SendNotification();
7796   finishCheck.CheckSignalNotReceived();
7797   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, fiftyPercentProgress, TEST_LOCATION);
7798
7799   application.SendNotification();
7800   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7801
7802   // We did expect the animation to finish
7803   application.SendNotification();
7804   finishCheck.CheckSignalReceived();
7805   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, targetZ, TEST_LOCATION);
7806   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7807   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7808   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION);
7809   END_TEST;
7810 }
7811
7812 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void)
7813 {
7814   TestApplication application;
7815
7816   Actor actor = Actor::New();
7817   application.GetScene().Add(actor);
7818   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7819
7820   // Build the animation
7821   float     durationSeconds(1.0f);
7822   Animation animation = Animation::New(durationSeconds);
7823   Vector3   targetPosition(200.0f, 200.0f, 200.0f);
7824   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
7825
7826   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7827
7828   // Start the animation
7829   animation.Play();
7830
7831   bool                 signalReceived(false);
7832   AnimationFinishCheck finishCheck(signalReceived);
7833   animation.FinishedSignal().Connect(&application, finishCheck);
7834
7835   application.SendNotification();
7836   application.Render(static_cast<unsigned int>(durationSeconds * 750.0f) /* 75% progress */);
7837
7838   // We didn't expect the animation to finish yet
7839   application.SendNotification();
7840   finishCheck.CheckSignalNotReceived();
7841
7842   // The position should have moved less, than with a linear alpha function
7843   Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
7844   DALI_TEST_CHECK(current.x > Vector3::ZERO.x);
7845   DALI_TEST_CHECK(current.y > Vector3::ZERO.y);
7846   DALI_TEST_CHECK(current.z > Vector3::ZERO.z);
7847   DALI_TEST_CHECK(current.x < seventyFivePercentProgress.x);
7848   DALI_TEST_CHECK(current.y < seventyFivePercentProgress.y);
7849   DALI_TEST_CHECK(current.z < seventyFivePercentProgress.z);
7850
7851   application.SendNotification();
7852   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7853
7854   // We did expect the animation to finish
7855   application.SendNotification();
7856   finishCheck.CheckSignalReceived();
7857   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7858   END_TEST;
7859 }
7860
7861 int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void)
7862 {
7863   TestApplication application;
7864
7865   Actor actor = Actor::New();
7866   application.GetScene().Add(actor);
7867   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7868
7869   // Build the animation
7870   float     durationSeconds(1.0f);
7871   Animation animation = Animation::New(durationSeconds);
7872   Vector3   targetPosition(200.0f, 200.0f, 200.0f);
7873   float     delay = 0.5f;
7874   animation.AnimateTo(Property(actor, Actor::Property::POSITION),
7875                       targetPosition,
7876                       TimePeriod(delay, durationSeconds - delay));
7877
7878   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7879
7880   // Start the animation
7881   animation.Play();
7882
7883   bool                 signalReceived(false);
7884   AnimationFinishCheck finishCheck(signalReceived);
7885   animation.FinishedSignal().Connect(&application, finishCheck);
7886
7887   application.SendNotification();
7888   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7889
7890   // We didn't expect the animation to finish yet
7891   application.SendNotification();
7892   finishCheck.CheckSignalNotReceived();
7893   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7894
7895   application.SendNotification();
7896   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.75) /* 7/8 animation progress, 3/4 animator progress */);
7897
7898   // We didn't expect the animation to finish yet
7899   application.SendNotification();
7900   finishCheck.CheckSignalNotReceived();
7901   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION);
7902
7903   application.SendNotification();
7904   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.25) + 1u /*just beyond the animation duration*/);
7905
7906   // We did expect the animation to finish
7907   application.SendNotification();
7908   finishCheck.CheckSignalReceived();
7909   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7910   END_TEST;
7911 }
7912
7913 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void)
7914 {
7915   TestApplication application;
7916
7917   Actor actor = Actor::New();
7918   application.GetScene().Add(actor);
7919   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7920
7921   // Build the animation
7922   float     durationSeconds(1.0f);
7923   Animation animation = Animation::New(durationSeconds);
7924   Vector3   targetPosition(200.0f, 200.0f, 200.0f);
7925   float     delay = 0.5f;
7926   animation.AnimateTo(Property(actor, Actor::Property::POSITION),
7927                       targetPosition,
7928                       AlphaFunction::LINEAR,
7929                       TimePeriod(delay, durationSeconds - delay));
7930
7931   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7932
7933   // Start the animation
7934   animation.Play();
7935
7936   bool                 signalReceived(false);
7937   AnimationFinishCheck finishCheck(signalReceived);
7938   animation.FinishedSignal().Connect(&application, finishCheck);
7939
7940   application.SendNotification();
7941   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7942
7943   // We didn't expect the animation to finish yet
7944   application.SendNotification();
7945   finishCheck.CheckSignalNotReceived();
7946   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7947
7948   application.SendNotification();
7949   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.75) /* 7/8 animation progress, 3/4 animator progress */);
7950
7951   // We didn't expect the animation to finish yet
7952   application.SendNotification();
7953   finishCheck.CheckSignalNotReceived();
7954   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION);
7955
7956   application.SendNotification();
7957   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.25) + 1u /*just beyond the animation duration*/);
7958
7959   // We did expect the animation to finish
7960   application.SendNotification();
7961   finishCheck.CheckSignalReceived();
7962   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7963   END_TEST;
7964 }
7965
7966 int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void)
7967 {
7968   TestApplication application;
7969
7970   Actor actor = Actor::New();
7971   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
7972   application.GetScene().Add(actor);
7973   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
7974
7975   // Build the animation
7976   float     durationSeconds(1.0f);
7977   Animation animation = Animation::New(durationSeconds);
7978   Degree    targetRotationDegrees(90.0f);
7979   Radian    targetRotationRadians(targetRotationDegrees);
7980   animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS));
7981
7982   // Start the animation
7983   animation.Play();
7984
7985   // Target value should be retrievable straight away
7986   DALI_TEST_EQUALS(actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
7987
7988   bool                 signalReceived(false);
7989   AnimationFinishCheck finishCheck(signalReceived);
7990   animation.FinishedSignal().Connect(&application, finishCheck);
7991
7992   application.SendNotification();
7993   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
7994
7995   // We didn't expect the animation to finish yet
7996   application.SendNotification();
7997   finishCheck.CheckSignalNotReceived();
7998   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
7999
8000   application.SendNotification();
8001   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8002
8003   // We didn't expect the animation to finish yet
8004   application.SendNotification();
8005   finishCheck.CheckSignalNotReceived();
8006   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8007
8008   application.SendNotification();
8009   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8010
8011   // We didn't expect the animation to finish yet
8012   application.SendNotification();
8013   finishCheck.CheckSignalNotReceived();
8014   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8015
8016   application.SendNotification();
8017   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8018
8019   // We did expect the animation to finish
8020   application.SendNotification();
8021   finishCheck.CheckSignalReceived();
8022   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8023   END_TEST;
8024 }
8025
8026 int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void)
8027 {
8028   TestApplication application;
8029
8030   Actor actor = Actor::New();
8031   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8032   application.GetScene().Add(actor);
8033   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8034
8035   // Build the animation
8036   float      durationSeconds(1.0f);
8037   Animation  animation = Animation::New(durationSeconds);
8038   Degree     targetRotationDegrees(90.0f);
8039   Radian     targetRotationRadians(targetRotationDegrees);
8040   Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
8041   animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), targetRotation);
8042
8043   // Start the animation
8044   animation.Play();
8045
8046   bool                 signalReceived(false);
8047   AnimationFinishCheck finishCheck(signalReceived);
8048   animation.FinishedSignal().Connect(&application, finishCheck);
8049
8050   application.SendNotification();
8051   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8052
8053   // We didn't expect the animation to finish yet
8054   application.SendNotification();
8055   finishCheck.CheckSignalNotReceived();
8056   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8057
8058   application.SendNotification();
8059   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8060
8061   // We didn't expect the animation to finish yet
8062   application.SendNotification();
8063   finishCheck.CheckSignalNotReceived();
8064   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8065
8066   application.SendNotification();
8067   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8068
8069   // We didn't expect the animation to finish yet
8070   application.SendNotification();
8071   finishCheck.CheckSignalNotReceived();
8072   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8073
8074   application.SendNotification();
8075   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8076
8077   // We did expect the animation to finish
8078   application.SendNotification();
8079   finishCheck.CheckSignalReceived();
8080   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8081   END_TEST;
8082 }
8083
8084 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void)
8085 {
8086   TestApplication application;
8087
8088   Actor actor = Actor::New();
8089   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8090   application.GetScene().Add(actor);
8091   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8092
8093   // Build the animation
8094   float     durationSeconds(1.0f);
8095   Animation animation = Animation::New(durationSeconds);
8096   Degree    targetRotationDegrees(90.0f);
8097   Radian    targetRotationRadians(targetRotationDegrees);
8098   animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
8099
8100   // Start the animation
8101   animation.Play();
8102
8103   bool                 signalReceived(false);
8104   AnimationFinishCheck finishCheck(signalReceived);
8105   animation.FinishedSignal().Connect(&application, finishCheck);
8106
8107   application.SendNotification();
8108   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8109
8110   // We didn't expect the animation to finish yet
8111   application.SendNotification();
8112   finishCheck.CheckSignalNotReceived();
8113   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f * 0.25f * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8114
8115   application.SendNotification();
8116   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8117
8118   // We didn't expect the animation to finish yet
8119   application.SendNotification();
8120   finishCheck.CheckSignalNotReceived();
8121   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f * 0.5f * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8122
8123   application.SendNotification();
8124   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8125
8126   // We didn't expect the animation to finish yet
8127   application.SendNotification();
8128   finishCheck.CheckSignalNotReceived();
8129   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f * 0.75f * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8130
8131   application.SendNotification();
8132   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8133
8134   // We did expect the animation to finish
8135   application.SendNotification();
8136   finishCheck.CheckSignalReceived();
8137   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8138   END_TEST;
8139 }
8140
8141 int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void)
8142 {
8143   TestApplication application;
8144
8145   Actor actor = Actor::New();
8146   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8147   application.GetScene().Add(actor);
8148   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8149
8150   // Build the animation
8151   float     durationSeconds(1.0f);
8152   Animation animation = Animation::New(durationSeconds);
8153   Degree    targetRotationDegrees(90.0f);
8154   Radian    targetRotationRadians(targetRotationDegrees);
8155   float     delay(0.1f);
8156   animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
8157
8158   // Start the animation
8159   animation.Play();
8160
8161   bool                 signalReceived(false);
8162   AnimationFinishCheck finishCheck(signalReceived);
8163   animation.FinishedSignal().Connect(&application, finishCheck);
8164
8165   application.SendNotification();
8166   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8167
8168   // We didn't expect the animation to finish yet
8169   application.SendNotification();
8170   finishCheck.CheckSignalNotReceived();
8171   float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
8172   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8173
8174   application.SendNotification();
8175   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8176
8177   // We didn't expect the animation to finish yet
8178   application.SendNotification();
8179   finishCheck.CheckSignalNotReceived();
8180   progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
8181   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8182
8183   application.SendNotification();
8184   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8185
8186   // We didn't expect the animation to finish yet
8187   application.SendNotification();
8188   finishCheck.CheckSignalNotReceived();
8189   progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
8190   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8191
8192   application.SendNotification();
8193   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8194
8195   // We did expect the animation to finish
8196   application.SendNotification();
8197   finishCheck.CheckSignalReceived();
8198   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8199   END_TEST;
8200 }
8201
8202 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void)
8203 {
8204   TestApplication application;
8205
8206   Actor actor = Actor::New();
8207   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8208   application.GetScene().Add(actor);
8209   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8210
8211   // Build the animation
8212   float     durationSeconds(1.0f);
8213   Animation animation = Animation::New(durationSeconds);
8214   Degree    targetRotationDegrees(90.0f);
8215   Radian    targetRotationRadians(targetRotationDegrees);
8216   float     delay(0.1f);
8217   animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
8218
8219   // Start the animation
8220   animation.Play();
8221
8222   bool                 signalReceived(false);
8223   AnimationFinishCheck finishCheck(signalReceived);
8224   animation.FinishedSignal().Connect(&application, finishCheck);
8225
8226   application.SendNotification();
8227   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8228
8229   // We didn't expect the animation to finish yet
8230   application.SendNotification();
8231   finishCheck.CheckSignalNotReceived();
8232   float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
8233   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8234
8235   application.SendNotification();
8236   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8237
8238   // We didn't expect the animation to finish yet
8239   application.SendNotification();
8240   finishCheck.CheckSignalNotReceived();
8241   progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
8242   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8243
8244   application.SendNotification();
8245   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8246
8247   // We didn't expect the animation to finish yet
8248   application.SendNotification();
8249   finishCheck.CheckSignalNotReceived();
8250   progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
8251   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8252
8253   application.SendNotification();
8254   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8255
8256   // We did expect the animation to finish
8257   application.SendNotification();
8258   finishCheck.CheckSignalReceived();
8259   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8260   END_TEST;
8261 }
8262
8263 int UtcDaliAnimationAnimateToActorScaleP(void)
8264 {
8265   TestApplication application;
8266
8267   Actor actor = Actor::New();
8268   application.GetScene().Add(actor);
8269   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8270
8271   // Build the animation
8272   float     durationSeconds(1.0f);
8273   Animation animation = Animation::New(durationSeconds);
8274   Vector3   targetScale(2.0f, 2.0f, 2.0f);
8275   animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale);
8276
8277   Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE) * 0.99f);
8278
8279   // Start the animation
8280   animation.Play();
8281
8282   // Target value should be retrievable straight away
8283   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8284   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), targetScale.x, TEST_LOCATION);
8285   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), targetScale.y, TEST_LOCATION);
8286   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), targetScale.z, TEST_LOCATION);
8287
8288   bool                 signalReceived(false);
8289   AnimationFinishCheck finishCheck(signalReceived);
8290   animation.FinishedSignal().Connect(&application, finishCheck);
8291
8292   application.SendNotification();
8293   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
8294
8295   // We didn't expect the animation to finish yet
8296   application.SendNotification();
8297   finishCheck.CheckSignalNotReceived();
8298   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), ninetyNinePercentProgress, TEST_LOCATION);
8299
8300   application.SendNotification();
8301   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
8302
8303   // We did expect the animation to finish
8304   application.SendNotification();
8305   finishCheck.CheckSignalReceived();
8306   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8307
8308   // Reset everything
8309   finishCheck.Reset();
8310   actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
8311   application.SendNotification();
8312   application.Render(0);
8313   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8314
8315   // Repeat with a different (ease-in) alpha function
8316   animation = Animation::New(durationSeconds);
8317   animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
8318   animation.FinishedSignal().Connect(&application, finishCheck);
8319   animation.Play();
8320
8321   application.SendNotification();
8322   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
8323
8324   // We didn't expect the animation to finish yet
8325   application.SendNotification();
8326   finishCheck.CheckSignalNotReceived();
8327
8328   // The scale should have grown less, than with a linear alpha function
8329   Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
8330   DALI_TEST_CHECK(current.x > 1.0f);
8331   DALI_TEST_CHECK(current.y > 1.0f);
8332   DALI_TEST_CHECK(current.z > 1.0f);
8333   DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
8334   DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
8335   DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z);
8336
8337   application.SendNotification();
8338   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
8339
8340   // We did expect the animation to finish
8341   application.SendNotification();
8342   finishCheck.CheckSignalReceived();
8343   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8344
8345   // Reset everything
8346   finishCheck.Reset();
8347   actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
8348   application.SendNotification();
8349   application.Render(0);
8350   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8351
8352   // Repeat with a delay
8353   float delay = 0.5f;
8354   animation   = Animation::New(durationSeconds);
8355   animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
8356   animation.FinishedSignal().Connect(&application, finishCheck);
8357   animation.Play();
8358
8359   application.SendNotification();
8360   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
8361
8362   // We didn't expect the animation to finish yet
8363   application.SendNotification();
8364   finishCheck.CheckSignalNotReceived();
8365   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8366
8367   application.SendNotification();
8368   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8369
8370   // We did expect the animation to finish
8371   application.SendNotification();
8372   finishCheck.CheckSignalReceived();
8373   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8374   END_TEST;
8375 }
8376
8377 int UtcDaliAnimationAnimateToActorScaleXP(void)
8378 {
8379   TestApplication application;
8380
8381   Actor actor = Actor::New();
8382   application.GetScene().Add(actor);
8383   float startValue(1.0f);
8384   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, startValue, TEST_LOCATION);
8385   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8386   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8387   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8388   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8389   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8390   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8391
8392   // Build the animation
8393   float     durationSeconds(1.0f);
8394   Animation animation = Animation::New(durationSeconds);
8395   float     targetX(10.0f);
8396   animation.AnimateTo(Property(actor, Actor::Property::SCALE_X), targetX);
8397
8398   float fiftyPercentProgress(startValue + (targetX - startValue) * 0.5f);
8399
8400   // Start the animation
8401   animation.Play();
8402
8403   // Target value should be retrievable straight away
8404   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3(targetX, startValue, startValue), TEST_LOCATION);
8405   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), targetX, TEST_LOCATION);
8406
8407   bool                 signalReceived(false);
8408   AnimationFinishCheck finishCheck(signalReceived);
8409   animation.FinishedSignal().Connect(&application, finishCheck);
8410
8411   application.SendNotification();
8412   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8413
8414   // We didn't expect the animation to finish yet
8415   application.SendNotification();
8416   finishCheck.CheckSignalNotReceived();
8417   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, fiftyPercentProgress, TEST_LOCATION);
8418   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), fiftyPercentProgress, TEST_LOCATION);
8419   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8420   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8421
8422   application.SendNotification();
8423   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8424
8425   // We did expect the animation to finish
8426   application.SendNotification();
8427   finishCheck.CheckSignalReceived();
8428   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, targetX, TEST_LOCATION);
8429   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), targetX, TEST_LOCATION);
8430   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8431   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8432   END_TEST;
8433 }
8434
8435 int UtcDaliAnimationAnimateToActorScaleYP(void)
8436 {
8437   TestApplication application;
8438
8439   Actor actor = Actor::New();
8440   application.GetScene().Add(actor);
8441   float startValue(1.0f);
8442   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, startValue, TEST_LOCATION);
8443   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8444   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8445   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8446   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8447   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8448   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8449
8450   // Build the animation
8451   float     durationSeconds(1.0f);
8452   Animation animation = Animation::New(durationSeconds);
8453   float     targetY(1000.0f);
8454   animation.AnimateTo(Property(actor, Actor::Property::SCALE_Y), targetY);
8455
8456   float fiftyPercentProgress(startValue + (targetY - startValue) * 0.5f);
8457
8458   // Start the animation
8459   animation.Play();
8460
8461   // Target value should be retrievable straight away
8462   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3(startValue, targetY, startValue), TEST_LOCATION);
8463   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), targetY, TEST_LOCATION);
8464
8465   bool                 signalReceived(false);
8466   AnimationFinishCheck finishCheck(signalReceived);
8467   animation.FinishedSignal().Connect(&application, finishCheck);
8468
8469   application.SendNotification();
8470   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8471
8472   // We didn't expect the animation to finish yet
8473   application.SendNotification();
8474   finishCheck.CheckSignalNotReceived();
8475   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, fiftyPercentProgress, TEST_LOCATION);
8476   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8477   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), fiftyPercentProgress, TEST_LOCATION);
8478   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8479
8480   application.SendNotification();
8481   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8482
8483   // We did expect the animation to finish
8484   application.SendNotification();
8485   finishCheck.CheckSignalReceived();
8486   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, targetY, TEST_LOCATION);
8487   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8488   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), targetY, TEST_LOCATION);
8489   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8490   END_TEST;
8491 }
8492
8493 int UtcDaliAnimationAnimateToActorScaleZP(void)
8494 {
8495   TestApplication application;
8496
8497   Actor actor = Actor::New();
8498   application.GetScene().Add(actor);
8499   float startValue(1.0f);
8500   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, startValue, TEST_LOCATION);
8501   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8502   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8503   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8504   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8505   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8506   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8507
8508   // Build the animation
8509   float     durationSeconds(1.0f);
8510   Animation animation = Animation::New(durationSeconds);
8511   float     targetZ(-1000.0f);
8512   animation.AnimateTo(Property(actor, Actor::Property::SCALE_Z), targetZ);
8513
8514   float fiftyPercentProgress(startValue + (targetZ - startValue) * 0.5f);
8515
8516   // Start the animation
8517   animation.Play();
8518
8519   // Target value should be retrievable straight away
8520   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3(startValue, startValue, targetZ), TEST_LOCATION);
8521   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), targetZ, TEST_LOCATION);
8522
8523   bool                 signalReceived(false);
8524   AnimationFinishCheck finishCheck(signalReceived);
8525   animation.FinishedSignal().Connect(&application, finishCheck);
8526
8527   application.SendNotification();
8528   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8529
8530   // We didn't expect the animation to finish yet
8531   application.SendNotification();
8532   finishCheck.CheckSignalNotReceived();
8533   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, fiftyPercentProgress, TEST_LOCATION);
8534   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8535   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8536   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), fiftyPercentProgress, TEST_LOCATION);
8537
8538   application.SendNotification();
8539   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8540
8541   // We did expect the animation to finish
8542   application.SendNotification();
8543   finishCheck.CheckSignalReceived();
8544   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, targetZ, TEST_LOCATION);
8545   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8546   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8547   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), targetZ, TEST_LOCATION);
8548   END_TEST;
8549 }
8550
8551 int UtcDaliAnimationAnimateToActorColorP(void)
8552 {
8553   TestApplication application;
8554
8555   Actor actor = Actor::New();
8556   application.GetScene().Add(actor);
8557   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
8558
8559   // Build the animation
8560   float     durationSeconds(1.0f);
8561   Animation animation = Animation::New(durationSeconds);
8562   Vector4   targetColor(Color::RED);
8563   animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor);
8564
8565   Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
8566   Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
8567
8568   // Start the animation
8569   animation.Play();
8570
8571   // Target value should be retrievable straight away
8572   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8573   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION);
8574   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION);
8575   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION);
8576   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION);
8577   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::OPACITY), targetColor.a, TEST_LOCATION);
8578
8579   bool                 signalReceived(false);
8580   AnimationFinishCheck finishCheck(signalReceived);
8581   animation.FinishedSignal().Connect(&application, finishCheck);
8582
8583   application.SendNotification();
8584   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
8585
8586   // We didn't expect the animation to finish yet
8587   application.SendNotification();
8588   finishCheck.CheckSignalNotReceived();
8589   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), tenPercentProgress, TEST_LOCATION);
8590
8591   application.SendNotification();
8592   application.Render(static_cast<unsigned int>(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/);
8593
8594   // We did expect the animation to finish
8595   application.SendNotification();
8596   finishCheck.CheckSignalReceived();
8597   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8598
8599   // Reset everything
8600   finishCheck.Reset();
8601   actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
8602   application.SendNotification();
8603   application.Render(0);
8604   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
8605
8606   // Repeat with a different (ease-in) alpha function
8607   animation = Animation::New(durationSeconds);
8608   animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
8609   animation.FinishedSignal().Connect(&application, finishCheck);
8610   animation.Play();
8611
8612   application.SendNotification();
8613   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
8614
8615   // We didn't expect the animation to finish yet
8616   application.SendNotification();
8617   finishCheck.CheckSignalNotReceived();
8618
8619   // The color should have changed less, than with a linear alpha function
8620   Vector4 current(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
8621   DALI_TEST_CHECK(current.x == 1.0f); // doesn't change
8622   DALI_TEST_CHECK(current.y < 1.0f);
8623   DALI_TEST_CHECK(current.y > tenPercentProgress.y);
8624   DALI_TEST_CHECK(current.z < 1.0f);
8625   DALI_TEST_CHECK(current.z > tenPercentProgress.z);
8626   DALI_TEST_CHECK(current.w == 1.0f); // doesn't change
8627
8628   application.SendNotification();
8629   application.Render(static_cast<unsigned int>(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/);
8630
8631   // We did expect the animation to finish
8632   application.SendNotification();
8633   finishCheck.CheckSignalReceived();
8634   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8635
8636   // Reset everything
8637   finishCheck.Reset();
8638   actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
8639   application.SendNotification();
8640   application.Render(0);
8641   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
8642
8643   // Repeat with a shorter animator duration
8644   float animatorDuration = 0.5f;
8645   animation              = Animation::New(durationSeconds);
8646   animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
8647   animation.FinishedSignal().Connect(&application, finishCheck);
8648   animation.Play();
8649
8650   application.SendNotification();
8651   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% animation progress, 20% animator progress */);
8652
8653   // We didn't expect the animation to finish yet
8654   application.SendNotification();
8655   finishCheck.CheckSignalNotReceived();
8656   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), twentyPercentProgress, TEST_LOCATION);
8657
8658   application.SendNotification();
8659   application.Render(static_cast<unsigned int>(durationSeconds * 400.0f) /* 50% animation progress, 100% animator progress */);
8660
8661   // We didn't expect the animation to finish yet
8662   application.SendNotification();
8663   finishCheck.CheckSignalNotReceived();
8664   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8665
8666   application.SendNotification();
8667   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8668
8669   // We did expect the animation to finish
8670   application.SendNotification();
8671   finishCheck.CheckSignalReceived();
8672   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8673   END_TEST;
8674 }
8675
8676 int UtcDaliAnimationAnimateToActorColorRedP(void)
8677 {
8678   TestApplication application;
8679
8680   Actor actor = Actor::New();
8681   application.GetScene().Add(actor);
8682   float startValue(1.0f);
8683   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, startValue, TEST_LOCATION);
8684   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8685   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8686   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8687   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8688   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8689   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8690   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8691   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8692
8693   // Build the animation
8694   float     durationSeconds(1.0f);
8695   Animation animation = Animation::New(durationSeconds);
8696   float     targetRed(0.5f);
8697   animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetRed);
8698
8699   float fiftyPercentProgress(startValue + (targetRed - startValue) * 0.5f);
8700
8701   // Start the animation
8702   animation.Play();
8703
8704   // Target value should be retrievable straight away
8705   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(targetRed, startValue, startValue, startValue), TEST_LOCATION);
8706   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetRed, TEST_LOCATION);
8707
8708   bool                 signalReceived(false);
8709   AnimationFinishCheck finishCheck(signalReceived);
8710   animation.FinishedSignal().Connect(&application, finishCheck);
8711
8712   application.SendNotification();
8713   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8714
8715   // We didn't expect the animation to finish yet
8716   application.SendNotification();
8717   finishCheck.CheckSignalNotReceived();
8718   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, fiftyPercentProgress, TEST_LOCATION);
8719   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION);
8720   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8721   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8722   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8723
8724   application.SendNotification();
8725   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8726
8727   // We did expect the animation to finish
8728   application.SendNotification();
8729   finishCheck.CheckSignalReceived();
8730   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, targetRed, TEST_LOCATION);
8731   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), targetRed, TEST_LOCATION);
8732   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8733   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8734   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8735   END_TEST;
8736 }
8737
8738 int UtcDaliAnimationAnimateToActorColorGreenP(void)
8739 {
8740   TestApplication application;
8741
8742   Actor actor = Actor::New();
8743   application.GetScene().Add(actor);
8744   float startValue(1.0f);
8745   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, startValue, TEST_LOCATION);
8746   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8747   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8748   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8749   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8750   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8751   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8752   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8753   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8754
8755   // Build the animation
8756   float     durationSeconds(1.0f);
8757   Animation animation = Animation::New(durationSeconds);
8758   float     targetGreen(0.5f);
8759   animation.AnimateTo(Property(actor, Actor::Property::COLOR_GREEN), targetGreen);
8760
8761   float fiftyPercentProgress(startValue + (targetGreen - startValue) * 0.5f);
8762
8763   // Start the animation
8764   animation.Play();
8765
8766   // Target value should be retrievable straight away
8767   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(startValue, targetGreen, startValue, startValue), TEST_LOCATION);
8768   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION);
8769
8770   bool                 signalReceived(false);
8771   AnimationFinishCheck finishCheck(signalReceived);
8772   animation.FinishedSignal().Connect(&application, finishCheck);
8773
8774   application.SendNotification();
8775   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8776
8777   // We didn't expect the animation to finish yet
8778   application.SendNotification();
8779   finishCheck.CheckSignalNotReceived();
8780   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, fiftyPercentProgress, TEST_LOCATION);
8781   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8782   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION);
8783   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8784   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8785
8786   application.SendNotification();
8787   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8788
8789   // We did expect the animation to finish
8790   application.SendNotification();
8791   finishCheck.CheckSignalReceived();
8792   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, targetGreen, TEST_LOCATION);
8793   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8794   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION);
8795   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8796   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8797   END_TEST;
8798 }
8799
8800 int UtcDaliAnimationAnimateToActorColorBlueP(void)
8801 {
8802   TestApplication application;
8803
8804   Actor actor = Actor::New();
8805   application.GetScene().Add(actor);
8806   float startValue(1.0f);
8807   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, startValue, TEST_LOCATION);
8808   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8809   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8810   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8811   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8812   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8813   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8814   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8815   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8816
8817   // Build the animation
8818   float     durationSeconds(1.0f);
8819   Animation animation = Animation::New(durationSeconds);
8820   float     targetBlue(0.5f);
8821   animation.AnimateTo(Property(actor, Actor::Property::COLOR_BLUE), targetBlue);
8822
8823   float fiftyPercentProgress(startValue + (targetBlue - startValue) * 0.5f);
8824
8825   // Start the animation
8826   animation.Play();
8827
8828   // Target value should be retrievable straight away
8829   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(startValue, startValue, targetBlue, startValue), TEST_LOCATION);
8830   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetBlue, TEST_LOCATION);
8831
8832   bool                 signalReceived(false);
8833   AnimationFinishCheck finishCheck(signalReceived);
8834   animation.FinishedSignal().Connect(&application, finishCheck);
8835
8836   application.SendNotification();
8837   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8838
8839   // We didn't expect the animation to finish yet
8840   application.SendNotification();
8841   finishCheck.CheckSignalNotReceived();
8842   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, fiftyPercentProgress, TEST_LOCATION);
8843   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8844   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8845   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), fiftyPercentProgress, TEST_LOCATION);
8846   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8847
8848   application.SendNotification();
8849   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8850
8851   // We did expect the animation to finish
8852   application.SendNotification();
8853   finishCheck.CheckSignalReceived();
8854   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, targetBlue, TEST_LOCATION);
8855   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8856   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8857   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), targetBlue, TEST_LOCATION);
8858   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8859   END_TEST;
8860 }
8861
8862 int UtcDaliAnimationAnimateToActorColorAlphaP(void)
8863 {
8864   TestApplication application;
8865
8866   Actor actor = Actor::New();
8867   application.GetScene().Add(actor);
8868   float startValue(1.0f);
8869   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
8870   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8871   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8872   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8873   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8874   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8875   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8876   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8877   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8878
8879   // Build the animation
8880   float     durationSeconds(1.0f);
8881   Animation animation = Animation::New(durationSeconds);
8882   float     targetAlpha(0.5f);
8883   animation.AnimateTo(Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha);
8884
8885   float fiftyPercentProgress(startValue + (targetAlpha - startValue) * 0.5f);
8886
8887   // Start the animation
8888   animation.Play();
8889
8890   // Target value should be retrievable straight away
8891   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(startValue, startValue, startValue, targetAlpha), TEST_LOCATION);
8892   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetAlpha, TEST_LOCATION);
8893   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::OPACITY), targetAlpha, TEST_LOCATION);
8894
8895   bool                 signalReceived(false);
8896   AnimationFinishCheck finishCheck(signalReceived);
8897   animation.FinishedSignal().Connect(&application, finishCheck);
8898
8899   application.SendNotification();
8900   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8901
8902   // We didn't expect the animation to finish yet
8903   application.SendNotification();
8904   finishCheck.CheckSignalNotReceived();
8905   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, fiftyPercentProgress, TEST_LOCATION);
8906   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8907   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8908   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8909   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), fiftyPercentProgress, TEST_LOCATION);
8910
8911   application.SendNotification();
8912   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8913
8914   // We did expect the animation to finish
8915   application.SendNotification();
8916   finishCheck.CheckSignalReceived();
8917   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, targetAlpha, TEST_LOCATION);
8918   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8919   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8920   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8921   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), targetAlpha, TEST_LOCATION);
8922   END_TEST;
8923 }
8924
8925 int UtcDaliAnimationKeyFrames01P(void)
8926 {
8927   TestApplication application;
8928
8929   KeyFrames keyFrames = KeyFrames::New();
8930   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8931
8932   keyFrames.Add(0.0f, 0.1f);
8933
8934   DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8935
8936   KeyFrames keyFrames2(keyFrames);
8937   DALI_TEST_CHECK(keyFrames2);
8938   DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
8939
8940   KeyFrames keyFrames3 = KeyFrames::New();
8941   keyFrames3.Add(0.6f, true);
8942   DALI_TEST_CHECK(keyFrames3);
8943   DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
8944
8945   keyFrames3 = keyFrames;
8946   DALI_TEST_CHECK(keyFrames3);
8947   DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
8948
8949   END_TEST;
8950 }
8951
8952 int UtcDaliAnimationKeyFrames02N(void)
8953 {
8954   TestApplication application;
8955
8956   KeyFrames keyFrames = KeyFrames::New();
8957   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8958
8959   keyFrames.Add(0.0f, 0.1f);
8960   keyFrames.Add(0.2f, 0.5f);
8961   keyFrames.Add(0.4f, 0.0f);
8962   keyFrames.Add(0.6f, 1.0f);
8963   keyFrames.Add(0.8f, 0.7f);
8964   keyFrames.Add(1.0f, 0.9f);
8965
8966   DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8967
8968   DALI_TEST_ASSERTION(
8969     {
8970       keyFrames.Add(1.9f, false);
8971     },
8972     "mType == value.GetType()");
8973
8974   END_TEST;
8975 }
8976
8977 int UtcDaliAnimationKeyFrames03N(void)
8978 {
8979   TestApplication application;
8980
8981   KeyFrames keyFrames = KeyFrames::New();
8982   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8983
8984   keyFrames.Add(0.0f, true);
8985   keyFrames.Add(0.2f, false);
8986   keyFrames.Add(0.4f, false);
8987   keyFrames.Add(0.6f, true);
8988   keyFrames.Add(0.8f, true);
8989   keyFrames.Add(1.0f, false);
8990
8991   DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
8992
8993   DALI_TEST_ASSERTION(
8994     {
8995       keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8996     },
8997     "mType == value.GetType()");
8998
8999   END_TEST;
9000 }
9001
9002 int UtcDaliAnimationKeyFrames04N(void)
9003 {
9004   TestApplication application;
9005
9006   KeyFrames keyFrames = KeyFrames::New();
9007   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9008
9009   keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
9010   keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
9011   keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
9012   keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
9013   keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
9014   keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
9015
9016   DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
9017
9018   DALI_TEST_ASSERTION(
9019     {
9020       keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
9021     },
9022     "mType == value.GetType()");
9023
9024   END_TEST;
9025 }
9026
9027 int UtcDaliAnimationKeyFrames05N(void)
9028 {
9029   TestApplication application;
9030
9031   KeyFrames keyFrames = KeyFrames::New();
9032   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9033
9034   keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
9035   keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
9036   keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
9037   keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
9038   keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
9039   keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
9040
9041   DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
9042
9043   DALI_TEST_ASSERTION(
9044     {
9045       keyFrames.Add(0.7f, 1.0f);
9046     },
9047     "mType == value.GetType()");
9048
9049   END_TEST;
9050 }
9051
9052 int UtcDaliAnimationKeyFrames06N(void)
9053 {
9054   TestApplication application;
9055
9056   KeyFrames keyFrames = KeyFrames::New();
9057   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9058
9059   keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
9060   keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9061   keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
9062   keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
9063   keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
9064   keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
9065
9066   DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
9067
9068   DALI_TEST_ASSERTION(
9069     {
9070       keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
9071     },
9072     "mType == value.GetType()");
9073
9074   END_TEST;
9075 }
9076
9077 int UtcDaliAnimationKeyFrames07N(void)
9078 {
9079   TestApplication application;
9080
9081   KeyFrames keyFrames = KeyFrames::New();
9082   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9083
9084   keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
9085   keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
9086   keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
9087   keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
9088   keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
9089   keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
9090
9091   DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
9092
9093   DALI_TEST_ASSERTION(
9094     {
9095       keyFrames.Add(0.7f, 1.1f);
9096     },
9097     "mType == value.GetType()");
9098
9099   END_TEST;
9100 }
9101
9102 int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
9103 {
9104   TestApplication application;
9105
9106   float startValue(1.0f);
9107   Actor actor = Actor::New();
9108   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9109   application.GetScene().Add(actor);
9110
9111   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9112   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9113   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9114   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9115   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9116   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9117   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9118   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9119   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9120
9121   // Build the animation
9122   float     durationSeconds(1.0f);
9123   Animation animation = Animation::New(durationSeconds);
9124
9125   KeyFrames keyFrames = KeyFrames::New();
9126   keyFrames.Add(0.0f, 0.1f);
9127   keyFrames.Add(0.2f, 0.5f);
9128   keyFrames.Add(0.4f, 0.0f);
9129   keyFrames.Add(0.6f, 1.0f);
9130   keyFrames.Add(0.8f, 0.7f);
9131   keyFrames.Add(1.0f, 0.9f);
9132
9133   animation.AnimateBetween(Property(actor, Actor::Property::COLOR_ALPHA), keyFrames);
9134
9135   // Start the animation
9136   animation.Play();
9137
9138   // Final key frame value should be retrievable straight away
9139   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, TEST_LOCATION);
9140
9141   bool                 signalReceived(false);
9142   AnimationFinishCheck finishCheck(signalReceived);
9143   animation.FinishedSignal().Connect(&application, finishCheck);
9144   application.SendNotification();
9145   application.Render(0);
9146   application.SendNotification();
9147   finishCheck.CheckSignalNotReceived();
9148   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.1f, TEST_LOCATION);
9149
9150   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
9151   application.SendNotification();
9152   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9153   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9154   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9155   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION);
9156   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.3f, 0.01f, TEST_LOCATION);
9157
9158   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% progress */);
9159   application.SendNotification();
9160   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9161   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9162   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9163   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION);
9164   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.25f, 0.01f, TEST_LOCATION);
9165
9166   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 40% progress */);
9167   application.SendNotification();
9168   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9169   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9170   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9171   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION);
9172   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.0f, 0.01f, TEST_LOCATION);
9173
9174   application.Render(static_cast<unsigned int>(durationSeconds * 400.0f) /* 80% progress */);
9175   application.SendNotification();
9176   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9177   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9178   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9179   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION);
9180   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.7f, 0.01f, TEST_LOCATION);
9181
9182   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 90% progress */);
9183   application.SendNotification();
9184   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9185   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9186   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9187   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION);
9188   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.8f, 0.01f, TEST_LOCATION);
9189
9190   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1 /* 100% progress */);
9191   application.SendNotification();
9192   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9193   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9194   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9195   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION);
9196   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.9f, 0.01f, TEST_LOCATION);
9197
9198   // We did expect the animation to finish
9199
9200   finishCheck.CheckSignalReceived();
9201   END_TEST;
9202 }
9203
9204 int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
9205 {
9206   TestApplication application;
9207
9208   float startValue(1.0f);
9209   Actor actor = Actor::New();
9210   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9211   application.GetScene().Add(actor);
9212
9213   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9214   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9215   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9216   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9217   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9218   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9219   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9220   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9221   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9222
9223   // Build the animation
9224   float     durationSeconds(1.0f);
9225   Animation animation = Animation::New(durationSeconds);
9226
9227   KeyFrames keyFrames = KeyFrames::New();
9228   keyFrames.Add(0.0f, 0.1f);
9229   keyFrames.Add(0.2f, 0.5f);
9230   keyFrames.Add(0.4f, 0.0f);
9231   keyFrames.Add(0.6f, 1.0f);
9232   keyFrames.Add(0.8f, 0.7f);
9233   keyFrames.Add(1.0f, 0.9f);
9234
9235   animation.AnimateBetween(Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::CUBIC);
9236
9237   // Start the animation
9238   animation.Play();
9239
9240   bool                 signalReceived(false);
9241   AnimationFinishCheck finishCheck(signalReceived);
9242   animation.FinishedSignal().Connect(&application, finishCheck);
9243   application.SendNotification();
9244   application.Render(0);
9245   application.SendNotification();
9246   finishCheck.CheckSignalNotReceived();
9247   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.1f, TEST_LOCATION);
9248
9249   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
9250   application.SendNotification();
9251   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9252   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9253   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9254   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.36f, 0.01f, TEST_LOCATION);
9255   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.36f, 0.01f, TEST_LOCATION);
9256
9257   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% progress */);
9258   application.SendNotification();
9259   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9260   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9261   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9262   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.21f, 0.01f, TEST_LOCATION);
9263   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.21f, 0.01f, TEST_LOCATION);
9264
9265   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 40% progress */);
9266   application.SendNotification();
9267   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9268   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9269   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9270   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION);
9271   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.0f, 0.01f, TEST_LOCATION);
9272
9273   application.Render(static_cast<unsigned int>(durationSeconds * 400.0f) /* 80% progress */);
9274   application.SendNotification();
9275   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9276   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9277   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9278   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION);
9279   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.7f, 0.01f, TEST_LOCATION);
9280
9281   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 90% 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.76f, 0.01f, TEST_LOCATION);
9287   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.76f, 0.01f, TEST_LOCATION);
9288
9289   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1 /* 100% 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.9f, 0.01f, TEST_LOCATION);
9295   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.9f, 0.01f, TEST_LOCATION);
9296
9297   // We did expect the animation to finish
9298
9299   finishCheck.CheckSignalReceived();
9300   END_TEST;
9301 }
9302
9303 int UtcDaliAnimationAnimateBetweenActorColorP(void)
9304 {
9305   TestApplication application;
9306
9307   float startValue(1.0f);
9308   Actor actor = Actor::New();
9309   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9310   application.GetScene().Add(actor);
9311
9312   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9313   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9314   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9315   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9316   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9317   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9318   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9319   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9320   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9321
9322   // Build the animation
9323   float     durationSeconds(1.0f);
9324   Animation animation = Animation::New(durationSeconds);
9325
9326   KeyFrames keyFrames = KeyFrames::New();
9327   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9328   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9329   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9330
9331   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames);
9332
9333   // Start the animation
9334   animation.Play();
9335
9336   bool                 signalReceived(false);
9337   AnimationFinishCheck finishCheck(signalReceived);
9338   animation.FinishedSignal().Connect(&application, finishCheck);
9339   application.SendNotification();
9340   application.Render(0);
9341   application.SendNotification();
9342   finishCheck.CheckSignalNotReceived();
9343   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
9344   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
9345   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
9346   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
9347
9348   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9349   application.SendNotification();
9350   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
9351   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
9352   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
9353   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
9354
9355   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9356   application.SendNotification();
9357   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
9358   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
9359   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
9360   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
9361
9362   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9363   application.SendNotification();
9364   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
9365   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
9366   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
9367   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
9368
9369   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9370   application.SendNotification();
9371   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
9372   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
9373   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
9374   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
9375
9376   // We did expect the animation to finish
9377
9378   finishCheck.CheckSignalReceived();
9379   END_TEST;
9380 }
9381
9382 int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
9383 {
9384   TestApplication application;
9385
9386   float startValue(1.0f);
9387   Actor actor = Actor::New();
9388   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9389   application.GetScene().Add(actor);
9390
9391   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9392   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9393   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9394   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9395   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9396   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9397   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9398   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9399   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9400
9401   // Build the animation
9402   float     durationSeconds(1.0f);
9403   Animation animation = Animation::New(durationSeconds);
9404
9405   KeyFrames keyFrames = KeyFrames::New();
9406   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9407   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9408   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9409
9410   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, Animation::CUBIC);
9411
9412   // Start the animation
9413   animation.Play();
9414
9415   bool                 signalReceived(false);
9416   AnimationFinishCheck finishCheck(signalReceived);
9417   animation.FinishedSignal().Connect(&application, finishCheck);
9418   application.SendNotification();
9419   application.Render(0);
9420   application.SendNotification();
9421   finishCheck.CheckSignalNotReceived();
9422   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
9423   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
9424   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
9425   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
9426
9427   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9428   application.SendNotification();
9429   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
9430   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
9431   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
9432   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
9433
9434   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9435   application.SendNotification();
9436   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
9437   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
9438   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
9439   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
9440
9441   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9442   application.SendNotification();
9443   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
9444   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
9445   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
9446   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
9447
9448   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9449   application.SendNotification();
9450   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
9451   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
9452   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
9453   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
9454
9455   // We did expect the animation to finish
9456
9457   finishCheck.CheckSignalReceived();
9458   END_TEST;
9459 }
9460
9461 int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
9462 {
9463   TestApplication application;
9464
9465   Actor     actor = Actor::New();
9466   AngleAxis aa(Degree(90), Vector3::XAXIS);
9467   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9468   application.GetScene().Add(actor);
9469
9470   application.SendNotification();
9471   application.Render(0);
9472
9473   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9474
9475   // Build the animation
9476   float     durationSeconds(1.0f);
9477   Animation animation = Animation::New(durationSeconds);
9478
9479   KeyFrames keyFrames = KeyFrames::New();
9480   keyFrames.Add(0.0f, false);
9481   keyFrames.Add(0.2f, true);
9482   keyFrames.Add(0.4f, true);
9483   keyFrames.Add(0.8f, false);
9484   keyFrames.Add(1.0f, true);
9485
9486   animation.AnimateBetween(Property(actor, Actor::Property::VISIBLE), keyFrames);
9487
9488   // Start the animation
9489   animation.Play();
9490
9491   // Final key frame value should be retrievable straight away
9492   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9493
9494   bool                 signalReceived(false);
9495   AnimationFinishCheck finishCheck(signalReceived);
9496   animation.FinishedSignal().Connect(&application, finishCheck);
9497   application.SendNotification();
9498   application.SendNotification();
9499   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9500   application.SendNotification();
9501   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9502   application.SendNotification();
9503
9504   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9505   finishCheck.CheckSignalReceived();
9506   END_TEST;
9507 }
9508
9509 int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
9510 {
9511   TestApplication application;
9512
9513   Actor     actor = Actor::New();
9514   AngleAxis aa(Degree(90), Vector3::XAXIS);
9515   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9516   application.GetScene().Add(actor);
9517
9518   application.SendNotification();
9519   application.Render(0);
9520
9521   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9522
9523   // Build the animation
9524   float     durationSeconds(1.0f);
9525   Animation animation = Animation::New(durationSeconds);
9526
9527   KeyFrames keyFrames = KeyFrames::New();
9528   keyFrames.Add(0.0f, false);
9529   keyFrames.Add(0.2f, true);
9530   keyFrames.Add(0.4f, true);
9531   keyFrames.Add(0.8f, false);
9532   keyFrames.Add(1.0f, true);
9533
9534   //Cubic interpolation for boolean values should be ignored
9535   animation.AnimateBetween(Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::CUBIC);
9536
9537   // Start the animation
9538   animation.Play();
9539
9540   bool                 signalReceived(false);
9541   AnimationFinishCheck finishCheck(signalReceived);
9542   animation.FinishedSignal().Connect(&application, finishCheck);
9543   application.SendNotification();
9544   application.SendNotification();
9545   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9546   application.SendNotification();
9547   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9548   application.SendNotification();
9549
9550   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9551   finishCheck.CheckSignalReceived();
9552   END_TEST;
9553 }
9554
9555 int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
9556 {
9557   TestApplication application;
9558
9559   Actor     actor = Actor::New();
9560   AngleAxis aa(Degree(90), Vector3::XAXIS);
9561   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9562   application.GetScene().Add(actor);
9563
9564   application.SendNotification();
9565   application.Render(0);
9566   Quaternion start(Radian(aa.angle), aa.axis);
9567   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9568
9569   // Build the animation
9570   float     durationSeconds(1.0f);
9571   Animation animation = Animation::New(durationSeconds);
9572
9573   KeyFrames keyFrames = KeyFrames::New();
9574   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9575
9576   animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames);
9577
9578   // Start the animation
9579   animation.Play();
9580
9581   // Final key frame value should be retrievable straight away
9582   DALI_TEST_EQUALS(actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Degree(60), Vector3::ZAXIS), TEST_LOCATION);
9583
9584   bool                 signalReceived(false);
9585   AnimationFinishCheck finishCheck(signalReceived);
9586   animation.FinishedSignal().Connect(&application, finishCheck);
9587   application.SendNotification();
9588   application.SendNotification();
9589   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9590   application.SendNotification();
9591   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9592   application.SendNotification();
9593
9594   Quaternion check(Radian(Degree(60)), Vector3::ZAXIS);
9595
9596   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9597   finishCheck.CheckSignalReceived();
9598   END_TEST;
9599 }
9600
9601 int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
9602 {
9603   TestApplication application;
9604
9605   Actor     actor = Actor::New();
9606   AngleAxis aa(Degree(90), Vector3::XAXIS);
9607   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9608   application.SendNotification();
9609   application.Render(0);
9610   application.GetScene().Add(actor);
9611
9612   Quaternion start(Radian(aa.angle), aa.axis);
9613   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9614
9615   // Build the animation
9616   float     durationSeconds(1.0f);
9617   Animation animation = Animation::New(durationSeconds);
9618
9619   KeyFrames keyFrames = KeyFrames::New();
9620   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9621   keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9622   keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9623
9624   animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames);
9625
9626   // Start the animation
9627   animation.Play();
9628
9629   bool                 signalReceived(false);
9630   AnimationFinishCheck finishCheck(signalReceived);
9631   animation.FinishedSignal().Connect(&application, finishCheck);
9632   application.SendNotification();
9633   application.Render(0);
9634   application.SendNotification();
9635   finishCheck.CheckSignalNotReceived();
9636
9637   Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9638   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9639
9640   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9641   application.SendNotification();
9642   check = Quaternion(Radian(Degree(90)), Vector3::XAXIS);
9643   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9644
9645   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9646   application.SendNotification();
9647   check = Quaternion(Radian(Degree(120)), Vector3::XAXIS);
9648   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9649
9650   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9651   application.SendNotification();
9652   check = Quaternion(Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f));
9653   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9654
9655   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9656   application.SendNotification();
9657   check = Quaternion(Radian(Degree(120)), Vector3::YAXIS);
9658   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9659
9660   // We did expect the animation to finish
9661
9662   finishCheck.CheckSignalReceived();
9663   END_TEST;
9664 }
9665
9666 int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
9667 {
9668   TestApplication application;
9669
9670   Actor     actor = Actor::New();
9671   AngleAxis aa(Degree(90), Vector3::XAXIS);
9672   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9673   application.GetScene().Add(actor);
9674
9675   application.SendNotification();
9676   application.Render(0);
9677   Quaternion start(Radian(aa.angle), aa.axis);
9678   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9679
9680   // Build the animation
9681   float     durationSeconds(1.0f);
9682   Animation animation = Animation::New(durationSeconds);
9683
9684   KeyFrames keyFrames = KeyFrames::New();
9685   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9686
9687   //Cubic interpolation should be ignored for quaternions
9688   animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::CUBIC);
9689
9690   // Start the animation
9691   animation.Play();
9692
9693   bool                 signalReceived(false);
9694   AnimationFinishCheck finishCheck(signalReceived);
9695   animation.FinishedSignal().Connect(&application, finishCheck);
9696   application.SendNotification();
9697   application.SendNotification();
9698   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9699   application.SendNotification();
9700   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9701   application.SendNotification();
9702
9703   Quaternion check(Radian(Degree(60)), Vector3::ZAXIS);
9704
9705   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9706   finishCheck.CheckSignalReceived();
9707   END_TEST;
9708 }
9709
9710 int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
9711 {
9712   TestApplication application;
9713
9714   Actor     actor = Actor::New();
9715   AngleAxis aa(Degree(90), Vector3::XAXIS);
9716   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9717   application.SendNotification();
9718   application.Render(0);
9719   application.GetScene().Add(actor);
9720
9721   Quaternion start(Radian(aa.angle), aa.axis);
9722   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9723
9724   // Build the animation
9725   float     durationSeconds(1.0f);
9726   Animation animation = Animation::New(durationSeconds);
9727
9728   KeyFrames keyFrames = KeyFrames::New();
9729   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9730   keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9731   keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9732
9733   //Cubic interpolation should be ignored for quaternions
9734   animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::CUBIC);
9735
9736   // Start the animation
9737   animation.Play();
9738
9739   bool                 signalReceived(false);
9740   AnimationFinishCheck finishCheck(signalReceived);
9741   animation.FinishedSignal().Connect(&application, finishCheck);
9742   application.SendNotification();
9743   application.Render(0);
9744   application.SendNotification();
9745   finishCheck.CheckSignalNotReceived();
9746
9747   Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9748   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9749
9750   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9751   application.SendNotification();
9752   check = Quaternion(Radian(Degree(90)), Vector3::XAXIS);
9753   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9754
9755   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9756   application.SendNotification();
9757   check = Quaternion(Radian(Degree(120)), Vector3::XAXIS);
9758   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9759
9760   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9761   application.SendNotification();
9762   check = Quaternion(Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f));
9763   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9764
9765   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9766   application.SendNotification();
9767   check = Quaternion(Radian(Degree(120)), Vector3::YAXIS);
9768   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9769
9770   // We did expect the animation to finish
9771
9772   finishCheck.CheckSignalReceived();
9773   END_TEST;
9774 }
9775
9776 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
9777 {
9778   TestApplication application;
9779
9780   float startValue(1.0f);
9781   Actor actor = Actor::New();
9782   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9783   application.GetScene().Add(actor);
9784
9785   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9786   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9787   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9788   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9789   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9790   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9791   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9792   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9793   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9794
9795   // Build the animation
9796   float     durationSeconds(1.0f);
9797   Animation animation = Animation::New(durationSeconds);
9798
9799   KeyFrames keyFrames = KeyFrames::New();
9800   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9801   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9802   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9803
9804   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR);
9805
9806   // Start the animation
9807   animation.Play();
9808
9809   bool                 signalReceived(false);
9810   AnimationFinishCheck finishCheck(signalReceived);
9811   animation.FinishedSignal().Connect(&application, finishCheck);
9812   application.SendNotification();
9813   application.Render(0);
9814   application.SendNotification();
9815   finishCheck.CheckSignalNotReceived();
9816   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
9817   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
9818   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
9819   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
9820
9821   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9822   application.SendNotification();
9823   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
9824   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
9825   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
9826   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
9827
9828   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9829   application.SendNotification();
9830   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
9831   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
9832   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
9833   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
9834
9835   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9836   application.SendNotification();
9837   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
9838   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
9839   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
9840   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
9841
9842   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9843   application.SendNotification();
9844   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
9845   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
9846   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
9847   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
9848
9849   // We did expect the animation to finish
9850
9851   finishCheck.CheckSignalReceived();
9852   END_TEST;
9853 }
9854
9855 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
9856 {
9857   TestApplication application;
9858
9859   float startValue(1.0f);
9860   Actor actor = Actor::New();
9861   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9862   application.GetScene().Add(actor);
9863
9864   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9865   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9866   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9867   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9868   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9869   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9870   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9871   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9872   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9873
9874   // Build the animation
9875   float     durationSeconds(1.0f);
9876   Animation animation = Animation::New(durationSeconds);
9877
9878   KeyFrames keyFrames = KeyFrames::New();
9879   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9880   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9881   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9882
9883   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::CUBIC);
9884
9885   // Start the animation
9886   animation.Play();
9887
9888   bool                 signalReceived(false);
9889   AnimationFinishCheck finishCheck(signalReceived);
9890   animation.FinishedSignal().Connect(&application, finishCheck);
9891   application.SendNotification();
9892   application.Render(0);
9893   application.SendNotification();
9894   finishCheck.CheckSignalNotReceived();
9895   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
9896   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
9897   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
9898   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
9899
9900   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9901   application.SendNotification();
9902   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
9903   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
9904   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
9905   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
9906
9907   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9908   application.SendNotification();
9909   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
9910   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
9911   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
9912   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
9913
9914   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9915   application.SendNotification();
9916   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
9917   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
9918   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
9919   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
9920
9921   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9922   application.SendNotification();
9923   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
9924   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
9925   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
9926   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
9927
9928   // We did expect the animation to finish
9929
9930   finishCheck.CheckSignalReceived();
9931   END_TEST;
9932 }
9933
9934 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void)
9935 {
9936   TestApplication application;
9937
9938   float startValue(1.0f);
9939   Actor actor = Actor::New();
9940   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9941   application.GetScene().Add(actor);
9942
9943   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9944   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9945   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9946   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9947   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9948   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9949   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9950   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9951   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9952
9953   // Build the animation
9954   float     durationSeconds(1.0f);
9955   float     delay     = 0.5f;
9956   Animation animation = Animation::New(durationSeconds);
9957
9958   KeyFrames keyFrames = KeyFrames::New();
9959   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9960   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9961   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9962
9963   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod(delay, durationSeconds - delay));
9964
9965   // Start the animation
9966   animation.Play();
9967
9968   bool                 signalReceived(false);
9969   AnimationFinishCheck finishCheck(signalReceived);
9970   animation.FinishedSignal().Connect(&application, finishCheck);
9971   application.SendNotification();
9972
9973   application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
9974   application.SendNotification();
9975   finishCheck.CheckSignalNotReceived();
9976   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
9977   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
9978   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
9979   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
9980
9981   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
9982   application.SendNotification();
9983   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
9984   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
9985   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
9986   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
9987
9988   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
9989   application.SendNotification();
9990   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
9991   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
9992   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
9993   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
9994
9995   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
9996   application.SendNotification();
9997   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
9998   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
9999   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
10000   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
10001
10002   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10003   application.SendNotification();
10004   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10005   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10006   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10007   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10008
10009   // We did expect the animation to finish
10010
10011   finishCheck.CheckSignalReceived();
10012   END_TEST;
10013 }
10014
10015 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
10016 {
10017   TestApplication application;
10018
10019   float startValue(1.0f);
10020   Actor actor = Actor::New();
10021   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10022   application.GetScene().Add(actor);
10023
10024   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10025   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10026   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10027   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10028   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10029   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10030   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10031   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10032   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10033
10034   // Build the animation
10035   float     durationSeconds(1.0f);
10036   float     delay     = 0.5f;
10037   Animation animation = Animation::New(durationSeconds);
10038
10039   KeyFrames keyFrames = KeyFrames::New();
10040   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10041   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10042   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10043
10044   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod(delay, durationSeconds - delay), Animation::CUBIC);
10045
10046   // Start the animation
10047   animation.Play();
10048
10049   bool                 signalReceived(false);
10050   AnimationFinishCheck finishCheck(signalReceived);
10051   animation.FinishedSignal().Connect(&application, finishCheck);
10052   application.SendNotification();
10053
10054   application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
10055   application.SendNotification();
10056   finishCheck.CheckSignalNotReceived();
10057   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10058   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10059   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10060   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10061
10062   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
10063   application.SendNotification();
10064   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
10065   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
10066   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
10067   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
10068
10069   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
10070   application.SendNotification();
10071   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10072   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10073   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10074   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10075
10076   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
10077   application.SendNotification();
10078   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
10079   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
10080   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
10081   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
10082
10083   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10084   application.SendNotification();
10085   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10086   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10087   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10088   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10089
10090   // We did expect the animation to finish
10091
10092   finishCheck.CheckSignalReceived();
10093   END_TEST;
10094 }
10095
10096 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
10097 {
10098   TestApplication application;
10099
10100   float startValue(1.0f);
10101   float delay = 0.5f;
10102   Actor actor = Actor::New();
10103   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10104   application.GetScene().Add(actor);
10105
10106   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10107   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10108   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10109   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10110   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10111   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10112   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10113   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10114   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10115
10116   // Build the animation
10117   float     durationSeconds(1.0f);
10118   Animation animation = Animation::New(durationSeconds);
10119
10120   KeyFrames keyFrames = KeyFrames::New();
10121   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10122   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10123   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10124
10125   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
10126
10127   // Start the animation
10128   animation.Play();
10129
10130   bool                 signalReceived(false);
10131   AnimationFinishCheck finishCheck(signalReceived);
10132   animation.FinishedSignal().Connect(&application, finishCheck);
10133   application.SendNotification();
10134
10135   application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
10136   application.SendNotification();
10137   finishCheck.CheckSignalNotReceived();
10138   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10139   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10140   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10141   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10142
10143   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
10144   application.SendNotification();
10145   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
10146   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
10147   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
10148   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
10149
10150   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
10151   application.SendNotification();
10152   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10153   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10154   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10155   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10156
10157   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
10158   application.SendNotification();
10159   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
10160   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
10161   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
10162   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
10163
10164   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10165   application.SendNotification();
10166   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10167   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10168   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10169   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10170
10171   // We did expect the animation to finish
10172
10173   finishCheck.CheckSignalReceived();
10174   END_TEST;
10175 }
10176
10177 int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void)
10178 {
10179   TestApplication application;
10180
10181   float startValue(1.0f);
10182   Actor actor = Actor::New();
10183   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10184   application.GetScene().Add(actor);
10185
10186   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10187   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10188   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10189   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10190   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10191   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10192   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10193   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10194   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10195
10196   // Build the animation
10197   float     durationSeconds(1.0f);
10198   float     delay     = 0.5f;
10199   Animation animation = Animation::New(durationSeconds);
10200
10201   KeyFrames keyFrames = KeyFrames::New();
10202   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10203   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10204   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10205
10206   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay), Animation::CUBIC);
10207
10208   // Start the animation
10209   animation.Play();
10210
10211   bool                 signalReceived(false);
10212   AnimationFinishCheck finishCheck(signalReceived);
10213   animation.FinishedSignal().Connect(&application, finishCheck);
10214   application.SendNotification();
10215
10216   application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
10217   application.SendNotification();
10218   finishCheck.CheckSignalNotReceived();
10219   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10220   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10221   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10222   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10223
10224   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
10225   application.SendNotification();
10226   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
10227   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
10228   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
10229   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
10230
10231   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
10232   application.SendNotification();
10233   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10234   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10235   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10236   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10237
10238   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
10239   application.SendNotification();
10240   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
10241   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
10242   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
10243   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
10244
10245   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10246   application.SendNotification();
10247   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10248   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10249   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10250   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10251
10252   // We did expect the animation to finish
10253
10254   finishCheck.CheckSignalReceived();
10255   END_TEST;
10256 }
10257
10258 int UtcDaliAnimationAnimateP(void)
10259 {
10260   TestApplication application;
10261
10262   Actor actor = Actor::New();
10263   application.GetScene().Add(actor);
10264
10265   //Build the path
10266   Vector3 position0(30.0, 80.0, 0.0);
10267   Vector3 position1(70.0, 120.0, 0.0);
10268   Vector3 position2(100.0, 100.0, 0.0);
10269
10270   Dali::Path path = Dali::Path::New();
10271   path.AddPoint(position0);
10272   path.AddPoint(position1);
10273   path.AddPoint(position2);
10274
10275   //Control points for first segment
10276   path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10277   path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10278
10279   //Control points for second segment
10280   path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10281   path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10282
10283   // Build the animation
10284   float     durationSeconds(1.0f);
10285   Animation animation = Animation::New(durationSeconds);
10286   animation.Animate(actor, path, Vector3::XAXIS);
10287
10288   // Start the animation
10289   animation.Play();
10290
10291   bool                 signalReceived(false);
10292   AnimationFinishCheck finishCheck(signalReceived);
10293   animation.FinishedSignal().Connect(&application, finishCheck);
10294   application.SendNotification();
10295   application.Render(0);
10296   application.SendNotification();
10297   finishCheck.CheckSignalNotReceived();
10298   Vector3    position, tangent;
10299   Quaternion rotation;
10300   path.Sample(0.0f, position, tangent);
10301   rotation = Quaternion(Vector3::XAXIS, tangent);
10302   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10303   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10304
10305   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10306   application.SendNotification();
10307   path.Sample(0.25f, position, tangent);
10308   rotation = Quaternion(Vector3::XAXIS, tangent);
10309   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10310   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10311
10312   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10313   application.SendNotification();
10314   path.Sample(0.5f, position, tangent);
10315   rotation = Quaternion(Vector3::XAXIS, tangent);
10316   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10317   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10318
10319   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10320   application.SendNotification();
10321   path.Sample(0.75f, position, tangent);
10322   rotation = Quaternion(Vector3::XAXIS, tangent);
10323   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10324   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10325
10326   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10327   application.SendNotification();
10328   path.Sample(1.0f, position, tangent);
10329   rotation = Quaternion(Vector3::XAXIS, tangent);
10330   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10331   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10332
10333   finishCheck.CheckSignalReceived();
10334   END_TEST;
10335 }
10336
10337 int UtcDaliAnimationAnimateAlphaFunctionP(void)
10338 {
10339   TestApplication application;
10340
10341   Actor actor = Actor::New();
10342   application.GetScene().Add(actor);
10343
10344   //Build the path
10345   Vector3 position0(30.0, 80.0, 0.0);
10346   Vector3 position1(70.0, 120.0, 0.0);
10347   Vector3 position2(100.0, 100.0, 0.0);
10348
10349   Dali::Path path = Dali::Path::New();
10350   path.AddPoint(position0);
10351   path.AddPoint(position1);
10352   path.AddPoint(position2);
10353
10354   //Control points for first segment
10355   path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10356   path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10357
10358   //Control points for second segment
10359   path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10360   path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10361
10362   // Build the animation
10363   float     durationSeconds(1.0f);
10364   Animation animation = Animation::New(durationSeconds);
10365   animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
10366
10367   // Start the animation
10368   animation.Play();
10369
10370   bool                 signalReceived(false);
10371   AnimationFinishCheck finishCheck(signalReceived);
10372   animation.FinishedSignal().Connect(&application, finishCheck);
10373   application.SendNotification();
10374   application.Render(0);
10375   application.SendNotification();
10376   finishCheck.CheckSignalNotReceived();
10377   Vector3    position, tangent;
10378   Quaternion rotation;
10379   path.Sample(0.0f, position, tangent);
10380   rotation = Quaternion(Vector3::XAXIS, tangent);
10381   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10382   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10383
10384   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10385   application.SendNotification();
10386   path.Sample(0.25f, position, tangent);
10387   rotation = Quaternion(Vector3::XAXIS, tangent);
10388   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10389   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10390
10391   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10392   application.SendNotification();
10393   path.Sample(0.5f, position, tangent);
10394   rotation = Quaternion(Vector3::XAXIS, tangent);
10395   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10396   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10397
10398   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10399   application.SendNotification();
10400   path.Sample(0.75f, position, tangent);
10401   rotation = Quaternion(Vector3::XAXIS, tangent);
10402   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10403   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10404
10405   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10406   application.SendNotification();
10407   path.Sample(1.0f, position, tangent);
10408   rotation = Quaternion(Vector3::XAXIS, tangent);
10409   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10410   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10411
10412   finishCheck.CheckSignalReceived();
10413   END_TEST;
10414 }
10415
10416 int UtcDaliAnimationAnimateTimePeriodP(void)
10417 {
10418   TestApplication application;
10419
10420   Actor actor = Actor::New();
10421   application.GetScene().Add(actor);
10422
10423   //Build the path
10424   Vector3 position0(30.0, 80.0, 0.0);
10425   Vector3 position1(70.0, 120.0, 0.0);
10426   Vector3 position2(100.0, 100.0, 0.0);
10427
10428   Dali::Path path = Dali::Path::New();
10429   path.AddPoint(position0);
10430   path.AddPoint(position1);
10431   path.AddPoint(position2);
10432
10433   //Control points for first segment
10434   path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10435   path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10436
10437   //Control points for second segment
10438   path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10439   path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10440
10441   // Build the animation
10442   float     durationSeconds(1.0f);
10443   Animation animation = Animation::New(durationSeconds);
10444   animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
10445
10446   // Start the animation
10447   animation.Play();
10448
10449   bool                 signalReceived(false);
10450   AnimationFinishCheck finishCheck(signalReceived);
10451   animation.FinishedSignal().Connect(&application, finishCheck);
10452   application.SendNotification();
10453   application.Render(0);
10454   application.SendNotification();
10455   finishCheck.CheckSignalNotReceived();
10456   Vector3    position, tangent;
10457   Quaternion rotation;
10458   path.Sample(0.0f, position, tangent);
10459   rotation = Quaternion(Vector3::XAXIS, tangent);
10460   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10461   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10462
10463   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10464   application.SendNotification();
10465   path.Sample(0.25f, position, tangent);
10466   rotation = Quaternion(Vector3::XAXIS, tangent);
10467   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10468   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10469
10470   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10471   application.SendNotification();
10472   path.Sample(0.5f, position, tangent);
10473   rotation = Quaternion(Vector3::XAXIS, tangent);
10474   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10475   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10476
10477   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10478   application.SendNotification();
10479   path.Sample(0.75f, position, tangent);
10480   rotation = Quaternion(Vector3::XAXIS, tangent);
10481   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10482   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10483
10484   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10485   application.SendNotification();
10486   path.Sample(1.0f, position, tangent);
10487   rotation = Quaternion(Vector3::XAXIS, tangent);
10488   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10489   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10490
10491   finishCheck.CheckSignalReceived();
10492   END_TEST;
10493 }
10494
10495 int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
10496 {
10497   TestApplication application;
10498
10499   Actor actor = Actor::New();
10500   application.GetScene().Add(actor);
10501
10502   //Build the path
10503   Vector3 position0(30.0, 80.0, 0.0);
10504   Vector3 position1(70.0, 120.0, 0.0);
10505   Vector3 position2(100.0, 100.0, 0.0);
10506
10507   Dali::Path path = Dali::Path::New();
10508   path.AddPoint(position0);
10509   path.AddPoint(position1);
10510   path.AddPoint(position2);
10511
10512   //Control points for first segment
10513   path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10514   path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10515
10516   //Control points for second segment
10517   path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10518   path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10519
10520   // Build the animation
10521   float     durationSeconds(1.0f);
10522   Animation animation = Animation::New(durationSeconds);
10523   animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
10524
10525   // Start the animation
10526   animation.Play();
10527
10528   bool                 signalReceived(false);
10529   AnimationFinishCheck finishCheck(signalReceived);
10530   animation.FinishedSignal().Connect(&application, finishCheck);
10531   application.SendNotification();
10532   application.Render(0);
10533   application.SendNotification();
10534   finishCheck.CheckSignalNotReceived();
10535   Vector3    position, tangent;
10536   Quaternion rotation;
10537   path.Sample(0.0f, position, tangent);
10538   rotation = Quaternion(Vector3::XAXIS, tangent);
10539   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10540   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10541
10542   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10543   application.SendNotification();
10544   path.Sample(0.25f, position, tangent);
10545   rotation = Quaternion(Vector3::XAXIS, tangent);
10546   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10547   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10548
10549   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10550   application.SendNotification();
10551   path.Sample(0.5f, position, tangent);
10552   rotation = Quaternion(Vector3::XAXIS, tangent);
10553   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10554   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10555
10556   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10557   application.SendNotification();
10558   path.Sample(0.75f, position, tangent);
10559   rotation = Quaternion(Vector3::XAXIS, tangent);
10560   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10561   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10562
10563   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10564   application.SendNotification();
10565   path.Sample(1.0f, position, tangent);
10566   rotation = Quaternion(Vector3::XAXIS, tangent);
10567   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10568   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10569
10570   finishCheck.CheckSignalReceived();
10571   END_TEST;
10572 }
10573
10574 int UtcDaliAnimationShowP(void)
10575 {
10576   TestApplication application;
10577
10578   Actor actor = Actor::New();
10579   actor.SetProperty(Actor::Property::VISIBLE, false);
10580   application.SendNotification();
10581   application.Render(0);
10582   DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10583   application.GetScene().Add(actor);
10584
10585   // Start the animation
10586   float     durationSeconds(10.0f);
10587   Animation animation = Animation::New(durationSeconds);
10588   animation.Show(actor, durationSeconds * 0.5f);
10589   animation.Play();
10590
10591   bool                 signalReceived(false);
10592   AnimationFinishCheck finishCheck(signalReceived);
10593   animation.FinishedSignal().Connect(&application, finishCheck);
10594
10595   application.SendNotification();
10596   application.Render(static_cast<unsigned int>(durationSeconds * 490.0f));
10597
10598   // We didn't expect the animation to finish yet
10599   application.SendNotification();
10600   finishCheck.CheckSignalNotReceived();
10601   DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10602
10603   application.SendNotification();
10604   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) /*Should be shown now*/);
10605
10606   // We didn't expect the animation to finish yet
10607   application.SendNotification();
10608   finishCheck.CheckSignalNotReceived();
10609   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10610
10611   application.SendNotification();
10612   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
10613
10614   // We did expect the animation to finish
10615   application.SendNotification();
10616   finishCheck.CheckSignalReceived();
10617   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10618   END_TEST;
10619 }
10620
10621 int UtcDaliAnimationHideP(void)
10622 {
10623   TestApplication application;
10624
10625   Actor actor = Actor::New();
10626   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10627   application.GetScene().Add(actor);
10628
10629   // Start the animation
10630   float     durationSeconds(10.0f);
10631   Animation animation = Animation::New(durationSeconds);
10632   animation.Hide(actor, durationSeconds * 0.5f);
10633   animation.Play();
10634
10635   bool                 signalReceived(false);
10636   AnimationFinishCheck finishCheck(signalReceived);
10637   animation.FinishedSignal().Connect(&application, finishCheck);
10638
10639   application.SendNotification();
10640   application.Render(static_cast<unsigned int>(durationSeconds * 490.0f));
10641
10642   // We didn't expect the animation to finish yet
10643   application.SendNotification();
10644   finishCheck.CheckSignalNotReceived();
10645   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10646
10647   application.SendNotification();
10648   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) /*Should be hidden now*/);
10649
10650   // We didn't expect the animation to finish yet
10651   application.SendNotification();
10652   finishCheck.CheckSignalNotReceived();
10653   DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10654
10655   application.SendNotification();
10656   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
10657
10658   // We did expect the animation to finish
10659   application.SendNotification();
10660   finishCheck.CheckSignalReceived();
10661   DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10662   END_TEST;
10663 }
10664
10665 int UtcDaliAnimationShowHideAtEndP(void)
10666 {
10667   // Test that show/hide delay can be the same as animation duration
10668   // i.e. to show/hide at the end of the animation
10669
10670   TestApplication application;
10671
10672   Actor actor = Actor::New();
10673   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10674   application.GetScene().Add(actor);
10675
10676   // Start Hide animation
10677   float     durationSeconds(10.0f);
10678   Animation animation = Animation::New(durationSeconds);
10679   animation.Hide(actor, durationSeconds /*Hide at end*/);
10680   animation.Play();
10681
10682   bool                 signalReceived(false);
10683   AnimationFinishCheck finishCheck(signalReceived);
10684   animation.FinishedSignal().Connect(&application, finishCheck);
10685
10686   application.SendNotification();
10687   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
10688
10689   // We did expect the animation to finish
10690   application.SendNotification();
10691   finishCheck.CheckSignalReceived();
10692   DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10693
10694   // Start Show animation
10695   animation = Animation::New(durationSeconds);
10696   animation.Show(actor, durationSeconds /*Show at end*/);
10697   animation.FinishedSignal().Connect(&application, finishCheck);
10698   animation.Play();
10699
10700   application.SendNotification();
10701   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
10702
10703   // We did expect the animation to finish
10704   application.SendNotification();
10705   finishCheck.CheckSignalReceived();
10706   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10707   END_TEST;
10708 }
10709
10710 int UtcDaliKeyFramesCreateDestroyP(void)
10711 {
10712   tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
10713
10714   KeyFrames* keyFrames = new KeyFrames;
10715   delete keyFrames;
10716   DALI_TEST_CHECK(true);
10717   END_TEST;
10718 }
10719
10720 int UtcDaliKeyFramesDownCastP(void)
10721 {
10722   TestApplication application;
10723   tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
10724
10725   KeyFrames  keyFrames = KeyFrames::New();
10726   BaseHandle object(keyFrames);
10727
10728   KeyFrames keyFrames2 = KeyFrames::DownCast(object);
10729   DALI_TEST_CHECK(keyFrames2);
10730
10731   KeyFrames keyFrames3 = DownCast<KeyFrames>(object);
10732   DALI_TEST_CHECK(keyFrames3);
10733
10734   BaseHandle unInitializedObject;
10735   KeyFrames  keyFrames4 = KeyFrames::DownCast(unInitializedObject);
10736   DALI_TEST_CHECK(!keyFrames4);
10737
10738   KeyFrames keyFrames5 = DownCast<KeyFrames>(unInitializedObject);
10739   DALI_TEST_CHECK(!keyFrames5);
10740   END_TEST;
10741 }
10742
10743 int UtcDaliAnimationCreateDestroyP(void)
10744 {
10745   TestApplication application;
10746   Animation*      animation = new Animation;
10747   DALI_TEST_CHECK(animation);
10748   delete animation;
10749   END_TEST;
10750 }
10751
10752 struct UpdateManagerTestConstraint
10753 {
10754   UpdateManagerTestConstraint(TestApplication& application)
10755   : mApplication(application)
10756   {
10757   }
10758
10759   void operator()(Vector3& current, const PropertyInputContainer& /* inputs */)
10760   {
10761     mApplication.SendNotification(); // Process events
10762   }
10763
10764   TestApplication& mApplication;
10765 };
10766
10767 int UtcDaliAnimationUpdateManagerP(void)
10768 {
10769   TestApplication application;
10770
10771   Actor actor = Actor::New();
10772   application.GetScene().Add(actor);
10773
10774   // Build the animation
10775   Animation animation = Animation::New(0.0f);
10776
10777   bool                 signalReceived = false;
10778   AnimationFinishCheck finishCheck(signalReceived);
10779   animation.FinishedSignal().Connect(&application, finishCheck);
10780
10781   Vector3         startValue(1.0f, 1.0f, 1.0f);
10782   Property::Index index      = actor.RegisterProperty("testProperty", startValue);
10783   Constraint      constraint = Constraint::New<Vector3>(actor, index, UpdateManagerTestConstraint(application));
10784   constraint.Apply();
10785
10786   // Apply animation to actor
10787   animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(100.f, 90.f, 80.f), AlphaFunction::LINEAR);
10788   animation.AnimateTo(Property(actor, Actor::Property::OPACITY), 0.3f, AlphaFunction::LINEAR);
10789
10790   animation.Play();
10791
10792   application.SendNotification();
10793   application.UpdateOnly(16);
10794
10795   finishCheck.CheckSignalNotReceived();
10796
10797   application.SendNotification(); // Process events
10798
10799   finishCheck.CheckSignalReceived();
10800
10801   END_TEST;
10802 }
10803
10804 int UtcDaliAnimationSignalOrderP(void)
10805 {
10806   TestApplication application;
10807
10808   Actor actor = Actor::New();
10809   application.GetScene().Add(actor);
10810
10811   // Build the animations
10812   Animation animation1 = Animation::New(0.0f);  // finishes first frame
10813   Animation animation2 = Animation::New(0.02f); // finishes in 20 ms
10814
10815   bool signal1Received = false;
10816   animation1.FinishedSignal().Connect(&application, AnimationFinishCheck(signal1Received));
10817
10818   bool signal2Received = false;
10819   animation2.FinishedSignal().Connect(&application, AnimationFinishCheck(signal2Received));
10820
10821   // Apply animations to actor
10822   animation1.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(3.0f, 2.0f, 1.0f), AlphaFunction::LINEAR);
10823   animation1.Play();
10824   animation2.AnimateTo(Property(actor, Actor::Property::SIZE), Vector3(10.0f, 20.0f, 30.0f), AlphaFunction::LINEAR);
10825   animation2.Play();
10826
10827   DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION);
10828   DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION);
10829
10830   application.SendNotification();
10831   application.UpdateOnly(10); // 10ms progress
10832
10833   // no notifications yet
10834   DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION);
10835   DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION);
10836
10837   application.SendNotification();
10838
10839   // first completed
10840   DALI_TEST_EQUALS(signal1Received, true, TEST_LOCATION);
10841   DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION);
10842   signal1Received = false;
10843
10844   // 1st animation is complete now, do another update with no ProcessEvents in between
10845   application.UpdateOnly(20); // 20ms progress
10846
10847   // ProcessEvents
10848   application.SendNotification();
10849
10850   // 2nd should complete now
10851   DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION);
10852   DALI_TEST_EQUALS(signal2Received, true, TEST_LOCATION);
10853
10854   END_TEST;
10855 }
10856
10857 int UtcDaliAnimationExtendDurationP(void)
10858 {
10859   TestApplication application;
10860
10861   Actor actor = Actor::New();
10862
10863   // Register a float property
10864   float           startValue(10.0f);
10865   Property::Index index = actor.RegisterProperty("testProperty", startValue);
10866   application.GetScene().Add(actor);
10867   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
10868   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
10869
10870   // Build the animation
10871   float     initialDurationSeconds(1.0f);
10872   float     animatorDelay = 5.0f;
10873   float     animatorDurationSeconds(5.0f);
10874   float     extendedDurationSeconds(animatorDelay + animatorDurationSeconds);
10875   Animation animation = Animation::New(initialDurationSeconds);
10876   float     targetValue(30.0f);
10877   float     relativeValue(targetValue - startValue);
10878
10879   animation.AnimateTo(Property(actor, index),
10880                       targetValue,
10881                       TimePeriod(animatorDelay, animatorDurationSeconds));
10882
10883   // The duration should have been extended
10884   DALI_TEST_EQUALS(animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION);
10885
10886   // Start the animation
10887   animation.Play();
10888
10889   bool                 signalReceived(false);
10890   AnimationFinishCheck finishCheck(signalReceived);
10891   animation.FinishedSignal().Connect(&application, finishCheck);
10892
10893   application.SendNotification();
10894   application.Render(static_cast<unsigned int>(extendedDurationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
10895
10896   // We didn't expect the animation to finish yet, but cached value should be the final one
10897   application.SendNotification();
10898   finishCheck.CheckSignalNotReceived();
10899   DALI_TEST_EQUALS(actor.GetProperty<float>(index), targetValue, TEST_LOCATION);
10900   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
10901
10902   application.SendNotification();
10903   application.Render(static_cast<unsigned int>(extendedDurationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
10904
10905   // We didn't expect the animation to finish yet
10906   application.SendNotification();
10907   finishCheck.CheckSignalNotReceived();
10908   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
10909
10910   application.SendNotification();
10911   application.Render(static_cast<unsigned int>(extendedDurationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
10912
10913   // We did expect the animation to finish
10914   application.SendNotification();
10915   finishCheck.CheckSignalReceived();
10916   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
10917   DALI_TEST_EQUALS(actor.GetProperty<float>(index), targetValue, TEST_LOCATION);
10918   END_TEST;
10919 }
10920
10921 int UtcDaliAnimationCustomIntProperty(void)
10922 {
10923   TestApplication application;
10924
10925   Actor actor = Actor::New();
10926   application.GetScene().Add(actor);
10927   int startValue(0u);
10928
10929   Property::Index index = actor.RegisterProperty("anIndex", startValue);
10930   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
10931   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
10932
10933   // Build the animation
10934   float     durationSeconds(1.0f);
10935   Animation animation = Animation::New(durationSeconds);
10936   animation.AnimateTo(Property(actor, index), 20);
10937
10938   // Start the animation
10939   animation.Play();
10940
10941   // Target value should be retrievable straight away
10942   DALI_TEST_EQUALS(actor.GetProperty<int>(index), 20, TEST_LOCATION);
10943
10944   bool                 signalReceived(false);
10945   AnimationFinishCheck finishCheck(signalReceived);
10946   animation.FinishedSignal().Connect(&application, finishCheck);
10947
10948   application.SendNotification();
10949   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
10950
10951   // We didn't expect the animation to finish yet
10952   application.SendNotification();
10953   finishCheck.CheckSignalNotReceived();
10954   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), 10, TEST_LOCATION);
10955
10956   application.SendNotification();
10957   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
10958
10959   // We did expect the animation to finish
10960   application.SendNotification();
10961   finishCheck.CheckSignalReceived();
10962   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), 20, TEST_LOCATION);
10963   DALI_TEST_EQUALS(actor.GetProperty<int>(index), 20, TEST_LOCATION);
10964   END_TEST;
10965 }
10966
10967 int UtcDaliAnimationDuration(void)
10968 {
10969   TestApplication application;
10970
10971   Actor actor = Actor::New();
10972   application.GetScene().Add(actor);
10973
10974   Animation animation = Animation::New(0.0f);
10975   DALI_TEST_EQUALS(0.0f, animation.GetDuration(), TEST_LOCATION);
10976
10977   // The animation duration should automatically increase depending on the animator time period
10978
10979   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(0.0f, 1.0f));
10980   DALI_TEST_EQUALS(1.0f, animation.GetDuration(), TEST_LOCATION);
10981
10982   animation.AnimateTo(Property(actor, Actor::Property::POSITION_Y), 200.0f, TimePeriod(10.0f, 1.0f));
10983   DALI_TEST_EQUALS(11.0f, animation.GetDuration(), TEST_LOCATION);
10984
10985   END_TEST;
10986 }
10987
10988 int UtcDaliAnimationAnimateByNonAnimateableTypeN(void)
10989 {
10990   TestApplication application;
10991
10992   Actor actor = Actor::New();
10993
10994   // Register an integer property
10995   int             startValue(1);
10996   Property::Index index = actor.RegisterProperty("testProperty", startValue);
10997   application.GetScene().Add(actor);
10998   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
10999
11000   DALI_TEST_ASSERTION(
11001     {
11002       // Build the animation
11003       Animation   animation     = Animation::New(2.0f);
11004       std::string relativeValue = "relative string";
11005       animation.AnimateBy(Property(actor, index), relativeValue);
11006       tet_result(TET_FAIL);
11007     },
11008     "Target value is not animatable");
11009
11010   END_TEST;
11011 }
11012
11013 int UtcDaliAnimationAnimateToNonAnimateableTypeN(void)
11014 {
11015   TestApplication application;
11016
11017   Actor actor = Actor::New();
11018
11019   // Register an integer property
11020   int             startValue(1);
11021   Property::Index index = actor.RegisterProperty("testProperty", startValue);
11022   application.GetScene().Add(actor);
11023   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11024
11025   DALI_TEST_ASSERTION(
11026     {
11027       // Build the animation
11028       Animation   animation     = Animation::New(2.0f);
11029       std::string relativeValue = "relative string";
11030       animation.AnimateTo(Property(actor, index), relativeValue);
11031     },
11032     "Target value is not animatable");
11033
11034   END_TEST;
11035 }
11036
11037 int UtcDaliAnimationAnimateBetweenNonAnimateableTypeN(void)
11038 {
11039   TestApplication application;
11040
11041   Actor actor = Actor::New();
11042
11043   // Register an integer property
11044   int             startValue(1);
11045   Property::Index index = actor.RegisterProperty("testProperty", startValue);
11046   application.GetScene().Add(actor);
11047   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11048
11049   DALI_TEST_ASSERTION(
11050     {
11051       // Build the animation
11052       KeyFrames keyFrames = KeyFrames::New();
11053       keyFrames.Add(0.0f, std::string("relative string1"));
11054       keyFrames.Add(1.0f, std::string("relative string2"));
11055       // no need to really create the animation as keyframes do the check
11056     },
11057     "Property type is not animatable");
11058
11059   END_TEST;
11060 }
11061
11062 int UtcDaliAnimationSetAndGetTargetBeforePlayP(void)
11063 {
11064   tet_infoline("Setting up an animation should not effect it's position property until the animation plays");
11065
11066   TestApplication application;
11067
11068   tet_infoline("Set initial position and set up animation to re-position actor");
11069
11070   Actor actor = Actor::New();
11071   application.GetScene().Add(actor);
11072   Vector3 initialPosition(0.0f, 0.0f, 0.0f);
11073   actor.SetProperty(Actor::Property::POSITION, initialPosition);
11074
11075   // Build the animation
11076   Animation animation = Animation::New(2.0f);
11077
11078   //Test GetCurrentProgress return 0.0 as the duration is 0.0
11079   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
11080   DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 0.0f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
11081
11082   tet_infoline("Set target position in animation without intiating play");
11083
11084   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11085   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
11086
11087   application.SendNotification();
11088   application.Render();
11089
11090   tet_infoline("Ensure position of actor is still at intial value");
11091
11092   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION);
11093   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION);
11094   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION);
11095
11096   tet_infoline("Play animation and ensure actor position is now target");
11097
11098   animation.Play();
11099   application.SendNotification();
11100   application.Render(1000u);
11101
11102   tet_infoline("Ensure position of actor is at target value when aninmation half way");
11103
11104   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
11105   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
11106   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
11107
11108   tet_printf("x position at half way point(%f)\n", actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x);
11109
11110   application.Render(2000u);
11111
11112   tet_infoline("Ensure position of actor is still at target value when aninmation complete");
11113
11114   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
11115   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
11116   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
11117
11118   END_TEST;
11119 }
11120
11121 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsPositionP(void)
11122 {
11123   tet_infoline("Setting up an animation should not effect it's position property until the animation plays even with mulitple animators");
11124
11125   TestApplication application;
11126
11127   std::vector<Vector3> targetPositions;
11128
11129   targetPositions.push_back(Vector3(100.0f, 100.0f, 100.0f));
11130   targetPositions.push_back(Vector3(200.0f, 1.0f, 100.0f));
11131   targetPositions.push_back(Vector3(50.0f, 10.0f, 100.0f));
11132
11133   tet_infoline("Set initial position and set up animation to re-position actor");
11134
11135   Actor actor = Actor::New();
11136   application.GetScene().Add(actor);
11137   Vector3 initialPosition(0.0f, 0.0f, 0.0f);
11138   actor.SetProperty(Actor::Property::POSITION, initialPosition);
11139
11140   // Build the animation
11141   Animation animation = Animation::New(2.0f);
11142
11143   //Test GetCurrentProgress return 0.0 as the duration is 0.0
11144   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
11145   DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 0.0f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
11146
11147   tet_infoline("Set target position in animation without intiating play");
11148
11149   for(unsigned int i = 0; i < targetPositions.size(); i++)
11150   {
11151     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[i], AlphaFunction::LINEAR);
11152   }
11153
11154   application.SendNotification();
11155   application.Render();
11156
11157   tet_infoline("Ensure position of actor is still at intial value");
11158
11159   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION);
11160   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION);
11161   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION);
11162
11163   tet_infoline("Play animation and ensure actor position is now target");
11164
11165   animation.Play();
11166   application.SendNotification();
11167   application.Render(1000u);
11168
11169   tet_infoline("Ensure position of actor is at target value when aninmation half way");
11170
11171   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION);
11172   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION);
11173   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION);
11174
11175   tet_printf("x position at half way point(%f)\n", actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x);
11176
11177   application.Render(2000u);
11178
11179   tet_infoline("Ensure position of actor is still at target value when aninmation complete");
11180
11181   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION);
11182   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION);
11183   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION);
11184
11185   END_TEST;
11186 }
11187
11188 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionP(void)
11189 {
11190   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");
11191
11192   TestApplication application;
11193
11194   std::vector<Vector3> targetSizes;
11195   std::vector<Vector3> targetPositions;
11196
11197   targetSizes.push_back(Vector3(100.0f, 100.0f, 100.0f));
11198   targetSizes.push_back(Vector3(50.0f, 10.0f, 100.0f));
11199
11200   targetPositions.push_back(Vector3(200.0f, 1.0f, 100.0f));
11201
11202   tet_infoline("Set initial position and set up animation to re-position actor");
11203
11204   Actor actor = Actor::New();
11205   application.GetScene().Add(actor);
11206   Vector3 initialSize(10.0f, 10.0f, 10.0f);
11207   Vector3 initialPosition(10.0f, 10.0f, 10.0f);
11208
11209   actor.SetProperty(Actor::Property::SIZE, initialSize);
11210   actor.SetProperty(Actor::Property::POSITION, initialPosition);
11211
11212   // Build the animation
11213   Animation animation = Animation::New(2.0f);
11214
11215   tet_infoline("Set target size in animation without intiating play");
11216   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
11217   tet_infoline("Set target position in animation without intiating play");
11218   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[0], AlphaFunction::LINEAR);
11219   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
11220
11221   application.SendNotification();
11222   application.Render();
11223
11224   tet_infoline("Ensure position of actor is still at intial size and position");
11225
11226   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION);
11227   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION);
11228   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION);
11229
11230   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialPosition.x, TEST_LOCATION);
11231   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialPosition.y, TEST_LOCATION);
11232   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialPosition.z, TEST_LOCATION);
11233
11234   tet_infoline("Play animation and ensure actor position and size is now matches targets");
11235
11236   animation.Play();
11237   application.SendNotification();
11238   application.Render(2000u);
11239
11240   tet_infoline("Ensure position and size of actor is at target value when aninmation playing");
11241
11242   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION);
11243   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION);
11244   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION);
11245
11246   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[0].x, TEST_LOCATION);
11247   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[0].y, TEST_LOCATION);
11248   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[0].z, TEST_LOCATION);
11249
11250   END_TEST;
11251 }
11252
11253 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionColourP(void)
11254 {
11255   tet_infoline("Setting up an animation should not effect it's size property until the animation plays even if other Properties animated");
11256
11257   TestApplication application;
11258
11259   std::vector<Vector3> targetSizes;
11260   std::vector<float>   targetColors;
11261
11262   targetSizes.push_back(Vector3(100.0f, 100.0f, 100.0f));
11263   targetSizes.push_back(Vector3(50.0f, 10.0f, 150.0f));
11264
11265   targetColors.push_back(1.0f);
11266
11267   tet_infoline("Set initial position and set up animation to re-position actor");
11268
11269   Actor actor = Actor::New();
11270   application.GetScene().Add(actor);
11271   Vector3 initialSize(10.0f, 5.0f, 10.0f);
11272
11273   actor.SetProperty(Actor::Property::SIZE, initialSize);
11274
11275   // Build the animation
11276   Animation animation = Animation::New(2.0f);
11277
11278   tet_infoline("Set target size in animation without initiating play");
11279   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
11280   tet_infoline("Set target position in animation without intiating play");
11281   animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetColors[0], AlphaFunction::LINEAR);
11282   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
11283
11284   application.SendNotification();
11285   application.Render();
11286
11287   tet_infoline("Ensure position of actor is still at initial size and position");
11288
11289   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION);
11290   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION);
11291   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION);
11292
11293   tet_infoline("Play animation and ensure actor position and size is now matches targets");
11294
11295   animation.Play();
11296   application.SendNotification();
11297   application.Render(2000u);
11298
11299   tet_infoline("Ensure position and size of actor is at target value when animation playing");
11300
11301   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION);
11302   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION);
11303   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION);
11304
11305   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColors[0], TEST_LOCATION);
11306
11307   END_TEST;
11308 }
11309
11310 int UtcDaliAnimationTimePeriodOrder(void)
11311 {
11312   tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place");
11313
11314   TestApplication application;
11315
11316   Actor actor = Actor::New();
11317   application.GetScene().Add(actor);
11318
11319   application.SendNotification();
11320   application.Render();
11321
11322   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11323   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11324   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11325   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11326   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11327
11328   //////////////////////////////////////////////////////////////////////////////////
11329
11330   tet_infoline("With two AnimateTo calls");
11331
11332   Animation animation = Animation::New(0.0f);
11333   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(3.0f, 1.0f));
11334   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(1.0f, 1.0f));
11335   animation.Play();
11336
11337   tet_infoline("The target position should change instantly");
11338   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11339   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11340
11341   application.SendNotification();
11342   application.Render(5000); // After the animation is complete
11343
11344   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11345   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11346   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11347
11348   //////////////////////////////////////////////////////////////////////////////////
11349
11350   tet_infoline("Same animation again but in a different order - should yield the same result");
11351
11352   actor.SetProperty(Actor::Property::POSITION_X, 0.0f);
11353   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11354   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11355
11356   application.SendNotification();
11357   application.Render();
11358
11359   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11360   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11361   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11362
11363   animation = Animation::New(0.0f);
11364   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(1.0f, 1.0f));
11365   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(3.0f, 1.0f));
11366   animation.Play();
11367
11368   tet_infoline("The target position should change instantly");
11369   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11370   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11371
11372   application.SendNotification();
11373   application.Render(5000); // After the animation is complete
11374
11375   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11376   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11377   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11378
11379   END_TEST;
11380 }
11381
11382 int UtcDaliAnimationTimePeriodOrderSeveralAnimateToCalls(void)
11383 {
11384   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");
11385
11386   TestApplication application;
11387
11388   Actor actor = Actor::New();
11389   application.GetScene().Add(actor);
11390
11391   application.SendNotification();
11392   application.Render();
11393
11394   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11395   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11396   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11397   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11398   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11399
11400   //////////////////////////////////////////////////////////////////////////////////
11401
11402   tet_infoline("");
11403
11404   Animation animation = Animation::New(0.0f);
11405   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1000.0f, TimePeriod(4.0f, 2.0f));
11406   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 145.0f, TimePeriod(3.0f, 10.0f));
11407   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 109.0f, TimePeriod(1.0f, 1.0f));
11408   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1.0f, TimePeriod(3.0f, 4.0f));
11409   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 200.0f, TimePeriod(2.0f, 5.0f));
11410   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(10.0f, 2.0f));
11411   animation.Play();
11412
11413   tet_infoline("The target position should change instantly");
11414   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11415   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11416
11417   application.SendNotification();
11418   application.Render(14000); // After the animation is complete
11419
11420   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11421   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11422   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11423
11424   //////////////////////////////////////////////////////////////////////////////////
11425
11426   tet_infoline("Same animation again but in a different order - should end up at the same point");
11427
11428   actor.SetProperty(Actor::Property::POSITION_X, 0.0f);
11429
11430   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11431   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11432
11433   application.SendNotification();
11434   application.Render();
11435
11436   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11437   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11438   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11439
11440   animation = Animation::New(0.0f);
11441   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 200.0f, TimePeriod(2.0f, 5.0f));
11442   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(10.0f, 2.0f));
11443   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 145.0f, TimePeriod(3.0f, 10.0f));
11444   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1000.0f, TimePeriod(4.0f, 2.0f));
11445   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1.0f, TimePeriod(3.0f, 4.0f));
11446   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 109.0f, TimePeriod(1.0f, 1.0f));
11447   animation.Play();
11448
11449   tet_infoline("The target position should change instantly");
11450   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11451   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11452
11453   application.SendNotification();
11454   application.Render(14000); // After the animation is complete
11455
11456   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11457   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11458   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11459
11460   END_TEST;
11461 }
11462
11463 int UtcDaliAnimationAnimateBetweenIntegerP(void)
11464 {
11465   TestApplication application;
11466
11467   int                   startValue(1);
11468   Actor                 actor = Actor::New();
11469   const Property::Index index = actor.RegisterProperty("customProperty", startValue);
11470   application.GetScene().Add(actor);
11471
11472   application.Render();
11473   application.SendNotification();
11474
11475   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11476
11477   // Build the animation
11478   float     durationSeconds(1.0f);
11479   Animation animation = Animation::New(durationSeconds);
11480
11481   KeyFrames keyFrames = KeyFrames::New();
11482   keyFrames.Add(0.0f, 10);
11483   keyFrames.Add(0.2f, 20);
11484   keyFrames.Add(0.4f, 30);
11485   keyFrames.Add(0.6f, 40);
11486   keyFrames.Add(0.8f, 50);
11487   keyFrames.Add(1.0f, 60);
11488
11489   animation.AnimateBetween(Property(actor, index), keyFrames);
11490
11491   // Start the animation
11492   animation.Play();
11493
11494   // Target value should change to the last key-frame's value straight away
11495   DALI_TEST_EQUALS(actor.GetProperty<int>(index), 60, TEST_LOCATION);
11496
11497   END_TEST;
11498 }
11499
11500 int UtcDaliAnimationAnimateBetweenVector2P(void)
11501 {
11502   TestApplication application;
11503
11504   Vector2               startValue(10.0f, 20.0f);
11505   Actor                 actor = Actor::New();
11506   const Property::Index index = actor.RegisterProperty("customProperty", startValue);
11507   application.GetScene().Add(actor);
11508
11509   application.Render();
11510   application.SendNotification();
11511
11512   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
11513
11514   // Build the animation
11515   float     durationSeconds(1.0f);
11516   Animation animation = Animation::New(durationSeconds);
11517
11518   KeyFrames keyFrames = KeyFrames::New();
11519   keyFrames.Add(0.0f, Vector2(0.0f, 5.0f));
11520   keyFrames.Add(0.2f, Vector2(30.0f, 25.0f));
11521   keyFrames.Add(0.4f, Vector2(40.0f, 35.0f));
11522   keyFrames.Add(0.6f, Vector2(50.0f, 45.0f));
11523   keyFrames.Add(0.8f, Vector2(60.0f, 55.0f));
11524   keyFrames.Add(1.0f, Vector2(70.0f, 65.0f));
11525
11526   animation.AnimateBetween(Property(actor, index), keyFrames);
11527
11528   // Start the animation
11529   animation.Play();
11530
11531   // Target value should change to the last key-frame's value straight away
11532   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), Vector2(70.0f, 65.0f), TEST_LOCATION);
11533
11534   END_TEST;
11535 }
11536
11537 int UtcDaliAnimationProgressCallbackP(void)
11538 {
11539   TestApplication application;
11540
11541   Actor actor = Actor::New();
11542   application.GetScene().Add(actor);
11543
11544   // Build the animation
11545   Animation animation = Animation::New(0.0f);
11546
11547   //Set duration
11548   float durationSeconds(1.0f);
11549   animation.SetDuration(durationSeconds);
11550
11551   bool finishedSignalReceived(false);
11552   bool progressSignalReceived(false);
11553
11554   AnimationFinishCheck finishCheck(finishedSignalReceived);
11555   animation.FinishedSignal().Connect(&application, finishCheck);
11556
11557   AnimationProgressCheck progressCheck(progressSignalReceived);
11558   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
11559   application.SendNotification();
11560
11561   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11562   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
11563
11564   tet_infoline("Animation Progress notification set to 30%");
11565   DevelAnimation::SetProgressNotification(animation, 0.3f);
11566
11567   application.SendNotification();
11568   application.Render();
11569
11570   DALI_TEST_EQUALS(0.3f, DevelAnimation::GetProgressNotification(animation), TEST_LOCATION);
11571
11572   progressCheck.CheckSignalNotReceived();
11573
11574   // Start the animation from 10% progress
11575   animation.SetCurrentProgress(0.1f);
11576   animation.Play();
11577
11578   tet_infoline("Animation Playing from 10%");
11579
11580   application.SendNotification();
11581   application.Render(0);                        // start animation
11582   application.Render(durationSeconds * 100.0f); // 20% progress
11583
11584   tet_infoline("Animation at 20%");
11585
11586   progressCheck.CheckSignalNotReceived();
11587
11588   application.SendNotification();
11589   application.Render(durationSeconds * 200.0f); // 40% progress
11590   application.SendNotification();
11591   tet_infoline("Animation at 40%");
11592   DALI_TEST_EQUALS(0.4f, animation.GetCurrentProgress(), TEST_LOCATION);
11593
11594   progressCheck.CheckSignalReceived();
11595
11596   tet_infoline("Progress check reset");
11597   progressCheck.Reset();
11598
11599   application.Render(durationSeconds * 100.0f); // 50% progress
11600   tet_infoline("Animation at 50%");
11601   application.SendNotification();
11602
11603   DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
11604
11605   progressCheck.CheckSignalNotReceived();
11606
11607   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 60% progress */);
11608   application.SendNotification();
11609
11610   tet_infoline("Animation at 60%");
11611
11612   finishCheck.CheckSignalNotReceived();
11613
11614   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
11615   application.SendNotification();
11616   DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
11617   tet_infoline("Animation at 80%");
11618
11619   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
11620   // We did expect the animation to finish
11621   application.SendNotification();
11622   finishCheck.CheckSignalReceived();
11623   tet_infoline("Animation finished");
11624   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11625
11626   END_TEST;
11627 }
11628
11629 int UtcDaliAnimationPlayAfterP(void)
11630 {
11631   TestApplication application;
11632
11633   tet_printf("Testing that playing after 2 seconds\n");
11634
11635   {
11636     Actor actor = Actor::New();
11637     application.GetScene().Add(actor);
11638
11639     // Build the animation
11640     float     durationSeconds(1.0f);
11641     Animation animation = Animation::New(durationSeconds);
11642
11643     bool                 signalReceived(false);
11644     AnimationFinishCheck finishCheck(signalReceived);
11645     animation.FinishedSignal().Connect(&application, finishCheck);
11646     application.SendNotification();
11647
11648     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11649     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
11650
11651     // Play animation after the initial delay time
11652     animation.PlayAfter(0.2f);
11653     application.SendNotification();
11654     application.Render(0); // start animation
11655
11656     application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
11657     application.SendNotification();
11658     finishCheck.CheckSignalNotReceived();
11659     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move
11660
11661     application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
11662
11663     // We didn't expect the animation to finish yet
11664     application.SendNotification();
11665     finishCheck.CheckSignalNotReceived();
11666     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
11667
11668     application.SendNotification();
11669     application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
11670
11671     application.SendNotification();
11672     finishCheck.CheckSignalNotReceived();
11673     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
11674
11675     application.SendNotification();
11676     application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
11677
11678     // We did expect the animation to finish
11679     application.SendNotification();
11680     finishCheck.CheckSignalReceived();
11681     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11682
11683     // Check that nothing has changed after a couple of buffer swaps
11684     application.Render(0);
11685     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11686   }
11687
11688   tet_printf("Testing that playing after 2 seconds with negative speedfactor\n");
11689   // SpeedFactor < 0
11690   {
11691     Actor actor = Actor::New();
11692     application.GetScene().Add(actor);
11693
11694     // Build the animation
11695     float     durationSeconds(1.0f);
11696     Animation animation = Animation::New(durationSeconds);
11697     animation.SetSpeedFactor(-1.0f); // Set SpeedFactor as < 0
11698
11699     bool                 signalReceived(false);
11700     AnimationFinishCheck finishCheck(signalReceived);
11701     animation.FinishedSignal().Connect(&application, finishCheck);
11702     application.SendNotification();
11703
11704     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11705     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
11706
11707     // Play animation after the initial delay time
11708     animation.PlayAfter(0.2f);
11709     application.SendNotification();
11710     application.Render(0); // start animation
11711
11712     application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
11713     application.SendNotification();
11714     finishCheck.CheckSignalNotReceived();
11715     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 1.0f), TEST_LOCATION); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
11716
11717     application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% animation progress, 50% animator progress */);
11718
11719     // We didn't expect the animation to finish yet
11720     application.SendNotification();
11721     finishCheck.CheckSignalNotReceived();
11722     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
11723
11724     application.SendNotification();
11725     application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% animation progress, 100% animator progress */);
11726
11727     application.SendNotification();
11728     finishCheck.CheckSignalNotReceived();
11729     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION);
11730
11731     application.SendNotification();
11732     application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
11733
11734     // We did expect the animation to finish
11735     application.SendNotification();
11736     finishCheck.CheckSignalReceived();
11737     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of Timeperiod in seconds
11738
11739     // Check that nothing has changed after a couple of buffer swaps
11740     application.Render(0);
11741     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0, 0.0, 0.0), TEST_LOCATION);
11742   }
11743
11744   END_TEST;
11745 }
11746
11747 int UtcDaliAnimationPlayAfterP2(void)
11748 {
11749   TestApplication application;
11750
11751   tet_printf("Testing that playing after 2 seconds before looping\n");
11752
11753   {
11754     Actor actor = Actor::New();
11755     application.GetScene().Add(actor);
11756
11757     // Build the animation
11758     float     durationSeconds(1.0f);
11759     Animation animation = Animation::New(durationSeconds);
11760     animation.SetLooping(true);
11761
11762     bool                 signalReceived(false);
11763     AnimationFinishCheck finishCheck(signalReceived);
11764     animation.FinishedSignal().Connect(&application, finishCheck);
11765     application.SendNotification();
11766
11767     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11768     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
11769
11770     // Play animation after the initial delay time
11771     animation.PlayAfter(0.2f);
11772     application.SendNotification();
11773     application.Render(0); // start animation
11774
11775     for(int iterations = 0; iterations < 3; ++iterations)
11776     {
11777       // The initial delay time of PlayAfter() applies only once in looping mode.
11778       if(iterations == 0)
11779       {
11780         application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
11781         application.SendNotification();
11782         finishCheck.CheckSignalNotReceived();
11783         DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move
11784       }
11785
11786       application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
11787
11788       // We didn't expect the animation to finish yet
11789       application.SendNotification();
11790       finishCheck.CheckSignalNotReceived();
11791       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
11792
11793       application.SendNotification();
11794       application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
11795
11796       application.SendNotification();
11797       finishCheck.CheckSignalNotReceived();
11798       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
11799
11800       application.SendNotification();
11801       application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% progress */);
11802
11803       // We did expect the animation to finish
11804       application.SendNotification();
11805       finishCheck.CheckSignalNotReceived();
11806       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11807     }
11808
11809     animation.SetLooping(false);
11810     application.SendNotification();
11811     application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
11812
11813     application.SendNotification();
11814     finishCheck.CheckSignalReceived();
11815     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11816   }
11817
11818   tet_printf("Testing that playing after 2 seconds before looping with negative speedfactor\n");
11819   // SpeedFactor < 0
11820   {
11821     Actor actor = Actor::New();
11822     application.GetScene().Add(actor);
11823
11824     // Build the animation
11825     float     durationSeconds(1.0f);
11826     Animation animation = Animation::New(durationSeconds);
11827     animation.SetLooping(true);
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     for(int iterations = 0; iterations < 3; ++iterations)
11844     {
11845       // The initial delay time of PlayAfter() applies only once in looping mode.
11846       if(iterations == 0)
11847       {
11848         application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
11849         application.SendNotification();
11850         finishCheck.CheckSignalNotReceived();
11851         DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 1.0f), TEST_LOCATION); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
11852       }
11853
11854       application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% animation progress, 50% animator progress */);
11855
11856       // We didn't expect the animation to finish yet
11857       application.SendNotification();
11858       finishCheck.CheckSignalNotReceived();
11859       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
11860
11861       application.SendNotification();
11862       application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% animation progress, 100% animator progress */);
11863
11864       application.SendNotification();
11865       finishCheck.CheckSignalNotReceived();
11866       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION);
11867
11868       application.SendNotification();
11869       application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 100% progress */);
11870
11871       // We did expect the animation to finish
11872       application.SendNotification();
11873       finishCheck.CheckSignalNotReceived();
11874       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in second
11875     }
11876
11877     animation.SetLooping(false);
11878     application.SendNotification();
11879     application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
11880
11881     application.SendNotification();
11882     finishCheck.CheckSignalReceived();
11883     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0, 0.0, 0.0), TEST_LOCATION);
11884   }
11885
11886   END_TEST;
11887 }
11888
11889 int UtcDaliAnimationPlayAfterP3(void)
11890 {
11891   TestApplication application;
11892
11893   tet_printf("Testing that PlayAfter with the negative delay seconds\n");
11894
11895   Actor actor = Actor::New();
11896   application.GetScene().Add(actor);
11897
11898   // Build the animation
11899   float     durationSeconds(1.0f);
11900   Animation animation = Animation::New(durationSeconds);
11901
11902   bool                 signalReceived(false);
11903   AnimationFinishCheck finishCheck(signalReceived);
11904   animation.FinishedSignal().Connect(&application, finishCheck);
11905   application.SendNotification();
11906
11907   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11908   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
11909
11910   // When the delay time is negative value, it would treat as play immediately.
11911   animation.PlayAfter(-2.0f);
11912   application.SendNotification();
11913   application.Render(0); // start animation
11914
11915   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
11916
11917   // We didn't expect the animation to finish yet
11918   application.SendNotification();
11919   finishCheck.CheckSignalNotReceived();
11920   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
11921
11922   application.SendNotification();
11923   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
11924
11925   application.SendNotification();
11926   finishCheck.CheckSignalNotReceived();
11927   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
11928
11929   application.SendNotification();
11930   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
11931
11932   // We did expect the animation to finish
11933   application.SendNotification();
11934   finishCheck.CheckSignalReceived();
11935   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11936
11937   // Check that nothing has changed after a couple of buffer swaps
11938   application.Render(0);
11939   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11940   END_TEST;
11941 }
11942
11943 int UtcDaliAnimationPlayAfterP4(void)
11944 {
11945   TestApplication application;
11946
11947   tet_printf("Testing that PlayAfter with progress value\n");
11948
11949   Actor actor = Actor::New();
11950   application.GetScene().Add(actor);
11951
11952   // Build the animation
11953   float     durationSeconds(1.0f);
11954   Animation animation = Animation::New(durationSeconds);
11955
11956   bool                 signalReceived(false);
11957   AnimationFinishCheck finishCheck(signalReceived);
11958   animation.FinishedSignal().Connect(&application, finishCheck);
11959   application.SendNotification();
11960
11961   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11962   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
11963
11964   // Delay time is 0.3s. So after duration times, progress must be 70%. animation will finished at 1.3s.
11965   animation.PlayAfter(durationSeconds * 0.3f);
11966   application.SendNotification();
11967   application.Render(0); // start animation
11968
11969   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 5/6 delay progress, 0% animation progress, 0% animator progress */);
11970
11971   // We didn't expect the animation to finish yet
11972   application.SendNotification();
11973   finishCheck.CheckSignalNotReceived();
11974   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of PlayAfter
11975
11976   application.SendNotification();
11977   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 20% animation progress, 0% animator progress */);
11978
11979   application.SendNotification();
11980   finishCheck.CheckSignalNotReceived();
11981   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
11982
11983   application.SendNotification();
11984   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 45% animation progress, 0% animator progress */);
11985
11986   application.SendNotification();
11987   finishCheck.CheckSignalNotReceived();
11988   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
11989
11990   application.SendNotification();
11991   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 70% animation progress, 40% animator progress */);
11992
11993   application.SendNotification();
11994   finishCheck.CheckSignalNotReceived();
11995   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION); // 40% of animator progress
11996
11997   application.SendNotification();
11998   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 95% animation progress, 90% animator progress */);
11999
12000   application.SendNotification();
12001   finishCheck.CheckSignalNotReceived();
12002   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.9f), TEST_LOCATION); // 90% of animator progress
12003
12004   application.SendNotification();
12005   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
12006
12007   // We did expect the animation to finish
12008   application.SendNotification();
12009   finishCheck.CheckSignalReceived();
12010   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12011
12012   // Check that nothing has changed after a couple of buffer swaps
12013   application.Render(0);
12014   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12015   END_TEST;
12016 }
12017
12018 int UtcDaliAnimationSetLoopingModeP(void)
12019 {
12020   // Test Loop forever and Loop mode being set
12021   TestApplication    application;
12022   Integration::Scene stage(application.GetScene());
12023
12024   // Default: LoopingMode::RESTART
12025   {
12026     Actor actor = Actor::New();
12027     stage.Add(actor);
12028
12029     float     durationSeconds(1.0f);
12030     Animation animation = Animation::New(durationSeconds);
12031     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::RESTART);
12032
12033     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
12034     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12035
12036     // Start the animation
12037     animation.Play();
12038     application.SendNotification();
12039     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
12040
12041     actor.Unparent();
12042
12043     application.SendNotification();
12044     application.Render();
12045     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12046   }
12047
12048   // LoopingMode::AUTO_REVERSE
12049   {
12050     Actor actor = Actor::New();
12051     stage.Add(actor);
12052
12053     float     durationSeconds(1.0f);
12054     Animation animation = Animation::New(durationSeconds);
12055     animation.SetLooping(true);
12056
12057     bool                 signalReceived(false);
12058     AnimationFinishCheck finishCheck(signalReceived);
12059     animation.FinishedSignal().Connect(&application, finishCheck);
12060     application.SendNotification();
12061
12062     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12063     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12064
12065     animation.SetLoopingMode(Animation::LoopingMode::AUTO_REVERSE);
12066     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12067
12068     // Start the animation
12069     animation.Play();
12070     application.SendNotification();
12071     application.Render(0);
12072
12073     for(int iterations = 0; iterations < 3; ++iterations)
12074     {
12075       application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% time progress */);
12076       application.SendNotification();
12077       finishCheck.CheckSignalNotReceived();
12078
12079       // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12080       // and arrives at the beginning.
12081       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12082
12083       application.SendNotification();
12084       application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 100% time progress */);
12085
12086       // We did expect the animation to finish
12087       application.SendNotification();
12088       finishCheck.CheckSignalNotReceived();
12089       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12090     }
12091
12092     animation.SetLooping(false);
12093     application.SendNotification();
12094     application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
12095
12096     application.SendNotification();
12097     finishCheck.CheckSignalReceived();
12098
12099     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12100   }
12101
12102   // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12103   {
12104     Actor actor = Actor::New();
12105     stage.Add(actor);
12106
12107     float     durationSeconds(1.0f);
12108     Animation animation = Animation::New(durationSeconds);
12109     animation.SetLooping(true);
12110
12111     bool                 signalReceived(false);
12112     AnimationFinishCheck finishCheck(signalReceived);
12113     animation.FinishedSignal().Connect(&application, finishCheck);
12114     application.SendNotification();
12115
12116     // Specify a negative multiplier to play the animation in reverse
12117     animation.SetSpeedFactor(-1.0f);
12118
12119     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12120     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12121
12122     animation.SetLoopingMode(Animation::AUTO_REVERSE);
12123     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12124
12125     // Start the animation
12126     animation.Play();
12127     application.SendNotification();
12128     application.Render(0);
12129
12130     for(int iterations = 0; iterations < 3; ++iterations)
12131     {
12132       application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% time progress */);
12133       application.SendNotification();
12134       finishCheck.CheckSignalNotReceived();
12135
12136       // Setting a negative speed factor is to play the animation in reverse.
12137       // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12138       // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12139       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12140
12141       application.SendNotification();
12142       application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 100% time progress */);
12143
12144       // We did expect the animation to finish
12145       application.SendNotification();
12146       finishCheck.CheckSignalNotReceived();
12147       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12148     }
12149
12150     animation.SetLooping(false);
12151     application.SendNotification();
12152     application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
12153
12154     application.SendNotification();
12155     finishCheck.CheckSignalReceived();
12156
12157     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12158   }
12159
12160   END_TEST;
12161 }
12162
12163 int UtcDaliAnimationSetLoopingModeP2(void)
12164 {
12165   // Test Loop Count and Loop mode being set
12166   TestApplication    application;
12167   Integration::Scene stage(application.GetScene());
12168
12169   // LoopingMode::AUTO_REVERSE
12170   {
12171     Actor actor = Actor::New();
12172     stage.Add(actor);
12173
12174     float     durationSeconds(1.0f);
12175     Animation animation = Animation::New(durationSeconds);
12176     animation.SetLoopCount(3);
12177     DALI_TEST_CHECK(animation.IsLooping());
12178
12179     bool                 signalReceived(false);
12180     AnimationFinishCheck finishCheck(signalReceived);
12181     animation.FinishedSignal().Connect(&application, finishCheck);
12182     application.SendNotification();
12183
12184     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12185     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12186
12187     animation.SetLoopingMode(Animation::AUTO_REVERSE);
12188     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12189
12190     // Start the animation
12191     animation.Play();
12192
12193     application.Render(0);
12194     application.SendNotification();
12195     application.Render(0);
12196     application.SendNotification();
12197     application.Render(0);
12198     application.SendNotification();
12199     application.Render(0);
12200     application.SendNotification();
12201
12202     // Loop
12203     float intervalSeconds = 3.0f;
12204
12205     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12206     // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12207     // and arrives at the beginning.
12208     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12209
12210     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12211
12212     application.Render(0);
12213     application.SendNotification();
12214     application.Render(0);
12215     application.SendNotification();
12216     application.Render(0);
12217     application.SendNotification();
12218     application.Render(0);
12219     application.SendNotification();
12220     finishCheck.CheckSignalNotReceived();
12221
12222     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12223
12224     application.SendNotification();
12225     finishCheck.CheckSignalReceived();
12226     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12227
12228     finishCheck.Reset();
12229   }
12230
12231   // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12232   {
12233     Actor actor = Actor::New();
12234     stage.Add(actor);
12235
12236     float     durationSeconds(1.0f);
12237     Animation animation = Animation::New(durationSeconds);
12238     animation.SetLoopCount(3);
12239     DALI_TEST_CHECK(animation.IsLooping());
12240
12241     bool                 signalReceived(false);
12242     AnimationFinishCheck finishCheck(signalReceived);
12243     animation.FinishedSignal().Connect(&application, finishCheck);
12244     application.SendNotification();
12245
12246     // Specify a negative multiplier to play the animation in reverse
12247     animation.SetSpeedFactor(-1.0f);
12248
12249     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12250     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12251
12252     animation.SetLoopingMode(Animation::AUTO_REVERSE);
12253     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12254
12255     // Start the animation
12256     animation.Play();
12257
12258     application.Render(0);
12259     application.SendNotification();
12260     application.Render(0);
12261     application.SendNotification();
12262     application.Render(0);
12263     application.SendNotification();
12264     application.Render(0);
12265     application.SendNotification();
12266
12267     // Loop
12268     float intervalSeconds = 3.0f;
12269
12270     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12271     // Setting a negative speed factor is to play the animation in reverse.
12272     // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12273     // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12274     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12275
12276     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12277
12278     application.Render(0);
12279     application.SendNotification();
12280     application.Render(0);
12281     application.SendNotification();
12282     application.Render(0);
12283     application.SendNotification();
12284     application.Render(0);
12285     application.SendNotification();
12286     finishCheck.CheckSignalNotReceived();
12287
12288     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12289
12290     application.SendNotification();
12291     finishCheck.CheckSignalReceived();
12292     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12293
12294     finishCheck.Reset();
12295   }
12296
12297   END_TEST;
12298 }
12299
12300 int UtcDaliAnimationSetLoopingModeP3(void)
12301 {
12302   // Test Loop Count is 1 (== default) and Loop mode being set
12303   TestApplication    application;
12304   Integration::Scene stage(application.GetScene());
12305
12306   // LoopingMode::AUTO_REVERSE
12307   {
12308     Actor actor = Actor::New();
12309     stage.Add(actor);
12310
12311     float     durationSeconds(1.0f);
12312     Animation animation = Animation::New(durationSeconds);
12313     DALI_TEST_CHECK(1 == animation.GetLoopCount());
12314
12315     bool                 signalReceived(false);
12316     AnimationFinishCheck finishCheck(signalReceived);
12317     animation.FinishedSignal().Connect(&application, finishCheck);
12318     application.SendNotification();
12319
12320     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12321     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12322
12323     animation.SetLoopingMode(Animation::AUTO_REVERSE);
12324     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12325
12326     // Start the animation
12327     animation.Play();
12328     application.Render(0);
12329     application.SendNotification();
12330
12331     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 50% time progress */);
12332     application.SendNotification();
12333     finishCheck.CheckSignalNotReceived();
12334
12335     // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12336     // and arrives at the beginning.
12337     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12338
12339     application.SendNotification();
12340     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 100% time progress */);
12341
12342     application.SendNotification();
12343     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12344
12345     application.SendNotification();
12346     application.Render(static_cast<unsigned int>(durationSeconds * 1.0f * 1000.0f) + 1u /*just beyond the animation duration*/);
12347
12348     application.SendNotification();
12349     application.Render(0);
12350     application.SendNotification();
12351     finishCheck.CheckSignalReceived();
12352
12353     // After all animation finished, arrives at the beginning.
12354     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12355
12356     finishCheck.Reset();
12357   }
12358
12359   // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12360   {
12361     Actor actor = Actor::New();
12362     stage.Add(actor);
12363
12364     float     durationSeconds(1.0f);
12365     Animation animation = Animation::New(durationSeconds);
12366     DALI_TEST_CHECK(1 == animation.GetLoopCount());
12367
12368     bool                 signalReceived(false);
12369     AnimationFinishCheck finishCheck(signalReceived);
12370     animation.FinishedSignal().Connect(&application, finishCheck);
12371     application.SendNotification();
12372
12373     // Specify a negative multiplier to play the animation in reverse
12374     animation.SetSpeedFactor(-1.0f);
12375
12376     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12377     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12378
12379     animation.SetLoopingMode(Animation::AUTO_REVERSE);
12380     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12381
12382     // Start the animation
12383     animation.Play();
12384     application.Render(0);
12385     application.SendNotification();
12386
12387     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 50% time progress */);
12388     application.SendNotification();
12389     finishCheck.CheckSignalNotReceived();
12390
12391     // Setting a negative speed factor is to play the animation in reverse.
12392     // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12393     // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12394     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12395
12396     application.SendNotification();
12397     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 100% time progress */);
12398
12399     application.SendNotification();
12400     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12401
12402     application.SendNotification();
12403     application.Render(static_cast<unsigned int>(durationSeconds * 1.0f * 1000.0f) + 1u /*just beyond the animation duration*/);
12404
12405     application.SendNotification();
12406     application.Render(0);
12407     application.SendNotification();
12408     finishCheck.CheckSignalReceived();
12409
12410     // After all animation finished, arrives at the target.
12411     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12412
12413     finishCheck.Reset();
12414   }
12415
12416   END_TEST;
12417 }
12418
12419 int UtcDaliAnimationGetLoopingModeP(void)
12420 {
12421   TestApplication application;
12422
12423   Animation animation = Animation::New(1.0f);
12424
12425   // default mode
12426   DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::RESTART);
12427
12428   animation.SetLoopingMode(Animation::AUTO_REVERSE);
12429   DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12430
12431   END_TEST;
12432 }
12433
12434 int UtcDaliAnimationProgressSignalConnectionWithoutProgressMarkerP(void)
12435 {
12436   TestApplication application;
12437
12438   tet_infoline("Connect to ProgressReachedSignal but do not set a required Progress marker");
12439
12440   Actor actor = Actor::New();
12441   application.GetScene().Add(actor);
12442
12443   // Build the animation
12444   Animation animation = Animation::New(0.0f);
12445
12446   //Set duration
12447   float durationSeconds(1.0f);
12448   animation.SetDuration(durationSeconds);
12449
12450   bool finishedSignalReceived(false);
12451   bool progressSignalReceived(false);
12452
12453   AnimationFinishCheck finishCheck(finishedSignalReceived);
12454   animation.FinishedSignal().Connect(&application, finishCheck);
12455
12456   AnimationProgressCheck progressCheck(progressSignalReceived);
12457   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
12458   application.SendNotification();
12459
12460   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12461   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12462
12463   progressCheck.CheckSignalNotReceived();
12464
12465   animation.Play();
12466
12467   application.SendNotification();
12468   application.Render(0);                        // start animation
12469   application.Render(durationSeconds * 100.0f); // 10% progress
12470   application.SendNotification();
12471
12472   tet_infoline("Ensure after animation has started playing that ProgressReachedSignal not emitted");
12473   progressCheck.CheckSignalNotReceived();
12474
12475   application.Render(static_cast<unsigned int>(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/);
12476
12477   application.SendNotification();
12478   finishCheck.CheckSignalReceived();
12479   tet_infoline("Animation finished");
12480   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12481
12482   END_TEST;
12483 }
12484
12485 int UtcDaliAnimationMultipleProgressSignalsP(void)
12486 {
12487   tet_infoline("Multiple animations with different progress markers");
12488
12489   TestApplication application;
12490
12491   Actor actor = Actor::New();
12492   application.GetScene().Add(actor);
12493
12494   // Build the animation
12495   Animation animationAlpha = Animation::New(0.0f);
12496   Animation animationBeta  = Animation::New(0.0f);
12497
12498   //Set duration
12499   float durationSeconds(1.0f);
12500   animationAlpha.SetDuration(durationSeconds);
12501   animationBeta.SetDuration(durationSeconds);
12502
12503   bool progressSignalReceivedAlpha(false);
12504   bool progressSignalReceivedBeta(false);
12505
12506   AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12507   AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta");
12508
12509   DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha);
12510   DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta);
12511   application.SendNotification();
12512
12513   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12514   animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12515   animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12516
12517   tet_infoline("AnimationAlpha Progress notification set to 30%");
12518   DevelAnimation::SetProgressNotification(animationAlpha, 0.3f);
12519
12520   tet_infoline("AnimationBeta Progress notification set to 50%");
12521   DevelAnimation::SetProgressNotification(animationBeta, 0.5f);
12522
12523   application.SendNotification();
12524   application.Render();
12525
12526   progressCheckAlpha.CheckSignalNotReceived();
12527   progressCheckBeta.CheckSignalNotReceived();
12528
12529   // Start the animations from 10% progress
12530   animationAlpha.SetCurrentProgress(0.1f);
12531   animationBeta.SetCurrentProgress(0.1f);
12532   animationAlpha.Play();
12533   animationBeta.Play();
12534
12535   tet_infoline("Animation Playing from 10%");
12536
12537   application.SendNotification();
12538   application.Render(0);                        // start animation
12539   application.Render(durationSeconds * 100.0f); // 20% progress
12540
12541   tet_infoline("Animation at 20% - No signals to be received");
12542
12543   progressCheckAlpha.CheckSignalNotReceived();
12544   progressCheckBeta.CheckSignalNotReceived();
12545
12546   application.SendNotification();
12547   application.Render(durationSeconds * 200.0f); // 40% progress
12548   application.SendNotification();
12549   tet_infoline("Animation at 40% - Alpha signal should be received");
12550   DALI_TEST_EQUALS(0.4f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
12551
12552   progressCheckAlpha.CheckSignalReceived();
12553   progressCheckBeta.CheckSignalNotReceived();
12554
12555   tet_infoline("Progress check reset");
12556   progressCheckAlpha.Reset();
12557   progressCheckBeta.Reset();
12558
12559   application.Render(durationSeconds * 100.0f); // 50% progress
12560   tet_infoline("Animation at 50% - Beta should receive signal, Alpha should not");
12561   application.SendNotification();
12562
12563   DALI_TEST_EQUALS(0.5f, animationBeta.GetCurrentProgress(), TEST_LOCATION);
12564
12565   progressCheckAlpha.CheckSignalNotReceived();
12566   progressCheckBeta.CheckSignalReceived();
12567   tet_infoline("Progress check reset");
12568   progressCheckAlpha.Reset();
12569   progressCheckBeta.Reset();
12570
12571   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 60% progress */);
12572   application.SendNotification();
12573
12574   tet_infoline("Animation at 60%");
12575
12576   progressCheckAlpha.CheckSignalNotReceived();
12577   progressCheckBeta.CheckSignalNotReceived();
12578
12579   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
12580   application.SendNotification();
12581   tet_infoline("Animation at 80%");
12582
12583   progressCheckAlpha.CheckSignalNotReceived();
12584   progressCheckBeta.CheckSignalNotReceived();
12585
12586   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
12587   // We did expect the animation to finish
12588   tet_infoline("Animation finished");
12589
12590   END_TEST;
12591 }
12592
12593 int UtcDaliAnimationMultipleProgressSignalsP2(void)
12594 {
12595   tet_infoline("Multiple animations with different progress markers and big step time");
12596
12597   TestApplication application;
12598
12599   Actor actor = Actor::New();
12600   application.GetScene().Add(actor);
12601
12602   // Build the animation
12603   Animation animationAlpha = Animation::New(0.0f);
12604   Animation animationBeta  = Animation::New(0.0f);
12605
12606   //Set duration
12607   const float durationSeconds(1.0f);
12608   animationAlpha.SetDuration(durationSeconds);
12609   animationBeta.SetDuration(durationSeconds);
12610
12611   bool progressSignalReceivedAlpha(false);
12612   bool progressSignalReceivedBeta(false);
12613
12614   AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12615   AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta");
12616
12617   DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha);
12618   DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta);
12619   application.SendNotification();
12620
12621   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12622   animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12623   animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12624
12625   tet_infoline("AnimationAlpha Progress notification set to 1%");
12626   DevelAnimation::SetProgressNotification(animationAlpha, 0.01f);
12627
12628   tet_infoline("AnimationBeta Progress notification set to 99%");
12629   DevelAnimation::SetProgressNotification(animationBeta, 0.99f);
12630
12631   application.SendNotification();
12632   application.Render();
12633
12634   progressCheckAlpha.CheckSignalNotReceived();
12635   progressCheckBeta.CheckSignalNotReceived();
12636
12637   // Start the animations unlimited looping
12638   animationAlpha.SetLooping(true);
12639   animationBeta.SetLooping(true);
12640   animationAlpha.Play();
12641   animationBeta.Play();
12642
12643   application.SendNotification();
12644   application.Render(0);                       // start animation
12645   application.Render(durationSeconds * 20.0f); // 2% progress
12646   application.SendNotification();
12647   DALI_TEST_EQUALS(0.02f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
12648
12649   tet_infoline("Animation at 2% - Alpha signals should be received, Beta should not.");
12650
12651   progressCheckAlpha.CheckSignalReceived();
12652   progressCheckBeta.CheckSignalNotReceived();
12653
12654   tet_infoline("Progress check reset");
12655   progressCheckAlpha.Reset();
12656   progressCheckBeta.Reset();
12657
12658   application.SendNotification();
12659   application.Render(durationSeconds * 960.0f); // 98% progress
12660   application.SendNotification();
12661   tet_infoline("Animation at 98% - No signal received");
12662   DALI_TEST_EQUALS(0.98f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
12663
12664   progressCheckAlpha.CheckSignalNotReceived();
12665   progressCheckBeta.CheckSignalNotReceived();
12666
12667   application.SendNotification();
12668   application.Render(durationSeconds * 40.0f); // 2% progress
12669   application.SendNotification();
12670   tet_infoline("Animation loop once and now 2% - Alpha and Beta should receive signal");
12671   application.SendNotification();
12672
12673   DALI_TEST_EQUALS(0.02f, animationBeta.GetCurrentProgress(), TEST_LOCATION);
12674
12675   progressCheckAlpha.CheckSignalReceived();
12676   progressCheckBeta.CheckSignalReceived();
12677
12678   tet_infoline("Progress check reset");
12679   progressCheckAlpha.Reset();
12680   progressCheckBeta.Reset();
12681
12682   application.SendNotification();
12683   application.Render(durationSeconds * 980.0f); // 100% progress
12684   application.SendNotification();
12685   tet_infoline("Animation loop one more time. and now 100% - Beta should receive signal, Alhpa sholud not");
12686   application.SendNotification();
12687
12688   progressCheckAlpha.CheckSignalNotReceived();
12689   progressCheckBeta.CheckSignalReceived();
12690
12691   tet_infoline("Progress check reset");
12692   progressCheckAlpha.Reset();
12693   progressCheckBeta.Reset();
12694
12695   animationAlpha.SetLooping(false);
12696   animationBeta.SetLooping(false);
12697
12698   application.SendNotification();
12699   application.Render(static_cast<unsigned int>(durationSeconds * 2000.0f) + 1u /*just beyond the animation duration*/);
12700   application.SendNotification();
12701
12702   // We did expect the animation to finish
12703   tet_infoline("Animation finished");
12704
12705   END_TEST;
12706 }
12707
12708 int UtcDaliAnimationProgressSignalWithPlayAfterP(void)
12709 {
12710   tet_infoline("Multiple animations with different progress markers");
12711
12712   TestApplication application;
12713
12714   Actor actor = Actor::New();
12715   application.GetScene().Add(actor);
12716
12717   // Build the animation
12718   Animation animationAlpha = Animation::New(0.0f);
12719   Animation animationBeta  = Animation::New(0.0f);
12720
12721   //Set duration
12722   float durationSeconds(1.0f);
12723   float delaySeconds(0.5f);
12724   animationAlpha.SetDuration(durationSeconds);
12725   animationBeta.SetDuration(durationSeconds);
12726
12727   bool progressSignalReceivedAlpha(false);
12728   bool progressSignalReceivedBeta(false);
12729
12730   AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12731   AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta");
12732
12733   DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha);
12734   DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta);
12735   application.SendNotification();
12736
12737   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12738   animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12739   animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12740
12741   tet_infoline("AnimationAlpha Progress notification set to 30%");
12742   DevelAnimation::SetProgressNotification(animationAlpha, 0.3f);
12743
12744   tet_infoline("AnimationBeta Progress notification set to ~0% (==Notify when delay is done)");
12745   DevelAnimation::SetProgressNotification(animationBeta, Math::MACHINE_EPSILON_1);
12746
12747   application.SendNotification();
12748   application.Render();
12749
12750   progressCheckAlpha.CheckSignalNotReceived();
12751   progressCheckBeta.CheckSignalNotReceived();
12752
12753   // Start the animations from 10% progress
12754   animationAlpha.PlayAfter(delaySeconds);
12755   animationBeta.PlayAfter(delaySeconds);
12756
12757   application.SendNotification();
12758   application.Render(0);                     // start animation
12759   application.Render(delaySeconds * 500.0f); // 50% wait progress
12760
12761   tet_infoline("Delay at 50% - No signals to be received");
12762
12763   progressCheckAlpha.CheckSignalNotReceived();
12764   progressCheckBeta.CheckSignalNotReceived();
12765
12766   application.SendNotification();
12767   application.Render(delaySeconds * 500.0f + durationSeconds * 50.0f); // 100% wait, 5% progress
12768   application.SendNotification();
12769   tet_infoline("Delay at 100%, Animation at 5% - Beta signal should be received");
12770   DALI_TEST_EQUALS(0.05f, animationBeta.GetCurrentProgress(), TEST_LOCATION);
12771
12772   progressCheckBeta.CheckSignalReceived();
12773   progressCheckAlpha.CheckSignalNotReceived();
12774
12775   tet_infoline("Progress check reset");
12776   progressCheckAlpha.Reset();
12777   progressCheckBeta.Reset();
12778
12779   application.Render(durationSeconds * 200.0f); // 25% progress
12780   tet_infoline("Animation at 25% - No signals to be received");
12781   application.SendNotification();
12782
12783   progressCheckAlpha.CheckSignalNotReceived();
12784   progressCheckBeta.CheckSignalNotReceived();
12785
12786   application.Render(durationSeconds * 200.0f); // 45% progress
12787   tet_infoline("Animation at 45% - Alpha should receive signal, Beta should not");
12788   application.SendNotification();
12789
12790   DALI_TEST_EQUALS(0.45f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
12791
12792   progressCheckAlpha.CheckSignalReceived();
12793   progressCheckBeta.CheckSignalNotReceived();
12794
12795   tet_infoline("Progress check reset");
12796   progressCheckAlpha.Reset();
12797   progressCheckBeta.Reset();
12798
12799   application.Render(static_cast<unsigned int>(durationSeconds * 150.0f) /* 60% progress */);
12800   application.SendNotification();
12801
12802   tet_infoline("Animation at 60%");
12803
12804   progressCheckAlpha.CheckSignalNotReceived();
12805   progressCheckBeta.CheckSignalNotReceived();
12806
12807   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
12808   application.SendNotification();
12809   tet_infoline("Animation at 80%");
12810
12811   progressCheckAlpha.CheckSignalNotReceived();
12812   progressCheckBeta.CheckSignalNotReceived();
12813
12814   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
12815   // We did expect the animation to finish
12816   tet_infoline("Animation finished");
12817
12818   END_TEST;
12819 }
12820
12821 int UtcDaliAnimationProgressCallbackWithLoopingP(void)
12822 {
12823   TestApplication application;
12824
12825   Actor actor = Actor::New();
12826   application.GetScene().Add(actor);
12827
12828   // Build the animation
12829   Animation animation = Animation::New(0.0f);
12830
12831   //Set duration
12832   const float durationSeconds(1.0f);
12833   animation.SetDuration(durationSeconds);
12834
12835   // Set Looping Count
12836   const int loopCount(4);
12837   animation.SetLoopCount(loopCount);
12838
12839   bool finishedSignalReceived(false);
12840   bool progressSignalReceived(false);
12841
12842   AnimationFinishCheck finishCheck(finishedSignalReceived);
12843   animation.FinishedSignal().Connect(&application, finishCheck);
12844
12845   AnimationProgressCheck progressCheck(progressSignalReceived);
12846   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
12847   application.SendNotification();
12848
12849   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12850   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12851
12852   tet_infoline("Animation Progress notification set to 50% with looping count 4");
12853   DevelAnimation::SetProgressNotification(animation, 0.5f);
12854
12855   application.SendNotification();
12856   application.Render();
12857
12858   progressCheck.CheckSignalNotReceived();
12859
12860   animation.Play();
12861
12862   for(int count = 0; count < loopCount; count++)
12863   {
12864     application.SendNotification();
12865     application.Render(0);                                // start animation
12866     application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
12867     DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
12868
12869     tet_infoline("Animation at 25%");
12870
12871     progressCheck.CheckSignalNotReceived();
12872
12873     application.SendNotification();
12874     application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
12875     application.SendNotification();
12876     tet_infoline("Animation at 50%");
12877     DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
12878
12879     progressCheck.CheckSignalReceived();
12880
12881     tet_infoline("Progress check reset");
12882     progressCheck.Reset();
12883
12884     application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
12885     tet_infoline("Animation at 75%");
12886     application.SendNotification();
12887
12888     DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
12889
12890     progressCheck.CheckSignalNotReceived();
12891
12892     application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
12893     tet_infoline("Animation at 100%");
12894     application.SendNotification();
12895
12896     //Nothing check at 100% progress. cause It can be both 100% and 0%.
12897     application.SendNotification();
12898   }
12899   application.Render(10u);
12900   application.SendNotification();
12901   application.Render(0u);
12902   application.SendNotification();
12903
12904   finishCheck.CheckSignalReceived();
12905
12906   END_TEST;
12907 }
12908
12909 int UtcDaliAnimationProgressCallbackWithLoopingP2(void)
12910 {
12911   TestApplication application;
12912
12913   Actor actor = Actor::New();
12914   application.GetScene().Add(actor);
12915
12916   // Build the animation
12917   Animation animation = Animation::New(0.0f);
12918
12919   //Set duration
12920   const float durationSeconds(1.0f);
12921   animation.SetDuration(durationSeconds);
12922
12923   // Set Looping Unlmited
12924   animation.SetLooping(true);
12925
12926   bool finishedSignalReceived(false);
12927   bool progressSignalReceived(false);
12928
12929   AnimationFinishCheck finishCheck(finishedSignalReceived);
12930   animation.FinishedSignal().Connect(&application, finishCheck);
12931
12932   AnimationProgressCheck progressCheck(progressSignalReceived);
12933   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
12934   application.SendNotification();
12935
12936   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12937   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12938
12939   tet_infoline("Animation Progress notification set to 50% with unlimited looping");
12940   DevelAnimation::SetProgressNotification(animation, 0.5f);
12941
12942   application.SendNotification();
12943   application.Render();
12944
12945   progressCheck.CheckSignalNotReceived();
12946
12947   animation.Play();
12948
12949   for(int count = 0; count < 4; count++)
12950   {
12951     application.SendNotification();
12952     application.Render(0);                                // start animation
12953     application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
12954     DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
12955
12956     tet_infoline("Animation at 25%");
12957
12958     progressCheck.CheckSignalNotReceived();
12959
12960     application.SendNotification();
12961     application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
12962     application.SendNotification();
12963     tet_infoline("Animation at 50%");
12964     DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
12965
12966     progressCheck.CheckSignalReceived();
12967
12968     tet_infoline("Progress check reset");
12969     progressCheck.Reset();
12970
12971     application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
12972     tet_infoline("Animation at 75%");
12973     application.SendNotification();
12974
12975     DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
12976
12977     progressCheck.CheckSignalNotReceived();
12978
12979     application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
12980     tet_infoline("Animation at 100%");
12981     application.SendNotification();
12982
12983     //Nothing check at 100% progress. cause It can be both 100% and 0%.
12984     finishCheck.CheckSignalNotReceived();
12985     application.SendNotification();
12986   }
12987   finishCheck.CheckSignalNotReceived();
12988
12989   animation.SetLooping(false);
12990   application.Render(0u);
12991   application.SendNotification();
12992   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 10u);
12993   application.SendNotification();
12994   application.Render(0u);
12995   application.SendNotification();
12996
12997   finishCheck.CheckSignalReceived();
12998
12999   END_TEST;
13000 }
13001
13002 int UtcDaliAnimationProgressCallbackNegativeSpeed(void)
13003 {
13004   TestApplication application;
13005
13006   Actor actor = Actor::New();
13007   application.GetScene().Add(actor);
13008
13009   // Build the animation
13010   Animation animation = Animation::New(0.0f);
13011
13012   //Set duration
13013   const float durationSeconds(1.0f);
13014   animation.SetDuration(durationSeconds);
13015
13016   //Set speed negative
13017   animation.SetSpeedFactor(-1.0f);
13018
13019   // Set Looping Unlmited
13020   animation.SetLooping(true);
13021
13022   bool finishedSignalReceived(false);
13023   bool progressSignalReceived(false);
13024
13025   AnimationFinishCheck finishCheck(finishedSignalReceived);
13026   animation.FinishedSignal().Connect(&application, finishCheck);
13027
13028   AnimationProgressCheck progressCheck(progressSignalReceived);
13029   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13030   application.SendNotification();
13031
13032   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13033   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13034
13035   tet_infoline("Animation Progress notification set to 50%");
13036   DevelAnimation::SetProgressNotification(animation, 0.5f);
13037
13038   application.SendNotification();
13039   application.Render();
13040
13041   progressCheck.CheckSignalNotReceived();
13042
13043   animation.Play();
13044
13045   for(int count = 0; count < 4; count++)
13046   {
13047     application.SendNotification();
13048     application.Render(0); // start animation
13049     progressCheck.CheckSignalNotReceived();
13050
13051     application.SendNotification();
13052     application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13053     DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13054
13055     tet_infoline("Animation at 25%");
13056
13057     progressCheck.CheckSignalNotReceived();
13058
13059     application.SendNotification();
13060     application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13061     application.SendNotification();
13062     tet_infoline("Animation at 50%");
13063     DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13064
13065     progressCheck.CheckSignalReceived();
13066
13067     tet_infoline("Progress check reset");
13068     progressCheck.Reset();
13069
13070     application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13071     tet_infoline("Animation at 75%");
13072     application.SendNotification();
13073
13074     DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13075
13076     progressCheck.CheckSignalNotReceived();
13077
13078     application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
13079     tet_infoline("Animation at 100%");
13080     application.SendNotification();
13081
13082     //Nothing check at 100% progress. cause It can be both 100% and 0%.
13083     finishCheck.CheckSignalNotReceived();
13084     application.SendNotification();
13085   }
13086   finishCheck.CheckSignalNotReceived();
13087
13088   animation.Stop();
13089   animation.SetLooping(false);
13090   animation.SetLoopCount(4);
13091   animation.Play();
13092   application.Render(0u);
13093   application.SendNotification();
13094
13095   for(int count = 0; count < 4; count++)
13096   {
13097     application.SendNotification();
13098     application.Render(0); // start animation
13099     progressCheck.CheckSignalNotReceived();
13100
13101     application.SendNotification();
13102     application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13103     DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13104
13105     tet_infoline("Animation at 25%");
13106
13107     progressCheck.CheckSignalNotReceived();
13108
13109     application.SendNotification();
13110     application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13111     application.SendNotification();
13112     tet_infoline("Animation at 50%");
13113     DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13114
13115     progressCheck.CheckSignalReceived();
13116
13117     tet_infoline("Progress check reset");
13118     progressCheck.Reset();
13119
13120     application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13121     tet_infoline("Animation at 75%");
13122     application.SendNotification();
13123
13124     DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13125
13126     progressCheck.CheckSignalNotReceived();
13127
13128     application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
13129     tet_infoline("Animation at 100%");
13130     application.SendNotification();
13131
13132     //Nothing check at 100% progress. cause It can be both 100% and 0%.
13133     application.SendNotification();
13134   }
13135   application.Render(10u);
13136   application.SendNotification();
13137   application.Render(0u);
13138   application.SendNotification();
13139
13140   finishCheck.CheckSignalReceived();
13141
13142   END_TEST;
13143 }
13144
13145 int UtcDaliAnimationProgressCallbackInvalidSignalN(void)
13146 {
13147   TestApplication application;
13148
13149   Actor actor = Actor::New();
13150   application.GetScene().Add(actor);
13151
13152   // Build the animation
13153   Animation animation = Animation::New(0.0f);
13154
13155   //Set duration
13156   const float durationSeconds(1.0f);
13157   animation.SetDuration(durationSeconds);
13158
13159   bool finishedSignalReceived(false);
13160   bool progressSignalReceived(false);
13161
13162   AnimationFinishCheck finishCheck(finishedSignalReceived);
13163   animation.FinishedSignal().Connect(&application, finishCheck);
13164
13165   AnimationProgressCheck progressCheck(progressSignalReceived);
13166   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13167   application.SendNotification();
13168
13169   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13170   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13171
13172   tet_infoline("Animation Progress PlayRange as 10% ~ 90%");
13173   animation.SetPlayRange(Vector2(0.1f, 0.9f));
13174
13175   tet_infoline("Animation Progress notification set to >90% that never can notificated");
13176   DevelAnimation::SetProgressNotification(animation, 0.9f + Math::MACHINE_EPSILON_1);
13177
13178   application.SendNotification();
13179   application.Render();
13180
13181   progressCheck.CheckSignalNotReceived();
13182
13183   animation.Play();
13184
13185   application.SendNotification();
13186   application.Render(0);                                // start animation
13187   application.Render(durationSeconds * 0.25 * 1000.0f); // 35% progress
13188   DALI_TEST_EQUALS(0.35f, animation.GetCurrentProgress(), TEST_LOCATION);
13189
13190   tet_infoline("Animation at 35%");
13191
13192   progressCheck.CheckSignalNotReceived();
13193
13194   application.SendNotification();
13195   application.Render(durationSeconds * 0.25 * 1000.0f); // 60% progress
13196   application.SendNotification();
13197   DALI_TEST_EQUALS(0.6f, animation.GetCurrentProgress(), TEST_LOCATION);
13198
13199   tet_infoline("Animation at 60%");
13200
13201   progressCheck.CheckSignalNotReceived();
13202
13203   application.Render(durationSeconds * 0.25 * 1000.0f); // 85% progress
13204   tet_infoline("Animation at 85%");
13205   application.SendNotification();
13206   DALI_TEST_EQUALS(0.85f, animation.GetCurrentProgress(), TEST_LOCATION);
13207
13208   progressCheck.CheckSignalNotReceived();
13209
13210   application.Render(durationSeconds * 0.25 * 1000.0f); // 90% progress
13211   tet_infoline("Animation over 90%");
13212   application.SendNotification();
13213
13214   // progress never signaled because playrange is 90%
13215   progressCheck.CheckSignalNotReceived();
13216
13217   END_TEST;
13218 }
13219
13220 int UtcDaliAnimationProgressCallbackLongDurationP(void)
13221 {
13222   TestApplication application;
13223
13224   Actor actor = Actor::New();
13225   application.GetScene().Add(actor);
13226
13227   // Build the animation
13228   Animation animation = Animation::New(0.0f);
13229
13230   //Set duration
13231   float durationSeconds(5.0f);
13232   animation.SetDuration(durationSeconds);
13233
13234   bool finishedSignalReceived(false);
13235   bool progressSignalReceived(false);
13236
13237   AnimationFinishCheck finishCheck(finishedSignalReceived);
13238   animation.FinishedSignal().Connect(&application, finishCheck);
13239
13240   AnimationProgressCheck progressCheck(progressSignalReceived);
13241   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13242   application.SendNotification();
13243
13244   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13245   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13246
13247   tet_infoline("Animation Progress notification set to 50%");
13248   DevelAnimation::SetProgressNotification(animation, 0.5f);
13249
13250   application.SendNotification();
13251   application.Render();
13252
13253   progressCheck.CheckSignalNotReceived();
13254
13255   animation.Play();
13256
13257   application.SendNotification();
13258   application.Render(0);                                // start animation
13259   application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13260   DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13261
13262   tet_infoline("Animation at 25%");
13263
13264   progressCheck.CheckSignalNotReceived();
13265
13266   application.SendNotification();
13267   application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13268   application.SendNotification();
13269   tet_infoline("Animation at 50%");
13270   DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13271
13272   progressCheck.CheckSignalReceived();
13273
13274   tet_infoline("Progress check reset");
13275   progressCheck.Reset();
13276
13277   application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13278   tet_infoline("Animation at 75%");
13279   application.SendNotification();
13280
13281   DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13282
13283   progressCheck.CheckSignalNotReceived();
13284
13285   END_TEST;
13286 }
13287
13288 int UtcDaliAnimationAnimateByInvalidParameters(void)
13289 {
13290   TestApplication application;
13291
13292   Actor actor = Actor::New();
13293   application.GetScene().Add(actor);
13294
13295   // Create the animation
13296   Animation animation = Animation::New(1.0f);
13297
13298   DALI_TEST_ASSERTION(
13299     {
13300       // non animateable property (STRING)
13301       animation.AnimateBy(Property(actor, Actor::Property::LAYOUT_DIRECTION), Property::Value("new direction"));
13302     },
13303     "Property type is not animatable");
13304
13305   DALI_TEST_ASSERTION(
13306     {
13307       // non animateable property (MATRIX)
13308       Property::Index index = actor.RegisterProperty("Foobar", Property::Value(Dali::Matrix()), Property::ANIMATABLE);
13309       animation.AnimateBy(Property(actor, index), Property::Value(Property::MATRIX));
13310     },
13311     "Property type is not animatable");
13312
13313   // AnimateBy
13314   DALI_TEST_ASSERTION(
13315     {
13316       // non animateable target (NONE)
13317       animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value());
13318     },
13319     "Target value is not animatable");
13320
13321   DALI_TEST_ASSERTION(
13322     {
13323       // non animateable target (STRING)
13324       animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value("foo"));
13325     },
13326     "Target value is not animatable");
13327
13328   DALI_TEST_ASSERTION(
13329     {
13330       // not mathing properties (VECTOR3, FLOAT)
13331       animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(10.f));
13332     },
13333     "Property and target types don't match");
13334
13335   DALI_TEST_ASSERTION(
13336     {
13337       // not mathing properties (VECTOR3.A, VECTOR2)
13338       animation.AnimateBy(Property(actor, Actor::Property::COLOR_ALPHA), Property::Value(Property::VECTOR2));
13339     },
13340     "Property and target types don't match");
13341
13342   DALI_TEST_ASSERTION(
13343     {
13344       // negative duration
13345       animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(Vector3(1, 2, 3)), TimePeriod(-1));
13346     },
13347     "Duration must be >=0");
13348
13349   END_TEST;
13350 }
13351
13352 int UtcDaliAnimationAnimateToInvalidParameters(void)
13353 {
13354   TestApplication application;
13355
13356   Actor actor = Actor::New();
13357   application.GetScene().Add(actor);
13358
13359   // Create the animation
13360   Animation animation = Animation::New(1.0f);
13361
13362   // AnimateTo
13363   DALI_TEST_ASSERTION(
13364     {
13365       // non animateable property (MAP)
13366       Property::Index index = actor.RegisterProperty("Foobar", Property::Value(Property::MAP), Property::ANIMATABLE);
13367       animation.AnimateTo(Property(actor, index), Property::Value(Property::MAP));
13368     },
13369     "Property type is not animatable");
13370
13371   DALI_TEST_ASSERTION(
13372     {
13373       // non animateable target (NONE)
13374       animation.AnimateTo(Property(actor, Actor::Property::CLIPPING_MODE), Property::Value());
13375     },
13376     "Property type is not animatable");
13377
13378   DALI_TEST_ASSERTION(
13379     {
13380       // non animateable target (ARRAY)
13381       animation.AnimateTo(Property(actor, Actor::Property::POSITION), Property::Value(Property::ARRAY));
13382     },
13383     "Target value is not animatable");
13384
13385   DALI_TEST_ASSERTION(
13386     {
13387       // non animateable target (RECTANGLE)
13388       animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(Rect<int32_t>()));
13389     },
13390     "Target value is not animatable");
13391
13392   DALI_TEST_ASSERTION(
13393     {
13394       // not mathing properties (FLOAT, INT)
13395       animation.AnimateTo(Property(actor, Actor::Property::SCALE_Y), Property::Value(10));
13396     },
13397     "Property and target types don't match");
13398
13399   DALI_TEST_ASSERTION(
13400     {
13401       // not mathing properties (VECTOR3, VECTOR2)
13402       animation.AnimateTo(Property(actor, Actor::Property::COLOR), Property::Value(Property::VECTOR2));
13403     },
13404     "Property and target types don't match");
13405
13406   DALI_TEST_ASSERTION(
13407     {
13408       // negative duration
13409       animation.AnimateTo(Property(actor, Actor::Property::POSITION), Property::Value(Vector3(1, 2, 3)), TimePeriod(-1));
13410     },
13411     "Duration must be >=0");
13412
13413   END_TEST;
13414 }
13415
13416 int UtcDaliAnimationAnimateBetweenInvalidParameters(void)
13417 {
13418   TestApplication application;
13419
13420   Actor actor = Actor::New();
13421   application.GetScene().Add(actor);
13422
13423   // Create the animation
13424   Animation animation = Animation::New(1.0f);
13425
13426   // AnimateBetween
13427   DALI_TEST_ASSERTION(
13428     {
13429       // non animateable property (ARRAY)
13430       Property::Index index     = actor.RegisterProperty("Foobar", Property::Value(Property::ARRAY), Property::ANIMATABLE);
13431       KeyFrames       keyframes = KeyFrames::New();
13432       keyframes.Add(0.5f, Property::Value(Property::ARRAY));
13433       animation.AnimateBetween(Property(actor, index), keyframes);
13434     },
13435     "Property type is not animatable");
13436
13437   DALI_TEST_ASSERTION(
13438     {
13439       // non animateable target (NONE)
13440       KeyFrames keyframes = KeyFrames::New();
13441       keyframes.Add(0.5f, Property::Value());
13442       animation.AnimateBetween(Property(actor, Actor::Property::CLIPPING_MODE), keyframes);
13443     },
13444     "Property type is not animatable");
13445
13446   DALI_TEST_ASSERTION(
13447     {
13448       // non animateable target (EXTENTS)
13449       KeyFrames keyframes = KeyFrames::New();
13450       keyframes.Add(0.5f, Property::Value(Property::EXTENTS)); // throws
13451       animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes);
13452     },
13453     "Property type is not animatable");
13454
13455   DALI_TEST_ASSERTION(
13456     {
13457       // non animateable target (RECTANGLE)
13458       KeyFrames keyframes = KeyFrames::New();
13459       keyframes.Add(0.5f, Property::Value(Property::MAP)); // throws
13460       animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes);
13461     },
13462     "Property type is not animatable");
13463
13464   DALI_TEST_ASSERTION(
13465     {
13466       // not mathing properties (VECTOR2, VECTOR4)
13467       KeyFrames keyframes = KeyFrames::New();
13468       keyframes.Add(0.5f, Property::Value(Vector4(1, 2, 3, 4)));
13469       animation.AnimateBetween(Property(actor, Actor::Property::MAXIMUM_SIZE), keyframes);
13470     },
13471     "Property and target types don't match");
13472
13473   DALI_TEST_ASSERTION(
13474     {
13475       // negative duration
13476       KeyFrames keyframes = KeyFrames::New();
13477       keyframes.Add(0.5f, Property::Value(Vector3(1, 2, 3)));
13478       animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, TimePeriod(-1));
13479     },
13480     "Duration must be >=0");
13481
13482   END_TEST;
13483 }
13484
13485 namespace // Purposefully left this in the middle as the values in this namespace are only used for the subsequent two test cases
13486 {
13487 enum TestFunction
13488 {
13489   STOP,
13490   CLEAR
13491 };
13492
13493 void CheckPropertyValuesWhenCallingAnimationMethod(TestFunction functionToTest, const char* testName)
13494 {
13495   tet_printf("Testing %s\n", testName);
13496
13497   // When an Animation::Stop() or Animation::Clear() is called, the event-side property needs to be updated appropriately
13498   // This test checks that that is being done
13499
13500   const float   durationSeconds(1.0f);
13501   unsigned int  halfAnimationDuration(static_cast<unsigned int>(durationSeconds * 1000.0f * 0.5f));
13502   const Vector3 originalPosition(Vector3::ZERO);
13503   const Vector3 targetPosition(10.0f, 10.0f, 10.0f);
13504   const Vector3 halfWayToTarget(targetPosition * 0.5f);
13505
13506   struct ExpectedValue
13507   {
13508     Animation::EndAction endAction;
13509     Vector3              expectedGetPropertyValue;
13510   };
13511
13512   ExpectedValue expectedValueTable[] =
13513     {
13514       {Animation::BAKE, halfWayToTarget},      // When baking, the current value is the final value.
13515       {Animation::BAKE_FINAL, targetPosition}, // When BakeFinal, we should jump to the final value when clearing or stopping.
13516       {Animation::DISCARD, originalPosition},  // When discarding, we should jump back to the original value when clearing or stopping.
13517     };
13518   const auto expectedValueTableCount = sizeof(expectedValueTable) / sizeof(ExpectedValue);
13519
13520   for(auto i = 0u; i < expectedValueTableCount; ++i)
13521   {
13522     TestApplication application;
13523
13524     Actor actor = Actor::New();
13525     application.GetScene().Add(actor);
13526
13527     // Build the animation
13528     Animation animation = Animation::New(durationSeconds);
13529     animation.SetEndAction(expectedValueTable[i].endAction);
13530     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13531
13532     // Start the animation
13533     animation.Play();
13534
13535     application.SendNotification();
13536     application.Render(halfAnimationDuration);
13537
13538     // Stop or Clear the animation early, both have the same effect
13539     if(functionToTest == TestFunction::STOP)
13540     {
13541       animation.Stop();
13542     }
13543     else
13544     {
13545       animation.Clear();
13546     }
13547
13548     // 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
13549     DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION);
13550     DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13551
13552     // After one frame, both values should match regardless of the End Action
13553     application.SendNotification();
13554     application.Render();
13555
13556     DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION);
13557     DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION);
13558   }
13559 }
13560 } // unnamed namespace
13561
13562 int UtcDaliAnimationStopPropertyValue(void)
13563 {
13564   CheckPropertyValuesWhenCallingAnimationMethod(TestFunction::STOP, "UtcDaliAnimationStopPropertyValue");
13565   END_TEST;
13566 }
13567
13568 int UtcDaliAnimationClearPropertyValue(void)
13569 {
13570   CheckPropertyValuesWhenCallingAnimationMethod(TestFunction::CLEAR, "UtcDaliAnimationStopPropertyValue");
13571   END_TEST;
13572 }
13573
13574 int UtcDaliAnimationPausePropertyValue(void)
13575 {
13576   const float   durationSeconds(1.0f);
13577   unsigned int  halfAnimationDuration(static_cast<unsigned int>(durationSeconds * 1000.0f * 0.5f));
13578   const Vector3 originalPosition(Vector3::ZERO);
13579   const Vector3 targetPosition(10.0f, 10.0f, 10.0f);
13580   const Vector3 halfWayToTarget(targetPosition * 0.5f);
13581
13582   Animation::EndAction endActions[] =
13583     {
13584       Animation::BAKE,
13585       Animation::BAKE_FINAL,
13586       Animation::DISCARD,
13587     };
13588   const auto endActionCount = sizeof(endActions) / sizeof(endActions[0]);
13589
13590   // For all end actions, when pausing, we stay at the current value
13591   for(auto i = 0u; i < endActionCount; ++i)
13592   {
13593     TestApplication application;
13594
13595     Actor actor = Actor::New();
13596     application.GetScene().Add(actor);
13597
13598     // Build the animation
13599     Animation animation = Animation::New(durationSeconds);
13600     animation.SetEndAction(endActions[i]);
13601     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13602
13603     // Start the animation
13604     animation.Play();
13605
13606     application.SendNotification();
13607     application.Render(halfAnimationDuration);
13608
13609     // Puase the animation early
13610     animation.Pause();
13611
13612     // The event side property should be set the current value immediately, the update side property will still only be halfway
13613     DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13614     DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13615
13616     // After one frame, both values should match regardless of the End Action
13617     application.SendNotification();
13618     application.Render();
13619
13620     DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13621     DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13622   }
13623
13624   END_TEST;
13625 }
13626
13627 int UtcDaliAnimationPlayFromWithLoopCount(void)
13628 {
13629   TestApplication application;
13630
13631   auto actor = Actor::New();
13632   application.GetScene().Add(actor);
13633
13634   auto animation = Animation::New(1.0f);
13635   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f);
13636   animation.SetLoopCount(2);
13637   animation.Play();
13638
13639   application.SendNotification();
13640   application.Render(1001);
13641
13642   // One loop completed
13643
13644   application.Render(2005);
13645   application.SendNotification();
13646
13647   // 2 loops should have completed
13648   DALI_TEST_EQUALS(animation.GetCurrentLoop(), 2u, TEST_LOCATION);
13649
13650   // Another render needs to occur after all the loops end
13651   application.SendNotification();
13652   application.Render(1000);
13653
13654   // Stop the animation and use PlayFrom, previously we got an Assert here
13655   animation.Stop();
13656   animation.PlayFrom(0.5f);
13657
13658   application.SendNotification();
13659   application.Render(1000);
13660
13661   DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
13662
13663   END_TEST;
13664 }
13665
13666 int UtcDaliAnimationCombineToAndByWithStop(void)
13667 {
13668   tet_infoline("Ensure the Y Position is not modified when animating the X position using AnimateTo and AnimateBy");
13669
13670   TestApplication application;
13671
13672   auto actor = Actor::New();
13673   actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
13674   application.GetScene().Add(actor);
13675
13676   auto        animation = Animation::New(1.0f);
13677   const float origY     = actor.GetProperty(Actor::Property::POSITION_Y).Get<float>();
13678   animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(150.0f, origY, 0.0f), TimePeriod(1.0f));
13679   animation.AnimateBy(Property(actor, Actor::Property::POSITION), Vector3(-30.0f, 0.0f, 0.0f), TimePeriod(1.0f, 1.0f));
13680   animation.Play();
13681
13682   application.SendNotification();
13683   application.Render(500);
13684
13685   application.SendNotification();
13686   application.Render(500);
13687
13688   application.SendNotification();
13689   application.Render(500);
13690
13691   // Stop and clear the animation using the current values
13692   animation.Stop();
13693   animation.Clear();
13694
13695   // Check the y position, it should be the same as before
13696   DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Y).Get<float>(), origY, TEST_LOCATION);
13697
13698   END_TEST;
13699 }
13700
13701 int UtcDaliAnimationCountAndGetAnimationAt(void)
13702 {
13703   tet_infoline("UtcDaliAnimationCountAndGetAnimationAt");
13704
13705   TestApplication application;
13706
13707   auto actor = Actor::New();
13708   actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
13709   application.GetScene().Add(actor);
13710
13711   auto        animation = Animation::New(1.0f);
13712   const float origY     = actor.GetProperty(Actor::Property::POSITION_Y).Get<float>();
13713   animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(150.0f, origY, 0.0f), TimePeriod(1.0f));
13714   animation.Play();
13715
13716   application.SendNotification();
13717   application.Render(500);
13718
13719   uint32_t animationCount = Dali::DevelAnimation::GetAnimationCount();
13720   DALI_TEST_EQUALS(animationCount, 1, TEST_LOCATION);
13721
13722   DALI_TEST_CHECK(!Dali::DevelAnimation::GetAnimationAt(5));
13723
13724   Dali::Animation animationReturned = Dali::DevelAnimation::GetAnimationAt(0);
13725   DALI_TEST_EQUALS(animationReturned.GetState(), Dali::Animation::State::PLAYING, TEST_LOCATION);
13726
13727   DALI_TEST_EQUALS(animation.GetDuration(), animationReturned.GetDuration(), TEST_LOCATION);
13728   DALI_TEST_EQUALS(animation.GetLoopCount(), animationReturned.GetLoopCount(), TEST_LOCATION);
13729   DALI_TEST_EQUALS(animation.IsLooping(), animationReturned.IsLooping(), TEST_LOCATION);
13730   DALI_TEST_EQUALS(animation.GetEndAction(), animationReturned.GetEndAction(), TEST_LOCATION);
13731   DALI_TEST_EQUALS(animation.GetState(), animationReturned.GetState(), TEST_LOCATION);
13732
13733   // Stop and clear the animation using the current values
13734   animation.Stop();
13735   animation.Clear();
13736
13737   END_TEST;
13738 }
13739
13740 int UtcDaliAnimationSetLoopingNegative(void)
13741 {
13742   TestApplication application;
13743   Dali::Animation instance;
13744   try
13745   {
13746     bool arg1(false);
13747     instance.SetLooping(arg1);
13748     DALI_TEST_CHECK(false); // Should not get here
13749   }
13750   catch(...)
13751   {
13752     DALI_TEST_CHECK(true); // We expect an assert
13753   }
13754   END_TEST;
13755 }
13756
13757 int UtcDaliAnimationSetDurationNegative(void)
13758 {
13759   TestApplication application;
13760   Dali::Animation instance;
13761   try
13762   {
13763     float arg1(0.0f);
13764     instance.SetDuration(arg1);
13765     DALI_TEST_CHECK(false); // Should not get here
13766   }
13767   catch(...)
13768   {
13769     DALI_TEST_CHECK(true); // We expect an assert
13770   }
13771   END_TEST;
13772 }
13773
13774 int UtcDaliAnimationGetLoopCountNegative(void)
13775 {
13776   TestApplication application;
13777   Dali::Animation instance;
13778   try
13779   {
13780     instance.GetLoopCount();
13781     DALI_TEST_CHECK(false); // Should not get here
13782   }
13783   catch(...)
13784   {
13785     DALI_TEST_CHECK(true); // We expect an assert
13786   }
13787   END_TEST;
13788 }
13789
13790 int UtcDaliAnimationSetEndActionNegative(void)
13791 {
13792   TestApplication application;
13793   Dali::Animation instance;
13794   try
13795   {
13796     Dali::Animation::EndAction arg1(Animation::BAKE);
13797     instance.SetEndAction(arg1);
13798     DALI_TEST_CHECK(false); // Should not get here
13799   }
13800   catch(...)
13801   {
13802     DALI_TEST_CHECK(true); // We expect an assert
13803   }
13804   END_TEST;
13805 }
13806
13807 int UtcDaliAnimationSetLoopCountNegative(void)
13808 {
13809   TestApplication application;
13810   Dali::Animation instance;
13811   try
13812   {
13813     int arg1(0);
13814     instance.SetLoopCount(arg1);
13815     DALI_TEST_CHECK(false); // Should not get here
13816   }
13817   catch(...)
13818   {
13819     DALI_TEST_CHECK(true); // We expect an assert
13820   }
13821   END_TEST;
13822 }
13823
13824 int UtcDaliAnimationSetPlayRangeNegative(void)
13825 {
13826   TestApplication application;
13827   Dali::Animation instance;
13828   try
13829   {
13830     Dali::Vector2 arg1;
13831     instance.SetPlayRange(arg1);
13832     DALI_TEST_CHECK(false); // Should not get here
13833   }
13834   catch(...)
13835   {
13836     DALI_TEST_CHECK(true); // We expect an assert
13837   }
13838   END_TEST;
13839 }
13840
13841 int UtcDaliAnimationAnimateBetweenNegative01(void)
13842 {
13843   TestApplication application;
13844   Dali::Animation instance;
13845   Dali::Actor     actor;
13846   try
13847   {
13848     Dali::Property  arg1(actor, Actor::Property::POSITION);
13849     Dali::KeyFrames arg2;
13850     instance.AnimateBetween(arg1, arg2);
13851     DALI_TEST_CHECK(false); // Should not get here
13852   }
13853   catch(...)
13854   {
13855     DALI_TEST_CHECK(true); // We expect an assert
13856   }
13857   END_TEST;
13858 }
13859
13860 int UtcDaliAnimationAnimateBetweenNegative02(void)
13861 {
13862   TestApplication application;
13863   Dali::Animation instance;
13864   Dali::Actor     actor;
13865   try
13866   {
13867     Dali::Property                 arg1(actor, Actor::Property::POSITION);
13868     Dali::KeyFrames                arg2;
13869     Dali::Animation::Interpolation arg3(Animation::LINEAR);
13870     instance.AnimateBetween(arg1, arg2, arg3);
13871     DALI_TEST_CHECK(false); // Should not get here
13872   }
13873   catch(...)
13874   {
13875     DALI_TEST_CHECK(true); // We expect an assert
13876   }
13877   END_TEST;
13878 }
13879
13880 int UtcDaliAnimationAnimateBetweenNegative03(void)
13881 {
13882   TestApplication application;
13883   Dali::Animation instance;
13884   Dali::Actor     actor;
13885   try
13886   {
13887     Dali::Property   arg1(actor, Actor::Property::POSITION);
13888     Dali::KeyFrames  arg2;
13889     Dali::TimePeriod arg3(1.0f);
13890     instance.AnimateBetween(arg1, arg2, arg3);
13891     DALI_TEST_CHECK(false); // Should not get here
13892   }
13893   catch(...)
13894   {
13895     DALI_TEST_CHECK(true); // We expect an assert
13896   }
13897   END_TEST;
13898 }
13899
13900 int UtcDaliAnimationAnimateBetweenNegative04(void)
13901 {
13902   TestApplication application;
13903   Dali::Animation instance;
13904   Dali::Actor     actor;
13905   try
13906   {
13907     Dali::Property                 arg1(actor, Actor::Property::POSITION);
13908     Dali::KeyFrames                arg2;
13909     Dali::TimePeriod               arg3(1.0f);
13910     Dali::Animation::Interpolation arg4(Animation::LINEAR);
13911     instance.AnimateBetween(arg1, arg2, arg3, arg4);
13912     DALI_TEST_CHECK(false); // Should not get here
13913   }
13914   catch(...)
13915   {
13916     DALI_TEST_CHECK(true); // We expect an assert
13917   }
13918   END_TEST;
13919 }
13920
13921 int UtcDaliAnimationAnimateBetweenNegative05(void)
13922 {
13923   TestApplication application;
13924   Dali::Animation instance;
13925   Dali::Actor     actor;
13926   try
13927   {
13928     Dali::Property      arg1(actor, Actor::Property::POSITION);
13929     Dali::KeyFrames     arg2;
13930     Dali::AlphaFunction arg3;
13931     instance.AnimateBetween(arg1, arg2, arg3);
13932     DALI_TEST_CHECK(false); // Should not get here
13933   }
13934   catch(...)
13935   {
13936     DALI_TEST_CHECK(true); // We expect an assert
13937   }
13938   END_TEST;
13939 }
13940
13941 int UtcDaliAnimationAnimateBetweenNegative06(void)
13942 {
13943   TestApplication application;
13944   Dali::Animation instance;
13945   Dali::Actor     actor;
13946   try
13947   {
13948     Dali::Property                 arg1(actor, Actor::Property::POSITION);
13949     Dali::KeyFrames                arg2;
13950     Dali::AlphaFunction            arg3;
13951     Dali::Animation::Interpolation arg4(Animation::LINEAR);
13952     instance.AnimateBetween(arg1, arg2, arg3, arg4);
13953     DALI_TEST_CHECK(false); // Should not get here
13954   }
13955   catch(...)
13956   {
13957     DALI_TEST_CHECK(true); // We expect an assert
13958   }
13959   END_TEST;
13960 }
13961
13962 int UtcDaliAnimationAnimateBetweenNegative07(void)
13963 {
13964   TestApplication application;
13965   Dali::Animation instance;
13966   Dali::Actor     actor;
13967   try
13968   {
13969     Dali::Property      arg1(actor, Actor::Property::POSITION);
13970     Dali::KeyFrames     arg2;
13971     Dali::AlphaFunction arg3;
13972     Dali::TimePeriod    arg4(1.0f);
13973     instance.AnimateBetween(arg1, arg2, arg3, arg4);
13974     DALI_TEST_CHECK(false); // Should not get here
13975   }
13976   catch(...)
13977   {
13978     DALI_TEST_CHECK(true); // We expect an assert
13979   }
13980   END_TEST;
13981 }
13982
13983 int UtcDaliAnimationAnimateBetweenNegative08(void)
13984 {
13985   TestApplication application;
13986   Dali::Animation instance;
13987   Dali::Actor     actor;
13988   try
13989   {
13990     Dali::Property                 arg1(actor, Actor::Property::POSITION);
13991     Dali::KeyFrames                arg2;
13992     Dali::AlphaFunction            arg3;
13993     Dali::TimePeriod               arg4(1.0f);
13994     Dali::Animation::Interpolation arg5(Animation::LINEAR);
13995     instance.AnimateBetween(arg1, arg2, arg3, arg4, arg5);
13996     DALI_TEST_CHECK(false); // Should not get here
13997   }
13998   catch(...)
13999   {
14000     DALI_TEST_CHECK(true); // We expect an assert
14001   }
14002   END_TEST;
14003 }
14004
14005 int UtcDaliAnimationFinishedSignalNegative(void)
14006 {
14007   TestApplication application;
14008   Dali::Animation instance;
14009   try
14010   {
14011     instance.FinishedSignal();
14012     DALI_TEST_CHECK(false); // Should not get here
14013   }
14014   catch(...)
14015   {
14016     DALI_TEST_CHECK(true); // We expect an assert
14017   }
14018   END_TEST;
14019 }
14020
14021 int UtcDaliAnimationGetCurrentLoopNegative(void)
14022 {
14023   TestApplication application;
14024   Dali::Animation instance;
14025   try
14026   {
14027     instance.GetCurrentLoop();
14028     DALI_TEST_CHECK(false); // Should not get here
14029   }
14030   catch(...)
14031   {
14032     DALI_TEST_CHECK(true); // We expect an assert
14033   }
14034   END_TEST;
14035 }
14036
14037 int UtcDaliAnimationSetLoopingModeNegative(void)
14038 {
14039   TestApplication application;
14040   Dali::Animation instance;
14041   try
14042   {
14043     Dali::Animation::LoopingMode arg1(Animation::RESTART);
14044     instance.SetLoopingMode(arg1);
14045     DALI_TEST_CHECK(false); // Should not get here
14046   }
14047   catch(...)
14048   {
14049     DALI_TEST_CHECK(true); // We expect an assert
14050   }
14051   END_TEST;
14052 }
14053
14054 int UtcDaliAnimationSetSpeedFactorNegative(void)
14055 {
14056   TestApplication application;
14057   Dali::Animation instance;
14058   try
14059   {
14060     float arg1(0.0f);
14061     instance.SetSpeedFactor(arg1);
14062     DALI_TEST_CHECK(false); // Should not get here
14063   }
14064   catch(...)
14065   {
14066     DALI_TEST_CHECK(true); // We expect an assert
14067   }
14068   END_TEST;
14069 }
14070
14071 int UtcDaliAnimationGetCurrentProgressNegative(void)
14072 {
14073   TestApplication application;
14074   Dali::Animation instance;
14075   try
14076   {
14077     instance.GetCurrentProgress();
14078     DALI_TEST_CHECK(false); // Should not get here
14079   }
14080   catch(...)
14081   {
14082     DALI_TEST_CHECK(true); // We expect an assert
14083   }
14084   END_TEST;
14085 }
14086
14087 int UtcDaliAnimationSetCurrentProgressNegative(void)
14088 {
14089   TestApplication application;
14090   Dali::Animation instance;
14091   try
14092   {
14093     float arg1(0.0f);
14094     instance.SetCurrentProgress(arg1);
14095     DALI_TEST_CHECK(false); // Should not get here
14096   }
14097   catch(...)
14098   {
14099     DALI_TEST_CHECK(true); // We expect an assert
14100   }
14101   END_TEST;
14102 }
14103
14104 int UtcDaliAnimationSetDisconnectActionNegative(void)
14105 {
14106   TestApplication application;
14107   Dali::Animation instance;
14108   try
14109   {
14110     Dali::Animation::EndAction arg1(Animation::BAKE);
14111     instance.SetDisconnectAction(arg1);
14112     DALI_TEST_CHECK(false); // Should not get here
14113   }
14114   catch(...)
14115   {
14116     DALI_TEST_CHECK(true); // We expect an assert
14117   }
14118   END_TEST;
14119 }
14120
14121 int UtcDaliAnimationSetDefaultAlphaFunctionNegative(void)
14122 {
14123   TestApplication application;
14124   Dali::Animation instance;
14125   try
14126   {
14127     Dali::AlphaFunction arg1;
14128     instance.SetDefaultAlphaFunction(arg1);
14129     DALI_TEST_CHECK(false); // Should not get here
14130   }
14131   catch(...)
14132   {
14133     DALI_TEST_CHECK(true); // We expect an assert
14134   }
14135   END_TEST;
14136 }
14137
14138 int UtcDaliAnimationHideNegative(void)
14139 {
14140   TestApplication application;
14141   Dali::Animation instance;
14142   try
14143   {
14144     Dali::Actor arg1;
14145     float       arg2(0.0f);
14146     instance.Hide(arg1, arg2);
14147     DALI_TEST_CHECK(false); // Should not get here
14148   }
14149   catch(...)
14150   {
14151     DALI_TEST_CHECK(true); // We expect an assert
14152   }
14153   END_TEST;
14154 }
14155
14156 int UtcDaliAnimationPlayNegative(void)
14157 {
14158   TestApplication application;
14159   Dali::Animation instance;
14160   try
14161   {
14162     instance.Play();
14163     DALI_TEST_CHECK(false); // Should not get here
14164   }
14165   catch(...)
14166   {
14167     DALI_TEST_CHECK(true); // We expect an assert
14168   }
14169   END_TEST;
14170 }
14171
14172 int UtcDaliAnimationShowNegative(void)
14173 {
14174   TestApplication application;
14175   Dali::Animation instance;
14176   try
14177   {
14178     Dali::Actor arg1;
14179     float       arg2(0.0f);
14180     instance.Show(arg1, arg2);
14181     DALI_TEST_CHECK(false); // Should not get here
14182   }
14183   catch(...)
14184   {
14185     DALI_TEST_CHECK(true); // We expect an assert
14186   }
14187   END_TEST;
14188 }
14189
14190 int UtcDaliAnimationStopNegative(void)
14191 {
14192   TestApplication application;
14193   Dali::Animation instance;
14194   try
14195   {
14196     instance.Stop();
14197     DALI_TEST_CHECK(false); // Should not get here
14198   }
14199   catch(...)
14200   {
14201     DALI_TEST_CHECK(true); // We expect an assert
14202   }
14203   END_TEST;
14204 }
14205
14206 int UtcDaliAnimationClearNegative(void)
14207 {
14208   TestApplication application;
14209   Dali::Animation instance;
14210   try
14211   {
14212     instance.Clear();
14213     DALI_TEST_CHECK(false); // Should not get here
14214   }
14215   catch(...)
14216   {
14217     DALI_TEST_CHECK(true); // We expect an assert
14218   }
14219   END_TEST;
14220 }
14221
14222 int UtcDaliAnimationPauseNegative(void)
14223 {
14224   TestApplication application;
14225   Dali::Animation instance;
14226   try
14227   {
14228     instance.Pause();
14229     DALI_TEST_CHECK(false); // Should not get here
14230   }
14231   catch(...)
14232   {
14233     DALI_TEST_CHECK(true); // We expect an assert
14234   }
14235   END_TEST;
14236 }
14237
14238 int UtcDaliAnimationAnimateNegative01(void)
14239 {
14240   TestApplication application;
14241   Dali::Animation instance;
14242   try
14243   {
14244     Dali::Actor   arg1;
14245     Dali::Path    arg2;
14246     Dali::Vector3 arg3;
14247     instance.Animate(arg1, arg2, arg3);
14248     DALI_TEST_CHECK(false); // Should not get here
14249   }
14250   catch(...)
14251   {
14252     DALI_TEST_CHECK(true); // We expect an assert
14253   }
14254   END_TEST;
14255 }
14256
14257 int UtcDaliAnimationAnimateNegative02(void)
14258 {
14259   TestApplication application;
14260   Dali::Animation instance;
14261   try
14262   {
14263     Dali::Actor      arg1;
14264     Dali::Path       arg2;
14265     Dali::Vector3    arg3;
14266     Dali::TimePeriod arg4(1.0f);
14267     instance.Animate(arg1, arg2, arg3, arg4);
14268     DALI_TEST_CHECK(false); // Should not get here
14269   }
14270   catch(...)
14271   {
14272     DALI_TEST_CHECK(true); // We expect an assert
14273   }
14274   END_TEST;
14275 }
14276
14277 int UtcDaliAnimationAnimateNegative03(void)
14278 {
14279   TestApplication application;
14280   Dali::Animation instance;
14281   try
14282   {
14283     Dali::Actor         arg1;
14284     Dali::Path          arg2;
14285     Dali::Vector3       arg3;
14286     Dali::AlphaFunction arg4;
14287     instance.Animate(arg1, arg2, arg3, arg4);
14288     DALI_TEST_CHECK(false); // Should not get here
14289   }
14290   catch(...)
14291   {
14292     DALI_TEST_CHECK(true); // We expect an assert
14293   }
14294   END_TEST;
14295 }
14296
14297 int UtcDaliAnimationAnimateNegative04(void)
14298 {
14299   TestApplication application;
14300   Dali::Animation instance;
14301   try
14302   {
14303     Dali::Actor         arg1;
14304     Dali::Path          arg2;
14305     Dali::Vector3       arg3;
14306     Dali::AlphaFunction arg4;
14307     Dali::TimePeriod    arg5(1.0f);
14308     instance.Animate(arg1, arg2, arg3, arg4, arg5);
14309     DALI_TEST_CHECK(false); // Should not get here
14310   }
14311   catch(...)
14312   {
14313     DALI_TEST_CHECK(true); // We expect an assert
14314   }
14315   END_TEST;
14316 }
14317
14318 int UtcDaliAnimationPlayFromNegative(void)
14319 {
14320   TestApplication application;
14321   Dali::Animation instance;
14322   try
14323   {
14324     float arg1(0.0f);
14325     instance.PlayFrom(arg1);
14326     DALI_TEST_CHECK(false); // Should not get here
14327   }
14328   catch(...)
14329   {
14330     DALI_TEST_CHECK(true); // We expect an assert
14331   }
14332   END_TEST;
14333 }
14334
14335 int UtcDaliAnimationAnimateByNegative01(void)
14336 {
14337   TestApplication application;
14338   Dali::Animation instance;
14339   Dali::Actor     actor;
14340   try
14341   {
14342     Dali::Property        arg1(actor, Actor::Property::POSITION);
14343     Dali::Property::Value arg2;
14344     instance.AnimateBy(arg1, arg2);
14345     DALI_TEST_CHECK(false); // Should not get here
14346   }
14347   catch(...)
14348   {
14349     DALI_TEST_CHECK(true); // We expect an assert
14350   }
14351   END_TEST;
14352 }
14353
14354 int UtcDaliAnimationAnimateByNegative02(void)
14355 {
14356   TestApplication application;
14357   Dali::Animation instance;
14358   Dali::Actor     actor;
14359   try
14360   {
14361     Dali::Property        arg1(actor, Actor::Property::POSITION);
14362     Dali::Property::Value arg2;
14363     Dali::TimePeriod      arg3(1.0f);
14364     instance.AnimateBy(arg1, arg2, arg3);
14365     DALI_TEST_CHECK(false); // Should not get here
14366   }
14367   catch(...)
14368   {
14369     DALI_TEST_CHECK(true); // We expect an assert
14370   }
14371   END_TEST;
14372 }
14373
14374 int UtcDaliAnimationAnimateByNegative03(void)
14375 {
14376   TestApplication application;
14377   Dali::Animation instance;
14378   Dali::Actor     actor;
14379   try
14380   {
14381     Dali::Property        arg1(actor, Actor::Property::POSITION);
14382     Dali::Property::Value arg2;
14383     Dali::AlphaFunction   arg3;
14384     instance.AnimateBy(arg1, arg2, arg3);
14385     DALI_TEST_CHECK(false); // Should not get here
14386   }
14387   catch(...)
14388   {
14389     DALI_TEST_CHECK(true); // We expect an assert
14390   }
14391   END_TEST;
14392 }
14393
14394 int UtcDaliAnimationAnimateByNegative04(void)
14395 {
14396   TestApplication application;
14397   Dali::Animation instance;
14398   Dali::Actor     actor;
14399   try
14400   {
14401     Dali::Property        arg1(actor, Actor::Property::POSITION);
14402     Dali::Property::Value arg2;
14403     Dali::AlphaFunction   arg3;
14404     Dali::TimePeriod      arg4(1.0f);
14405     instance.AnimateBy(arg1, arg2, arg3, arg4);
14406     DALI_TEST_CHECK(false); // Should not get here
14407   }
14408   catch(...)
14409   {
14410     DALI_TEST_CHECK(true); // We expect an assert
14411   }
14412   END_TEST;
14413 }
14414
14415 int UtcDaliAnimationAnimateToNegative01(void)
14416 {
14417   TestApplication application;
14418   Dali::Actor     actor;
14419   Dali::Animation instance;
14420   try
14421   {
14422     Dali::Property        arg1(actor, Actor::Property::POSITION);
14423     Dali::Property::Value arg2;
14424     instance.AnimateTo(arg1, arg2);
14425     DALI_TEST_CHECK(false); // Should not get here
14426   }
14427   catch(...)
14428   {
14429     DALI_TEST_CHECK(true); // We expect an assert
14430   }
14431   END_TEST;
14432 }
14433
14434 int UtcDaliAnimationAnimateToNegative02(void)
14435 {
14436   TestApplication application;
14437   Dali::Animation instance;
14438   Dali::Actor     actor;
14439   try
14440   {
14441     Dali::Property        arg1(actor, Actor::Property::POSITION);
14442     Dali::Property::Value arg2;
14443     Dali::TimePeriod      arg3(1.0f);
14444     instance.AnimateTo(arg1, arg2, arg3);
14445     DALI_TEST_CHECK(false); // Should not get here
14446   }
14447   catch(...)
14448   {
14449     DALI_TEST_CHECK(true); // We expect an assert
14450   }
14451   END_TEST;
14452 }
14453
14454 int UtcDaliAnimationAnimateToNegative03(void)
14455 {
14456   TestApplication application;
14457   Dali::Animation instance;
14458   Dali::Actor     actor;
14459   try
14460   {
14461     Dali::Property        arg1(actor, Actor::Property::POSITION);
14462     Dali::Property::Value arg2;
14463     Dali::AlphaFunction   arg3;
14464     instance.AnimateTo(arg1, arg2, arg3);
14465     DALI_TEST_CHECK(false); // Should not get here
14466   }
14467   catch(...)
14468   {
14469     DALI_TEST_CHECK(true); // We expect an assert
14470   }
14471   END_TEST;
14472 }
14473
14474 int UtcDaliAnimationAnimateToNegative04(void)
14475 {
14476   TestApplication application;
14477   Dali::Animation instance;
14478   Dali::Actor     actor;
14479   try
14480   {
14481     Dali::Property        arg1(actor, Actor::Property::POSITION);
14482     Dali::Property::Value arg2;
14483     Dali::AlphaFunction   arg3;
14484     Dali::TimePeriod      arg4(1.0f);
14485     instance.AnimateTo(arg1, arg2, arg3, arg4);
14486     DALI_TEST_CHECK(false); // Should not get here
14487   }
14488   catch(...)
14489   {
14490     DALI_TEST_CHECK(true); // We expect an assert
14491   }
14492   END_TEST;
14493 }
14494
14495 int UtcDaliAnimationPlayAfterNegative(void)
14496 {
14497   TestApplication application;
14498   Dali::Animation instance;
14499   try
14500   {
14501     float arg1(0.0f);
14502     instance.PlayAfter(arg1);
14503     DALI_TEST_CHECK(false); // Should not get here
14504   }
14505   catch(...)
14506   {
14507     DALI_TEST_CHECK(true); // We expect an assert
14508   }
14509   END_TEST;
14510 }
14511
14512 int UtcDaliAnimationGetDurationNegative(void)
14513 {
14514   TestApplication application;
14515   Dali::Animation instance;
14516   try
14517   {
14518     instance.GetDuration();
14519     DALI_TEST_CHECK(false); // Should not get here
14520   }
14521   catch(...)
14522   {
14523     DALI_TEST_CHECK(true); // We expect an assert
14524   }
14525   END_TEST;
14526 }
14527
14528 int UtcDaliAnimationGetEndActionNegative(void)
14529 {
14530   TestApplication application;
14531   Dali::Animation instance;
14532   try
14533   {
14534     instance.GetEndAction();
14535     DALI_TEST_CHECK(false); // Should not get here
14536   }
14537   catch(...)
14538   {
14539     DALI_TEST_CHECK(true); // We expect an assert
14540   }
14541   END_TEST;
14542 }
14543
14544 int UtcDaliAnimationGetPlayRangeNegative(void)
14545 {
14546   TestApplication application;
14547   Dali::Animation instance;
14548   try
14549   {
14550     instance.GetPlayRange();
14551     DALI_TEST_CHECK(false); // Should not get here
14552   }
14553   catch(...)
14554   {
14555     DALI_TEST_CHECK(true); // We expect an assert
14556   }
14557   END_TEST;
14558 }
14559
14560 int UtcDaliAnimationGetLoopingModeNegative(void)
14561 {
14562   TestApplication application;
14563   Dali::Animation instance;
14564   try
14565   {
14566     instance.GetLoopingMode();
14567     DALI_TEST_CHECK(false); // Should not get here
14568   }
14569   catch(...)
14570   {
14571     DALI_TEST_CHECK(true); // We expect an assert
14572   }
14573   END_TEST;
14574 }
14575
14576 int UtcDaliAnimationGetSpeedFactorNegative(void)
14577 {
14578   TestApplication application;
14579   Dali::Animation instance;
14580   try
14581   {
14582     instance.GetSpeedFactor();
14583     DALI_TEST_CHECK(false); // Should not get here
14584   }
14585   catch(...)
14586   {
14587     DALI_TEST_CHECK(true); // We expect an assert
14588   }
14589   END_TEST;
14590 }
14591
14592 int UtcDaliAnimationGetDisconnectActionNegative(void)
14593 {
14594   TestApplication application;
14595   Dali::Animation instance;
14596   try
14597   {
14598     instance.GetDisconnectAction();
14599     DALI_TEST_CHECK(false); // Should not get here
14600   }
14601   catch(...)
14602   {
14603     DALI_TEST_CHECK(true); // We expect an assert
14604   }
14605   END_TEST;
14606 }
14607
14608 int UtcDaliAnimationGetDefaultAlphaFunctionNegative(void)
14609 {
14610   TestApplication application;
14611   Dali::Animation instance;
14612   try
14613   {
14614     instance.GetDefaultAlphaFunction();
14615     DALI_TEST_CHECK(false); // Should not get here
14616   }
14617   catch(...)
14618   {
14619     DALI_TEST_CHECK(true); // We expect an assert
14620   }
14621   END_TEST;
14622 }
14623
14624 int UtcDaliAnimationGetStateNegative(void)
14625 {
14626   TestApplication application;
14627   Dali::Animation instance;
14628   try
14629   {
14630     instance.GetState();
14631     DALI_TEST_CHECK(false); // Should not get here
14632   }
14633   catch(...)
14634   {
14635     DALI_TEST_CHECK(true); // We expect an assert
14636   }
14637   END_TEST;
14638 }
14639
14640 int UtcDaliAnimationIsLoopingNegative(void)
14641 {
14642   TestApplication application;
14643   Dali::Animation instance;
14644   try
14645   {
14646     instance.IsLooping();
14647     DALI_TEST_CHECK(false); // Should not get here
14648   }
14649   catch(...)
14650   {
14651     DALI_TEST_CHECK(true); // We expect an assert
14652   }
14653   END_TEST;
14654 }
14655
14656 int UtcDaliKeyFramesAddNegative01(void)
14657 {
14658   TestApplication application;
14659   Dali::KeyFrames instance;
14660   try
14661   {
14662     float                 arg1(0.0f);
14663     Dali::Property::Value arg2;
14664     instance.Add(arg1, arg2);
14665     DALI_TEST_CHECK(false); // Should not get here
14666   }
14667   catch(...)
14668   {
14669     DALI_TEST_CHECK(true); // We expect an assert
14670   }
14671   END_TEST;
14672 }
14673
14674 int UtcDaliKeyFramesAddNegative02(void)
14675 {
14676   TestApplication application;
14677   Dali::KeyFrames instance;
14678   try
14679   {
14680     float                 arg1(0.0f);
14681     Dali::Property::Value arg2;
14682     Dali::AlphaFunction   arg3;
14683     instance.Add(arg1, arg2, arg3);
14684     DALI_TEST_CHECK(false); // Should not get here
14685   }
14686   catch(...)
14687   {
14688     DALI_TEST_CHECK(true); // We expect an assert
14689   }
14690   END_TEST;
14691 }
14692
14693 int UtcDaliKeyFramesGetTypeNegative(void)
14694 {
14695   TestApplication application;
14696   Dali::KeyFrames instance;
14697   try
14698   {
14699     instance.GetType();
14700     DALI_TEST_CHECK(false); // Should not get here
14701   }
14702   catch(...)
14703   {
14704     DALI_TEST_CHECK(true); // We expect an assert
14705   }
14706   END_TEST;
14707 }