[Tizen] Do not call NotifyObjects in case of finished animations
[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 UtcDaliAnimationPlayOffSceneP(void)
2220 {
2221   // Test that an animation cannot be played, when the actor is off-stage.
2222   // And the property value and the current property value should not be changed in the case.
2223
2224   TestApplication application;
2225
2226   Actor   actor = Actor::New();
2227   Vector3 basePosition(Vector3::ZERO);
2228   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2229   // Not added to the stage yet!
2230
2231   // Build the animation
2232   float     durationSeconds(1.0f);
2233   Animation animation = Animation::New(durationSeconds);
2234   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2235   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2236
2237   // Start the animation
2238   animation.Play();
2239
2240   bool                 signalReceived(false);
2241   AnimationFinishCheck finishCheck(signalReceived);
2242   animation.FinishedSignal().Connect(&application, finishCheck);
2243
2244   application.SendNotification();
2245   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
2246
2247   application.SendNotification();
2248   finishCheck.CheckSignalReceived();
2249
2250   // An animation can't be played. The position shouldn't be changed.
2251   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2252   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2253
2254   // Add to the stage
2255   application.GetScene().Add(actor);
2256
2257   // Start the animation again
2258   animation.Play();
2259
2260   application.SendNotification();
2261   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
2262
2263   // We did expect the animation to finish
2264   application.SendNotification();
2265   finishCheck.CheckSignalReceived();
2266
2267   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2268   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2269
2270   // Reset the position
2271   actor[Actor::Property::POSITION] = basePosition;
2272
2273   application.SendNotification();
2274   application.Render();
2275
2276   // Create an animator again
2277   animation.Clear();
2278   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2279
2280   // Remove from the stage
2281   application.GetScene().Remove(actor);
2282
2283   signalReceived = false;
2284
2285   // Start the animation again
2286   animation.Play();
2287
2288   application.SendNotification();
2289   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
2290
2291   application.SendNotification();
2292   finishCheck.CheckSignalReceived();
2293
2294   // An animation can't be played. The position shouldn't be changed.
2295   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2296   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2297
2298   END_TEST;
2299 }
2300
2301 int UtcDaliAnimationPlayOffSceneDiscardP(void)
2302 {
2303   // Test that an animation cannot be played, when the actor is off-stage.
2304   // When the actor is added to the stage, it should appear at the current position
2305   // i.e. where it would have been anyway, if on-stage from the beginning.
2306
2307   TestApplication application;
2308
2309   Actor   actor = Actor::New();
2310   Vector3 basePosition(Vector3::ZERO);
2311   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2312   // Not added to the stage yet!
2313
2314   // Build the animation
2315   float     durationSeconds(1.0f);
2316   Animation animation = Animation::New(durationSeconds);
2317   animation.SetDisconnectAction(Animation::DISCARD);
2318   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2319   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2320
2321   // Start the animation
2322   animation.Play();
2323
2324   bool                 signalReceived(false);
2325   AnimationFinishCheck finishCheck(signalReceived);
2326   animation.FinishedSignal().Connect(&application, finishCheck);
2327
2328   application.SendNotification();
2329   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2330
2331   // We didn't expect the animation to finish yet
2332   application.SendNotification();
2333   finishCheck.CheckSignalNotReceived();
2334
2335   // An animation can't be played. The position shouldn't be changed.
2336   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2337
2338   // Add to the stage
2339   application.GetScene().Add(actor);
2340
2341   application.SendNotification();
2342   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2343
2344   // We didn't expect the animation to finish yet
2345   application.SendNotification();
2346   finishCheck.CheckSignalNotReceived();
2347   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(40, 40, 40) /*on-stage*/, TEST_LOCATION);
2348
2349   // Remove from the stage
2350   application.GetScene().Remove(actor);
2351
2352   application.SendNotification();
2353   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2354
2355   // We didn't expect the animation to finish yet
2356   application.SendNotification();
2357   finishCheck.CheckSignalNotReceived();
2358   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO /*back to start position as disconnect behaviour is discard*/, TEST_LOCATION);
2359   // Check that nothing has changed after a couple of buffer swaps
2360   application.Render(0);
2361   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
2362   application.Render(0);
2363   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
2364   application.Render(0);
2365   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, 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), Vector3(80, 80, 80), 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 UtcDaliAnimationPlayOffSceneBakeFinalP(void)
2396 {
2397   // Test that an animation cannot 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   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2412   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2413
2414   // Start the animation
2415   animation.Play();
2416
2417   bool                 signalReceived(false);
2418   AnimationFinishCheck finishCheck(signalReceived);
2419   animation.FinishedSignal().Connect(&application, finishCheck);
2420
2421   application.SendNotification();
2422   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2423
2424   // We didn't expect the animation to finish yet
2425   application.SendNotification();
2426   finishCheck.CheckSignalNotReceived();
2427
2428   // An animation can't be played. The position shouldn't be changed.
2429   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2430
2431   // Add to the stage
2432   application.GetScene().Add(actor);
2433
2434   application.SendNotification();
2435   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2436
2437   // We didn't expect the animation to finish yet
2438   application.SendNotification();
2439   finishCheck.CheckSignalNotReceived();
2440   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(40, 40, 40) /*on-stage*/, TEST_LOCATION);
2441
2442   // Remove from the stage
2443   application.GetScene().Remove(actor);
2444
2445   application.SendNotification();
2446   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2447
2448   // We didn't expect the animation to finish yet
2449   application.SendNotification();
2450   finishCheck.CheckSignalNotReceived();
2451   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition /*bake final*/, TEST_LOCATION);
2452
2453   // Add to the stage
2454   application.GetScene().Add(actor);
2455
2456   application.SendNotification();
2457   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2458
2459   // We didn't expect the animation to finish yet
2460   application.SendNotification();
2461   finishCheck.CheckSignalNotReceived();
2462   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition /*bake final removed the */, TEST_LOCATION);
2463
2464   application.SendNotification();
2465   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2466
2467   // We did expect the animation to finish
2468   application.SendNotification();
2469   finishCheck.CheckSignalReceived();
2470   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2471
2472   // Check that nothing has changed after a couple of buffer swaps
2473   application.Render(0);
2474   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2475
2476   application.Render(0);
2477   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2478   END_TEST;
2479 }
2480
2481 int UtcDaliAnimationPlayOffSceneBakeP(void)
2482 {
2483   // Test that an animation cannot be played, when the actor is off-stage.
2484   // When the actor is added to the stage, it should appear at the current position
2485   // i.e. where it would have been anyway, if on-stage from the beginning.
2486
2487   TestApplication application;
2488
2489   Actor   actor = Actor::New();
2490   Vector3 basePosition(Vector3::ZERO);
2491   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2492   // Not added to the stage!
2493
2494   // Build the animation
2495   float     durationSeconds(1.0f);
2496   Animation animation = Animation::New(durationSeconds);
2497   animation.SetDisconnectAction(Animation::BAKE);
2498   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2499   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2500
2501   // Start the animation
2502   animation.Play();
2503
2504   bool                 signalReceived(false);
2505   AnimationFinishCheck finishCheck(signalReceived);
2506   animation.FinishedSignal().Connect(&application, finishCheck);
2507
2508   application.SendNotification();
2509   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2510
2511   // We didn't expect the animation to finish yet
2512   application.SendNotification();
2513   finishCheck.CheckSignalNotReceived();
2514
2515   // An animation can't be played. The position shouldn't be changed.
2516   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2517
2518   // Add to the stage
2519   application.GetScene().Add(actor);
2520
2521   application.SendNotification();
2522   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2523
2524   // We didn't expect the animation to finish yet
2525   application.SendNotification();
2526   finishCheck.CheckSignalNotReceived();
2527   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(40, 40, 40) /*on-stage*/, TEST_LOCATION);
2528
2529   // Remove from the stage
2530   application.GetScene().Remove(actor); // baked here
2531
2532   application.SendNotification();
2533   // this render is a no-op in this case as animator is disabled while off stage
2534   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2535   // We didn't expect the animation to finish yet
2536   application.SendNotification();
2537   finishCheck.CheckSignalNotReceived();
2538   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(40, 40, 40) /*baked value*/, TEST_LOCATION);
2539
2540   // Add back to the stage
2541   application.GetScene().Add(actor);
2542
2543   application.SendNotification();
2544   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2545   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /* animation restarted at 40,40,40 + 80%*60 */, TEST_LOCATION);
2546   application.Render(static_cast<unsigned int>(0.0f));
2547   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2548   application.Render(static_cast<unsigned int>(0.0f));
2549   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2550
2551   // Remove from the stage
2552   application.GetScene().Remove(actor); // baked here
2553
2554   application.SendNotification();
2555   // this render is a no-op in this case as animator is disabled while off stage
2556   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 100% progress */);
2557   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2558   application.Render(static_cast<unsigned int>(0.0f));
2559   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2560   application.Render(static_cast<unsigned int>(0.0f));
2561   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2562
2563   // Add back to the stage
2564   application.GetScene().Add(actor);
2565
2566   // We didn't expect the animation to finish yet
2567   application.SendNotification();
2568   finishCheck.CheckSignalNotReceived();
2569   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88), TEST_LOCATION);
2570
2571   application.SendNotification();
2572   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2573
2574   // We did expect the animation to finish
2575   application.SendNotification();
2576   finishCheck.CheckSignalReceived();
2577   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2578
2579   // Check that nothing has changed after a couple of buffer swaps
2580   application.Render(0);
2581   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2582
2583   application.Render(0);
2584   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2585   END_TEST;
2586 }
2587
2588 int UtcDaliAnimationPlayDiscardHandleP(void)
2589 {
2590   TestApplication application;
2591
2592   Actor actor = Actor::New();
2593   application.GetScene().Add(actor);
2594
2595   // Build the animation
2596   float     durationSeconds(1.0f);
2597   Animation animation = Animation::New(durationSeconds);
2598   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2599   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2600
2601   bool                 signalReceived(false);
2602   AnimationFinishCheck finishCheck(signalReceived);
2603   animation.FinishedSignal().Connect(&application, finishCheck);
2604
2605   // Start the animation
2606   animation.Play();
2607
2608   // This is a test of the "Fire and Forget" behaviour
2609   // Discard the animation handle!
2610   animation.Reset();
2611   DALI_TEST_CHECK(!animation);
2612
2613   application.SendNotification();
2614   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2615
2616   // We didn't expect the animation to finish yet
2617   application.SendNotification();
2618   finishCheck.CheckSignalNotReceived();
2619   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2620
2621   application.SendNotification();
2622   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2623
2624   // We didn't expect the animation to finish yet
2625   application.SendNotification();
2626   finishCheck.CheckSignalNotReceived();
2627   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION);
2628
2629   application.SendNotification();
2630   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2631
2632   // We didn't expect the animation to finish yet
2633   application.SendNotification();
2634   finishCheck.CheckSignalNotReceived();
2635   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
2636
2637   application.SendNotification();
2638   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2639
2640   // We didn't expect the animation to finish yet
2641   application.SendNotification();
2642   finishCheck.CheckSignalNotReceived();
2643   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
2644
2645   application.SendNotification();
2646   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2647
2648   // We did expect the animation to finish
2649   application.SendNotification();
2650   finishCheck.CheckSignalReceived();
2651   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2652
2653   // Check that nothing has changed after a couple of buffer swaps
2654   application.Render(0);
2655   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2656   application.Render(0);
2657   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2658   END_TEST;
2659 }
2660
2661 int UtcDaliAnimationPlayStopDiscardHandleP(void)
2662 {
2663   TestApplication application;
2664
2665   Actor actor = Actor::New();
2666   application.GetScene().Add(actor);
2667
2668   // Build the animation
2669   float     durationSeconds(1.0f);
2670   Animation animation = Animation::New(durationSeconds);
2671   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2672   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2673
2674   // Start the animation
2675   animation.Play();
2676
2677   bool                 signalReceived(false);
2678   AnimationFinishCheck finishCheck(signalReceived);
2679   animation.FinishedSignal().Connect(&application, finishCheck);
2680
2681   application.SendNotification();
2682   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2683
2684   // We didn't expect the animation to finish yet
2685   application.SendNotification();
2686   finishCheck.CheckSignalNotReceived();
2687   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2688
2689   // This is a test of the "Fire and Forget" behaviour
2690   // Stop the animation, and Discard the animation handle!
2691   animation.Stop();
2692   animation.Reset();
2693   DALI_TEST_CHECK(!animation);
2694
2695   application.SendNotification();
2696   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2697
2698   // We expect the animation to finish at 20% progress
2699   application.SendNotification();
2700   finishCheck.CheckSignalReceived();
2701   finishCheck.Reset();
2702   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2703
2704   application.SendNotification();
2705   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2706
2707   // Check that nothing has changed
2708   application.SendNotification();
2709   finishCheck.CheckSignalNotReceived();
2710   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2711
2712   application.SendNotification();
2713   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2714
2715   // Check that nothing has changed
2716   application.SendNotification();
2717   finishCheck.CheckSignalNotReceived();
2718   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2719
2720   application.SendNotification();
2721   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 100% progress */);
2722
2723   // Check that nothing has changed
2724   application.SendNotification();
2725   finishCheck.CheckSignalNotReceived();
2726   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2727   END_TEST;
2728 }
2729
2730 int UtcDaliAnimationPlayRangeP(void)
2731 {
2732   TestApplication application;
2733
2734   Actor actor = Actor::New();
2735   application.GetScene().Add(actor);
2736
2737   // Build the animation
2738   float     durationSeconds(1.0f);
2739   Animation animation = Animation::New(durationSeconds);
2740   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2741   KeyFrames keyframes = KeyFrames::New();
2742   keyframes.Add(0.0f, Vector3(0.0f, 0.0f, 0.0f));
2743   keyframes.Add(1.0f, Vector3(100.0f, 100.0f, 100.0f));
2744
2745   animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes);
2746
2747   // Set range between 0.4 and 0.8
2748   animation.SetPlayRange(Vector2(0.4f, 0.8f));
2749   animation.Play();
2750
2751   bool                 signalReceived(false);
2752   AnimationFinishCheck finishCheck(signalReceived);
2753   animation.FinishedSignal().Connect(&application, finishCheck);
2754
2755   //Test that setting progress outside the range doesn't work
2756   animation.SetCurrentProgress(0.9f);
2757   application.SendNotification();
2758   application.Render(0);
2759   DALI_TEST_EQUALS(animation.GetCurrentProgress(), 0.4f, TEST_LOCATION);
2760   animation.SetCurrentProgress(0.2f);
2761   application.SendNotification();
2762   application.Render(0);
2763   DALI_TEST_EQUALS(animation.GetCurrentProgress(), 0.4f, TEST_LOCATION);
2764
2765   application.SendNotification();
2766   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2767
2768   // We didn't expect the animation to finish yet
2769   application.SendNotification();
2770   finishCheck.CheckSignalNotReceived();
2771   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
2772
2773   animation.Play(); // Test that calling play has no effect, when animation is already playing
2774   application.SendNotification();
2775   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /* 80% progress */);
2776
2777   // We did expect the animation to finish
2778   application.SendNotification();
2779   finishCheck.CheckSignalReceived();
2780   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
2781
2782   // Check that nothing has changed after a couple of buffer swaps
2783   application.Render(0);
2784   DALI_TEST_EQUALS(targetPosition * 0.8f, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2785   application.Render(0);
2786   DALI_TEST_EQUALS(targetPosition * 0.8f, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2787
2788   //Loop inside the range
2789   finishCheck.Reset();
2790   animation.SetLooping(true);
2791   animation.Play();
2792   application.SendNotification();
2793   float intervalSeconds = 0.1f;
2794   float progress        = 0.4f;
2795   for(int iterations = 0; iterations < 10; ++iterations)
2796   {
2797     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
2798
2799     progress += intervalSeconds;
2800     if(progress > 0.8f)
2801     {
2802       progress = progress - 0.4f;
2803     }
2804
2805     DALI_TEST_EQUALS(targetPosition * progress, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.001f, TEST_LOCATION);
2806   }
2807
2808   // We didn't expect the animation to finish yet
2809   application.SendNotification();
2810   finishCheck.CheckSignalNotReceived();
2811
2812   //Test change range on the fly
2813   animation.SetPlayRange(Vector2(0.2f, 0.9f));
2814   application.SendNotification();
2815
2816   for(int iterations = 0; iterations < 10; ++iterations)
2817   {
2818     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
2819
2820     progress += intervalSeconds;
2821     if(progress > 0.9f)
2822     {
2823       progress = progress - 0.7f;
2824     }
2825
2826     DALI_TEST_EQUALS(targetPosition * progress, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.001f, TEST_LOCATION);
2827   }
2828
2829   END_TEST;
2830 }
2831
2832 int UtcDaliAnimationPlayFromP(void)
2833 {
2834   TestApplication application;
2835
2836   Actor actor = Actor::New();
2837   application.GetScene().Add(actor);
2838
2839   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
2840
2841   // Build the animation
2842   float     durationSeconds(1.0f);
2843   Animation animation = Animation::New(durationSeconds);
2844   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2845   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2846
2847   // Start the animation from 40% progress
2848   animation.PlayFrom(0.4f);
2849
2850   // Target value should be updated straight away
2851   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2852
2853   bool                 signalReceived(false);
2854   AnimationFinishCheck finishCheck(signalReceived);
2855   animation.FinishedSignal().Connect(&application, finishCheck);
2856
2857   application.SendNotification();
2858   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2859
2860   // We didn't expect the animation to finish yet
2861   application.SendNotification();
2862   finishCheck.CheckSignalNotReceived();
2863   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
2864
2865   animation.Play(); // Test that calling play has no effect, when animation is already playing
2866   application.SendNotification();
2867   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2868
2869   // We didn't expect the animation to finish yet
2870   application.SendNotification();
2871   finishCheck.CheckSignalNotReceived();
2872   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
2873
2874   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2875   // We did expect the animation to finish
2876   application.SendNotification();
2877   finishCheck.CheckSignalReceived();
2878   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2879
2880   // Check that nothing has changed after a couple of buffer swaps
2881   application.Render(0);
2882   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2883   application.Render(0);
2884   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2885   END_TEST;
2886 }
2887
2888 int UtcDaliAnimationPlayFromN(void)
2889 {
2890   TestApplication application;
2891
2892   Actor actor = Actor::New();
2893   application.GetScene().Add(actor);
2894
2895   // Build the animation
2896   float     durationSeconds(1.0f);
2897   Animation animation = Animation::New(durationSeconds);
2898   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2899   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2900
2901   //PlayFrom with an argument outside the range [0..1] will be ignored
2902   animation.PlayFrom(-1.0f);
2903   application.SendNotification();
2904   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
2905
2906   animation.PlayFrom(100.0f);
2907   application.SendNotification();
2908   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
2909   END_TEST;
2910 }
2911
2912 int UtcDaliAnimationPauseP(void)
2913 {
2914   TestApplication application;
2915
2916   Actor actor = Actor::New();
2917   application.GetScene().Add(actor);
2918
2919   // Build the animation
2920   float     durationSeconds(1.0f);
2921   Animation animation = Animation::New(durationSeconds);
2922   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2923   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2924
2925   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2926
2927   // Start the animation
2928   animation.Play();
2929
2930   bool                 signalReceived(false);
2931   AnimationFinishCheck finishCheck(signalReceived);
2932   animation.FinishedSignal().Connect(&application, finishCheck);
2933
2934   application.SendNotification();
2935   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
2936
2937   // We didn't expect the animation to finish yet
2938   application.SendNotification();
2939   finishCheck.CheckSignalNotReceived();
2940   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
2941
2942   // Pause the animation
2943   animation.Pause();
2944   application.SendNotification();
2945
2946   // Loop 5 times
2947   for(int i = 0; i < 5; ++i)
2948   {
2949     application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
2950
2951     // We didn't expect the animation to finish yet
2952     application.SendNotification();
2953     finishCheck.CheckSignalNotReceived();
2954     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress when paused */, TEST_LOCATION);
2955   }
2956
2957   // Keep going
2958   animation.Play();
2959   application.SendNotification();
2960   application.Render(static_cast<unsigned int>(durationSeconds * 490.0f) /*slightly less than the animation duration*/);
2961
2962   // We didn't expect the animation to finish yet
2963   application.SendNotification();
2964   finishCheck.CheckSignalNotReceived();
2965
2966   application.SendNotification();
2967   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
2968
2969   // We did expect the animation to finish
2970   application.SendNotification();
2971   finishCheck.CheckSignalReceived();
2972   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2973
2974   // Check that nothing has changed after a couple of buffer swaps
2975   application.Render(0);
2976   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2977   application.Render(0);
2978   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2979   END_TEST;
2980 }
2981
2982 int UtcDaliAnimationGetStateP(void)
2983 {
2984   TestApplication application;
2985
2986   Actor actor = Actor::New();
2987   application.GetScene().Add(actor);
2988
2989   // Build the animation
2990   float     durationSeconds(1.0f);
2991   Animation animation = Animation::New(durationSeconds);
2992   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2993   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2994   DALI_TEST_EQUALS(animation.GetState(), Animation::STOPPED, TEST_LOCATION);
2995
2996   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2997
2998   // Start the animation
2999   animation.Play();
3000
3001   DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
3002
3003   bool                 signalReceived(false);
3004   AnimationFinishCheck finishCheck(signalReceived);
3005   animation.FinishedSignal().Connect(&application, finishCheck);
3006
3007   application.SendNotification();
3008   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3009
3010   // We didn't expect the animation to finish yet
3011   application.SendNotification();
3012   finishCheck.CheckSignalNotReceived();
3013   DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
3014   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
3015
3016   // Pause the animation
3017   animation.Pause();
3018   DALI_TEST_EQUALS(animation.GetState(), Animation::PAUSED, TEST_LOCATION);
3019   application.SendNotification();
3020   application.Render(0.f);
3021
3022   // Loop 5 times
3023   for(int i = 0; i < 5; ++i)
3024   {
3025     application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
3026
3027     // We didn't expect the animation to finish yet
3028     application.SendNotification();
3029     finishCheck.CheckSignalNotReceived();
3030     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress when paused */, TEST_LOCATION);
3031     DALI_TEST_EQUALS(animation.GetState(), Animation::PAUSED, TEST_LOCATION);
3032   }
3033
3034   // Keep going
3035   finishCheck.Reset();
3036   animation.Play();
3037   DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
3038   application.SendNotification();
3039   application.Render(static_cast<unsigned int>(durationSeconds * 490.0f) /*slightly less than the animation duration*/);
3040   // We didn't expect the animation to finish yet
3041   application.SendNotification();
3042   finishCheck.CheckSignalNotReceived();
3043   DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
3044
3045   application.SendNotification();
3046   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
3047
3048   // We did expect the animation to finish
3049   application.SendNotification();
3050   finishCheck.CheckSignalReceived();
3051   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
3052   DALI_TEST_EQUALS(animation.GetState(), Animation::STOPPED, TEST_LOCATION);
3053
3054   // Check that nothing has changed after a couple of buffer swaps
3055   application.Render(0);
3056   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
3057   application.Render(0);
3058   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
3059   DALI_TEST_EQUALS(animation.GetState(), Animation::STOPPED, TEST_LOCATION);
3060
3061   // re-play
3062   finishCheck.Reset();
3063   animation.Play();
3064   DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
3065   application.SendNotification();
3066   application.Render(static_cast<unsigned int>(durationSeconds * 490.0f) /*slightly less than the animation duration*/);
3067   application.SendNotification();
3068   finishCheck.CheckSignalNotReceived();
3069   DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
3070
3071   END_TEST;
3072 }
3073
3074 int UtcDaliAnimationStopP(void)
3075 {
3076   TestApplication application;
3077
3078   Actor actor = Actor::New();
3079   application.GetScene().Add(actor);
3080
3081   // Build the animation
3082   float     durationSeconds(1.0f);
3083   Animation animation = Animation::New(durationSeconds);
3084   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
3085   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
3086
3087   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
3088
3089   // Start the animation
3090   animation.Play();
3091
3092   bool                 signalReceived(false);
3093   AnimationFinishCheck finishCheck(signalReceived);
3094   animation.FinishedSignal().Connect(&application, finishCheck);
3095
3096   application.SendNotification();
3097   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3098
3099   // We didn't expect the animation to finish yet
3100   application.SendNotification();
3101   finishCheck.CheckSignalNotReceived();
3102   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
3103
3104   // Stop the animation
3105   animation.Stop();
3106   application.SendNotification();
3107
3108   // Loop 5 times
3109   for(int i = 0; i < 5; ++i)
3110   {
3111     application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
3112
3113     // We did expect the animation to finish
3114     application.SendNotification();
3115     finishCheck.CheckSignalReceived();
3116     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress when stopped */, TEST_LOCATION);
3117   }
3118   END_TEST;
3119 }
3120
3121 int UtcDaliAnimationStopSetPositionP(void)
3122 {
3123   // Test that Animation::Stop & Actor::SetPosition can be used in conjunction
3124   // i.e. to check that the animation does not interfere with the position set.
3125
3126   TestApplication application;
3127
3128   Actor actor = Actor::New();
3129   application.GetScene().Add(actor);
3130
3131   // Build the animation
3132   float     durationSeconds(1.0f);
3133   Animation animation = Animation::New(durationSeconds);
3134   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
3135   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
3136
3137   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
3138
3139   // Start the animation
3140   animation.Play();
3141
3142   bool                 signalReceived(false);
3143   AnimationFinishCheck finishCheck(signalReceived);
3144   animation.FinishedSignal().Connect(&application, finishCheck);
3145
3146   application.SendNotification();
3147   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3148
3149   // We didn't expect the animation to finish yet
3150   application.SendNotification();
3151   finishCheck.CheckSignalNotReceived();
3152   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
3153
3154   // Stop the animation
3155   animation.Stop();
3156   Vector3 positionSet(2.0f, 3.0f, 4.0f);
3157   actor.SetProperty(Actor::Property::POSITION, positionSet);
3158   application.SendNotification();
3159
3160   // Loop 5 times
3161   for(int i = 0; i < 5; ++i)
3162   {
3163     application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
3164
3165     // We did expect the animation to finish
3166     application.SendNotification();
3167     finishCheck.CheckSignalReceived();
3168     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), positionSet /*Animation should not interfere with this*/, TEST_LOCATION);
3169   }
3170   END_TEST;
3171 }
3172
3173 int UtcDaliAnimationClearP(void)
3174 {
3175   TestApplication application;
3176
3177   Actor actor = Actor::New();
3178   application.GetScene().Add(actor);
3179
3180   // Build the animation
3181   float     durationSeconds(1.0f);
3182   Animation animation = Animation::New(durationSeconds);
3183   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
3184   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
3185
3186   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
3187
3188   // Start the animation
3189   animation.Play();
3190
3191   bool                 signalReceived(false);
3192   AnimationFinishCheck finishCheck(signalReceived);
3193   animation.FinishedSignal().Connect(&application, finishCheck);
3194
3195   application.SendNotification();
3196   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3197
3198   // We didn't expect the animation to finish yet
3199   application.SendNotification();
3200   finishCheck.CheckSignalNotReceived();
3201   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
3202
3203   // Clear the animation
3204   animation.Clear();
3205   application.SendNotification();
3206
3207   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
3208
3209   // We don't expect the animation to finish now
3210   application.SendNotification();
3211   finishCheck.CheckSignalNotReceived();
3212   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress since the animator was destroyed */, TEST_LOCATION);
3213
3214   // Restart as a scale animation; this should not move the actor's position
3215   finishCheck.Reset();
3216   actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO);
3217   Vector3 targetScale(3.0f, 3.0f, 3.0f);
3218   animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR);
3219   animation.Play();
3220
3221   application.SendNotification();
3222   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3223
3224   // We didn't expect the animation to finish yet
3225   application.SendNotification();
3226   finishCheck.CheckSignalNotReceived();
3227   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO /*Check move-animator was destroyed*/, TEST_LOCATION);
3228   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION);
3229
3230   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
3231
3232   // We did expect the animation to finish
3233   application.SendNotification();
3234   finishCheck.CheckSignalReceived();
3235   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO /*Check move-animator was destroyed*/, TEST_LOCATION);
3236   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
3237   END_TEST;
3238 }
3239
3240 int UtcDaliAnimationFinishedSignalP(void)
3241 {
3242   TestApplication application;
3243
3244   // Start the empty animation
3245   float     durationSeconds(1.0f);
3246   Animation animation = Animation::New(durationSeconds);
3247   animation.Play();
3248
3249   bool                 signalReceived(false);
3250   AnimationFinishCheck finishCheck(signalReceived);
3251   animation.FinishedSignal().Connect(&application, finishCheck);
3252
3253   application.SendNotification();
3254   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*beyond the animation duration*/);
3255
3256   // We did expect the animation to finish
3257   application.SendNotification();
3258   finishCheck.CheckSignalReceived();
3259   END_TEST;
3260 }
3261
3262 int UtcDaliAnimationAnimateByBooleanP(void)
3263 {
3264   TestApplication application;
3265
3266   Actor actor = Actor::New();
3267
3268   // Register a boolean property
3269   bool            startValue(false);
3270   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3271   application.GetScene().Add(actor);
3272   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3273   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3274
3275   // Build the animation
3276   float      durationSeconds(2.0f);
3277   Animation  animation = Animation::New(durationSeconds);
3278   const bool relativeValue(true);
3279   const bool finalValue(false || relativeValue);
3280   animation.AnimateBy(Property(actor, index), relativeValue);
3281
3282   // Start the animation
3283   animation.Play();
3284
3285   // Target value should be retrievable straight away
3286   DALI_TEST_EQUALS(actor.GetProperty<bool>(index), finalValue, TEST_LOCATION);
3287
3288   bool                 signalReceived(false);
3289   AnimationFinishCheck finishCheck(signalReceived);
3290   animation.FinishedSignal().Connect(&application, finishCheck);
3291
3292   application.SendNotification();
3293   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3294
3295   // We didn't expect the animation to finish yet
3296   application.SendNotification();
3297   finishCheck.CheckSignalNotReceived();
3298   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3299
3300   application.SendNotification();
3301   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3302
3303   // We did expect the animation to finish
3304   application.SendNotification();
3305   finishCheck.CheckSignalReceived();
3306   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3307
3308   // Check that nothing has changed after a couple of buffer swaps
3309   application.Render(0);
3310   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3311   application.Render(0);
3312   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3313
3314   // Repeat with relative value "false" - this should be an NOOP
3315   animation = Animation::New(durationSeconds);
3316   bool noOpValue(false);
3317   animation.AnimateBy(Property(actor, index), noOpValue);
3318
3319   // Start the animation
3320   animation.Play();
3321
3322   finishCheck.Reset();
3323   animation.FinishedSignal().Connect(&application, finishCheck);
3324
3325   application.SendNotification();
3326   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3327
3328   // We didn't expect the animation to finish yet
3329   application.SendNotification();
3330   finishCheck.CheckSignalNotReceived();
3331   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3332
3333   application.SendNotification();
3334   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3335
3336   // We did expect the animation to finish
3337   application.SendNotification();
3338   finishCheck.CheckSignalReceived();
3339   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3340
3341   // Check that nothing has changed after a couple of buffer swaps
3342   application.Render(0);
3343   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3344   application.Render(0);
3345   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3346   END_TEST;
3347 }
3348
3349 int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void)
3350 {
3351   TestApplication application;
3352
3353   Actor actor = Actor::New();
3354
3355   // Register a boolean property
3356   bool            startValue(false);
3357   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3358   application.GetScene().Add(actor);
3359   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3360   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3361
3362   // Build the animation
3363   float     durationSeconds(2.0f);
3364   Animation animation = Animation::New(durationSeconds);
3365   bool      relativeValue(true);
3366   bool      finalValue(false || relativeValue);
3367   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN);
3368
3369   // Start the animation
3370   animation.Play();
3371
3372   bool                 signalReceived(false);
3373   AnimationFinishCheck finishCheck(signalReceived);
3374   animation.FinishedSignal().Connect(&application, finishCheck);
3375
3376   application.SendNotification();
3377   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3378
3379   // We didn't expect the animation to finish yet
3380   application.SendNotification();
3381   finishCheck.CheckSignalNotReceived();
3382   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3383
3384   application.SendNotification();
3385   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3386
3387   // We did expect the animation to finish
3388   application.SendNotification();
3389   finishCheck.CheckSignalReceived();
3390   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3391
3392   // Check that nothing has changed after a couple of buffer swaps
3393   application.Render(0);
3394   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3395   application.Render(0);
3396   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3397
3398   // Repeat with relative value "false" - this should be an NOOP
3399   animation = Animation::New(durationSeconds);
3400   bool noOpValue(false);
3401   animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunction::EASE_IN);
3402
3403   // Start the animation
3404   animation.Play();
3405
3406   finishCheck.Reset();
3407   animation.FinishedSignal().Connect(&application, finishCheck);
3408
3409   application.SendNotification();
3410   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3411
3412   // We didn't expect the animation to finish yet
3413   application.SendNotification();
3414   finishCheck.CheckSignalNotReceived();
3415   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3416
3417   application.SendNotification();
3418   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3419
3420   // We did expect the animation to finish
3421   application.SendNotification();
3422   finishCheck.CheckSignalReceived();
3423   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3424   END_TEST;
3425 }
3426
3427 int UtcDaliAnimationAnimateByBooleanTimePeriodP(void)
3428 {
3429   TestApplication application;
3430
3431   Actor actor = Actor::New();
3432
3433   // Register a boolean property
3434   bool            startValue(false);
3435   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3436   application.GetScene().Add(actor);
3437   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3438   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3439
3440   // Build the animation
3441   float     durationSeconds(2.0f);
3442   Animation animation = Animation::New(durationSeconds);
3443   bool      relativeValue(true);
3444   bool      finalValue(false || relativeValue);
3445   float     animatorDurationSeconds(durationSeconds * 0.5f);
3446   animation.AnimateBy(Property(actor, index),
3447                       relativeValue,
3448                       TimePeriod(animatorDurationSeconds));
3449
3450   // Start the animation
3451   animation.Play();
3452
3453   bool                 signalReceived(false);
3454   AnimationFinishCheck finishCheck(signalReceived);
3455   animation.FinishedSignal().Connect(&application, finishCheck);
3456
3457   application.SendNotification();
3458   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
3459
3460   // We didn't expect the animation to finish yet
3461   application.SendNotification();
3462   finishCheck.CheckSignalNotReceived();
3463   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3464
3465   application.SendNotification();
3466   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
3467
3468   // We didn't expect the animation to finish yet...
3469   application.SendNotification();
3470   finishCheck.CheckSignalNotReceived();
3471
3472   // ...however we should have reached the final value
3473   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3474
3475   application.SendNotification();
3476   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
3477
3478   // We did expect the animation to finish
3479   application.SendNotification();
3480   finishCheck.CheckSignalReceived();
3481   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3482
3483   // Check that nothing has changed after a couple of buffer swaps
3484   application.Render(0);
3485   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3486   application.Render(0);
3487   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3488   END_TEST;
3489 }
3490
3491 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void)
3492 {
3493   TestApplication application;
3494
3495   Actor actor = Actor::New();
3496
3497   // Register a boolean property
3498   bool            startValue(false);
3499   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3500   application.GetScene().Add(actor);
3501   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3502   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3503
3504   // Build the animation
3505   float     durationSeconds(2.0f);
3506   Animation animation = Animation::New(durationSeconds);
3507   bool      relativeValue(true);
3508   bool      finalValue(false || relativeValue);
3509   float     animatorDurationSeconds(durationSeconds * 0.5f);
3510   animation.AnimateBy(Property(actor, index),
3511                       relativeValue,
3512                       AlphaFunction::EASE_IN_OUT,
3513                       TimePeriod(animatorDurationSeconds));
3514
3515   // Start the animation
3516   animation.Play();
3517
3518   bool                 signalReceived(false);
3519   AnimationFinishCheck finishCheck(signalReceived);
3520   animation.FinishedSignal().Connect(&application, finishCheck);
3521
3522   application.SendNotification();
3523   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
3524
3525   // We didn't expect the animation to finish yet
3526   application.SendNotification();
3527   finishCheck.CheckSignalNotReceived();
3528   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3529
3530   application.SendNotification();
3531   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
3532
3533   // We didn't expect the animation to finish yet...
3534   application.SendNotification();
3535   finishCheck.CheckSignalNotReceived();
3536
3537   // ...however we should have reached the final value
3538   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3539
3540   application.SendNotification();
3541   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
3542
3543   // We did expect the animation to finish
3544   application.SendNotification();
3545   finishCheck.CheckSignalReceived();
3546   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3547
3548   // Check that nothing has changed after a couple of buffer swaps
3549   application.Render(0);
3550   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3551   application.Render(0);
3552   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3553   END_TEST;
3554 }
3555
3556 int UtcDaliAnimationAnimateByFloatP(void)
3557 {
3558   TestApplication application;
3559
3560   Actor actor = Actor::New();
3561
3562   // Register a float property
3563   float           startValue(10.0f);
3564   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3565   application.GetScene().Add(actor);
3566   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3567   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3568
3569   // Build the animation
3570   float     durationSeconds(2.0f);
3571   Animation animation = Animation::New(durationSeconds);
3572   float     targetValue(50.0f);
3573   float     relativeValue(targetValue - startValue);
3574   animation.AnimateBy(Property(actor, index), relativeValue);
3575
3576   float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
3577
3578   // Start the animation
3579   animation.Play();
3580
3581   // Target value should be retrievable straight away
3582   DALI_TEST_EQUALS(actor.GetProperty<float>(index), targetValue, TEST_LOCATION);
3583
3584   bool                 signalReceived(false);
3585   AnimationFinishCheck finishCheck(signalReceived);
3586   animation.FinishedSignal().Connect(&application, finishCheck);
3587
3588   application.SendNotification();
3589   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3590
3591   // We didn't expect the animation to finish yet
3592   application.SendNotification();
3593   finishCheck.CheckSignalNotReceived();
3594   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION);
3595
3596   application.SendNotification();
3597   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3598
3599   // We did expect the animation to finish
3600   application.SendNotification();
3601   finishCheck.CheckSignalReceived();
3602   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3603
3604   // Check that nothing has changed after a couple of buffer swaps
3605   application.Render(0);
3606   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3607   application.Render(0);
3608   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3609   END_TEST;
3610 }
3611
3612 int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void)
3613 {
3614   TestApplication application;
3615
3616   Actor actor = Actor::New();
3617
3618   // Register a float property
3619   float           startValue(10.0f);
3620   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3621   application.GetScene().Add(actor);
3622   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3623   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3624
3625   // Build the animation
3626   float     durationSeconds(1.0f);
3627   Animation animation = Animation::New(durationSeconds);
3628   float     targetValue(90.0f);
3629   float     relativeValue(targetValue - startValue);
3630   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3631
3632   float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
3633
3634   // Start the animation
3635   animation.Play();
3636
3637   bool                 signalReceived(false);
3638   AnimationFinishCheck finishCheck(signalReceived);
3639   animation.FinishedSignal().Connect(&application, finishCheck);
3640
3641   application.SendNotification();
3642   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3643
3644   // We didn't expect the animation to finish yet
3645   application.SendNotification();
3646   finishCheck.CheckSignalNotReceived();
3647
3648   // The position should have moved more, than with a linear alpha function
3649   float current(actor.GetCurrentProperty<float>(index));
3650   DALI_TEST_CHECK(current > ninetyFivePercentProgress);
3651
3652   application.SendNotification();
3653   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3654
3655   // We did expect the animation to finish
3656   application.SendNotification();
3657   finishCheck.CheckSignalReceived();
3658   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3659
3660   // Check that nothing has changed after a couple of buffer swaps
3661   application.Render(0);
3662   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3663   application.Render(0);
3664   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3665   END_TEST;
3666 }
3667
3668 int UtcDaliAnimationAnimateByFloatTimePeriodP(void)
3669 {
3670   TestApplication application;
3671
3672   Actor actor = Actor::New();
3673
3674   // Register a float property
3675   float           startValue(10.0f);
3676   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3677   application.GetScene().Add(actor);
3678   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3679   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3680
3681   // Build the animation
3682   float     durationSeconds(1.0f);
3683   Animation animation = Animation::New(durationSeconds);
3684   float     targetValue(30.0f);
3685   float     relativeValue(targetValue - startValue);
3686   float     delay = 0.5f;
3687   animation.AnimateBy(Property(actor, index),
3688                       relativeValue,
3689                       TimePeriod(delay, durationSeconds - delay));
3690
3691   // Start the animation
3692   animation.Play();
3693
3694   bool                 signalReceived(false);
3695   AnimationFinishCheck finishCheck(signalReceived);
3696   animation.FinishedSignal().Connect(&application, finishCheck);
3697
3698   application.SendNotification();
3699   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
3700
3701   // We didn't expect the animation to finish yet
3702   application.SendNotification();
3703   finishCheck.CheckSignalNotReceived();
3704   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3705
3706   application.SendNotification();
3707   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
3708
3709   // We didn't expect the animation to finish yet
3710   application.SendNotification();
3711   finishCheck.CheckSignalNotReceived();
3712   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
3713
3714   application.SendNotification();
3715   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
3716
3717   // We did expect the animation to finish
3718   application.SendNotification();
3719   finishCheck.CheckSignalReceived();
3720   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3721
3722   // Check that nothing has changed after a couple of buffer swaps
3723   application.Render(0);
3724   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3725   application.Render(0);
3726   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3727   END_TEST;
3728 }
3729
3730 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void)
3731 {
3732   TestApplication application;
3733
3734   Actor actor = Actor::New();
3735
3736   // Register a float property
3737   float           startValue(10.0f);
3738   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3739   application.GetScene().Add(actor);
3740   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3741   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3742
3743   // Build the animation
3744   float     durationSeconds(1.0f);
3745   Animation animation = Animation::New(durationSeconds);
3746   float     targetValue(30.0f);
3747   float     relativeValue(targetValue - startValue);
3748   float     delay = 0.5f;
3749   animation.AnimateBy(Property(actor, index),
3750                       relativeValue,
3751                       AlphaFunction::LINEAR,
3752                       TimePeriod(delay, durationSeconds - delay));
3753
3754   // Start the animation
3755   animation.Play();
3756
3757   bool                 signalReceived(false);
3758   AnimationFinishCheck finishCheck(signalReceived);
3759   animation.FinishedSignal().Connect(&application, finishCheck);
3760
3761   application.SendNotification();
3762   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
3763
3764   // We didn't expect the animation to finish yet
3765   application.SendNotification();
3766   finishCheck.CheckSignalNotReceived();
3767   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3768
3769   application.SendNotification();
3770   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
3771
3772   // We didn't expect the animation to finish yet
3773   application.SendNotification();
3774   finishCheck.CheckSignalNotReceived();
3775   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
3776
3777   application.SendNotification();
3778   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
3779
3780   // We did expect the animation to finish
3781   application.SendNotification();
3782   finishCheck.CheckSignalReceived();
3783   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3784
3785   // Check that nothing has changed after a couple of buffer swaps
3786   application.Render(0);
3787   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3788   application.Render(0);
3789   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3790   END_TEST;
3791 }
3792
3793 int UtcDaliAnimationAnimateByIntegerP(void)
3794 {
3795   TestApplication application;
3796
3797   Actor actor = Actor::New();
3798
3799   // Register an integer property
3800   int             startValue(1);
3801   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3802   application.GetScene().Add(actor);
3803   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
3804   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3805
3806   // Build the animation
3807   float     durationSeconds(2.0f);
3808   Animation animation = Animation::New(durationSeconds);
3809   int       targetValue(50);
3810   int       relativeValue(targetValue - startValue);
3811   animation.AnimateBy(Property(actor, index), relativeValue);
3812
3813   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
3814
3815   // Start the animation
3816   animation.Play();
3817
3818   // Target value should be retrievable straight away
3819   DALI_TEST_EQUALS(actor.GetProperty<int>(index), targetValue, TEST_LOCATION);
3820
3821   bool                 signalReceived(false);
3822   AnimationFinishCheck finishCheck(signalReceived);
3823   animation.FinishedSignal().Connect(&application, finishCheck);
3824
3825   application.SendNotification();
3826   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3827
3828   // We didn't expect the animation to finish yet
3829   application.SendNotification();
3830   finishCheck.CheckSignalNotReceived();
3831   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION);
3832
3833   application.SendNotification();
3834   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3835
3836   // We did expect the animation to finish
3837   application.SendNotification();
3838   finishCheck.CheckSignalReceived();
3839   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3840
3841   // Check that nothing has changed after a couple of buffer swaps
3842   application.Render(0);
3843   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3844   application.Render(0);
3845   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3846   END_TEST;
3847 }
3848
3849 int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void)
3850 {
3851   TestApplication application;
3852
3853   Actor actor = Actor::New();
3854
3855   // Register an integer property
3856   int             startValue(1);
3857   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3858   application.GetScene().Add(actor);
3859   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
3860   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3861
3862   // Build the animation
3863   float     durationSeconds(1.0f);
3864   Animation animation = Animation::New(durationSeconds);
3865   int       targetValue(90);
3866   int       relativeValue(targetValue - startValue);
3867   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3868
3869   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
3870
3871   // Start the animation
3872   animation.Play();
3873
3874   bool                 signalReceived(false);
3875   AnimationFinishCheck finishCheck(signalReceived);
3876   animation.FinishedSignal().Connect(&application, finishCheck);
3877
3878   application.SendNotification();
3879   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3880
3881   // We didn't expect the animation to finish yet
3882   application.SendNotification();
3883   finishCheck.CheckSignalNotReceived();
3884
3885   // The position should have moved more, than with a linear alpha function
3886   int current(actor.GetCurrentProperty<int>(index));
3887   DALI_TEST_CHECK(current > ninetyFivePercentProgress);
3888
3889   application.SendNotification();
3890   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3891
3892   // We did expect the animation to finish
3893   application.SendNotification();
3894   finishCheck.CheckSignalReceived();
3895   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3896
3897   // Check that nothing has changed after a couple of buffer swaps
3898   application.Render(0);
3899   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3900   application.Render(0);
3901   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3902   END_TEST;
3903 }
3904
3905 int UtcDaliAnimationAnimateByIntegerTimePeriodP(void)
3906 {
3907   TestApplication application;
3908
3909   Actor actor = Actor::New();
3910
3911   // Register an integer property
3912   int             startValue(10);
3913   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3914   application.GetScene().Add(actor);
3915   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
3916   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3917
3918   // Build the animation
3919   float     durationSeconds(1.0f);
3920   Animation animation = Animation::New(durationSeconds);
3921   int       targetValue(30);
3922   int       relativeValue(targetValue - startValue);
3923   float     delay = 0.5f;
3924   animation.AnimateBy(Property(actor, index),
3925                       relativeValue,
3926                       TimePeriod(delay, durationSeconds - delay));
3927
3928   // Start the animation
3929   animation.Play();
3930
3931   bool                 signalReceived(false);
3932   AnimationFinishCheck finishCheck(signalReceived);
3933   animation.FinishedSignal().Connect(&application, finishCheck);
3934
3935   application.SendNotification();
3936   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
3937
3938   // We didn't expect the animation to finish yet
3939   application.SendNotification();
3940   finishCheck.CheckSignalNotReceived();
3941   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3942
3943   application.SendNotification();
3944   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
3945
3946   // We didn't expect the animation to finish yet
3947   application.SendNotification();
3948   finishCheck.CheckSignalNotReceived();
3949   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
3950
3951   application.SendNotification();
3952   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
3953
3954   // We did expect the animation to finish
3955   application.SendNotification();
3956   finishCheck.CheckSignalReceived();
3957   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3958
3959   // Check that nothing has changed after a couple of buffer swaps
3960   application.Render(0);
3961   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3962   application.Render(0);
3963   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3964   END_TEST;
3965 }
3966
3967 int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void)
3968 {
3969   TestApplication application;
3970
3971   Actor actor = Actor::New();
3972
3973   // Register an integer property
3974   int             startValue(10);
3975   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3976   application.GetScene().Add(actor);
3977   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
3978   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3979
3980   // Build the animation
3981   float     durationSeconds(1.0f);
3982   Animation animation = Animation::New(durationSeconds);
3983   int       targetValue(30);
3984   int       relativeValue(targetValue - startValue);
3985   float     delay = 0.5f;
3986   animation.AnimateBy(Property(actor, index),
3987                       relativeValue,
3988                       AlphaFunction::LINEAR,
3989                       TimePeriod(delay, durationSeconds - delay));
3990
3991   // Start the animation
3992   animation.Play();
3993
3994   bool                 signalReceived(false);
3995   AnimationFinishCheck finishCheck(signalReceived);
3996   animation.FinishedSignal().Connect(&application, finishCheck);
3997
3998   application.SendNotification();
3999   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4000
4001   // We didn't expect the animation to finish yet
4002   application.SendNotification();
4003   finishCheck.CheckSignalNotReceived();
4004   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
4005
4006   application.SendNotification();
4007   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4008
4009   // We didn't expect the animation to finish yet
4010   application.SendNotification();
4011   finishCheck.CheckSignalNotReceived();
4012   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
4013
4014   application.SendNotification();
4015   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4016
4017   // We did expect the animation to finish
4018   application.SendNotification();
4019   finishCheck.CheckSignalReceived();
4020   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4021
4022   // Check that nothing has changed after a couple of buffer swaps
4023   application.Render(0);
4024   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4025   application.Render(0);
4026   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4027   END_TEST;
4028 }
4029
4030 int UtcDaliAnimationAnimateByQuaternionP(void)
4031 {
4032   TestApplication application;
4033
4034   Actor actor = Actor::New();
4035
4036   // Register a quaternion property
4037   const Quaternion startValue(Degree(90), Vector3::XAXIS);
4038   Property::Index  index = actor.RegisterProperty("testProperty", startValue);
4039   application.GetScene().Add(actor);
4040   DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == startValue);
4041   DALI_TEST_CHECK(actor.GetCurrentProperty<Quaternion>(index) == startValue);
4042
4043   // Build the animation
4044   float            durationSeconds(2.0f);
4045   Animation        animation = Animation::New(durationSeconds);
4046   const Quaternion relativeValue(Degree(90), Vector3::ZAXIS);
4047   const Quaternion finalValue(startValue * relativeValue);
4048   animation.AnimateBy(Property(actor, index), relativeValue);
4049
4050   DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == startValue);
4051   DALI_TEST_CHECK(actor.GetCurrentProperty<Quaternion>(index) == startValue);
4052
4053   // Start the animation
4054   animation.Play();
4055
4056   // Target value should be retrievable straight away
4057   DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == finalValue);
4058
4059   application.SendNotification();
4060   application.Render(2000); // animation complete
4061
4062   DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == finalValue);
4063   DALI_TEST_CHECK(actor.GetCurrentProperty<Quaternion>(index) == finalValue);
4064
4065   END_TEST;
4066 }
4067
4068 int UtcDaliAnimationAnimateByVector2P(void)
4069 {
4070   TestApplication application;
4071
4072   Actor actor = Actor::New();
4073
4074   // Register a Vector2 property
4075   Vector2         startValue(10.0f, 10.0f);
4076   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4077   application.GetScene().Add(actor);
4078   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4079   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4080
4081   // Build the animation
4082   float     durationSeconds(2.0f);
4083   Animation animation = Animation::New(durationSeconds);
4084   Vector2   targetValue(60.0f, 60.0f);
4085   Vector2   relativeValue(targetValue - startValue);
4086   animation.AnimateBy(Property(actor, index), relativeValue);
4087
4088   Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4089
4090   // Start the animation
4091   animation.Play();
4092
4093   // Target value should be retrievable straight away
4094   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION);
4095
4096   bool                 signalReceived(false);
4097   AnimationFinishCheck finishCheck(signalReceived);
4098   animation.FinishedSignal().Connect(&application, finishCheck);
4099
4100   application.SendNotification();
4101   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4102
4103   // We didn't expect the animation to finish yet
4104   application.SendNotification();
4105   finishCheck.CheckSignalNotReceived();
4106   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION);
4107
4108   application.SendNotification();
4109   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4110
4111   // We did expect the animation to finish
4112   application.SendNotification();
4113   finishCheck.CheckSignalReceived();
4114   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4115
4116   // Check that nothing has changed after a couple of buffer swaps
4117   application.Render(0);
4118   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4119   application.Render(0);
4120   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4121   END_TEST;
4122 }
4123
4124 int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void)
4125 {
4126   TestApplication application;
4127
4128   Actor actor = Actor::New();
4129
4130   // Register a Vector2 property
4131   Vector2         startValue(100.0f, 100.0f);
4132   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4133   application.GetScene().Add(actor);
4134   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4135   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4136
4137   // Build the animation
4138   float     durationSeconds(1.0f);
4139   Animation animation = Animation::New(durationSeconds);
4140   Vector2   targetValue(20.0f, 20.0f);
4141   Vector2   relativeValue(targetValue - startValue);
4142   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4143
4144   Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4145
4146   // Start the animation
4147   animation.Play();
4148
4149   bool                 signalReceived(false);
4150   AnimationFinishCheck finishCheck(signalReceived);
4151   animation.FinishedSignal().Connect(&application, finishCheck);
4152
4153   application.SendNotification();
4154   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4155
4156   // We didn't expect the animation to finish yet
4157   application.SendNotification();
4158   finishCheck.CheckSignalNotReceived();
4159
4160   // The position should have moved more, than with a linear alpha function
4161   Vector2 current(actor.GetCurrentProperty<Vector2>(index));
4162   DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x);
4163   DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y);
4164
4165   application.SendNotification();
4166   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4167
4168   // We did expect the animation to finish
4169   application.SendNotification();
4170   finishCheck.CheckSignalReceived();
4171   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4172
4173   // Check that nothing has changed after a couple of buffer swaps
4174   application.Render(0);
4175   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4176   application.Render(0);
4177   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4178   END_TEST;
4179 }
4180
4181 int UtcDaliAnimationAnimateByVector2TimePeriodP(void)
4182 {
4183   TestApplication application;
4184
4185   Actor actor = Actor::New();
4186
4187   // Register a Vector2 property
4188   Vector2         startValue(10.0f, 10.0f);
4189   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4190   application.GetScene().Add(actor);
4191   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4192   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4193
4194   // Build the animation
4195   float     durationSeconds(1.0f);
4196   Animation animation = Animation::New(durationSeconds);
4197   Vector2   targetValue(30.0f, 30.0f);
4198   Vector2   relativeValue(targetValue - startValue);
4199   float     delay = 0.5f;
4200   animation.AnimateBy(Property(actor, index),
4201                       relativeValue,
4202                       TimePeriod(delay, durationSeconds - delay));
4203
4204   // Start the animation
4205   animation.Play();
4206
4207   bool                 signalReceived(false);
4208   AnimationFinishCheck finishCheck(signalReceived);
4209   animation.FinishedSignal().Connect(&application, finishCheck);
4210
4211   application.SendNotification();
4212   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4213
4214   // We didn't expect the animation to finish yet
4215   application.SendNotification();
4216   finishCheck.CheckSignalNotReceived();
4217   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4218
4219   application.SendNotification();
4220   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4221
4222   // We didn't expect the animation to finish yet
4223   application.SendNotification();
4224   finishCheck.CheckSignalNotReceived();
4225   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4226
4227   application.SendNotification();
4228   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4229
4230   // We did expect the animation to finish
4231   application.SendNotification();
4232   finishCheck.CheckSignalReceived();
4233   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4234
4235   // Check that nothing has changed after a couple of buffer swaps
4236   application.Render(0);
4237   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4238   application.Render(0);
4239   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4240   END_TEST;
4241 }
4242
4243 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void)
4244 {
4245   TestApplication application;
4246
4247   Actor actor = Actor::New();
4248
4249   // Register a Vector2 property
4250   Vector2         startValue(5.0f, 5.0f);
4251   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4252   application.GetScene().Add(actor);
4253   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4254   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4255
4256   // Build the animation
4257   float     durationSeconds(1.0f);
4258   Animation animation = Animation::New(durationSeconds);
4259   Vector2   targetValue(10.0f, 10.0f);
4260   Vector2   relativeValue(targetValue - startValue);
4261   float     delay = 0.5f;
4262   animation.AnimateBy(Property(actor, index),
4263                       relativeValue,
4264                       AlphaFunction::LINEAR,
4265                       TimePeriod(delay, durationSeconds - delay));
4266
4267   // Start the animation
4268   animation.Play();
4269
4270   bool                 signalReceived(false);
4271   AnimationFinishCheck finishCheck(signalReceived);
4272   animation.FinishedSignal().Connect(&application, finishCheck);
4273
4274   application.SendNotification();
4275   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4276
4277   // We didn't expect the animation to finish yet
4278   application.SendNotification();
4279   finishCheck.CheckSignalNotReceived();
4280   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4281
4282   application.SendNotification();
4283   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4284
4285   // We didn't expect the animation to finish yet
4286   application.SendNotification();
4287   finishCheck.CheckSignalNotReceived();
4288   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4289
4290   application.SendNotification();
4291   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4292
4293   // We did expect the animation to finish
4294   application.SendNotification();
4295   finishCheck.CheckSignalReceived();
4296   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4297
4298   // Check that nothing has changed after a couple of buffer swaps
4299   application.Render(0);
4300   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4301   application.Render(0);
4302   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4303   END_TEST;
4304 }
4305
4306 int UtcDaliAnimationAnimateByVector3P(void)
4307 {
4308   TestApplication application;
4309
4310   Actor actor = Actor::New();
4311
4312   // Register a Vector3 property
4313   Vector3         startValue(10.0f, 10.0f, 10.0f);
4314   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4315   application.GetScene().Add(actor);
4316   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4317   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4318
4319   // Build the animation
4320   float     durationSeconds(2.0f);
4321   Animation animation = Animation::New(durationSeconds);
4322   Vector3   targetValue(60.0f, 60.0f, 60.0f);
4323   Vector3   relativeValue(targetValue - startValue);
4324   animation.AnimateBy(Property(actor, index), relativeValue);
4325
4326   Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4327
4328   // Start the animation
4329   animation.Play();
4330
4331   // Target value should be retrievable straight away
4332   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION);
4333
4334   bool                 signalReceived(false);
4335   AnimationFinishCheck finishCheck(signalReceived);
4336   animation.FinishedSignal().Connect(&application, finishCheck);
4337
4338   application.SendNotification();
4339   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4340
4341   // We didn't expect the animation to finish yet
4342   application.SendNotification();
4343   finishCheck.CheckSignalNotReceived();
4344   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION);
4345
4346   application.SendNotification();
4347   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4348
4349   // We did expect the animation to finish
4350   application.SendNotification();
4351   finishCheck.CheckSignalReceived();
4352   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4353
4354   // Check that nothing has changed after a couple of buffer swaps
4355   application.Render(0);
4356   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4357   application.Render(0);
4358   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4359   END_TEST;
4360 }
4361
4362 int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void)
4363 {
4364   TestApplication application;
4365
4366   Actor actor = Actor::New();
4367
4368   // Register a Vector3 property
4369   Vector3         startValue(100.0f, 100.0f, 100.0f);
4370   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4371   application.GetScene().Add(actor);
4372   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4373   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4374
4375   // Build the animation
4376   float     durationSeconds(1.0f);
4377   Animation animation = Animation::New(durationSeconds);
4378   Vector3   targetValue(20.0f, 20.0f, 20.0f);
4379   Vector3   relativeValue(targetValue - startValue);
4380   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4381
4382   Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4383
4384   // Start the animation
4385   animation.Play();
4386
4387   bool                 signalReceived(false);
4388   AnimationFinishCheck finishCheck(signalReceived);
4389   animation.FinishedSignal().Connect(&application, finishCheck);
4390
4391   application.SendNotification();
4392   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4393
4394   // We didn't expect the animation to finish yet
4395   application.SendNotification();
4396   finishCheck.CheckSignalNotReceived();
4397
4398   // The position should have moved more, than with a linear alpha function
4399   Vector3 current(actor.GetCurrentProperty<Vector3>(index));
4400   DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x);
4401   DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y);
4402   DALI_TEST_CHECK(current.z < ninetyFivePercentProgress.z);
4403
4404   application.SendNotification();
4405   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4406
4407   // We did expect the animation to finish
4408   application.SendNotification();
4409   finishCheck.CheckSignalReceived();
4410   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4411
4412   // Check that nothing has changed after a couple of buffer swaps
4413   application.Render(0);
4414   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4415   application.Render(0);
4416   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4417   END_TEST;
4418 }
4419
4420 int UtcDaliAnimationAnimateByVector3TimePeriodP(void)
4421 {
4422   TestApplication application;
4423
4424   Actor actor = Actor::New();
4425
4426   // Register a Vector3 property
4427   Vector3         startValue(10.0f, 10.0f, 10.0f);
4428   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4429   application.GetScene().Add(actor);
4430   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4431   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4432
4433   // Build the animation
4434   float     durationSeconds(1.0f);
4435   Animation animation = Animation::New(durationSeconds);
4436   Vector3   targetValue(30.0f, 30.0f, 30.0f);
4437   Vector3   relativeValue(targetValue - startValue);
4438   float     delay = 0.5f;
4439   animation.AnimateBy(Property(actor, index),
4440                       relativeValue,
4441                       TimePeriod(delay, durationSeconds - delay));
4442
4443   // Start the animation
4444   animation.Play();
4445
4446   bool                 signalReceived(false);
4447   AnimationFinishCheck finishCheck(signalReceived);
4448   animation.FinishedSignal().Connect(&application, finishCheck);
4449
4450   application.SendNotification();
4451   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4452
4453   // We didn't expect the animation to finish yet
4454   application.SendNotification();
4455   finishCheck.CheckSignalNotReceived();
4456   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4457
4458   application.SendNotification();
4459   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4460
4461   // We didn't expect the animation to finish yet
4462   application.SendNotification();
4463   finishCheck.CheckSignalNotReceived();
4464   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4465
4466   application.SendNotification();
4467   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4468
4469   // We did expect the animation to finish
4470   application.SendNotification();
4471   finishCheck.CheckSignalReceived();
4472   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4473
4474   // Check that nothing has changed after a couple of buffer swaps
4475   application.Render(0);
4476   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4477   application.Render(0);
4478   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4479   END_TEST;
4480 }
4481
4482 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void)
4483 {
4484   TestApplication application;
4485
4486   Actor actor = Actor::New();
4487
4488   // Register a Vector3 property
4489   Vector3         startValue(5.0f, 5.0f, 5.0f);
4490   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4491   application.GetScene().Add(actor);
4492   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4493   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4494
4495   // Build the animation
4496   float     durationSeconds(1.0f);
4497   Animation animation = Animation::New(durationSeconds);
4498   Vector3   targetValue(10.0f, 10.0f, 10.0f);
4499   Vector3   relativeValue(targetValue - startValue);
4500   float     delay = 0.5f;
4501   animation.AnimateBy(Property(actor, index),
4502                       relativeValue,
4503                       AlphaFunction::LINEAR,
4504                       TimePeriod(delay, durationSeconds - delay));
4505
4506   // Start the animation
4507   animation.Play();
4508
4509   bool                 signalReceived(false);
4510   AnimationFinishCheck finishCheck(signalReceived);
4511   animation.FinishedSignal().Connect(&application, finishCheck);
4512
4513   application.SendNotification();
4514   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4515
4516   // We didn't expect the animation to finish yet
4517   application.SendNotification();
4518   finishCheck.CheckSignalNotReceived();
4519   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4520
4521   application.SendNotification();
4522   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4523
4524   // We didn't expect the animation to finish yet
4525   application.SendNotification();
4526   finishCheck.CheckSignalNotReceived();
4527   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4528
4529   application.SendNotification();
4530   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4531
4532   // We did expect the animation to finish
4533   application.SendNotification();
4534   finishCheck.CheckSignalReceived();
4535   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4536
4537   // Check that nothing has changed after a couple of buffer swaps
4538   application.Render(0);
4539   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4540   application.Render(0);
4541   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4542   END_TEST;
4543 }
4544
4545 int UtcDaliAnimationAnimateByVector4P(void)
4546 {
4547   TestApplication application;
4548
4549   Actor actor = Actor::New();
4550
4551   // Register a Vector4 property
4552   Vector4         startValue(10.0f, 10.0f, 10.0f, 10.0f);
4553   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4554   application.GetScene().Add(actor);
4555   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4556   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4557
4558   // Build the animation
4559   float     durationSeconds(2.0f);
4560   Animation animation = Animation::New(durationSeconds);
4561   Vector4   targetValue(60.0f, 60.0f, 60.0f, 60.0f);
4562   Vector4   relativeValue(targetValue - startValue);
4563   animation.AnimateBy(Property(actor, index), relativeValue);
4564
4565   Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4566
4567   // Start the animation
4568   animation.Play();
4569
4570   // Target value should be retrievable straight away
4571   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION);
4572
4573   bool                 signalReceived(false);
4574   AnimationFinishCheck finishCheck(signalReceived);
4575   animation.FinishedSignal().Connect(&application, finishCheck);
4576
4577   application.SendNotification();
4578   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4579
4580   // We didn't expect the animation to finish yet
4581   application.SendNotification();
4582   finishCheck.CheckSignalNotReceived();
4583   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION);
4584
4585   application.SendNotification();
4586   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4587
4588   // We did expect the animation to finish
4589   application.SendNotification();
4590   finishCheck.CheckSignalReceived();
4591   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4592
4593   // Check that nothing has changed after a couple of buffer swaps
4594   application.Render(0);
4595   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4596   application.Render(0);
4597   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4598   END_TEST;
4599 }
4600
4601 int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void)
4602 {
4603   TestApplication application;
4604
4605   Actor actor = Actor::New();
4606
4607   // Register a Vector4 property
4608   Vector4         startValue(100.0f, 100.0f, 100.0f, 100.0f);
4609   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4610   application.GetScene().Add(actor);
4611   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4612   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4613
4614   // Build the animation
4615   float     durationSeconds(1.0f);
4616   Animation animation = Animation::New(durationSeconds);
4617   Vector4   targetValue(20.0f, 20.0f, 20.0f, 20.0f);
4618   Vector4   relativeValue(targetValue - startValue);
4619   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4620
4621   Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4622
4623   // Start the animation
4624   animation.Play();
4625
4626   bool                 signalReceived(false);
4627   AnimationFinishCheck finishCheck(signalReceived);
4628   animation.FinishedSignal().Connect(&application, finishCheck);
4629
4630   application.SendNotification();
4631   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4632
4633   // We didn't expect the animation to finish yet
4634   application.SendNotification();
4635   finishCheck.CheckSignalNotReceived();
4636
4637   // The position should have moved more, than with a linear alpha function
4638   Vector4 current(actor.GetCurrentProperty<Vector4>(index));
4639   DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x);
4640   DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y);
4641   DALI_TEST_CHECK(current.z < ninetyFivePercentProgress.z);
4642   DALI_TEST_CHECK(current.w < ninetyFivePercentProgress.w);
4643
4644   application.SendNotification();
4645   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4646
4647   // We did expect the animation to finish
4648   application.SendNotification();
4649   finishCheck.CheckSignalReceived();
4650   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4651
4652   // Check that nothing has changed after a couple of buffer swaps
4653   application.Render(0);
4654   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4655   application.Render(0);
4656   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4657   END_TEST;
4658 }
4659
4660 int UtcDaliAnimationAnimateByVector4TimePeriodP(void)
4661 {
4662   TestApplication application;
4663
4664   Actor actor = Actor::New();
4665
4666   // Register a Vector4 property
4667   Vector4         startValue(10.0f, 10.0f, 10.0f, 10.0f);
4668   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4669   application.GetScene().Add(actor);
4670   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4671   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4672
4673   // Build the animation
4674   float     durationSeconds(1.0f);
4675   Animation animation = Animation::New(durationSeconds);
4676   Vector4   targetValue(30.0f, 30.0f, 30.0f, 30.0f);
4677   Vector4   relativeValue(targetValue - startValue);
4678   float     delay = 0.5f;
4679   animation.AnimateBy(Property(actor, index),
4680                       relativeValue,
4681                       TimePeriod(delay, durationSeconds - delay));
4682
4683   // Start the animation
4684   animation.Play();
4685
4686   bool                 signalReceived(false);
4687   AnimationFinishCheck finishCheck(signalReceived);
4688   animation.FinishedSignal().Connect(&application, finishCheck);
4689
4690   application.SendNotification();
4691   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4692
4693   // We didn't expect the animation to finish yet
4694   application.SendNotification();
4695   finishCheck.CheckSignalNotReceived();
4696   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4697
4698   application.SendNotification();
4699   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4700
4701   // We didn't expect the animation to finish yet
4702   application.SendNotification();
4703   finishCheck.CheckSignalNotReceived();
4704   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4705
4706   application.SendNotification();
4707   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4708
4709   // We did expect the animation to finish
4710   application.SendNotification();
4711   finishCheck.CheckSignalReceived();
4712   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4713
4714   // Check that nothing has changed after a couple of buffer swaps
4715   application.Render(0);
4716   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4717   application.Render(0);
4718   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4719   END_TEST;
4720 }
4721
4722 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void)
4723 {
4724   TestApplication application;
4725
4726   Actor actor = Actor::New();
4727
4728   // Register a Vector4 property
4729   Vector4         startValue(5.0f, 5.0f, 5.0f, 5.0f);
4730   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4731   application.GetScene().Add(actor);
4732   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4733   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4734
4735   // Build the animation
4736   float     durationSeconds(1.0f);
4737   Animation animation = Animation::New(durationSeconds);
4738   Vector4   targetValue(10.0f, 10.0f, 10.0f, 10.0f);
4739   Vector4   relativeValue(targetValue - startValue);
4740   float     delay = 0.5f;
4741   animation.AnimateBy(Property(actor, index),
4742                       relativeValue,
4743                       AlphaFunction::LINEAR,
4744                       TimePeriod(delay, durationSeconds - delay));
4745
4746   // Start the animation
4747   animation.Play();
4748
4749   bool                 signalReceived(false);
4750   AnimationFinishCheck finishCheck(signalReceived);
4751   animation.FinishedSignal().Connect(&application, finishCheck);
4752
4753   application.SendNotification();
4754   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4755
4756   // We didn't expect the animation to finish yet
4757   application.SendNotification();
4758   finishCheck.CheckSignalNotReceived();
4759   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4760
4761   application.SendNotification();
4762   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4763
4764   // We didn't expect the animation to finish yet
4765   application.SendNotification();
4766   finishCheck.CheckSignalNotReceived();
4767   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4768
4769   application.SendNotification();
4770   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4771
4772   // We did expect the animation to finish
4773   application.SendNotification();
4774   finishCheck.CheckSignalReceived();
4775   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4776
4777   // Check that nothing has changed after a couple of buffer swaps
4778   application.Render(0);
4779   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4780   application.Render(0);
4781   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4782   END_TEST;
4783 }
4784
4785 int UtcDaliAnimationAnimateByActorPositionP(void)
4786 {
4787   TestApplication application;
4788
4789   Actor   actor = Actor::New();
4790   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4791   actor.SetProperty(Actor::Property::POSITION, startPosition);
4792   application.GetScene().Add(actor);
4793   application.SendNotification();
4794   application.Render(0);
4795   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4796
4797   // Build the animation
4798   float     durationSeconds(1.0f);
4799   Animation animation = Animation::New(durationSeconds);
4800   Vector3   targetPosition(20.0f, 20.0f, 20.0f);
4801   Vector3   relativePosition(targetPosition - startPosition);
4802   animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition);
4803
4804   Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
4805
4806   // Start the animation
4807   animation.Play();
4808
4809   // Target value should be retrievable straight away
4810   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4811
4812   bool                 signalReceived(false);
4813   AnimationFinishCheck finishCheck(signalReceived);
4814   animation.FinishedSignal().Connect(&application, finishCheck);
4815
4816   application.SendNotification();
4817   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4818
4819   // We didn't expect the animation to finish yet
4820   application.SendNotification();
4821   finishCheck.CheckSignalNotReceived();
4822   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), ninetyFivePercentProgress, TEST_LOCATION);
4823
4824   application.SendNotification();
4825   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4826
4827   // We did expect the animation to finish
4828   application.SendNotification();
4829   finishCheck.CheckSignalReceived();
4830   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4831
4832   // Check that nothing has changed after a couple of buffer swaps
4833   application.Render(0);
4834   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4835   application.Render(0);
4836   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4837   END_TEST;
4838 }
4839
4840 int UtcDaliAnimationAnimateByActorPositionComponentsP(void)
4841 {
4842   TestApplication application;
4843
4844   Actor actor = Actor::New();
4845   application.GetScene().Add(actor);
4846   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
4847
4848   // Build the animation
4849   float     durationSeconds(1.0f);
4850   Animation animation = Animation::New(durationSeconds);
4851   Vector3   targetPosition(200.0f, 300.0f, 400.0f);
4852   Vector3   relativePosition(targetPosition - Vector3::ZERO);
4853   animation.AnimateBy(Property(actor, Actor::Property::POSITION_X), relativePosition.x);
4854   animation.AnimateBy(Property(actor, Actor::Property::POSITION_Y), relativePosition.y);
4855   animation.AnimateBy(Property(actor, Actor::Property::POSITION_Z), relativePosition.z);
4856
4857   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
4858   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
4859
4860   // Start the animation
4861   animation.Play();
4862
4863   // Target value should be retrievable straight away
4864   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4865   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
4866   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
4867   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
4868
4869   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); // Not changed yet
4870
4871   application.SendNotification();
4872   application.Render(1000); // 1 second progress
4873
4874   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4875
4876   END_TEST;
4877 }
4878
4879 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
4880 {
4881   TestApplication application;
4882
4883   Actor   actor = Actor::New();
4884   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4885   actor.SetProperty(Actor::Property::POSITION, startPosition);
4886   application.GetScene().Add(actor);
4887   application.SendNotification();
4888   application.Render(0);
4889   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4890
4891   // Build the animation
4892   float     durationSeconds(1.0f);
4893   Animation animation = Animation::New(durationSeconds);
4894   Vector3   targetPosition(20.0f, 20.0f, 20.0f);
4895   Vector3   relativePosition(targetPosition - startPosition);
4896   animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
4897
4898   Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
4899
4900   // Start the animation
4901   animation.Play();
4902
4903   bool                 signalReceived(false);
4904   AnimationFinishCheck finishCheck(signalReceived);
4905   animation.FinishedSignal().Connect(&application, finishCheck);
4906
4907   application.SendNotification();
4908   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4909
4910   // We didn't expect the animation to finish yet
4911   application.SendNotification();
4912   finishCheck.CheckSignalNotReceived();
4913
4914   // The position should have moved more, than with a linear alpha function
4915   Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
4916   DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
4917   DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
4918   DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z);
4919
4920   application.SendNotification();
4921   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4922
4923   // We did expect the animation to finish
4924   application.SendNotification();
4925   finishCheck.CheckSignalReceived();
4926   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4927
4928   // Check that nothing has changed after a couple of buffer swaps
4929   application.Render(0);
4930   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4931   application.Render(0);
4932   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4933   END_TEST;
4934 }
4935
4936 int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void)
4937 {
4938   TestApplication application;
4939
4940   Actor   actor = Actor::New();
4941   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4942   actor.SetProperty(Actor::Property::POSITION, startPosition);
4943   application.GetScene().Add(actor);
4944   application.SendNotification();
4945   application.Render(0);
4946   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4947
4948   // Build the animation
4949   float     durationSeconds(1.0f);
4950   Animation animation = Animation::New(durationSeconds);
4951   Vector3   targetPosition(20.0f, 20.0f, 20.0f);
4952   Vector3   relativePosition(targetPosition - startPosition);
4953   float     delay = 0.5f;
4954   animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4955                       relativePosition,
4956                       TimePeriod(delay, durationSeconds - delay));
4957
4958   Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
4959
4960   // Start the animation
4961   animation.Play();
4962
4963   bool                 signalReceived(false);
4964   AnimationFinishCheck finishCheck(signalReceived);
4965   animation.FinishedSignal().Connect(&application, finishCheck);
4966
4967   application.SendNotification();
4968   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4969
4970   // We didn't expect the animation to finish yet
4971   application.SendNotification();
4972   finishCheck.CheckSignalNotReceived();
4973   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4974
4975   application.SendNotification();
4976   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
4977
4978   // We did expect the animation to finish
4979   application.SendNotification();
4980   finishCheck.CheckSignalReceived();
4981   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4982
4983   // Check that nothing has changed after a couple of buffer swaps
4984   application.Render(0);
4985   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4986   application.Render(0);
4987   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4988   END_TEST;
4989 }
4990
4991 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void)
4992 {
4993   TestApplication application;
4994
4995   Actor   actor = Actor::New();
4996   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4997   actor.SetProperty(Actor::Property::POSITION, startPosition);
4998   application.GetScene().Add(actor);
4999   application.SendNotification();
5000   application.Render(0);
5001   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
5002
5003   // Build the animation
5004   float     durationSeconds(1.0f);
5005   Animation animation = Animation::New(durationSeconds);
5006   Vector3   targetPosition(20.0f, 20.0f, 20.0f);
5007   Vector3   relativePosition(targetPosition - startPosition);
5008   float     delay = 0.5f;
5009   animation.AnimateBy(Property(actor, Actor::Property::POSITION),
5010                       relativePosition,
5011                       AlphaFunction::LINEAR,
5012                       TimePeriod(delay, durationSeconds - delay));
5013
5014   Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
5015
5016   // Start the animation
5017   animation.Play();
5018
5019   bool                 signalReceived(false);
5020   AnimationFinishCheck finishCheck(signalReceived);
5021   animation.FinishedSignal().Connect(&application, finishCheck);
5022
5023   application.SendNotification();
5024   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
5025
5026   // We didn't expect the animation to finish yet
5027   application.SendNotification();
5028   finishCheck.CheckSignalNotReceived();
5029   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
5030
5031   application.SendNotification();
5032   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
5033
5034   // We did expect the animation to finish
5035   application.SendNotification();
5036   finishCheck.CheckSignalReceived();
5037   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5038
5039   // Check that nothing has changed after a couple of buffer swaps
5040   application.Render(0);
5041   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5042   application.Render(0);
5043   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5044   END_TEST;
5045 }
5046
5047 int UtcDaliAnimationAnimateByActorOrientationP1(void)
5048 {
5049   TestApplication application;
5050
5051   Actor actor = Actor::New();
5052   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
5053   application.GetScene().Add(actor);
5054   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5055
5056   // Build the animation
5057   float     durationSeconds(1.0f);
5058   Animation animation = Animation::New(durationSeconds);
5059   Degree    relativeRotationDegrees(360.0f);
5060   Radian    relativeRotationRadians(relativeRotationDegrees);
5061   animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS));
5062
5063   // Start the animation
5064   animation.Play();
5065
5066   // Target value should be retrievable straight away
5067   DALI_TEST_EQUALS(actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), TEST_LOCATION);
5068
5069   bool                 signalReceived(false);
5070   AnimationFinishCheck finishCheck(signalReceived);
5071   animation.FinishedSignal().Connect(&application, finishCheck);
5072
5073   application.SendNotification();
5074   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5075
5076   // We didn't expect the animation to finish yet
5077   application.SendNotification();
5078   finishCheck.CheckSignalNotReceived();
5079   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5080
5081   application.SendNotification();
5082   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5083
5084   // We didn't expect the animation to finish yet
5085   application.SendNotification();
5086   finishCheck.CheckSignalNotReceived();
5087   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5088
5089   application.SendNotification();
5090   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5091
5092   // We didn't expect the animation to finish yet
5093   application.SendNotification();
5094   finishCheck.CheckSignalNotReceived();
5095   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5096
5097   application.SendNotification();
5098   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5099
5100   // We did expect the animation to finish
5101   application.SendNotification();
5102   finishCheck.CheckSignalReceived();
5103   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5104   END_TEST;
5105 }
5106
5107 int UtcDaliAnimationAnimateByActorOrientationP2(void)
5108 {
5109   TestApplication application;
5110
5111   tet_printf("Testing that rotation angle > 360 performs full rotations\n");
5112
5113   Actor actor = Actor::New();
5114   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::ZAXIS));
5115   application.GetScene().Add(actor);
5116   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5117
5118   // Build the animation
5119   float     durationSeconds(1.0f);
5120   Animation animation = Animation::New(durationSeconds);
5121   Degree    relativeRotationDegrees(710.0f);
5122   Radian    relativeRotationRadians(relativeRotationDegrees);
5123
5124   animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), AngleAxis(relativeRotationRadians, Vector3::ZAXIS));
5125
5126   // Start the animation
5127   animation.Play();
5128
5129   bool                 signalReceived(false);
5130   AnimationFinishCheck finishCheck(signalReceived);
5131   animation.FinishedSignal().Connect(&application, finishCheck);
5132
5133   application.SendNotification();
5134   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5135
5136   // We didn't expect the animation to finish yet
5137   application.SendNotification();
5138   finishCheck.CheckSignalNotReceived();
5139   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5140
5141   application.SendNotification();
5142   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5143
5144   // We didn't expect the animation to finish yet
5145   application.SendNotification();
5146   finishCheck.CheckSignalNotReceived();
5147   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5148
5149   application.SendNotification();
5150   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5151
5152   // We didn't expect the animation to finish yet
5153   application.SendNotification();
5154   finishCheck.CheckSignalNotReceived();
5155   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5156
5157   application.SendNotification();
5158   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5159
5160   // We did expect the animation to finish
5161   application.SendNotification();
5162   finishCheck.CheckSignalReceived();
5163   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5164   END_TEST;
5165 }
5166
5167 int UtcDaliAnimationAnimateByActorOrientationP3(void)
5168 {
5169   TestApplication application;
5170
5171   tet_printf("Testing that rotation angle > 360 performs partial rotations when cast to Quaternion\n");
5172
5173   Actor actor = Actor::New();
5174   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::ZAXIS));
5175   application.GetScene().Add(actor);
5176   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5177
5178   // Build the animation
5179   float     durationSeconds(1.0f);
5180   Animation animation = Animation::New(durationSeconds);
5181   Degree    relativeRotationDegrees(730.0f);
5182   Radian    relativeRotationRadians(relativeRotationDegrees);
5183
5184   Radian actualRotationRadians(Degree(10.0f));
5185
5186   animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS));
5187
5188   // Start the animation
5189   animation.Play();
5190
5191   bool                 signalReceived(false);
5192   AnimationFinishCheck finishCheck(signalReceived);
5193   animation.FinishedSignal().Connect(&application, finishCheck);
5194
5195   application.SendNotification();
5196   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5197
5198   // We didn't expect the animation to finish yet
5199   application.SendNotification();
5200   finishCheck.CheckSignalNotReceived();
5201   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5202
5203   application.SendNotification();
5204   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5205
5206   // We didn't expect the animation to finish yet
5207   application.SendNotification();
5208   finishCheck.CheckSignalNotReceived();
5209   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5210
5211   application.SendNotification();
5212   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5213
5214   // We didn't expect the animation to finish yet
5215   application.SendNotification();
5216   finishCheck.CheckSignalNotReceived();
5217   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5218
5219   application.SendNotification();
5220   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5221
5222   // We did expect the animation to finish
5223   application.SendNotification();
5224   finishCheck.CheckSignalReceived();
5225   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5226   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5227   END_TEST;
5228 }
5229
5230 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
5231 {
5232   TestApplication application;
5233
5234   Actor actor = Actor::New();
5235   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
5236   application.GetScene().Add(actor);
5237   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5238
5239   // Build the animation
5240   float     durationSeconds(1.0f);
5241   Animation animation = Animation::New(durationSeconds);
5242   Degree    relativeRotationDegrees(360.0f);
5243   Radian    relativeRotationRadians(relativeRotationDegrees);
5244   animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), AlphaFunction::EASE_IN);
5245
5246   // Start the animation
5247   animation.Play();
5248
5249   bool                 signalReceived(false);
5250   AnimationFinishCheck finishCheck(signalReceived);
5251   animation.FinishedSignal().Connect(&application, finishCheck);
5252
5253   application.SendNotification();
5254   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5255
5256   // We didn't expect the animation to finish yet
5257   application.SendNotification();
5258   finishCheck.CheckSignalNotReceived();
5259   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f * 0.25f * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5260
5261   application.SendNotification();
5262   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5263
5264   // We didn't expect the animation to finish yet
5265   application.SendNotification();
5266   finishCheck.CheckSignalNotReceived();
5267   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f * 0.5f * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5268
5269   application.SendNotification();
5270   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5271
5272   // We didn't expect the animation to finish yet
5273   application.SendNotification();
5274   finishCheck.CheckSignalNotReceived();
5275   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f * 0.75f * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5276
5277   application.SendNotification();
5278   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5279
5280   // We did expect the animation to finish
5281   application.SendNotification();
5282   finishCheck.CheckSignalReceived();
5283   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5284   END_TEST;
5285 }
5286
5287 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void)
5288 {
5289   TestApplication application;
5290
5291   Actor actor = Actor::New();
5292   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
5293   application.GetScene().Add(actor);
5294   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5295
5296   // Build the animation
5297   float     durationSeconds(1.0f);
5298   Animation animation = Animation::New(durationSeconds);
5299   Degree    relativeRotationDegrees(360.0f);
5300   Radian    relativeRotationRadians(relativeRotationDegrees);
5301   float     delay = 0.3f;
5302   animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
5303
5304   // Start the animation
5305   animation.Play();
5306
5307   bool                 signalReceived(false);
5308   AnimationFinishCheck finishCheck(signalReceived);
5309   animation.FinishedSignal().Connect(&application, finishCheck);
5310
5311   application.SendNotification();
5312   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5313
5314   // We didn't expect the animation to finish yet
5315   application.SendNotification();
5316   finishCheck.CheckSignalNotReceived();
5317   float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
5318   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5319
5320   application.SendNotification();
5321   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5322
5323   // We didn't expect the animation to finish yet
5324   application.SendNotification();
5325   finishCheck.CheckSignalNotReceived();
5326   progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
5327   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5328
5329   application.SendNotification();
5330   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5331
5332   // We didn't expect the animation to finish yet
5333   application.SendNotification();
5334   finishCheck.CheckSignalNotReceived();
5335   progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
5336   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5337
5338   application.SendNotification();
5339   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5340
5341   // We did expect the animation to finish
5342   application.SendNotification();
5343   finishCheck.CheckSignalReceived();
5344   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5345   END_TEST;
5346 }
5347
5348 int UtcDaliAnimationAnimateByActorScaleP(void)
5349 {
5350   TestApplication application;
5351
5352   Actor actor = Actor::New();
5353   application.GetScene().Add(actor);
5354   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5355
5356   // Build the animation
5357   float     durationSeconds(1.0f);
5358   Animation animation = Animation::New(durationSeconds);
5359   Vector3   targetScale(2.0f, 2.0f, 2.0f);
5360   Vector3   relativeScale(targetScale - Vector3::ONE);
5361   animation.AnimateBy(Property(actor, Actor::Property::SCALE), Vector3(relativeScale.x, relativeScale.y, relativeScale.z));
5362
5363   Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale * 0.99f);
5364
5365   // Start the animation
5366   animation.Play();
5367
5368   // Target value should be retrievable straight away
5369   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5370
5371   bool                 signalReceived(false);
5372   AnimationFinishCheck finishCheck(signalReceived);
5373   animation.FinishedSignal().Connect(&application, finishCheck);
5374
5375   application.SendNotification();
5376   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
5377
5378   // We didn't expect the animation to finish yet
5379   application.SendNotification();
5380   finishCheck.CheckSignalNotReceived();
5381   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), ninetyNinePercentProgress, TEST_LOCATION);
5382
5383   application.SendNotification();
5384   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
5385
5386   // We did expect the animation to finish
5387   application.SendNotification();
5388   finishCheck.CheckSignalReceived();
5389   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5390
5391   // Reset everything
5392   finishCheck.Reset();
5393   actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
5394   application.SendNotification();
5395   application.Render(0);
5396   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5397
5398   // Repeat with a different (ease-in) alpha function
5399   animation = Animation::New(durationSeconds);
5400   animation.AnimateBy(Property(actor, Actor::Property::SCALE), relativeScale, AlphaFunction::EASE_IN);
5401   animation.FinishedSignal().Connect(&application, finishCheck);
5402   animation.Play();
5403
5404   application.SendNotification();
5405   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
5406
5407   // We didn't expect the animation to finish yet
5408   application.SendNotification();
5409   finishCheck.CheckSignalNotReceived();
5410
5411   // The scale should have grown less, than with a linear alpha function
5412   Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
5413   DALI_TEST_CHECK(current.x > 1.0f);
5414   DALI_TEST_CHECK(current.y > 1.0f);
5415   DALI_TEST_CHECK(current.z > 1.0f);
5416   DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
5417   DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
5418   DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z);
5419
5420   application.SendNotification();
5421   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
5422
5423   // We did expect the animation to finish
5424   application.SendNotification();
5425   finishCheck.CheckSignalReceived();
5426   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5427
5428   // Reset everything
5429   finishCheck.Reset();
5430   actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
5431   application.SendNotification();
5432   application.Render(0);
5433   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5434
5435   // Repeat with a delay
5436   float delay = 0.5f;
5437   animation   = Animation::New(durationSeconds);
5438   animation.AnimateBy(Property(actor, Actor::Property::SCALE), relativeScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
5439   animation.FinishedSignal().Connect(&application, finishCheck);
5440   animation.Play();
5441
5442   application.SendNotification();
5443   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
5444
5445   // We didn't expect the animation to finish yet
5446   application.SendNotification();
5447   finishCheck.CheckSignalNotReceived();
5448   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5449
5450   application.SendNotification();
5451   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
5452
5453   // We did expect the animation to finish
5454   application.SendNotification();
5455   finishCheck.CheckSignalReceived();
5456   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5457   END_TEST;
5458 }
5459
5460 int UtcDaliAnimationAnimateByActorScaleComponentsP(void)
5461 {
5462   TestApplication application;
5463
5464   Actor actor = Actor::New();
5465   application.GetScene().Add(actor);
5466   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5467
5468   // Build the animation
5469   float     durationSeconds(1.0f);
5470   Animation animation = Animation::New(durationSeconds);
5471   Vector3   targetScale(2.0f, 3.0f, 4.0f);
5472   Vector3   relativeScale(targetScale - Vector3::ONE);
5473   animation.AnimateBy(Property(actor, Actor::Property::SCALE_X), relativeScale.x);
5474   animation.AnimateBy(Property(actor, Actor::Property::SCALE_Y), relativeScale.y);
5475   animation.AnimateBy(Property(actor, Actor::Property::SCALE_Z), relativeScale.z);
5476
5477   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5478   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5479
5480   // Start the animation
5481   animation.Play();
5482
5483   // Target value should be retrievable straight away
5484   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5485   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), targetScale.x, TEST_LOCATION);
5486   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), targetScale.y, TEST_LOCATION);
5487   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), targetScale.z, TEST_LOCATION);
5488
5489   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION); // Not changed yet
5490
5491   application.SendNotification();
5492   application.Render(1000); // 1 second progress
5493
5494   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5495
5496   END_TEST;
5497 }
5498
5499 int UtcDaliAnimationAnimateByActorColorP(void)
5500 {
5501   TestApplication application;
5502
5503   Actor actor = Actor::New();
5504   application.GetScene().Add(actor);
5505   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5506
5507   // Build the animation
5508   float     durationSeconds(1.0f);
5509   Animation animation = Animation::New(durationSeconds);
5510   Vector4   targetColor(0.5f, 0.75f, 0.8f, 0.1f);
5511   Vector4   relativeColor(targetColor - Color::WHITE);
5512   animation.AnimateBy(Property(actor, Actor::Property::COLOR), relativeColor);
5513
5514   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5515   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5516
5517   // Start the animation
5518   animation.Play();
5519
5520   // Target value should be retrievable straight away
5521   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5522   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION);
5523   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION);
5524   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION);
5525   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION);
5526
5527   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); // Not changed yet
5528
5529   application.SendNotification();
5530   application.Render(1000); // 1 second progress
5531
5532   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5533
5534   END_TEST;
5535 }
5536
5537 int UtcDaliAnimationAnimateByActorColorComponentsP(void)
5538 {
5539   TestApplication application;
5540
5541   Actor actor = Actor::New();
5542   application.GetScene().Add(actor);
5543   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5544
5545   // Build the animation
5546   float     durationSeconds(1.0f);
5547   Animation animation = Animation::New(durationSeconds);
5548   Vector4   targetColor(0.5f, 0.75f, 0.8f, 0.1f);
5549   Vector4   relativeColor(targetColor - Color::WHITE);
5550   animation.AnimateBy(Property(actor, Actor::Property::COLOR_RED), relativeColor.r);
5551   animation.AnimateBy(Property(actor, Actor::Property::COLOR_GREEN), relativeColor.g);
5552   animation.AnimateBy(Property(actor, Actor::Property::COLOR_BLUE), relativeColor.b);
5553   animation.AnimateBy(Property(actor, Actor::Property::COLOR_ALPHA), relativeColor.a);
5554
5555   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5556   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5557
5558   // Start the animation
5559   animation.Play();
5560
5561   // Target value should be retrievable straight away
5562   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5563   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION);
5564   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION);
5565   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION);
5566   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION);
5567
5568   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); // Not changed yet
5569
5570   application.SendNotification();
5571   application.Render(1000); // 1 second progress
5572
5573   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5574
5575   END_TEST;
5576 }
5577
5578 int UtcDaliAnimationAnimateByActorSizeP(void)
5579 {
5580   TestApplication application;
5581
5582   Actor actor = Actor::New();
5583   application.GetScene().Add(actor);
5584   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5585
5586   // Build the animation
5587   float     durationSeconds(1.0f);
5588   Animation animation = Animation::New(durationSeconds);
5589   Vector3   targetSize(100.0f, 200.0f, 300.0f);
5590   Vector3   relativeSize(targetSize - Vector3::ZERO);
5591   animation.AnimateBy(Property(actor, Actor::Property::SIZE), relativeSize);
5592
5593   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5594   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5595
5596   // Start the animation
5597   animation.Play();
5598
5599   // Target value should be retrievable straight away
5600   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5601   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION);
5602   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION);
5603   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION);
5604
5605   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Not changed yet
5606
5607   application.SendNotification();
5608   application.Render(1000); // 1 second progress
5609
5610   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5611
5612   END_TEST;
5613 }
5614
5615 int UtcDaliAnimationAnimateByActorSizeComponentsP(void)
5616 {
5617   TestApplication application;
5618
5619   Actor actor = Actor::New();
5620   application.GetScene().Add(actor);
5621   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5622
5623   // Build the animation
5624   float     durationSeconds(1.0f);
5625   Animation animation = Animation::New(durationSeconds);
5626   Vector3   targetSize(100.0f, 200.0f, 300.0f);
5627   Vector3   relativeSize(targetSize - Vector3::ZERO);
5628   animation.AnimateBy(Property(actor, Actor::Property::SIZE_WIDTH), relativeSize.width);
5629   animation.AnimateBy(Property(actor, Actor::Property::SIZE_HEIGHT), relativeSize.height);
5630   animation.AnimateBy(Property(actor, Actor::Property::SIZE_DEPTH), relativeSize.depth);
5631
5632   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5633   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5634
5635   // Start the animation
5636   animation.Play();
5637
5638   // Target value should be retrievable straight away
5639   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5640   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION);
5641   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION);
5642   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION);
5643
5644   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Not changed yet
5645
5646   application.SendNotification();
5647   application.Render(1000); // 1 second progress
5648
5649   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5650
5651   END_TEST;
5652 }
5653
5654 int UtcDaliAnimationAnimateByActorVisibilityP(void)
5655 {
5656   TestApplication application;
5657
5658   Actor actor = Actor::New();
5659   application.GetScene().Add(actor);
5660   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
5661
5662   actor.SetProperty(Actor::Property::VISIBLE, false);
5663
5664   application.SendNotification();
5665   application.Render();
5666
5667   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
5668
5669   // Build the animation
5670   float     durationSeconds(1.0f);
5671   Animation animation = Animation::New(durationSeconds);
5672   bool      targetVisibility(true);
5673   bool      relativeVisibility(targetVisibility);
5674   animation.AnimateBy(Property(actor, Actor::Property::VISIBLE), relativeVisibility);
5675
5676   DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
5677
5678   // Start the animation
5679   animation.Play();
5680
5681   // Target value should be retrievable straight away
5682   DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), targetVisibility, TEST_LOCATION);
5683   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION); // Not changed yet
5684
5685   application.SendNotification();
5686   application.Render(1000); // 1 second progress
5687
5688   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
5689
5690   END_TEST;
5691 }
5692
5693 int UtcDaliAnimationAnimateToBooleanP(void)
5694 {
5695   TestApplication application;
5696
5697   Actor actor = Actor::New();
5698
5699   // Register a boolean property
5700   const bool      startValue(false);
5701   Property::Index index = actor.RegisterProperty("testProperty", startValue);
5702   application.GetScene().Add(actor);
5703   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5704   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5705
5706   // Build the animation
5707   float      durationSeconds(2.0f);
5708   Animation  animation = Animation::New(durationSeconds);
5709   const bool targetValue(!startValue);
5710   animation.AnimateTo(Property(actor, index), targetValue);
5711
5712   // Start the animation
5713   animation.Play();
5714
5715   bool                 signalReceived(false);
5716   AnimationFinishCheck finishCheck(signalReceived);
5717   animation.FinishedSignal().Connect(&application, finishCheck);
5718
5719   application.SendNotification();
5720   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5721
5722   // We didn't expect the animation to finish yet
5723   application.SendNotification();
5724   finishCheck.CheckSignalNotReceived();
5725   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5726
5727   application.SendNotification();
5728   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5729
5730   // We did expect the animation to finish
5731   application.SendNotification();
5732   finishCheck.CheckSignalReceived();
5733   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5734
5735   // Check that nothing has changed after a couple of buffer swaps
5736   application.Render(0);
5737   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5738   application.Render(0);
5739   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5740
5741   // Repeat with target value "false"
5742   animation = Animation::New(durationSeconds);
5743   const bool finalValue(!targetValue);
5744   animation.AnimateTo(Property(actor, index), finalValue);
5745
5746   // Start the animation
5747   animation.Play();
5748
5749   finishCheck.Reset();
5750   animation.FinishedSignal().Connect(&application, finishCheck);
5751
5752   application.SendNotification();
5753   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5754
5755   // We didn't expect the animation to finish yet
5756   application.SendNotification();
5757   finishCheck.CheckSignalNotReceived();
5758   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5759
5760   application.SendNotification();
5761   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5762
5763   // We did expect the animation to finish
5764   application.SendNotification();
5765   finishCheck.CheckSignalReceived();
5766   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5767
5768   // Check that nothing has changed after a couple of buffer swaps
5769   application.Render(0);
5770   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5771   application.Render(0);
5772   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5773   END_TEST;
5774 }
5775
5776 int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void)
5777 {
5778   TestApplication application;
5779
5780   Actor actor = Actor::New();
5781
5782   // Register a boolean property
5783   const bool      startValue(false);
5784   Property::Index index = actor.RegisterProperty("testProperty", startValue);
5785   application.GetScene().Add(actor);
5786   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5787   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5788
5789   // Build the animation
5790   float      durationSeconds(2.0f);
5791   Animation  animation = Animation::New(durationSeconds);
5792   const bool targetValue(!startValue);
5793   animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
5794
5795   // Start the animation
5796   animation.Play();
5797
5798   bool                 signalReceived(false);
5799   AnimationFinishCheck finishCheck(signalReceived);
5800   animation.FinishedSignal().Connect(&application, finishCheck);
5801
5802   application.SendNotification();
5803   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5804
5805   // We didn't expect the animation to finish yet
5806   application.SendNotification();
5807   finishCheck.CheckSignalNotReceived();
5808   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5809
5810   application.SendNotification();
5811   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5812
5813   // We did expect the animation to finish
5814   application.SendNotification();
5815   finishCheck.CheckSignalReceived();
5816   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5817
5818   // Check that nothing has changed after a couple of buffer swaps
5819   application.Render(0);
5820   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5821   application.Render(0);
5822   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5823
5824   // Repeat with target value "false"
5825   animation = Animation::New(durationSeconds);
5826   const bool finalValue(!targetValue);
5827   animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
5828
5829   // Start the animation
5830   animation.Play();
5831
5832   finishCheck.Reset();
5833   animation.FinishedSignal().Connect(&application, finishCheck);
5834
5835   application.SendNotification();
5836   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5837
5838   // We didn't expect the animation to finish yet
5839   application.SendNotification();
5840   finishCheck.CheckSignalNotReceived();
5841   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5842
5843   application.SendNotification();
5844   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5845
5846   // We did expect the animation to finish
5847   application.SendNotification();
5848   finishCheck.CheckSignalReceived();
5849   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5850
5851   // Check that nothing has changed after a couple of buffer swaps
5852   application.Render(0);
5853   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5854   application.Render(0);
5855   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5856   END_TEST;
5857 }
5858
5859 int UtcDaliAnimationAnimateToBooleanTimePeriodP(void)
5860 {
5861   TestApplication application;
5862
5863   Actor actor = Actor::New();
5864
5865   // Register a boolean property
5866   bool            startValue(false);
5867   Property::Index index = actor.RegisterProperty("testProperty", startValue);
5868   application.GetScene().Add(actor);
5869   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5870   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5871
5872   // Build the animation
5873   float     durationSeconds(2.0f);
5874   Animation animation = Animation::New(durationSeconds);
5875   bool      finalValue(!startValue);
5876   float     animatorDurationSeconds(durationSeconds * 0.5f);
5877   animation.AnimateTo(Property(actor, index),
5878                       finalValue,
5879                       TimePeriod(animatorDurationSeconds));
5880
5881   // Start the animation
5882   animation.Play();
5883
5884   bool                 signalReceived(false);
5885   AnimationFinishCheck finishCheck(signalReceived);
5886   animation.FinishedSignal().Connect(&application, finishCheck);
5887
5888   application.SendNotification();
5889   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
5890
5891   // We didn't expect the animation to finish yet
5892   application.SendNotification();
5893   finishCheck.CheckSignalNotReceived();
5894   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5895
5896   application.SendNotification();
5897   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
5898
5899   // We didn't expect the animation to finish yet...
5900   application.SendNotification();
5901   finishCheck.CheckSignalNotReceived();
5902
5903   // ...however we should have reached the final value
5904   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5905
5906   application.SendNotification();
5907   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
5908
5909   // We did expect the animation to finish
5910   application.SendNotification();
5911   finishCheck.CheckSignalReceived();
5912   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5913
5914   // Check that nothing has changed after a couple of buffer swaps
5915   application.Render(0);
5916   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5917   application.Render(0);
5918   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5919   END_TEST;
5920 }
5921
5922 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void)
5923 {
5924   TestApplication application;
5925
5926   Actor actor = Actor::New();
5927
5928   // Register a boolean property
5929   bool            startValue(false);
5930   Property::Index index = actor.RegisterProperty("testProperty", startValue);
5931   application.GetScene().Add(actor);
5932   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5933   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5934
5935   // Build the animation
5936   float     durationSeconds(2.0f);
5937   Animation animation = Animation::New(durationSeconds);
5938   bool      finalValue(!startValue);
5939   float     animatorDurationSeconds(durationSeconds * 0.5f);
5940   animation.AnimateTo(Property(actor, index),
5941                       finalValue,
5942                       AlphaFunction::LINEAR,
5943                       TimePeriod(animatorDurationSeconds));
5944
5945   // Start the animation
5946   animation.Play();
5947
5948   bool                 signalReceived(false);
5949   AnimationFinishCheck finishCheck(signalReceived);
5950   animation.FinishedSignal().Connect(&application, finishCheck);
5951
5952   application.SendNotification();
5953   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
5954
5955   // We didn't expect the animation to finish yet
5956   application.SendNotification();
5957   finishCheck.CheckSignalNotReceived();
5958   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5959
5960   application.SendNotification();
5961   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
5962
5963   // We didn't expect the animation to finish yet...
5964   application.SendNotification();
5965   finishCheck.CheckSignalNotReceived();
5966
5967   // ...however we should have reached the final value
5968   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5969
5970   application.SendNotification();
5971   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
5972
5973   // We did expect the animation to finish
5974   application.SendNotification();
5975   finishCheck.CheckSignalReceived();
5976   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5977
5978   // Check that nothing has changed after a couple of buffer swaps
5979   application.Render(0);
5980   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5981   application.Render(0);
5982   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5983   END_TEST;
5984 }
5985
5986 int UtcDaliAnimationAnimateToFloatP(void)
5987 {
5988   TestApplication application;
5989
5990   Actor actor = Actor::New();
5991
5992   // Register a float property
5993   float           startValue(10.0f);
5994   Property::Index index = actor.RegisterProperty("testProperty", startValue);
5995   application.GetScene().Add(actor);
5996   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
5997   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
5998
5999   // Build the animation
6000   float     durationSeconds(2.0f);
6001   Animation animation = Animation::New(durationSeconds);
6002   float     targetValue(50.0f);
6003   float     relativeValue(targetValue - startValue);
6004   animation.AnimateTo(Property(actor, "testProperty"), targetValue);
6005
6006   float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6007
6008   // Start the animation
6009   animation.Play();
6010
6011   bool                 signalReceived(false);
6012   AnimationFinishCheck finishCheck(signalReceived);
6013   animation.FinishedSignal().Connect(&application, finishCheck);
6014
6015   application.SendNotification();
6016   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6017
6018   // We didn't expect the animation to finish yet
6019   application.SendNotification();
6020   finishCheck.CheckSignalNotReceived();
6021   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION);
6022
6023   application.SendNotification();
6024   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6025
6026   // We did expect the animation to finish
6027   application.SendNotification();
6028   finishCheck.CheckSignalReceived();
6029   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6030   END_TEST;
6031 }
6032
6033 int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void)
6034 {
6035   TestApplication application;
6036
6037   Actor actor = Actor::New();
6038
6039   // Register a float property
6040   float           startValue(10.0f);
6041   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6042   application.GetScene().Add(actor);
6043   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
6044   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6045
6046   // Build the animation
6047   float     durationSeconds(1.0f);
6048   Animation animation = Animation::New(durationSeconds);
6049   float     targetValue(90.0f);
6050   float     relativeValue(targetValue - startValue);
6051   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6052
6053   float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6054
6055   // Start the animation
6056   animation.Play();
6057
6058   bool                 signalReceived(false);
6059   AnimationFinishCheck finishCheck(signalReceived);
6060   animation.FinishedSignal().Connect(&application, finishCheck);
6061
6062   application.SendNotification();
6063   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6064
6065   // We didn't expect the animation to finish yet
6066   application.SendNotification();
6067   finishCheck.CheckSignalNotReceived();
6068
6069   // The position should have moved more, than with a linear alpha function
6070   float current(actor.GetCurrentProperty<float>(index));
6071   DALI_TEST_CHECK(current > ninetyFivePercentProgress);
6072
6073   application.SendNotification();
6074   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6075
6076   // We did expect the animation to finish
6077   application.SendNotification();
6078   finishCheck.CheckSignalReceived();
6079   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6080   END_TEST;
6081 }
6082
6083 int UtcDaliAnimationAnimateToFloatTimePeriodP(void)
6084 {
6085   TestApplication application;
6086
6087   Actor actor = Actor::New();
6088
6089   // Register a float property
6090   float           startValue(10.0f);
6091   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6092   application.GetScene().Add(actor);
6093   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
6094   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6095
6096   // Build the animation
6097   float     durationSeconds(1.0f);
6098   Animation animation = Animation::New(durationSeconds);
6099   float     targetValue(30.0f);
6100   float     relativeValue(targetValue - startValue);
6101   float     delay = 0.5f;
6102   animation.AnimateTo(Property(actor, index),
6103                       targetValue,
6104                       TimePeriod(delay, durationSeconds - delay));
6105
6106   // Start the animation
6107   animation.Play();
6108
6109   bool                 signalReceived(false);
6110   AnimationFinishCheck finishCheck(signalReceived);
6111   animation.FinishedSignal().Connect(&application, finishCheck);
6112
6113   application.SendNotification();
6114   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6115
6116   // We didn't expect the animation to finish yet
6117   application.SendNotification();
6118   finishCheck.CheckSignalNotReceived();
6119   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6120
6121   application.SendNotification();
6122   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6123
6124   // We didn't expect the animation to finish yet
6125   application.SendNotification();
6126   finishCheck.CheckSignalNotReceived();
6127   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6128
6129   application.SendNotification();
6130   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6131
6132   // We did expect the animation to finish
6133   application.SendNotification();
6134   finishCheck.CheckSignalReceived();
6135   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6136   END_TEST;
6137 }
6138
6139 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void)
6140 {
6141   TestApplication application;
6142
6143   Actor actor = Actor::New();
6144
6145   // Register a float property
6146   float           startValue(10.0f);
6147   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6148   application.GetScene().Add(actor);
6149   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
6150   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6151
6152   // Build the animation
6153   float     durationSeconds(1.0f);
6154   Animation animation = Animation::New(durationSeconds);
6155   float     targetValue(30.0f);
6156   float     relativeValue(targetValue - startValue);
6157   float     delay = 0.5f;
6158   animation.AnimateTo(Property(actor, index),
6159                       targetValue,
6160                       AlphaFunction::LINEAR,
6161                       TimePeriod(delay, durationSeconds - delay));
6162
6163   // Start the animation
6164   animation.Play();
6165
6166   bool                 signalReceived(false);
6167   AnimationFinishCheck finishCheck(signalReceived);
6168   animation.FinishedSignal().Connect(&application, finishCheck);
6169
6170   application.SendNotification();
6171   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6172
6173   // We didn't expect the animation to finish yet
6174   application.SendNotification();
6175   finishCheck.CheckSignalNotReceived();
6176   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6177
6178   application.SendNotification();
6179   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6180
6181   // We didn't expect the animation to finish yet
6182   application.SendNotification();
6183   finishCheck.CheckSignalNotReceived();
6184   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6185
6186   application.SendNotification();
6187   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6188
6189   // We did expect the animation to finish
6190   application.SendNotification();
6191   finishCheck.CheckSignalReceived();
6192   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6193   END_TEST;
6194 }
6195
6196 int UtcDaliAnimationAnimateToIntegerP(void)
6197 {
6198   TestApplication application;
6199
6200   Actor actor = Actor::New();
6201
6202   // Register an integer property
6203   int             startValue(10);
6204   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6205   application.GetScene().Add(actor);
6206   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6207   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6208
6209   // Build the animation
6210   float     durationSeconds(2.0f);
6211   Animation animation = Animation::New(durationSeconds);
6212   int       targetValue(50);
6213   int       relativeValue(targetValue - startValue);
6214   animation.AnimateTo(Property(actor, "testProperty"), targetValue);
6215
6216   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
6217
6218   // Start the animation
6219   animation.Play();
6220
6221   bool                 signalReceived(false);
6222   AnimationFinishCheck finishCheck(signalReceived);
6223   animation.FinishedSignal().Connect(&application, finishCheck);
6224
6225   application.SendNotification();
6226   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6227
6228   // We didn't expect the animation to finish yet
6229   application.SendNotification();
6230   finishCheck.CheckSignalNotReceived();
6231   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION);
6232
6233   application.SendNotification();
6234   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6235
6236   // We did expect the animation to finish
6237   application.SendNotification();
6238   finishCheck.CheckSignalReceived();
6239   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6240   END_TEST;
6241 }
6242
6243 int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void)
6244 {
6245   TestApplication application;
6246
6247   Actor actor = Actor::New();
6248
6249   // Register an integer property
6250   int             startValue(10);
6251   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6252   application.GetScene().Add(actor);
6253   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6254   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6255
6256   // Build the animation
6257   float     durationSeconds(1.0f);
6258   Animation animation = Animation::New(durationSeconds);
6259   int       targetValue(90);
6260   int       relativeValue(targetValue - startValue);
6261   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6262
6263   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
6264
6265   // Start the animation
6266   animation.Play();
6267
6268   bool                 signalReceived(false);
6269   AnimationFinishCheck finishCheck(signalReceived);
6270   animation.FinishedSignal().Connect(&application, finishCheck);
6271
6272   application.SendNotification();
6273   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6274
6275   // We didn't expect the animation to finish yet
6276   application.SendNotification();
6277   finishCheck.CheckSignalNotReceived();
6278
6279   // The position should have moved more, than with a linear alpha function
6280   int current(actor.GetCurrentProperty<int>(index));
6281   DALI_TEST_CHECK(current > ninetyFivePercentProgress);
6282
6283   application.SendNotification();
6284   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6285
6286   // We did expect the animation to finish
6287   application.SendNotification();
6288   finishCheck.CheckSignalReceived();
6289   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6290   END_TEST;
6291 }
6292
6293 int UtcDaliAnimationAnimateToIntegerTimePeriodP(void)
6294 {
6295   TestApplication application;
6296
6297   Actor actor = Actor::New();
6298
6299   // Register an integer property
6300   int             startValue(10);
6301   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6302   application.GetScene().Add(actor);
6303   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6304   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6305
6306   // Build the animation
6307   float     durationSeconds(1.0f);
6308   Animation animation = Animation::New(durationSeconds);
6309   int       targetValue(30);
6310   int       relativeValue(targetValue - startValue);
6311   float     delay = 0.5f;
6312   animation.AnimateTo(Property(actor, index),
6313                       targetValue,
6314                       TimePeriod(delay, durationSeconds - delay));
6315
6316   // Start the animation
6317   animation.Play();
6318
6319   bool                 signalReceived(false);
6320   AnimationFinishCheck finishCheck(signalReceived);
6321   animation.FinishedSignal().Connect(&application, finishCheck);
6322
6323   application.SendNotification();
6324   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6325
6326   // We didn't expect the animation to finish yet
6327   application.SendNotification();
6328   finishCheck.CheckSignalNotReceived();
6329   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6330
6331   application.SendNotification();
6332   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6333
6334   // We didn't expect the animation to finish yet
6335   application.SendNotification();
6336   finishCheck.CheckSignalNotReceived();
6337   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
6338
6339   application.SendNotification();
6340   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6341
6342   // We did expect the animation to finish
6343   application.SendNotification();
6344   finishCheck.CheckSignalReceived();
6345   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6346   END_TEST;
6347 }
6348
6349 int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void)
6350 {
6351   TestApplication application;
6352
6353   Actor actor = Actor::New();
6354
6355   // Register an integer property
6356   int             startValue(10);
6357   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6358   application.GetScene().Add(actor);
6359   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6360   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6361
6362   // Build the animation
6363   float     durationSeconds(1.0f);
6364   Animation animation = Animation::New(durationSeconds);
6365   int       targetValue(30);
6366   int       relativeValue(targetValue - startValue);
6367   float     delay = 0.5f;
6368   animation.AnimateTo(Property(actor, index),
6369                       targetValue,
6370                       AlphaFunction::LINEAR,
6371                       TimePeriod(delay, durationSeconds - delay));
6372
6373   // Start the animation
6374   animation.Play();
6375
6376   bool                 signalReceived(false);
6377   AnimationFinishCheck finishCheck(signalReceived);
6378   animation.FinishedSignal().Connect(&application, finishCheck);
6379
6380   application.SendNotification();
6381   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6382
6383   // We didn't expect the animation to finish yet
6384   application.SendNotification();
6385   finishCheck.CheckSignalNotReceived();
6386   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6387
6388   application.SendNotification();
6389   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6390
6391   // We didn't expect the animation to finish yet
6392   application.SendNotification();
6393   finishCheck.CheckSignalNotReceived();
6394   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
6395
6396   application.SendNotification();
6397   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6398
6399   // We did expect the animation to finish
6400   application.SendNotification();
6401   finishCheck.CheckSignalReceived();
6402   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6403   END_TEST;
6404 }
6405
6406 int UtcDaliAnimationAnimateToVector2P(void)
6407 {
6408   TestApplication application;
6409
6410   Actor actor = Actor::New();
6411
6412   // Register a Vector2 property
6413   Vector2         startValue(-50.0f, -50.0f);
6414   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6415   application.GetScene().Add(actor);
6416   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6417   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6418
6419   // Build the animation
6420   float     durationSeconds(2.0f);
6421   Animation animation = Animation::New(durationSeconds);
6422   Vector2   targetValue(50.0f, 50.0f);
6423   Vector2   relativeValue(targetValue - startValue);
6424   animation.AnimateTo(Property(actor, index), targetValue);
6425
6426   Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6427
6428   // Start the animation
6429   animation.Play();
6430
6431   bool                 signalReceived(false);
6432   AnimationFinishCheck finishCheck(signalReceived);
6433   animation.FinishedSignal().Connect(&application, finishCheck);
6434
6435   application.SendNotification();
6436   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6437
6438   // We didn't expect the animation to finish yet
6439   application.SendNotification();
6440   finishCheck.CheckSignalNotReceived();
6441   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION);
6442
6443   application.SendNotification();
6444   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6445
6446   // We did expect the animation to finish
6447   application.SendNotification();
6448   finishCheck.CheckSignalReceived();
6449   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6450   END_TEST;
6451 }
6452
6453 int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void)
6454 {
6455   TestApplication application;
6456
6457   Actor actor = Actor::New();
6458
6459   // Register a Vector2 property
6460   Vector2         startValue(1000.0f, 1000.0f);
6461   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6462   application.GetScene().Add(actor);
6463   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6464   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6465
6466   // Build the animation
6467   float     durationSeconds(1.0f);
6468   Animation animation = Animation::New(durationSeconds);
6469   Vector2   targetValue(9000.0f, 9000.0f);
6470   Vector2   relativeValue(targetValue - startValue);
6471   animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
6472
6473   Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6474
6475   // Start the animation
6476   animation.Play();
6477
6478   bool                 signalReceived(false);
6479   AnimationFinishCheck finishCheck(signalReceived);
6480   animation.FinishedSignal().Connect(&application, finishCheck);
6481
6482   application.SendNotification();
6483   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6484
6485   // We didn't expect the animation to finish yet
6486   application.SendNotification();
6487   finishCheck.CheckSignalNotReceived();
6488
6489   // The position should have moved more, than with a linear alpha function
6490   Vector2 current(actor.GetCurrentProperty<Vector2>(index));
6491   DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
6492   DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
6493
6494   application.SendNotification();
6495   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6496
6497   // We did expect the animation to finish
6498   application.SendNotification();
6499   finishCheck.CheckSignalReceived();
6500   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6501   END_TEST;
6502 }
6503
6504 int UtcDaliAnimationAnimateToVector2TimePeriodP(void)
6505 {
6506   TestApplication application;
6507
6508   Actor actor = Actor::New();
6509
6510   // Register a Vector2 property
6511   Vector2         startValue(10.0f, 10.0f);
6512   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6513   application.GetScene().Add(actor);
6514   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6515   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6516
6517   // Build the animation
6518   float     durationSeconds(1.0f);
6519   Animation animation = Animation::New(durationSeconds);
6520   Vector2   targetValue(-10.0f, 20.0f);
6521   Vector2   relativeValue(targetValue - startValue);
6522   float     delay = 0.5f;
6523   animation.AnimateTo(Property(actor, index),
6524                       targetValue,
6525                       TimePeriod(delay, durationSeconds - delay));
6526
6527   // Start the animation
6528   animation.Play();
6529
6530   bool                 signalReceived(false);
6531   AnimationFinishCheck finishCheck(signalReceived);
6532   animation.FinishedSignal().Connect(&application, finishCheck);
6533
6534   application.SendNotification();
6535   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6536
6537   // We didn't expect the animation to finish yet
6538   application.SendNotification();
6539   finishCheck.CheckSignalNotReceived();
6540   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6541
6542   application.SendNotification();
6543   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6544
6545   // We didn't expect the animation to finish yet
6546   application.SendNotification();
6547   finishCheck.CheckSignalNotReceived();
6548   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6549
6550   application.SendNotification();
6551   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6552
6553   // We did expect the animation to finish
6554   application.SendNotification();
6555   finishCheck.CheckSignalReceived();
6556   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6557   END_TEST;
6558 }
6559
6560 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void)
6561 {
6562   TestApplication application;
6563
6564   Actor actor = Actor::New();
6565
6566   // Register a Vector2 property
6567   Vector2         startValue(10.0f, 10.0f);
6568   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6569   application.GetScene().Add(actor);
6570   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6571   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6572
6573   // Build the animation
6574   float     durationSeconds(1.0f);
6575   Animation animation = Animation::New(durationSeconds);
6576   Vector2   targetValue(30.0f, 30.0f);
6577   Vector2   relativeValue(targetValue - startValue);
6578   float     delay = 0.5f;
6579   animation.AnimateTo(Property(actor, index),
6580                       targetValue,
6581                       AlphaFunction::LINEAR,
6582                       TimePeriod(delay, durationSeconds - delay));
6583
6584   // Start the animation
6585   animation.Play();
6586
6587   bool                 signalReceived(false);
6588   AnimationFinishCheck finishCheck(signalReceived);
6589   animation.FinishedSignal().Connect(&application, finishCheck);
6590
6591   application.SendNotification();
6592   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6593
6594   // We didn't expect the animation to finish yet, but cached value should be the final one
6595   application.SendNotification();
6596   finishCheck.CheckSignalNotReceived();
6597   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION);
6598   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6599
6600   application.SendNotification();
6601   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6602
6603   // We didn't expect the animation to finish yet
6604   application.SendNotification();
6605   finishCheck.CheckSignalNotReceived();
6606   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6607
6608   application.SendNotification();
6609   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6610
6611   // We did expect the animation to finish
6612   application.SendNotification();
6613   finishCheck.CheckSignalReceived();
6614   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6615   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION);
6616   END_TEST;
6617 }
6618
6619 int UtcDaliAnimationAnimateToVector3P(void)
6620 {
6621   TestApplication application;
6622
6623   Actor actor = Actor::New();
6624
6625   // Register a Vector3 property
6626   Vector3         startValue(-50.0f, -50.0f, -50.0f);
6627   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6628   application.GetScene().Add(actor);
6629   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6630   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6631
6632   // Build the animation
6633   float     durationSeconds(2.0f);
6634   Animation animation = Animation::New(durationSeconds);
6635   Vector3   targetValue(50.0f, 50.0f, 50.0f);
6636   Vector3   relativeValue(targetValue - startValue);
6637   animation.AnimateTo(Property(actor, index), targetValue);
6638
6639   Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6640
6641   // Start the animation
6642   animation.Play();
6643
6644   bool                 signalReceived(false);
6645   AnimationFinishCheck finishCheck(signalReceived);
6646   animation.FinishedSignal().Connect(&application, finishCheck);
6647
6648   application.SendNotification();
6649   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6650
6651   // We didn't expect the animation to finish yet
6652   application.SendNotification();
6653   finishCheck.CheckSignalNotReceived();
6654   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION);
6655
6656   application.SendNotification();
6657   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6658
6659   // We did expect the animation to finish
6660   application.SendNotification();
6661   finishCheck.CheckSignalReceived();
6662   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6663   END_TEST;
6664 }
6665
6666 int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void)
6667 {
6668   TestApplication application;
6669
6670   Actor actor = Actor::New();
6671
6672   // Register a Vector3 property
6673   Vector3         startValue(1000.0f, 1000.0f, 1000.0f);
6674   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6675   application.GetScene().Add(actor);
6676   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6677   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6678
6679   // Build the animation
6680   float     durationSeconds(1.0f);
6681   Animation animation = Animation::New(durationSeconds);
6682   Vector3   targetValue(9000.0f, 9000.0f, 9000.0f);
6683   Vector3   relativeValue(targetValue - startValue);
6684   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6685
6686   Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6687
6688   // Start the animation
6689   animation.Play();
6690
6691   bool                 signalReceived(false);
6692   AnimationFinishCheck finishCheck(signalReceived);
6693   animation.FinishedSignal().Connect(&application, finishCheck);
6694
6695   application.SendNotification();
6696   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6697
6698   // We didn't expect the animation to finish yet
6699   application.SendNotification();
6700   finishCheck.CheckSignalNotReceived();
6701
6702   // The position should have moved more, than with a linear alpha function
6703   Vector3 current(actor.GetCurrentProperty<Vector3>(index));
6704   DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
6705   DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
6706   DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z);
6707
6708   application.SendNotification();
6709   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6710
6711   // We did expect the animation to finish
6712   application.SendNotification();
6713   finishCheck.CheckSignalReceived();
6714   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6715   END_TEST;
6716 }
6717
6718 int UtcDaliAnimationAnimateToVector3TimePeriodP(void)
6719 {
6720   TestApplication application;
6721
6722   Actor actor = Actor::New();
6723
6724   // Register a Vector3 property
6725   Vector3         startValue(10.0f, 10.0f, 10.0f);
6726   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6727   application.GetScene().Add(actor);
6728   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6729   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6730
6731   // Build the animation
6732   float     durationSeconds(1.0f);
6733   Animation animation = Animation::New(durationSeconds);
6734   Vector3   targetValue(-10.0f, 20.0f, 100.0f);
6735   Vector3   relativeValue(targetValue - startValue);
6736   float     delay = 0.5f;
6737   animation.AnimateTo(Property(actor, index),
6738                       targetValue,
6739                       TimePeriod(delay, durationSeconds - delay));
6740
6741   // Start the animation
6742   animation.Play();
6743
6744   bool                 signalReceived(false);
6745   AnimationFinishCheck finishCheck(signalReceived);
6746   animation.FinishedSignal().Connect(&application, finishCheck);
6747
6748   application.SendNotification();
6749   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6750
6751   // We didn't expect the animation to finish yet
6752   application.SendNotification();
6753   finishCheck.CheckSignalNotReceived();
6754   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6755
6756   application.SendNotification();
6757   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6758
6759   // We didn't expect the animation to finish yet
6760   application.SendNotification();
6761   finishCheck.CheckSignalNotReceived();
6762   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6763
6764   application.SendNotification();
6765   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6766
6767   // We did expect the animation to finish
6768   application.SendNotification();
6769   finishCheck.CheckSignalReceived();
6770   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6771   END_TEST;
6772 }
6773
6774 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void)
6775 {
6776   TestApplication application;
6777
6778   Actor actor = Actor::New();
6779
6780   // Register a Vector3 property
6781   Vector3         startValue(10.0f, 10.0f, 10.0f);
6782   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6783   application.GetScene().Add(actor);
6784   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6785   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6786
6787   // Build the animation
6788   float     durationSeconds(1.0f);
6789   Animation animation = Animation::New(durationSeconds);
6790   Vector3   targetValue(30.0f, 30.0f, 30.0f);
6791   Vector3   relativeValue(targetValue - startValue);
6792   float     delay = 0.5f;
6793   animation.AnimateTo(Property(actor, "testProperty"),
6794                       targetValue,
6795                       AlphaFunction::LINEAR,
6796                       TimePeriod(delay, durationSeconds - delay));
6797
6798   // Start the animation
6799   animation.Play();
6800
6801   bool                 signalReceived(false);
6802   AnimationFinishCheck finishCheck(signalReceived);
6803   animation.FinishedSignal().Connect(&application, finishCheck);
6804
6805   application.SendNotification();
6806   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6807
6808   // We didn't expect the animation to finish yet
6809   application.SendNotification();
6810   finishCheck.CheckSignalNotReceived();
6811   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6812
6813   application.SendNotification();
6814   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6815
6816   // We didn't expect the animation to finish yet
6817   application.SendNotification();
6818   finishCheck.CheckSignalNotReceived();
6819   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6820
6821   application.SendNotification();
6822   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6823
6824   // We did expect the animation to finish
6825   application.SendNotification();
6826   finishCheck.CheckSignalReceived();
6827   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6828   END_TEST;
6829 }
6830
6831 int UtcDaliAnimationAnimateToVector3ComponentP(void)
6832 {
6833   TestApplication application;
6834
6835   Actor actor = Actor::New();
6836
6837   // Register a Vector3 property
6838   Vector3         startValue(10.0f, 10.0f, 10.0f);
6839   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6840   application.GetScene().Add(actor);
6841   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6842   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6843
6844   // Build the animation
6845   float     durationSeconds(1.0f);
6846   Animation animation = Animation::New(durationSeconds);
6847   Vector3   targetValue(30.0f, 30.0f, 10.0f);
6848   Vector3   relativeValue(targetValue - startValue);
6849   float     delay = 0.5f;
6850   animation.AnimateTo(Property(actor, "testProperty", 0),
6851                       30.0f,
6852                       AlphaFunction::LINEAR,
6853                       TimePeriod(delay, durationSeconds - delay));
6854   animation.AnimateTo(Property(actor, index, 1),
6855                       30.0f,
6856                       AlphaFunction::LINEAR,
6857                       TimePeriod(delay, durationSeconds - delay));
6858
6859   // Start the animation
6860   animation.Play();
6861
6862   bool                 signalReceived(false);
6863   AnimationFinishCheck finishCheck(signalReceived);
6864   animation.FinishedSignal().Connect(&application, finishCheck);
6865
6866   application.SendNotification();
6867   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6868
6869   // We didn't expect the animation to finish yet
6870   application.SendNotification();
6871   finishCheck.CheckSignalNotReceived();
6872   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6873
6874   application.SendNotification();
6875   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6876
6877   // We didn't expect the animation to finish yet
6878   application.SendNotification();
6879   finishCheck.CheckSignalNotReceived();
6880   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6881
6882   application.SendNotification();
6883   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6884
6885   // We did expect the animation to finish
6886   application.SendNotification();
6887   finishCheck.CheckSignalReceived();
6888   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6889   END_TEST;
6890 }
6891
6892 int UtcDaliAnimationAnimateToVector4P(void)
6893 {
6894   TestApplication application;
6895
6896   Actor actor = Actor::New();
6897
6898   // Register a Vector4 property
6899   Vector4         startValue(-50.0f, -40.0f, -30.0f, -20.0f);
6900   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6901   application.GetScene().Add(actor);
6902   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
6903   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
6904
6905   // Build the animation
6906   float     durationSeconds(2.0f);
6907   Animation animation = Animation::New(durationSeconds);
6908   Vector4   targetValue(50.0f, 50.0f, 50.0f, 50.0f);
6909   Vector4   relativeValue(targetValue - startValue);
6910   animation.AnimateTo(Property(actor, index), targetValue);
6911
6912   Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6913
6914   // Start the animation
6915   animation.Play();
6916
6917   bool                 signalReceived(false);
6918   AnimationFinishCheck finishCheck(signalReceived);
6919   animation.FinishedSignal().Connect(&application, finishCheck);
6920
6921   application.SendNotification();
6922   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6923
6924   // We didn't expect the animation to finish yet
6925   application.SendNotification();
6926   finishCheck.CheckSignalNotReceived();
6927   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION);
6928
6929   application.SendNotification();
6930   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6931
6932   // We did expect the animation to finish
6933   application.SendNotification();
6934   finishCheck.CheckSignalReceived();
6935   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
6936   END_TEST;
6937 }
6938
6939 int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void)
6940 {
6941   TestApplication application;
6942
6943   Actor actor = Actor::New();
6944
6945   // Register a Vector4 property
6946   Vector4         startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
6947   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6948   application.GetScene().Add(actor);
6949   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
6950   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
6951
6952   // Build the animation
6953   float     durationSeconds(1.0f);
6954   Animation animation = Animation::New(durationSeconds);
6955   Vector4   targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
6956   Vector4   relativeValue(targetValue - startValue);
6957   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6958
6959   Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6960
6961   // Start the animation
6962   animation.Play();
6963
6964   bool                 signalReceived(false);
6965   AnimationFinishCheck finishCheck(signalReceived);
6966   animation.FinishedSignal().Connect(&application, finishCheck);
6967
6968   application.SendNotification();
6969   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6970
6971   // We didn't expect the animation to finish yet
6972   application.SendNotification();
6973   finishCheck.CheckSignalNotReceived();
6974
6975   // The position should have moved more, than with a linear alpha function
6976   Vector4 current(actor.GetCurrentProperty<Vector4>(index));
6977   DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
6978   DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
6979   DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z);
6980   DALI_TEST_CHECK(current.w > ninetyFivePercentProgress.w);
6981
6982   application.SendNotification();
6983   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6984
6985   // We did expect the animation to finish
6986   application.SendNotification();
6987   finishCheck.CheckSignalReceived();
6988   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
6989   END_TEST;
6990 }
6991
6992 int UtcDaliAnimationAnimateToVector4TimePeriodP(void)
6993 {
6994   TestApplication application;
6995
6996   Actor actor = Actor::New();
6997
6998   // Register a Vector4 property
6999   Vector4         startValue(10.0f, 10.0f, 10.0f, 10.0f);
7000   Property::Index index = actor.RegisterProperty("testProperty", startValue);
7001   application.GetScene().Add(actor);
7002   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
7003   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION);
7004
7005   // Build the animation
7006   float     durationSeconds(1.0f);
7007   Animation animation = Animation::New(durationSeconds);
7008   Vector4   targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
7009   Vector4   relativeValue(targetValue - startValue);
7010   float     delay = 0.5f;
7011   animation.AnimateTo(Property(actor, index),
7012                       targetValue,
7013                       TimePeriod(delay, durationSeconds - delay));
7014
7015   // Start the animation
7016   animation.Play();
7017
7018   bool                 signalReceived(false);
7019   AnimationFinishCheck finishCheck(signalReceived);
7020   animation.FinishedSignal().Connect(&application, finishCheck);
7021
7022   application.SendNotification();
7023   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7024
7025   // We didn't expect the animation to finish yet
7026   application.SendNotification();
7027   finishCheck.CheckSignalNotReceived();
7028   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION);
7029
7030   application.SendNotification();
7031   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
7032
7033   // We didn't expect the animation to finish yet
7034   application.SendNotification();
7035   finishCheck.CheckSignalNotReceived();
7036   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), VECTOR4_EPSILON, TEST_LOCATION);
7037
7038   application.SendNotification();
7039   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7040
7041   // We did expect the animation to finish
7042   application.SendNotification();
7043   finishCheck.CheckSignalReceived();
7044   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, VECTOR4_EPSILON, TEST_LOCATION);
7045   END_TEST;
7046 }
7047
7048 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void)
7049 {
7050   TestApplication application;
7051
7052   Actor actor = Actor::New();
7053
7054   // Register a Vector4 property
7055   Vector4         startValue(10.0f, 10.0f, 10.0f, 10.0f);
7056   Property::Index index = actor.RegisterProperty("testProperty", startValue);
7057   application.GetScene().Add(actor);
7058   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
7059   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
7060
7061   // Build the animation
7062   float     durationSeconds(1.0f);
7063   Animation animation = Animation::New(durationSeconds);
7064   Vector4   targetValue(30.0f, 30.0f, 30.0f, 30.0f);
7065   Vector4   relativeValue(targetValue - startValue);
7066   float     delay = 0.5f;
7067   animation.AnimateTo(Property(actor, index),
7068                       targetValue,
7069                       AlphaFunction::LINEAR,
7070                       TimePeriod(delay, durationSeconds - delay));
7071
7072   // Start the animation
7073   animation.Play();
7074
7075   bool                 signalReceived(false);
7076   AnimationFinishCheck finishCheck(signalReceived);
7077   animation.FinishedSignal().Connect(&application, finishCheck);
7078
7079   application.SendNotification();
7080   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7081
7082   // We didn't expect the animation to finish yet
7083   application.SendNotification();
7084   finishCheck.CheckSignalNotReceived();
7085   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
7086
7087   application.SendNotification();
7088   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
7089
7090   // We didn't expect the animation to finish yet
7091   application.SendNotification();
7092   finishCheck.CheckSignalNotReceived();
7093   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
7094
7095   application.SendNotification();
7096   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7097
7098   // We did expect the animation to finish
7099   application.SendNotification();
7100   finishCheck.CheckSignalReceived();
7101   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
7102   END_TEST;
7103 }
7104
7105 int UtcDaliAnimationAnimateToActorParentOriginP(void)
7106 {
7107   TestApplication application;
7108
7109   Actor actor = Actor::New();
7110   application.GetScene().Add(actor);
7111   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_LEFT, TEST_LOCATION);
7112
7113   // Build the animation
7114   float     durationSeconds(1.0f);
7115   Animation animation = Animation::New(durationSeconds);
7116   Vector3   targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
7117
7118   DALI_TEST_ASSERTION(
7119     {
7120       animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin);
7121     },
7122     "Property is not animatable");
7123
7124   END_TEST;
7125 }
7126
7127 int UtcDaliAnimationAnimateToActorParentOriginXN(void)
7128 {
7129   TestApplication application;
7130
7131   Actor actor = Actor::New();
7132   application.GetScene().Add(actor);
7133   float startValue(0.0f);
7134   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).x, startValue, TEST_LOCATION);
7135   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION);
7136
7137   // Build the animation
7138   float     durationSeconds(1.0f);
7139   Animation animation = Animation::New(durationSeconds);
7140   float     targetX(1.0f);
7141
7142   DALI_TEST_ASSERTION(
7143     {
7144       animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX);
7145     },
7146     "Property is not animatable");
7147
7148   END_TEST;
7149 }
7150
7151 int UtcDaliAnimationAnimateToActorParentOriginYN(void)
7152 {
7153   TestApplication application;
7154
7155   Actor actor = Actor::New();
7156   application.GetScene().Add(actor);
7157   float startValue(0.0f);
7158   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).y, startValue, TEST_LOCATION);
7159   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION);
7160
7161   // Build the animation
7162   float     durationSeconds(1.0f);
7163   Animation animation = Animation::New(durationSeconds);
7164   float     targetY(1.0f);
7165
7166   DALI_TEST_ASSERTION(
7167     {
7168       animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY);
7169     },
7170     "Property is not animatable");
7171
7172   END_TEST;
7173 }
7174
7175 int UtcDaliAnimationAnimateToActorParentOriginZN(void)
7176 {
7177   TestApplication application;
7178
7179   Actor actor = Actor::New();
7180   application.GetScene().Add(actor);
7181   float startValue(0.5f);
7182   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).z, startValue, TEST_LOCATION);
7183   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION);
7184
7185   // Build the animation
7186   float     durationSeconds(1.0f);
7187   Animation animation = Animation::New(durationSeconds);
7188   float     targetZ(1.0f);
7189
7190   DALI_TEST_ASSERTION(
7191     {
7192       animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ);
7193     },
7194     "Property is not animatable");
7195
7196   END_TEST;
7197 }
7198
7199 int UtcDaliAnimationAnimateToActorAnchorPointN(void)
7200 {
7201   TestApplication application;
7202
7203   Actor actor = Actor::New();
7204   application.GetScene().Add(actor);
7205   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), AnchorPoint::CENTER, TEST_LOCATION);
7206
7207   // Build the animation
7208   float     durationSeconds(1.0f);
7209   Animation animation = Animation::New(durationSeconds);
7210   Vector3   targetAnchorPoint(AnchorPoint::TOP_LEFT);
7211
7212   DALI_TEST_ASSERTION(
7213     {
7214       animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
7215     },
7216     "Property is not animatable");
7217
7218   END_TEST;
7219 }
7220
7221 int UtcDaliAnimationAnimateToActorAnchorPointXN(void)
7222 {
7223   TestApplication application;
7224
7225   Actor actor = Actor::New();
7226   application.GetScene().Add(actor);
7227   float startValue(0.5f);
7228   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).x, startValue, TEST_LOCATION);
7229   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION);
7230
7231   // Build the animation
7232   float     durationSeconds(1.0f);
7233   Animation animation = Animation::New(durationSeconds);
7234   float     targetX(1.0f);
7235
7236   DALI_TEST_ASSERTION(
7237     {
7238       animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_X), targetX);
7239     },
7240     "Property is not animatable");
7241
7242   END_TEST;
7243 }
7244
7245 int UtcDaliAnimationAnimateToActorAnchorPointYN(void)
7246 {
7247   TestApplication application;
7248
7249   Actor actor = Actor::New();
7250   application.GetScene().Add(actor);
7251   float startValue(0.5f);
7252   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).y, startValue, TEST_LOCATION);
7253   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION);
7254
7255   // Build the animation
7256   float     durationSeconds(1.0f);
7257   Animation animation = Animation::New(durationSeconds);
7258   float     targetY(0.0f);
7259
7260   DALI_TEST_ASSERTION(
7261     {
7262       animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY);
7263     },
7264     "Property is not animatable");
7265
7266   END_TEST;
7267 }
7268
7269 int UtcDaliAnimationAnimateToActorAnchorPointZN(void)
7270 {
7271   TestApplication application;
7272
7273   Actor actor = Actor::New();
7274   application.GetScene().Add(actor);
7275   float startValue(0.5f);
7276   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).z, startValue, TEST_LOCATION);
7277   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION);
7278
7279   // Build the animation
7280   float     durationSeconds(1.0f);
7281   Animation animation = Animation::New(durationSeconds);
7282   float     targetZ(100.0f);
7283
7284   DALI_TEST_ASSERTION(
7285     {
7286       animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ);
7287     },
7288     "Property is not animatable");
7289
7290   END_TEST;
7291 }
7292
7293 int UtcDaliAnimationAnimateToActorSizeP(void)
7294 {
7295   TestApplication application;
7296
7297   Actor actor = Actor::New();
7298   application.GetScene().Add(actor);
7299   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7300
7301   // Build the animation
7302   float     durationSeconds(1.0f);
7303   Animation animation = Animation::New(durationSeconds);
7304   Vector3   targetSize(100.0f, 100.0f, 100.0f);
7305   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize);
7306
7307   Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7308
7309   // Should return the initial properties before play
7310   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7311   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), 0.0f, TEST_LOCATION);
7312   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), 0.0f, TEST_LOCATION);
7313   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), 0.0f, TEST_LOCATION);
7314
7315   // Start the animation
7316   animation.Play();
7317
7318   // Should return the target property after play
7319   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7320   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION);
7321   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION);
7322   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION);
7323
7324   bool                 signalReceived(false);
7325   AnimationFinishCheck finishCheck(signalReceived);
7326   animation.FinishedSignal().Connect(&application, finishCheck);
7327
7328   application.SendNotification();
7329   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7330
7331   // We didn't expect the animation to finish yet
7332   application.SendNotification();
7333   finishCheck.CheckSignalNotReceived();
7334   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), ninetyNinePercentProgress, TEST_LOCATION);
7335
7336   application.SendNotification();
7337   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7338
7339   // We did expect the animation to finish
7340   application.SendNotification();
7341   finishCheck.CheckSignalReceived();
7342   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7343
7344   // Reset everything
7345   finishCheck.Reset();
7346   actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7347   application.SendNotification();
7348   application.Render(0);
7349   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7350
7351   // Repeat with a different (ease-in) alpha function
7352   animation = Animation::New(durationSeconds);
7353   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
7354   animation.FinishedSignal().Connect(&application, finishCheck);
7355   animation.Play();
7356
7357   application.SendNotification();
7358   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7359
7360   // We didn't expect the animation to finish yet
7361   application.SendNotification();
7362   finishCheck.CheckSignalNotReceived();
7363
7364   // The size should have travelled less, than with a linear alpha function
7365   Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
7366   DALI_TEST_CHECK(current.x > 0.0f);
7367   DALI_TEST_CHECK(current.y > 0.0f);
7368   DALI_TEST_CHECK(current.z > 0.0f);
7369   DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
7370   DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
7371   DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z);
7372
7373   application.SendNotification();
7374   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7375
7376   // We did expect the animation to finish
7377   application.SendNotification();
7378   finishCheck.CheckSignalReceived();
7379   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7380
7381   // Reset everything
7382   finishCheck.Reset();
7383   actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7384   application.SendNotification();
7385   application.Render(0);
7386   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7387
7388   // Repeat with a delay
7389   float delay = 0.5f;
7390   animation   = Animation::New(durationSeconds);
7391   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7392   animation.FinishedSignal().Connect(&application, finishCheck);
7393   animation.Play();
7394
7395   application.SendNotification();
7396   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7397
7398   // We didn't expect the animation to finish yet
7399   application.SendNotification();
7400   finishCheck.CheckSignalNotReceived();
7401   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7402
7403   application.SendNotification();
7404   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7405
7406   // We did expect the animation to finish
7407   application.SendNotification();
7408   finishCheck.CheckSignalReceived();
7409   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7410   END_TEST;
7411 }
7412
7413 int UtcDaliAnimationAnimateToActorSizeWidthP(void)
7414 {
7415   TestApplication application;
7416
7417   Actor actor = Actor::New();
7418   application.GetScene().Add(actor);
7419   float startValue(0.0f);
7420   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, startValue, TEST_LOCATION);
7421   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION);
7422
7423   // Build the animation
7424   float     durationSeconds(1.0f);
7425   Animation animation = Animation::New(durationSeconds);
7426   float     targetWidth(10.0f);
7427   animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetWidth);
7428
7429   float fiftyPercentProgress(startValue + (targetWidth - startValue) * 0.5f);
7430
7431   // Should return the initial properties before play
7432   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7433   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION);
7434
7435   // Start the animation
7436   animation.Play();
7437
7438   // Should return the target property after play
7439   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(targetWidth, 0.0f, 0.0f), TEST_LOCATION);
7440   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION);
7441
7442   bool                 signalReceived(false);
7443   AnimationFinishCheck finishCheck(signalReceived);
7444   animation.FinishedSignal().Connect(&application, finishCheck);
7445
7446   application.SendNotification();
7447   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7448
7449   // We didn't expect the animation to finish yet
7450   application.SendNotification();
7451   finishCheck.CheckSignalNotReceived();
7452   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, fiftyPercentProgress, TEST_LOCATION);
7453
7454   application.SendNotification();
7455   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7456
7457   // We did expect the animation to finish
7458   application.SendNotification();
7459   finishCheck.CheckSignalReceived();
7460   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, targetWidth, TEST_LOCATION);
7461   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION);
7462   END_TEST;
7463 }
7464
7465 int UtcDaliAnimationAnimateToActorSizeHeightP(void)
7466 {
7467   TestApplication application;
7468
7469   Actor actor = Actor::New();
7470   application.GetScene().Add(actor);
7471   float startValue(0.0f);
7472   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, startValue, TEST_LOCATION);
7473   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION);
7474
7475   // Build the animation
7476   float     durationSeconds(1.0f);
7477   Animation animation = Animation::New(durationSeconds);
7478   float     targetHeight(-10.0f);
7479   animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight);
7480
7481   float fiftyPercentProgress(startValue + (targetHeight - startValue) * 0.5f);
7482
7483   // Should return the initial properties before play
7484   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7485   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION);
7486
7487   // Start the animation
7488   animation.Play();
7489
7490   // Should return the target property after play
7491   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(0.0f, targetHeight, 0.0f), TEST_LOCATION);
7492   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION);
7493
7494   bool                 signalReceived(false);
7495   AnimationFinishCheck finishCheck(signalReceived);
7496   animation.FinishedSignal().Connect(&application, finishCheck);
7497
7498   application.SendNotification();
7499   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7500
7501   // We didn't expect the animation to finish yet
7502   application.SendNotification();
7503   finishCheck.CheckSignalNotReceived();
7504   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, fiftyPercentProgress, TEST_LOCATION);
7505
7506   application.SendNotification();
7507   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7508
7509   // We did expect the animation to finish
7510   application.SendNotification();
7511   finishCheck.CheckSignalReceived();
7512   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, targetHeight, TEST_LOCATION);
7513   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION);
7514   END_TEST;
7515 }
7516
7517 int UtcDaliAnimationAnimateToActorSizeDepthP(void)
7518 {
7519   TestApplication application;
7520
7521   Actor actor = Actor::New();
7522   application.GetScene().Add(actor);
7523   float startValue(0.0f);
7524   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, startValue, TEST_LOCATION);
7525   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION);
7526
7527   // Build the animation
7528   float     durationSeconds(1.0f);
7529   Animation animation = Animation::New(durationSeconds);
7530   float     targetDepth(-10.0f);
7531   animation.AnimateTo(Property(actor, Actor::Property::SIZE_DEPTH), targetDepth);
7532
7533   float fiftyPercentProgress(startValue + (targetDepth - startValue) * 0.5f);
7534
7535   // Should return the initial properties before play
7536   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7537   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION);
7538
7539   // Start the animation
7540   animation.Play();
7541
7542   // Should return the target property after play
7543   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(0.0f, 0.0f, targetDepth), TEST_LOCATION);
7544   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION);
7545
7546   bool                 signalReceived(false);
7547   AnimationFinishCheck finishCheck(signalReceived);
7548   animation.FinishedSignal().Connect(&application, finishCheck);
7549
7550   application.SendNotification();
7551   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7552
7553   // We didn't expect the animation to finish yet
7554   application.SendNotification();
7555   finishCheck.CheckSignalNotReceived();
7556   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, fiftyPercentProgress, TEST_LOCATION);
7557
7558   application.SendNotification();
7559   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7560
7561   // We did expect the animation to finish
7562   application.SendNotification();
7563   finishCheck.CheckSignalReceived();
7564   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, targetDepth, TEST_LOCATION);
7565   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION);
7566   END_TEST;
7567 }
7568
7569 int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void)
7570 {
7571   TestApplication application;
7572
7573   Actor actor = Actor::New();
7574   application.GetScene().Add(actor);
7575   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7576
7577   // Build the animation
7578   float     durationSeconds(1.0f);
7579   Animation animation = Animation::New(durationSeconds);
7580   Vector3   targetSize(100.0f, 100.0f, 100.0f);
7581   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize);
7582
7583   Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7584
7585   // Start the animation
7586   animation.Play();
7587
7588   bool                 signalReceived(false);
7589   AnimationFinishCheck finishCheck(signalReceived);
7590   animation.FinishedSignal().Connect(&application, finishCheck);
7591
7592   application.SendNotification();
7593   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7594
7595   // We didn't expect the animation to finish yet
7596   application.SendNotification();
7597   finishCheck.CheckSignalNotReceived();
7598   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), ninetyNinePercentProgress, TEST_LOCATION);
7599
7600   application.SendNotification();
7601   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7602
7603   // We did expect the animation to finish
7604   application.SendNotification();
7605   finishCheck.CheckSignalReceived();
7606   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7607
7608   // Reset everything
7609   finishCheck.Reset();
7610   actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7611   application.SendNotification();
7612   application.Render(0);
7613   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7614
7615   // Repeat with a different (ease-in) alpha function
7616   animation = Animation::New(durationSeconds);
7617   animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetSize.x, AlphaFunction::EASE_IN);
7618   animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetSize.y, AlphaFunction::EASE_IN);
7619   animation.FinishedSignal().Connect(&application, finishCheck);
7620   animation.Play();
7621
7622   application.SendNotification();
7623   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7624
7625   // We didn't expect the animation to finish yet
7626   application.SendNotification();
7627   finishCheck.CheckSignalNotReceived();
7628
7629   // The size should have travelled less, than with a linear alpha function
7630   Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
7631   DALI_TEST_CHECK(current.x > 0.0f);
7632   DALI_TEST_CHECK(current.y > 0.0f);
7633   DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
7634   DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
7635
7636   application.SendNotification();
7637   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7638
7639   // We did expect the animation to finish
7640   application.SendNotification();
7641   finishCheck.CheckSignalReceived();
7642   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).x, targetSize.x, TEST_LOCATION);
7643   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).y, targetSize.y, TEST_LOCATION);
7644
7645   // Reset everything
7646   finishCheck.Reset();
7647   actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7648   application.SendNotification();
7649   application.Render(0);
7650   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7651
7652   // Repeat with a delay
7653   float delay = 0.5f;
7654   animation   = Animation::New(durationSeconds);
7655   animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetSize.x, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7656   animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetSize.y, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7657   animation.FinishedSignal().Connect(&application, finishCheck);
7658   animation.Play();
7659
7660   application.SendNotification();
7661   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7662
7663   // We didn't expect the animation to finish yet
7664   application.SendNotification();
7665   finishCheck.CheckSignalNotReceived();
7666   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7667
7668   application.SendNotification();
7669   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7670
7671   // We did expect the animation to finish
7672   application.SendNotification();
7673   finishCheck.CheckSignalReceived();
7674   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).x, targetSize.x, TEST_LOCATION);
7675   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).y, targetSize.y, TEST_LOCATION);
7676   END_TEST;
7677 }
7678
7679 int UtcDaliAnimationAnimateToActorPositionP(void)
7680 {
7681   TestApplication application;
7682
7683   Actor actor = Actor::New();
7684   application.GetScene().Add(actor);
7685   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7686
7687   // Build the animation
7688   float     durationSeconds(1.0f);
7689   Animation animation = Animation::New(durationSeconds);
7690   Vector3   targetPosition(200.0f, 200.0f, 200.0f);
7691   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
7692
7693   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7694
7695   // Should return the initial properties before play
7696   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7697   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
7698   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), 0.0f, TEST_LOCATION);
7699   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), 0.0f, TEST_LOCATION);
7700
7701   // Start the animation
7702   animation.Play();
7703
7704   // Should return the target property after play
7705   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7706   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
7707   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
7708   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
7709
7710   bool                 signalReceived(false);
7711   AnimationFinishCheck finishCheck(signalReceived);
7712   animation.FinishedSignal().Connect(&application, finishCheck);
7713
7714   application.SendNotification();
7715   application.Render(static_cast<unsigned int>(durationSeconds * 750.0f) /* 75% progress */);
7716
7717   // We didn't expect the animation to finish yet
7718   application.SendNotification();
7719   finishCheck.CheckSignalNotReceived();
7720   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION);
7721
7722   application.SendNotification();
7723   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7724
7725   // We did expect the animation to finish
7726   application.SendNotification();
7727   finishCheck.CheckSignalReceived();
7728   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7729   END_TEST;
7730 }
7731
7732 int UtcDaliAnimationAnimateToActorPositionXP(void)
7733 {
7734   TestApplication application;
7735
7736   Actor actor = Actor::New();
7737   application.GetScene().Add(actor);
7738   float startValue(0.0f);
7739   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, startValue, TEST_LOCATION);
7740   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7741   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7742   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7743
7744   // Build the animation
7745   float     durationSeconds(1.0f);
7746   Animation animation = Animation::New(durationSeconds);
7747   float     targetX(1.0f);
7748   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), targetX);
7749
7750   float fiftyPercentProgress(startValue + (targetX - startValue) * 0.5f);
7751
7752   // Should return the initial properties before play
7753   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7754   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7755
7756   // Start the animation
7757   animation.Play();
7758
7759   // Should return the target property after play
7760   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(targetX, 0.0f, 0.0f), TEST_LOCATION);
7761   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION);
7762
7763   bool                 signalReceived(false);
7764   AnimationFinishCheck finishCheck(signalReceived);
7765   animation.FinishedSignal().Connect(&application, finishCheck);
7766
7767   application.SendNotification();
7768   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7769
7770   // We didn't expect the animation to finish yet
7771   application.SendNotification();
7772   finishCheck.CheckSignalNotReceived();
7773   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, fiftyPercentProgress, TEST_LOCATION);
7774
7775   application.SendNotification();
7776   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7777
7778   // We did expect the animation to finish
7779   application.SendNotification();
7780   finishCheck.CheckSignalReceived();
7781   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, targetX, TEST_LOCATION);
7782   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION);
7783   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7784   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7785   END_TEST;
7786 }
7787
7788 int UtcDaliAnimationAnimateToActorPositionYP(void)
7789 {
7790   TestApplication application;
7791
7792   Actor actor = Actor::New();
7793   application.GetScene().Add(actor);
7794   float startValue(0.0f);
7795   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, startValue, TEST_LOCATION);
7796   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7797   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7798   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7799
7800   // Build the animation
7801   float     durationSeconds(1.0f);
7802   Animation animation = Animation::New(durationSeconds);
7803   float     targetY(10.0f);
7804   animation.AnimateTo(Property(actor, Actor::Property::POSITION_Y), targetY);
7805
7806   float fiftyPercentProgress(startValue + (targetY - startValue) * 0.5f);
7807
7808   // Should return the initial properties before play
7809   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7810   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7811
7812   // Start the animation
7813   animation.Play();
7814
7815   // Should return the target property after play
7816   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, targetY, 0.0f), TEST_LOCATION);
7817   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION);
7818
7819   bool                 signalReceived(false);
7820   AnimationFinishCheck finishCheck(signalReceived);
7821   animation.FinishedSignal().Connect(&application, finishCheck);
7822
7823   application.SendNotification();
7824   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7825
7826   // We didn't expect the animation to finish yet
7827   application.SendNotification();
7828   finishCheck.CheckSignalNotReceived();
7829   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, fiftyPercentProgress, TEST_LOCATION);
7830
7831   application.SendNotification();
7832   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7833
7834   // We did expect the animation to finish
7835   application.SendNotification();
7836   finishCheck.CheckSignalReceived();
7837   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, targetY, TEST_LOCATION);
7838   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7839   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION);
7840   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7841   END_TEST;
7842 }
7843
7844 int UtcDaliAnimationAnimateToActorPositionZP(void)
7845 {
7846   TestApplication application;
7847
7848   Actor actor = Actor::New();
7849   application.GetScene().Add(actor);
7850   float startValue(0.0f);
7851   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, startValue, TEST_LOCATION);
7852   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7853   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7854   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7855
7856   // Build the animation
7857   float     durationSeconds(1.0f);
7858   Animation animation = Animation::New(durationSeconds);
7859   float     targetZ(-5.0f);
7860   animation.AnimateTo(Property(actor, Actor::Property::POSITION_Z), targetZ);
7861
7862   float fiftyPercentProgress(startValue + (targetZ - startValue) * 0.5f);
7863
7864   // Should return the initial properties before play
7865   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7866   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7867
7868   // Start the animation
7869   animation.Play();
7870
7871   // Should return the target property after play
7872   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, targetZ), TEST_LOCATION);
7873   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION);
7874
7875   bool                 signalReceived(false);
7876   AnimationFinishCheck finishCheck(signalReceived);
7877   animation.FinishedSignal().Connect(&application, finishCheck);
7878
7879   application.SendNotification();
7880   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7881
7882   // We didn't expect the animation to finish yet
7883   application.SendNotification();
7884   finishCheck.CheckSignalNotReceived();
7885   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, fiftyPercentProgress, TEST_LOCATION);
7886
7887   application.SendNotification();
7888   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7889
7890   // We did expect the animation to finish
7891   application.SendNotification();
7892   finishCheck.CheckSignalReceived();
7893   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, targetZ, TEST_LOCATION);
7894   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7895   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7896   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION);
7897   END_TEST;
7898 }
7899
7900 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void)
7901 {
7902   TestApplication application;
7903
7904   Actor actor = Actor::New();
7905   application.GetScene().Add(actor);
7906   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7907
7908   // Build the animation
7909   float     durationSeconds(1.0f);
7910   Animation animation = Animation::New(durationSeconds);
7911   Vector3   targetPosition(200.0f, 200.0f, 200.0f);
7912   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
7913
7914   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7915
7916   // Start the animation
7917   animation.Play();
7918
7919   bool                 signalReceived(false);
7920   AnimationFinishCheck finishCheck(signalReceived);
7921   animation.FinishedSignal().Connect(&application, finishCheck);
7922
7923   application.SendNotification();
7924   application.Render(static_cast<unsigned int>(durationSeconds * 750.0f) /* 75% progress */);
7925
7926   // We didn't expect the animation to finish yet
7927   application.SendNotification();
7928   finishCheck.CheckSignalNotReceived();
7929
7930   // The position should have moved less, than with a linear alpha function
7931   Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
7932   DALI_TEST_CHECK(current.x > Vector3::ZERO.x);
7933   DALI_TEST_CHECK(current.y > Vector3::ZERO.y);
7934   DALI_TEST_CHECK(current.z > Vector3::ZERO.z);
7935   DALI_TEST_CHECK(current.x < seventyFivePercentProgress.x);
7936   DALI_TEST_CHECK(current.y < seventyFivePercentProgress.y);
7937   DALI_TEST_CHECK(current.z < seventyFivePercentProgress.z);
7938
7939   application.SendNotification();
7940   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7941
7942   // We did expect the animation to finish
7943   application.SendNotification();
7944   finishCheck.CheckSignalReceived();
7945   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7946   END_TEST;
7947 }
7948
7949 int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void)
7950 {
7951   TestApplication application;
7952
7953   Actor actor = Actor::New();
7954   application.GetScene().Add(actor);
7955   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7956
7957   // Build the animation
7958   float     durationSeconds(1.0f);
7959   Animation animation = Animation::New(durationSeconds);
7960   Vector3   targetPosition(200.0f, 200.0f, 200.0f);
7961   float     delay = 0.5f;
7962   animation.AnimateTo(Property(actor, Actor::Property::POSITION),
7963                       targetPosition,
7964                       TimePeriod(delay, durationSeconds - delay));
7965
7966   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7967
7968   // Start the animation
7969   animation.Play();
7970
7971   bool                 signalReceived(false);
7972   AnimationFinishCheck finishCheck(signalReceived);
7973   animation.FinishedSignal().Connect(&application, finishCheck);
7974
7975   application.SendNotification();
7976   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7977
7978   // We didn't expect the animation to finish yet
7979   application.SendNotification();
7980   finishCheck.CheckSignalNotReceived();
7981   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7982
7983   application.SendNotification();
7984   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.75) /* 7/8 animation progress, 3/4 animator progress */);
7985
7986   // We didn't expect the animation to finish yet
7987   application.SendNotification();
7988   finishCheck.CheckSignalNotReceived();
7989   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION);
7990
7991   application.SendNotification();
7992   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.25) + 1u /*just beyond the animation duration*/);
7993
7994   // We did expect the animation to finish
7995   application.SendNotification();
7996   finishCheck.CheckSignalReceived();
7997   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7998   END_TEST;
7999 }
8000
8001 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void)
8002 {
8003   TestApplication application;
8004
8005   Actor actor = Actor::New();
8006   application.GetScene().Add(actor);
8007   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
8008
8009   // Build the animation
8010   float     durationSeconds(1.0f);
8011   Animation animation = Animation::New(durationSeconds);
8012   Vector3   targetPosition(200.0f, 200.0f, 200.0f);
8013   float     delay = 0.5f;
8014   animation.AnimateTo(Property(actor, Actor::Property::POSITION),
8015                       targetPosition,
8016                       AlphaFunction::LINEAR,
8017                       TimePeriod(delay, durationSeconds - delay));
8018
8019   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
8020
8021   // Start the animation
8022   animation.Play();
8023
8024   bool                 signalReceived(false);
8025   AnimationFinishCheck finishCheck(signalReceived);
8026   animation.FinishedSignal().Connect(&application, finishCheck);
8027
8028   application.SendNotification();
8029   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
8030
8031   // We didn't expect the animation to finish yet
8032   application.SendNotification();
8033   finishCheck.CheckSignalNotReceived();
8034   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
8035
8036   application.SendNotification();
8037   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.75) /* 7/8 animation progress, 3/4 animator progress */);
8038
8039   // We didn't expect the animation to finish yet
8040   application.SendNotification();
8041   finishCheck.CheckSignalNotReceived();
8042   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION);
8043
8044   application.SendNotification();
8045   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.25) + 1u /*just beyond the animation duration*/);
8046
8047   // We did expect the animation to finish
8048   application.SendNotification();
8049   finishCheck.CheckSignalReceived();
8050   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
8051   END_TEST;
8052 }
8053
8054 int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void)
8055 {
8056   TestApplication application;
8057
8058   Actor actor = Actor::New();
8059   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8060   application.GetScene().Add(actor);
8061   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8062
8063   // Build the animation
8064   float     durationSeconds(1.0f);
8065   Animation animation = Animation::New(durationSeconds);
8066   Degree    targetRotationDegrees(90.0f);
8067   Radian    targetRotationRadians(targetRotationDegrees);
8068   animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS));
8069
8070   // Start the animation
8071   animation.Play();
8072
8073   // Target value should be retrievable straight away
8074   DALI_TEST_EQUALS(actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8075
8076   bool                 signalReceived(false);
8077   AnimationFinishCheck finishCheck(signalReceived);
8078   animation.FinishedSignal().Connect(&application, finishCheck);
8079
8080   application.SendNotification();
8081   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8082
8083   // We didn't expect the animation to finish yet
8084   application.SendNotification();
8085   finishCheck.CheckSignalNotReceived();
8086   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8087
8088   application.SendNotification();
8089   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8090
8091   // We didn't expect the animation to finish yet
8092   application.SendNotification();
8093   finishCheck.CheckSignalNotReceived();
8094   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8095
8096   application.SendNotification();
8097   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8098
8099   // We didn't expect the animation to finish yet
8100   application.SendNotification();
8101   finishCheck.CheckSignalNotReceived();
8102   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8103
8104   application.SendNotification();
8105   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8106
8107   // We did expect the animation to finish
8108   application.SendNotification();
8109   finishCheck.CheckSignalReceived();
8110   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8111   END_TEST;
8112 }
8113
8114 int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void)
8115 {
8116   TestApplication application;
8117
8118   Actor actor = Actor::New();
8119   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8120   application.GetScene().Add(actor);
8121   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8122
8123   // Build the animation
8124   float      durationSeconds(1.0f);
8125   Animation  animation = Animation::New(durationSeconds);
8126   Degree     targetRotationDegrees(90.0f);
8127   Radian     targetRotationRadians(targetRotationDegrees);
8128   Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
8129   animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), targetRotation);
8130
8131   // Start the animation
8132   animation.Play();
8133
8134   bool                 signalReceived(false);
8135   AnimationFinishCheck finishCheck(signalReceived);
8136   animation.FinishedSignal().Connect(&application, finishCheck);
8137
8138   application.SendNotification();
8139   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8140
8141   // We didn't expect the animation to finish yet
8142   application.SendNotification();
8143   finishCheck.CheckSignalNotReceived();
8144   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8145
8146   application.SendNotification();
8147   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8148
8149   // We didn't expect the animation to finish yet
8150   application.SendNotification();
8151   finishCheck.CheckSignalNotReceived();
8152   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8153
8154   application.SendNotification();
8155   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8156
8157   // We didn't expect the animation to finish yet
8158   application.SendNotification();
8159   finishCheck.CheckSignalNotReceived();
8160   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8161
8162   application.SendNotification();
8163   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8164
8165   // We did expect the animation to finish
8166   application.SendNotification();
8167   finishCheck.CheckSignalReceived();
8168   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8169   END_TEST;
8170 }
8171
8172 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void)
8173 {
8174   TestApplication application;
8175
8176   Actor actor = Actor::New();
8177   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8178   application.GetScene().Add(actor);
8179   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8180
8181   // Build the animation
8182   float     durationSeconds(1.0f);
8183   Animation animation = Animation::New(durationSeconds);
8184   Degree    targetRotationDegrees(90.0f);
8185   Radian    targetRotationRadians(targetRotationDegrees);
8186   animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
8187
8188   // Start the animation
8189   animation.Play();
8190
8191   bool                 signalReceived(false);
8192   AnimationFinishCheck finishCheck(signalReceived);
8193   animation.FinishedSignal().Connect(&application, finishCheck);
8194
8195   application.SendNotification();
8196   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8197
8198   // We didn't expect the animation to finish yet
8199   application.SendNotification();
8200   finishCheck.CheckSignalNotReceived();
8201   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f * 0.25f * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8202
8203   application.SendNotification();
8204   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8205
8206   // We didn't expect the animation to finish yet
8207   application.SendNotification();
8208   finishCheck.CheckSignalNotReceived();
8209   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f * 0.5f * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8210
8211   application.SendNotification();
8212   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8213
8214   // We didn't expect the animation to finish yet
8215   application.SendNotification();
8216   finishCheck.CheckSignalNotReceived();
8217   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f * 0.75f * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8218
8219   application.SendNotification();
8220   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8221
8222   // We did expect the animation to finish
8223   application.SendNotification();
8224   finishCheck.CheckSignalReceived();
8225   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8226   END_TEST;
8227 }
8228
8229 int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void)
8230 {
8231   TestApplication application;
8232
8233   Actor actor = Actor::New();
8234   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8235   application.GetScene().Add(actor);
8236   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8237
8238   // Build the animation
8239   float     durationSeconds(1.0f);
8240   Animation animation = Animation::New(durationSeconds);
8241   Degree    targetRotationDegrees(90.0f);
8242   Radian    targetRotationRadians(targetRotationDegrees);
8243   float     delay(0.1f);
8244   animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
8245
8246   // Start the animation
8247   animation.Play();
8248
8249   bool                 signalReceived(false);
8250   AnimationFinishCheck finishCheck(signalReceived);
8251   animation.FinishedSignal().Connect(&application, finishCheck);
8252
8253   application.SendNotification();
8254   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8255
8256   // We didn't expect the animation to finish yet
8257   application.SendNotification();
8258   finishCheck.CheckSignalNotReceived();
8259   float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
8260   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8261
8262   application.SendNotification();
8263   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8264
8265   // We didn't expect the animation to finish yet
8266   application.SendNotification();
8267   finishCheck.CheckSignalNotReceived();
8268   progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
8269   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8270
8271   application.SendNotification();
8272   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8273
8274   // We didn't expect the animation to finish yet
8275   application.SendNotification();
8276   finishCheck.CheckSignalNotReceived();
8277   progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
8278   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8279
8280   application.SendNotification();
8281   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8282
8283   // We did expect the animation to finish
8284   application.SendNotification();
8285   finishCheck.CheckSignalReceived();
8286   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8287   END_TEST;
8288 }
8289
8290 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void)
8291 {
8292   TestApplication application;
8293
8294   Actor actor = Actor::New();
8295   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8296   application.GetScene().Add(actor);
8297   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8298
8299   // Build the animation
8300   float     durationSeconds(1.0f);
8301   Animation animation = Animation::New(durationSeconds);
8302   Degree    targetRotationDegrees(90.0f);
8303   Radian    targetRotationRadians(targetRotationDegrees);
8304   float     delay(0.1f);
8305   animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
8306
8307   // Start the animation
8308   animation.Play();
8309
8310   bool                 signalReceived(false);
8311   AnimationFinishCheck finishCheck(signalReceived);
8312   animation.FinishedSignal().Connect(&application, finishCheck);
8313
8314   application.SendNotification();
8315   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8316
8317   // We didn't expect the animation to finish yet
8318   application.SendNotification();
8319   finishCheck.CheckSignalNotReceived();
8320   float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
8321   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8322
8323   application.SendNotification();
8324   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8325
8326   // We didn't expect the animation to finish yet
8327   application.SendNotification();
8328   finishCheck.CheckSignalNotReceived();
8329   progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
8330   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8331
8332   application.SendNotification();
8333   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8334
8335   // We didn't expect the animation to finish yet
8336   application.SendNotification();
8337   finishCheck.CheckSignalNotReceived();
8338   progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
8339   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8340
8341   application.SendNotification();
8342   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8343
8344   // We did expect the animation to finish
8345   application.SendNotification();
8346   finishCheck.CheckSignalReceived();
8347   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8348   END_TEST;
8349 }
8350
8351 int UtcDaliAnimationAnimateToActorScaleP(void)
8352 {
8353   TestApplication application;
8354
8355   Actor actor = Actor::New();
8356   application.GetScene().Add(actor);
8357   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8358
8359   // Build the animation
8360   float     durationSeconds(1.0f);
8361   Animation animation = Animation::New(durationSeconds);
8362   Vector3   targetScale(2.0f, 2.0f, 2.0f);
8363   animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale);
8364
8365   Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE) * 0.99f);
8366
8367   // Start the animation
8368   animation.Play();
8369
8370   // Target value should be retrievable straight away
8371   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8372   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), targetScale.x, TEST_LOCATION);
8373   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), targetScale.y, TEST_LOCATION);
8374   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), targetScale.z, TEST_LOCATION);
8375
8376   bool                 signalReceived(false);
8377   AnimationFinishCheck finishCheck(signalReceived);
8378   animation.FinishedSignal().Connect(&application, finishCheck);
8379
8380   application.SendNotification();
8381   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
8382
8383   // We didn't expect the animation to finish yet
8384   application.SendNotification();
8385   finishCheck.CheckSignalNotReceived();
8386   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), ninetyNinePercentProgress, TEST_LOCATION);
8387
8388   application.SendNotification();
8389   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
8390
8391   // We did expect the animation to finish
8392   application.SendNotification();
8393   finishCheck.CheckSignalReceived();
8394   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8395
8396   // Reset everything
8397   finishCheck.Reset();
8398   actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
8399   application.SendNotification();
8400   application.Render(0);
8401   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8402
8403   // Repeat with a different (ease-in) alpha function
8404   animation = Animation::New(durationSeconds);
8405   animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
8406   animation.FinishedSignal().Connect(&application, finishCheck);
8407   animation.Play();
8408
8409   application.SendNotification();
8410   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
8411
8412   // We didn't expect the animation to finish yet
8413   application.SendNotification();
8414   finishCheck.CheckSignalNotReceived();
8415
8416   // The scale should have grown less, than with a linear alpha function
8417   Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
8418   DALI_TEST_CHECK(current.x > 1.0f);
8419   DALI_TEST_CHECK(current.y > 1.0f);
8420   DALI_TEST_CHECK(current.z > 1.0f);
8421   DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
8422   DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
8423   DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z);
8424
8425   application.SendNotification();
8426   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
8427
8428   // We did expect the animation to finish
8429   application.SendNotification();
8430   finishCheck.CheckSignalReceived();
8431   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8432
8433   // Reset everything
8434   finishCheck.Reset();
8435   actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
8436   application.SendNotification();
8437   application.Render(0);
8438   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8439
8440   // Repeat with a delay
8441   float delay = 0.5f;
8442   animation   = Animation::New(durationSeconds);
8443   animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
8444   animation.FinishedSignal().Connect(&application, finishCheck);
8445   animation.Play();
8446
8447   application.SendNotification();
8448   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
8449
8450   // We didn't expect the animation to finish yet
8451   application.SendNotification();
8452   finishCheck.CheckSignalNotReceived();
8453   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8454
8455   application.SendNotification();
8456   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8457
8458   // We did expect the animation to finish
8459   application.SendNotification();
8460   finishCheck.CheckSignalReceived();
8461   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8462   END_TEST;
8463 }
8464
8465 int UtcDaliAnimationAnimateToActorScaleXP(void)
8466 {
8467   TestApplication application;
8468
8469   Actor actor = Actor::New();
8470   application.GetScene().Add(actor);
8471   float startValue(1.0f);
8472   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, startValue, TEST_LOCATION);
8473   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8474   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8475   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, 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), startValue, TEST_LOCATION);
8478   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8479
8480   // Build the animation
8481   float     durationSeconds(1.0f);
8482   Animation animation = Animation::New(durationSeconds);
8483   float     targetX(10.0f);
8484   animation.AnimateTo(Property(actor, Actor::Property::SCALE_X), targetX);
8485
8486   float fiftyPercentProgress(startValue + (targetX - startValue) * 0.5f);
8487
8488   // Start the animation
8489   animation.Play();
8490
8491   // Target value should be retrievable straight away
8492   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3(targetX, startValue, startValue), TEST_LOCATION);
8493   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), targetX, TEST_LOCATION);
8494
8495   bool                 signalReceived(false);
8496   AnimationFinishCheck finishCheck(signalReceived);
8497   animation.FinishedSignal().Connect(&application, finishCheck);
8498
8499   application.SendNotification();
8500   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8501
8502   // We didn't expect the animation to finish yet
8503   application.SendNotification();
8504   finishCheck.CheckSignalNotReceived();
8505   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, fiftyPercentProgress, TEST_LOCATION);
8506   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), fiftyPercentProgress, TEST_LOCATION);
8507   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8508   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8509
8510   application.SendNotification();
8511   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8512
8513   // We did expect the animation to finish
8514   application.SendNotification();
8515   finishCheck.CheckSignalReceived();
8516   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, targetX, TEST_LOCATION);
8517   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), targetX, TEST_LOCATION);
8518   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8519   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8520   END_TEST;
8521 }
8522
8523 int UtcDaliAnimationAnimateToActorScaleYP(void)
8524 {
8525   TestApplication application;
8526
8527   Actor actor = Actor::New();
8528   application.GetScene().Add(actor);
8529   float startValue(1.0f);
8530   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, startValue, TEST_LOCATION);
8531   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8532   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8533   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, 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), startValue, TEST_LOCATION);
8537
8538   // Build the animation
8539   float     durationSeconds(1.0f);
8540   Animation animation = Animation::New(durationSeconds);
8541   float     targetY(1000.0f);
8542   animation.AnimateTo(Property(actor, Actor::Property::SCALE_Y), targetY);
8543
8544   float fiftyPercentProgress(startValue + (targetY - startValue) * 0.5f);
8545
8546   // Start the animation
8547   animation.Play();
8548
8549   // Target value should be retrievable straight away
8550   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3(startValue, targetY, startValue), TEST_LOCATION);
8551   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), targetY, TEST_LOCATION);
8552
8553   bool                 signalReceived(false);
8554   AnimationFinishCheck finishCheck(signalReceived);
8555   animation.FinishedSignal().Connect(&application, finishCheck);
8556
8557   application.SendNotification();
8558   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8559
8560   // We didn't expect the animation to finish yet
8561   application.SendNotification();
8562   finishCheck.CheckSignalNotReceived();
8563   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, fiftyPercentProgress, TEST_LOCATION);
8564   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8565   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), fiftyPercentProgress, TEST_LOCATION);
8566   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8567
8568   application.SendNotification();
8569   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8570
8571   // We did expect the animation to finish
8572   application.SendNotification();
8573   finishCheck.CheckSignalReceived();
8574   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, targetY, TEST_LOCATION);
8575   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8576   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), targetY, TEST_LOCATION);
8577   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8578   END_TEST;
8579 }
8580
8581 int UtcDaliAnimationAnimateToActorScaleZP(void)
8582 {
8583   TestApplication application;
8584
8585   Actor actor = Actor::New();
8586   application.GetScene().Add(actor);
8587   float startValue(1.0f);
8588   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, startValue, TEST_LOCATION);
8589   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8590   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8591   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8592   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8593   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8594   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8595
8596   // Build the animation
8597   float     durationSeconds(1.0f);
8598   Animation animation = Animation::New(durationSeconds);
8599   float     targetZ(-1000.0f);
8600   animation.AnimateTo(Property(actor, Actor::Property::SCALE_Z), targetZ);
8601
8602   float fiftyPercentProgress(startValue + (targetZ - startValue) * 0.5f);
8603
8604   // Start the animation
8605   animation.Play();
8606
8607   // Target value should be retrievable straight away
8608   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3(startValue, startValue, targetZ), TEST_LOCATION);
8609   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), targetZ, TEST_LOCATION);
8610
8611   bool                 signalReceived(false);
8612   AnimationFinishCheck finishCheck(signalReceived);
8613   animation.FinishedSignal().Connect(&application, finishCheck);
8614
8615   application.SendNotification();
8616   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8617
8618   // We didn't expect the animation to finish yet
8619   application.SendNotification();
8620   finishCheck.CheckSignalNotReceived();
8621   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, fiftyPercentProgress, TEST_LOCATION);
8622   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8623   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8624   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), fiftyPercentProgress, TEST_LOCATION);
8625
8626   application.SendNotification();
8627   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8628
8629   // We did expect the animation to finish
8630   application.SendNotification();
8631   finishCheck.CheckSignalReceived();
8632   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, targetZ, TEST_LOCATION);
8633   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8634   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8635   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), targetZ, TEST_LOCATION);
8636   END_TEST;
8637 }
8638
8639 int UtcDaliAnimationAnimateToActorColorP(void)
8640 {
8641   TestApplication application;
8642
8643   Actor actor = Actor::New();
8644   application.GetScene().Add(actor);
8645   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
8646
8647   // Build the animation
8648   float     durationSeconds(1.0f);
8649   Animation animation = Animation::New(durationSeconds);
8650   Vector4   targetColor(Color::RED);
8651   animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor);
8652
8653   Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
8654   Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
8655
8656   // Start the animation
8657   animation.Play();
8658
8659   // Target value should be retrievable straight away
8660   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8661   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION);
8662   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION);
8663   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION);
8664   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION);
8665   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::OPACITY), targetColor.a, TEST_LOCATION);
8666
8667   bool                 signalReceived(false);
8668   AnimationFinishCheck finishCheck(signalReceived);
8669   animation.FinishedSignal().Connect(&application, finishCheck);
8670
8671   application.SendNotification();
8672   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
8673
8674   // We didn't expect the animation to finish yet
8675   application.SendNotification();
8676   finishCheck.CheckSignalNotReceived();
8677   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), tenPercentProgress, TEST_LOCATION);
8678
8679   application.SendNotification();
8680   application.Render(static_cast<unsigned int>(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/);
8681
8682   // We did expect the animation to finish
8683   application.SendNotification();
8684   finishCheck.CheckSignalReceived();
8685   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8686
8687   // Reset everything
8688   finishCheck.Reset();
8689   actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
8690   application.SendNotification();
8691   application.Render(0);
8692   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
8693
8694   // Repeat with a different (ease-in) alpha function
8695   animation = Animation::New(durationSeconds);
8696   animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
8697   animation.FinishedSignal().Connect(&application, finishCheck);
8698   animation.Play();
8699
8700   application.SendNotification();
8701   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
8702
8703   // We didn't expect the animation to finish yet
8704   application.SendNotification();
8705   finishCheck.CheckSignalNotReceived();
8706
8707   // The color should have changed less, than with a linear alpha function
8708   Vector4 current(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
8709   DALI_TEST_CHECK(current.x == 1.0f); // doesn't change
8710   DALI_TEST_CHECK(current.y < 1.0f);
8711   DALI_TEST_CHECK(current.y > tenPercentProgress.y);
8712   DALI_TEST_CHECK(current.z < 1.0f);
8713   DALI_TEST_CHECK(current.z > tenPercentProgress.z);
8714   DALI_TEST_CHECK(current.w == 1.0f); // doesn't change
8715
8716   application.SendNotification();
8717   application.Render(static_cast<unsigned int>(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/);
8718
8719   // We did expect the animation to finish
8720   application.SendNotification();
8721   finishCheck.CheckSignalReceived();
8722   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8723
8724   // Reset everything
8725   finishCheck.Reset();
8726   actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
8727   application.SendNotification();
8728   application.Render(0);
8729   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
8730
8731   // Repeat with a shorter animator duration
8732   float animatorDuration = 0.5f;
8733   animation              = Animation::New(durationSeconds);
8734   animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
8735   animation.FinishedSignal().Connect(&application, finishCheck);
8736   animation.Play();
8737
8738   application.SendNotification();
8739   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% animation progress, 20% animator progress */);
8740
8741   // We didn't expect the animation to finish yet
8742   application.SendNotification();
8743   finishCheck.CheckSignalNotReceived();
8744   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), twentyPercentProgress, TEST_LOCATION);
8745
8746   application.SendNotification();
8747   application.Render(static_cast<unsigned int>(durationSeconds * 400.0f) /* 50% animation progress, 100% animator progress */);
8748
8749   // We didn't expect the animation to finish yet
8750   application.SendNotification();
8751   finishCheck.CheckSignalNotReceived();
8752   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8753
8754   application.SendNotification();
8755   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8756
8757   // We did expect the animation to finish
8758   application.SendNotification();
8759   finishCheck.CheckSignalReceived();
8760   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8761   END_TEST;
8762 }
8763
8764 int UtcDaliAnimationAnimateToActorColorRedP(void)
8765 {
8766   TestApplication application;
8767
8768   Actor actor = Actor::New();
8769   application.GetScene().Add(actor);
8770   float startValue(1.0f);
8771   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, startValue, TEST_LOCATION);
8772   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8773   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8774   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8775   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8776   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8777   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8778   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8779   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8780
8781   // Build the animation
8782   float     durationSeconds(1.0f);
8783   Animation animation = Animation::New(durationSeconds);
8784   float     targetRed(0.5f);
8785   animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetRed);
8786
8787   float fiftyPercentProgress(startValue + (targetRed - startValue) * 0.5f);
8788
8789   // Start the animation
8790   animation.Play();
8791
8792   // Target value should be retrievable straight away
8793   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(targetRed, startValue, startValue, startValue), TEST_LOCATION);
8794   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetRed, TEST_LOCATION);
8795
8796   bool                 signalReceived(false);
8797   AnimationFinishCheck finishCheck(signalReceived);
8798   animation.FinishedSignal().Connect(&application, finishCheck);
8799
8800   application.SendNotification();
8801   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8802
8803   // We didn't expect the animation to finish yet
8804   application.SendNotification();
8805   finishCheck.CheckSignalNotReceived();
8806   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, fiftyPercentProgress, TEST_LOCATION);
8807   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION);
8808   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8809   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8810   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8811
8812   application.SendNotification();
8813   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8814
8815   // We did expect the animation to finish
8816   application.SendNotification();
8817   finishCheck.CheckSignalReceived();
8818   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, targetRed, TEST_LOCATION);
8819   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), targetRed, TEST_LOCATION);
8820   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8821   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8822   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8823   END_TEST;
8824 }
8825
8826 int UtcDaliAnimationAnimateToActorColorGreenP(void)
8827 {
8828   TestApplication application;
8829
8830   Actor actor = Actor::New();
8831   application.GetScene().Add(actor);
8832   float startValue(1.0f);
8833   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, startValue, TEST_LOCATION);
8834   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8835   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8836   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8837   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8838   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8839   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8840   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8841   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8842
8843   // Build the animation
8844   float     durationSeconds(1.0f);
8845   Animation animation = Animation::New(durationSeconds);
8846   float     targetGreen(0.5f);
8847   animation.AnimateTo(Property(actor, Actor::Property::COLOR_GREEN), targetGreen);
8848
8849   float fiftyPercentProgress(startValue + (targetGreen - startValue) * 0.5f);
8850
8851   // Start the animation
8852   animation.Play();
8853
8854   // Target value should be retrievable straight away
8855   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(startValue, targetGreen, startValue, startValue), TEST_LOCATION);
8856   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION);
8857
8858   bool                 signalReceived(false);
8859   AnimationFinishCheck finishCheck(signalReceived);
8860   animation.FinishedSignal().Connect(&application, finishCheck);
8861
8862   application.SendNotification();
8863   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8864
8865   // We didn't expect the animation to finish yet
8866   application.SendNotification();
8867   finishCheck.CheckSignalNotReceived();
8868   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, fiftyPercentProgress, TEST_LOCATION);
8869   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8870   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION);
8871   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8872   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8873
8874   application.SendNotification();
8875   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8876
8877   // We did expect the animation to finish
8878   application.SendNotification();
8879   finishCheck.CheckSignalReceived();
8880   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, targetGreen, TEST_LOCATION);
8881   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8882   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION);
8883   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8884   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8885   END_TEST;
8886 }
8887
8888 int UtcDaliAnimationAnimateToActorColorBlueP(void)
8889 {
8890   TestApplication application;
8891
8892   Actor actor = Actor::New();
8893   application.GetScene().Add(actor);
8894   float startValue(1.0f);
8895   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, startValue, TEST_LOCATION);
8896   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8897   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8898   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8899   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8900   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8901   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8902   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8903   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8904
8905   // Build the animation
8906   float     durationSeconds(1.0f);
8907   Animation animation = Animation::New(durationSeconds);
8908   float     targetBlue(0.5f);
8909   animation.AnimateTo(Property(actor, Actor::Property::COLOR_BLUE), targetBlue);
8910
8911   float fiftyPercentProgress(startValue + (targetBlue - startValue) * 0.5f);
8912
8913   // Start the animation
8914   animation.Play();
8915
8916   // Target value should be retrievable straight away
8917   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(startValue, startValue, targetBlue, startValue), TEST_LOCATION);
8918   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetBlue, TEST_LOCATION);
8919
8920   bool                 signalReceived(false);
8921   AnimationFinishCheck finishCheck(signalReceived);
8922   animation.FinishedSignal().Connect(&application, finishCheck);
8923
8924   application.SendNotification();
8925   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8926
8927   // We didn't expect the animation to finish yet
8928   application.SendNotification();
8929   finishCheck.CheckSignalNotReceived();
8930   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, fiftyPercentProgress, TEST_LOCATION);
8931   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8932   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8933   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), fiftyPercentProgress, TEST_LOCATION);
8934   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8935
8936   application.SendNotification();
8937   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8938
8939   // We did expect the animation to finish
8940   application.SendNotification();
8941   finishCheck.CheckSignalReceived();
8942   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, targetBlue, TEST_LOCATION);
8943   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8944   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8945   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), targetBlue, TEST_LOCATION);
8946   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8947   END_TEST;
8948 }
8949
8950 int UtcDaliAnimationAnimateToActorColorAlphaP(void)
8951 {
8952   TestApplication application;
8953
8954   Actor actor = Actor::New();
8955   application.GetScene().Add(actor);
8956   float startValue(1.0f);
8957   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
8958   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8959   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8960   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8961   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8962   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8963   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8964   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8965   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8966
8967   // Build the animation
8968   float     durationSeconds(1.0f);
8969   Animation animation = Animation::New(durationSeconds);
8970   float     targetAlpha(0.5f);
8971   animation.AnimateTo(Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha);
8972
8973   float fiftyPercentProgress(startValue + (targetAlpha - startValue) * 0.5f);
8974
8975   // Start the animation
8976   animation.Play();
8977
8978   // Target value should be retrievable straight away
8979   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(startValue, startValue, startValue, targetAlpha), TEST_LOCATION);
8980   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetAlpha, TEST_LOCATION);
8981   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::OPACITY), targetAlpha, TEST_LOCATION);
8982
8983   bool                 signalReceived(false);
8984   AnimationFinishCheck finishCheck(signalReceived);
8985   animation.FinishedSignal().Connect(&application, finishCheck);
8986
8987   application.SendNotification();
8988   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8989
8990   // We didn't expect the animation to finish yet
8991   application.SendNotification();
8992   finishCheck.CheckSignalNotReceived();
8993   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, fiftyPercentProgress, TEST_LOCATION);
8994   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8995   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8996   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8997   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), fiftyPercentProgress, TEST_LOCATION);
8998
8999   application.SendNotification();
9000   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
9001
9002   // We did expect the animation to finish
9003   application.SendNotification();
9004   finishCheck.CheckSignalReceived();
9005   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, targetAlpha, TEST_LOCATION);
9006   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9007   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9008   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9009   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), targetAlpha, TEST_LOCATION);
9010   END_TEST;
9011 }
9012
9013 int UtcDaliAnimationKeyFrames01P(void)
9014 {
9015   TestApplication application;
9016
9017   KeyFrames keyFrames = KeyFrames::New();
9018   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9019
9020   keyFrames.Add(0.0f, 0.1f);
9021
9022   DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
9023
9024   KeyFrames keyFrames2(keyFrames);
9025   DALI_TEST_CHECK(keyFrames2);
9026   DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
9027
9028   KeyFrames keyFrames3 = KeyFrames::New();
9029   keyFrames3.Add(0.6f, true);
9030   DALI_TEST_CHECK(keyFrames3);
9031   DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
9032
9033   keyFrames3 = keyFrames;
9034   DALI_TEST_CHECK(keyFrames3);
9035   DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
9036
9037   END_TEST;
9038 }
9039
9040 int UtcDaliAnimationKeyFrames02N(void)
9041 {
9042   TestApplication application;
9043
9044   KeyFrames keyFrames = KeyFrames::New();
9045   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9046
9047   keyFrames.Add(0.0f, 0.1f);
9048   keyFrames.Add(0.2f, 0.5f);
9049   keyFrames.Add(0.4f, 0.0f);
9050   keyFrames.Add(0.6f, 1.0f);
9051   keyFrames.Add(0.8f, 0.7f);
9052   keyFrames.Add(1.0f, 0.9f);
9053
9054   DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
9055
9056   DALI_TEST_ASSERTION(
9057     {
9058       keyFrames.Add(1.9f, false);
9059     },
9060     "mType == value.GetType()");
9061
9062   END_TEST;
9063 }
9064
9065 int UtcDaliAnimationKeyFrames03N(void)
9066 {
9067   TestApplication application;
9068
9069   KeyFrames keyFrames = KeyFrames::New();
9070   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9071
9072   keyFrames.Add(0.0f, true);
9073   keyFrames.Add(0.2f, false);
9074   keyFrames.Add(0.4f, false);
9075   keyFrames.Add(0.6f, true);
9076   keyFrames.Add(0.8f, true);
9077   keyFrames.Add(1.0f, false);
9078
9079   DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
9080
9081   DALI_TEST_ASSERTION(
9082     {
9083       keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
9084     },
9085     "mType == value.GetType()");
9086
9087   END_TEST;
9088 }
9089
9090 int UtcDaliAnimationKeyFrames04N(void)
9091 {
9092   TestApplication application;
9093
9094   KeyFrames keyFrames = KeyFrames::New();
9095   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9096
9097   keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
9098   keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
9099   keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
9100   keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
9101   keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
9102   keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
9103
9104   DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
9105
9106   DALI_TEST_ASSERTION(
9107     {
9108       keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
9109     },
9110     "mType == value.GetType()");
9111
9112   END_TEST;
9113 }
9114
9115 int UtcDaliAnimationKeyFrames05N(void)
9116 {
9117   TestApplication application;
9118
9119   KeyFrames keyFrames = KeyFrames::New();
9120   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9121
9122   keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
9123   keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
9124   keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
9125   keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
9126   keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
9127   keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
9128
9129   DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
9130
9131   DALI_TEST_ASSERTION(
9132     {
9133       keyFrames.Add(0.7f, 1.0f);
9134     },
9135     "mType == value.GetType()");
9136
9137   END_TEST;
9138 }
9139
9140 int UtcDaliAnimationKeyFrames06N(void)
9141 {
9142   TestApplication application;
9143
9144   KeyFrames keyFrames = KeyFrames::New();
9145   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9146
9147   keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
9148   keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9149   keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
9150   keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
9151   keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
9152   keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
9153
9154   DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
9155
9156   DALI_TEST_ASSERTION(
9157     {
9158       keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
9159     },
9160     "mType == value.GetType()");
9161
9162   END_TEST;
9163 }
9164
9165 int UtcDaliAnimationKeyFrames07N(void)
9166 {
9167   TestApplication application;
9168
9169   KeyFrames keyFrames = KeyFrames::New();
9170   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9171
9172   keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
9173   keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
9174   keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
9175   keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
9176   keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
9177   keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
9178
9179   DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
9180
9181   DALI_TEST_ASSERTION(
9182     {
9183       keyFrames.Add(0.7f, 1.1f);
9184     },
9185     "mType == value.GetType()");
9186
9187   END_TEST;
9188 }
9189
9190 int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
9191 {
9192   TestApplication application;
9193
9194   float startValue(1.0f);
9195   Actor actor = Actor::New();
9196   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9197   application.GetScene().Add(actor);
9198
9199   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9200   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9201   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9202   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9203   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9204   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9205   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9206   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9207   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9208
9209   // Build the animation
9210   float     durationSeconds(1.0f);
9211   Animation animation = Animation::New(durationSeconds);
9212
9213   KeyFrames keyFrames = KeyFrames::New();
9214   keyFrames.Add(0.0f, 0.1f);
9215   keyFrames.Add(0.2f, 0.5f);
9216   keyFrames.Add(0.4f, 0.0f);
9217   keyFrames.Add(0.6f, 1.0f);
9218   keyFrames.Add(0.8f, 0.7f);
9219   keyFrames.Add(1.0f, 0.9f);
9220
9221   animation.AnimateBetween(Property(actor, Actor::Property::COLOR_ALPHA), keyFrames);
9222
9223   // Start the animation
9224   animation.Play();
9225
9226   // Final key frame value should be retrievable straight away
9227   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, TEST_LOCATION);
9228
9229   bool                 signalReceived(false);
9230   AnimationFinishCheck finishCheck(signalReceived);
9231   animation.FinishedSignal().Connect(&application, finishCheck);
9232   application.SendNotification();
9233   application.Render(0);
9234   application.SendNotification();
9235   finishCheck.CheckSignalNotReceived();
9236   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.1f, TEST_LOCATION);
9237
9238   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
9239   application.SendNotification();
9240   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9241   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9242   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9243   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION);
9244   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.3f, 0.01f, TEST_LOCATION);
9245
9246   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% progress */);
9247   application.SendNotification();
9248   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9249   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9250   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9251   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION);
9252   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.25f, 0.01f, TEST_LOCATION);
9253
9254   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 40% progress */);
9255   application.SendNotification();
9256   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9257   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9258   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9259   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION);
9260   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.0f, 0.01f, TEST_LOCATION);
9261
9262   application.Render(static_cast<unsigned int>(durationSeconds * 400.0f) /* 80% progress */);
9263   application.SendNotification();
9264   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9265   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9266   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9267   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION);
9268   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.7f, 0.01f, TEST_LOCATION);
9269
9270   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 90% progress */);
9271   application.SendNotification();
9272   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9273   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9274   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9275   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION);
9276   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.8f, 0.01f, TEST_LOCATION);
9277
9278   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1 /* 100% progress */);
9279   application.SendNotification();
9280   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9281   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9282   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9283   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION);
9284   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.9f, 0.01f, TEST_LOCATION);
9285
9286   // We did expect the animation to finish
9287
9288   finishCheck.CheckSignalReceived();
9289   END_TEST;
9290 }
9291
9292 int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
9293 {
9294   TestApplication application;
9295
9296   float startValue(1.0f);
9297   Actor actor = Actor::New();
9298   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9299   application.GetScene().Add(actor);
9300
9301   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9302   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9303   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9304   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9305   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9306   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9307   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9308   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9309   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9310
9311   // Build the animation
9312   float     durationSeconds(1.0f);
9313   Animation animation = Animation::New(durationSeconds);
9314
9315   KeyFrames keyFrames = KeyFrames::New();
9316   keyFrames.Add(0.0f, 0.1f);
9317   keyFrames.Add(0.2f, 0.5f);
9318   keyFrames.Add(0.4f, 0.0f);
9319   keyFrames.Add(0.6f, 1.0f);
9320   keyFrames.Add(0.8f, 0.7f);
9321   keyFrames.Add(1.0f, 0.9f);
9322
9323   animation.AnimateBetween(Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::CUBIC);
9324
9325   // Start the animation
9326   animation.Play();
9327
9328   bool                 signalReceived(false);
9329   AnimationFinishCheck finishCheck(signalReceived);
9330   animation.FinishedSignal().Connect(&application, finishCheck);
9331   application.SendNotification();
9332   application.Render(0);
9333   application.SendNotification();
9334   finishCheck.CheckSignalNotReceived();
9335   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.1f, TEST_LOCATION);
9336
9337   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
9338   application.SendNotification();
9339   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9340   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9341   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9342   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.36f, 0.01f, TEST_LOCATION);
9343   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.36f, 0.01f, TEST_LOCATION);
9344
9345   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% progress */);
9346   application.SendNotification();
9347   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9348   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9349   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9350   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.21f, 0.01f, TEST_LOCATION);
9351   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.21f, 0.01f, TEST_LOCATION);
9352
9353   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 40% progress */);
9354   application.SendNotification();
9355   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9356   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9357   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9358   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION);
9359   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.0f, 0.01f, TEST_LOCATION);
9360
9361   application.Render(static_cast<unsigned int>(durationSeconds * 400.0f) /* 80% progress */);
9362   application.SendNotification();
9363   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9364   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9365   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9366   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION);
9367   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.7f, 0.01f, TEST_LOCATION);
9368
9369   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 90% progress */);
9370   application.SendNotification();
9371   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9372   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9373   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9374   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.76f, 0.01f, TEST_LOCATION);
9375   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.76f, 0.01f, TEST_LOCATION);
9376
9377   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1 /* 100% progress */);
9378   application.SendNotification();
9379   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9380   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9381   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9382   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION);
9383   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.9f, 0.01f, TEST_LOCATION);
9384
9385   // We did expect the animation to finish
9386
9387   finishCheck.CheckSignalReceived();
9388   END_TEST;
9389 }
9390
9391 int UtcDaliAnimationAnimateBetweenActorColorP(void)
9392 {
9393   TestApplication application;
9394
9395   float startValue(1.0f);
9396   Actor actor = Actor::New();
9397   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9398   application.GetScene().Add(actor);
9399
9400   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9401   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9402   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9403   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9404   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9405   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9406   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9407   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9408   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9409
9410   // Build the animation
9411   float     durationSeconds(1.0f);
9412   Animation animation = Animation::New(durationSeconds);
9413
9414   KeyFrames keyFrames = KeyFrames::New();
9415   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9416   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9417   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9418
9419   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames);
9420
9421   // Start the animation
9422   animation.Play();
9423
9424   bool                 signalReceived(false);
9425   AnimationFinishCheck finishCheck(signalReceived);
9426   animation.FinishedSignal().Connect(&application, finishCheck);
9427   application.SendNotification();
9428   application.Render(0);
9429   application.SendNotification();
9430   finishCheck.CheckSignalNotReceived();
9431   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
9432   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
9433   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
9434   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
9435
9436   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9437   application.SendNotification();
9438   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
9439   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
9440   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
9441   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
9442
9443   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9444   application.SendNotification();
9445   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
9446   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
9447   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
9448   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
9449
9450   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9451   application.SendNotification();
9452   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
9453   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
9454   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
9455   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
9456
9457   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9458   application.SendNotification();
9459   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
9460   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
9461   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
9462   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
9463
9464   // We did expect the animation to finish
9465
9466   finishCheck.CheckSignalReceived();
9467   END_TEST;
9468 }
9469
9470 int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
9471 {
9472   TestApplication application;
9473
9474   float startValue(1.0f);
9475   Actor actor = Actor::New();
9476   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9477   application.GetScene().Add(actor);
9478
9479   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9480   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9481   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9482   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9483   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9484   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9485   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9486   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9487   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9488
9489   // Build the animation
9490   float     durationSeconds(1.0f);
9491   Animation animation = Animation::New(durationSeconds);
9492
9493   KeyFrames keyFrames = KeyFrames::New();
9494   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9495   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9496   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9497
9498   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, Animation::CUBIC);
9499
9500   // Start the animation
9501   animation.Play();
9502
9503   bool                 signalReceived(false);
9504   AnimationFinishCheck finishCheck(signalReceived);
9505   animation.FinishedSignal().Connect(&application, finishCheck);
9506   application.SendNotification();
9507   application.Render(0);
9508   application.SendNotification();
9509   finishCheck.CheckSignalNotReceived();
9510   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
9511   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
9512   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
9513   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
9514
9515   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9516   application.SendNotification();
9517   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
9518   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
9519   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
9520   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
9521
9522   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9523   application.SendNotification();
9524   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
9525   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
9526   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
9527   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
9528
9529   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9530   application.SendNotification();
9531   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
9532   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
9533   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
9534   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
9535
9536   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9537   application.SendNotification();
9538   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
9539   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
9540   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
9541   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
9542
9543   // We did expect the animation to finish
9544
9545   finishCheck.CheckSignalReceived();
9546   END_TEST;
9547 }
9548
9549 int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
9550 {
9551   TestApplication application;
9552
9553   Actor     actor = Actor::New();
9554   AngleAxis aa(Degree(90), Vector3::XAXIS);
9555   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9556   application.GetScene().Add(actor);
9557
9558   application.SendNotification();
9559   application.Render(0);
9560
9561   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9562
9563   // Build the animation
9564   float     durationSeconds(1.0f);
9565   Animation animation = Animation::New(durationSeconds);
9566
9567   KeyFrames keyFrames = KeyFrames::New();
9568   keyFrames.Add(0.0f, false);
9569   keyFrames.Add(0.2f, true);
9570   keyFrames.Add(0.4f, true);
9571   keyFrames.Add(0.8f, false);
9572   keyFrames.Add(1.0f, true);
9573
9574   animation.AnimateBetween(Property(actor, Actor::Property::VISIBLE), keyFrames);
9575
9576   // Start the animation
9577   animation.Play();
9578
9579   // Final key frame value should be retrievable straight away
9580   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9581
9582   bool                 signalReceived(false);
9583   AnimationFinishCheck finishCheck(signalReceived);
9584   animation.FinishedSignal().Connect(&application, finishCheck);
9585   application.SendNotification();
9586   application.SendNotification();
9587   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9588   application.SendNotification();
9589   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9590   application.SendNotification();
9591
9592   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9593   finishCheck.CheckSignalReceived();
9594   END_TEST;
9595 }
9596
9597 int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
9598 {
9599   TestApplication application;
9600
9601   Actor     actor = Actor::New();
9602   AngleAxis aa(Degree(90), Vector3::XAXIS);
9603   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9604   application.GetScene().Add(actor);
9605
9606   application.SendNotification();
9607   application.Render(0);
9608
9609   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9610
9611   // Build the animation
9612   float     durationSeconds(1.0f);
9613   Animation animation = Animation::New(durationSeconds);
9614
9615   KeyFrames keyFrames = KeyFrames::New();
9616   keyFrames.Add(0.0f, false);
9617   keyFrames.Add(0.2f, true);
9618   keyFrames.Add(0.4f, true);
9619   keyFrames.Add(0.8f, false);
9620   keyFrames.Add(1.0f, true);
9621
9622   //Cubic interpolation for boolean values should be ignored
9623   animation.AnimateBetween(Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::CUBIC);
9624
9625   // Start the animation
9626   animation.Play();
9627
9628   bool                 signalReceived(false);
9629   AnimationFinishCheck finishCheck(signalReceived);
9630   animation.FinishedSignal().Connect(&application, finishCheck);
9631   application.SendNotification();
9632   application.SendNotification();
9633   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9634   application.SendNotification();
9635   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9636   application.SendNotification();
9637
9638   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9639   finishCheck.CheckSignalReceived();
9640   END_TEST;
9641 }
9642
9643 int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
9644 {
9645   TestApplication application;
9646
9647   Actor     actor = Actor::New();
9648   AngleAxis aa(Degree(90), Vector3::XAXIS);
9649   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9650   application.GetScene().Add(actor);
9651
9652   application.SendNotification();
9653   application.Render(0);
9654   Quaternion start(Radian(aa.angle), aa.axis);
9655   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9656
9657   // Build the animation
9658   float     durationSeconds(1.0f);
9659   Animation animation = Animation::New(durationSeconds);
9660
9661   KeyFrames keyFrames = KeyFrames::New();
9662   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9663
9664   animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames);
9665
9666   // Start the animation
9667   animation.Play();
9668
9669   // Final key frame value should be retrievable straight away
9670   DALI_TEST_EQUALS(actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Degree(60), Vector3::ZAXIS), TEST_LOCATION);
9671
9672   bool                 signalReceived(false);
9673   AnimationFinishCheck finishCheck(signalReceived);
9674   animation.FinishedSignal().Connect(&application, finishCheck);
9675   application.SendNotification();
9676   application.SendNotification();
9677   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9678   application.SendNotification();
9679   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9680   application.SendNotification();
9681
9682   Quaternion check(Radian(Degree(60)), Vector3::ZAXIS);
9683
9684   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9685   finishCheck.CheckSignalReceived();
9686   END_TEST;
9687 }
9688
9689 int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
9690 {
9691   TestApplication application;
9692
9693   Actor     actor = Actor::New();
9694   AngleAxis aa(Degree(90), Vector3::XAXIS);
9695   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9696   application.SendNotification();
9697   application.Render(0);
9698   application.GetScene().Add(actor);
9699
9700   Quaternion start(Radian(aa.angle), aa.axis);
9701   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9702
9703   // Build the animation
9704   float     durationSeconds(1.0f);
9705   Animation animation = Animation::New(durationSeconds);
9706
9707   KeyFrames keyFrames = KeyFrames::New();
9708   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9709   keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9710   keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9711
9712   animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames);
9713
9714   // Start the animation
9715   animation.Play();
9716
9717   bool                 signalReceived(false);
9718   AnimationFinishCheck finishCheck(signalReceived);
9719   animation.FinishedSignal().Connect(&application, finishCheck);
9720   application.SendNotification();
9721   application.Render(0);
9722   application.SendNotification();
9723   finishCheck.CheckSignalNotReceived();
9724
9725   Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9726   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9727
9728   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9729   application.SendNotification();
9730   check = Quaternion(Radian(Degree(90)), Vector3::XAXIS);
9731   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9732
9733   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9734   application.SendNotification();
9735   check = Quaternion(Radian(Degree(120)), Vector3::XAXIS);
9736   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9737
9738   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9739   application.SendNotification();
9740   check = Quaternion(Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f));
9741   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9742
9743   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9744   application.SendNotification();
9745   check = Quaternion(Radian(Degree(120)), Vector3::YAXIS);
9746   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9747
9748   // We did expect the animation to finish
9749
9750   finishCheck.CheckSignalReceived();
9751   END_TEST;
9752 }
9753
9754 int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
9755 {
9756   TestApplication application;
9757
9758   Actor     actor = Actor::New();
9759   AngleAxis aa(Degree(90), Vector3::XAXIS);
9760   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9761   application.GetScene().Add(actor);
9762
9763   application.SendNotification();
9764   application.Render(0);
9765   Quaternion start(Radian(aa.angle), aa.axis);
9766   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9767
9768   // Build the animation
9769   float     durationSeconds(1.0f);
9770   Animation animation = Animation::New(durationSeconds);
9771
9772   KeyFrames keyFrames = KeyFrames::New();
9773   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9774
9775   //Cubic interpolation should be ignored for quaternions
9776   animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::CUBIC);
9777
9778   // Start the animation
9779   animation.Play();
9780
9781   bool                 signalReceived(false);
9782   AnimationFinishCheck finishCheck(signalReceived);
9783   animation.FinishedSignal().Connect(&application, finishCheck);
9784   application.SendNotification();
9785   application.SendNotification();
9786   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9787   application.SendNotification();
9788   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9789   application.SendNotification();
9790
9791   Quaternion check(Radian(Degree(60)), Vector3::ZAXIS);
9792
9793   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9794   finishCheck.CheckSignalReceived();
9795   END_TEST;
9796 }
9797
9798 int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
9799 {
9800   TestApplication application;
9801
9802   Actor     actor = Actor::New();
9803   AngleAxis aa(Degree(90), Vector3::XAXIS);
9804   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9805   application.SendNotification();
9806   application.Render(0);
9807   application.GetScene().Add(actor);
9808
9809   Quaternion start(Radian(aa.angle), aa.axis);
9810   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9811
9812   // Build the animation
9813   float     durationSeconds(1.0f);
9814   Animation animation = Animation::New(durationSeconds);
9815
9816   KeyFrames keyFrames = KeyFrames::New();
9817   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9818   keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9819   keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9820
9821   //Cubic interpolation should be ignored for quaternions
9822   animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::CUBIC);
9823
9824   // Start the animation
9825   animation.Play();
9826
9827   bool                 signalReceived(false);
9828   AnimationFinishCheck finishCheck(signalReceived);
9829   animation.FinishedSignal().Connect(&application, finishCheck);
9830   application.SendNotification();
9831   application.Render(0);
9832   application.SendNotification();
9833   finishCheck.CheckSignalNotReceived();
9834
9835   Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9836   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9837
9838   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9839   application.SendNotification();
9840   check = Quaternion(Radian(Degree(90)), Vector3::XAXIS);
9841   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9842
9843   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9844   application.SendNotification();
9845   check = Quaternion(Radian(Degree(120)), Vector3::XAXIS);
9846   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9847
9848   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9849   application.SendNotification();
9850   check = Quaternion(Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f));
9851   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9852
9853   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9854   application.SendNotification();
9855   check = Quaternion(Radian(Degree(120)), Vector3::YAXIS);
9856   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9857
9858   // We did expect the animation to finish
9859
9860   finishCheck.CheckSignalReceived();
9861   END_TEST;
9862 }
9863
9864 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
9865 {
9866   TestApplication application;
9867
9868   float startValue(1.0f);
9869   Actor actor = Actor::New();
9870   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9871   application.GetScene().Add(actor);
9872
9873   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9874   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9875   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9876   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9877   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9878   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9879   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9880   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9881   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9882
9883   // Build the animation
9884   float     durationSeconds(1.0f);
9885   Animation animation = Animation::New(durationSeconds);
9886
9887   KeyFrames keyFrames = KeyFrames::New();
9888   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9889   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9890   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9891
9892   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR);
9893
9894   // Start the animation
9895   animation.Play();
9896
9897   bool                 signalReceived(false);
9898   AnimationFinishCheck finishCheck(signalReceived);
9899   animation.FinishedSignal().Connect(&application, finishCheck);
9900   application.SendNotification();
9901   application.Render(0);
9902   application.SendNotification();
9903   finishCheck.CheckSignalNotReceived();
9904   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
9905   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
9906   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
9907   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
9908
9909   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9910   application.SendNotification();
9911   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
9912   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
9913   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
9914   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
9915
9916   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9917   application.SendNotification();
9918   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
9919   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
9920   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
9921   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
9922
9923   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9924   application.SendNotification();
9925   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
9926   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
9927   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
9928   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
9929
9930   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9931   application.SendNotification();
9932   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
9933   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
9934   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
9935   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
9936
9937   // We did expect the animation to finish
9938
9939   finishCheck.CheckSignalReceived();
9940   END_TEST;
9941 }
9942
9943 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
9944 {
9945   TestApplication application;
9946
9947   float startValue(1.0f);
9948   Actor actor = Actor::New();
9949   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9950   application.GetScene().Add(actor);
9951
9952   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9953   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9954   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9955   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9956   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9957   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9958   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9959   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9960   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9961
9962   // Build the animation
9963   float     durationSeconds(1.0f);
9964   Animation animation = Animation::New(durationSeconds);
9965
9966   KeyFrames keyFrames = KeyFrames::New();
9967   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9968   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9969   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9970
9971   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::CUBIC);
9972
9973   // Start the animation
9974   animation.Play();
9975
9976   bool                 signalReceived(false);
9977   AnimationFinishCheck finishCheck(signalReceived);
9978   animation.FinishedSignal().Connect(&application, finishCheck);
9979   application.SendNotification();
9980   application.Render(0);
9981   application.SendNotification();
9982   finishCheck.CheckSignalNotReceived();
9983   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
9984   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
9985   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
9986   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
9987
9988   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9989   application.SendNotification();
9990   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
9991   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
9992   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
9993   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
9994
9995   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9996   application.SendNotification();
9997   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
9998   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
9999   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10000   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10001
10002   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10003   application.SendNotification();
10004   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
10005   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
10006   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
10007   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
10008
10009   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10010   application.SendNotification();
10011   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10012   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10013   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10014   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10015
10016   // We did expect the animation to finish
10017
10018   finishCheck.CheckSignalReceived();
10019   END_TEST;
10020 }
10021
10022 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void)
10023 {
10024   TestApplication application;
10025
10026   float startValue(1.0f);
10027   Actor actor = Actor::New();
10028   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10029   application.GetScene().Add(actor);
10030
10031   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10032   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10033   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10034   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10035   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10036   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10037   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10038   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10039   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10040
10041   // Build the animation
10042   float     durationSeconds(1.0f);
10043   float     delay     = 0.5f;
10044   Animation animation = Animation::New(durationSeconds);
10045
10046   KeyFrames keyFrames = KeyFrames::New();
10047   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10048   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10049   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10050
10051   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod(delay, durationSeconds - delay));
10052
10053   // Start the animation
10054   animation.Play();
10055
10056   bool                 signalReceived(false);
10057   AnimationFinishCheck finishCheck(signalReceived);
10058   animation.FinishedSignal().Connect(&application, finishCheck);
10059   application.SendNotification();
10060
10061   application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
10062   application.SendNotification();
10063   finishCheck.CheckSignalNotReceived();
10064   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10065   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10066   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10067   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10068
10069   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
10070   application.SendNotification();
10071   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
10072   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
10073   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
10074   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
10075
10076   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
10077   application.SendNotification();
10078   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10079   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10080   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10081   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10082
10083   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
10084   application.SendNotification();
10085   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
10086   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
10087   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
10088   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
10089
10090   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10091   application.SendNotification();
10092   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10093   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10094   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10095   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10096
10097   // We did expect the animation to finish
10098
10099   finishCheck.CheckSignalReceived();
10100   END_TEST;
10101 }
10102
10103 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
10104 {
10105   TestApplication application;
10106
10107   float startValue(1.0f);
10108   Actor actor = Actor::New();
10109   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10110   application.GetScene().Add(actor);
10111
10112   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10113   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10114   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10115   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10116   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10117   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10118   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10119   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10120   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10121
10122   // Build the animation
10123   float     durationSeconds(1.0f);
10124   float     delay     = 0.5f;
10125   Animation animation = Animation::New(durationSeconds);
10126
10127   KeyFrames keyFrames = KeyFrames::New();
10128   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10129   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10130   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10131
10132   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod(delay, durationSeconds - delay), Animation::CUBIC);
10133
10134   // Start the animation
10135   animation.Play();
10136
10137   bool                 signalReceived(false);
10138   AnimationFinishCheck finishCheck(signalReceived);
10139   animation.FinishedSignal().Connect(&application, finishCheck);
10140   application.SendNotification();
10141
10142   application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
10143   application.SendNotification();
10144   finishCheck.CheckSignalNotReceived();
10145   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10146   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10147   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10148   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10149
10150   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
10151   application.SendNotification();
10152   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
10153   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
10154   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
10155   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
10156
10157   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
10158   application.SendNotification();
10159   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10160   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10161   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10162   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10163
10164   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
10165   application.SendNotification();
10166   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
10167   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
10168   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
10169   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
10170
10171   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10172   application.SendNotification();
10173   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10174   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10175   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10176   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10177
10178   // We did expect the animation to finish
10179
10180   finishCheck.CheckSignalReceived();
10181   END_TEST;
10182 }
10183
10184 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
10185 {
10186   TestApplication application;
10187
10188   float startValue(1.0f);
10189   float delay = 0.5f;
10190   Actor actor = Actor::New();
10191   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10192   application.GetScene().Add(actor);
10193
10194   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10195   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10196   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10197   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10198   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10199   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10200   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10201   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10202   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10203
10204   // Build the animation
10205   float     durationSeconds(1.0f);
10206   Animation animation = Animation::New(durationSeconds);
10207
10208   KeyFrames keyFrames = KeyFrames::New();
10209   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10210   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10211   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10212
10213   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
10214
10215   // Start the animation
10216   animation.Play();
10217
10218   bool                 signalReceived(false);
10219   AnimationFinishCheck finishCheck(signalReceived);
10220   animation.FinishedSignal().Connect(&application, finishCheck);
10221   application.SendNotification();
10222
10223   application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
10224   application.SendNotification();
10225   finishCheck.CheckSignalNotReceived();
10226   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10227   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10228   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10229   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10230
10231   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
10232   application.SendNotification();
10233   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
10234   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
10235   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
10236   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
10237
10238   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
10239   application.SendNotification();
10240   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10241   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10242   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10243   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10244
10245   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
10246   application.SendNotification();
10247   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
10248   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
10249   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
10250   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
10251
10252   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10253   application.SendNotification();
10254   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10255   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10256   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10257   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10258
10259   // We did expect the animation to finish
10260
10261   finishCheck.CheckSignalReceived();
10262   END_TEST;
10263 }
10264
10265 int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void)
10266 {
10267   TestApplication application;
10268
10269   float startValue(1.0f);
10270   Actor actor = Actor::New();
10271   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10272   application.GetScene().Add(actor);
10273
10274   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10275   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10276   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10277   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10278   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10279   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10280   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10281   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10282   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10283
10284   // Build the animation
10285   float     durationSeconds(1.0f);
10286   float     delay     = 0.5f;
10287   Animation animation = Animation::New(durationSeconds);
10288
10289   KeyFrames keyFrames = KeyFrames::New();
10290   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10291   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10292   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10293
10294   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay), Animation::CUBIC);
10295
10296   // Start the animation
10297   animation.Play();
10298
10299   bool                 signalReceived(false);
10300   AnimationFinishCheck finishCheck(signalReceived);
10301   animation.FinishedSignal().Connect(&application, finishCheck);
10302   application.SendNotification();
10303
10304   application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
10305   application.SendNotification();
10306   finishCheck.CheckSignalNotReceived();
10307   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10308   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10309   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10310   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10311
10312   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
10313   application.SendNotification();
10314   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
10315   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
10316   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
10317   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
10318
10319   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
10320   application.SendNotification();
10321   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10322   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10323   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10324   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10325
10326   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
10327   application.SendNotification();
10328   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
10329   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
10330   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
10331   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
10332
10333   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10334   application.SendNotification();
10335   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10336   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10337   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10338   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10339
10340   // We did expect the animation to finish
10341
10342   finishCheck.CheckSignalReceived();
10343   END_TEST;
10344 }
10345
10346 int UtcDaliAnimationAnimateP(void)
10347 {
10348   TestApplication application;
10349
10350   Actor actor = Actor::New();
10351   application.GetScene().Add(actor);
10352
10353   //Build the path
10354   Vector3 position0(30.0, 80.0, 0.0);
10355   Vector3 position1(70.0, 120.0, 0.0);
10356   Vector3 position2(100.0, 100.0, 0.0);
10357
10358   Dali::Path path = Dali::Path::New();
10359   path.AddPoint(position0);
10360   path.AddPoint(position1);
10361   path.AddPoint(position2);
10362
10363   //Control points for first segment
10364   path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10365   path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10366
10367   //Control points for second segment
10368   path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10369   path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10370
10371   // Build the animation
10372   float     durationSeconds(1.0f);
10373   Animation animation = Animation::New(durationSeconds);
10374   animation.Animate(actor, path, Vector3::XAXIS);
10375
10376   // Start the animation
10377   animation.Play();
10378
10379   bool                 signalReceived(false);
10380   AnimationFinishCheck finishCheck(signalReceived);
10381   animation.FinishedSignal().Connect(&application, finishCheck);
10382   application.SendNotification();
10383   application.Render(0);
10384   application.SendNotification();
10385   finishCheck.CheckSignalNotReceived();
10386   Vector3    position, tangent;
10387   Quaternion rotation;
10388   path.Sample(0.0f, position, tangent);
10389   rotation = Quaternion(Vector3::XAXIS, tangent);
10390   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10391   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10392
10393   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10394   application.SendNotification();
10395   path.Sample(0.25f, position, tangent);
10396   rotation = Quaternion(Vector3::XAXIS, tangent);
10397   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10398   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10399
10400   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10401   application.SendNotification();
10402   path.Sample(0.5f, position, tangent);
10403   rotation = Quaternion(Vector3::XAXIS, tangent);
10404   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10405   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10406
10407   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10408   application.SendNotification();
10409   path.Sample(0.75f, position, tangent);
10410   rotation = Quaternion(Vector3::XAXIS, tangent);
10411   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10412   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10413
10414   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10415   application.SendNotification();
10416   path.Sample(1.0f, position, tangent);
10417   rotation = Quaternion(Vector3::XAXIS, tangent);
10418   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10419   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10420
10421   finishCheck.CheckSignalReceived();
10422   END_TEST;
10423 }
10424
10425 int UtcDaliAnimationAnimateAlphaFunctionP(void)
10426 {
10427   TestApplication application;
10428
10429   Actor actor = Actor::New();
10430   application.GetScene().Add(actor);
10431
10432   //Build the path
10433   Vector3 position0(30.0, 80.0, 0.0);
10434   Vector3 position1(70.0, 120.0, 0.0);
10435   Vector3 position2(100.0, 100.0, 0.0);
10436
10437   Dali::Path path = Dali::Path::New();
10438   path.AddPoint(position0);
10439   path.AddPoint(position1);
10440   path.AddPoint(position2);
10441
10442   //Control points for first segment
10443   path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10444   path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10445
10446   //Control points for second segment
10447   path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10448   path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10449
10450   // Build the animation
10451   float     durationSeconds(1.0f);
10452   Animation animation = Animation::New(durationSeconds);
10453   animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
10454
10455   // Start the animation
10456   animation.Play();
10457
10458   bool                 signalReceived(false);
10459   AnimationFinishCheck finishCheck(signalReceived);
10460   animation.FinishedSignal().Connect(&application, finishCheck);
10461   application.SendNotification();
10462   application.Render(0);
10463   application.SendNotification();
10464   finishCheck.CheckSignalNotReceived();
10465   Vector3    position, tangent;
10466   Quaternion rotation;
10467   path.Sample(0.0f, position, tangent);
10468   rotation = Quaternion(Vector3::XAXIS, tangent);
10469   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10470   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10471
10472   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10473   application.SendNotification();
10474   path.Sample(0.25f, position, tangent);
10475   rotation = Quaternion(Vector3::XAXIS, tangent);
10476   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10477   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10478
10479   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10480   application.SendNotification();
10481   path.Sample(0.5f, position, tangent);
10482   rotation = Quaternion(Vector3::XAXIS, tangent);
10483   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10484   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10485
10486   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10487   application.SendNotification();
10488   path.Sample(0.75f, position, tangent);
10489   rotation = Quaternion(Vector3::XAXIS, tangent);
10490   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10491   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10492
10493   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10494   application.SendNotification();
10495   path.Sample(1.0f, position, tangent);
10496   rotation = Quaternion(Vector3::XAXIS, tangent);
10497   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10498   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10499
10500   finishCheck.CheckSignalReceived();
10501   END_TEST;
10502 }
10503
10504 int UtcDaliAnimationAnimateTimePeriodP(void)
10505 {
10506   TestApplication application;
10507
10508   Actor actor = Actor::New();
10509   application.GetScene().Add(actor);
10510
10511   //Build the path
10512   Vector3 position0(30.0, 80.0, 0.0);
10513   Vector3 position1(70.0, 120.0, 0.0);
10514   Vector3 position2(100.0, 100.0, 0.0);
10515
10516   Dali::Path path = Dali::Path::New();
10517   path.AddPoint(position0);
10518   path.AddPoint(position1);
10519   path.AddPoint(position2);
10520
10521   //Control points for first segment
10522   path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10523   path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10524
10525   //Control points for second segment
10526   path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10527   path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10528
10529   // Build the animation
10530   float     durationSeconds(1.0f);
10531   Animation animation = Animation::New(durationSeconds);
10532   animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
10533
10534   // Start the animation
10535   animation.Play();
10536
10537   bool                 signalReceived(false);
10538   AnimationFinishCheck finishCheck(signalReceived);
10539   animation.FinishedSignal().Connect(&application, finishCheck);
10540   application.SendNotification();
10541   application.Render(0);
10542   application.SendNotification();
10543   finishCheck.CheckSignalNotReceived();
10544   Vector3    position, tangent;
10545   Quaternion rotation;
10546   path.Sample(0.0f, position, tangent);
10547   rotation = Quaternion(Vector3::XAXIS, tangent);
10548   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10549   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10550
10551   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10552   application.SendNotification();
10553   path.Sample(0.25f, position, tangent);
10554   rotation = Quaternion(Vector3::XAXIS, tangent);
10555   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10556   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10557
10558   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10559   application.SendNotification();
10560   path.Sample(0.5f, position, tangent);
10561   rotation = Quaternion(Vector3::XAXIS, tangent);
10562   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10563   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10564
10565   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10566   application.SendNotification();
10567   path.Sample(0.75f, position, tangent);
10568   rotation = Quaternion(Vector3::XAXIS, tangent);
10569   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10570   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10571
10572   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10573   application.SendNotification();
10574   path.Sample(1.0f, position, tangent);
10575   rotation = Quaternion(Vector3::XAXIS, tangent);
10576   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10577   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10578
10579   finishCheck.CheckSignalReceived();
10580   END_TEST;
10581 }
10582
10583 int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
10584 {
10585   TestApplication application;
10586
10587   Actor actor = Actor::New();
10588   application.GetScene().Add(actor);
10589
10590   //Build the path
10591   Vector3 position0(30.0, 80.0, 0.0);
10592   Vector3 position1(70.0, 120.0, 0.0);
10593   Vector3 position2(100.0, 100.0, 0.0);
10594
10595   Dali::Path path = Dali::Path::New();
10596   path.AddPoint(position0);
10597   path.AddPoint(position1);
10598   path.AddPoint(position2);
10599
10600   //Control points for first segment
10601   path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10602   path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10603
10604   //Control points for second segment
10605   path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10606   path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10607
10608   // Build the animation
10609   float     durationSeconds(1.0f);
10610   Animation animation = Animation::New(durationSeconds);
10611   animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
10612
10613   // Start the animation
10614   animation.Play();
10615
10616   bool                 signalReceived(false);
10617   AnimationFinishCheck finishCheck(signalReceived);
10618   animation.FinishedSignal().Connect(&application, finishCheck);
10619   application.SendNotification();
10620   application.Render(0);
10621   application.SendNotification();
10622   finishCheck.CheckSignalNotReceived();
10623   Vector3    position, tangent;
10624   Quaternion rotation;
10625   path.Sample(0.0f, position, tangent);
10626   rotation = Quaternion(Vector3::XAXIS, tangent);
10627   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10628   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10629
10630   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10631   application.SendNotification();
10632   path.Sample(0.25f, position, tangent);
10633   rotation = Quaternion(Vector3::XAXIS, tangent);
10634   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10635   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10636
10637   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10638   application.SendNotification();
10639   path.Sample(0.5f, position, tangent);
10640   rotation = Quaternion(Vector3::XAXIS, tangent);
10641   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10642   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10643
10644   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10645   application.SendNotification();
10646   path.Sample(0.75f, position, tangent);
10647   rotation = Quaternion(Vector3::XAXIS, tangent);
10648   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10649   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10650
10651   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10652   application.SendNotification();
10653   path.Sample(1.0f, position, tangent);
10654   rotation = Quaternion(Vector3::XAXIS, tangent);
10655   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10656   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10657
10658   finishCheck.CheckSignalReceived();
10659   END_TEST;
10660 }
10661
10662 int UtcDaliAnimationShowP(void)
10663 {
10664   TestApplication application;
10665
10666   Actor actor = Actor::New();
10667   actor.SetProperty(Actor::Property::VISIBLE, false);
10668   application.SendNotification();
10669   application.Render(0);
10670   DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10671   application.GetScene().Add(actor);
10672
10673   // Start the animation
10674   float     durationSeconds(10.0f);
10675   Animation animation = Animation::New(durationSeconds);
10676   animation.Show(actor, durationSeconds * 0.5f);
10677   animation.Play();
10678
10679   bool                 signalReceived(false);
10680   AnimationFinishCheck finishCheck(signalReceived);
10681   animation.FinishedSignal().Connect(&application, finishCheck);
10682
10683   application.SendNotification();
10684   application.Render(static_cast<unsigned int>(durationSeconds * 490.0f));
10685
10686   // We didn't expect the animation to finish yet
10687   application.SendNotification();
10688   finishCheck.CheckSignalNotReceived();
10689   DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10690
10691   application.SendNotification();
10692   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) /*Should be shown now*/);
10693
10694   // We didn't expect the animation to finish yet
10695   application.SendNotification();
10696   finishCheck.CheckSignalNotReceived();
10697   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10698
10699   application.SendNotification();
10700   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
10701
10702   // We did expect the animation to finish
10703   application.SendNotification();
10704   finishCheck.CheckSignalReceived();
10705   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10706   END_TEST;
10707 }
10708
10709 int UtcDaliAnimationHideP(void)
10710 {
10711   TestApplication application;
10712
10713   Actor actor = Actor::New();
10714   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10715   application.GetScene().Add(actor);
10716
10717   // Start the animation
10718   float     durationSeconds(10.0f);
10719   Animation animation = Animation::New(durationSeconds);
10720   animation.Hide(actor, durationSeconds * 0.5f);
10721   animation.Play();
10722
10723   bool                 signalReceived(false);
10724   AnimationFinishCheck finishCheck(signalReceived);
10725   animation.FinishedSignal().Connect(&application, finishCheck);
10726
10727   application.SendNotification();
10728   application.Render(static_cast<unsigned int>(durationSeconds * 490.0f));
10729
10730   // We didn't expect the animation to finish yet
10731   application.SendNotification();
10732   finishCheck.CheckSignalNotReceived();
10733   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10734
10735   application.SendNotification();
10736   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) /*Should be hidden now*/);
10737
10738   // We didn't expect the animation to finish yet
10739   application.SendNotification();
10740   finishCheck.CheckSignalNotReceived();
10741   DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10742
10743   application.SendNotification();
10744   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
10745
10746   // We did expect the animation to finish
10747   application.SendNotification();
10748   finishCheck.CheckSignalReceived();
10749   DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10750   END_TEST;
10751 }
10752
10753 int UtcDaliAnimationShowHideAtEndP(void)
10754 {
10755   // Test that show/hide delay can be the same as animation duration
10756   // i.e. to show/hide at the end of the animation
10757
10758   TestApplication application;
10759
10760   Actor actor = Actor::New();
10761   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10762   application.GetScene().Add(actor);
10763
10764   // Start Hide animation
10765   float     durationSeconds(10.0f);
10766   Animation animation = Animation::New(durationSeconds);
10767   animation.Hide(actor, durationSeconds /*Hide at end*/);
10768   animation.Play();
10769
10770   bool                 signalReceived(false);
10771   AnimationFinishCheck finishCheck(signalReceived);
10772   animation.FinishedSignal().Connect(&application, finishCheck);
10773
10774   application.SendNotification();
10775   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
10776
10777   // We did expect the animation to finish
10778   application.SendNotification();
10779   finishCheck.CheckSignalReceived();
10780   DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10781
10782   // Start Show animation
10783   animation = Animation::New(durationSeconds);
10784   animation.Show(actor, durationSeconds /*Show at end*/);
10785   animation.FinishedSignal().Connect(&application, finishCheck);
10786   animation.Play();
10787
10788   application.SendNotification();
10789   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
10790
10791   // We did expect the animation to finish
10792   application.SendNotification();
10793   finishCheck.CheckSignalReceived();
10794   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10795   END_TEST;
10796 }
10797
10798 int UtcDaliKeyFramesCreateDestroyP(void)
10799 {
10800   tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
10801
10802   KeyFrames* keyFrames = new KeyFrames;
10803   delete keyFrames;
10804   DALI_TEST_CHECK(true);
10805   END_TEST;
10806 }
10807
10808 int UtcDaliKeyFramesDownCastP(void)
10809 {
10810   TestApplication application;
10811   tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
10812
10813   KeyFrames  keyFrames = KeyFrames::New();
10814   BaseHandle object(keyFrames);
10815
10816   KeyFrames keyFrames2 = KeyFrames::DownCast(object);
10817   DALI_TEST_CHECK(keyFrames2);
10818
10819   KeyFrames keyFrames3 = DownCast<KeyFrames>(object);
10820   DALI_TEST_CHECK(keyFrames3);
10821
10822   BaseHandle unInitializedObject;
10823   KeyFrames  keyFrames4 = KeyFrames::DownCast(unInitializedObject);
10824   DALI_TEST_CHECK(!keyFrames4);
10825
10826   KeyFrames keyFrames5 = DownCast<KeyFrames>(unInitializedObject);
10827   DALI_TEST_CHECK(!keyFrames5);
10828   END_TEST;
10829 }
10830
10831 int UtcDaliAnimationCreateDestroyP(void)
10832 {
10833   TestApplication application;
10834   Animation*      animation = new Animation;
10835   DALI_TEST_CHECK(animation);
10836   delete animation;
10837   END_TEST;
10838 }
10839
10840 struct UpdateManagerTestConstraint
10841 {
10842   UpdateManagerTestConstraint(TestApplication& application)
10843   : mApplication(application)
10844   {
10845   }
10846
10847   void operator()(Vector3& current, const PropertyInputContainer& /* inputs */)
10848   {
10849     mApplication.SendNotification(); // Process events
10850   }
10851
10852   TestApplication& mApplication;
10853 };
10854
10855 int UtcDaliAnimationUpdateManagerP(void)
10856 {
10857   TestApplication application;
10858
10859   Actor actor = Actor::New();
10860   application.GetScene().Add(actor);
10861
10862   // Build the animation
10863   Animation animation = Animation::New(0.0f);
10864
10865   bool                 signalReceived = false;
10866   AnimationFinishCheck finishCheck(signalReceived);
10867   animation.FinishedSignal().Connect(&application, finishCheck);
10868
10869   Vector3         startValue(1.0f, 1.0f, 1.0f);
10870   Property::Index index      = actor.RegisterProperty("testProperty", startValue);
10871   Constraint      constraint = Constraint::New<Vector3>(actor, index, UpdateManagerTestConstraint(application));
10872   constraint.Apply();
10873
10874   // Apply animation to actor
10875   animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(100.f, 90.f, 80.f), AlphaFunction::LINEAR);
10876   animation.AnimateTo(Property(actor, Actor::Property::OPACITY), 0.3f, AlphaFunction::LINEAR);
10877
10878   animation.Play();
10879
10880   application.SendNotification();
10881   application.UpdateOnly(16);
10882
10883   finishCheck.CheckSignalNotReceived();
10884
10885   application.SendNotification(); // Process events
10886
10887   finishCheck.CheckSignalReceived();
10888
10889   END_TEST;
10890 }
10891
10892 int UtcDaliAnimationSignalOrderP(void)
10893 {
10894   TestApplication application;
10895
10896   Actor actor = Actor::New();
10897   application.GetScene().Add(actor);
10898
10899   // Build the animations
10900   Animation animation1 = Animation::New(0.0f);  // finishes first frame
10901   Animation animation2 = Animation::New(0.02f); // finishes in 20 ms
10902
10903   bool signal1Received = false;
10904   animation1.FinishedSignal().Connect(&application, AnimationFinishCheck(signal1Received));
10905
10906   bool signal2Received = false;
10907   animation2.FinishedSignal().Connect(&application, AnimationFinishCheck(signal2Received));
10908
10909   // Apply animations to actor
10910   animation1.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(3.0f, 2.0f, 1.0f), AlphaFunction::LINEAR);
10911   animation1.Play();
10912   animation2.AnimateTo(Property(actor, Actor::Property::SIZE), Vector3(10.0f, 20.0f, 30.0f), AlphaFunction::LINEAR);
10913   animation2.Play();
10914
10915   DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION);
10916   DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION);
10917
10918   application.SendNotification();
10919   application.UpdateOnly(10); // 10ms progress
10920
10921   // no notifications yet
10922   DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION);
10923   DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION);
10924
10925   application.SendNotification();
10926
10927   // first completed
10928   DALI_TEST_EQUALS(signal1Received, true, TEST_LOCATION);
10929   DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION);
10930   signal1Received = false;
10931
10932   // 1st animation is complete now, do another update with no ProcessEvents in between
10933   application.UpdateOnly(20); // 20ms progress
10934
10935   // ProcessEvents
10936   application.SendNotification();
10937
10938   // 2nd should complete now
10939   DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION);
10940   DALI_TEST_EQUALS(signal2Received, true, TEST_LOCATION);
10941
10942   END_TEST;
10943 }
10944
10945 int UtcDaliAnimationExtendDurationP(void)
10946 {
10947   TestApplication application;
10948
10949   Actor actor = Actor::New();
10950
10951   // Register a float property
10952   float           startValue(10.0f);
10953   Property::Index index = actor.RegisterProperty("testProperty", startValue);
10954   application.GetScene().Add(actor);
10955   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
10956   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
10957
10958   // Build the animation
10959   float     initialDurationSeconds(1.0f);
10960   float     animatorDelay = 5.0f;
10961   float     animatorDurationSeconds(5.0f);
10962   float     extendedDurationSeconds(animatorDelay + animatorDurationSeconds);
10963   Animation animation = Animation::New(initialDurationSeconds);
10964   float     targetValue(30.0f);
10965   float     relativeValue(targetValue - startValue);
10966
10967   animation.AnimateTo(Property(actor, index),
10968                       targetValue,
10969                       TimePeriod(animatorDelay, animatorDurationSeconds));
10970
10971   // The duration should have been extended
10972   DALI_TEST_EQUALS(animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION);
10973
10974   // Start the animation
10975   animation.Play();
10976
10977   bool                 signalReceived(false);
10978   AnimationFinishCheck finishCheck(signalReceived);
10979   animation.FinishedSignal().Connect(&application, finishCheck);
10980
10981   application.SendNotification();
10982   application.Render(static_cast<unsigned int>(extendedDurationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
10983
10984   // We didn't expect the animation to finish yet, but cached value should be the final one
10985   application.SendNotification();
10986   finishCheck.CheckSignalNotReceived();
10987   DALI_TEST_EQUALS(actor.GetProperty<float>(index), targetValue, TEST_LOCATION);
10988   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
10989
10990   application.SendNotification();
10991   application.Render(static_cast<unsigned int>(extendedDurationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
10992
10993   // We didn't expect the animation to finish yet
10994   application.SendNotification();
10995   finishCheck.CheckSignalNotReceived();
10996   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
10997
10998   application.SendNotification();
10999   application.Render(static_cast<unsigned int>(extendedDurationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
11000
11001   // We did expect the animation to finish
11002   application.SendNotification();
11003   finishCheck.CheckSignalReceived();
11004   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
11005   DALI_TEST_EQUALS(actor.GetProperty<float>(index), targetValue, TEST_LOCATION);
11006   END_TEST;
11007 }
11008
11009 int UtcDaliAnimationCustomIntProperty(void)
11010 {
11011   TestApplication application;
11012
11013   Actor actor = Actor::New();
11014   application.GetScene().Add(actor);
11015   int startValue(0u);
11016
11017   Property::Index index = actor.RegisterProperty("anIndex", startValue);
11018   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
11019   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11020
11021   // Build the animation
11022   float     durationSeconds(1.0f);
11023   Animation animation = Animation::New(durationSeconds);
11024   animation.AnimateTo(Property(actor, index), 20);
11025
11026   // Start the animation
11027   animation.Play();
11028
11029   // Target value should be retrievable straight away
11030   DALI_TEST_EQUALS(actor.GetProperty<int>(index), 20, TEST_LOCATION);
11031
11032   bool                 signalReceived(false);
11033   AnimationFinishCheck finishCheck(signalReceived);
11034   animation.FinishedSignal().Connect(&application, finishCheck);
11035
11036   application.SendNotification();
11037   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
11038
11039   // We didn't expect the animation to finish yet
11040   application.SendNotification();
11041   finishCheck.CheckSignalNotReceived();
11042   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), 10, TEST_LOCATION);
11043
11044   application.SendNotification();
11045   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
11046
11047   // We did expect the animation to finish
11048   application.SendNotification();
11049   finishCheck.CheckSignalReceived();
11050   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), 20, TEST_LOCATION);
11051   DALI_TEST_EQUALS(actor.GetProperty<int>(index), 20, TEST_LOCATION);
11052   END_TEST;
11053 }
11054
11055 int UtcDaliAnimationDuration(void)
11056 {
11057   TestApplication application;
11058
11059   Actor actor = Actor::New();
11060   application.GetScene().Add(actor);
11061
11062   Animation animation = Animation::New(0.0f);
11063   DALI_TEST_EQUALS(0.0f, animation.GetDuration(), TEST_LOCATION);
11064
11065   // The animation duration should automatically increase depending on the animator time period
11066
11067   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(0.0f, 1.0f));
11068   DALI_TEST_EQUALS(1.0f, animation.GetDuration(), TEST_LOCATION);
11069
11070   animation.AnimateTo(Property(actor, Actor::Property::POSITION_Y), 200.0f, TimePeriod(10.0f, 1.0f));
11071   DALI_TEST_EQUALS(11.0f, animation.GetDuration(), TEST_LOCATION);
11072
11073   END_TEST;
11074 }
11075
11076 int UtcDaliAnimationAnimateByNonAnimateableTypeN(void)
11077 {
11078   TestApplication application;
11079
11080   Actor actor = Actor::New();
11081
11082   // Register an integer property
11083   int             startValue(1);
11084   Property::Index index = actor.RegisterProperty("testProperty", startValue);
11085   application.GetScene().Add(actor);
11086   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11087
11088   DALI_TEST_ASSERTION(
11089     {
11090       // Build the animation
11091       Animation   animation     = Animation::New(2.0f);
11092       std::string relativeValue = "relative string";
11093       animation.AnimateBy(Property(actor, index), relativeValue);
11094       tet_result(TET_FAIL);
11095     },
11096     "Target value is not animatable");
11097
11098   END_TEST;
11099 }
11100
11101 int UtcDaliAnimationAnimateToNonAnimateableTypeN(void)
11102 {
11103   TestApplication application;
11104
11105   Actor actor = Actor::New();
11106
11107   // Register an integer property
11108   int             startValue(1);
11109   Property::Index index = actor.RegisterProperty("testProperty", startValue);
11110   application.GetScene().Add(actor);
11111   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11112
11113   DALI_TEST_ASSERTION(
11114     {
11115       // Build the animation
11116       Animation   animation     = Animation::New(2.0f);
11117       std::string relativeValue = "relative string";
11118       animation.AnimateTo(Property(actor, index), relativeValue);
11119     },
11120     "Target value is not animatable");
11121
11122   END_TEST;
11123 }
11124
11125 int UtcDaliAnimationAnimateBetweenNonAnimateableTypeN(void)
11126 {
11127   TestApplication application;
11128
11129   Actor actor = Actor::New();
11130
11131   // Register an integer property
11132   int             startValue(1);
11133   Property::Index index = actor.RegisterProperty("testProperty", startValue);
11134   application.GetScene().Add(actor);
11135   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11136
11137   DALI_TEST_ASSERTION(
11138     {
11139       // Build the animation
11140       KeyFrames keyFrames = KeyFrames::New();
11141       keyFrames.Add(0.0f, std::string("relative string1"));
11142       keyFrames.Add(1.0f, std::string("relative string2"));
11143       // no need to really create the animation as keyframes do the check
11144     },
11145     "Property type is not animatable");
11146
11147   END_TEST;
11148 }
11149
11150 int UtcDaliAnimationSetAndGetTargetBeforePlayP(void)
11151 {
11152   tet_infoline("Setting up an animation should not effect it's position property until the animation plays");
11153
11154   TestApplication application;
11155
11156   tet_infoline("Set initial position and set up animation to re-position actor");
11157
11158   Actor actor = Actor::New();
11159   application.GetScene().Add(actor);
11160   Vector3 initialPosition(0.0f, 0.0f, 0.0f);
11161   actor.SetProperty(Actor::Property::POSITION, initialPosition);
11162
11163   // Build the animation
11164   Animation animation = Animation::New(2.0f);
11165
11166   //Test GetCurrentProgress return 0.0 as the duration is 0.0
11167   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
11168   DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 0.0f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
11169
11170   tet_infoline("Set target position in animation without intiating play");
11171
11172   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11173   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
11174
11175   application.SendNotification();
11176   application.Render();
11177
11178   tet_infoline("Ensure position of actor is still at intial value");
11179
11180   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION);
11181   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION);
11182   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION);
11183
11184   tet_infoline("Play animation and ensure actor position is now target");
11185
11186   animation.Play();
11187   application.SendNotification();
11188   application.Render(1000u);
11189
11190   tet_infoline("Ensure position of actor is at target value when aninmation half way");
11191
11192   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
11193   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
11194   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
11195
11196   tet_printf("x position at half way point(%f)\n", actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x);
11197
11198   application.Render(2000u);
11199
11200   tet_infoline("Ensure position of actor is still at target value when aninmation complete");
11201
11202   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
11203   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
11204   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
11205
11206   END_TEST;
11207 }
11208
11209 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsPositionP(void)
11210 {
11211   tet_infoline("Setting up an animation should not effect it's position property until the animation plays even with mulitple animators");
11212
11213   TestApplication application;
11214
11215   std::vector<Vector3> targetPositions;
11216
11217   targetPositions.push_back(Vector3(100.0f, 100.0f, 100.0f));
11218   targetPositions.push_back(Vector3(200.0f, 1.0f, 100.0f));
11219   targetPositions.push_back(Vector3(50.0f, 10.0f, 100.0f));
11220
11221   tet_infoline("Set initial position and set up animation to re-position actor");
11222
11223   Actor actor = Actor::New();
11224   application.GetScene().Add(actor);
11225   Vector3 initialPosition(0.0f, 0.0f, 0.0f);
11226   actor.SetProperty(Actor::Property::POSITION, initialPosition);
11227
11228   // Build the animation
11229   Animation animation = Animation::New(2.0f);
11230
11231   //Test GetCurrentProgress return 0.0 as the duration is 0.0
11232   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
11233   DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 0.0f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
11234
11235   tet_infoline("Set target position in animation without intiating play");
11236
11237   for(unsigned int i = 0; i < targetPositions.size(); i++)
11238   {
11239     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[i], AlphaFunction::LINEAR);
11240   }
11241
11242   application.SendNotification();
11243   application.Render();
11244
11245   tet_infoline("Ensure position of actor is still at intial value");
11246
11247   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION);
11248   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION);
11249   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION);
11250
11251   tet_infoline("Play animation and ensure actor position is now target");
11252
11253   animation.Play();
11254   application.SendNotification();
11255   application.Render(1000u);
11256
11257   tet_infoline("Ensure position of actor is at target value when aninmation half way");
11258
11259   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION);
11260   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION);
11261   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION);
11262
11263   tet_printf("x position at half way point(%f)\n", actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x);
11264
11265   application.Render(2000u);
11266
11267   tet_infoline("Ensure position of actor is still at target value when aninmation complete");
11268
11269   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION);
11270   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION);
11271   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION);
11272
11273   END_TEST;
11274 }
11275
11276 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionP(void)
11277 {
11278   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");
11279
11280   TestApplication application;
11281
11282   std::vector<Vector3> targetSizes;
11283   std::vector<Vector3> targetPositions;
11284
11285   targetSizes.push_back(Vector3(100.0f, 100.0f, 100.0f));
11286   targetSizes.push_back(Vector3(50.0f, 10.0f, 100.0f));
11287
11288   targetPositions.push_back(Vector3(200.0f, 1.0f, 100.0f));
11289
11290   tet_infoline("Set initial position and set up animation to re-position actor");
11291
11292   Actor actor = Actor::New();
11293   application.GetScene().Add(actor);
11294   Vector3 initialSize(10.0f, 10.0f, 10.0f);
11295   Vector3 initialPosition(10.0f, 10.0f, 10.0f);
11296
11297   actor.SetProperty(Actor::Property::SIZE, initialSize);
11298   actor.SetProperty(Actor::Property::POSITION, initialPosition);
11299
11300   // Build the animation
11301   Animation animation = Animation::New(2.0f);
11302
11303   tet_infoline("Set target size in animation without intiating play");
11304   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
11305   tet_infoline("Set target position in animation without intiating play");
11306   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[0], AlphaFunction::LINEAR);
11307   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
11308
11309   application.SendNotification();
11310   application.Render();
11311
11312   tet_infoline("Ensure position of actor is still at intial size and position");
11313
11314   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION);
11315   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION);
11316   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION);
11317
11318   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialPosition.x, TEST_LOCATION);
11319   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialPosition.y, TEST_LOCATION);
11320   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialPosition.z, TEST_LOCATION);
11321
11322   tet_infoline("Play animation and ensure actor position and size is now matches targets");
11323
11324   animation.Play();
11325   application.SendNotification();
11326   application.Render(2000u);
11327
11328   tet_infoline("Ensure position and size of actor is at target value when aninmation playing");
11329
11330   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION);
11331   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION);
11332   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION);
11333
11334   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[0].x, TEST_LOCATION);
11335   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[0].y, TEST_LOCATION);
11336   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[0].z, TEST_LOCATION);
11337
11338   END_TEST;
11339 }
11340
11341 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionColourP(void)
11342 {
11343   tet_infoline("Setting up an animation should not effect it's size property until the animation plays even if other Properties animated");
11344
11345   TestApplication application;
11346
11347   std::vector<Vector3> targetSizes;
11348   std::vector<float>   targetColors;
11349
11350   targetSizes.push_back(Vector3(100.0f, 100.0f, 100.0f));
11351   targetSizes.push_back(Vector3(50.0f, 10.0f, 150.0f));
11352
11353   targetColors.push_back(1.0f);
11354
11355   tet_infoline("Set initial position and set up animation to re-position actor");
11356
11357   Actor actor = Actor::New();
11358   application.GetScene().Add(actor);
11359   Vector3 initialSize(10.0f, 5.0f, 10.0f);
11360
11361   actor.SetProperty(Actor::Property::SIZE, initialSize);
11362
11363   // Build the animation
11364   Animation animation = Animation::New(2.0f);
11365
11366   tet_infoline("Set target size in animation without initiating play");
11367   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
11368   tet_infoline("Set target position in animation without intiating play");
11369   animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetColors[0], AlphaFunction::LINEAR);
11370   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
11371
11372   application.SendNotification();
11373   application.Render();
11374
11375   tet_infoline("Ensure position of actor is still at initial size and position");
11376
11377   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION);
11378   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION);
11379   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION);
11380
11381   tet_infoline("Play animation and ensure actor position and size is now matches targets");
11382
11383   animation.Play();
11384   application.SendNotification();
11385   application.Render(2000u);
11386
11387   tet_infoline("Ensure position and size of actor is at target value when animation playing");
11388
11389   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION);
11390   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION);
11391   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION);
11392
11393   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColors[0], TEST_LOCATION);
11394
11395   END_TEST;
11396 }
11397
11398 int UtcDaliAnimationTimePeriodOrder(void)
11399 {
11400   tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place");
11401
11402   TestApplication application;
11403
11404   Actor actor = Actor::New();
11405   application.GetScene().Add(actor);
11406
11407   application.SendNotification();
11408   application.Render();
11409
11410   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11411   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11412   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11413   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11414   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11415
11416   //////////////////////////////////////////////////////////////////////////////////
11417
11418   tet_infoline("With two AnimateTo calls");
11419
11420   Animation animation = Animation::New(0.0f);
11421   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(3.0f, 1.0f));
11422   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(1.0f, 1.0f));
11423   animation.Play();
11424
11425   tet_infoline("The target position should change instantly");
11426   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11427   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11428
11429   application.SendNotification();
11430   application.Render(5000); // After the animation is complete
11431
11432   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11433   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11434   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11435
11436   //////////////////////////////////////////////////////////////////////////////////
11437
11438   tet_infoline("Same animation again but in a different order - should yield the same result");
11439
11440   actor.SetProperty(Actor::Property::POSITION_X, 0.0f);
11441   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11442   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11443
11444   application.SendNotification();
11445   application.Render();
11446
11447   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11448   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11449   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11450
11451   animation = Animation::New(0.0f);
11452   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(1.0f, 1.0f));
11453   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(3.0f, 1.0f));
11454   animation.Play();
11455
11456   tet_infoline("The target position should change instantly");
11457   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11458   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11459
11460   application.SendNotification();
11461   application.Render(5000); // After the animation is complete
11462
11463   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11464   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11465   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11466
11467   END_TEST;
11468 }
11469
11470 int UtcDaliAnimationTimePeriodOrderSeveralAnimateToCalls(void)
11471 {
11472   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");
11473
11474   TestApplication application;
11475
11476   Actor actor = Actor::New();
11477   application.GetScene().Add(actor);
11478
11479   application.SendNotification();
11480   application.Render();
11481
11482   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11483   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11484   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11485   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11486   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11487
11488   //////////////////////////////////////////////////////////////////////////////////
11489
11490   tet_infoline("");
11491
11492   Animation animation = Animation::New(0.0f);
11493   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1000.0f, TimePeriod(4.0f, 2.0f));
11494   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 145.0f, TimePeriod(3.0f, 10.0f));
11495   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 109.0f, TimePeriod(1.0f, 1.0f));
11496   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1.0f, TimePeriod(3.0f, 4.0f));
11497   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 200.0f, TimePeriod(2.0f, 5.0f));
11498   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(10.0f, 2.0f));
11499   animation.Play();
11500
11501   tet_infoline("The target position should change instantly");
11502   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11503   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11504
11505   application.SendNotification();
11506   application.Render(14000); // After the animation is complete
11507
11508   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11509   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11510   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11511
11512   //////////////////////////////////////////////////////////////////////////////////
11513
11514   tet_infoline("Same animation again but in a different order - should end up at the same point");
11515
11516   actor.SetProperty(Actor::Property::POSITION_X, 0.0f);
11517
11518   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11519   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11520
11521   application.SendNotification();
11522   application.Render();
11523
11524   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11525   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11526   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11527
11528   animation = Animation::New(0.0f);
11529   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 200.0f, TimePeriod(2.0f, 5.0f));
11530   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(10.0f, 2.0f));
11531   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 145.0f, TimePeriod(3.0f, 10.0f));
11532   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1000.0f, TimePeriod(4.0f, 2.0f));
11533   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1.0f, TimePeriod(3.0f, 4.0f));
11534   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 109.0f, TimePeriod(1.0f, 1.0f));
11535   animation.Play();
11536
11537   tet_infoline("The target position should change instantly");
11538   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11539   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11540
11541   application.SendNotification();
11542   application.Render(14000); // After the animation is complete
11543
11544   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11545   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11546   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11547
11548   END_TEST;
11549 }
11550
11551 int UtcDaliAnimationAnimateBetweenIntegerP(void)
11552 {
11553   TestApplication application;
11554
11555   int                   startValue(1);
11556   Actor                 actor = Actor::New();
11557   const Property::Index index = actor.RegisterProperty("customProperty", startValue);
11558   application.GetScene().Add(actor);
11559
11560   application.Render();
11561   application.SendNotification();
11562
11563   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11564
11565   // Build the animation
11566   float     durationSeconds(1.0f);
11567   Animation animation = Animation::New(durationSeconds);
11568
11569   KeyFrames keyFrames = KeyFrames::New();
11570   keyFrames.Add(0.0f, 10);
11571   keyFrames.Add(0.2f, 20);
11572   keyFrames.Add(0.4f, 30);
11573   keyFrames.Add(0.6f, 40);
11574   keyFrames.Add(0.8f, 50);
11575   keyFrames.Add(1.0f, 60);
11576
11577   animation.AnimateBetween(Property(actor, index), keyFrames);
11578
11579   // Start the animation
11580   animation.Play();
11581
11582   // Target value should change to the last key-frame's value straight away
11583   DALI_TEST_EQUALS(actor.GetProperty<int>(index), 60, TEST_LOCATION);
11584
11585   END_TEST;
11586 }
11587
11588 int UtcDaliAnimationAnimateBetweenVector2P(void)
11589 {
11590   TestApplication application;
11591
11592   Vector2               startValue(10.0f, 20.0f);
11593   Actor                 actor = Actor::New();
11594   const Property::Index index = actor.RegisterProperty("customProperty", startValue);
11595   application.GetScene().Add(actor);
11596
11597   application.Render();
11598   application.SendNotification();
11599
11600   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
11601
11602   // Build the animation
11603   float     durationSeconds(1.0f);
11604   Animation animation = Animation::New(durationSeconds);
11605
11606   KeyFrames keyFrames = KeyFrames::New();
11607   keyFrames.Add(0.0f, Vector2(0.0f, 5.0f));
11608   keyFrames.Add(0.2f, Vector2(30.0f, 25.0f));
11609   keyFrames.Add(0.4f, Vector2(40.0f, 35.0f));
11610   keyFrames.Add(0.6f, Vector2(50.0f, 45.0f));
11611   keyFrames.Add(0.8f, Vector2(60.0f, 55.0f));
11612   keyFrames.Add(1.0f, Vector2(70.0f, 65.0f));
11613
11614   animation.AnimateBetween(Property(actor, index), keyFrames);
11615
11616   // Start the animation
11617   animation.Play();
11618
11619   // Target value should change to the last key-frame's value straight away
11620   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), Vector2(70.0f, 65.0f), TEST_LOCATION);
11621
11622   END_TEST;
11623 }
11624
11625 int UtcDaliAnimationProgressCallbackP(void)
11626 {
11627   TestApplication application;
11628
11629   Actor actor = Actor::New();
11630   application.GetScene().Add(actor);
11631
11632   // Build the animation
11633   Animation animation = Animation::New(0.0f);
11634
11635   //Set duration
11636   float durationSeconds(1.0f);
11637   animation.SetDuration(durationSeconds);
11638
11639   bool finishedSignalReceived(false);
11640   bool progressSignalReceived(false);
11641
11642   AnimationFinishCheck finishCheck(finishedSignalReceived);
11643   animation.FinishedSignal().Connect(&application, finishCheck);
11644
11645   AnimationProgressCheck progressCheck(progressSignalReceived);
11646   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
11647   application.SendNotification();
11648
11649   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11650   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
11651
11652   tet_infoline("Animation Progress notification set to 30%");
11653   DevelAnimation::SetProgressNotification(animation, 0.3f);
11654
11655   application.SendNotification();
11656   application.Render();
11657
11658   DALI_TEST_EQUALS(0.3f, DevelAnimation::GetProgressNotification(animation), TEST_LOCATION);
11659
11660   progressCheck.CheckSignalNotReceived();
11661
11662   // Start the animation from 10% progress
11663   animation.SetCurrentProgress(0.1f);
11664   animation.Play();
11665
11666   tet_infoline("Animation Playing from 10%");
11667
11668   application.SendNotification();
11669   application.Render(0);                        // start animation
11670   application.Render(durationSeconds * 100.0f); // 20% progress
11671
11672   tet_infoline("Animation at 20%");
11673
11674   progressCheck.CheckSignalNotReceived();
11675
11676   application.SendNotification();
11677   application.Render(durationSeconds * 200.0f); // 40% progress
11678   application.SendNotification();
11679   tet_infoline("Animation at 40%");
11680   DALI_TEST_EQUALS(0.4f, animation.GetCurrentProgress(), TEST_LOCATION);
11681
11682   progressCheck.CheckSignalReceived();
11683
11684   tet_infoline("Progress check reset");
11685   progressCheck.Reset();
11686
11687   application.Render(durationSeconds * 100.0f); // 50% progress
11688   tet_infoline("Animation at 50%");
11689   application.SendNotification();
11690
11691   DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
11692
11693   progressCheck.CheckSignalNotReceived();
11694
11695   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 60% progress */);
11696   application.SendNotification();
11697
11698   tet_infoline("Animation at 60%");
11699
11700   finishCheck.CheckSignalNotReceived();
11701
11702   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
11703   application.SendNotification();
11704   DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
11705   tet_infoline("Animation at 80%");
11706
11707   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
11708   // We did expect the animation to finish
11709   application.SendNotification();
11710   finishCheck.CheckSignalReceived();
11711   tet_infoline("Animation finished");
11712   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11713
11714   END_TEST;
11715 }
11716
11717 int UtcDaliAnimationPlayAfterP(void)
11718 {
11719   TestApplication application;
11720
11721   tet_printf("Testing that playing after 2 seconds\n");
11722
11723   {
11724     Actor actor = Actor::New();
11725     application.GetScene().Add(actor);
11726
11727     // Build the animation
11728     float     durationSeconds(1.0f);
11729     Animation animation = Animation::New(durationSeconds);
11730
11731     bool                 signalReceived(false);
11732     AnimationFinishCheck finishCheck(signalReceived);
11733     animation.FinishedSignal().Connect(&application, finishCheck);
11734     application.SendNotification();
11735
11736     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11737     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
11738
11739     // Play animation after the initial delay time
11740     animation.PlayAfter(0.2f);
11741     application.SendNotification();
11742     application.Render(0); // start animation
11743
11744     application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
11745     application.SendNotification();
11746     finishCheck.CheckSignalNotReceived();
11747     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move
11748
11749     application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
11750
11751     // We didn't expect the animation to finish yet
11752     application.SendNotification();
11753     finishCheck.CheckSignalNotReceived();
11754     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
11755
11756     application.SendNotification();
11757     application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
11758
11759     application.SendNotification();
11760     finishCheck.CheckSignalNotReceived();
11761     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
11762
11763     application.SendNotification();
11764     application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
11765
11766     // We did expect the animation to finish
11767     application.SendNotification();
11768     finishCheck.CheckSignalReceived();
11769     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11770
11771     // Check that nothing has changed after a couple of buffer swaps
11772     application.Render(0);
11773     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11774   }
11775
11776   tet_printf("Testing that playing after 2 seconds with negative speedfactor\n");
11777   // SpeedFactor < 0
11778   {
11779     Actor actor = Actor::New();
11780     application.GetScene().Add(actor);
11781
11782     // Build the animation
11783     float     durationSeconds(1.0f);
11784     Animation animation = Animation::New(durationSeconds);
11785     animation.SetSpeedFactor(-1.0f); // Set SpeedFactor as < 0
11786
11787     bool                 signalReceived(false);
11788     AnimationFinishCheck finishCheck(signalReceived);
11789     animation.FinishedSignal().Connect(&application, finishCheck);
11790     application.SendNotification();
11791
11792     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11793     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
11794
11795     // Play animation after the initial delay time
11796     animation.PlayAfter(0.2f);
11797     application.SendNotification();
11798     application.Render(0); // start animation
11799
11800     application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
11801     application.SendNotification();
11802     finishCheck.CheckSignalNotReceived();
11803     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 1.0f), TEST_LOCATION); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
11804
11805     application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% animation progress, 50% animator progress */);
11806
11807     // We didn't expect the animation to finish yet
11808     application.SendNotification();
11809     finishCheck.CheckSignalNotReceived();
11810     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
11811
11812     application.SendNotification();
11813     application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% animation progress, 100% animator progress */);
11814
11815     application.SendNotification();
11816     finishCheck.CheckSignalNotReceived();
11817     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION);
11818
11819     application.SendNotification();
11820     application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
11821
11822     // We did expect the animation to finish
11823     application.SendNotification();
11824     finishCheck.CheckSignalReceived();
11825     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of Timeperiod in seconds
11826
11827     // Check that nothing has changed after a couple of buffer swaps
11828     application.Render(0);
11829     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0, 0.0, 0.0), TEST_LOCATION);
11830   }
11831
11832   END_TEST;
11833 }
11834
11835 int UtcDaliAnimationPlayAfterP2(void)
11836 {
11837   TestApplication application;
11838
11839   tet_printf("Testing that playing after 2 seconds before looping\n");
11840
11841   {
11842     Actor actor = Actor::New();
11843     application.GetScene().Add(actor);
11844
11845     // Build the animation
11846     float     durationSeconds(1.0f);
11847     Animation animation = Animation::New(durationSeconds);
11848     animation.SetLooping(true);
11849
11850     bool                 signalReceived(false);
11851     AnimationFinishCheck finishCheck(signalReceived);
11852     animation.FinishedSignal().Connect(&application, finishCheck);
11853     application.SendNotification();
11854
11855     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11856     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
11857
11858     // Play animation after the initial delay time
11859     animation.PlayAfter(0.2f);
11860     application.SendNotification();
11861     application.Render(0); // start animation
11862
11863     for(int iterations = 0; iterations < 3; ++iterations)
11864     {
11865       // The initial delay time of PlayAfter() applies only once in looping mode.
11866       if(iterations == 0)
11867       {
11868         application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
11869         application.SendNotification();
11870         finishCheck.CheckSignalNotReceived();
11871         DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move
11872       }
11873
11874       application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
11875
11876       // We didn't expect the animation to finish yet
11877       application.SendNotification();
11878       finishCheck.CheckSignalNotReceived();
11879       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
11880
11881       application.SendNotification();
11882       application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
11883
11884       application.SendNotification();
11885       finishCheck.CheckSignalNotReceived();
11886       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
11887
11888       application.SendNotification();
11889       application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% progress */);
11890
11891       // We did expect the animation to finish
11892       application.SendNotification();
11893       finishCheck.CheckSignalNotReceived();
11894       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11895     }
11896
11897     animation.SetLooping(false);
11898     application.SendNotification();
11899     application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
11900
11901     application.SendNotification();
11902     finishCheck.CheckSignalReceived();
11903     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11904   }
11905
11906   tet_printf("Testing that playing after 2 seconds before looping with negative speedfactor\n");
11907   // SpeedFactor < 0
11908   {
11909     Actor actor = Actor::New();
11910     application.GetScene().Add(actor);
11911
11912     // Build the animation
11913     float     durationSeconds(1.0f);
11914     Animation animation = Animation::New(durationSeconds);
11915     animation.SetLooping(true);
11916     animation.SetSpeedFactor(-1.0f); //Set SpeedFactor as < 0
11917
11918     bool                 signalReceived(false);
11919     AnimationFinishCheck finishCheck(signalReceived);
11920     animation.FinishedSignal().Connect(&application, finishCheck);
11921     application.SendNotification();
11922
11923     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11924     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
11925
11926     // Play animation after the initial delay time
11927     animation.PlayAfter(0.2f);
11928     application.SendNotification();
11929     application.Render(0); // start animation
11930
11931     for(int iterations = 0; iterations < 3; ++iterations)
11932     {
11933       // The initial delay time of PlayAfter() applies only once in looping mode.
11934       if(iterations == 0)
11935       {
11936         application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
11937         application.SendNotification();
11938         finishCheck.CheckSignalNotReceived();
11939         DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 1.0f), TEST_LOCATION); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
11940       }
11941
11942       application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% animation progress, 50% animator progress */);
11943
11944       // We didn't expect the animation to finish yet
11945       application.SendNotification();
11946       finishCheck.CheckSignalNotReceived();
11947       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
11948
11949       application.SendNotification();
11950       application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% animation progress, 100% animator progress */);
11951
11952       application.SendNotification();
11953       finishCheck.CheckSignalNotReceived();
11954       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION);
11955
11956       application.SendNotification();
11957       application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 100% progress */);
11958
11959       // We did expect the animation to finish
11960       application.SendNotification();
11961       finishCheck.CheckSignalNotReceived();
11962       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in second
11963     }
11964
11965     animation.SetLooping(false);
11966     application.SendNotification();
11967     application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
11968
11969     application.SendNotification();
11970     finishCheck.CheckSignalReceived();
11971     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0, 0.0, 0.0), TEST_LOCATION);
11972   }
11973
11974   END_TEST;
11975 }
11976
11977 int UtcDaliAnimationPlayAfterP3(void)
11978 {
11979   TestApplication application;
11980
11981   tet_printf("Testing that PlayAfter with the negative delay seconds\n");
11982
11983   Actor actor = Actor::New();
11984   application.GetScene().Add(actor);
11985
11986   // Build the animation
11987   float     durationSeconds(1.0f);
11988   Animation animation = Animation::New(durationSeconds);
11989
11990   bool                 signalReceived(false);
11991   AnimationFinishCheck finishCheck(signalReceived);
11992   animation.FinishedSignal().Connect(&application, finishCheck);
11993   application.SendNotification();
11994
11995   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11996   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
11997
11998   // When the delay time is negative value, it would treat as play immediately.
11999   animation.PlayAfter(-2.0f);
12000   application.SendNotification();
12001   application.Render(0); // start animation
12002
12003   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
12004
12005   // We didn't expect the animation to finish yet
12006   application.SendNotification();
12007   finishCheck.CheckSignalNotReceived();
12008   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
12009
12010   application.SendNotification();
12011   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
12012
12013   application.SendNotification();
12014   finishCheck.CheckSignalNotReceived();
12015   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
12016
12017   application.SendNotification();
12018   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
12019
12020   // We did expect the animation to finish
12021   application.SendNotification();
12022   finishCheck.CheckSignalReceived();
12023   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12024
12025   // Check that nothing has changed after a couple of buffer swaps
12026   application.Render(0);
12027   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12028   END_TEST;
12029 }
12030
12031 int UtcDaliAnimationPlayAfterP4(void)
12032 {
12033   TestApplication application;
12034
12035   tet_printf("Testing that PlayAfter with progress value\n");
12036
12037   Actor actor = Actor::New();
12038   application.GetScene().Add(actor);
12039
12040   // Build the animation
12041   float     durationSeconds(1.0f);
12042   Animation animation = Animation::New(durationSeconds);
12043
12044   bool                 signalReceived(false);
12045   AnimationFinishCheck finishCheck(signalReceived);
12046   animation.FinishedSignal().Connect(&application, finishCheck);
12047   application.SendNotification();
12048
12049   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12050   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
12051
12052   // Delay time is 0.3s. So after duration times, progress must be 70%. animation will finished at 1.3s.
12053   animation.PlayAfter(durationSeconds * 0.3f);
12054   application.SendNotification();
12055   application.Render(0); // start animation
12056
12057   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 5/6 delay progress, 0% animation progress, 0% animator progress */);
12058
12059   // We didn't expect the animation to finish yet
12060   application.SendNotification();
12061   finishCheck.CheckSignalNotReceived();
12062   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of PlayAfter
12063
12064   application.SendNotification();
12065   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 20% animation progress, 0% animator progress */);
12066
12067   application.SendNotification();
12068   finishCheck.CheckSignalNotReceived();
12069   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
12070
12071   application.SendNotification();
12072   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 45% animation progress, 0% animator progress */);
12073
12074   application.SendNotification();
12075   finishCheck.CheckSignalNotReceived();
12076   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
12077
12078   application.SendNotification();
12079   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 70% animation progress, 40% animator progress */);
12080
12081   application.SendNotification();
12082   finishCheck.CheckSignalNotReceived();
12083   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION); // 40% of animator progress
12084
12085   application.SendNotification();
12086   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 95% animation progress, 90% animator progress */);
12087
12088   application.SendNotification();
12089   finishCheck.CheckSignalNotReceived();
12090   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.9f), TEST_LOCATION); // 90% of animator progress
12091
12092   application.SendNotification();
12093   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
12094
12095   // We did expect the animation to finish
12096   application.SendNotification();
12097   finishCheck.CheckSignalReceived();
12098   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12099
12100   // Check that nothing has changed after a couple of buffer swaps
12101   application.Render(0);
12102   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12103   END_TEST;
12104 }
12105
12106 int UtcDaliAnimationSetLoopingModeP(void)
12107 {
12108   // Test Loop forever and Loop mode being set
12109   TestApplication    application;
12110   Integration::Scene stage(application.GetScene());
12111
12112   // Default: LoopingMode::RESTART
12113   {
12114     Actor actor = Actor::New();
12115     stage.Add(actor);
12116
12117     float     durationSeconds(1.0f);
12118     Animation animation = Animation::New(durationSeconds);
12119     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::RESTART);
12120
12121     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
12122     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12123
12124     // Start the animation
12125     animation.Play();
12126     application.SendNotification();
12127     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
12128
12129     actor.Unparent();
12130
12131     application.SendNotification();
12132     application.Render();
12133     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12134   }
12135
12136   // LoopingMode::AUTO_REVERSE
12137   {
12138     Actor actor = Actor::New();
12139     stage.Add(actor);
12140
12141     float     durationSeconds(1.0f);
12142     Animation animation = Animation::New(durationSeconds);
12143     animation.SetLooping(true);
12144
12145     bool                 signalReceived(false);
12146     AnimationFinishCheck finishCheck(signalReceived);
12147     animation.FinishedSignal().Connect(&application, finishCheck);
12148     application.SendNotification();
12149
12150     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12151     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12152
12153     animation.SetLoopingMode(Animation::LoopingMode::AUTO_REVERSE);
12154     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12155
12156     // Start the animation
12157     animation.Play();
12158     application.SendNotification();
12159     application.Render(0);
12160
12161     for(int iterations = 0; iterations < 3; ++iterations)
12162     {
12163       application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% time progress */);
12164       application.SendNotification();
12165       finishCheck.CheckSignalNotReceived();
12166
12167       // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12168       // and arrives at the beginning.
12169       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12170
12171       application.SendNotification();
12172       application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 100% time progress */);
12173
12174       // We did expect the animation to finish
12175       application.SendNotification();
12176       finishCheck.CheckSignalNotReceived();
12177       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12178     }
12179
12180     animation.SetLooping(false);
12181     application.SendNotification();
12182     application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
12183
12184     application.SendNotification();
12185     finishCheck.CheckSignalReceived();
12186
12187     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12188   }
12189
12190   // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12191   {
12192     Actor actor = Actor::New();
12193     stage.Add(actor);
12194
12195     float     durationSeconds(1.0f);
12196     Animation animation = Animation::New(durationSeconds);
12197     animation.SetLooping(true);
12198
12199     bool                 signalReceived(false);
12200     AnimationFinishCheck finishCheck(signalReceived);
12201     animation.FinishedSignal().Connect(&application, finishCheck);
12202     application.SendNotification();
12203
12204     // Specify a negative multiplier to play the animation in reverse
12205     animation.SetSpeedFactor(-1.0f);
12206
12207     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12208     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12209
12210     animation.SetLoopingMode(Animation::AUTO_REVERSE);
12211     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12212
12213     // Start the animation
12214     animation.Play();
12215     application.SendNotification();
12216     application.Render(0);
12217
12218     for(int iterations = 0; iterations < 3; ++iterations)
12219     {
12220       application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% time progress */);
12221       application.SendNotification();
12222       finishCheck.CheckSignalNotReceived();
12223
12224       // Setting a negative speed factor is to play the animation in reverse.
12225       // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12226       // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12227       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12228
12229       application.SendNotification();
12230       application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 100% time progress */);
12231
12232       // We did expect the animation to finish
12233       application.SendNotification();
12234       finishCheck.CheckSignalNotReceived();
12235       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12236     }
12237
12238     animation.SetLooping(false);
12239     application.SendNotification();
12240     application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
12241
12242     application.SendNotification();
12243     finishCheck.CheckSignalReceived();
12244
12245     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12246   }
12247
12248   END_TEST;
12249 }
12250
12251 int UtcDaliAnimationSetLoopingModeP2(void)
12252 {
12253   // Test Loop Count and Loop mode being set
12254   TestApplication    application;
12255   Integration::Scene stage(application.GetScene());
12256
12257   // LoopingMode::AUTO_REVERSE
12258   {
12259     Actor actor = Actor::New();
12260     stage.Add(actor);
12261
12262     float     durationSeconds(1.0f);
12263     Animation animation = Animation::New(durationSeconds);
12264     animation.SetLoopCount(3);
12265     DALI_TEST_CHECK(animation.IsLooping());
12266
12267     bool                 signalReceived(false);
12268     AnimationFinishCheck finishCheck(signalReceived);
12269     animation.FinishedSignal().Connect(&application, finishCheck);
12270     application.SendNotification();
12271
12272     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12273     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12274
12275     animation.SetLoopingMode(Animation::AUTO_REVERSE);
12276     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12277
12278     // Start the animation
12279     animation.Play();
12280
12281     application.Render(0);
12282     application.SendNotification();
12283     application.Render(0);
12284     application.SendNotification();
12285     application.Render(0);
12286     application.SendNotification();
12287     application.Render(0);
12288     application.SendNotification();
12289
12290     // Loop
12291     float intervalSeconds = 3.0f;
12292
12293     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12294     // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12295     // and arrives at the beginning.
12296     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12297
12298     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12299
12300     application.Render(0);
12301     application.SendNotification();
12302     application.Render(0);
12303     application.SendNotification();
12304     application.Render(0);
12305     application.SendNotification();
12306     application.Render(0);
12307     application.SendNotification();
12308     finishCheck.CheckSignalNotReceived();
12309
12310     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12311
12312     application.SendNotification();
12313     finishCheck.CheckSignalReceived();
12314     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12315
12316     finishCheck.Reset();
12317   }
12318
12319   // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12320   {
12321     Actor actor = Actor::New();
12322     stage.Add(actor);
12323
12324     float     durationSeconds(1.0f);
12325     Animation animation = Animation::New(durationSeconds);
12326     animation.SetLoopCount(3);
12327     DALI_TEST_CHECK(animation.IsLooping());
12328
12329     bool                 signalReceived(false);
12330     AnimationFinishCheck finishCheck(signalReceived);
12331     animation.FinishedSignal().Connect(&application, finishCheck);
12332     application.SendNotification();
12333
12334     // Specify a negative multiplier to play the animation in reverse
12335     animation.SetSpeedFactor(-1.0f);
12336
12337     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12338     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12339
12340     animation.SetLoopingMode(Animation::AUTO_REVERSE);
12341     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12342
12343     // Start the animation
12344     animation.Play();
12345
12346     application.Render(0);
12347     application.SendNotification();
12348     application.Render(0);
12349     application.SendNotification();
12350     application.Render(0);
12351     application.SendNotification();
12352     application.Render(0);
12353     application.SendNotification();
12354
12355     // Loop
12356     float intervalSeconds = 3.0f;
12357
12358     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12359     // Setting a negative speed factor is to play the animation in reverse.
12360     // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12361     // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12362     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12363
12364     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12365
12366     application.Render(0);
12367     application.SendNotification();
12368     application.Render(0);
12369     application.SendNotification();
12370     application.Render(0);
12371     application.SendNotification();
12372     application.Render(0);
12373     application.SendNotification();
12374     finishCheck.CheckSignalNotReceived();
12375
12376     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12377
12378     application.SendNotification();
12379     finishCheck.CheckSignalReceived();
12380     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12381
12382     finishCheck.Reset();
12383   }
12384
12385   END_TEST;
12386 }
12387
12388 int UtcDaliAnimationSetLoopingModeP3(void)
12389 {
12390   // Test Loop Count is 1 (== default) and Loop mode being set
12391   TestApplication    application;
12392   Integration::Scene stage(application.GetScene());
12393
12394   // LoopingMode::AUTO_REVERSE
12395   {
12396     Actor actor = Actor::New();
12397     stage.Add(actor);
12398
12399     float     durationSeconds(1.0f);
12400     Animation animation = Animation::New(durationSeconds);
12401     DALI_TEST_CHECK(1 == animation.GetLoopCount());
12402
12403     bool                 signalReceived(false);
12404     AnimationFinishCheck finishCheck(signalReceived);
12405     animation.FinishedSignal().Connect(&application, finishCheck);
12406     application.SendNotification();
12407
12408     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12409     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12410
12411     animation.SetLoopingMode(Animation::AUTO_REVERSE);
12412     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12413
12414     // Start the animation
12415     animation.Play();
12416     application.Render(0);
12417     application.SendNotification();
12418
12419     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 50% time progress */);
12420     application.SendNotification();
12421     finishCheck.CheckSignalNotReceived();
12422
12423     // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12424     // and arrives at the beginning.
12425     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12426
12427     application.SendNotification();
12428     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 100% time progress */);
12429
12430     application.SendNotification();
12431     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12432
12433     application.SendNotification();
12434     application.Render(static_cast<unsigned int>(durationSeconds * 1.0f * 1000.0f) + 1u /*just beyond the animation duration*/);
12435
12436     application.SendNotification();
12437     application.Render(0);
12438     application.SendNotification();
12439     finishCheck.CheckSignalReceived();
12440
12441     // After all animation finished, arrives at the beginning.
12442     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12443
12444     finishCheck.Reset();
12445   }
12446
12447   // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12448   {
12449     Actor actor = Actor::New();
12450     stage.Add(actor);
12451
12452     float     durationSeconds(1.0f);
12453     Animation animation = Animation::New(durationSeconds);
12454     DALI_TEST_CHECK(1 == animation.GetLoopCount());
12455
12456     bool                 signalReceived(false);
12457     AnimationFinishCheck finishCheck(signalReceived);
12458     animation.FinishedSignal().Connect(&application, finishCheck);
12459     application.SendNotification();
12460
12461     // Specify a negative multiplier to play the animation in reverse
12462     animation.SetSpeedFactor(-1.0f);
12463
12464     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12465     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12466
12467     animation.SetLoopingMode(Animation::AUTO_REVERSE);
12468     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12469
12470     // Start the animation
12471     animation.Play();
12472     application.Render(0);
12473     application.SendNotification();
12474
12475     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 50% time progress */);
12476     application.SendNotification();
12477     finishCheck.CheckSignalNotReceived();
12478
12479     // Setting a negative speed factor is to play the animation in reverse.
12480     // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12481     // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12482     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12483
12484     application.SendNotification();
12485     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 100% time progress */);
12486
12487     application.SendNotification();
12488     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12489
12490     application.SendNotification();
12491     application.Render(static_cast<unsigned int>(durationSeconds * 1.0f * 1000.0f) + 1u /*just beyond the animation duration*/);
12492
12493     application.SendNotification();
12494     application.Render(0);
12495     application.SendNotification();
12496     finishCheck.CheckSignalReceived();
12497
12498     // After all animation finished, arrives at the target.
12499     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12500
12501     finishCheck.Reset();
12502   }
12503
12504   END_TEST;
12505 }
12506
12507 int UtcDaliAnimationGetLoopingModeP(void)
12508 {
12509   TestApplication application;
12510
12511   Animation animation = Animation::New(1.0f);
12512
12513   // default mode
12514   DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::RESTART);
12515
12516   animation.SetLoopingMode(Animation::AUTO_REVERSE);
12517   DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12518
12519   END_TEST;
12520 }
12521
12522 int UtcDaliAnimationProgressSignalConnectionWithoutProgressMarkerP(void)
12523 {
12524   TestApplication application;
12525
12526   tet_infoline("Connect to ProgressReachedSignal but do not set a required Progress marker");
12527
12528   Actor actor = Actor::New();
12529   application.GetScene().Add(actor);
12530
12531   // Build the animation
12532   Animation animation = Animation::New(0.0f);
12533
12534   //Set duration
12535   float durationSeconds(1.0f);
12536   animation.SetDuration(durationSeconds);
12537
12538   bool finishedSignalReceived(false);
12539   bool progressSignalReceived(false);
12540
12541   AnimationFinishCheck finishCheck(finishedSignalReceived);
12542   animation.FinishedSignal().Connect(&application, finishCheck);
12543
12544   AnimationProgressCheck progressCheck(progressSignalReceived);
12545   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
12546   application.SendNotification();
12547
12548   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12549   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12550
12551   progressCheck.CheckSignalNotReceived();
12552
12553   animation.Play();
12554
12555   application.SendNotification();
12556   application.Render(0);                        // start animation
12557   application.Render(durationSeconds * 100.0f); // 10% progress
12558   application.SendNotification();
12559
12560   tet_infoline("Ensure after animation has started playing that ProgressReachedSignal not emitted");
12561   progressCheck.CheckSignalNotReceived();
12562
12563   application.Render(static_cast<unsigned int>(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/);
12564
12565   application.SendNotification();
12566   finishCheck.CheckSignalReceived();
12567   tet_infoline("Animation finished");
12568   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12569
12570   END_TEST;
12571 }
12572
12573 int UtcDaliAnimationMultipleProgressSignalsP(void)
12574 {
12575   tet_infoline("Multiple animations with different progress markers");
12576
12577   TestApplication application;
12578
12579   Actor actor = Actor::New();
12580   application.GetScene().Add(actor);
12581
12582   // Build the animation
12583   Animation animationAlpha = Animation::New(0.0f);
12584   Animation animationBeta  = Animation::New(0.0f);
12585
12586   //Set duration
12587   float durationSeconds(1.0f);
12588   animationAlpha.SetDuration(durationSeconds);
12589   animationBeta.SetDuration(durationSeconds);
12590
12591   bool progressSignalReceivedAlpha(false);
12592   bool progressSignalReceivedBeta(false);
12593
12594   AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12595   AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta");
12596
12597   DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha);
12598   DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta);
12599   application.SendNotification();
12600
12601   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12602   animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12603   animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12604
12605   tet_infoline("AnimationAlpha Progress notification set to 30%");
12606   DevelAnimation::SetProgressNotification(animationAlpha, 0.3f);
12607
12608   tet_infoline("AnimationBeta Progress notification set to 50%");
12609   DevelAnimation::SetProgressNotification(animationBeta, 0.5f);
12610
12611   application.SendNotification();
12612   application.Render();
12613
12614   progressCheckAlpha.CheckSignalNotReceived();
12615   progressCheckBeta.CheckSignalNotReceived();
12616
12617   // Start the animations from 10% progress
12618   animationAlpha.SetCurrentProgress(0.1f);
12619   animationBeta.SetCurrentProgress(0.1f);
12620   animationAlpha.Play();
12621   animationBeta.Play();
12622
12623   tet_infoline("Animation Playing from 10%");
12624
12625   application.SendNotification();
12626   application.Render(0);                        // start animation
12627   application.Render(durationSeconds * 100.0f); // 20% progress
12628
12629   tet_infoline("Animation at 20% - No signals to be received");
12630
12631   progressCheckAlpha.CheckSignalNotReceived();
12632   progressCheckBeta.CheckSignalNotReceived();
12633
12634   application.SendNotification();
12635   application.Render(durationSeconds * 200.0f); // 40% progress
12636   application.SendNotification();
12637   tet_infoline("Animation at 40% - Alpha signal should be received");
12638   DALI_TEST_EQUALS(0.4f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
12639
12640   progressCheckAlpha.CheckSignalReceived();
12641   progressCheckBeta.CheckSignalNotReceived();
12642
12643   tet_infoline("Progress check reset");
12644   progressCheckAlpha.Reset();
12645   progressCheckBeta.Reset();
12646
12647   application.Render(durationSeconds * 100.0f); // 50% progress
12648   tet_infoline("Animation at 50% - Beta should receive signal, Alpha should not");
12649   application.SendNotification();
12650
12651   DALI_TEST_EQUALS(0.5f, animationBeta.GetCurrentProgress(), TEST_LOCATION);
12652
12653   progressCheckAlpha.CheckSignalNotReceived();
12654   progressCheckBeta.CheckSignalReceived();
12655   tet_infoline("Progress check reset");
12656   progressCheckAlpha.Reset();
12657   progressCheckBeta.Reset();
12658
12659   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 60% progress */);
12660   application.SendNotification();
12661
12662   tet_infoline("Animation at 60%");
12663
12664   progressCheckAlpha.CheckSignalNotReceived();
12665   progressCheckBeta.CheckSignalNotReceived();
12666
12667   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
12668   application.SendNotification();
12669   tet_infoline("Animation at 80%");
12670
12671   progressCheckAlpha.CheckSignalNotReceived();
12672   progressCheckBeta.CheckSignalNotReceived();
12673
12674   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
12675   // We did expect the animation to finish
12676   tet_infoline("Animation finished");
12677
12678   END_TEST;
12679 }
12680
12681 int UtcDaliAnimationMultipleProgressSignalsP2(void)
12682 {
12683   tet_infoline("Multiple animations with different progress markers and big step time");
12684
12685   TestApplication application;
12686
12687   Actor actor = Actor::New();
12688   application.GetScene().Add(actor);
12689
12690   // Build the animation
12691   Animation animationAlpha = Animation::New(0.0f);
12692   Animation animationBeta  = Animation::New(0.0f);
12693
12694   //Set duration
12695   const float durationSeconds(1.0f);
12696   animationAlpha.SetDuration(durationSeconds);
12697   animationBeta.SetDuration(durationSeconds);
12698
12699   bool progressSignalReceivedAlpha(false);
12700   bool progressSignalReceivedBeta(false);
12701
12702   AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12703   AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta");
12704
12705   DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha);
12706   DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta);
12707   application.SendNotification();
12708
12709   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12710   animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12711   animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12712
12713   tet_infoline("AnimationAlpha Progress notification set to 1%");
12714   DevelAnimation::SetProgressNotification(animationAlpha, 0.01f);
12715
12716   tet_infoline("AnimationBeta Progress notification set to 99%");
12717   DevelAnimation::SetProgressNotification(animationBeta, 0.99f);
12718
12719   application.SendNotification();
12720   application.Render();
12721
12722   progressCheckAlpha.CheckSignalNotReceived();
12723   progressCheckBeta.CheckSignalNotReceived();
12724
12725   // Start the animations unlimited looping
12726   animationAlpha.SetLooping(true);
12727   animationBeta.SetLooping(true);
12728   animationAlpha.Play();
12729   animationBeta.Play();
12730
12731   application.SendNotification();
12732   application.Render(0);                       // start animation
12733   application.Render(durationSeconds * 20.0f); // 2% progress
12734   application.SendNotification();
12735   DALI_TEST_EQUALS(0.02f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
12736
12737   tet_infoline("Animation at 2% - Alpha signals should be received, Beta should not.");
12738
12739   progressCheckAlpha.CheckSignalReceived();
12740   progressCheckBeta.CheckSignalNotReceived();
12741
12742   tet_infoline("Progress check reset");
12743   progressCheckAlpha.Reset();
12744   progressCheckBeta.Reset();
12745
12746   application.SendNotification();
12747   application.Render(durationSeconds * 960.0f); // 98% progress
12748   application.SendNotification();
12749   tet_infoline("Animation at 98% - No signal received");
12750   DALI_TEST_EQUALS(0.98f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
12751
12752   progressCheckAlpha.CheckSignalNotReceived();
12753   progressCheckBeta.CheckSignalNotReceived();
12754
12755   application.SendNotification();
12756   application.Render(durationSeconds * 40.0f); // 2% progress
12757   application.SendNotification();
12758   tet_infoline("Animation loop once and now 2% - Alpha and Beta should receive signal");
12759   application.SendNotification();
12760
12761   DALI_TEST_EQUALS(0.02f, animationBeta.GetCurrentProgress(), TEST_LOCATION);
12762
12763   progressCheckAlpha.CheckSignalReceived();
12764   progressCheckBeta.CheckSignalReceived();
12765
12766   tet_infoline("Progress check reset");
12767   progressCheckAlpha.Reset();
12768   progressCheckBeta.Reset();
12769
12770   application.SendNotification();
12771   application.Render(durationSeconds * 980.0f); // 100% progress
12772   application.SendNotification();
12773   tet_infoline("Animation loop one more time. and now 100% - Beta should receive signal, Alhpa sholud not");
12774   application.SendNotification();
12775
12776   progressCheckAlpha.CheckSignalNotReceived();
12777   progressCheckBeta.CheckSignalReceived();
12778
12779   tet_infoline("Progress check reset");
12780   progressCheckAlpha.Reset();
12781   progressCheckBeta.Reset();
12782
12783   animationAlpha.SetLooping(false);
12784   animationBeta.SetLooping(false);
12785
12786   application.SendNotification();
12787   application.Render(static_cast<unsigned int>(durationSeconds * 2000.0f) + 1u /*just beyond the animation duration*/);
12788   application.SendNotification();
12789
12790   // We did expect the animation to finish
12791   tet_infoline("Animation finished");
12792
12793   END_TEST;
12794 }
12795
12796 int UtcDaliAnimationProgressSignalWithPlayAfterP(void)
12797 {
12798   tet_infoline("Multiple animations with different progress markers");
12799
12800   TestApplication application;
12801
12802   Actor actor = Actor::New();
12803   application.GetScene().Add(actor);
12804
12805   // Build the animation
12806   Animation animationAlpha = Animation::New(0.0f);
12807   Animation animationBeta  = Animation::New(0.0f);
12808
12809   //Set duration
12810   float durationSeconds(1.0f);
12811   float delaySeconds(0.5f);
12812   animationAlpha.SetDuration(durationSeconds);
12813   animationBeta.SetDuration(durationSeconds);
12814
12815   bool progressSignalReceivedAlpha(false);
12816   bool progressSignalReceivedBeta(false);
12817
12818   AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12819   AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta");
12820
12821   DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha);
12822   DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta);
12823   application.SendNotification();
12824
12825   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12826   animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12827   animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12828
12829   tet_infoline("AnimationAlpha Progress notification set to 30%");
12830   DevelAnimation::SetProgressNotification(animationAlpha, 0.3f);
12831
12832   tet_infoline("AnimationBeta Progress notification set to ~0% (==Notify when delay is done)");
12833   DevelAnimation::SetProgressNotification(animationBeta, Math::MACHINE_EPSILON_1);
12834
12835   application.SendNotification();
12836   application.Render();
12837
12838   progressCheckAlpha.CheckSignalNotReceived();
12839   progressCheckBeta.CheckSignalNotReceived();
12840
12841   // Start the animations from 10% progress
12842   animationAlpha.PlayAfter(delaySeconds);
12843   animationBeta.PlayAfter(delaySeconds);
12844
12845   application.SendNotification();
12846   application.Render(0);                     // start animation
12847   application.Render(delaySeconds * 500.0f); // 50% wait progress
12848
12849   tet_infoline("Delay at 50% - No signals to be received");
12850
12851   progressCheckAlpha.CheckSignalNotReceived();
12852   progressCheckBeta.CheckSignalNotReceived();
12853
12854   application.SendNotification();
12855   application.Render(delaySeconds * 500.0f + durationSeconds * 50.0f); // 100% wait, 5% progress
12856   application.SendNotification();
12857   tet_infoline("Delay at 100%, Animation at 5% - Beta signal should be received");
12858   DALI_TEST_EQUALS(0.05f, animationBeta.GetCurrentProgress(), TEST_LOCATION);
12859
12860   progressCheckBeta.CheckSignalReceived();
12861   progressCheckAlpha.CheckSignalNotReceived();
12862
12863   tet_infoline("Progress check reset");
12864   progressCheckAlpha.Reset();
12865   progressCheckBeta.Reset();
12866
12867   application.Render(durationSeconds * 200.0f); // 25% progress
12868   tet_infoline("Animation at 25% - No signals to be received");
12869   application.SendNotification();
12870
12871   progressCheckAlpha.CheckSignalNotReceived();
12872   progressCheckBeta.CheckSignalNotReceived();
12873
12874   application.Render(durationSeconds * 200.0f); // 45% progress
12875   tet_infoline("Animation at 45% - Alpha should receive signal, Beta should not");
12876   application.SendNotification();
12877
12878   DALI_TEST_EQUALS(0.45f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
12879
12880   progressCheckAlpha.CheckSignalReceived();
12881   progressCheckBeta.CheckSignalNotReceived();
12882
12883   tet_infoline("Progress check reset");
12884   progressCheckAlpha.Reset();
12885   progressCheckBeta.Reset();
12886
12887   application.Render(static_cast<unsigned int>(durationSeconds * 150.0f) /* 60% progress */);
12888   application.SendNotification();
12889
12890   tet_infoline("Animation at 60%");
12891
12892   progressCheckAlpha.CheckSignalNotReceived();
12893   progressCheckBeta.CheckSignalNotReceived();
12894
12895   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
12896   application.SendNotification();
12897   tet_infoline("Animation at 80%");
12898
12899   progressCheckAlpha.CheckSignalNotReceived();
12900   progressCheckBeta.CheckSignalNotReceived();
12901
12902   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
12903   // We did expect the animation to finish
12904   tet_infoline("Animation finished");
12905
12906   END_TEST;
12907 }
12908
12909 int UtcDaliAnimationProgressCallbackWithLoopingP(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 Count
12924   const int loopCount(4);
12925   animation.SetLoopCount(loopCount);
12926
12927   bool finishedSignalReceived(false);
12928   bool progressSignalReceived(false);
12929
12930   AnimationFinishCheck finishCheck(finishedSignalReceived);
12931   animation.FinishedSignal().Connect(&application, finishCheck);
12932
12933   AnimationProgressCheck progressCheck(progressSignalReceived);
12934   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
12935   application.SendNotification();
12936
12937   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12938   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12939
12940   tet_infoline("Animation Progress notification set to 50% with looping count 4");
12941   DevelAnimation::SetProgressNotification(animation, 0.5f);
12942
12943   application.SendNotification();
12944   application.Render();
12945
12946   progressCheck.CheckSignalNotReceived();
12947
12948   animation.Play();
12949
12950   for(int count = 0; count < loopCount; count++)
12951   {
12952     application.SendNotification();
12953     application.Render(0);                                // start animation
12954     application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
12955     DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
12956
12957     tet_infoline("Animation at 25%");
12958
12959     progressCheck.CheckSignalNotReceived();
12960
12961     application.SendNotification();
12962     application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
12963     application.SendNotification();
12964     tet_infoline("Animation at 50%");
12965     DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
12966
12967     progressCheck.CheckSignalReceived();
12968
12969     tet_infoline("Progress check reset");
12970     progressCheck.Reset();
12971
12972     application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
12973     tet_infoline("Animation at 75%");
12974     application.SendNotification();
12975
12976     DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
12977
12978     progressCheck.CheckSignalNotReceived();
12979
12980     application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
12981     tet_infoline("Animation at 100%");
12982     application.SendNotification();
12983
12984     //Nothing check at 100% progress. cause It can be both 100% and 0%.
12985     application.SendNotification();
12986   }
12987   application.Render(10u);
12988   application.SendNotification();
12989   application.Render(0u);
12990   application.SendNotification();
12991
12992   finishCheck.CheckSignalReceived();
12993
12994   END_TEST;
12995 }
12996
12997 int UtcDaliAnimationProgressCallbackWithLoopingP2(void)
12998 {
12999   TestApplication application;
13000
13001   Actor actor = Actor::New();
13002   application.GetScene().Add(actor);
13003
13004   // Build the animation
13005   Animation animation = Animation::New(0.0f);
13006
13007   //Set duration
13008   const float durationSeconds(1.0f);
13009   animation.SetDuration(durationSeconds);
13010
13011   // Set Looping Unlmited
13012   animation.SetLooping(true);
13013
13014   bool finishedSignalReceived(false);
13015   bool progressSignalReceived(false);
13016
13017   AnimationFinishCheck finishCheck(finishedSignalReceived);
13018   animation.FinishedSignal().Connect(&application, finishCheck);
13019
13020   AnimationProgressCheck progressCheck(progressSignalReceived);
13021   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13022   application.SendNotification();
13023
13024   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13025   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13026
13027   tet_infoline("Animation Progress notification set to 50% with unlimited looping");
13028   DevelAnimation::SetProgressNotification(animation, 0.5f);
13029
13030   application.SendNotification();
13031   application.Render();
13032
13033   progressCheck.CheckSignalNotReceived();
13034
13035   animation.Play();
13036
13037   for(int count = 0; count < 4; count++)
13038   {
13039     application.SendNotification();
13040     application.Render(0);                                // start animation
13041     application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13042     DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13043
13044     tet_infoline("Animation at 25%");
13045
13046     progressCheck.CheckSignalNotReceived();
13047
13048     application.SendNotification();
13049     application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13050     application.SendNotification();
13051     tet_infoline("Animation at 50%");
13052     DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13053
13054     progressCheck.CheckSignalReceived();
13055
13056     tet_infoline("Progress check reset");
13057     progressCheck.Reset();
13058
13059     application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13060     tet_infoline("Animation at 75%");
13061     application.SendNotification();
13062
13063     DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13064
13065     progressCheck.CheckSignalNotReceived();
13066
13067     application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
13068     tet_infoline("Animation at 100%");
13069     application.SendNotification();
13070
13071     //Nothing check at 100% progress. cause It can be both 100% and 0%.
13072     finishCheck.CheckSignalNotReceived();
13073     application.SendNotification();
13074   }
13075   finishCheck.CheckSignalNotReceived();
13076
13077   animation.SetLooping(false);
13078   application.Render(0u);
13079   application.SendNotification();
13080   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 10u);
13081   application.SendNotification();
13082   application.Render(0u);
13083   application.SendNotification();
13084
13085   finishCheck.CheckSignalReceived();
13086
13087   END_TEST;
13088 }
13089
13090 int UtcDaliAnimationProgressCallbackNegativeSpeed(void)
13091 {
13092   TestApplication application;
13093
13094   Actor actor = Actor::New();
13095   application.GetScene().Add(actor);
13096
13097   // Build the animation
13098   Animation animation = Animation::New(0.0f);
13099
13100   //Set duration
13101   const float durationSeconds(1.0f);
13102   animation.SetDuration(durationSeconds);
13103
13104   //Set speed negative
13105   animation.SetSpeedFactor(-1.0f);
13106
13107   // Set Looping Unlmited
13108   animation.SetLooping(true);
13109
13110   bool finishedSignalReceived(false);
13111   bool progressSignalReceived(false);
13112
13113   AnimationFinishCheck finishCheck(finishedSignalReceived);
13114   animation.FinishedSignal().Connect(&application, finishCheck);
13115
13116   AnimationProgressCheck progressCheck(progressSignalReceived);
13117   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13118   application.SendNotification();
13119
13120   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13121   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13122
13123   tet_infoline("Animation Progress notification set to 50%");
13124   DevelAnimation::SetProgressNotification(animation, 0.5f);
13125
13126   application.SendNotification();
13127   application.Render();
13128
13129   progressCheck.CheckSignalNotReceived();
13130
13131   animation.Play();
13132
13133   for(int count = 0; count < 4; count++)
13134   {
13135     application.SendNotification();
13136     application.Render(0); // start animation
13137     progressCheck.CheckSignalNotReceived();
13138
13139     application.SendNotification();
13140     application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13141     DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13142
13143     tet_infoline("Animation at 25%");
13144
13145     progressCheck.CheckSignalNotReceived();
13146
13147     application.SendNotification();
13148     application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13149     application.SendNotification();
13150     tet_infoline("Animation at 50%");
13151     DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13152
13153     progressCheck.CheckSignalReceived();
13154
13155     tet_infoline("Progress check reset");
13156     progressCheck.Reset();
13157
13158     application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13159     tet_infoline("Animation at 75%");
13160     application.SendNotification();
13161
13162     DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13163
13164     progressCheck.CheckSignalNotReceived();
13165
13166     application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
13167     tet_infoline("Animation at 100%");
13168     application.SendNotification();
13169
13170     //Nothing check at 100% progress. cause It can be both 100% and 0%.
13171     finishCheck.CheckSignalNotReceived();
13172     application.SendNotification();
13173   }
13174   finishCheck.CheckSignalNotReceived();
13175
13176   animation.Stop();
13177   animation.SetLooping(false);
13178   animation.SetLoopCount(4);
13179   animation.Play();
13180   application.Render(0u);
13181   application.SendNotification();
13182
13183   for(int count = 0; count < 4; count++)
13184   {
13185     application.SendNotification();
13186     application.Render(0); // start animation
13187     progressCheck.CheckSignalNotReceived();
13188
13189     application.SendNotification();
13190     application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13191     DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13192
13193     tet_infoline("Animation at 25%");
13194
13195     progressCheck.CheckSignalNotReceived();
13196
13197     application.SendNotification();
13198     application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13199     application.SendNotification();
13200     tet_infoline("Animation at 50%");
13201     DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13202
13203     progressCheck.CheckSignalReceived();
13204
13205     tet_infoline("Progress check reset");
13206     progressCheck.Reset();
13207
13208     application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13209     tet_infoline("Animation at 75%");
13210     application.SendNotification();
13211
13212     DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13213
13214     progressCheck.CheckSignalNotReceived();
13215
13216     application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
13217     tet_infoline("Animation at 100%");
13218     application.SendNotification();
13219
13220     //Nothing check at 100% progress. cause It can be both 100% and 0%.
13221     application.SendNotification();
13222   }
13223   application.Render(10u);
13224   application.SendNotification();
13225   application.Render(0u);
13226   application.SendNotification();
13227
13228   finishCheck.CheckSignalReceived();
13229
13230   END_TEST;
13231 }
13232
13233 int UtcDaliAnimationProgressCallbackInvalidSignalN(void)
13234 {
13235   TestApplication application;
13236
13237   Actor actor = Actor::New();
13238   application.GetScene().Add(actor);
13239
13240   // Build the animation
13241   Animation animation = Animation::New(0.0f);
13242
13243   //Set duration
13244   const float durationSeconds(1.0f);
13245   animation.SetDuration(durationSeconds);
13246
13247   bool finishedSignalReceived(false);
13248   bool progressSignalReceived(false);
13249
13250   AnimationFinishCheck finishCheck(finishedSignalReceived);
13251   animation.FinishedSignal().Connect(&application, finishCheck);
13252
13253   AnimationProgressCheck progressCheck(progressSignalReceived);
13254   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13255   application.SendNotification();
13256
13257   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13258   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13259
13260   tet_infoline("Animation Progress PlayRange as 10% ~ 90%");
13261   animation.SetPlayRange(Vector2(0.1f, 0.9f));
13262
13263   tet_infoline("Animation Progress notification set to >90% that never can notificated");
13264   DevelAnimation::SetProgressNotification(animation, 0.9f + Math::MACHINE_EPSILON_1);
13265
13266   application.SendNotification();
13267   application.Render();
13268
13269   progressCheck.CheckSignalNotReceived();
13270
13271   animation.Play();
13272
13273   application.SendNotification();
13274   application.Render(0);                                // start animation
13275   application.Render(durationSeconds * 0.25 * 1000.0f); // 35% progress
13276   DALI_TEST_EQUALS(0.35f, animation.GetCurrentProgress(), TEST_LOCATION);
13277
13278   tet_infoline("Animation at 35%");
13279
13280   progressCheck.CheckSignalNotReceived();
13281
13282   application.SendNotification();
13283   application.Render(durationSeconds * 0.25 * 1000.0f); // 60% progress
13284   application.SendNotification();
13285   DALI_TEST_EQUALS(0.6f, animation.GetCurrentProgress(), TEST_LOCATION);
13286
13287   tet_infoline("Animation at 60%");
13288
13289   progressCheck.CheckSignalNotReceived();
13290
13291   application.Render(durationSeconds * 0.25 * 1000.0f); // 85% progress
13292   tet_infoline("Animation at 85%");
13293   application.SendNotification();
13294   DALI_TEST_EQUALS(0.85f, animation.GetCurrentProgress(), TEST_LOCATION);
13295
13296   progressCheck.CheckSignalNotReceived();
13297
13298   application.Render(durationSeconds * 0.25 * 1000.0f); // 90% progress
13299   tet_infoline("Animation over 90%");
13300   application.SendNotification();
13301
13302   // progress never signaled because playrange is 90%
13303   progressCheck.CheckSignalNotReceived();
13304
13305   END_TEST;
13306 }
13307
13308 int UtcDaliAnimationProgressCallbackLongDurationP(void)
13309 {
13310   TestApplication application;
13311
13312   Actor actor = Actor::New();
13313   application.GetScene().Add(actor);
13314
13315   // Build the animation
13316   Animation animation = Animation::New(0.0f);
13317
13318   //Set duration
13319   float durationSeconds(5.0f);
13320   animation.SetDuration(durationSeconds);
13321
13322   bool finishedSignalReceived(false);
13323   bool progressSignalReceived(false);
13324
13325   AnimationFinishCheck finishCheck(finishedSignalReceived);
13326   animation.FinishedSignal().Connect(&application, finishCheck);
13327
13328   AnimationProgressCheck progressCheck(progressSignalReceived);
13329   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13330   application.SendNotification();
13331
13332   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13333   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13334
13335   tet_infoline("Animation Progress notification set to 50%");
13336   DevelAnimation::SetProgressNotification(animation, 0.5f);
13337
13338   application.SendNotification();
13339   application.Render();
13340
13341   progressCheck.CheckSignalNotReceived();
13342
13343   animation.Play();
13344
13345   application.SendNotification();
13346   application.Render(0);                                // start animation
13347   application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13348   DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13349
13350   tet_infoline("Animation at 25%");
13351
13352   progressCheck.CheckSignalNotReceived();
13353
13354   application.SendNotification();
13355   application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13356   application.SendNotification();
13357   tet_infoline("Animation at 50%");
13358   DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13359
13360   progressCheck.CheckSignalReceived();
13361
13362   tet_infoline("Progress check reset");
13363   progressCheck.Reset();
13364
13365   application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13366   tet_infoline("Animation at 75%");
13367   application.SendNotification();
13368
13369   DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13370
13371   progressCheck.CheckSignalNotReceived();
13372
13373   END_TEST;
13374 }
13375
13376 int UtcDaliAnimationAnimateByInvalidParameters(void)
13377 {
13378   TestApplication application;
13379
13380   Actor actor = Actor::New();
13381   application.GetScene().Add(actor);
13382
13383   // Create the animation
13384   Animation animation = Animation::New(1.0f);
13385
13386   DALI_TEST_ASSERTION(
13387     {
13388       // non animateable property (STRING)
13389       animation.AnimateBy(Property(actor, Actor::Property::LAYOUT_DIRECTION), Property::Value("new direction"));
13390     },
13391     "Property type is not animatable");
13392
13393   DALI_TEST_ASSERTION(
13394     {
13395       // non animateable property (MATRIX)
13396       Property::Index index = actor.RegisterProperty("Foobar", Property::Value(Dali::Matrix()), Property::ANIMATABLE);
13397       animation.AnimateBy(Property(actor, index), Property::Value(Property::MATRIX));
13398     },
13399     "Property type is not animatable");
13400
13401   // AnimateBy
13402   DALI_TEST_ASSERTION(
13403     {
13404       // non animateable target (NONE)
13405       animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value());
13406     },
13407     "Target value is not animatable");
13408
13409   DALI_TEST_ASSERTION(
13410     {
13411       // non animateable target (STRING)
13412       animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value("foo"));
13413     },
13414     "Target value is not animatable");
13415
13416   DALI_TEST_ASSERTION(
13417     {
13418       // not mathing properties (VECTOR3, FLOAT)
13419       animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(10.f));
13420     },
13421     "Property and target types don't match");
13422
13423   DALI_TEST_ASSERTION(
13424     {
13425       // not mathing properties (VECTOR3.A, VECTOR2)
13426       animation.AnimateBy(Property(actor, Actor::Property::COLOR_ALPHA), Property::Value(Property::VECTOR2));
13427     },
13428     "Property and target types don't match");
13429
13430   DALI_TEST_ASSERTION(
13431     {
13432       // negative duration
13433       animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(Vector3(1, 2, 3)), TimePeriod(-1));
13434     },
13435     "Duration must be >=0");
13436
13437   END_TEST;
13438 }
13439
13440 int UtcDaliAnimationAnimateToInvalidParameters(void)
13441 {
13442   TestApplication application;
13443
13444   Actor actor = Actor::New();
13445   application.GetScene().Add(actor);
13446
13447   // Create the animation
13448   Animation animation = Animation::New(1.0f);
13449
13450   // AnimateTo
13451   DALI_TEST_ASSERTION(
13452     {
13453       // non animateable property (MAP)
13454       Property::Index index = actor.RegisterProperty("Foobar", Property::Value(Property::MAP), Property::ANIMATABLE);
13455       animation.AnimateTo(Property(actor, index), Property::Value(Property::MAP));
13456     },
13457     "Property type is not animatable");
13458
13459   DALI_TEST_ASSERTION(
13460     {
13461       // non animateable target (NONE)
13462       animation.AnimateTo(Property(actor, Actor::Property::CLIPPING_MODE), Property::Value());
13463     },
13464     "Property type is not animatable");
13465
13466   DALI_TEST_ASSERTION(
13467     {
13468       // non animateable target (ARRAY)
13469       animation.AnimateTo(Property(actor, Actor::Property::POSITION), Property::Value(Property::ARRAY));
13470     },
13471     "Target value is not animatable");
13472
13473   DALI_TEST_ASSERTION(
13474     {
13475       // non animateable target (RECTANGLE)
13476       animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(Rect<int32_t>()));
13477     },
13478     "Target value is not animatable");
13479
13480   DALI_TEST_ASSERTION(
13481     {
13482       // not mathing properties (FLOAT, INT)
13483       animation.AnimateTo(Property(actor, Actor::Property::SCALE_Y), Property::Value(10));
13484     },
13485     "Property and target types don't match");
13486
13487   DALI_TEST_ASSERTION(
13488     {
13489       // not mathing properties (VECTOR3, VECTOR2)
13490       animation.AnimateTo(Property(actor, Actor::Property::COLOR), Property::Value(Property::VECTOR2));
13491     },
13492     "Property and target types don't match");
13493
13494   DALI_TEST_ASSERTION(
13495     {
13496       // negative duration
13497       animation.AnimateTo(Property(actor, Actor::Property::POSITION), Property::Value(Vector3(1, 2, 3)), TimePeriod(-1));
13498     },
13499     "Duration must be >=0");
13500
13501   END_TEST;
13502 }
13503
13504 int UtcDaliAnimationAnimateBetweenInvalidParameters(void)
13505 {
13506   TestApplication application;
13507
13508   Actor actor = Actor::New();
13509   application.GetScene().Add(actor);
13510
13511   // Create the animation
13512   Animation animation = Animation::New(1.0f);
13513
13514   // AnimateBetween
13515   DALI_TEST_ASSERTION(
13516     {
13517       // non animateable property (ARRAY)
13518       Property::Index index     = actor.RegisterProperty("Foobar", Property::Value(Property::ARRAY), Property::ANIMATABLE);
13519       KeyFrames       keyframes = KeyFrames::New();
13520       keyframes.Add(0.5f, Property::Value(Property::ARRAY));
13521       animation.AnimateBetween(Property(actor, index), keyframes);
13522     },
13523     "Property type is not animatable");
13524
13525   DALI_TEST_ASSERTION(
13526     {
13527       // non animateable target (NONE)
13528       KeyFrames keyframes = KeyFrames::New();
13529       keyframes.Add(0.5f, Property::Value());
13530       animation.AnimateBetween(Property(actor, Actor::Property::CLIPPING_MODE), keyframes);
13531     },
13532     "Property type is not animatable");
13533
13534   DALI_TEST_ASSERTION(
13535     {
13536       // non animateable target (EXTENTS)
13537       KeyFrames keyframes = KeyFrames::New();
13538       keyframes.Add(0.5f, Property::Value(Property::EXTENTS)); // throws
13539       animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes);
13540     },
13541     "Property type is not animatable");
13542
13543   DALI_TEST_ASSERTION(
13544     {
13545       // non animateable target (RECTANGLE)
13546       KeyFrames keyframes = KeyFrames::New();
13547       keyframes.Add(0.5f, Property::Value(Property::MAP)); // throws
13548       animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes);
13549     },
13550     "Property type is not animatable");
13551
13552   DALI_TEST_ASSERTION(
13553     {
13554       // not mathing properties (VECTOR2, VECTOR4)
13555       KeyFrames keyframes = KeyFrames::New();
13556       keyframes.Add(0.5f, Property::Value(Vector4(1, 2, 3, 4)));
13557       animation.AnimateBetween(Property(actor, Actor::Property::MAXIMUM_SIZE), keyframes);
13558     },
13559     "Property and target types don't match");
13560
13561   DALI_TEST_ASSERTION(
13562     {
13563       // negative duration
13564       KeyFrames keyframes = KeyFrames::New();
13565       keyframes.Add(0.5f, Property::Value(Vector3(1, 2, 3)));
13566       animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, TimePeriod(-1));
13567     },
13568     "Duration must be >=0");
13569
13570   END_TEST;
13571 }
13572
13573 namespace // Purposefully left this in the middle as the values in this namespace are only used for the subsequent two test cases
13574 {
13575 enum TestFunction
13576 {
13577   STOP,
13578   CLEAR
13579 };
13580
13581 void CheckPropertyValuesWhenCallingAnimationMethod(TestFunction functionToTest, const char* testName)
13582 {
13583   tet_printf("Testing %s\n", testName);
13584
13585   // When an Animation::Stop() or Animation::Clear() is called, the event-side property needs to be updated appropriately
13586   // This test checks that that is being done
13587
13588   const float   durationSeconds(1.0f);
13589   unsigned int  halfAnimationDuration(static_cast<unsigned int>(durationSeconds * 1000.0f * 0.5f));
13590   const Vector3 originalPosition(Vector3::ZERO);
13591   const Vector3 targetPosition(10.0f, 10.0f, 10.0f);
13592   const Vector3 halfWayToTarget(targetPosition * 0.5f);
13593
13594   struct ExpectedValue
13595   {
13596     Animation::EndAction endAction;
13597     Vector3              expectedGetPropertyValue;
13598   };
13599
13600   ExpectedValue expectedValueTable[] =
13601     {
13602       {Animation::BAKE, halfWayToTarget},      // When baking, the current value is the final value.
13603       {Animation::BAKE_FINAL, targetPosition}, // When BakeFinal, we should jump to the final value when clearing or stopping.
13604       {Animation::DISCARD, originalPosition},  // When discarding, we should jump back to the original value when clearing or stopping.
13605     };
13606   const auto expectedValueTableCount = sizeof(expectedValueTable) / sizeof(ExpectedValue);
13607
13608   for(auto i = 0u; i < expectedValueTableCount; ++i)
13609   {
13610     TestApplication application;
13611
13612     Actor actor = Actor::New();
13613     application.GetScene().Add(actor);
13614
13615     // Build the animation
13616     Animation animation = Animation::New(durationSeconds);
13617     animation.SetEndAction(expectedValueTable[i].endAction);
13618     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13619
13620     // Start the animation
13621     animation.Play();
13622
13623     application.SendNotification();
13624     application.Render(halfAnimationDuration);
13625
13626     // Stop or Clear the animation early, both have the same effect
13627     if(functionToTest == TestFunction::STOP)
13628     {
13629       animation.Stop();
13630     }
13631     else
13632     {
13633       animation.Clear();
13634     }
13635
13636     // 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
13637     DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION);
13638     DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13639
13640     // After one frame, both values should match regardless of the End Action
13641     application.SendNotification();
13642     application.Render();
13643
13644     DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION);
13645     DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION);
13646   }
13647 }
13648 } // unnamed namespace
13649
13650 int UtcDaliAnimationStopPropertyValue(void)
13651 {
13652   CheckPropertyValuesWhenCallingAnimationMethod(TestFunction::STOP, "UtcDaliAnimationStopPropertyValue");
13653   END_TEST;
13654 }
13655
13656 int UtcDaliAnimationClearPropertyValue01(void)
13657 {
13658   CheckPropertyValuesWhenCallingAnimationMethod(TestFunction::CLEAR, "UtcDaliAnimationStopPropertyValue");
13659   END_TEST;
13660 }
13661
13662 int UtcDaliAnimationClearPropertyValue02(void)
13663 {
13664   TestApplication application;
13665
13666   Actor actor = Actor::New();
13667   application.GetScene().Add(actor);
13668
13669   const float durationSeconds(1.0f);
13670   const Vector3 targetPosition1(10.0f, 10.0f, 10.0f);
13671   const Vector3 targetPosition2(20.0f, 20.0f, 20.0f);
13672
13673   // Build the animation
13674   Animation animation1 = Animation::New(durationSeconds);
13675   animation1.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition1, AlphaFunction::LINEAR);
13676   animation1.Play();
13677
13678   application.SendNotification();
13679   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
13680
13681   // The event side property should be set the current value immediately
13682   DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), targetPosition1, VECTOR3_EPSILON, TEST_LOCATION);
13683
13684   application.SendNotification();
13685   application.Render(2u /*just beyond the animation duration*/);
13686
13687   // Build a new animation
13688   Animation animation2 = Animation::New(durationSeconds);
13689   animation2.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition2, AlphaFunction::LINEAR);
13690   animation2.Play();
13691
13692   application.SendNotification();
13693   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
13694
13695   // The event side property should be set the current value immediately
13696   DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), targetPosition2, VECTOR3_EPSILON, TEST_LOCATION);
13697
13698   // Clear the first animation after finished
13699   animation1.Clear();
13700
13701   application.SendNotification();
13702   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
13703
13704   // The property should not be changed.
13705   DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), targetPosition2, VECTOR3_EPSILON, TEST_LOCATION);
13706
13707   END_TEST;
13708 }
13709
13710 int UtcDaliAnimationPausePropertyValue(void)
13711 {
13712   const float   durationSeconds(1.0f);
13713   unsigned int  halfAnimationDuration(static_cast<unsigned int>(durationSeconds * 1000.0f * 0.5f));
13714   const Vector3 targetPosition(10.0f, 10.0f, 10.0f);
13715   const Vector3 halfWayToTarget(targetPosition * 0.5f);
13716
13717   Animation::EndAction endActions[] =
13718     {
13719       Animation::BAKE,
13720       Animation::BAKE_FINAL,
13721       Animation::DISCARD,
13722     };
13723   const auto endActionCount = sizeof(endActions) / sizeof(endActions[0]);
13724
13725   // For all end actions, when pausing, we stay at the current value
13726   for(auto i = 0u; i < endActionCount; ++i)
13727   {
13728     TestApplication application;
13729
13730     Actor actor = Actor::New();
13731     application.GetScene().Add(actor);
13732
13733     // Build the animation
13734     Animation animation = Animation::New(durationSeconds);
13735     animation.SetEndAction(endActions[i]);
13736     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13737
13738     // Start the animation
13739     animation.Play();
13740
13741     application.SendNotification();
13742     application.Render(halfAnimationDuration);
13743
13744     // Puase the animation early
13745     animation.Pause();
13746
13747     // The event side property should be set the current value immediately, the update side property will still only be halfway
13748     DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13749     DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13750
13751     // After one frame, both values should match regardless of the End Action
13752     application.SendNotification();
13753     application.Render();
13754
13755     DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13756     DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13757   }
13758
13759   END_TEST;
13760 }
13761
13762 int UtcDaliAnimationPlayFromWithLoopCount(void)
13763 {
13764   TestApplication application;
13765
13766   auto actor = Actor::New();
13767   application.GetScene().Add(actor);
13768
13769   auto animation = Animation::New(1.0f);
13770   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f);
13771   animation.SetLoopCount(2);
13772   animation.Play();
13773
13774   application.SendNotification();
13775   application.Render(1001);
13776
13777   // One loop completed
13778
13779   application.Render(2005);
13780   application.SendNotification();
13781
13782   // 2 loops should have completed
13783   DALI_TEST_EQUALS(animation.GetCurrentLoop(), 2u, TEST_LOCATION);
13784
13785   // Another render needs to occur after all the loops end
13786   application.SendNotification();
13787   application.Render(1000);
13788
13789   // Stop the animation and use PlayFrom, previously we got an Assert here
13790   animation.Stop();
13791   animation.PlayFrom(0.5f);
13792
13793   application.SendNotification();
13794   application.Render(1000);
13795
13796   DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
13797
13798   END_TEST;
13799 }
13800
13801 int UtcDaliAnimationCombineToAndByWithStop(void)
13802 {
13803   tet_infoline("Ensure the Y Position is not modified when animating the X position using AnimateTo and AnimateBy");
13804
13805   TestApplication application;
13806
13807   auto actor = Actor::New();
13808   actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
13809   application.GetScene().Add(actor);
13810
13811   auto        animation = Animation::New(1.0f);
13812   const float origY     = actor.GetProperty(Actor::Property::POSITION_Y).Get<float>();
13813   animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(150.0f, origY, 0.0f), TimePeriod(1.0f));
13814   animation.AnimateBy(Property(actor, Actor::Property::POSITION), Vector3(-30.0f, 0.0f, 0.0f), TimePeriod(1.0f, 1.0f));
13815   animation.Play();
13816
13817   application.SendNotification();
13818   application.Render(500);
13819
13820   application.SendNotification();
13821   application.Render(500);
13822
13823   application.SendNotification();
13824   application.Render(500);
13825
13826   // Stop and clear the animation using the current values
13827   animation.Stop();
13828   animation.Clear();
13829
13830   // Check the y position, it should be the same as before
13831   DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Y).Get<float>(), origY, TEST_LOCATION);
13832
13833   END_TEST;
13834 }
13835
13836 int UtcDaliAnimationCountAndGetAnimationAt(void)
13837 {
13838   tet_infoline("UtcDaliAnimationCountAndGetAnimationAt");
13839
13840   TestApplication application;
13841
13842   auto actor = Actor::New();
13843   actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
13844   application.GetScene().Add(actor);
13845
13846   auto        animation = Animation::New(1.0f);
13847   const float origY     = actor.GetProperty(Actor::Property::POSITION_Y).Get<float>();
13848   animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(150.0f, origY, 0.0f), TimePeriod(1.0f));
13849   animation.Play();
13850
13851   application.SendNotification();
13852   application.Render(500);
13853
13854   uint32_t animationCount = Dali::DevelAnimation::GetAnimationCount();
13855   DALI_TEST_EQUALS(animationCount, 1, TEST_LOCATION);
13856
13857   DALI_TEST_CHECK(!Dali::DevelAnimation::GetAnimationAt(5));
13858
13859   Dali::Animation animationReturned = Dali::DevelAnimation::GetAnimationAt(0);
13860   DALI_TEST_EQUALS(animationReturned.GetState(), Dali::Animation::State::PLAYING, TEST_LOCATION);
13861
13862   DALI_TEST_EQUALS(animation.GetDuration(), animationReturned.GetDuration(), TEST_LOCATION);
13863   DALI_TEST_EQUALS(animation.GetLoopCount(), animationReturned.GetLoopCount(), TEST_LOCATION);
13864   DALI_TEST_EQUALS(animation.IsLooping(), animationReturned.IsLooping(), TEST_LOCATION);
13865   DALI_TEST_EQUALS(animation.GetEndAction(), animationReturned.GetEndAction(), TEST_LOCATION);
13866   DALI_TEST_EQUALS(animation.GetState(), animationReturned.GetState(), TEST_LOCATION);
13867
13868   // Stop and clear the animation using the current values
13869   animation.Stop();
13870   animation.Clear();
13871
13872   END_TEST;
13873 }
13874
13875 int UtcDaliAnimationSetLoopingNegative(void)
13876 {
13877   TestApplication application;
13878   Dali::Animation instance;
13879   try
13880   {
13881     bool arg1(false);
13882     instance.SetLooping(arg1);
13883     DALI_TEST_CHECK(false); // Should not get here
13884   }
13885   catch(...)
13886   {
13887     DALI_TEST_CHECK(true); // We expect an assert
13888   }
13889   END_TEST;
13890 }
13891
13892 int UtcDaliAnimationSetDurationNegative(void)
13893 {
13894   TestApplication application;
13895   Dali::Animation instance;
13896   try
13897   {
13898     float arg1(0.0f);
13899     instance.SetDuration(arg1);
13900     DALI_TEST_CHECK(false); // Should not get here
13901   }
13902   catch(...)
13903   {
13904     DALI_TEST_CHECK(true); // We expect an assert
13905   }
13906   END_TEST;
13907 }
13908
13909 int UtcDaliAnimationGetLoopCountNegative(void)
13910 {
13911   TestApplication application;
13912   Dali::Animation instance;
13913   try
13914   {
13915     instance.GetLoopCount();
13916     DALI_TEST_CHECK(false); // Should not get here
13917   }
13918   catch(...)
13919   {
13920     DALI_TEST_CHECK(true); // We expect an assert
13921   }
13922   END_TEST;
13923 }
13924
13925 int UtcDaliAnimationSetEndActionNegative(void)
13926 {
13927   TestApplication application;
13928   Dali::Animation instance;
13929   try
13930   {
13931     Dali::Animation::EndAction arg1(Animation::BAKE);
13932     instance.SetEndAction(arg1);
13933     DALI_TEST_CHECK(false); // Should not get here
13934   }
13935   catch(...)
13936   {
13937     DALI_TEST_CHECK(true); // We expect an assert
13938   }
13939   END_TEST;
13940 }
13941
13942 int UtcDaliAnimationSetLoopCountNegative(void)
13943 {
13944   TestApplication application;
13945   Dali::Animation instance;
13946   try
13947   {
13948     int arg1(0);
13949     instance.SetLoopCount(arg1);
13950     DALI_TEST_CHECK(false); // Should not get here
13951   }
13952   catch(...)
13953   {
13954     DALI_TEST_CHECK(true); // We expect an assert
13955   }
13956   END_TEST;
13957 }
13958
13959 int UtcDaliAnimationSetPlayRangeNegative(void)
13960 {
13961   TestApplication application;
13962   Dali::Animation instance;
13963   try
13964   {
13965     Dali::Vector2 arg1;
13966     instance.SetPlayRange(arg1);
13967     DALI_TEST_CHECK(false); // Should not get here
13968   }
13969   catch(...)
13970   {
13971     DALI_TEST_CHECK(true); // We expect an assert
13972   }
13973   END_TEST;
13974 }
13975
13976 int UtcDaliAnimationAnimateBetweenNegative01(void)
13977 {
13978   TestApplication application;
13979   Dali::Animation instance;
13980   Dali::Actor     actor;
13981   try
13982   {
13983     Dali::Property  arg1(actor, Actor::Property::POSITION);
13984     Dali::KeyFrames arg2;
13985     instance.AnimateBetween(arg1, arg2);
13986     DALI_TEST_CHECK(false); // Should not get here
13987   }
13988   catch(...)
13989   {
13990     DALI_TEST_CHECK(true); // We expect an assert
13991   }
13992   END_TEST;
13993 }
13994
13995 int UtcDaliAnimationAnimateBetweenNegative02(void)
13996 {
13997   TestApplication application;
13998   Dali::Animation instance;
13999   Dali::Actor     actor;
14000   try
14001   {
14002     Dali::Property                 arg1(actor, Actor::Property::POSITION);
14003     Dali::KeyFrames                arg2;
14004     Dali::Animation::Interpolation arg3(Animation::LINEAR);
14005     instance.AnimateBetween(arg1, arg2, arg3);
14006     DALI_TEST_CHECK(false); // Should not get here
14007   }
14008   catch(...)
14009   {
14010     DALI_TEST_CHECK(true); // We expect an assert
14011   }
14012   END_TEST;
14013 }
14014
14015 int UtcDaliAnimationAnimateBetweenNegative03(void)
14016 {
14017   TestApplication application;
14018   Dali::Animation instance;
14019   Dali::Actor     actor;
14020   try
14021   {
14022     Dali::Property   arg1(actor, Actor::Property::POSITION);
14023     Dali::KeyFrames  arg2;
14024     Dali::TimePeriod arg3(1.0f);
14025     instance.AnimateBetween(arg1, arg2, arg3);
14026     DALI_TEST_CHECK(false); // Should not get here
14027   }
14028   catch(...)
14029   {
14030     DALI_TEST_CHECK(true); // We expect an assert
14031   }
14032   END_TEST;
14033 }
14034
14035 int UtcDaliAnimationAnimateBetweenNegative04(void)
14036 {
14037   TestApplication application;
14038   Dali::Animation instance;
14039   Dali::Actor     actor;
14040   try
14041   {
14042     Dali::Property                 arg1(actor, Actor::Property::POSITION);
14043     Dali::KeyFrames                arg2;
14044     Dali::TimePeriod               arg3(1.0f);
14045     Dali::Animation::Interpolation arg4(Animation::LINEAR);
14046     instance.AnimateBetween(arg1, arg2, arg3, arg4);
14047     DALI_TEST_CHECK(false); // Should not get here
14048   }
14049   catch(...)
14050   {
14051     DALI_TEST_CHECK(true); // We expect an assert
14052   }
14053   END_TEST;
14054 }
14055
14056 int UtcDaliAnimationAnimateBetweenNegative05(void)
14057 {
14058   TestApplication application;
14059   Dali::Animation instance;
14060   Dali::Actor     actor;
14061   try
14062   {
14063     Dali::Property      arg1(actor, Actor::Property::POSITION);
14064     Dali::KeyFrames     arg2;
14065     Dali::AlphaFunction arg3;
14066     instance.AnimateBetween(arg1, arg2, arg3);
14067     DALI_TEST_CHECK(false); // Should not get here
14068   }
14069   catch(...)
14070   {
14071     DALI_TEST_CHECK(true); // We expect an assert
14072   }
14073   END_TEST;
14074 }
14075
14076 int UtcDaliAnimationAnimateBetweenNegative06(void)
14077 {
14078   TestApplication application;
14079   Dali::Animation instance;
14080   Dali::Actor     actor;
14081   try
14082   {
14083     Dali::Property                 arg1(actor, Actor::Property::POSITION);
14084     Dali::KeyFrames                arg2;
14085     Dali::AlphaFunction            arg3;
14086     Dali::Animation::Interpolation arg4(Animation::LINEAR);
14087     instance.AnimateBetween(arg1, arg2, arg3, arg4);
14088     DALI_TEST_CHECK(false); // Should not get here
14089   }
14090   catch(...)
14091   {
14092     DALI_TEST_CHECK(true); // We expect an assert
14093   }
14094   END_TEST;
14095 }
14096
14097 int UtcDaliAnimationAnimateBetweenNegative07(void)
14098 {
14099   TestApplication application;
14100   Dali::Animation instance;
14101   Dali::Actor     actor;
14102   try
14103   {
14104     Dali::Property      arg1(actor, Actor::Property::POSITION);
14105     Dali::KeyFrames     arg2;
14106     Dali::AlphaFunction arg3;
14107     Dali::TimePeriod    arg4(1.0f);
14108     instance.AnimateBetween(arg1, arg2, arg3, arg4);
14109     DALI_TEST_CHECK(false); // Should not get here
14110   }
14111   catch(...)
14112   {
14113     DALI_TEST_CHECK(true); // We expect an assert
14114   }
14115   END_TEST;
14116 }
14117
14118 int UtcDaliAnimationAnimateBetweenNegative08(void)
14119 {
14120   TestApplication application;
14121   Dali::Animation instance;
14122   Dali::Actor     actor;
14123   try
14124   {
14125     Dali::Property                 arg1(actor, Actor::Property::POSITION);
14126     Dali::KeyFrames                arg2;
14127     Dali::AlphaFunction            arg3;
14128     Dali::TimePeriod               arg4(1.0f);
14129     Dali::Animation::Interpolation arg5(Animation::LINEAR);
14130     instance.AnimateBetween(arg1, arg2, arg3, arg4, arg5);
14131     DALI_TEST_CHECK(false); // Should not get here
14132   }
14133   catch(...)
14134   {
14135     DALI_TEST_CHECK(true); // We expect an assert
14136   }
14137   END_TEST;
14138 }
14139
14140 int UtcDaliAnimationFinishedSignalNegative(void)
14141 {
14142   TestApplication application;
14143   Dali::Animation instance;
14144   try
14145   {
14146     instance.FinishedSignal();
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 UtcDaliAnimationGetCurrentLoopNegative(void)
14157 {
14158   TestApplication application;
14159   Dali::Animation instance;
14160   try
14161   {
14162     instance.GetCurrentLoop();
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 UtcDaliAnimationSetLoopingModeNegative(void)
14173 {
14174   TestApplication application;
14175   Dali::Animation instance;
14176   try
14177   {
14178     Dali::Animation::LoopingMode arg1(Animation::RESTART);
14179     instance.SetLoopingMode(arg1);
14180     DALI_TEST_CHECK(false); // Should not get here
14181   }
14182   catch(...)
14183   {
14184     DALI_TEST_CHECK(true); // We expect an assert
14185   }
14186   END_TEST;
14187 }
14188
14189 int UtcDaliAnimationSetSpeedFactorNegative(void)
14190 {
14191   TestApplication application;
14192   Dali::Animation instance;
14193   try
14194   {
14195     float arg1(0.0f);
14196     instance.SetSpeedFactor(arg1);
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 UtcDaliAnimationGetCurrentProgressNegative(void)
14207 {
14208   TestApplication application;
14209   Dali::Animation instance;
14210   try
14211   {
14212     instance.GetCurrentProgress();
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 UtcDaliAnimationSetCurrentProgressNegative(void)
14223 {
14224   TestApplication application;
14225   Dali::Animation instance;
14226   try
14227   {
14228     float arg1(0.0f);
14229     instance.SetCurrentProgress(arg1);
14230     DALI_TEST_CHECK(false); // Should not get here
14231   }
14232   catch(...)
14233   {
14234     DALI_TEST_CHECK(true); // We expect an assert
14235   }
14236   END_TEST;
14237 }
14238
14239 int UtcDaliAnimationSetDisconnectActionNegative(void)
14240 {
14241   TestApplication application;
14242   Dali::Animation instance;
14243   try
14244   {
14245     Dali::Animation::EndAction arg1(Animation::BAKE);
14246     instance.SetDisconnectAction(arg1);
14247     DALI_TEST_CHECK(false); // Should not get here
14248   }
14249   catch(...)
14250   {
14251     DALI_TEST_CHECK(true); // We expect an assert
14252   }
14253   END_TEST;
14254 }
14255
14256 int UtcDaliAnimationSetDefaultAlphaFunctionNegative(void)
14257 {
14258   TestApplication application;
14259   Dali::Animation instance;
14260   try
14261   {
14262     Dali::AlphaFunction arg1;
14263     instance.SetDefaultAlphaFunction(arg1);
14264     DALI_TEST_CHECK(false); // Should not get here
14265   }
14266   catch(...)
14267   {
14268     DALI_TEST_CHECK(true); // We expect an assert
14269   }
14270   END_TEST;
14271 }
14272
14273 int UtcDaliAnimationHideNegative(void)
14274 {
14275   TestApplication application;
14276   Dali::Animation instance;
14277   try
14278   {
14279     Dali::Actor arg1;
14280     float       arg2(0.0f);
14281     instance.Hide(arg1, arg2);
14282     DALI_TEST_CHECK(false); // Should not get here
14283   }
14284   catch(...)
14285   {
14286     DALI_TEST_CHECK(true); // We expect an assert
14287   }
14288   END_TEST;
14289 }
14290
14291 int UtcDaliAnimationPlayNegative(void)
14292 {
14293   TestApplication application;
14294   Dali::Animation instance;
14295   try
14296   {
14297     instance.Play();
14298     DALI_TEST_CHECK(false); // Should not get here
14299   }
14300   catch(...)
14301   {
14302     DALI_TEST_CHECK(true); // We expect an assert
14303   }
14304   END_TEST;
14305 }
14306
14307 int UtcDaliAnimationShowNegative(void)
14308 {
14309   TestApplication application;
14310   Dali::Animation instance;
14311   try
14312   {
14313     Dali::Actor arg1;
14314     float       arg2(0.0f);
14315     instance.Show(arg1, arg2);
14316     DALI_TEST_CHECK(false); // Should not get here
14317   }
14318   catch(...)
14319   {
14320     DALI_TEST_CHECK(true); // We expect an assert
14321   }
14322   END_TEST;
14323 }
14324
14325 int UtcDaliAnimationStopNegative(void)
14326 {
14327   TestApplication application;
14328   Dali::Animation instance;
14329   try
14330   {
14331     instance.Stop();
14332     DALI_TEST_CHECK(false); // Should not get here
14333   }
14334   catch(...)
14335   {
14336     DALI_TEST_CHECK(true); // We expect an assert
14337   }
14338   END_TEST;
14339 }
14340
14341 int UtcDaliAnimationClearNegative(void)
14342 {
14343   TestApplication application;
14344   Dali::Animation instance;
14345   try
14346   {
14347     instance.Clear();
14348     DALI_TEST_CHECK(false); // Should not get here
14349   }
14350   catch(...)
14351   {
14352     DALI_TEST_CHECK(true); // We expect an assert
14353   }
14354   END_TEST;
14355 }
14356
14357 int UtcDaliAnimationPauseNegative(void)
14358 {
14359   TestApplication application;
14360   Dali::Animation instance;
14361   try
14362   {
14363     instance.Pause();
14364     DALI_TEST_CHECK(false); // Should not get here
14365   }
14366   catch(...)
14367   {
14368     DALI_TEST_CHECK(true); // We expect an assert
14369   }
14370   END_TEST;
14371 }
14372
14373 int UtcDaliAnimationAnimateNegative01(void)
14374 {
14375   TestApplication application;
14376   Dali::Animation instance;
14377   try
14378   {
14379     Dali::Actor   arg1;
14380     Dali::Path    arg2;
14381     Dali::Vector3 arg3;
14382     instance.Animate(arg1, arg2, arg3);
14383     DALI_TEST_CHECK(false); // Should not get here
14384   }
14385   catch(...)
14386   {
14387     DALI_TEST_CHECK(true); // We expect an assert
14388   }
14389   END_TEST;
14390 }
14391
14392 int UtcDaliAnimationAnimateNegative02(void)
14393 {
14394   TestApplication application;
14395   Dali::Animation instance;
14396   try
14397   {
14398     Dali::Actor      arg1;
14399     Dali::Path       arg2;
14400     Dali::Vector3    arg3;
14401     Dali::TimePeriod arg4(1.0f);
14402     instance.Animate(arg1, arg2, arg3, arg4);
14403     DALI_TEST_CHECK(false); // Should not get here
14404   }
14405   catch(...)
14406   {
14407     DALI_TEST_CHECK(true); // We expect an assert
14408   }
14409   END_TEST;
14410 }
14411
14412 int UtcDaliAnimationAnimateNegative03(void)
14413 {
14414   TestApplication application;
14415   Dali::Animation instance;
14416   try
14417   {
14418     Dali::Actor         arg1;
14419     Dali::Path          arg2;
14420     Dali::Vector3       arg3;
14421     Dali::AlphaFunction arg4;
14422     instance.Animate(arg1, arg2, arg3, arg4);
14423     DALI_TEST_CHECK(false); // Should not get here
14424   }
14425   catch(...)
14426   {
14427     DALI_TEST_CHECK(true); // We expect an assert
14428   }
14429   END_TEST;
14430 }
14431
14432 int UtcDaliAnimationAnimateNegative04(void)
14433 {
14434   TestApplication application;
14435   Dali::Animation instance;
14436   try
14437   {
14438     Dali::Actor         arg1;
14439     Dali::Path          arg2;
14440     Dali::Vector3       arg3;
14441     Dali::AlphaFunction arg4;
14442     Dali::TimePeriod    arg5(1.0f);
14443     instance.Animate(arg1, arg2, arg3, arg4, arg5);
14444     DALI_TEST_CHECK(false); // Should not get here
14445   }
14446   catch(...)
14447   {
14448     DALI_TEST_CHECK(true); // We expect an assert
14449   }
14450   END_TEST;
14451 }
14452
14453 int UtcDaliAnimationPlayFromNegative(void)
14454 {
14455   TestApplication application;
14456   Dali::Animation instance;
14457   try
14458   {
14459     float arg1(0.0f);
14460     instance.PlayFrom(arg1);
14461     DALI_TEST_CHECK(false); // Should not get here
14462   }
14463   catch(...)
14464   {
14465     DALI_TEST_CHECK(true); // We expect an assert
14466   }
14467   END_TEST;
14468 }
14469
14470 int UtcDaliAnimationAnimateByNegative01(void)
14471 {
14472   TestApplication application;
14473   Dali::Animation instance;
14474   Dali::Actor     actor;
14475   try
14476   {
14477     Dali::Property        arg1(actor, Actor::Property::POSITION);
14478     Dali::Property::Value arg2;
14479     instance.AnimateBy(arg1, arg2);
14480     DALI_TEST_CHECK(false); // Should not get here
14481   }
14482   catch(...)
14483   {
14484     DALI_TEST_CHECK(true); // We expect an assert
14485   }
14486   END_TEST;
14487 }
14488
14489 int UtcDaliAnimationAnimateByNegative02(void)
14490 {
14491   TestApplication application;
14492   Dali::Animation instance;
14493   Dali::Actor     actor;
14494   try
14495   {
14496     Dali::Property        arg1(actor, Actor::Property::POSITION);
14497     Dali::Property::Value arg2;
14498     Dali::TimePeriod      arg3(1.0f);
14499     instance.AnimateBy(arg1, arg2, arg3);
14500     DALI_TEST_CHECK(false); // Should not get here
14501   }
14502   catch(...)
14503   {
14504     DALI_TEST_CHECK(true); // We expect an assert
14505   }
14506   END_TEST;
14507 }
14508
14509 int UtcDaliAnimationAnimateByNegative03(void)
14510 {
14511   TestApplication application;
14512   Dali::Animation instance;
14513   Dali::Actor     actor;
14514   try
14515   {
14516     Dali::Property        arg1(actor, Actor::Property::POSITION);
14517     Dali::Property::Value arg2;
14518     Dali::AlphaFunction   arg3;
14519     instance.AnimateBy(arg1, arg2, arg3);
14520     DALI_TEST_CHECK(false); // Should not get here
14521   }
14522   catch(...)
14523   {
14524     DALI_TEST_CHECK(true); // We expect an assert
14525   }
14526   END_TEST;
14527 }
14528
14529 int UtcDaliAnimationAnimateByNegative04(void)
14530 {
14531   TestApplication application;
14532   Dali::Animation instance;
14533   Dali::Actor     actor;
14534   try
14535   {
14536     Dali::Property        arg1(actor, Actor::Property::POSITION);
14537     Dali::Property::Value arg2;
14538     Dali::AlphaFunction   arg3;
14539     Dali::TimePeriod      arg4(1.0f);
14540     instance.AnimateBy(arg1, arg2, arg3, arg4);
14541     DALI_TEST_CHECK(false); // Should not get here
14542   }
14543   catch(...)
14544   {
14545     DALI_TEST_CHECK(true); // We expect an assert
14546   }
14547   END_TEST;
14548 }
14549
14550 int UtcDaliAnimationAnimateToNegative01(void)
14551 {
14552   TestApplication application;
14553   Dali::Actor     actor;
14554   Dali::Animation instance;
14555   try
14556   {
14557     Dali::Property        arg1(actor, Actor::Property::POSITION);
14558     Dali::Property::Value arg2;
14559     instance.AnimateTo(arg1, arg2);
14560     DALI_TEST_CHECK(false); // Should not get here
14561   }
14562   catch(...)
14563   {
14564     DALI_TEST_CHECK(true); // We expect an assert
14565   }
14566   END_TEST;
14567 }
14568
14569 int UtcDaliAnimationAnimateToNegative02(void)
14570 {
14571   TestApplication application;
14572   Dali::Animation instance;
14573   Dali::Actor     actor;
14574   try
14575   {
14576     Dali::Property        arg1(actor, Actor::Property::POSITION);
14577     Dali::Property::Value arg2;
14578     Dali::TimePeriod      arg3(1.0f);
14579     instance.AnimateTo(arg1, arg2, arg3);
14580     DALI_TEST_CHECK(false); // Should not get here
14581   }
14582   catch(...)
14583   {
14584     DALI_TEST_CHECK(true); // We expect an assert
14585   }
14586   END_TEST;
14587 }
14588
14589 int UtcDaliAnimationAnimateToNegative03(void)
14590 {
14591   TestApplication application;
14592   Dali::Animation instance;
14593   Dali::Actor     actor;
14594   try
14595   {
14596     Dali::Property        arg1(actor, Actor::Property::POSITION);
14597     Dali::Property::Value arg2;
14598     Dali::AlphaFunction   arg3;
14599     instance.AnimateTo(arg1, arg2, arg3);
14600     DALI_TEST_CHECK(false); // Should not get here
14601   }
14602   catch(...)
14603   {
14604     DALI_TEST_CHECK(true); // We expect an assert
14605   }
14606   END_TEST;
14607 }
14608
14609 int UtcDaliAnimationAnimateToNegative04(void)
14610 {
14611   TestApplication application;
14612   Dali::Animation instance;
14613   Dali::Actor     actor;
14614   try
14615   {
14616     Dali::Property        arg1(actor, Actor::Property::POSITION);
14617     Dali::Property::Value arg2;
14618     Dali::AlphaFunction   arg3;
14619     Dali::TimePeriod      arg4(1.0f);
14620     instance.AnimateTo(arg1, arg2, arg3, arg4);
14621     DALI_TEST_CHECK(false); // Should not get here
14622   }
14623   catch(...)
14624   {
14625     DALI_TEST_CHECK(true); // We expect an assert
14626   }
14627   END_TEST;
14628 }
14629
14630 int UtcDaliAnimationPlayAfterNegative(void)
14631 {
14632   TestApplication application;
14633   Dali::Animation instance;
14634   try
14635   {
14636     float arg1(0.0f);
14637     instance.PlayAfter(arg1);
14638     DALI_TEST_CHECK(false); // Should not get here
14639   }
14640   catch(...)
14641   {
14642     DALI_TEST_CHECK(true); // We expect an assert
14643   }
14644   END_TEST;
14645 }
14646
14647 int UtcDaliAnimationGetDurationNegative(void)
14648 {
14649   TestApplication application;
14650   Dali::Animation instance;
14651   try
14652   {
14653     instance.GetDuration();
14654     DALI_TEST_CHECK(false); // Should not get here
14655   }
14656   catch(...)
14657   {
14658     DALI_TEST_CHECK(true); // We expect an assert
14659   }
14660   END_TEST;
14661 }
14662
14663 int UtcDaliAnimationGetEndActionNegative(void)
14664 {
14665   TestApplication application;
14666   Dali::Animation instance;
14667   try
14668   {
14669     instance.GetEndAction();
14670     DALI_TEST_CHECK(false); // Should not get here
14671   }
14672   catch(...)
14673   {
14674     DALI_TEST_CHECK(true); // We expect an assert
14675   }
14676   END_TEST;
14677 }
14678
14679 int UtcDaliAnimationGetPlayRangeNegative(void)
14680 {
14681   TestApplication application;
14682   Dali::Animation instance;
14683   try
14684   {
14685     instance.GetPlayRange();
14686     DALI_TEST_CHECK(false); // Should not get here
14687   }
14688   catch(...)
14689   {
14690     DALI_TEST_CHECK(true); // We expect an assert
14691   }
14692   END_TEST;
14693 }
14694
14695 int UtcDaliAnimationGetLoopingModeNegative(void)
14696 {
14697   TestApplication application;
14698   Dali::Animation instance;
14699   try
14700   {
14701     instance.GetLoopingMode();
14702     DALI_TEST_CHECK(false); // Should not get here
14703   }
14704   catch(...)
14705   {
14706     DALI_TEST_CHECK(true); // We expect an assert
14707   }
14708   END_TEST;
14709 }
14710
14711 int UtcDaliAnimationGetSpeedFactorNegative(void)
14712 {
14713   TestApplication application;
14714   Dali::Animation instance;
14715   try
14716   {
14717     instance.GetSpeedFactor();
14718     DALI_TEST_CHECK(false); // Should not get here
14719   }
14720   catch(...)
14721   {
14722     DALI_TEST_CHECK(true); // We expect an assert
14723   }
14724   END_TEST;
14725 }
14726
14727 int UtcDaliAnimationGetDisconnectActionNegative(void)
14728 {
14729   TestApplication application;
14730   Dali::Animation instance;
14731   try
14732   {
14733     instance.GetDisconnectAction();
14734     DALI_TEST_CHECK(false); // Should not get here
14735   }
14736   catch(...)
14737   {
14738     DALI_TEST_CHECK(true); // We expect an assert
14739   }
14740   END_TEST;
14741 }
14742
14743 int UtcDaliAnimationGetDefaultAlphaFunctionNegative(void)
14744 {
14745   TestApplication application;
14746   Dali::Animation instance;
14747   try
14748   {
14749     instance.GetDefaultAlphaFunction();
14750     DALI_TEST_CHECK(false); // Should not get here
14751   }
14752   catch(...)
14753   {
14754     DALI_TEST_CHECK(true); // We expect an assert
14755   }
14756   END_TEST;
14757 }
14758
14759 int UtcDaliAnimationGetStateNegative(void)
14760 {
14761   TestApplication application;
14762   Dali::Animation instance;
14763   try
14764   {
14765     instance.GetState();
14766     DALI_TEST_CHECK(false); // Should not get here
14767   }
14768   catch(...)
14769   {
14770     DALI_TEST_CHECK(true); // We expect an assert
14771   }
14772   END_TEST;
14773 }
14774
14775 int UtcDaliAnimationIsLoopingNegative(void)
14776 {
14777   TestApplication application;
14778   Dali::Animation instance;
14779   try
14780   {
14781     instance.IsLooping();
14782     DALI_TEST_CHECK(false); // Should not get here
14783   }
14784   catch(...)
14785   {
14786     DALI_TEST_CHECK(true); // We expect an assert
14787   }
14788   END_TEST;
14789 }
14790
14791 int UtcDaliKeyFramesAddNegative01(void)
14792 {
14793   TestApplication application;
14794   Dali::KeyFrames instance;
14795   try
14796   {
14797     float                 arg1(0.0f);
14798     Dali::Property::Value arg2;
14799     instance.Add(arg1, arg2);
14800     DALI_TEST_CHECK(false); // Should not get here
14801   }
14802   catch(...)
14803   {
14804     DALI_TEST_CHECK(true); // We expect an assert
14805   }
14806   END_TEST;
14807 }
14808
14809 int UtcDaliKeyFramesAddNegative02(void)
14810 {
14811   TestApplication application;
14812   Dali::KeyFrames instance;
14813   try
14814   {
14815     float                 arg1(0.0f);
14816     Dali::Property::Value arg2;
14817     Dali::AlphaFunction   arg3;
14818     instance.Add(arg1, arg2, arg3);
14819     DALI_TEST_CHECK(false); // Should not get here
14820   }
14821   catch(...)
14822   {
14823     DALI_TEST_CHECK(true); // We expect an assert
14824   }
14825   END_TEST;
14826 }
14827
14828 int UtcDaliKeyFramesGetTypeNegative(void)
14829 {
14830   TestApplication application;
14831   Dali::KeyFrames instance;
14832   try
14833   {
14834     instance.GetType();
14835     DALI_TEST_CHECK(false); // Should not get here
14836   }
14837   catch(...)
14838   {
14839     DALI_TEST_CHECK(true); // We expect an assert
14840   }
14841   END_TEST;
14842 }