Set KeyFrame's frame value
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-Animation.cpp
1 /*
2  * Copyright (c) 2023 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 #include <dali-test-suite-utils.h>
19 #include <dali/devel-api/actors/actor-devel.h>
20 #include <dali/devel-api/animation/animation-devel.h>
21 #include <dali/devel-api/animation/key-frames-devel.h>
22 #include <dali/public-api/dali-core.h>
23 #include <stdlib.h>
24
25 #include <algorithm>
26 #include <iostream>
27
28 using std::max;
29 using namespace Dali;
30
31 void utc_dali_animation_startuP(void)
32 {
33   test_return_value = TET_UNDEF;
34 }
35
36 void utc_dali_animation_cleanuP(void)
37 {
38   test_return_value = TET_PASS;
39 }
40
41 namespace
42 {
43 static const float ROTATION_EPSILON = 0.0001f;
44 static const float VECTOR4_EPSILON  = 0.0001f;
45 static const float VECTOR3_EPSILON  = 0.0001f;
46
47 // Functor to test whether a Finish signal is emitted
48 struct AnimationFinishCheck
49 {
50   AnimationFinishCheck(bool& signalReceived)
51   : mSignalReceived(signalReceived)
52   {
53   }
54
55   void operator()(Animation& animation)
56   {
57     mSignalReceived = true;
58   }
59
60   void Reset()
61   {
62     mSignalReceived = false;
63   }
64
65   void CheckSignalReceived()
66   {
67     if(!mSignalReceived)
68     {
69       tet_printf("Expected Finish signal was not received\n");
70       tet_result(TET_FAIL);
71     }
72     else
73     {
74       tet_result(TET_PASS);
75     }
76   }
77
78   void CheckSignalNotReceived()
79   {
80     if(mSignalReceived)
81     {
82       tet_printf("Unexpected Finish signal was received\n");
83       tet_result(TET_FAIL);
84     }
85     else
86     {
87       tet_result(TET_PASS);
88     }
89   }
90
91   bool& mSignalReceived; // owned by individual tests
92 };
93
94 // Functor to test whether a Progress signal is emitted
95 struct AnimationProgressCheck
96 {
97   AnimationProgressCheck(bool& signalReceived, std::string name = " ")
98   : mSignalReceived(signalReceived),
99     mName(name)
100   {
101   }
102
103   void operator()(Animation& animation)
104   {
105     mSignalReceived = true;
106   }
107
108   void Reset()
109   {
110     mSignalReceived = false;
111   }
112
113   void CheckSignalReceived()
114   {
115     if(!mSignalReceived)
116     {
117       tet_printf("Expected Progress reached signal was not received %s \n", mName.c_str());
118       tet_result(TET_FAIL);
119     }
120     else
121     {
122       tet_result(TET_PASS);
123     }
124   }
125
126   void CheckSignalNotReceived()
127   {
128     if(mSignalReceived)
129     {
130       tet_printf("Unexpected Progress reached signal was received %s \n", mName.c_str());
131       tet_result(TET_FAIL);
132     }
133     else
134     {
135       tet_result(TET_PASS);
136     }
137   }
138
139   bool&       mSignalReceived; // owned by individual tests
140   std::string mName;
141 };
142
143 } // namespace
144
145 int UtcDaliAnimationConstructorP(void)
146 {
147   TestApplication application;
148
149   Animation animation;
150
151   DALI_TEST_CHECK(!animation);
152   END_TEST;
153 }
154
155 int UtcDaliAnimationNewP(void)
156 {
157   TestApplication application;
158
159   Animation animation = Animation::New(1.0f);
160
161   DALI_TEST_CHECK(animation);
162   END_TEST;
163 }
164
165 int UtcDaliAnimationNewN(void)
166 {
167   TestApplication application;
168
169   Animation animation = Animation::New(-1.0f);
170
171   DALI_TEST_CHECK(animation);
172   DALI_TEST_EQUALS(animation.GetDuration(), 0.0f, TEST_LOCATION);
173   END_TEST;
174 }
175
176 int UtcDaliAnimationDownCastP(void)
177 {
178   TestApplication application;
179
180   tet_infoline("Testing Dali::Animation::DownCast()");
181
182   float     durationSeconds(1.0f);
183   Animation animation = Animation::New(durationSeconds);
184
185   BaseHandle object(animation);
186
187   Animation animation2 = Animation::DownCast(object);
188   DALI_TEST_CHECK(animation2);
189
190   Animation animation3 = DownCast<Animation>(object);
191   DALI_TEST_CHECK(animation3);
192   END_TEST;
193 }
194
195 int UtcDaliAnimationDownCastN(void)
196 {
197   TestApplication application;
198
199   BaseHandle unInitializedObject;
200
201   Animation animation1 = Animation::DownCast(unInitializedObject);
202   DALI_TEST_CHECK(!animation1);
203
204   Animation animation2 = DownCast<Animation>(unInitializedObject);
205   DALI_TEST_CHECK(!animation2);
206   END_TEST;
207 }
208
209 int UtcDaliAnimationCopyConstructorP(void)
210 {
211   TestApplication application;
212
213   // Initialize an object, ref count == 1
214   Animation animation = Animation::New(1.0f);
215
216   Animation copy(animation);
217   DALI_TEST_CHECK(copy);
218
219   DALI_TEST_CHECK(copy.GetDuration() == animation.GetDuration());
220   END_TEST;
221 }
222
223 int UtcDaliAnimationAssignmentOperatorP(void)
224 {
225   TestApplication application;
226
227   Animation animation = Animation::New(1.0f);
228
229   Animation copy = animation;
230   DALI_TEST_CHECK(copy);
231
232   DALI_TEST_CHECK(animation == copy);
233
234   DALI_TEST_CHECK(copy.GetDuration() == animation.GetDuration());
235   END_TEST;
236 }
237
238 int UtcDaliAnimationMoveConstructor(void)
239 {
240   TestApplication application;
241
242   //Animation
243
244   Animation animation = Animation::New(1.0f);
245   DALI_TEST_CHECK(animation);
246   DALI_TEST_EQUALS(1, animation.GetBaseObject().ReferenceCount(), TEST_LOCATION);
247   DALI_TEST_EQUALS(1.0f, animation.GetDuration(), 0.001f, TEST_LOCATION);
248
249   Animation movedAnimation = std::move(animation);
250   DALI_TEST_CHECK(movedAnimation);
251   DALI_TEST_EQUALS(1, movedAnimation.GetBaseObject().ReferenceCount(), TEST_LOCATION);
252   DALI_TEST_EQUALS(1.0f, movedAnimation.GetDuration(), 0.001f, TEST_LOCATION);
253   DALI_TEST_CHECK(!animation);
254
255   // KeyFrames
256
257   KeyFrames keyframes = KeyFrames::New();
258   DALI_TEST_CHECK(keyframes);
259   DALI_TEST_EQUALS(1, keyframes.GetBaseObject().ReferenceCount(), TEST_LOCATION);
260   DALI_TEST_EQUALS(Property::Type::NONE, keyframes.GetType(), TEST_LOCATION);
261
262   keyframes.Add(0.0f, Vector3(0.0f, 0.0f, 0.0f));
263   keyframes.Add(1.0f, Vector3(100.0f, 100.0f, 100.0f));
264   DALI_TEST_EQUALS(Property::Type::VECTOR3, keyframes.GetType(), TEST_LOCATION);
265
266   KeyFrames movedKeyFrames = std::move(keyframes);
267   DALI_TEST_CHECK(movedKeyFrames);
268   DALI_TEST_EQUALS(1, movedKeyFrames.GetBaseObject().ReferenceCount(), TEST_LOCATION);
269   DALI_TEST_EQUALS(Property::Type::VECTOR3, movedKeyFrames.GetType(), TEST_LOCATION);
270   DALI_TEST_CHECK(!keyframes);
271
272   END_TEST;
273 }
274
275 int UtcDaliAnimationMoveAssignment(void)
276 {
277   TestApplication application;
278
279   // Animation
280
281   Animation animation = Animation::New(1.0f);
282   DALI_TEST_CHECK(animation);
283   DALI_TEST_EQUALS(1, animation.GetBaseObject().ReferenceCount(), TEST_LOCATION);
284   DALI_TEST_EQUALS(1.0f, animation.GetDuration(), 0.001f, TEST_LOCATION);
285
286   Animation move;
287   move = std::move(animation);
288   DALI_TEST_CHECK(move);
289   DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
290   DALI_TEST_EQUALS(1.0f, move.GetDuration(), 0.001f, TEST_LOCATION);
291   DALI_TEST_CHECK(!animation);
292
293   // KeyFrames
294
295   KeyFrames keyframes = KeyFrames::New();
296   DALI_TEST_CHECK(keyframes);
297   DALI_TEST_EQUALS(1, keyframes.GetBaseObject().ReferenceCount(), TEST_LOCATION);
298   DALI_TEST_EQUALS(Property::Type::NONE, keyframes.GetType(), TEST_LOCATION);
299
300   keyframes.Add(0.0f, Vector3(0.0f, 0.0f, 0.0f));
301   keyframes.Add(1.0f, Vector3(100.0f, 100.0f, 100.0f));
302   DALI_TEST_EQUALS(Property::Type::VECTOR3, keyframes.GetType(), TEST_LOCATION);
303
304   KeyFrames movedKeyFrames;
305   movedKeyFrames = std::move(keyframes);
306   DALI_TEST_CHECK(movedKeyFrames);
307   DALI_TEST_EQUALS(1, movedKeyFrames.GetBaseObject().ReferenceCount(), TEST_LOCATION);
308   DALI_TEST_EQUALS(Property::Type::VECTOR3, movedKeyFrames.GetType(), TEST_LOCATION);
309   DALI_TEST_CHECK(!keyframes);
310
311   END_TEST;
312 }
313
314 int UtcDaliAnimationSetDurationP(void)
315 {
316   TestApplication application;
317
318   Actor actor = Actor::New();
319   application.GetScene().Add(actor);
320
321   // Build the animation
322   float     durationSeconds(1.0f);
323   Animation animation = Animation::New(durationSeconds);
324   DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
325
326   // Start the animation
327   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
328   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
329   animation.Play();
330
331   bool                 signalReceived(false);
332   AnimationFinishCheck finishCheck(signalReceived);
333   animation.FinishedSignal().Connect(&application, finishCheck);
334
335   application.SendNotification();
336   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
337
338   // We didn't expect the animation to finish yet
339   application.SendNotification();
340   finishCheck.CheckSignalNotReceived();
341
342   application.Render(2u /*just beyond the animation duration*/);
343
344   // We did expect the animation to finish
345   application.SendNotification();
346   finishCheck.CheckSignalReceived();
347   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
348
349   // Restart the animation, with a different duration
350   finishCheck.Reset();
351   actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO);
352   durationSeconds = 3.5f;
353   animation.SetDuration(durationSeconds);
354   DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
355   animation.Play();
356
357   application.SendNotification();
358   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
359
360   // We didn't expect the animation to finish yet
361   application.SendNotification();
362   finishCheck.CheckSignalNotReceived();
363
364   application.Render(2u /*just beyond the animation duration*/);
365
366   // We did expect the animation to finish
367   application.SendNotification();
368   finishCheck.CheckSignalReceived();
369   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
370
371   // Check that nothing has changed after a couple of buffer swaps
372   application.Render(0);
373   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
374   application.Render(0);
375   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
376   END_TEST;
377 }
378
379 int UtcDaliAnimationSetDurationN(void)
380 {
381   TestApplication application;
382
383   Animation animation = Animation::New(1.0f);
384   DALI_TEST_EQUALS(animation.GetDuration(), 1.0f, TEST_LOCATION);
385
386   animation.SetDuration(-1.0f);
387   DALI_TEST_EQUALS(animation.GetDuration(), 0.0f, TEST_LOCATION);
388   END_TEST;
389 }
390
391 int UtcDaliAnimationGetDurationP(void)
392 {
393   TestApplication application;
394
395   Animation animation = Animation::New(1.0f);
396   DALI_TEST_EQUALS(animation.GetDuration(), 1.0f, TEST_LOCATION);
397
398   animation.SetDuration(2.0f);
399   DALI_TEST_EQUALS(animation.GetDuration(), 2.0f, TEST_LOCATION);
400   END_TEST;
401 }
402
403 int UtcDaliAnimationSetLoopingP(void)
404 {
405   TestApplication application;
406
407   Actor actor = Actor::New();
408   application.GetScene().Add(actor);
409
410   // Build the animation
411   float     durationSeconds(1.0f);
412   Animation animation = Animation::New(durationSeconds);
413   Vector3   targetPosition(10.0f, 10.0f, 10.0f);
414   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
415
416   // Start the animation
417   animation.SetLooping(true);
418   DALI_TEST_CHECK(animation.IsLooping());
419   animation.Play();
420
421   bool                 signalReceived(false);
422   AnimationFinishCheck finishCheck(signalReceived);
423   animation.FinishedSignal().Connect(&application, finishCheck);
424
425   application.SendNotification();
426
427   // Loop 5 times
428   float intervalSeconds = 0.25f;
429   float progress        = 0.0f;
430   for(int iterations = 0; iterations < 5;)
431   {
432     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
433
434     progress += intervalSeconds;
435     DALI_TEST_EQUALS(targetPosition * progress, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.001f, TEST_LOCATION);
436
437     if(progress >= 1.0f)
438     {
439       progress = progress - 1.0f;
440       ++iterations;
441     }
442   }
443
444   // We didn't expect the animation to finish yet
445   application.SendNotification();
446   finishCheck.CheckSignalNotReceived();
447
448   animation.SetLooping(false);
449   DALI_TEST_CHECK(!animation.IsLooping());
450
451   application.SendNotification();
452   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
453
454   // We did expect the animation to finish
455   application.SendNotification();
456   finishCheck.CheckSignalReceived();
457   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
458
459   // Check that nothing has changed after a couple of buffer swaps
460   application.Render(0);
461   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
462   application.Render(0);
463   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
464   END_TEST;
465 }
466
467 int UtcDaliAnimationSetLoopCountP(void)
468 {
469   TestApplication application;
470
471   Actor actor = Actor::New();
472   application.GetScene().Add(actor);
473
474   // Build the animation
475   float     durationSeconds(1.0f);
476   Animation animation = Animation::New(durationSeconds);
477   Vector3   targetPosition(10.0f, 10.0f, 10.0f);
478   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
479
480   // Start the animation
481   animation.SetLoopCount(3);
482   DALI_TEST_CHECK(animation.IsLooping());
483   animation.Play();
484
485   bool                 signalReceived(false);
486   AnimationFinishCheck finishCheck(signalReceived);
487   animation.FinishedSignal().Connect(&application, finishCheck);
488
489   application.Render(0);
490   application.SendNotification();
491   application.Render(0);
492   application.SendNotification();
493   application.Render(0);
494   application.SendNotification();
495   application.Render(0);
496   application.SendNotification();
497
498   // Loop
499   float intervalSeconds = 3.0f;
500
501   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
502   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
503
504   application.Render(0);
505   application.SendNotification();
506   application.Render(0);
507   application.SendNotification();
508   application.Render(0);
509   application.SendNotification();
510   application.Render(0);
511   application.SendNotification();
512   finishCheck.CheckSignalNotReceived();
513
514   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
515
516   application.SendNotification();
517   finishCheck.CheckSignalReceived();
518   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
519
520   finishCheck.Reset();
521
522   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
523   application.SendNotification();
524   finishCheck.CheckSignalNotReceived();
525
526   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
527   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
528   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
529   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
530   application.SendNotification();
531   finishCheck.CheckSignalNotReceived();
532
533   END_TEST;
534 }
535
536 int UtcDaliAnimationSetLoopCountP2(void)
537 {
538   TestApplication application;
539
540   //
541   // switching between forever and loop count
542   //
543
544   Actor actor = Actor::New();
545   application.GetScene().Add(actor);
546
547   // Build the animation
548   float     durationSeconds(1.0f);
549   Animation animation = Animation::New(durationSeconds);
550   Vector3   targetPosition(10.0f, 10.0f, 10.0f);
551   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
552   animation.SetEndAction(Animation::DISCARD);
553
554   // Start the animation
555   animation.SetLoopCount(3);
556   DALI_TEST_CHECK(animation.IsLooping());
557   animation.Play();
558
559   bool                 signalReceived(false);
560   AnimationFinishCheck finishCheck(signalReceived);
561   animation.FinishedSignal().Connect(&application, finishCheck);
562
563   float intervalSeconds = 3.0f;
564
565   application.SendNotification();
566   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
567   application.SendNotification();
568   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
569   application.SendNotification();
570   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
571   application.SendNotification();
572
573   application.SendNotification();
574   finishCheck.CheckSignalReceived();
575
576   finishCheck.Reset();
577
578   // Loop forever
579   animation.SetLooping(true);
580   DALI_TEST_CHECK(animation.IsLooping());
581
582   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
583   application.SendNotification();
584   finishCheck.CheckSignalNotReceived();
585
586   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
587   application.SendNotification();
588   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
589   application.SendNotification();
590   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
591   application.SendNotification();
592   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
593   application.SendNotification();
594   application.SendNotification();
595   finishCheck.CheckSignalNotReceived();
596
597   finishCheck.Reset();
598
599   // Loop N again
600   animation.SetLoopCount(3);
601   DALI_TEST_CHECK(animation.IsLooping());
602   animation.Play();
603
604   application.SendNotification();
605   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
606   application.SendNotification();
607   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
608   application.SendNotification();
609   finishCheck.CheckSignalNotReceived();
610
611   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
612   application.SendNotification();
613   finishCheck.CheckSignalReceived();
614
615   finishCheck.Reset();
616
617   // loop forever
618   animation.SetLooping(true);
619   DALI_TEST_CHECK(animation.IsLooping());
620
621   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
622   application.SendNotification();
623   finishCheck.CheckSignalNotReceived();
624
625   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
626   application.SendNotification();
627   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
628   application.SendNotification();
629   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
630   application.SendNotification();
631   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
632   application.SendNotification();
633   finishCheck.CheckSignalNotReceived();
634
635   finishCheck.Reset();
636
637   // Loop N again
638   animation.SetLoopCount(3);
639   DALI_TEST_CHECK(animation.IsLooping());
640
641   application.SendNotification();
642   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
643   application.SendNotification();
644   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
645   application.SendNotification();
646   finishCheck.CheckSignalNotReceived();
647
648   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
649   application.SendNotification();
650   finishCheck.CheckSignalNotReceived(); // we never hit play
651
652   finishCheck.Reset();
653
654   END_TEST;
655 }
656
657 int UtcDaliAnimationSetLoopCountP3(void)
658 {
659   TestApplication application;
660
661   //
662   // switching between forever and loop count
663   //
664   Actor actor = Actor::New();
665   application.GetScene().Add(actor);
666
667   // Build the animation
668   float     durationSeconds(1.0f);
669   Animation animation = Animation::New(durationSeconds);
670   Vector3   targetPosition(10.0f, 10.0f, 10.0f);
671   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
672   animation.SetEndAction(Animation::DISCARD);
673
674   float intervalSeconds = 3.0f;
675
676   bool                 signalReceived(false);
677   AnimationFinishCheck finishCheck(signalReceived);
678   animation.FinishedSignal().Connect(&application, finishCheck);
679
680   // loop forever
681   animation.SetLooping(true);
682   DALI_TEST_CHECK(animation.IsLooping());
683
684   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
685   application.SendNotification();
686   finishCheck.CheckSignalNotReceived();
687
688   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
689   application.SendNotification();
690   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
691   application.SendNotification();
692   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
693   application.SendNotification();
694   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
695   application.SendNotification();
696   finishCheck.CheckSignalNotReceived();
697
698   finishCheck.Reset();
699
700   // Loop N again
701   animation.SetLoopCount(3);
702   DALI_TEST_CHECK(animation.IsLooping());
703
704   application.SendNotification();
705   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
706   application.SendNotification();
707   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
708   application.SendNotification();
709   finishCheck.CheckSignalNotReceived();
710
711   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
712   application.SendNotification();
713   finishCheck.CheckSignalNotReceived(); // we never hit play
714
715   finishCheck.Reset();
716
717   END_TEST;
718 }
719
720 int UtcDaliAnimationSetLoopCountP4(void)
721 {
722   TestApplication application;
723
724   //
725   // ..and play again
726   //
727   Actor actor = Actor::New();
728   application.GetScene().Add(actor);
729
730   // Build the animation
731   float     durationSeconds(1.0f);
732   Animation animation = Animation::New(durationSeconds);
733   Vector3   targetPosition(10.0f, 10.0f, 10.0f);
734   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
735   animation.SetEndAction(Animation::BAKE);
736
737   float intervalSeconds = 3.0f;
738
739   bool                 signalReceived(false);
740   AnimationFinishCheck finishCheck(signalReceived);
741   animation.FinishedSignal().Connect(&application, finishCheck);
742
743   animation.SetLoopCount(1);
744   animation.Play();
745   DALI_TEST_CHECK(!animation.IsLooping());
746
747   application.SendNotification();
748   finishCheck.CheckSignalNotReceived();
749   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
750   application.SendNotification();
751   finishCheck.CheckSignalReceived();
752
753   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
754   actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
755
756   finishCheck.Reset();
757
758   animation.Play(); // again
759   DALI_TEST_CHECK(!animation.IsLooping());
760
761   application.SendNotification();
762   finishCheck.CheckSignalNotReceived();
763   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
764   application.SendNotification();
765   finishCheck.CheckSignalReceived();
766
767   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
768
769   END_TEST;
770 }
771
772 int UtcDaliAnimationGetLoopCountP(void)
773 {
774   TestApplication application;
775
776   Actor actor = Actor::New();
777   application.GetScene().Add(actor);
778
779   // Build the animation
780   float     durationSeconds(1.0f);
781   Animation animation = Animation::New(durationSeconds);
782   Vector3   targetPosition(10.0f, 10.0f, 10.0f);
783   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
784
785   DALI_TEST_CHECK(1 == animation.GetLoopCount());
786
787   // Start the animation
788   animation.SetLoopCount(3);
789   DALI_TEST_CHECK(animation.IsLooping());
790   DALI_TEST_CHECK(3 == animation.GetLoopCount());
791
792   animation.Play();
793
794   application.Render(0);
795   application.SendNotification();
796
797   // Loop
798   float intervalSeconds = 3.0f;
799
800   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
801   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
802
803   application.Render(0);
804   application.SendNotification();
805
806   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
807   application.SendNotification();
808
809   animation.SetLoopCount(0);
810   DALI_TEST_CHECK(animation.IsLooping());
811   DALI_TEST_CHECK(0 == animation.GetLoopCount());
812
813   animation.SetLoopCount(1);
814   DALI_TEST_CHECK(!animation.IsLooping());
815   DALI_TEST_CHECK(1 == animation.GetLoopCount());
816
817   END_TEST;
818 }
819
820 int UtcDaliAnimationGetCurrentLoopP(void)
821 {
822   TestApplication application;
823
824   Actor actor = Actor::New();
825   application.GetScene().Add(actor);
826
827   // Build the animation
828   float     durationSeconds(1.0f);
829   Animation animation = Animation::New(durationSeconds);
830   Vector3   targetPosition(10.0f, 10.0f, 10.0f);
831   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
832
833   // Start the animation
834   animation.SetLoopCount(3);
835   DALI_TEST_CHECK(animation.IsLooping());
836   DALI_TEST_CHECK(0 == animation.GetCurrentLoop());
837   animation.Play();
838
839   bool                 signalReceived(false);
840   AnimationFinishCheck finishCheck(signalReceived);
841   animation.FinishedSignal().Connect(&application, finishCheck);
842
843   application.SendNotification();
844
845   // Loop
846   float intervalSeconds = 3.0f;
847
848   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
849   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
850
851   application.SendNotification();
852   finishCheck.CheckSignalNotReceived();
853   DALI_TEST_CHECK(2 == animation.GetCurrentLoop());
854
855   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
856
857   application.SendNotification();
858   finishCheck.CheckSignalReceived();
859   DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
860   DALI_TEST_CHECK(animation.GetLoopCount() == animation.GetCurrentLoop());
861
862   finishCheck.Reset();
863
864   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
865   application.SendNotification();
866   finishCheck.CheckSignalNotReceived();
867   DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
868
869   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
870   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
871   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
872   application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
873   application.SendNotification();
874   finishCheck.CheckSignalNotReceived();
875   DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
876
877   END_TEST;
878 }
879
880 int UtcDaliAnimationIsLoopingP(void)
881 {
882   TestApplication application;
883
884   Animation animation = Animation::New(1.0f);
885   DALI_TEST_CHECK(!animation.IsLooping());
886
887   animation.SetLooping(true);
888   DALI_TEST_CHECK(animation.IsLooping());
889   END_TEST;
890 }
891
892 int UtcDaliAnimationSetEndActionN(void)
893 {
894   TestApplication application;
895
896   Actor actor = Actor::New();
897   application.GetScene().Add(actor);
898
899   // Build the animation
900   float     durationSeconds(1.0f);
901   Animation animation = Animation::New(durationSeconds);
902   DALI_TEST_CHECK(animation.GetEndAction() == Animation::BAKE);
903
904   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
905   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
906
907   // Start the animation
908   animation.Play();
909
910   bool                 signalReceived(false);
911   AnimationFinishCheck finishCheck(signalReceived);
912   animation.FinishedSignal().Connect(&application, finishCheck);
913
914   application.SendNotification();
915   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
916
917   // We did expect the animation to finish
918   application.SendNotification();
919   finishCheck.CheckSignalReceived();
920   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
921
922   // Go back to the start
923   actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO);
924   application.SendNotification();
925   application.Render(0);
926   DALI_TEST_EQUALS(Vector3::ZERO, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
927
928   // Test BakeFinal, animate again, for half the duration
929   finishCheck.Reset();
930   animation.SetEndAction(Animation::BAKE_FINAL);
931   DALI_TEST_CHECK(animation.GetEndAction() == Animation::BAKE_FINAL);
932   animation.Play();
933
934   application.SendNotification();
935   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f * 0.5f) /*half of the animation duration*/);
936
937   // Stop the animation early
938   animation.Stop();
939
940   // We did NOT expect the animation to finish
941   application.SendNotification();
942   finishCheck.CheckSignalNotReceived();
943   DALI_TEST_EQUALS(targetPosition * 0.5f, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), VECTOR4_EPSILON, TEST_LOCATION);
944
945   // The position should be same with target position in the next frame
946   application.Render(0);
947   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
948
949   // Go back to the start
950   actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO);
951   application.SendNotification();
952   application.Render(0);
953   DALI_TEST_EQUALS(Vector3::ZERO, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
954
955   // Test EndAction::Discard, animate again, but don't bake this time
956   finishCheck.Reset();
957   animation.SetEndAction(Animation::DISCARD);
958   DALI_TEST_CHECK(animation.GetEndAction() == Animation::DISCARD);
959   animation.Play();
960
961   application.SendNotification();
962   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
963
964   // We did expect the animation to finish
965   application.SendNotification();
966   finishCheck.CheckSignalReceived();
967   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
968
969   // The position should be discarded in the next frame
970   application.Render(0);
971   DALI_TEST_EQUALS(Vector3::ZERO /*discarded*/, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
972
973   // Check that nothing has changed after a couple of buffer swaps
974   application.Render(0);
975   DALI_TEST_EQUALS(Vector3::ZERO, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
976   application.Render(0);
977   DALI_TEST_EQUALS(Vector3::ZERO, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
978   END_TEST;
979 }
980
981 int UtcDaliAnimationGetEndActionP(void)
982 {
983   TestApplication application;
984
985   Animation animation = Animation::New(1.0f);
986   DALI_TEST_CHECK(animation.GetEndAction() == Animation::BAKE);
987
988   animation.SetEndAction(Animation::DISCARD);
989   DALI_TEST_CHECK(animation.GetEndAction() == Animation::DISCARD);
990
991   animation.SetEndAction(Animation::BAKE_FINAL);
992   DALI_TEST_CHECK(animation.GetEndAction() == Animation::BAKE_FINAL);
993
994   END_TEST;
995 }
996
997 int UtcDaliAnimationSetDisconnectActionP(void)
998 {
999   TestApplication    application;
1000   Integration::Scene stage(application.GetScene());
1001
1002   // Default: BakeFinal
1003   {
1004     Actor actor = Actor::New();
1005     stage.Add(actor);
1006
1007     // Build the animation
1008     float     durationSeconds(1.0f);
1009     Animation animation = Animation::New(durationSeconds);
1010     DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BAKE_FINAL);
1011
1012     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
1013     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1014
1015     // Start the animation
1016     animation.Play();
1017
1018     application.SendNotification();
1019     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
1020
1021     actor.Unparent();
1022
1023     application.SendNotification();
1024     application.Render();
1025
1026     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
1027   }
1028
1029   // Bake
1030   {
1031     Actor actor = Actor::New();
1032     stage.Add(actor);
1033
1034     // Build the animation
1035     float     durationSeconds(1.0f);
1036     Animation animation = Animation::New(durationSeconds);
1037     animation.SetDisconnectAction(Animation::BAKE);
1038
1039     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
1040     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1041
1042     // Start the animation
1043     animation.Play();
1044
1045     application.SendNotification();
1046     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
1047
1048     actor.Unparent();
1049
1050     application.SendNotification();
1051     application.Render();
1052
1053     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition * 0.5f, TEST_LOCATION);
1054   }
1055
1056   // Discard
1057   {
1058     Actor actor = Actor::New();
1059     stage.Add(actor);
1060
1061     // Build the animation
1062     float     durationSeconds(1.0f);
1063     Animation animation = Animation::New(durationSeconds);
1064     animation.SetDisconnectAction(Animation::DISCARD);
1065
1066     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
1067     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1068
1069     // Start the animation
1070     animation.Play();
1071
1072     application.SendNotification();
1073     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
1074
1075     actor.Unparent();
1076
1077     application.SendNotification();
1078     application.Render();
1079
1080     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
1081   }
1082
1083   // Don't play the animation: disconnect action should not be applied
1084   {
1085     Actor actor = Actor::New();
1086     stage.Add(actor);
1087
1088     // Build the animation
1089     float     durationSeconds(1.0f);
1090     Animation animation = Animation::New(durationSeconds);
1091
1092     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
1093     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1094
1095     application.SendNotification();
1096     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
1097
1098     actor.Unparent();
1099
1100     application.SendNotification();
1101     application.Render();
1102
1103     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
1104   }
1105
1106   END_TEST;
1107 }
1108
1109 int UtcDaliAnimationGetDisconnectActionP(void)
1110 {
1111   TestApplication application;
1112   Animation       animation = Animation::New(1.0f);
1113   DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BAKE_FINAL); // default!
1114
1115   animation.SetDisconnectAction(Animation::DISCARD);
1116   DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::DISCARD);
1117
1118   animation.SetDisconnectAction(Animation::BAKE);
1119   DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BAKE);
1120
1121   END_TEST;
1122 }
1123
1124 int UtcDaliAnimationSetDefaultAlphaFunctionP(void)
1125 {
1126   TestApplication application;
1127
1128   Animation     animation = Animation::New(1.0f);
1129   AlphaFunction func      = animation.GetDefaultAlphaFunction();
1130   DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1131
1132   animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1133   AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1134   DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1135   END_TEST;
1136 }
1137
1138 int UtcDaliAnimationGetDefaultAlphaFunctionP(void)
1139 {
1140   TestApplication application;
1141
1142   Animation     animation = Animation::New(1.0f);
1143   AlphaFunction func      = animation.GetDefaultAlphaFunction();
1144
1145   // Test that the default is linear
1146   DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1147
1148   animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1149   AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1150   DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1151
1152   END_TEST;
1153 }
1154
1155 int UtcDaliAnimationSetCurrentProgressP(void)
1156 {
1157   TestApplication application;
1158
1159   Actor actor = Actor::New();
1160   application.GetScene().Add(actor);
1161
1162   // Build the animation
1163   Animation animation = Animation::New(0.0f);
1164
1165   //Set duration
1166   float durationSeconds(1.0f);
1167   animation.SetDuration(durationSeconds);
1168
1169   bool                 signalReceived(false);
1170   AnimationFinishCheck finishCheck(signalReceived);
1171   animation.FinishedSignal().Connect(&application, finishCheck);
1172   application.SendNotification();
1173
1174   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1175   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1176
1177   // Start the animation from 40% progress
1178   animation.SetCurrentProgress(0.4f);
1179   animation.Play();
1180
1181   application.SendNotification();
1182   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
1183
1184   // We didn't expect the animation to finish yet
1185   application.SendNotification();
1186   finishCheck.CheckSignalNotReceived();
1187   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
1188   DALI_TEST_EQUALS(0.6f, animation.GetCurrentProgress(), TEST_LOCATION);
1189
1190   animation.Play(); // Test that calling play has no effect, when animation is already playing
1191   application.SendNotification();
1192
1193   //Set the progress to 70%
1194   animation.SetCurrentProgress(0.7f);
1195   application.SendNotification();
1196   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 80% progress */);
1197   DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
1198
1199   application.SendNotification();
1200   finishCheck.CheckSignalNotReceived();
1201   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
1202   DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
1203
1204   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
1205   // We did expect the animation to finish
1206   application.SendNotification();
1207   finishCheck.CheckSignalReceived();
1208   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
1209
1210   // Check that nothing has changed after a couple of buffer swaps
1211   application.Render(0);
1212   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1213   application.Render(0);
1214   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1215   END_TEST;
1216 }
1217
1218 int UtcDaliAnimationSetCurrentProgressN(void)
1219 {
1220   TestApplication application;
1221
1222   Actor actor = Actor::New();
1223   application.GetScene().Add(actor);
1224
1225   // Build the animation
1226   Animation animation = Animation::New(0.0f);
1227
1228   //Set duration
1229   float durationSeconds(1.0f);
1230   animation.SetDuration(durationSeconds);
1231
1232   bool                 signalReceived(false);
1233   AnimationFinishCheck finishCheck(signalReceived);
1234   animation.FinishedSignal().Connect(&application, finishCheck);
1235   application.SendNotification();
1236
1237   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1238   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1239
1240   //Trying to set the current cursor outside the range [0..1] is ignored
1241   animation.SetCurrentProgress(-1.0f);
1242   application.SendNotification();
1243   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
1244
1245   animation.SetCurrentProgress(100.0f);
1246   application.SendNotification();
1247   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
1248   END_TEST;
1249 }
1250
1251 int UtcDaliAnimationGetCurrentProgressP(void)
1252 {
1253   TestApplication application;
1254
1255   Actor actor = Actor::New();
1256   application.GetScene().Add(actor);
1257
1258   // Build the animation
1259   Animation animation = Animation::New(0.0f);
1260   animation.Play();
1261
1262   //Test GetCurrentProgress return 0.0 as the duration is 0.0
1263   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
1264
1265   animation.SetCurrentProgress(0.5f);
1266   application.SendNotification();
1267   application.Render(static_cast<unsigned int>(100.0f));
1268
1269   //Progress should still be 0.0
1270   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
1271
1272   //Set duration
1273   float durationSeconds(1.0f);
1274   animation.SetDuration(durationSeconds);
1275   application.SendNotification();
1276
1277   bool                 signalReceived(false);
1278   AnimationFinishCheck finishCheck(signalReceived);
1279   animation.FinishedSignal().Connect(&application, finishCheck);
1280   application.SendNotification();
1281
1282   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1283   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1284
1285   // Start the animation from 40% progress
1286   animation.SetCurrentProgress(0.4f);
1287   animation.Play();
1288
1289   application.SendNotification();
1290   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
1291
1292   // We didn't expect the animation to finish yet
1293   application.SendNotification();
1294   finishCheck.CheckSignalNotReceived();
1295   DALI_TEST_EQUALS(0.6f, animation.GetCurrentProgress(), TEST_LOCATION);
1296
1297   animation.Play(); // Test that calling play has no effect, when animation is already playing
1298   application.SendNotification();
1299
1300   //Set the progress to 70%
1301   animation.SetCurrentProgress(0.7f);
1302   application.SendNotification();
1303   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 80% progress */);
1304   DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
1305
1306   application.SendNotification();
1307   finishCheck.CheckSignalNotReceived();
1308   DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
1309
1310   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
1311   // We did expect the animation to finish
1312   application.SendNotification();
1313   finishCheck.CheckSignalReceived();
1314   END_TEST;
1315 }
1316
1317 int UtcDaliAnimationSetSpeedFactorP1(void)
1318 {
1319   TestApplication application;
1320
1321   tet_printf("Testing that setting a speed factor of 2 takes half the time\n");
1322
1323   Actor actor = Actor::New();
1324   application.GetScene().Add(actor);
1325
1326   // Build the animation
1327   float     durationSeconds(1.0f);
1328   Animation animation = Animation::New(durationSeconds);
1329
1330   const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1331   const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1332
1333   KeyFrames keyframes = KeyFrames::New();
1334   keyframes.Add(0.0f, initialPosition);
1335   keyframes.Add(1.0f, targetPosition);
1336   animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1337
1338   //Set speed to be x2
1339   animation.SetSpeedFactor(2.0f);
1340
1341   // Start the animation
1342   animation.Play();
1343
1344   bool                 signalReceived(false);
1345   AnimationFinishCheck finishCheck(signalReceived);
1346   animation.FinishedSignal().Connect(&application, finishCheck);
1347
1348   application.SendNotification();
1349   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
1350
1351   // We didn't expect the animation to finish yet
1352   application.SendNotification();
1353   finishCheck.CheckSignalNotReceived();
1354   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION);
1355
1356   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
1357
1358   // We didn't expect the animation to finish yet
1359   application.SendNotification();
1360   finishCheck.CheckSignalNotReceived();
1361   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
1362
1363   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1u /*just beyond half the duration*/);
1364
1365   // We did expect the animation to finish
1366   application.SendNotification();
1367   finishCheck.CheckSignalReceived();
1368   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
1369
1370   // Check that nothing has changed after a couple of buffer swaps
1371   application.Render(0);
1372   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1373   application.Render(0);
1374   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1375
1376   END_TEST;
1377 }
1378
1379 int UtcDaliAnimationSetSpeedFactorP2(void)
1380 {
1381   TestApplication application;
1382
1383   Actor actor = Actor::New();
1384   application.GetScene().Add(actor);
1385
1386   // Build the animation
1387   float     durationSeconds(1.0f);
1388   Animation animation = Animation::New(durationSeconds);
1389
1390   const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1391   const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1392
1393   KeyFrames keyframes = KeyFrames::New();
1394   keyframes.Add(0.0f, initialPosition);
1395   keyframes.Add(1.0f, targetPosition);
1396   animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1397
1398   tet_printf("Test -1 speed factor. Animation will play in reverse at normal speed\n");
1399   animation.SetSpeedFactor(-1.0f);
1400
1401   // Start the animation
1402   animation.Play();
1403
1404   bool                 signalReceived(false);
1405   AnimationFinishCheck finishCheck(signalReceived);
1406   animation.FinishedSignal().Connect(&application, finishCheck);
1407
1408   application.SendNotification();
1409   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
1410
1411   // We didn't expect the animation to finish yet
1412   application.SendNotification();
1413   finishCheck.CheckSignalNotReceived();
1414   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
1415
1416   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
1417
1418   // We didn't expect the animation to finish yet
1419   application.SendNotification();
1420   finishCheck.CheckSignalNotReceived();
1421   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
1422
1423   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
1424
1425   // We didn't expect the animation to finish yet
1426   application.SendNotification();
1427   finishCheck.CheckSignalNotReceived();
1428   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION);
1429
1430   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
1431
1432   // We didn't expect the animation to finish yet
1433   application.SendNotification();
1434   finishCheck.CheckSignalNotReceived();
1435   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
1436
1437   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
1438
1439   // We did expect the animation to finish
1440   application.SendNotification();
1441   finishCheck.CheckSignalReceived();
1442   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), initialPosition, TEST_LOCATION);
1443
1444   // Check that nothing has changed after a couple of buffer swaps
1445   application.Render(0);
1446   DALI_TEST_EQUALS(initialPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1447   application.Render(0);
1448   DALI_TEST_EQUALS(initialPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1449
1450   END_TEST;
1451 }
1452
1453 int UtcDaliAnimationSetSpeedFactorP3(void)
1454 {
1455   TestApplication application;
1456
1457   Actor actor = Actor::New();
1458   application.GetScene().Add(actor);
1459
1460   // Build the animation
1461   float     durationSeconds(1.0f);
1462   Animation animation = Animation::New(durationSeconds);
1463
1464   const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1465   const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1466
1467   KeyFrames keyframes = KeyFrames::New();
1468   keyframes.Add(0.0f, initialPosition);
1469   keyframes.Add(1.0f, targetPosition);
1470   animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1471
1472   bool                 signalReceived(false);
1473   AnimationFinishCheck finishCheck(signalReceived);
1474   animation.FinishedSignal().Connect(&application, finishCheck);
1475
1476   tet_printf("Test half speed factor. Animation will take twice the duration\n");
1477
1478   //Set speed to be half of normal speed
1479   animation.SetSpeedFactor(0.5f);
1480
1481   // Start the animation
1482   animation.Play();
1483
1484   application.SendNotification();
1485   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 10% progress */);
1486
1487   // We didn't expect the animation to finish yet
1488   application.SendNotification();
1489   finishCheck.CheckSignalNotReceived();
1490   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.1f), TEST_LOCATION);
1491
1492   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
1493
1494   // We didn't expect the animation to finish yet
1495   application.SendNotification();
1496   finishCheck.CheckSignalNotReceived();
1497   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
1498
1499   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% progress */);
1500
1501   // We didn't expect the animation to finish yet
1502   application.SendNotification();
1503   finishCheck.CheckSignalNotReceived();
1504   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.3f), TEST_LOCATION);
1505
1506   application.SendNotification();
1507   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
1508
1509   // We didn't expect the animation to finish yet
1510   application.SendNotification();
1511   finishCheck.CheckSignalNotReceived();
1512   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION);
1513
1514   application.Render(static_cast<unsigned int>(durationSeconds * 1200.0f) + 1u /*just beyond the animation duration*/);
1515
1516   // We did expect the animation to finish
1517   application.SendNotification();
1518   finishCheck.CheckSignalReceived();
1519   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
1520
1521   // Check that nothing has changed after a couple of buffer swaps
1522   application.Render(0);
1523   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1524   application.Render(0);
1525   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1526   END_TEST;
1527 }
1528
1529 int UtcDaliAnimationSetSpeedFactorP4(void)
1530 {
1531   TestApplication application;
1532
1533   Actor actor = Actor::New();
1534   application.GetScene().Add(actor);
1535
1536   // Build the animation
1537   float     durationSeconds(1.0f);
1538   Animation animation = Animation::New(durationSeconds);
1539
1540   const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1541   const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1542
1543   KeyFrames keyframes = KeyFrames::New();
1544   keyframes.Add(0.0f, initialPosition);
1545   keyframes.Add(1.0f, targetPosition);
1546   animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1547
1548   bool                 signalReceived(false);
1549   AnimationFinishCheck finishCheck(signalReceived);
1550   animation.FinishedSignal().Connect(&application, finishCheck);
1551
1552   tet_printf("Test half speed factor. Animation will take twice the duration\n");
1553
1554   tet_printf("Set speed to be half of normal speed\n");
1555   tet_printf("SetSpeedFactor(0.5f)\n");
1556   animation.SetSpeedFactor(0.5f);
1557
1558   // Start the animation
1559   animation.Play();
1560
1561   application.SendNotification();
1562   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 10% progress */);
1563
1564   // We didn't expect the animation to finish yet
1565   application.SendNotification();
1566   finishCheck.CheckSignalNotReceived();
1567   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.1f), TEST_LOCATION);
1568
1569   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
1570
1571   // We didn't expect the animation to finish yet
1572   application.SendNotification();
1573   finishCheck.CheckSignalNotReceived();
1574   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
1575
1576   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% progress */);
1577
1578   // We didn't expect the animation to finish yet
1579   application.SendNotification();
1580   finishCheck.CheckSignalNotReceived();
1581   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.3f), TEST_LOCATION);
1582
1583   tet_printf("Reverse direction of animation whilst playing\n");
1584   tet_printf("SetSpeedFactor(-0.5f)\n");
1585   animation.SetSpeedFactor(-0.5f);
1586
1587   application.SendNotification();
1588   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
1589
1590   // We didn't expect the animation to finish yet
1591   application.SendNotification();
1592   finishCheck.CheckSignalNotReceived();
1593   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
1594
1595   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 10% progress */);
1596
1597   // We didn't expect the animation to finish yet
1598   application.SendNotification();
1599   finishCheck.CheckSignalNotReceived();
1600   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.1f), 0.0001, TEST_LOCATION);
1601
1602   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
1603
1604   // We did expect the animation to finish
1605   application.SendNotification();
1606   finishCheck.CheckSignalReceived();
1607   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), initialPosition, TEST_LOCATION);
1608
1609   // Check that nothing has changed after a couple of buffer swaps
1610   application.Render(0);
1611   DALI_TEST_EQUALS(initialPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1612   application.Render(0);
1613   DALI_TEST_EQUALS(initialPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1614   END_TEST;
1615 }
1616
1617 int UtcDaliAnimationSetSpeedFactorAndRange(void)
1618 {
1619   TestApplication application;
1620
1621   const unsigned int NUM_FRAMES(15);
1622
1623   struct TestData
1624   {
1625     float startTime;
1626     float endTime;
1627     float startX;
1628     float endX;
1629     float expected[NUM_FRAMES];
1630   };
1631
1632   TestData testData[] = {
1633     // ACTOR 0
1634     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1635     /*                       |----------PlayRange---------------|                 */
1636     /*                                            | reverse                       */
1637     {0.0f, 1.0f, // TimePeriod
1638      0.0f,
1639      100.0f, // POS
1640      {
1641        /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1642        /**/ 30.0f,
1643        40.0f,
1644        50.0f,
1645        60.0f, /* Reverse direction */
1646        /**/ 50.0f,
1647        /**/ 40.0f,
1648        /**/ 30.0f,
1649        /**/ 70.0f,
1650        /**/ 60.0f,
1651        /**/ 50.0f,
1652        /**/
1653      }},
1654
1655     // ACTOR 1 - Across start of range
1656     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1657     /*                       |----------PlayRange---------------|                 */
1658     /*                                            | reverse                       */
1659     {0.2f, 0.5f, // TimePeriod
1660      20.0f,
1661      50.0f,                                   // POS
1662      {/**/ 30.0f, 40.0f, 50.0f, 50.0f, 50.0f, /* Loop */
1663       /**/ 30.0f,
1664       40.0f,
1665       50.0f,
1666       50.0f, /* Reverse direction @ frame #9 */
1667       /**/ 50.0f,
1668       /**/ 40.0f,
1669       /**/ 30.0f,
1670       /**/ 50.0f,
1671       /**/ 50.0f,
1672       /**/ 50.0f}},
1673
1674     // ACTOR 2 - Across end of range
1675     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1676     /*                       |----------PlayRange---------------|                 */
1677     /*                                            | reverse                       */
1678     {/**/ 0.5f, 0.9f, // TimePeriod
1679      /**/ 50.0f,
1680      90.0f, // POS
1681      {
1682        /**/ 50.0f,
1683        50.0f,
1684        50.0f,
1685        60.0f,
1686        70.0f, /* Loop */
1687        /**/ 50.0f,
1688        50.0f,
1689        50.0f,
1690        60.0f, /* Reverse direction @ frame #9 */
1691        /**/ 50.0f,
1692        /**/ 50.0f,
1693        /**/ 50.0f,
1694        70.0f,
1695        /**/ 60.0f,
1696        /**/ 50.0f,
1697      }},
1698
1699     // ACTOR 3 - Before beginning of range
1700     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1701     /*                       |----------PlayRange---------------|                 */
1702     /*                                            | reverse                       */
1703     {/**/ 0.1f, 0.25f, // TimePeriod
1704      /**/ 10.0f,
1705      25.0f, // POS
1706      {
1707        /**/
1708        /**/ 25.0f,
1709        25.0f,
1710        25.0f,
1711        25.0f,
1712        25.0f,
1713        25.0f,
1714        25.0f,
1715        25.0f,
1716        25.0f,
1717        25.0f,
1718        25.0f,
1719        25.0f,
1720        25.0f,
1721        25.0f,
1722        25.0f
1723        /**/
1724      }},
1725
1726     // ACTOR 4 - After end of range
1727     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1728     /*                       |----------PlayRange---------------|                 */
1729     /*                                            | reverse                       */
1730     {/**/ 0.85f, 1.0f, // TimePeriod
1731      /**/ 85.0f,
1732      100.0f, // POS
1733      {
1734        /**/
1735        /**/ 85.0f,
1736        85.0f,
1737        85.0f,
1738        85.0f,
1739        85.0f,
1740        85.0f,
1741        85.0f,
1742        85.0f,
1743        85.0f,
1744        85.0f,
1745        85.0f,
1746        85.0f,
1747        85.0f,
1748        85.0f,
1749        85.0f
1750        /**/
1751      }},
1752     // Actor 5 - Middle of range
1753     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1754     /*                       |----------PlayRange---------------|                 */
1755     /*                                            | reverse                       */
1756     {/**/ 0.4f, 0.65f, // Time Period
1757      /**/ 40.0f,
1758      65.0f, // Position
1759      {
1760        /**/ 40.0f,
1761        40.0f,
1762        50.0f,
1763        60.0f,
1764        65.0f,
1765        /**/ 40.0f,
1766        40.0f,
1767        50.0f,
1768        60.0f, // Reverse
1769        /**/ 50.0f,
1770        /**/ 40.0f,
1771        /**/ 40.0f,
1772        /**/ 65.0f,
1773        /**/ 60.0f,
1774        /**/ 50.0f,
1775      }}};
1776
1777   const size_t NUM_ENTRIES(sizeof(testData) / sizeof(TestData));
1778
1779   // Build the animation
1780   float                durationSeconds(1.0f);
1781   Animation            animation = Animation::New(durationSeconds);
1782   bool                 signalReceived(false);
1783   AnimationFinishCheck finishCheck(signalReceived);
1784   animation.FinishedSignal().Connect(&application, finishCheck);
1785
1786   std::vector<Dali::Actor> actors;
1787
1788   for(unsigned int actorIndex = 0; actorIndex < NUM_ENTRIES; ++actorIndex)
1789   {
1790     Actor actor = Actor::New();
1791     actor.SetProperty(Actor::Property::POSITION, Vector3(testData[actorIndex].startX, 0, 0));
1792     actors.push_back(actor);
1793     application.GetScene().Add(actor);
1794
1795     if(actorIndex == 0 || actorIndex == NUM_ENTRIES - 1)
1796     {
1797       KeyFrames keyframes = KeyFrames::New();
1798       keyframes.Add(testData[actorIndex].startTime, Vector3(testData[actorIndex].startX, 0, 0));
1799       keyframes.Add(testData[actorIndex].endTime, Vector3(testData[actorIndex].endX, 0, 0));
1800       animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1801     }
1802     else
1803     {
1804       animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(testData[actorIndex].endX, 0, 0), TimePeriod(testData[actorIndex].startTime, testData[actorIndex].endTime - testData[actorIndex].startTime));
1805     }
1806   }
1807
1808   tet_printf("Test half speed factor. Animation will take twice the duration\n");
1809   tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1810   tet_printf("SetSpeedFactor(0.5f)\n");
1811   animation.SetSpeedFactor(0.5f);
1812   animation.SetPlayRange(Vector2(0.3f, 0.8f));
1813   animation.SetLooping(true);
1814
1815   // Start the animation
1816   animation.Play();
1817   application.SendNotification();
1818   application.Render(0); // Frame 0 tests initial values
1819
1820   for(unsigned int frame = 0; frame < NUM_FRAMES; ++frame)
1821   {
1822     unsigned int actorIndex = 0u;
1823     for(actorIndex = 0u; actorIndex < NUM_ENTRIES; ++actorIndex)
1824     {
1825       DALI_TEST_EQUALS(actors[actorIndex].GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, testData[actorIndex].expected[frame], 0.001, TEST_LOCATION);
1826       if(!Equals(actors[actorIndex].GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, testData[actorIndex].expected[frame]))
1827       {
1828         tet_printf("Failed at frame %u, actorIndex %u\n", frame, actorIndex);
1829       }
1830     }
1831
1832     if(frame == 8)
1833     {
1834       tet_printf("Reverse direction of animation whilst playing after frame 8\n");
1835       tet_printf("SetSpeedFactor(-0.5f)\n");
1836       animation.SetSpeedFactor(-0.5f);
1837       application.SendNotification();
1838     }
1839     application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1840
1841     // We didn't expect the animation to finish yet
1842     application.SendNotification();
1843     finishCheck.CheckSignalNotReceived();
1844   }
1845
1846   END_TEST;
1847 }
1848
1849 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount01(void)
1850 {
1851   TestApplication application;
1852
1853   const unsigned int NUM_FRAMES(15);
1854
1855   struct TestData
1856   {
1857     float startTime;
1858     float endTime;
1859     float startX;
1860     float endX;
1861     float expected[NUM_FRAMES];
1862   };
1863
1864   TestData testData =
1865     // ACTOR 0
1866     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1867     /*                       |----------PlayRange---------------|                 */
1868     {0.0f, 1.0f, // TimePeriod
1869      0.0f,
1870      100.0f, // POS
1871      {
1872        /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1873        /**/ 30.0f,
1874        40.0f,
1875        50.0f,
1876        60.0f,
1877        70.0f,
1878        /**/ 30.0f,
1879        40.0f,
1880        50.0f,
1881        60.0f,
1882        70.0f,
1883        /**/
1884      }};
1885
1886   // Build the animation
1887   float                durationSeconds(1.0f);
1888   Animation            animation = Animation::New(durationSeconds);
1889   bool                 signalReceived(false);
1890   AnimationFinishCheck finishCheck(signalReceived);
1891   animation.FinishedSignal().Connect(&application, finishCheck);
1892
1893   std::vector<Dali::Actor> actors;
1894
1895   Actor actor = Actor::New();
1896   actor.SetProperty(Actor::Property::POSITION, Vector3(testData.startX, 0, 0));
1897   actors.push_back(actor);
1898   application.GetScene().Add(actor);
1899
1900   KeyFrames keyframes = KeyFrames::New();
1901   keyframes.Add(testData.startTime, Vector3(testData.startX, 0, 0));
1902   keyframes.Add(testData.endTime, Vector3(testData.endX, 0, 0));
1903   animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1904
1905   tet_printf("Test half speed factor. Animation will take twice the duration\n");
1906   tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1907   tet_printf("SetSpeedFactor(0.5f)\n");
1908   tet_printf("SetLoopCount(3)\n");
1909   animation.SetSpeedFactor(0.5f);
1910   animation.SetPlayRange(Vector2(0.3f, 0.8f));
1911   animation.SetLoopCount(3);
1912
1913   // Start the animation
1914   animation.Play();
1915   application.SendNotification();
1916   application.Render(0); // Frame 0 tests initial values
1917
1918   for(unsigned int frame = 0; frame < NUM_FRAMES; ++frame)
1919   {
1920     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, testData.expected[frame], 0.001, TEST_LOCATION);
1921
1922     application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1923
1924     if(frame < NUM_FRAMES - 1)
1925     {
1926       // We didn't expect the animation to finish yet
1927       application.SendNotification();
1928       finishCheck.CheckSignalNotReceived();
1929     }
1930   }
1931
1932   // We did expect the animation to finish
1933   application.SendNotification();
1934   finishCheck.CheckSignalReceived();
1935   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, 80.0f, 0.001, TEST_LOCATION);
1936
1937   END_TEST;
1938 }
1939
1940 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount02(void)
1941 {
1942   TestApplication application;
1943
1944   const unsigned int NUM_FRAMES(15);
1945
1946   struct TestData
1947   {
1948     float startTime;
1949     float endTime;
1950     float startX;
1951     float endX;
1952     float expected[NUM_FRAMES];
1953   };
1954
1955   TestData testData =
1956     // ACTOR 0
1957     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1958     /*                       |----------PlayRange---------------|                 */
1959     {0.0f, 1.0f, // TimePeriod
1960      0.0f,
1961      100.0f, // POS
1962      {
1963        /**/ 80.0f,
1964        70.0f,
1965        60.0f,
1966        50.0f,
1967        40.0f,
1968        /**/ 80.0f,
1969        70.0f,
1970        60.0f,
1971        50.0f,
1972        40.0f,
1973        /**/ 80.0f,
1974        70.0f,
1975        60.0f,
1976        50.0f,
1977        40.0f,
1978      }};
1979
1980   // Build the animation
1981   float                durationSeconds(1.0f);
1982   Animation            animation = Animation::New(durationSeconds);
1983   bool                 signalReceived(false);
1984   AnimationFinishCheck finishCheck(signalReceived);
1985   animation.FinishedSignal().Connect(&application, finishCheck);
1986
1987   std::vector<Dali::Actor> actors;
1988
1989   Actor actor = Actor::New();
1990   actor.SetProperty(Actor::Property::POSITION, Vector3(testData.startX, 0, 0));
1991   actors.push_back(actor);
1992   application.GetScene().Add(actor);
1993
1994   KeyFrames keyframes = KeyFrames::New();
1995   keyframes.Add(testData.startTime, Vector3(testData.startX, 0, 0));
1996   keyframes.Add(testData.endTime, Vector3(testData.endX, 0, 0));
1997   animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1998
1999   tet_printf("Test reverse half speed factor. Animation will take twice the duration\n");
2000   tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
2001   tet_printf("SetSpeedFactor(-0.5f)\n");
2002   tet_printf("SetLoopCount(3)\n");
2003   animation.SetSpeedFactor(-0.5f);
2004   animation.SetPlayRange(Vector2(0.3f, 0.8f));
2005   animation.SetLoopCount(3);
2006
2007   // Start the animation
2008   animation.Play();
2009   application.SendNotification();
2010   application.Render(0); // Frame 0 tests initial values
2011
2012   for(unsigned int frame = 0; frame < NUM_FRAMES; ++frame)
2013   {
2014     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, testData.expected[frame], 0.001, TEST_LOCATION);
2015
2016     application.Render(200); // 200 ms at half speed corresponds to 0.1 s
2017
2018     if(frame < NUM_FRAMES - 1)
2019     {
2020       // We didn't expect the animation to finish yet
2021       application.SendNotification();
2022       finishCheck.CheckSignalNotReceived();
2023     }
2024   }
2025
2026   // We did expect the animation to finish
2027   application.SendNotification();
2028   finishCheck.CheckSignalReceived();
2029   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, 30.0f, 0.001, TEST_LOCATION);
2030
2031   END_TEST;
2032 }
2033
2034 int UtcDaliAnimationGetSpeedFactorP(void)
2035 {
2036   TestApplication application;
2037
2038   Animation animation = Animation::New(1.0f);
2039   animation.SetSpeedFactor(0.5f);
2040   DALI_TEST_EQUALS(animation.GetSpeedFactor(), 0.5f, TEST_LOCATION);
2041
2042   animation.SetSpeedFactor(-2.5f);
2043   DALI_TEST_EQUALS(animation.GetSpeedFactor(), -2.5f, TEST_LOCATION);
2044   END_TEST;
2045 }
2046
2047 int UtcDaliAnimationSetPlayRangeP(void)
2048 {
2049   TestApplication application;
2050
2051   Actor actor = Actor::New();
2052   application.GetScene().Add(actor);
2053
2054   // Build the animation
2055   float     durationSeconds(1.0f);
2056   Animation animation = Animation::New(durationSeconds);
2057
2058   bool                 signalReceived(false);
2059   AnimationFinishCheck finishCheck(signalReceived);
2060   animation.FinishedSignal().Connect(&application, finishCheck);
2061   application.SendNotification();
2062
2063   // Set range between 0.4 and 0.8
2064   animation.SetPlayRange(Vector2(0.4f, 0.9f));
2065   application.SendNotification();
2066   DALI_TEST_EQUALS(Vector2(0.4f, 0.9f), animation.GetPlayRange(), TEST_LOCATION);
2067
2068   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2069   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2070
2071   // Start the animation from 40% progress
2072   animation.Play();
2073
2074   application.SendNotification();
2075   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2076
2077   // We didn't expect the animation to finish yet
2078   application.SendNotification();
2079   finishCheck.CheckSignalNotReceived();
2080   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
2081
2082   application.SendNotification();
2083   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2084
2085   application.SendNotification();
2086   finishCheck.CheckSignalNotReceived();
2087   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
2088
2089   application.SendNotification();
2090   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1u /*just beyond the animation duration*/);
2091
2092   // We did expect the animation to finish
2093   application.SendNotification();
2094   finishCheck.CheckSignalReceived();
2095   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.9f), TEST_LOCATION);
2096   END_TEST;
2097 }
2098
2099 int UtcDaliAnimationSetPlayRangeN(void)
2100 {
2101   TestApplication application;
2102
2103   Actor actor = Actor::New();
2104   application.GetScene().Add(actor);
2105
2106   // Build the animation
2107   Animation animation = Animation::New(0);
2108   application.SendNotification();
2109
2110   //PlayRange out of bounds
2111   animation.SetPlayRange(Vector2(-1.0f, 1.0f));
2112   application.SendNotification();
2113   DALI_TEST_EQUALS(Vector2(0.0f, 1.0f), animation.GetPlayRange(), TEST_LOCATION);
2114   animation.SetPlayRange(Vector2(0.0f, 2.0f));
2115   application.SendNotification();
2116   DALI_TEST_EQUALS(Vector2(0.0f, 1.0f), animation.GetPlayRange(), TEST_LOCATION);
2117
2118   //If playRange is not in the correct order it has to be ordered
2119   animation.SetPlayRange(Vector2(0.8f, 0.2f));
2120   application.SendNotification();
2121   DALI_TEST_EQUALS(Vector2(0.2f, 0.8f), animation.GetPlayRange(), TEST_LOCATION);
2122
2123   END_TEST;
2124 }
2125
2126 int UtcDaliAnimationGetPlayRangeP(void)
2127 {
2128   TestApplication application;
2129
2130   Actor actor = Actor::New();
2131   application.GetScene().Add(actor);
2132
2133   // Build the animation
2134   Animation animation = Animation::New(1.0f);
2135   application.SendNotification();
2136
2137   //If PlayRange not specified it should be 0.0-1.0 by default
2138   DALI_TEST_EQUALS(Vector2(0.0f, 1.0f), animation.GetPlayRange(), TEST_LOCATION);
2139
2140   // Set range between 0.4 and 0.8
2141   animation.SetPlayRange(Vector2(0.4f, 0.8f));
2142   application.SendNotification();
2143   DALI_TEST_EQUALS(Vector2(0.4f, 0.8f), animation.GetPlayRange(), TEST_LOCATION);
2144
2145   END_TEST;
2146 }
2147
2148 int UtcDaliAnimationPlayP(void)
2149 {
2150   TestApplication application;
2151
2152   Actor actor = Actor::New();
2153   application.GetScene().Add(actor);
2154
2155   // Build the animation
2156   float     durationSeconds(1.0f);
2157   Animation animation = Animation::New(durationSeconds);
2158   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2159   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2160
2161   // Start the animation
2162   animation.Play();
2163
2164   bool                 signalReceived(false);
2165   AnimationFinishCheck finishCheck(signalReceived);
2166   animation.FinishedSignal().Connect(&application, finishCheck);
2167
2168   application.SendNotification();
2169   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2170
2171   // We didn't expect the animation to finish yet
2172   application.SendNotification();
2173   finishCheck.CheckSignalNotReceived();
2174   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2175
2176   animation.Play(); // Test that calling play has no effect, when animation is already playing
2177   application.SendNotification();
2178   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2179
2180   // We didn't expect the animation to finish yet
2181   application.SendNotification();
2182   finishCheck.CheckSignalNotReceived();
2183   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION);
2184
2185   animation.Play(); // Test that calling play has no effect, when animation is already playing
2186   application.SendNotification();
2187   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2188
2189   // We didn't expect the animation to finish yet
2190   application.SendNotification();
2191   finishCheck.CheckSignalNotReceived();
2192   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
2193
2194   animation.Play(); // Test that calling play has no effect, when animation is already playing
2195   application.SendNotification();
2196   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2197
2198   // We didn't expect the animation to finish yet
2199   application.SendNotification();
2200   finishCheck.CheckSignalNotReceived();
2201   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
2202
2203   animation.Play(); // Test that calling play has no effect, when animation is already playing
2204   application.SendNotification();
2205   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2206
2207   // We did expect the animation to finish
2208   application.SendNotification();
2209   finishCheck.CheckSignalReceived();
2210   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2211
2212   // Check that nothing has changed after a couple of buffer swaps
2213   application.Render(0);
2214   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2215   application.Render(0);
2216   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2217   END_TEST;
2218 }
2219
2220 int UtcDaliAnimationPlayOffSceneP(void)
2221 {
2222   // Test that an animation cannot be played, when the actor is off-stage.
2223   // And the property value and the current property value should not be changed in the case.
2224
2225   TestApplication application;
2226
2227   Actor   actor = Actor::New();
2228   Vector3 basePosition(Vector3::ZERO);
2229   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2230   // Not added to the stage yet!
2231
2232   // Build the animation
2233   float     durationSeconds(1.0f);
2234   Animation animation = Animation::New(durationSeconds);
2235   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2236   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2237
2238   // Start the animation
2239   animation.Play();
2240
2241   bool                 signalReceived(false);
2242   AnimationFinishCheck finishCheck(signalReceived);
2243   animation.FinishedSignal().Connect(&application, finishCheck);
2244
2245   application.SendNotification();
2246   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
2247
2248   application.SendNotification();
2249   finishCheck.CheckSignalReceived();
2250
2251   // An animation can't be played. The position shouldn't be changed.
2252   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2253   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2254
2255   // Add to the stage
2256   application.GetScene().Add(actor);
2257
2258   // Start the animation again
2259   animation.Play();
2260
2261   application.SendNotification();
2262   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
2263
2264   // We did expect the animation to finish
2265   application.SendNotification();
2266   finishCheck.CheckSignalReceived();
2267
2268   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2269   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2270
2271   // Reset the position
2272   actor[Actor::Property::POSITION] = basePosition;
2273
2274   application.SendNotification();
2275   application.Render();
2276
2277   // Create an animator again
2278   animation.Clear();
2279   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2280
2281   // Remove from the stage
2282   application.GetScene().Remove(actor);
2283
2284   signalReceived = false;
2285
2286   // Start the animation again
2287   animation.Play();
2288
2289   application.SendNotification();
2290   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
2291
2292   application.SendNotification();
2293   finishCheck.CheckSignalReceived();
2294
2295   // An animation can't be played. The position shouldn't be changed.
2296   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2297   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2298
2299   END_TEST;
2300 }
2301
2302 int UtcDaliAnimationPlayOffSceneDiscardP(void)
2303 {
2304   // Test that an animation cannot be played, when the actor is off-stage.
2305   // When the actor is added to the stage, it should appear at the current position
2306   // i.e. where it would have been anyway, if on-stage from the beginning.
2307
2308   TestApplication application;
2309
2310   Actor   actor = Actor::New();
2311   Vector3 basePosition(Vector3::ZERO);
2312   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2313   // Not added to the stage yet!
2314
2315   // Build the animation
2316   float     durationSeconds(1.0f);
2317   Animation animation = Animation::New(durationSeconds);
2318   animation.SetDisconnectAction(Animation::DISCARD);
2319   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2320   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2321
2322   // Start the animation
2323   animation.Play();
2324
2325   bool                 signalReceived(false);
2326   AnimationFinishCheck finishCheck(signalReceived);
2327   animation.FinishedSignal().Connect(&application, finishCheck);
2328
2329   application.SendNotification();
2330   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2331
2332   // We didn't expect the animation to finish yet
2333   application.SendNotification();
2334   finishCheck.CheckSignalNotReceived();
2335
2336   // An animation can't be played. The position shouldn't be changed.
2337   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2338
2339   // Add to the stage
2340   application.GetScene().Add(actor);
2341
2342   application.SendNotification();
2343   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2344
2345   // We didn't expect the animation to finish yet
2346   application.SendNotification();
2347   finishCheck.CheckSignalNotReceived();
2348   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(40, 40, 40) /*on-stage*/, TEST_LOCATION);
2349
2350   // Remove from the stage
2351   application.GetScene().Remove(actor);
2352
2353   application.SendNotification();
2354   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2355
2356   // We didn't expect the animation to finish yet
2357   application.SendNotification();
2358   finishCheck.CheckSignalNotReceived();
2359   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO /*back to start position as disconnect behaviour is discard*/, TEST_LOCATION);
2360   // Check that nothing has changed after a couple of buffer swaps
2361   application.Render(0);
2362   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
2363   application.Render(0);
2364   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
2365   application.Render(0);
2366   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
2367
2368   // Add to the stage
2369   application.GetScene().Add(actor);
2370
2371   application.SendNotification();
2372   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2373
2374   // We didn't expect the animation to finish yet
2375   application.SendNotification();
2376   finishCheck.CheckSignalNotReceived();
2377   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(80, 80, 80), TEST_LOCATION);
2378
2379   application.SendNotification();
2380   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2381
2382   // We did expect the animation to finish
2383   application.SendNotification();
2384   finishCheck.CheckSignalReceived();
2385   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2386
2387   // Check that nothing has changed after a couple of buffer swaps
2388   application.Render(0);
2389   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2390
2391   application.Render(0);
2392   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2393   END_TEST;
2394 }
2395
2396 int UtcDaliAnimationPlayOffSceneBakeFinalP(void)
2397 {
2398   // Test that an animation cannot be played, when the actor is off-stage.
2399   // When the actor is added to the stage, it should appear at the current position
2400   // i.e. where it would have been anyway, if on-stage from the beginning.
2401
2402   TestApplication application;
2403
2404   Actor   actor = Actor::New();
2405   Vector3 basePosition(Vector3::ZERO);
2406   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2407   // Not added to the stage!
2408
2409   // Build the animation
2410   float     durationSeconds(1.0f);
2411   Animation animation = Animation::New(durationSeconds);
2412   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2413   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2414
2415   // Start the animation
2416   animation.Play();
2417
2418   bool                 signalReceived(false);
2419   AnimationFinishCheck finishCheck(signalReceived);
2420   animation.FinishedSignal().Connect(&application, finishCheck);
2421
2422   application.SendNotification();
2423   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2424
2425   // We didn't expect the animation to finish yet
2426   application.SendNotification();
2427   finishCheck.CheckSignalNotReceived();
2428
2429   // An animation can't be played. The position shouldn't be changed.
2430   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2431
2432   // Add to the stage
2433   application.GetScene().Add(actor);
2434
2435   application.SendNotification();
2436   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2437
2438   // We didn't expect the animation to finish yet
2439   application.SendNotification();
2440   finishCheck.CheckSignalNotReceived();
2441   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(40, 40, 40) /*on-stage*/, TEST_LOCATION);
2442
2443   // Remove from the stage
2444   application.GetScene().Remove(actor);
2445
2446   application.SendNotification();
2447   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2448
2449   // We didn't expect the animation to finish yet
2450   application.SendNotification();
2451   finishCheck.CheckSignalNotReceived();
2452   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition /*bake final*/, TEST_LOCATION);
2453
2454   // Add to the stage
2455   application.GetScene().Add(actor);
2456
2457   application.SendNotification();
2458   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2459
2460   // We didn't expect the animation to finish yet
2461   application.SendNotification();
2462   finishCheck.CheckSignalNotReceived();
2463   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition /*bake final removed the */, TEST_LOCATION);
2464
2465   application.SendNotification();
2466   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2467
2468   // We did expect the animation to finish
2469   application.SendNotification();
2470   finishCheck.CheckSignalReceived();
2471   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2472
2473   // Check that nothing has changed after a couple of buffer swaps
2474   application.Render(0);
2475   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2476
2477   application.Render(0);
2478   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2479   END_TEST;
2480 }
2481
2482 int UtcDaliAnimationPlayOffSceneBakeP(void)
2483 {
2484   // Test that an animation cannot be played, when the actor is off-stage.
2485   // When the actor is added to the stage, it should appear at the current position
2486   // i.e. where it would have been anyway, if on-stage from the beginning.
2487
2488   TestApplication application;
2489
2490   Actor   actor = Actor::New();
2491   Vector3 basePosition(Vector3::ZERO);
2492   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2493   // Not added to the stage!
2494
2495   // Build the animation
2496   float     durationSeconds(1.0f);
2497   Animation animation = Animation::New(durationSeconds);
2498   animation.SetDisconnectAction(Animation::BAKE);
2499   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2500   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2501
2502   // Start the animation
2503   animation.Play();
2504
2505   bool                 signalReceived(false);
2506   AnimationFinishCheck finishCheck(signalReceived);
2507   animation.FinishedSignal().Connect(&application, finishCheck);
2508
2509   application.SendNotification();
2510   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2511
2512   // We didn't expect the animation to finish yet
2513   application.SendNotification();
2514   finishCheck.CheckSignalNotReceived();
2515
2516   // An animation can't be played. The position shouldn't be changed.
2517   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2518
2519   // Add to the stage
2520   application.GetScene().Add(actor);
2521
2522   application.SendNotification();
2523   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2524
2525   // We didn't expect the animation to finish yet
2526   application.SendNotification();
2527   finishCheck.CheckSignalNotReceived();
2528   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(40, 40, 40) /*on-stage*/, TEST_LOCATION);
2529
2530   // Remove from the stage
2531   application.GetScene().Remove(actor); // baked here
2532
2533   application.SendNotification();
2534   // this render is a no-op in this case as animator is disabled while off stage
2535   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2536   // We didn't expect the animation to finish yet
2537   application.SendNotification();
2538   finishCheck.CheckSignalNotReceived();
2539   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(40, 40, 40) /*baked value*/, TEST_LOCATION);
2540
2541   // Add back to the stage
2542   application.GetScene().Add(actor);
2543
2544   application.SendNotification();
2545   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2546   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /* animation restarted at 40,40,40 + 80%*60 */, TEST_LOCATION);
2547   application.Render(static_cast<unsigned int>(0.0f));
2548   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2549   application.Render(static_cast<unsigned int>(0.0f));
2550   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2551
2552   // Remove from the stage
2553   application.GetScene().Remove(actor); // baked here
2554
2555   application.SendNotification();
2556   // this render is a no-op in this case as animator is disabled while off stage
2557   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 100% progress */);
2558   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2559   application.Render(static_cast<unsigned int>(0.0f));
2560   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2561   application.Render(static_cast<unsigned int>(0.0f));
2562   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2563
2564   // Add back to the stage
2565   application.GetScene().Add(actor);
2566
2567   // We didn't expect the animation to finish yet
2568   application.SendNotification();
2569   finishCheck.CheckSignalNotReceived();
2570   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88), TEST_LOCATION);
2571
2572   application.SendNotification();
2573   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2574
2575   // We did expect the animation to finish
2576   application.SendNotification();
2577   finishCheck.CheckSignalReceived();
2578   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2579
2580   // Check that nothing has changed after a couple of buffer swaps
2581   application.Render(0);
2582   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2583
2584   application.Render(0);
2585   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2586   END_TEST;
2587 }
2588
2589 int UtcDaliAnimationPlayDiscardHandleP(void)
2590 {
2591   TestApplication application;
2592
2593   Actor actor = Actor::New();
2594   application.GetScene().Add(actor);
2595
2596   // Build the animation
2597   float     durationSeconds(1.0f);
2598   Animation animation = Animation::New(durationSeconds);
2599   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2600   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2601
2602   bool                 signalReceived(false);
2603   AnimationFinishCheck finishCheck(signalReceived);
2604   animation.FinishedSignal().Connect(&application, finishCheck);
2605
2606   // Start the animation
2607   animation.Play();
2608
2609   // This is a test of the "Fire and Forget" behaviour
2610   // Discard the animation handle!
2611   animation.Reset();
2612   DALI_TEST_CHECK(!animation);
2613
2614   application.SendNotification();
2615   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2616
2617   // We didn't expect the animation to finish yet
2618   application.SendNotification();
2619   finishCheck.CheckSignalNotReceived();
2620   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2621
2622   application.SendNotification();
2623   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2624
2625   // We didn't expect the animation to finish yet
2626   application.SendNotification();
2627   finishCheck.CheckSignalNotReceived();
2628   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION);
2629
2630   application.SendNotification();
2631   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2632
2633   // We didn't expect the animation to finish yet
2634   application.SendNotification();
2635   finishCheck.CheckSignalNotReceived();
2636   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
2637
2638   application.SendNotification();
2639   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2640
2641   // We didn't expect the animation to finish yet
2642   application.SendNotification();
2643   finishCheck.CheckSignalNotReceived();
2644   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
2645
2646   application.SendNotification();
2647   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2648
2649   // We did expect the animation to finish
2650   application.SendNotification();
2651   finishCheck.CheckSignalReceived();
2652   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2653
2654   // Check that nothing has changed after a couple of buffer swaps
2655   application.Render(0);
2656   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2657   application.Render(0);
2658   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2659   END_TEST;
2660 }
2661
2662 int UtcDaliAnimationPlayStopDiscardHandleP(void)
2663 {
2664   TestApplication application;
2665
2666   Actor actor = Actor::New();
2667   application.GetScene().Add(actor);
2668
2669   // Build the animation
2670   float     durationSeconds(1.0f);
2671   Animation animation = Animation::New(durationSeconds);
2672   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2673   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2674
2675   // Start the animation
2676   animation.Play();
2677
2678   bool                 signalReceived(false);
2679   AnimationFinishCheck finishCheck(signalReceived);
2680   animation.FinishedSignal().Connect(&application, finishCheck);
2681
2682   application.SendNotification();
2683   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2684
2685   // We didn't expect the animation to finish yet
2686   application.SendNotification();
2687   finishCheck.CheckSignalNotReceived();
2688   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2689
2690   // This is a test of the "Fire and Forget" behaviour
2691   // Stop the animation, and Discard the animation handle!
2692   animation.Stop();
2693   animation.Reset();
2694   DALI_TEST_CHECK(!animation);
2695
2696   application.SendNotification();
2697   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2698
2699   // We expect the animation to finish at 20% progress
2700   application.SendNotification();
2701   finishCheck.CheckSignalReceived();
2702   finishCheck.Reset();
2703   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2704
2705   application.SendNotification();
2706   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2707
2708   // Check that nothing has changed
2709   application.SendNotification();
2710   finishCheck.CheckSignalNotReceived();
2711   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2712
2713   application.SendNotification();
2714   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2715
2716   // Check that nothing has changed
2717   application.SendNotification();
2718   finishCheck.CheckSignalNotReceived();
2719   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2720
2721   application.SendNotification();
2722   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 100% progress */);
2723
2724   // Check that nothing has changed
2725   application.SendNotification();
2726   finishCheck.CheckSignalNotReceived();
2727   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2728   END_TEST;
2729 }
2730
2731 int UtcDaliAnimationPlayRangeP(void)
2732 {
2733   TestApplication application;
2734
2735   Actor actor = Actor::New();
2736   application.GetScene().Add(actor);
2737
2738   // Build the animation
2739   float     durationSeconds(1.0f);
2740   Animation animation = Animation::New(durationSeconds);
2741   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2742   KeyFrames keyframes = KeyFrames::New();
2743   keyframes.Add(0.0f, Vector3(0.0f, 0.0f, 0.0f));
2744   keyframes.Add(1.0f, Vector3(100.0f, 100.0f, 100.0f));
2745
2746   animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes);
2747
2748   // Set range between 0.4 and 0.8
2749   animation.SetPlayRange(Vector2(0.4f, 0.8f));
2750   animation.Play();
2751
2752   bool                 signalReceived(false);
2753   AnimationFinishCheck finishCheck(signalReceived);
2754   animation.FinishedSignal().Connect(&application, finishCheck);
2755
2756   //Test that setting progress outside the range doesn't work
2757   animation.SetCurrentProgress(0.9f);
2758   application.SendNotification();
2759   application.Render(0);
2760   DALI_TEST_EQUALS(animation.GetCurrentProgress(), 0.4f, TEST_LOCATION);
2761   animation.SetCurrentProgress(0.2f);
2762   application.SendNotification();
2763   application.Render(0);
2764   DALI_TEST_EQUALS(animation.GetCurrentProgress(), 0.4f, TEST_LOCATION);
2765
2766   application.SendNotification();
2767   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2768
2769   // We didn't expect the animation to finish yet
2770   application.SendNotification();
2771   finishCheck.CheckSignalNotReceived();
2772   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
2773
2774   animation.Play(); // Test that calling play has no effect, when animation is already playing
2775   application.SendNotification();
2776   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /* 80% progress */);
2777
2778   // We did expect the animation to finish
2779   application.SendNotification();
2780   finishCheck.CheckSignalReceived();
2781   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
2782
2783   // Check that nothing has changed after a couple of buffer swaps
2784   application.Render(0);
2785   DALI_TEST_EQUALS(targetPosition * 0.8f, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2786   application.Render(0);
2787   DALI_TEST_EQUALS(targetPosition * 0.8f, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2788
2789   //Loop inside the range
2790   finishCheck.Reset();
2791   animation.SetLooping(true);
2792   animation.Play();
2793   application.SendNotification();
2794   float intervalSeconds = 0.1f;
2795   float progress        = 0.4f;
2796   for(int iterations = 0; iterations < 10; ++iterations)
2797   {
2798     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
2799
2800     progress += intervalSeconds;
2801     if(progress > 0.8f)
2802     {
2803       progress = progress - 0.4f;
2804     }
2805
2806     DALI_TEST_EQUALS(targetPosition * progress, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.001f, TEST_LOCATION);
2807   }
2808
2809   // We didn't expect the animation to finish yet
2810   application.SendNotification();
2811   finishCheck.CheckSignalNotReceived();
2812
2813   //Test change range on the fly
2814   animation.SetPlayRange(Vector2(0.2f, 0.9f));
2815   application.SendNotification();
2816
2817   for(int iterations = 0; iterations < 10; ++iterations)
2818   {
2819     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
2820
2821     progress += intervalSeconds;
2822     if(progress > 0.9f)
2823     {
2824       progress = progress - 0.7f;
2825     }
2826
2827     DALI_TEST_EQUALS(targetPosition * progress, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.001f, TEST_LOCATION);
2828   }
2829
2830   END_TEST;
2831 }
2832
2833 int UtcDaliAnimationPlayFromP(void)
2834 {
2835   TestApplication application;
2836
2837   Actor actor = Actor::New();
2838   application.GetScene().Add(actor);
2839
2840   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
2841
2842   // Build the animation
2843   float     durationSeconds(1.0f);
2844   Animation animation = Animation::New(durationSeconds);
2845   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2846   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2847
2848   // Start the animation from 40% progress
2849   animation.PlayFrom(0.4f);
2850
2851   // Target value should be updated straight away
2852   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2853
2854   bool                 signalReceived(false);
2855   AnimationFinishCheck finishCheck(signalReceived);
2856   animation.FinishedSignal().Connect(&application, finishCheck);
2857
2858   application.SendNotification();
2859   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2860
2861   // We didn't expect the animation to finish yet
2862   application.SendNotification();
2863   finishCheck.CheckSignalNotReceived();
2864   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
2865
2866   animation.Play(); // Test that calling play has no effect, when animation is already playing
2867   application.SendNotification();
2868   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2869
2870   // We didn't expect the animation to finish yet
2871   application.SendNotification();
2872   finishCheck.CheckSignalNotReceived();
2873   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
2874
2875   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2876   // We did expect the animation to finish
2877   application.SendNotification();
2878   finishCheck.CheckSignalReceived();
2879   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2880
2881   // Check that nothing has changed after a couple of buffer swaps
2882   application.Render(0);
2883   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2884   application.Render(0);
2885   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2886   END_TEST;
2887 }
2888
2889 int UtcDaliAnimationPlayFromN(void)
2890 {
2891   TestApplication application;
2892
2893   Actor actor = Actor::New();
2894   application.GetScene().Add(actor);
2895
2896   // Build the animation
2897   float     durationSeconds(1.0f);
2898   Animation animation = Animation::New(durationSeconds);
2899   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2900   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2901
2902   //PlayFrom with an argument outside the range [0..1] will be ignored
2903   animation.PlayFrom(-1.0f);
2904   application.SendNotification();
2905   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
2906
2907   animation.PlayFrom(100.0f);
2908   application.SendNotification();
2909   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
2910   END_TEST;
2911 }
2912
2913 int UtcDaliAnimationPauseP(void)
2914 {
2915   TestApplication application;
2916
2917   Actor actor = Actor::New();
2918   application.GetScene().Add(actor);
2919
2920   // Build the animation
2921   float     durationSeconds(1.0f);
2922   Animation animation = Animation::New(durationSeconds);
2923   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2924   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2925
2926   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2927
2928   // Start the animation
2929   animation.Play();
2930
2931   bool                 signalReceived(false);
2932   AnimationFinishCheck finishCheck(signalReceived);
2933   animation.FinishedSignal().Connect(&application, finishCheck);
2934
2935   application.SendNotification();
2936   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
2937
2938   // We didn't expect the animation to finish yet
2939   application.SendNotification();
2940   finishCheck.CheckSignalNotReceived();
2941   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
2942
2943   // Pause the animation
2944   animation.Pause();
2945   application.SendNotification();
2946
2947   // Loop 5 times
2948   for(int i = 0; i < 5; ++i)
2949   {
2950     application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
2951
2952     // We didn't expect the animation to finish yet
2953     application.SendNotification();
2954     finishCheck.CheckSignalNotReceived();
2955     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress when paused */, TEST_LOCATION);
2956   }
2957
2958   // Keep going
2959   animation.Play();
2960   application.SendNotification();
2961   application.Render(static_cast<unsigned int>(durationSeconds * 490.0f) /*slightly less than the animation duration*/);
2962
2963   // We didn't expect the animation to finish yet
2964   application.SendNotification();
2965   finishCheck.CheckSignalNotReceived();
2966
2967   application.SendNotification();
2968   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
2969
2970   // We did expect the animation to finish
2971   application.SendNotification();
2972   finishCheck.CheckSignalReceived();
2973   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2974
2975   // Check that nothing has changed after a couple of buffer swaps
2976   application.Render(0);
2977   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2978   application.Render(0);
2979   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2980   END_TEST;
2981 }
2982
2983 int UtcDaliAnimationGetStateP(void)
2984 {
2985   TestApplication application;
2986
2987   Actor actor = Actor::New();
2988   application.GetScene().Add(actor);
2989
2990   // Build the animation
2991   float     durationSeconds(1.0f);
2992   Animation animation = Animation::New(durationSeconds);
2993   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
2994   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2995   DALI_TEST_EQUALS(animation.GetState(), Animation::STOPPED, TEST_LOCATION);
2996
2997   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2998
2999   // Start the animation
3000   animation.Play();
3001
3002   DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
3003
3004   bool                 signalReceived(false);
3005   AnimationFinishCheck finishCheck(signalReceived);
3006   animation.FinishedSignal().Connect(&application, finishCheck);
3007
3008   application.SendNotification();
3009   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3010
3011   // We didn't expect the animation to finish yet
3012   application.SendNotification();
3013   finishCheck.CheckSignalNotReceived();
3014   DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
3015   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
3016
3017   // Pause the animation
3018   animation.Pause();
3019   DALI_TEST_EQUALS(animation.GetState(), Animation::PAUSED, TEST_LOCATION);
3020   application.SendNotification();
3021   application.Render(0.f);
3022
3023   // Loop 5 times
3024   for(int i = 0; i < 5; ++i)
3025   {
3026     application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
3027
3028     // We didn't expect the animation to finish yet
3029     application.SendNotification();
3030     finishCheck.CheckSignalNotReceived();
3031     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress when paused */, TEST_LOCATION);
3032     DALI_TEST_EQUALS(animation.GetState(), Animation::PAUSED, TEST_LOCATION);
3033   }
3034
3035   // Keep going
3036   finishCheck.Reset();
3037   animation.Play();
3038   DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
3039   application.SendNotification();
3040   application.Render(static_cast<unsigned int>(durationSeconds * 490.0f) /*slightly less than the animation duration*/);
3041   // We didn't expect the animation to finish yet
3042   application.SendNotification();
3043   finishCheck.CheckSignalNotReceived();
3044   DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
3045
3046   application.SendNotification();
3047   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
3048
3049   // We did expect the animation to finish
3050   application.SendNotification();
3051   finishCheck.CheckSignalReceived();
3052   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
3053   DALI_TEST_EQUALS(animation.GetState(), Animation::STOPPED, TEST_LOCATION);
3054
3055   // Check that nothing has changed after a couple of buffer swaps
3056   application.Render(0);
3057   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
3058   application.Render(0);
3059   DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
3060   DALI_TEST_EQUALS(animation.GetState(), Animation::STOPPED, TEST_LOCATION);
3061
3062   // re-play
3063   finishCheck.Reset();
3064   animation.Play();
3065   DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
3066   application.SendNotification();
3067   application.Render(static_cast<unsigned int>(durationSeconds * 490.0f) /*slightly less than the animation duration*/);
3068   application.SendNotification();
3069   finishCheck.CheckSignalNotReceived();
3070   DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
3071
3072   END_TEST;
3073 }
3074
3075 int UtcDaliAnimationStopP(void)
3076 {
3077   TestApplication application;
3078
3079   Actor actor = Actor::New();
3080   application.GetScene().Add(actor);
3081
3082   // Build the animation
3083   float     durationSeconds(1.0f);
3084   Animation animation = Animation::New(durationSeconds);
3085   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
3086   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
3087
3088   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
3089
3090   // Start the animation
3091   animation.Play();
3092
3093   bool                 signalReceived(false);
3094   AnimationFinishCheck finishCheck(signalReceived);
3095   animation.FinishedSignal().Connect(&application, finishCheck);
3096
3097   application.SendNotification();
3098   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3099
3100   // We didn't expect the animation to finish yet
3101   application.SendNotification();
3102   finishCheck.CheckSignalNotReceived();
3103   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
3104
3105   // Stop the animation
3106   animation.Stop();
3107   application.SendNotification();
3108
3109   // Loop 5 times
3110   for(int i = 0; i < 5; ++i)
3111   {
3112     application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
3113
3114     // We did expect the animation to finish
3115     application.SendNotification();
3116     finishCheck.CheckSignalReceived();
3117     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress when stopped */, TEST_LOCATION);
3118   }
3119   END_TEST;
3120 }
3121
3122 int UtcDaliAnimationStopSetPositionP(void)
3123 {
3124   // Test that Animation::Stop & Actor::SetPosition can be used in conjunction
3125   // i.e. to check that the animation does not interfere with the position set.
3126
3127   TestApplication application;
3128
3129   Actor actor = Actor::New();
3130   application.GetScene().Add(actor);
3131
3132   // Build the animation
3133   float     durationSeconds(1.0f);
3134   Animation animation = Animation::New(durationSeconds);
3135   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
3136   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
3137
3138   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
3139
3140   // Start the animation
3141   animation.Play();
3142
3143   bool                 signalReceived(false);
3144   AnimationFinishCheck finishCheck(signalReceived);
3145   animation.FinishedSignal().Connect(&application, finishCheck);
3146
3147   application.SendNotification();
3148   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3149
3150   // We didn't expect the animation to finish yet
3151   application.SendNotification();
3152   finishCheck.CheckSignalNotReceived();
3153   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
3154
3155   // Stop the animation
3156   animation.Stop();
3157   Vector3 positionSet(2.0f, 3.0f, 4.0f);
3158   actor.SetProperty(Actor::Property::POSITION, positionSet);
3159   application.SendNotification();
3160
3161   // Loop 5 times
3162   for(int i = 0; i < 5; ++i)
3163   {
3164     application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
3165
3166     // We did expect the animation to finish
3167     application.SendNotification();
3168     finishCheck.CheckSignalReceived();
3169     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), positionSet /*Animation should not interfere with this*/, TEST_LOCATION);
3170   }
3171   END_TEST;
3172 }
3173
3174 int UtcDaliAnimationClearP(void)
3175 {
3176   TestApplication application;
3177
3178   Actor actor = Actor::New();
3179   application.GetScene().Add(actor);
3180
3181   // Build the animation
3182   float     durationSeconds(1.0f);
3183   Animation animation = Animation::New(durationSeconds);
3184   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
3185   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
3186
3187   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
3188
3189   // Start the animation
3190   animation.Play();
3191
3192   bool                 signalReceived(false);
3193   AnimationFinishCheck finishCheck(signalReceived);
3194   animation.FinishedSignal().Connect(&application, finishCheck);
3195
3196   application.SendNotification();
3197   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3198
3199   // We didn't expect the animation to finish yet
3200   application.SendNotification();
3201   finishCheck.CheckSignalNotReceived();
3202   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
3203
3204   // Clear the animation
3205   animation.Clear();
3206   application.SendNotification();
3207
3208   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
3209
3210   // We don't expect the animation to finish now
3211   application.SendNotification();
3212   finishCheck.CheckSignalNotReceived();
3213   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress since the animator was destroyed */, TEST_LOCATION);
3214
3215   // Restart as a scale animation; this should not move the actor's position
3216   finishCheck.Reset();
3217   actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO);
3218   Vector3 targetScale(3.0f, 3.0f, 3.0f);
3219   animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR);
3220   animation.Play();
3221
3222   application.SendNotification();
3223   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3224
3225   // We didn't expect the animation to finish yet
3226   application.SendNotification();
3227   finishCheck.CheckSignalNotReceived();
3228   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO /*Check move-animator was destroyed*/, TEST_LOCATION);
3229   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION);
3230
3231   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
3232
3233   // We did expect the animation to finish
3234   application.SendNotification();
3235   finishCheck.CheckSignalReceived();
3236   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO /*Check move-animator was destroyed*/, TEST_LOCATION);
3237   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
3238   END_TEST;
3239 }
3240
3241 int UtcDaliAnimationFinishedSignalP(void)
3242 {
3243   TestApplication application;
3244
3245   // Start the empty animation
3246   float     durationSeconds(1.0f);
3247   Animation animation = Animation::New(durationSeconds);
3248   animation.Play();
3249
3250   bool                 signalReceived(false);
3251   AnimationFinishCheck finishCheck(signalReceived);
3252   animation.FinishedSignal().Connect(&application, finishCheck);
3253
3254   application.SendNotification();
3255   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*beyond the animation duration*/);
3256
3257   // We did expect the animation to finish
3258   application.SendNotification();
3259   finishCheck.CheckSignalReceived();
3260   END_TEST;
3261 }
3262
3263 int UtcDaliAnimationAnimateByBooleanP(void)
3264 {
3265   TestApplication application;
3266
3267   Actor actor = Actor::New();
3268
3269   // Register a boolean property
3270   bool            startValue(false);
3271   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3272   application.GetScene().Add(actor);
3273   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3274   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3275
3276   // Build the animation
3277   float      durationSeconds(2.0f);
3278   Animation  animation = Animation::New(durationSeconds);
3279   const bool relativeValue(true);
3280   const bool finalValue(false || relativeValue);
3281   animation.AnimateBy(Property(actor, index), relativeValue);
3282
3283   // Start the animation
3284   animation.Play();
3285
3286   // Target value should be retrievable straight away
3287   DALI_TEST_EQUALS(actor.GetProperty<bool>(index), finalValue, TEST_LOCATION);
3288
3289   bool                 signalReceived(false);
3290   AnimationFinishCheck finishCheck(signalReceived);
3291   animation.FinishedSignal().Connect(&application, finishCheck);
3292
3293   application.SendNotification();
3294   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3295
3296   // We didn't expect the animation to finish yet
3297   application.SendNotification();
3298   finishCheck.CheckSignalNotReceived();
3299   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3300
3301   application.SendNotification();
3302   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3303
3304   // We did expect the animation to finish
3305   application.SendNotification();
3306   finishCheck.CheckSignalReceived();
3307   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3308
3309   // Check that nothing has changed after a couple of buffer swaps
3310   application.Render(0);
3311   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3312   application.Render(0);
3313   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3314
3315   // Repeat with relative value "false" - this should be an NOOP
3316   animation = Animation::New(durationSeconds);
3317   bool noOpValue(false);
3318   animation.AnimateBy(Property(actor, index), noOpValue);
3319
3320   // Start the animation
3321   animation.Play();
3322
3323   finishCheck.Reset();
3324   animation.FinishedSignal().Connect(&application, finishCheck);
3325
3326   application.SendNotification();
3327   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3328
3329   // We didn't expect the animation to finish yet
3330   application.SendNotification();
3331   finishCheck.CheckSignalNotReceived();
3332   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3333
3334   application.SendNotification();
3335   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3336
3337   // We did expect the animation to finish
3338   application.SendNotification();
3339   finishCheck.CheckSignalReceived();
3340   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3341
3342   // Check that nothing has changed after a couple of buffer swaps
3343   application.Render(0);
3344   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3345   application.Render(0);
3346   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3347   END_TEST;
3348 }
3349
3350 int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void)
3351 {
3352   TestApplication application;
3353
3354   Actor actor = Actor::New();
3355
3356   // Register a boolean property
3357   bool            startValue(false);
3358   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3359   application.GetScene().Add(actor);
3360   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3361   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3362
3363   // Build the animation
3364   float     durationSeconds(2.0f);
3365   Animation animation = Animation::New(durationSeconds);
3366   bool      relativeValue(true);
3367   bool      finalValue(false || relativeValue);
3368   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN);
3369
3370   // Start the animation
3371   animation.Play();
3372
3373   bool                 signalReceived(false);
3374   AnimationFinishCheck finishCheck(signalReceived);
3375   animation.FinishedSignal().Connect(&application, finishCheck);
3376
3377   application.SendNotification();
3378   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3379
3380   // We didn't expect the animation to finish yet
3381   application.SendNotification();
3382   finishCheck.CheckSignalNotReceived();
3383   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3384
3385   application.SendNotification();
3386   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3387
3388   // We did expect the animation to finish
3389   application.SendNotification();
3390   finishCheck.CheckSignalReceived();
3391   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3392
3393   // Check that nothing has changed after a couple of buffer swaps
3394   application.Render(0);
3395   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3396   application.Render(0);
3397   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3398
3399   // Repeat with relative value "false" - this should be an NOOP
3400   animation = Animation::New(durationSeconds);
3401   bool noOpValue(false);
3402   animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunction::EASE_IN);
3403
3404   // Start the animation
3405   animation.Play();
3406
3407   finishCheck.Reset();
3408   animation.FinishedSignal().Connect(&application, finishCheck);
3409
3410   application.SendNotification();
3411   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3412
3413   // We didn't expect the animation to finish yet
3414   application.SendNotification();
3415   finishCheck.CheckSignalNotReceived();
3416   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3417
3418   application.SendNotification();
3419   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3420
3421   // We did expect the animation to finish
3422   application.SendNotification();
3423   finishCheck.CheckSignalReceived();
3424   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3425   END_TEST;
3426 }
3427
3428 int UtcDaliAnimationAnimateByBooleanTimePeriodP(void)
3429 {
3430   TestApplication application;
3431
3432   Actor actor = Actor::New();
3433
3434   // Register a boolean property
3435   bool            startValue(false);
3436   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3437   application.GetScene().Add(actor);
3438   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3439   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3440
3441   // Build the animation
3442   float     durationSeconds(2.0f);
3443   Animation animation = Animation::New(durationSeconds);
3444   bool      relativeValue(true);
3445   bool      finalValue(false || relativeValue);
3446   float     animatorDurationSeconds(durationSeconds * 0.5f);
3447   animation.AnimateBy(Property(actor, index),
3448                       relativeValue,
3449                       TimePeriod(animatorDurationSeconds));
3450
3451   // Start the animation
3452   animation.Play();
3453
3454   bool                 signalReceived(false);
3455   AnimationFinishCheck finishCheck(signalReceived);
3456   animation.FinishedSignal().Connect(&application, finishCheck);
3457
3458   application.SendNotification();
3459   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
3460
3461   // We didn't expect the animation to finish yet
3462   application.SendNotification();
3463   finishCheck.CheckSignalNotReceived();
3464   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3465
3466   application.SendNotification();
3467   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
3468
3469   // We didn't expect the animation to finish yet...
3470   application.SendNotification();
3471   finishCheck.CheckSignalNotReceived();
3472
3473   // ...however we should have reached the final value
3474   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3475
3476   application.SendNotification();
3477   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
3478
3479   // We did expect the animation to finish
3480   application.SendNotification();
3481   finishCheck.CheckSignalReceived();
3482   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3483
3484   // Check that nothing has changed after a couple of buffer swaps
3485   application.Render(0);
3486   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3487   application.Render(0);
3488   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3489   END_TEST;
3490 }
3491
3492 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void)
3493 {
3494   TestApplication application;
3495
3496   Actor actor = Actor::New();
3497
3498   // Register a boolean property
3499   bool            startValue(false);
3500   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3501   application.GetScene().Add(actor);
3502   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3503   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3504
3505   // Build the animation
3506   float     durationSeconds(2.0f);
3507   Animation animation = Animation::New(durationSeconds);
3508   bool      relativeValue(true);
3509   bool      finalValue(false || relativeValue);
3510   float     animatorDurationSeconds(durationSeconds * 0.5f);
3511   animation.AnimateBy(Property(actor, index),
3512                       relativeValue,
3513                       AlphaFunction::EASE_IN_OUT,
3514                       TimePeriod(animatorDurationSeconds));
3515
3516   // Start the animation
3517   animation.Play();
3518
3519   bool                 signalReceived(false);
3520   AnimationFinishCheck finishCheck(signalReceived);
3521   animation.FinishedSignal().Connect(&application, finishCheck);
3522
3523   application.SendNotification();
3524   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
3525
3526   // We didn't expect the animation to finish yet
3527   application.SendNotification();
3528   finishCheck.CheckSignalNotReceived();
3529   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3530
3531   application.SendNotification();
3532   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
3533
3534   // We didn't expect the animation to finish yet...
3535   application.SendNotification();
3536   finishCheck.CheckSignalNotReceived();
3537
3538   // ...however we should have reached the final value
3539   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3540
3541   application.SendNotification();
3542   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
3543
3544   // We did expect the animation to finish
3545   application.SendNotification();
3546   finishCheck.CheckSignalReceived();
3547   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3548
3549   // Check that nothing has changed after a couple of buffer swaps
3550   application.Render(0);
3551   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3552   application.Render(0);
3553   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3554   END_TEST;
3555 }
3556
3557 int UtcDaliAnimationAnimateByFloatP(void)
3558 {
3559   TestApplication application;
3560
3561   Actor actor = Actor::New();
3562
3563   // Register a float property
3564   float           startValue(10.0f);
3565   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3566   application.GetScene().Add(actor);
3567   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3568   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3569
3570   // Build the animation
3571   float     durationSeconds(2.0f);
3572   Animation animation = Animation::New(durationSeconds);
3573   float     targetValue(50.0f);
3574   float     relativeValue(targetValue - startValue);
3575   animation.AnimateBy(Property(actor, index), relativeValue);
3576
3577   float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
3578
3579   // Start the animation
3580   animation.Play();
3581
3582   // Target value should be retrievable straight away
3583   DALI_TEST_EQUALS(actor.GetProperty<float>(index), targetValue, TEST_LOCATION);
3584
3585   bool                 signalReceived(false);
3586   AnimationFinishCheck finishCheck(signalReceived);
3587   animation.FinishedSignal().Connect(&application, finishCheck);
3588
3589   application.SendNotification();
3590   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3591
3592   // We didn't expect the animation to finish yet
3593   application.SendNotification();
3594   finishCheck.CheckSignalNotReceived();
3595   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION);
3596
3597   application.SendNotification();
3598   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3599
3600   // We did expect the animation to finish
3601   application.SendNotification();
3602   finishCheck.CheckSignalReceived();
3603   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3604
3605   // Check that nothing has changed after a couple of buffer swaps
3606   application.Render(0);
3607   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3608   application.Render(0);
3609   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3610   END_TEST;
3611 }
3612
3613 int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void)
3614 {
3615   TestApplication application;
3616
3617   Actor actor = Actor::New();
3618
3619   // Register a float property
3620   float           startValue(10.0f);
3621   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3622   application.GetScene().Add(actor);
3623   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3624   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3625
3626   // Build the animation
3627   float     durationSeconds(1.0f);
3628   Animation animation = Animation::New(durationSeconds);
3629   float     targetValue(90.0f);
3630   float     relativeValue(targetValue - startValue);
3631   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3632
3633   float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
3634
3635   // Start the animation
3636   animation.Play();
3637
3638   bool                 signalReceived(false);
3639   AnimationFinishCheck finishCheck(signalReceived);
3640   animation.FinishedSignal().Connect(&application, finishCheck);
3641
3642   application.SendNotification();
3643   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3644
3645   // We didn't expect the animation to finish yet
3646   application.SendNotification();
3647   finishCheck.CheckSignalNotReceived();
3648
3649   // The position should have moved more, than with a linear alpha function
3650   float current(actor.GetCurrentProperty<float>(index));
3651   DALI_TEST_CHECK(current > ninetyFivePercentProgress);
3652
3653   application.SendNotification();
3654   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3655
3656   // We did expect the animation to finish
3657   application.SendNotification();
3658   finishCheck.CheckSignalReceived();
3659   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3660
3661   // Check that nothing has changed after a couple of buffer swaps
3662   application.Render(0);
3663   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3664   application.Render(0);
3665   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3666   END_TEST;
3667 }
3668
3669 int UtcDaliAnimationAnimateByFloatTimePeriodP(void)
3670 {
3671   TestApplication application;
3672
3673   Actor actor = Actor::New();
3674
3675   // Register a float property
3676   float           startValue(10.0f);
3677   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3678   application.GetScene().Add(actor);
3679   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3680   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3681
3682   // Build the animation
3683   float     durationSeconds(1.0f);
3684   Animation animation = Animation::New(durationSeconds);
3685   float     targetValue(30.0f);
3686   float     relativeValue(targetValue - startValue);
3687   float     delay = 0.5f;
3688   animation.AnimateBy(Property(actor, index),
3689                       relativeValue,
3690                       TimePeriod(delay, durationSeconds - delay));
3691
3692   // Start the animation
3693   animation.Play();
3694
3695   bool                 signalReceived(false);
3696   AnimationFinishCheck finishCheck(signalReceived);
3697   animation.FinishedSignal().Connect(&application, finishCheck);
3698
3699   application.SendNotification();
3700   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
3701
3702   // We didn't expect the animation to finish yet
3703   application.SendNotification();
3704   finishCheck.CheckSignalNotReceived();
3705   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3706
3707   application.SendNotification();
3708   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
3709
3710   // We didn't expect the animation to finish yet
3711   application.SendNotification();
3712   finishCheck.CheckSignalNotReceived();
3713   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
3714
3715   application.SendNotification();
3716   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
3717
3718   // We did expect the animation to finish
3719   application.SendNotification();
3720   finishCheck.CheckSignalReceived();
3721   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3722
3723   // Check that nothing has changed after a couple of buffer swaps
3724   application.Render(0);
3725   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3726   application.Render(0);
3727   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3728   END_TEST;
3729 }
3730
3731 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void)
3732 {
3733   TestApplication application;
3734
3735   Actor actor = Actor::New();
3736
3737   // Register a float property
3738   float           startValue(10.0f);
3739   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3740   application.GetScene().Add(actor);
3741   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3742   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3743
3744   // Build the animation
3745   float     durationSeconds(1.0f);
3746   Animation animation = Animation::New(durationSeconds);
3747   float     targetValue(30.0f);
3748   float     relativeValue(targetValue - startValue);
3749   float     delay = 0.5f;
3750   animation.AnimateBy(Property(actor, index),
3751                       relativeValue,
3752                       AlphaFunction::LINEAR,
3753                       TimePeriod(delay, durationSeconds - delay));
3754
3755   // Start the animation
3756   animation.Play();
3757
3758   bool                 signalReceived(false);
3759   AnimationFinishCheck finishCheck(signalReceived);
3760   animation.FinishedSignal().Connect(&application, finishCheck);
3761
3762   application.SendNotification();
3763   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
3764
3765   // We didn't expect the animation to finish yet
3766   application.SendNotification();
3767   finishCheck.CheckSignalNotReceived();
3768   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3769
3770   application.SendNotification();
3771   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
3772
3773   // We didn't expect the animation to finish yet
3774   application.SendNotification();
3775   finishCheck.CheckSignalNotReceived();
3776   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
3777
3778   application.SendNotification();
3779   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
3780
3781   // We did expect the animation to finish
3782   application.SendNotification();
3783   finishCheck.CheckSignalReceived();
3784   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3785
3786   // Check that nothing has changed after a couple of buffer swaps
3787   application.Render(0);
3788   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3789   application.Render(0);
3790   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3791   END_TEST;
3792 }
3793
3794 int UtcDaliAnimationAnimateByIntegerP(void)
3795 {
3796   TestApplication application;
3797
3798   Actor actor = Actor::New();
3799
3800   // Register an integer property
3801   int             startValue(1);
3802   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3803   application.GetScene().Add(actor);
3804   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
3805   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3806
3807   // Build the animation
3808   float     durationSeconds(2.0f);
3809   Animation animation = Animation::New(durationSeconds);
3810   int       targetValue(50);
3811   int       relativeValue(targetValue - startValue);
3812   animation.AnimateBy(Property(actor, index), relativeValue);
3813
3814   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
3815
3816   // Start the animation
3817   animation.Play();
3818
3819   // Target value should be retrievable straight away
3820   DALI_TEST_EQUALS(actor.GetProperty<int>(index), targetValue, TEST_LOCATION);
3821
3822   bool                 signalReceived(false);
3823   AnimationFinishCheck finishCheck(signalReceived);
3824   animation.FinishedSignal().Connect(&application, finishCheck);
3825
3826   application.SendNotification();
3827   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3828
3829   // We didn't expect the animation to finish yet
3830   application.SendNotification();
3831   finishCheck.CheckSignalNotReceived();
3832   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION);
3833
3834   application.SendNotification();
3835   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3836
3837   // We did expect the animation to finish
3838   application.SendNotification();
3839   finishCheck.CheckSignalReceived();
3840   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3841
3842   // Check that nothing has changed after a couple of buffer swaps
3843   application.Render(0);
3844   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3845   application.Render(0);
3846   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3847   END_TEST;
3848 }
3849
3850 int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void)
3851 {
3852   TestApplication application;
3853
3854   Actor actor = Actor::New();
3855
3856   // Register an integer property
3857   int             startValue(1);
3858   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3859   application.GetScene().Add(actor);
3860   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
3861   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3862
3863   // Build the animation
3864   float     durationSeconds(1.0f);
3865   Animation animation = Animation::New(durationSeconds);
3866   int       targetValue(90);
3867   int       relativeValue(targetValue - startValue);
3868   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3869
3870   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
3871
3872   // Start the animation
3873   animation.Play();
3874
3875   bool                 signalReceived(false);
3876   AnimationFinishCheck finishCheck(signalReceived);
3877   animation.FinishedSignal().Connect(&application, finishCheck);
3878
3879   application.SendNotification();
3880   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3881
3882   // We didn't expect the animation to finish yet
3883   application.SendNotification();
3884   finishCheck.CheckSignalNotReceived();
3885
3886   // The position should have moved more, than with a linear alpha function
3887   int current(actor.GetCurrentProperty<int>(index));
3888   DALI_TEST_CHECK(current > ninetyFivePercentProgress);
3889
3890   application.SendNotification();
3891   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3892
3893   // We did expect the animation to finish
3894   application.SendNotification();
3895   finishCheck.CheckSignalReceived();
3896   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3897
3898   // Check that nothing has changed after a couple of buffer swaps
3899   application.Render(0);
3900   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3901   application.Render(0);
3902   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3903   END_TEST;
3904 }
3905
3906 int UtcDaliAnimationAnimateByIntegerTimePeriodP(void)
3907 {
3908   TestApplication application;
3909
3910   Actor actor = Actor::New();
3911
3912   // Register an integer property
3913   int             startValue(10);
3914   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3915   application.GetScene().Add(actor);
3916   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
3917   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3918
3919   // Build the animation
3920   float     durationSeconds(1.0f);
3921   Animation animation = Animation::New(durationSeconds);
3922   int       targetValue(30);
3923   int       relativeValue(targetValue - startValue);
3924   float     delay = 0.5f;
3925   animation.AnimateBy(Property(actor, index),
3926                       relativeValue,
3927                       TimePeriod(delay, durationSeconds - delay));
3928
3929   // Start the animation
3930   animation.Play();
3931
3932   bool                 signalReceived(false);
3933   AnimationFinishCheck finishCheck(signalReceived);
3934   animation.FinishedSignal().Connect(&application, finishCheck);
3935
3936   application.SendNotification();
3937   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
3938
3939   // We didn't expect the animation to finish yet
3940   application.SendNotification();
3941   finishCheck.CheckSignalNotReceived();
3942   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3943
3944   application.SendNotification();
3945   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
3946
3947   // We didn't expect the animation to finish yet
3948   application.SendNotification();
3949   finishCheck.CheckSignalNotReceived();
3950   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
3951
3952   application.SendNotification();
3953   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
3954
3955   // We did expect the animation to finish
3956   application.SendNotification();
3957   finishCheck.CheckSignalReceived();
3958   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3959
3960   // Check that nothing has changed after a couple of buffer swaps
3961   application.Render(0);
3962   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3963   application.Render(0);
3964   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3965   END_TEST;
3966 }
3967
3968 int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void)
3969 {
3970   TestApplication application;
3971
3972   Actor actor = Actor::New();
3973
3974   // Register an integer property
3975   int             startValue(10);
3976   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3977   application.GetScene().Add(actor);
3978   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
3979   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3980
3981   // Build the animation
3982   float     durationSeconds(1.0f);
3983   Animation animation = Animation::New(durationSeconds);
3984   int       targetValue(30);
3985   int       relativeValue(targetValue - startValue);
3986   float     delay = 0.5f;
3987   animation.AnimateBy(Property(actor, index),
3988                       relativeValue,
3989                       AlphaFunction::LINEAR,
3990                       TimePeriod(delay, durationSeconds - delay));
3991
3992   // Start the animation
3993   animation.Play();
3994
3995   bool                 signalReceived(false);
3996   AnimationFinishCheck finishCheck(signalReceived);
3997   animation.FinishedSignal().Connect(&application, finishCheck);
3998
3999   application.SendNotification();
4000   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4001
4002   // We didn't expect the animation to finish yet
4003   application.SendNotification();
4004   finishCheck.CheckSignalNotReceived();
4005   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
4006
4007   application.SendNotification();
4008   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4009
4010   // We didn't expect the animation to finish yet
4011   application.SendNotification();
4012   finishCheck.CheckSignalNotReceived();
4013   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
4014
4015   application.SendNotification();
4016   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4017
4018   // We did expect the animation to finish
4019   application.SendNotification();
4020   finishCheck.CheckSignalReceived();
4021   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4022
4023   // Check that nothing has changed after a couple of buffer swaps
4024   application.Render(0);
4025   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4026   application.Render(0);
4027   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4028   END_TEST;
4029 }
4030
4031 int UtcDaliAnimationAnimateByQuaternionP(void)
4032 {
4033   TestApplication application;
4034
4035   Actor actor = Actor::New();
4036
4037   // Register a quaternion property
4038   const Quaternion startValue(Degree(90), Vector3::XAXIS);
4039   Property::Index  index = actor.RegisterProperty("testProperty", startValue);
4040   application.GetScene().Add(actor);
4041   DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == startValue);
4042   DALI_TEST_CHECK(actor.GetCurrentProperty<Quaternion>(index) == startValue);
4043
4044   // Build the animation
4045   float            durationSeconds(2.0f);
4046   Animation        animation = Animation::New(durationSeconds);
4047   const Quaternion relativeValue(Degree(90), Vector3::ZAXIS);
4048   const Quaternion finalValue(startValue * relativeValue);
4049   animation.AnimateBy(Property(actor, index), relativeValue);
4050
4051   DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == startValue);
4052   DALI_TEST_CHECK(actor.GetCurrentProperty<Quaternion>(index) == startValue);
4053
4054   // Start the animation
4055   animation.Play();
4056
4057   // Target value should be retrievable straight away
4058   DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == finalValue);
4059
4060   application.SendNotification();
4061   application.Render(2000); // animation complete
4062
4063   DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == finalValue);
4064   DALI_TEST_CHECK(actor.GetCurrentProperty<Quaternion>(index) == finalValue);
4065
4066   END_TEST;
4067 }
4068
4069 int UtcDaliAnimationAnimateByVector2P(void)
4070 {
4071   TestApplication application;
4072
4073   Actor actor = Actor::New();
4074
4075   // Register a Vector2 property
4076   Vector2         startValue(10.0f, 10.0f);
4077   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4078   application.GetScene().Add(actor);
4079   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4080   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4081
4082   // Build the animation
4083   float     durationSeconds(2.0f);
4084   Animation animation = Animation::New(durationSeconds);
4085   Vector2   targetValue(60.0f, 60.0f);
4086   Vector2   relativeValue(targetValue - startValue);
4087   animation.AnimateBy(Property(actor, index), relativeValue);
4088
4089   Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4090
4091   // Start the animation
4092   animation.Play();
4093
4094   // Target value should be retrievable straight away
4095   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION);
4096
4097   bool                 signalReceived(false);
4098   AnimationFinishCheck finishCheck(signalReceived);
4099   animation.FinishedSignal().Connect(&application, finishCheck);
4100
4101   application.SendNotification();
4102   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4103
4104   // We didn't expect the animation to finish yet
4105   application.SendNotification();
4106   finishCheck.CheckSignalNotReceived();
4107   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION);
4108
4109   application.SendNotification();
4110   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4111
4112   // We did expect the animation to finish
4113   application.SendNotification();
4114   finishCheck.CheckSignalReceived();
4115   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4116
4117   // Check that nothing has changed after a couple of buffer swaps
4118   application.Render(0);
4119   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4120   application.Render(0);
4121   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4122   END_TEST;
4123 }
4124
4125 int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void)
4126 {
4127   TestApplication application;
4128
4129   Actor actor = Actor::New();
4130
4131   // Register a Vector2 property
4132   Vector2         startValue(100.0f, 100.0f);
4133   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4134   application.GetScene().Add(actor);
4135   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4136   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4137
4138   // Build the animation
4139   float     durationSeconds(1.0f);
4140   Animation animation = Animation::New(durationSeconds);
4141   Vector2   targetValue(20.0f, 20.0f);
4142   Vector2   relativeValue(targetValue - startValue);
4143   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4144
4145   Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4146
4147   // Start the animation
4148   animation.Play();
4149
4150   bool                 signalReceived(false);
4151   AnimationFinishCheck finishCheck(signalReceived);
4152   animation.FinishedSignal().Connect(&application, finishCheck);
4153
4154   application.SendNotification();
4155   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4156
4157   // We didn't expect the animation to finish yet
4158   application.SendNotification();
4159   finishCheck.CheckSignalNotReceived();
4160
4161   // The position should have moved more, than with a linear alpha function
4162   Vector2 current(actor.GetCurrentProperty<Vector2>(index));
4163   DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x);
4164   DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y);
4165
4166   application.SendNotification();
4167   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4168
4169   // We did expect the animation to finish
4170   application.SendNotification();
4171   finishCheck.CheckSignalReceived();
4172   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4173
4174   // Check that nothing has changed after a couple of buffer swaps
4175   application.Render(0);
4176   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4177   application.Render(0);
4178   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4179   END_TEST;
4180 }
4181
4182 int UtcDaliAnimationAnimateByVector2TimePeriodP(void)
4183 {
4184   TestApplication application;
4185
4186   Actor actor = Actor::New();
4187
4188   // Register a Vector2 property
4189   Vector2         startValue(10.0f, 10.0f);
4190   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4191   application.GetScene().Add(actor);
4192   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4193   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4194
4195   // Build the animation
4196   float     durationSeconds(1.0f);
4197   Animation animation = Animation::New(durationSeconds);
4198   Vector2   targetValue(30.0f, 30.0f);
4199   Vector2   relativeValue(targetValue - startValue);
4200   float     delay = 0.5f;
4201   animation.AnimateBy(Property(actor, index),
4202                       relativeValue,
4203                       TimePeriod(delay, durationSeconds - delay));
4204
4205   // Start the animation
4206   animation.Play();
4207
4208   bool                 signalReceived(false);
4209   AnimationFinishCheck finishCheck(signalReceived);
4210   animation.FinishedSignal().Connect(&application, finishCheck);
4211
4212   application.SendNotification();
4213   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4214
4215   // We didn't expect the animation to finish yet
4216   application.SendNotification();
4217   finishCheck.CheckSignalNotReceived();
4218   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4219
4220   application.SendNotification();
4221   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4222
4223   // We didn't expect the animation to finish yet
4224   application.SendNotification();
4225   finishCheck.CheckSignalNotReceived();
4226   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4227
4228   application.SendNotification();
4229   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4230
4231   // We did expect the animation to finish
4232   application.SendNotification();
4233   finishCheck.CheckSignalReceived();
4234   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4235
4236   // Check that nothing has changed after a couple of buffer swaps
4237   application.Render(0);
4238   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4239   application.Render(0);
4240   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4241   END_TEST;
4242 }
4243
4244 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void)
4245 {
4246   TestApplication application;
4247
4248   Actor actor = Actor::New();
4249
4250   // Register a Vector2 property
4251   Vector2         startValue(5.0f, 5.0f);
4252   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4253   application.GetScene().Add(actor);
4254   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4255   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4256
4257   // Build the animation
4258   float     durationSeconds(1.0f);
4259   Animation animation = Animation::New(durationSeconds);
4260   Vector2   targetValue(10.0f, 10.0f);
4261   Vector2   relativeValue(targetValue - startValue);
4262   float     delay = 0.5f;
4263   animation.AnimateBy(Property(actor, index),
4264                       relativeValue,
4265                       AlphaFunction::LINEAR,
4266                       TimePeriod(delay, durationSeconds - delay));
4267
4268   // Start the animation
4269   animation.Play();
4270
4271   bool                 signalReceived(false);
4272   AnimationFinishCheck finishCheck(signalReceived);
4273   animation.FinishedSignal().Connect(&application, finishCheck);
4274
4275   application.SendNotification();
4276   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4277
4278   // We didn't expect the animation to finish yet
4279   application.SendNotification();
4280   finishCheck.CheckSignalNotReceived();
4281   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4282
4283   application.SendNotification();
4284   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4285
4286   // We didn't expect the animation to finish yet
4287   application.SendNotification();
4288   finishCheck.CheckSignalNotReceived();
4289   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4290
4291   application.SendNotification();
4292   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4293
4294   // We did expect the animation to finish
4295   application.SendNotification();
4296   finishCheck.CheckSignalReceived();
4297   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4298
4299   // Check that nothing has changed after a couple of buffer swaps
4300   application.Render(0);
4301   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4302   application.Render(0);
4303   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4304   END_TEST;
4305 }
4306
4307 int UtcDaliAnimationAnimateByVector3P(void)
4308 {
4309   TestApplication application;
4310
4311   Actor actor = Actor::New();
4312
4313   // Register a Vector3 property
4314   Vector3         startValue(10.0f, 10.0f, 10.0f);
4315   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4316   application.GetScene().Add(actor);
4317   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4318   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4319
4320   // Build the animation
4321   float     durationSeconds(2.0f);
4322   Animation animation = Animation::New(durationSeconds);
4323   Vector3   targetValue(60.0f, 60.0f, 60.0f);
4324   Vector3   relativeValue(targetValue - startValue);
4325   animation.AnimateBy(Property(actor, index), relativeValue);
4326
4327   Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4328
4329   // Start the animation
4330   animation.Play();
4331
4332   // Target value should be retrievable straight away
4333   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION);
4334
4335   bool                 signalReceived(false);
4336   AnimationFinishCheck finishCheck(signalReceived);
4337   animation.FinishedSignal().Connect(&application, finishCheck);
4338
4339   application.SendNotification();
4340   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4341
4342   // We didn't expect the animation to finish yet
4343   application.SendNotification();
4344   finishCheck.CheckSignalNotReceived();
4345   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION);
4346
4347   application.SendNotification();
4348   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4349
4350   // We did expect the animation to finish
4351   application.SendNotification();
4352   finishCheck.CheckSignalReceived();
4353   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4354
4355   // Check that nothing has changed after a couple of buffer swaps
4356   application.Render(0);
4357   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4358   application.Render(0);
4359   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4360   END_TEST;
4361 }
4362
4363 int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void)
4364 {
4365   TestApplication application;
4366
4367   Actor actor = Actor::New();
4368
4369   // Register a Vector3 property
4370   Vector3         startValue(100.0f, 100.0f, 100.0f);
4371   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4372   application.GetScene().Add(actor);
4373   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4374   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4375
4376   // Build the animation
4377   float     durationSeconds(1.0f);
4378   Animation animation = Animation::New(durationSeconds);
4379   Vector3   targetValue(20.0f, 20.0f, 20.0f);
4380   Vector3   relativeValue(targetValue - startValue);
4381   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4382
4383   Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4384
4385   // Start the animation
4386   animation.Play();
4387
4388   bool                 signalReceived(false);
4389   AnimationFinishCheck finishCheck(signalReceived);
4390   animation.FinishedSignal().Connect(&application, finishCheck);
4391
4392   application.SendNotification();
4393   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4394
4395   // We didn't expect the animation to finish yet
4396   application.SendNotification();
4397   finishCheck.CheckSignalNotReceived();
4398
4399   // The position should have moved more, than with a linear alpha function
4400   Vector3 current(actor.GetCurrentProperty<Vector3>(index));
4401   DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x);
4402   DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y);
4403   DALI_TEST_CHECK(current.z < ninetyFivePercentProgress.z);
4404
4405   application.SendNotification();
4406   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4407
4408   // We did expect the animation to finish
4409   application.SendNotification();
4410   finishCheck.CheckSignalReceived();
4411   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4412
4413   // Check that nothing has changed after a couple of buffer swaps
4414   application.Render(0);
4415   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4416   application.Render(0);
4417   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4418   END_TEST;
4419 }
4420
4421 int UtcDaliAnimationAnimateByVector3TimePeriodP(void)
4422 {
4423   TestApplication application;
4424
4425   Actor actor = Actor::New();
4426
4427   // Register a Vector3 property
4428   Vector3         startValue(10.0f, 10.0f, 10.0f);
4429   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4430   application.GetScene().Add(actor);
4431   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4432   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4433
4434   // Build the animation
4435   float     durationSeconds(1.0f);
4436   Animation animation = Animation::New(durationSeconds);
4437   Vector3   targetValue(30.0f, 30.0f, 30.0f);
4438   Vector3   relativeValue(targetValue - startValue);
4439   float     delay = 0.5f;
4440   animation.AnimateBy(Property(actor, index),
4441                       relativeValue,
4442                       TimePeriod(delay, durationSeconds - delay));
4443
4444   // Start the animation
4445   animation.Play();
4446
4447   bool                 signalReceived(false);
4448   AnimationFinishCheck finishCheck(signalReceived);
4449   animation.FinishedSignal().Connect(&application, finishCheck);
4450
4451   application.SendNotification();
4452   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4453
4454   // We didn't expect the animation to finish yet
4455   application.SendNotification();
4456   finishCheck.CheckSignalNotReceived();
4457   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4458
4459   application.SendNotification();
4460   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4461
4462   // We didn't expect the animation to finish yet
4463   application.SendNotification();
4464   finishCheck.CheckSignalNotReceived();
4465   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4466
4467   application.SendNotification();
4468   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4469
4470   // We did expect the animation to finish
4471   application.SendNotification();
4472   finishCheck.CheckSignalReceived();
4473   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4474
4475   // Check that nothing has changed after a couple of buffer swaps
4476   application.Render(0);
4477   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4478   application.Render(0);
4479   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4480   END_TEST;
4481 }
4482
4483 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void)
4484 {
4485   TestApplication application;
4486
4487   Actor actor = Actor::New();
4488
4489   // Register a Vector3 property
4490   Vector3         startValue(5.0f, 5.0f, 5.0f);
4491   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4492   application.GetScene().Add(actor);
4493   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4494   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4495
4496   // Build the animation
4497   float     durationSeconds(1.0f);
4498   Animation animation = Animation::New(durationSeconds);
4499   Vector3   targetValue(10.0f, 10.0f, 10.0f);
4500   Vector3   relativeValue(targetValue - startValue);
4501   float     delay = 0.5f;
4502   animation.AnimateBy(Property(actor, index),
4503                       relativeValue,
4504                       AlphaFunction::LINEAR,
4505                       TimePeriod(delay, durationSeconds - delay));
4506
4507   // Start the animation
4508   animation.Play();
4509
4510   bool                 signalReceived(false);
4511   AnimationFinishCheck finishCheck(signalReceived);
4512   animation.FinishedSignal().Connect(&application, finishCheck);
4513
4514   application.SendNotification();
4515   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4516
4517   // We didn't expect the animation to finish yet
4518   application.SendNotification();
4519   finishCheck.CheckSignalNotReceived();
4520   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4521
4522   application.SendNotification();
4523   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4524
4525   // We didn't expect the animation to finish yet
4526   application.SendNotification();
4527   finishCheck.CheckSignalNotReceived();
4528   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4529
4530   application.SendNotification();
4531   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4532
4533   // We did expect the animation to finish
4534   application.SendNotification();
4535   finishCheck.CheckSignalReceived();
4536   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4537
4538   // Check that nothing has changed after a couple of buffer swaps
4539   application.Render(0);
4540   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4541   application.Render(0);
4542   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4543   END_TEST;
4544 }
4545
4546 int UtcDaliAnimationAnimateByVector4P(void)
4547 {
4548   TestApplication application;
4549
4550   Actor actor = Actor::New();
4551
4552   // Register a Vector4 property
4553   Vector4         startValue(10.0f, 10.0f, 10.0f, 10.0f);
4554   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4555   application.GetScene().Add(actor);
4556   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4557   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4558
4559   // Build the animation
4560   float     durationSeconds(2.0f);
4561   Animation animation = Animation::New(durationSeconds);
4562   Vector4   targetValue(60.0f, 60.0f, 60.0f, 60.0f);
4563   Vector4   relativeValue(targetValue - startValue);
4564   animation.AnimateBy(Property(actor, index), relativeValue);
4565
4566   Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4567
4568   // Start the animation
4569   animation.Play();
4570
4571   // Target value should be retrievable straight away
4572   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION);
4573
4574   bool                 signalReceived(false);
4575   AnimationFinishCheck finishCheck(signalReceived);
4576   animation.FinishedSignal().Connect(&application, finishCheck);
4577
4578   application.SendNotification();
4579   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4580
4581   // We didn't expect the animation to finish yet
4582   application.SendNotification();
4583   finishCheck.CheckSignalNotReceived();
4584   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION);
4585
4586   application.SendNotification();
4587   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4588
4589   // We did expect the animation to finish
4590   application.SendNotification();
4591   finishCheck.CheckSignalReceived();
4592   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4593
4594   // Check that nothing has changed after a couple of buffer swaps
4595   application.Render(0);
4596   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4597   application.Render(0);
4598   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4599   END_TEST;
4600 }
4601
4602 int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void)
4603 {
4604   TestApplication application;
4605
4606   Actor actor = Actor::New();
4607
4608   // Register a Vector4 property
4609   Vector4         startValue(100.0f, 100.0f, 100.0f, 100.0f);
4610   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4611   application.GetScene().Add(actor);
4612   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4613   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4614
4615   // Build the animation
4616   float     durationSeconds(1.0f);
4617   Animation animation = Animation::New(durationSeconds);
4618   Vector4   targetValue(20.0f, 20.0f, 20.0f, 20.0f);
4619   Vector4   relativeValue(targetValue - startValue);
4620   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4621
4622   Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4623
4624   // Start the animation
4625   animation.Play();
4626
4627   bool                 signalReceived(false);
4628   AnimationFinishCheck finishCheck(signalReceived);
4629   animation.FinishedSignal().Connect(&application, finishCheck);
4630
4631   application.SendNotification();
4632   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4633
4634   // We didn't expect the animation to finish yet
4635   application.SendNotification();
4636   finishCheck.CheckSignalNotReceived();
4637
4638   // The position should have moved more, than with a linear alpha function
4639   Vector4 current(actor.GetCurrentProperty<Vector4>(index));
4640   DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x);
4641   DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y);
4642   DALI_TEST_CHECK(current.z < ninetyFivePercentProgress.z);
4643   DALI_TEST_CHECK(current.w < ninetyFivePercentProgress.w);
4644
4645   application.SendNotification();
4646   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4647
4648   // We did expect the animation to finish
4649   application.SendNotification();
4650   finishCheck.CheckSignalReceived();
4651   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4652
4653   // Check that nothing has changed after a couple of buffer swaps
4654   application.Render(0);
4655   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4656   application.Render(0);
4657   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4658   END_TEST;
4659 }
4660
4661 int UtcDaliAnimationAnimateByVector4TimePeriodP(void)
4662 {
4663   TestApplication application;
4664
4665   Actor actor = Actor::New();
4666
4667   // Register a Vector4 property
4668   Vector4         startValue(10.0f, 10.0f, 10.0f, 10.0f);
4669   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4670   application.GetScene().Add(actor);
4671   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4672   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4673
4674   // Build the animation
4675   float     durationSeconds(1.0f);
4676   Animation animation = Animation::New(durationSeconds);
4677   Vector4   targetValue(30.0f, 30.0f, 30.0f, 30.0f);
4678   Vector4   relativeValue(targetValue - startValue);
4679   float     delay = 0.5f;
4680   animation.AnimateBy(Property(actor, index),
4681                       relativeValue,
4682                       TimePeriod(delay, durationSeconds - delay));
4683
4684   // Start the animation
4685   animation.Play();
4686
4687   bool                 signalReceived(false);
4688   AnimationFinishCheck finishCheck(signalReceived);
4689   animation.FinishedSignal().Connect(&application, finishCheck);
4690
4691   application.SendNotification();
4692   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4693
4694   // We didn't expect the animation to finish yet
4695   application.SendNotification();
4696   finishCheck.CheckSignalNotReceived();
4697   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4698
4699   application.SendNotification();
4700   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4701
4702   // We didn't expect the animation to finish yet
4703   application.SendNotification();
4704   finishCheck.CheckSignalNotReceived();
4705   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4706
4707   application.SendNotification();
4708   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4709
4710   // We did expect the animation to finish
4711   application.SendNotification();
4712   finishCheck.CheckSignalReceived();
4713   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4714
4715   // Check that nothing has changed after a couple of buffer swaps
4716   application.Render(0);
4717   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4718   application.Render(0);
4719   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4720   END_TEST;
4721 }
4722
4723 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void)
4724 {
4725   TestApplication application;
4726
4727   Actor actor = Actor::New();
4728
4729   // Register a Vector4 property
4730   Vector4         startValue(5.0f, 5.0f, 5.0f, 5.0f);
4731   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4732   application.GetScene().Add(actor);
4733   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4734   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4735
4736   // Build the animation
4737   float     durationSeconds(1.0f);
4738   Animation animation = Animation::New(durationSeconds);
4739   Vector4   targetValue(10.0f, 10.0f, 10.0f, 10.0f);
4740   Vector4   relativeValue(targetValue - startValue);
4741   float     delay = 0.5f;
4742   animation.AnimateBy(Property(actor, index),
4743                       relativeValue,
4744                       AlphaFunction::LINEAR,
4745                       TimePeriod(delay, durationSeconds - delay));
4746
4747   // Start the animation
4748   animation.Play();
4749
4750   bool                 signalReceived(false);
4751   AnimationFinishCheck finishCheck(signalReceived);
4752   animation.FinishedSignal().Connect(&application, finishCheck);
4753
4754   application.SendNotification();
4755   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4756
4757   // We didn't expect the animation to finish yet
4758   application.SendNotification();
4759   finishCheck.CheckSignalNotReceived();
4760   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4761
4762   application.SendNotification();
4763   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4764
4765   // We didn't expect the animation to finish yet
4766   application.SendNotification();
4767   finishCheck.CheckSignalNotReceived();
4768   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4769
4770   application.SendNotification();
4771   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4772
4773   // We did expect the animation to finish
4774   application.SendNotification();
4775   finishCheck.CheckSignalReceived();
4776   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4777
4778   // Check that nothing has changed after a couple of buffer swaps
4779   application.Render(0);
4780   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4781   application.Render(0);
4782   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4783   END_TEST;
4784 }
4785
4786 int UtcDaliAnimationAnimateByActorPositionP(void)
4787 {
4788   TestApplication application;
4789
4790   Actor   actor = Actor::New();
4791   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4792   actor.SetProperty(Actor::Property::POSITION, startPosition);
4793   application.GetScene().Add(actor);
4794   application.SendNotification();
4795   application.Render(0);
4796   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4797
4798   // Build the animation
4799   float     durationSeconds(1.0f);
4800   Animation animation = Animation::New(durationSeconds);
4801   Vector3   targetPosition(20.0f, 20.0f, 20.0f);
4802   Vector3   relativePosition(targetPosition - startPosition);
4803   animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition);
4804
4805   Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
4806
4807   // Start the animation
4808   animation.Play();
4809
4810   // Target value should be retrievable straight away
4811   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4812
4813   bool                 signalReceived(false);
4814   AnimationFinishCheck finishCheck(signalReceived);
4815   animation.FinishedSignal().Connect(&application, finishCheck);
4816
4817   application.SendNotification();
4818   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4819
4820   // We didn't expect the animation to finish yet
4821   application.SendNotification();
4822   finishCheck.CheckSignalNotReceived();
4823   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), ninetyFivePercentProgress, TEST_LOCATION);
4824
4825   application.SendNotification();
4826   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4827
4828   // We did expect the animation to finish
4829   application.SendNotification();
4830   finishCheck.CheckSignalReceived();
4831   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4832
4833   // Check that nothing has changed after a couple of buffer swaps
4834   application.Render(0);
4835   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4836   application.Render(0);
4837   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4838   END_TEST;
4839 }
4840
4841 int UtcDaliAnimationAnimateByActorPositionComponentsP(void)
4842 {
4843   TestApplication application;
4844
4845   Actor actor = Actor::New();
4846   application.GetScene().Add(actor);
4847   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
4848
4849   // Build the animation
4850   float     durationSeconds(1.0f);
4851   Animation animation = Animation::New(durationSeconds);
4852   Vector3   targetPosition(200.0f, 300.0f, 400.0f);
4853   Vector3   relativePosition(targetPosition - Vector3::ZERO);
4854   animation.AnimateBy(Property(actor, Actor::Property::POSITION_X), relativePosition.x);
4855   animation.AnimateBy(Property(actor, Actor::Property::POSITION_Y), relativePosition.y);
4856   animation.AnimateBy(Property(actor, Actor::Property::POSITION_Z), relativePosition.z);
4857
4858   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
4859   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
4860
4861   // Start the animation
4862   animation.Play();
4863
4864   // Target value should be retrievable straight away
4865   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4866   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
4867   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
4868   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
4869
4870   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); // Not changed yet
4871
4872   application.SendNotification();
4873   application.Render(1000); // 1 second progress
4874
4875   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4876
4877   END_TEST;
4878 }
4879
4880 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
4881 {
4882   TestApplication application;
4883
4884   Actor   actor = Actor::New();
4885   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4886   actor.SetProperty(Actor::Property::POSITION, startPosition);
4887   application.GetScene().Add(actor);
4888   application.SendNotification();
4889   application.Render(0);
4890   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4891
4892   // Build the animation
4893   float     durationSeconds(1.0f);
4894   Animation animation = Animation::New(durationSeconds);
4895   Vector3   targetPosition(20.0f, 20.0f, 20.0f);
4896   Vector3   relativePosition(targetPosition - startPosition);
4897   animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
4898
4899   Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
4900
4901   // Start the animation
4902   animation.Play();
4903
4904   bool                 signalReceived(false);
4905   AnimationFinishCheck finishCheck(signalReceived);
4906   animation.FinishedSignal().Connect(&application, finishCheck);
4907
4908   application.SendNotification();
4909   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4910
4911   // We didn't expect the animation to finish yet
4912   application.SendNotification();
4913   finishCheck.CheckSignalNotReceived();
4914
4915   // The position should have moved more, than with a linear alpha function
4916   Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
4917   DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
4918   DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
4919   DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z);
4920
4921   application.SendNotification();
4922   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4923
4924   // We did expect the animation to finish
4925   application.SendNotification();
4926   finishCheck.CheckSignalReceived();
4927   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4928
4929   // Check that nothing has changed after a couple of buffer swaps
4930   application.Render(0);
4931   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4932   application.Render(0);
4933   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4934   END_TEST;
4935 }
4936
4937 int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void)
4938 {
4939   TestApplication application;
4940
4941   Actor   actor = Actor::New();
4942   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4943   actor.SetProperty(Actor::Property::POSITION, startPosition);
4944   application.GetScene().Add(actor);
4945   application.SendNotification();
4946   application.Render(0);
4947   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4948
4949   // Build the animation
4950   float     durationSeconds(1.0f);
4951   Animation animation = Animation::New(durationSeconds);
4952   Vector3   targetPosition(20.0f, 20.0f, 20.0f);
4953   Vector3   relativePosition(targetPosition - startPosition);
4954   float     delay = 0.5f;
4955   animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4956                       relativePosition,
4957                       TimePeriod(delay, durationSeconds - delay));
4958
4959   Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
4960
4961   // Start the animation
4962   animation.Play();
4963
4964   bool                 signalReceived(false);
4965   AnimationFinishCheck finishCheck(signalReceived);
4966   animation.FinishedSignal().Connect(&application, finishCheck);
4967
4968   application.SendNotification();
4969   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4970
4971   // We didn't expect the animation to finish yet
4972   application.SendNotification();
4973   finishCheck.CheckSignalNotReceived();
4974   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4975
4976   application.SendNotification();
4977   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
4978
4979   // We did expect the animation to finish
4980   application.SendNotification();
4981   finishCheck.CheckSignalReceived();
4982   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4983
4984   // Check that nothing has changed after a couple of buffer swaps
4985   application.Render(0);
4986   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4987   application.Render(0);
4988   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4989   END_TEST;
4990 }
4991
4992 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void)
4993 {
4994   TestApplication application;
4995
4996   Actor   actor = Actor::New();
4997   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4998   actor.SetProperty(Actor::Property::POSITION, startPosition);
4999   application.GetScene().Add(actor);
5000   application.SendNotification();
5001   application.Render(0);
5002   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
5003
5004   // Build the animation
5005   float     durationSeconds(1.0f);
5006   Animation animation = Animation::New(durationSeconds);
5007   Vector3   targetPosition(20.0f, 20.0f, 20.0f);
5008   Vector3   relativePosition(targetPosition - startPosition);
5009   float     delay = 0.5f;
5010   animation.AnimateBy(Property(actor, Actor::Property::POSITION),
5011                       relativePosition,
5012                       AlphaFunction::LINEAR,
5013                       TimePeriod(delay, durationSeconds - delay));
5014
5015   Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
5016
5017   // Start the animation
5018   animation.Play();
5019
5020   bool                 signalReceived(false);
5021   AnimationFinishCheck finishCheck(signalReceived);
5022   animation.FinishedSignal().Connect(&application, finishCheck);
5023
5024   application.SendNotification();
5025   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
5026
5027   // We didn't expect the animation to finish yet
5028   application.SendNotification();
5029   finishCheck.CheckSignalNotReceived();
5030   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
5031
5032   application.SendNotification();
5033   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
5034
5035   // We did expect the animation to finish
5036   application.SendNotification();
5037   finishCheck.CheckSignalReceived();
5038   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5039
5040   // Check that nothing has changed after a couple of buffer swaps
5041   application.Render(0);
5042   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5043   application.Render(0);
5044   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5045   END_TEST;
5046 }
5047
5048 int UtcDaliAnimationAnimateByActorOrientationP1(void)
5049 {
5050   TestApplication application;
5051
5052   Actor actor = Actor::New();
5053   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
5054   application.GetScene().Add(actor);
5055   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5056
5057   // Build the animation
5058   float     durationSeconds(1.0f);
5059   Animation animation = Animation::New(durationSeconds);
5060   Degree    relativeRotationDegrees(360.0f);
5061   Radian    relativeRotationRadians(relativeRotationDegrees);
5062   animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS));
5063
5064   // Start the animation
5065   animation.Play();
5066
5067   // Target value should be retrievable straight away
5068   DALI_TEST_EQUALS(actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), TEST_LOCATION);
5069
5070   bool                 signalReceived(false);
5071   AnimationFinishCheck finishCheck(signalReceived);
5072   animation.FinishedSignal().Connect(&application, finishCheck);
5073
5074   application.SendNotification();
5075   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5076
5077   // We didn't expect the animation to finish yet
5078   application.SendNotification();
5079   finishCheck.CheckSignalNotReceived();
5080   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5081
5082   application.SendNotification();
5083   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5084
5085   // We didn't expect the animation to finish yet
5086   application.SendNotification();
5087   finishCheck.CheckSignalNotReceived();
5088   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5089
5090   application.SendNotification();
5091   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5092
5093   // We didn't expect the animation to finish yet
5094   application.SendNotification();
5095   finishCheck.CheckSignalNotReceived();
5096   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5097
5098   application.SendNotification();
5099   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5100
5101   // We did expect the animation to finish
5102   application.SendNotification();
5103   finishCheck.CheckSignalReceived();
5104   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5105   END_TEST;
5106 }
5107
5108 int UtcDaliAnimationAnimateByActorOrientationP2(void)
5109 {
5110   TestApplication application;
5111
5112   tet_printf("Testing that rotation angle > 360 performs full rotations\n");
5113
5114   Actor actor = Actor::New();
5115   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::ZAXIS));
5116   application.GetScene().Add(actor);
5117   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5118
5119   // Build the animation
5120   float     durationSeconds(1.0f);
5121   Animation animation = Animation::New(durationSeconds);
5122   Degree    relativeRotationDegrees(710.0f);
5123   Radian    relativeRotationRadians(relativeRotationDegrees);
5124
5125   animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), AngleAxis(relativeRotationRadians, Vector3::ZAXIS));
5126
5127   // Start the animation
5128   animation.Play();
5129
5130   bool                 signalReceived(false);
5131   AnimationFinishCheck finishCheck(signalReceived);
5132   animation.FinishedSignal().Connect(&application, finishCheck);
5133
5134   application.SendNotification();
5135   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5136
5137   // We didn't expect the animation to finish yet
5138   application.SendNotification();
5139   finishCheck.CheckSignalNotReceived();
5140   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5141
5142   application.SendNotification();
5143   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5144
5145   // We didn't expect the animation to finish yet
5146   application.SendNotification();
5147   finishCheck.CheckSignalNotReceived();
5148   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5149
5150   application.SendNotification();
5151   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5152
5153   // We didn't expect the animation to finish yet
5154   application.SendNotification();
5155   finishCheck.CheckSignalNotReceived();
5156   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5157
5158   application.SendNotification();
5159   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5160
5161   // We did expect the animation to finish
5162   application.SendNotification();
5163   finishCheck.CheckSignalReceived();
5164   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5165   END_TEST;
5166 }
5167
5168 int UtcDaliAnimationAnimateByActorOrientationP3(void)
5169 {
5170   TestApplication application;
5171
5172   tet_printf("Testing that rotation angle > 360 performs partial rotations when cast to Quaternion\n");
5173
5174   Actor actor = Actor::New();
5175   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::ZAXIS));
5176   application.GetScene().Add(actor);
5177   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5178
5179   // Build the animation
5180   float     durationSeconds(1.0f);
5181   Animation animation = Animation::New(durationSeconds);
5182   Degree    relativeRotationDegrees(730.0f);
5183   Radian    relativeRotationRadians(relativeRotationDegrees);
5184
5185   Radian actualRotationRadians(Degree(10.0f));
5186
5187   animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS));
5188
5189   // Start the animation
5190   animation.Play();
5191
5192   bool                 signalReceived(false);
5193   AnimationFinishCheck finishCheck(signalReceived);
5194   animation.FinishedSignal().Connect(&application, finishCheck);
5195
5196   application.SendNotification();
5197   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5198
5199   // We didn't expect the animation to finish yet
5200   application.SendNotification();
5201   finishCheck.CheckSignalNotReceived();
5202   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5203
5204   application.SendNotification();
5205   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5206
5207   // We didn't expect the animation to finish yet
5208   application.SendNotification();
5209   finishCheck.CheckSignalNotReceived();
5210   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5211
5212   application.SendNotification();
5213   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5214
5215   // We didn't expect the animation to finish yet
5216   application.SendNotification();
5217   finishCheck.CheckSignalNotReceived();
5218   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5219
5220   application.SendNotification();
5221   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5222
5223   // We did expect the animation to finish
5224   application.SendNotification();
5225   finishCheck.CheckSignalReceived();
5226   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5227   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5228   END_TEST;
5229 }
5230
5231 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
5232 {
5233   TestApplication application;
5234
5235   Actor actor = Actor::New();
5236   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
5237   application.GetScene().Add(actor);
5238   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5239
5240   // Build the animation
5241   float     durationSeconds(1.0f);
5242   Animation animation = Animation::New(durationSeconds);
5243   Degree    relativeRotationDegrees(360.0f);
5244   Radian    relativeRotationRadians(relativeRotationDegrees);
5245   animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), AlphaFunction::EASE_IN);
5246
5247   // Start the animation
5248   animation.Play();
5249
5250   bool                 signalReceived(false);
5251   AnimationFinishCheck finishCheck(signalReceived);
5252   animation.FinishedSignal().Connect(&application, finishCheck);
5253
5254   application.SendNotification();
5255   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5256
5257   // We didn't expect the animation to finish yet
5258   application.SendNotification();
5259   finishCheck.CheckSignalNotReceived();
5260   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f * 0.25f * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5261
5262   application.SendNotification();
5263   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5264
5265   // We didn't expect the animation to finish yet
5266   application.SendNotification();
5267   finishCheck.CheckSignalNotReceived();
5268   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f * 0.5f * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5269
5270   application.SendNotification();
5271   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5272
5273   // We didn't expect the animation to finish yet
5274   application.SendNotification();
5275   finishCheck.CheckSignalNotReceived();
5276   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f * 0.75f * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5277
5278   application.SendNotification();
5279   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5280
5281   // We did expect the animation to finish
5282   application.SendNotification();
5283   finishCheck.CheckSignalReceived();
5284   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5285   END_TEST;
5286 }
5287
5288 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void)
5289 {
5290   TestApplication application;
5291
5292   Actor actor = Actor::New();
5293   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
5294   application.GetScene().Add(actor);
5295   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5296
5297   // Build the animation
5298   float     durationSeconds(1.0f);
5299   Animation animation = Animation::New(durationSeconds);
5300   Degree    relativeRotationDegrees(360.0f);
5301   Radian    relativeRotationRadians(relativeRotationDegrees);
5302   float     delay = 0.3f;
5303   animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
5304
5305   // Start the animation
5306   animation.Play();
5307
5308   bool                 signalReceived(false);
5309   AnimationFinishCheck finishCheck(signalReceived);
5310   animation.FinishedSignal().Connect(&application, finishCheck);
5311
5312   application.SendNotification();
5313   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5314
5315   // We didn't expect the animation to finish yet
5316   application.SendNotification();
5317   finishCheck.CheckSignalNotReceived();
5318   float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
5319   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5320
5321   application.SendNotification();
5322   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5323
5324   // We didn't expect the animation to finish yet
5325   application.SendNotification();
5326   finishCheck.CheckSignalNotReceived();
5327   progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
5328   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5329
5330   application.SendNotification();
5331   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5332
5333   // We didn't expect the animation to finish yet
5334   application.SendNotification();
5335   finishCheck.CheckSignalNotReceived();
5336   progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
5337   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5338
5339   application.SendNotification();
5340   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5341
5342   // We did expect the animation to finish
5343   application.SendNotification();
5344   finishCheck.CheckSignalReceived();
5345   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5346   END_TEST;
5347 }
5348
5349 int UtcDaliAnimationAnimateByActorScaleP(void)
5350 {
5351   TestApplication application;
5352
5353   Actor actor = Actor::New();
5354   application.GetScene().Add(actor);
5355   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5356
5357   // Build the animation
5358   float     durationSeconds(1.0f);
5359   Animation animation = Animation::New(durationSeconds);
5360   Vector3   targetScale(2.0f, 2.0f, 2.0f);
5361   Vector3   relativeScale(targetScale - Vector3::ONE);
5362   animation.AnimateBy(Property(actor, Actor::Property::SCALE), Vector3(relativeScale.x, relativeScale.y, relativeScale.z));
5363
5364   Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale * 0.99f);
5365
5366   // Start the animation
5367   animation.Play();
5368
5369   // Target value should be retrievable straight away
5370   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5371
5372   bool                 signalReceived(false);
5373   AnimationFinishCheck finishCheck(signalReceived);
5374   animation.FinishedSignal().Connect(&application, finishCheck);
5375
5376   application.SendNotification();
5377   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
5378
5379   // We didn't expect the animation to finish yet
5380   application.SendNotification();
5381   finishCheck.CheckSignalNotReceived();
5382   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), ninetyNinePercentProgress, TEST_LOCATION);
5383
5384   application.SendNotification();
5385   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
5386
5387   // We did expect the animation to finish
5388   application.SendNotification();
5389   finishCheck.CheckSignalReceived();
5390   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5391
5392   // Reset everything
5393   finishCheck.Reset();
5394   actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
5395   application.SendNotification();
5396   application.Render(0);
5397   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5398
5399   // Repeat with a different (ease-in) alpha function
5400   animation = Animation::New(durationSeconds);
5401   animation.AnimateBy(Property(actor, Actor::Property::SCALE), relativeScale, AlphaFunction::EASE_IN);
5402   animation.FinishedSignal().Connect(&application, finishCheck);
5403   animation.Play();
5404
5405   application.SendNotification();
5406   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
5407
5408   // We didn't expect the animation to finish yet
5409   application.SendNotification();
5410   finishCheck.CheckSignalNotReceived();
5411
5412   // The scale should have grown less, than with a linear alpha function
5413   Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
5414   DALI_TEST_CHECK(current.x > 1.0f);
5415   DALI_TEST_CHECK(current.y > 1.0f);
5416   DALI_TEST_CHECK(current.z > 1.0f);
5417   DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
5418   DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
5419   DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z);
5420
5421   application.SendNotification();
5422   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
5423
5424   // We did expect the animation to finish
5425   application.SendNotification();
5426   finishCheck.CheckSignalReceived();
5427   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5428
5429   // Reset everything
5430   finishCheck.Reset();
5431   actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
5432   application.SendNotification();
5433   application.Render(0);
5434   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5435
5436   // Repeat with a delay
5437   float delay = 0.5f;
5438   animation   = Animation::New(durationSeconds);
5439   animation.AnimateBy(Property(actor, Actor::Property::SCALE), relativeScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
5440   animation.FinishedSignal().Connect(&application, finishCheck);
5441   animation.Play();
5442
5443   application.SendNotification();
5444   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
5445
5446   // We didn't expect the animation to finish yet
5447   application.SendNotification();
5448   finishCheck.CheckSignalNotReceived();
5449   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5450
5451   application.SendNotification();
5452   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
5453
5454   // We did expect the animation to finish
5455   application.SendNotification();
5456   finishCheck.CheckSignalReceived();
5457   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5458   END_TEST;
5459 }
5460
5461 int UtcDaliAnimationAnimateByActorScaleComponentsP(void)
5462 {
5463   TestApplication application;
5464
5465   Actor actor = Actor::New();
5466   application.GetScene().Add(actor);
5467   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5468
5469   // Build the animation
5470   float     durationSeconds(1.0f);
5471   Animation animation = Animation::New(durationSeconds);
5472   Vector3   targetScale(2.0f, 3.0f, 4.0f);
5473   Vector3   relativeScale(targetScale - Vector3::ONE);
5474   animation.AnimateBy(Property(actor, Actor::Property::SCALE_X), relativeScale.x);
5475   animation.AnimateBy(Property(actor, Actor::Property::SCALE_Y), relativeScale.y);
5476   animation.AnimateBy(Property(actor, Actor::Property::SCALE_Z), relativeScale.z);
5477
5478   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5479   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5480
5481   // Start the animation
5482   animation.Play();
5483
5484   // Target value should be retrievable straight away
5485   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5486   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), targetScale.x, TEST_LOCATION);
5487   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), targetScale.y, TEST_LOCATION);
5488   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), targetScale.z, TEST_LOCATION);
5489
5490   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION); // Not changed yet
5491
5492   application.SendNotification();
5493   application.Render(1000); // 1 second progress
5494
5495   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5496
5497   END_TEST;
5498 }
5499
5500 int UtcDaliAnimationAnimateByActorColorP(void)
5501 {
5502   TestApplication application;
5503
5504   Actor actor = Actor::New();
5505   application.GetScene().Add(actor);
5506   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5507
5508   // Build the animation
5509   float     durationSeconds(1.0f);
5510   Animation animation = Animation::New(durationSeconds);
5511   Vector4   targetColor(0.5f, 0.75f, 0.8f, 0.1f);
5512   Vector4   relativeColor(targetColor - Color::WHITE);
5513   animation.AnimateBy(Property(actor, Actor::Property::COLOR), relativeColor);
5514
5515   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5516   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5517
5518   // Start the animation
5519   animation.Play();
5520
5521   // Target value should be retrievable straight away
5522   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5523   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION);
5524   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION);
5525   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION);
5526   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION);
5527
5528   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); // Not changed yet
5529
5530   application.SendNotification();
5531   application.Render(1000); // 1 second progress
5532
5533   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5534
5535   END_TEST;
5536 }
5537
5538 int UtcDaliAnimationAnimateByActorColorComponentsP(void)
5539 {
5540   TestApplication application;
5541
5542   Actor actor = Actor::New();
5543   application.GetScene().Add(actor);
5544   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5545
5546   // Build the animation
5547   float     durationSeconds(1.0f);
5548   Animation animation = Animation::New(durationSeconds);
5549   Vector4   targetColor(0.5f, 0.75f, 0.8f, 0.1f);
5550   Vector4   relativeColor(targetColor - Color::WHITE);
5551   animation.AnimateBy(Property(actor, Actor::Property::COLOR_RED), relativeColor.r);
5552   animation.AnimateBy(Property(actor, Actor::Property::COLOR_GREEN), relativeColor.g);
5553   animation.AnimateBy(Property(actor, Actor::Property::COLOR_BLUE), relativeColor.b);
5554   animation.AnimateBy(Property(actor, Actor::Property::COLOR_ALPHA), relativeColor.a);
5555
5556   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5557   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5558
5559   // Start the animation
5560   animation.Play();
5561
5562   // Target value should be retrievable straight away
5563   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5564   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION);
5565   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION);
5566   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION);
5567   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION);
5568
5569   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); // Not changed yet
5570
5571   application.SendNotification();
5572   application.Render(1000); // 1 second progress
5573
5574   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5575
5576   END_TEST;
5577 }
5578
5579 int UtcDaliAnimationAnimateByActorSizeP(void)
5580 {
5581   TestApplication application;
5582
5583   Actor actor = Actor::New();
5584   application.GetScene().Add(actor);
5585   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5586
5587   // Build the animation
5588   float     durationSeconds(1.0f);
5589   Animation animation = Animation::New(durationSeconds);
5590   Vector3   targetSize(100.0f, 200.0f, 300.0f);
5591   Vector3   relativeSize(targetSize - Vector3::ZERO);
5592   animation.AnimateBy(Property(actor, Actor::Property::SIZE), relativeSize);
5593
5594   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5595   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5596
5597   // Start the animation
5598   animation.Play();
5599
5600   // Target value should be retrievable straight away
5601   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5602   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION);
5603   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION);
5604   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION);
5605
5606   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Not changed yet
5607
5608   application.SendNotification();
5609   application.Render(1000); // 1 second progress
5610
5611   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5612
5613   END_TEST;
5614 }
5615
5616 int UtcDaliAnimationAnimateByActorSizeComponentsP(void)
5617 {
5618   TestApplication application;
5619
5620   Actor actor = Actor::New();
5621   application.GetScene().Add(actor);
5622   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5623
5624   // Build the animation
5625   float     durationSeconds(1.0f);
5626   Animation animation = Animation::New(durationSeconds);
5627   Vector3   targetSize(100.0f, 200.0f, 300.0f);
5628   Vector3   relativeSize(targetSize - Vector3::ZERO);
5629   animation.AnimateBy(Property(actor, Actor::Property::SIZE_WIDTH), relativeSize.width);
5630   animation.AnimateBy(Property(actor, Actor::Property::SIZE_HEIGHT), relativeSize.height);
5631   animation.AnimateBy(Property(actor, Actor::Property::SIZE_DEPTH), relativeSize.depth);
5632
5633   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5634   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5635
5636   // Start the animation
5637   animation.Play();
5638
5639   // Target value should be retrievable straight away
5640   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5641   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION);
5642   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION);
5643   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION);
5644
5645   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Not changed yet
5646
5647   application.SendNotification();
5648   application.Render(1000); // 1 second progress
5649
5650   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5651
5652   END_TEST;
5653 }
5654
5655 int UtcDaliAnimationAnimateByActorVisibilityP(void)
5656 {
5657   TestApplication application;
5658
5659   Actor actor = Actor::New();
5660   application.GetScene().Add(actor);
5661   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
5662
5663   actor.SetProperty(Actor::Property::VISIBLE, false);
5664
5665   application.SendNotification();
5666   application.Render();
5667
5668   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
5669
5670   // Build the animation
5671   float     durationSeconds(1.0f);
5672   Animation animation = Animation::New(durationSeconds);
5673   bool      targetVisibility(true);
5674   bool      relativeVisibility(targetVisibility);
5675   animation.AnimateBy(Property(actor, Actor::Property::VISIBLE), relativeVisibility);
5676
5677   DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
5678
5679   // Start the animation
5680   animation.Play();
5681
5682   // Target value should be retrievable straight away
5683   DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), targetVisibility, TEST_LOCATION);
5684   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION); // Not changed yet
5685
5686   application.SendNotification();
5687   application.Render(1000); // 1 second progress
5688
5689   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
5690
5691   END_TEST;
5692 }
5693
5694 int UtcDaliAnimationAnimateToBooleanP(void)
5695 {
5696   TestApplication application;
5697
5698   Actor actor = Actor::New();
5699
5700   // Register a boolean property
5701   const bool      startValue(false);
5702   Property::Index index = actor.RegisterProperty("testProperty", startValue);
5703   application.GetScene().Add(actor);
5704   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5705   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5706
5707   // Build the animation
5708   float      durationSeconds(2.0f);
5709   Animation  animation = Animation::New(durationSeconds);
5710   const bool targetValue(!startValue);
5711   animation.AnimateTo(Property(actor, index), targetValue);
5712
5713   // Start the animation
5714   animation.Play();
5715
5716   bool                 signalReceived(false);
5717   AnimationFinishCheck finishCheck(signalReceived);
5718   animation.FinishedSignal().Connect(&application, finishCheck);
5719
5720   application.SendNotification();
5721   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5722
5723   // We didn't expect the animation to finish yet
5724   application.SendNotification();
5725   finishCheck.CheckSignalNotReceived();
5726   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5727
5728   application.SendNotification();
5729   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5730
5731   // We did expect the animation to finish
5732   application.SendNotification();
5733   finishCheck.CheckSignalReceived();
5734   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5735
5736   // Check that nothing has changed after a couple of buffer swaps
5737   application.Render(0);
5738   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5739   application.Render(0);
5740   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5741
5742   // Repeat with target value "false"
5743   animation = Animation::New(durationSeconds);
5744   const bool finalValue(!targetValue);
5745   animation.AnimateTo(Property(actor, index), finalValue);
5746
5747   // Start the animation
5748   animation.Play();
5749
5750   finishCheck.Reset();
5751   animation.FinishedSignal().Connect(&application, finishCheck);
5752
5753   application.SendNotification();
5754   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5755
5756   // We didn't expect the animation to finish yet
5757   application.SendNotification();
5758   finishCheck.CheckSignalNotReceived();
5759   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5760
5761   application.SendNotification();
5762   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5763
5764   // We did expect the animation to finish
5765   application.SendNotification();
5766   finishCheck.CheckSignalReceived();
5767   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5768
5769   // Check that nothing has changed after a couple of buffer swaps
5770   application.Render(0);
5771   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5772   application.Render(0);
5773   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5774   END_TEST;
5775 }
5776
5777 int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void)
5778 {
5779   TestApplication application;
5780
5781   Actor actor = Actor::New();
5782
5783   // Register a boolean property
5784   const bool      startValue(false);
5785   Property::Index index = actor.RegisterProperty("testProperty", startValue);
5786   application.GetScene().Add(actor);
5787   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5788   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5789
5790   // Build the animation
5791   float      durationSeconds(2.0f);
5792   Animation  animation = Animation::New(durationSeconds);
5793   const bool targetValue(!startValue);
5794   animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
5795
5796   // Start the animation
5797   animation.Play();
5798
5799   bool                 signalReceived(false);
5800   AnimationFinishCheck finishCheck(signalReceived);
5801   animation.FinishedSignal().Connect(&application, finishCheck);
5802
5803   application.SendNotification();
5804   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5805
5806   // We didn't expect the animation to finish yet
5807   application.SendNotification();
5808   finishCheck.CheckSignalNotReceived();
5809   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5810
5811   application.SendNotification();
5812   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5813
5814   // We did expect the animation to finish
5815   application.SendNotification();
5816   finishCheck.CheckSignalReceived();
5817   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5818
5819   // Check that nothing has changed after a couple of buffer swaps
5820   application.Render(0);
5821   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5822   application.Render(0);
5823   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5824
5825   // Repeat with target value "false"
5826   animation = Animation::New(durationSeconds);
5827   const bool finalValue(!targetValue);
5828   animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
5829
5830   // Start the animation
5831   animation.Play();
5832
5833   finishCheck.Reset();
5834   animation.FinishedSignal().Connect(&application, finishCheck);
5835
5836   application.SendNotification();
5837   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5838
5839   // We didn't expect the animation to finish yet
5840   application.SendNotification();
5841   finishCheck.CheckSignalNotReceived();
5842   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5843
5844   application.SendNotification();
5845   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5846
5847   // We did expect the animation to finish
5848   application.SendNotification();
5849   finishCheck.CheckSignalReceived();
5850   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5851
5852   // Check that nothing has changed after a couple of buffer swaps
5853   application.Render(0);
5854   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5855   application.Render(0);
5856   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5857   END_TEST;
5858 }
5859
5860 int UtcDaliAnimationAnimateToBooleanTimePeriodP(void)
5861 {
5862   TestApplication application;
5863
5864   Actor actor = Actor::New();
5865
5866   // Register a boolean property
5867   bool            startValue(false);
5868   Property::Index index = actor.RegisterProperty("testProperty", startValue);
5869   application.GetScene().Add(actor);
5870   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5871   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5872
5873   // Build the animation
5874   float     durationSeconds(2.0f);
5875   Animation animation = Animation::New(durationSeconds);
5876   bool      finalValue(!startValue);
5877   float     animatorDurationSeconds(durationSeconds * 0.5f);
5878   animation.AnimateTo(Property(actor, index),
5879                       finalValue,
5880                       TimePeriod(animatorDurationSeconds));
5881
5882   // Start the animation
5883   animation.Play();
5884
5885   bool                 signalReceived(false);
5886   AnimationFinishCheck finishCheck(signalReceived);
5887   animation.FinishedSignal().Connect(&application, finishCheck);
5888
5889   application.SendNotification();
5890   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
5891
5892   // We didn't expect the animation to finish yet
5893   application.SendNotification();
5894   finishCheck.CheckSignalNotReceived();
5895   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5896
5897   application.SendNotification();
5898   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
5899
5900   // We didn't expect the animation to finish yet...
5901   application.SendNotification();
5902   finishCheck.CheckSignalNotReceived();
5903
5904   // ...however we should have reached the final value
5905   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5906
5907   application.SendNotification();
5908   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
5909
5910   // We did expect the animation to finish
5911   application.SendNotification();
5912   finishCheck.CheckSignalReceived();
5913   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5914
5915   // Check that nothing has changed after a couple of buffer swaps
5916   application.Render(0);
5917   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5918   application.Render(0);
5919   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5920   END_TEST;
5921 }
5922
5923 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void)
5924 {
5925   TestApplication application;
5926
5927   Actor actor = Actor::New();
5928
5929   // Register a boolean property
5930   bool            startValue(false);
5931   Property::Index index = actor.RegisterProperty("testProperty", startValue);
5932   application.GetScene().Add(actor);
5933   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5934   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5935
5936   // Build the animation
5937   float     durationSeconds(2.0f);
5938   Animation animation = Animation::New(durationSeconds);
5939   bool      finalValue(!startValue);
5940   float     animatorDurationSeconds(durationSeconds * 0.5f);
5941   animation.AnimateTo(Property(actor, index),
5942                       finalValue,
5943                       AlphaFunction::LINEAR,
5944                       TimePeriod(animatorDurationSeconds));
5945
5946   // Start the animation
5947   animation.Play();
5948
5949   bool                 signalReceived(false);
5950   AnimationFinishCheck finishCheck(signalReceived);
5951   animation.FinishedSignal().Connect(&application, finishCheck);
5952
5953   application.SendNotification();
5954   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
5955
5956   // We didn't expect the animation to finish yet
5957   application.SendNotification();
5958   finishCheck.CheckSignalNotReceived();
5959   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5960
5961   application.SendNotification();
5962   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
5963
5964   // We didn't expect the animation to finish yet...
5965   application.SendNotification();
5966   finishCheck.CheckSignalNotReceived();
5967
5968   // ...however we should have reached the final value
5969   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5970
5971   application.SendNotification();
5972   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
5973
5974   // We did expect the animation to finish
5975   application.SendNotification();
5976   finishCheck.CheckSignalReceived();
5977   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5978
5979   // Check that nothing has changed after a couple of buffer swaps
5980   application.Render(0);
5981   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5982   application.Render(0);
5983   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5984   END_TEST;
5985 }
5986
5987 int UtcDaliAnimationAnimateToFloatP(void)
5988 {
5989   TestApplication application;
5990
5991   Actor actor = Actor::New();
5992
5993   // Register a float property
5994   float           startValue(10.0f);
5995   Property::Index index = actor.RegisterProperty("testProperty", startValue);
5996   application.GetScene().Add(actor);
5997   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
5998   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
5999
6000   // Build the animation
6001   float     durationSeconds(2.0f);
6002   Animation animation = Animation::New(durationSeconds);
6003   float     targetValue(50.0f);
6004   float     relativeValue(targetValue - startValue);
6005   animation.AnimateTo(Property(actor, "testProperty"), targetValue);
6006
6007   float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6008
6009   // Start the animation
6010   animation.Play();
6011
6012   bool                 signalReceived(false);
6013   AnimationFinishCheck finishCheck(signalReceived);
6014   animation.FinishedSignal().Connect(&application, finishCheck);
6015
6016   application.SendNotification();
6017   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6018
6019   // We didn't expect the animation to finish yet
6020   application.SendNotification();
6021   finishCheck.CheckSignalNotReceived();
6022   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION);
6023
6024   application.SendNotification();
6025   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6026
6027   // We did expect the animation to finish
6028   application.SendNotification();
6029   finishCheck.CheckSignalReceived();
6030   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6031   END_TEST;
6032 }
6033
6034 int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void)
6035 {
6036   TestApplication application;
6037
6038   Actor actor = Actor::New();
6039
6040   // Register a float property
6041   float           startValue(10.0f);
6042   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6043   application.GetScene().Add(actor);
6044   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
6045   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6046
6047   // Build the animation
6048   float     durationSeconds(1.0f);
6049   Animation animation = Animation::New(durationSeconds);
6050   float     targetValue(90.0f);
6051   float     relativeValue(targetValue - startValue);
6052   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6053
6054   float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6055
6056   // Start the animation
6057   animation.Play();
6058
6059   bool                 signalReceived(false);
6060   AnimationFinishCheck finishCheck(signalReceived);
6061   animation.FinishedSignal().Connect(&application, finishCheck);
6062
6063   application.SendNotification();
6064   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6065
6066   // We didn't expect the animation to finish yet
6067   application.SendNotification();
6068   finishCheck.CheckSignalNotReceived();
6069
6070   // The position should have moved more, than with a linear alpha function
6071   float current(actor.GetCurrentProperty<float>(index));
6072   DALI_TEST_CHECK(current > ninetyFivePercentProgress);
6073
6074   application.SendNotification();
6075   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6076
6077   // We did expect the animation to finish
6078   application.SendNotification();
6079   finishCheck.CheckSignalReceived();
6080   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6081   END_TEST;
6082 }
6083
6084 int UtcDaliAnimationAnimateToFloatTimePeriodP(void)
6085 {
6086   TestApplication application;
6087
6088   Actor actor = Actor::New();
6089
6090   // Register a float property
6091   float           startValue(10.0f);
6092   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6093   application.GetScene().Add(actor);
6094   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
6095   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6096
6097   // Build the animation
6098   float     durationSeconds(1.0f);
6099   Animation animation = Animation::New(durationSeconds);
6100   float     targetValue(30.0f);
6101   float     relativeValue(targetValue - startValue);
6102   float     delay = 0.5f;
6103   animation.AnimateTo(Property(actor, index),
6104                       targetValue,
6105                       TimePeriod(delay, durationSeconds - delay));
6106
6107   // Start the animation
6108   animation.Play();
6109
6110   bool                 signalReceived(false);
6111   AnimationFinishCheck finishCheck(signalReceived);
6112   animation.FinishedSignal().Connect(&application, finishCheck);
6113
6114   application.SendNotification();
6115   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6116
6117   // We didn't expect the animation to finish yet
6118   application.SendNotification();
6119   finishCheck.CheckSignalNotReceived();
6120   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6121
6122   application.SendNotification();
6123   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6124
6125   // We didn't expect the animation to finish yet
6126   application.SendNotification();
6127   finishCheck.CheckSignalNotReceived();
6128   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6129
6130   application.SendNotification();
6131   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6132
6133   // We did expect the animation to finish
6134   application.SendNotification();
6135   finishCheck.CheckSignalReceived();
6136   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6137   END_TEST;
6138 }
6139
6140 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void)
6141 {
6142   TestApplication application;
6143
6144   Actor actor = Actor::New();
6145
6146   // Register a float property
6147   float           startValue(10.0f);
6148   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6149   application.GetScene().Add(actor);
6150   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
6151   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6152
6153   // Build the animation
6154   float     durationSeconds(1.0f);
6155   Animation animation = Animation::New(durationSeconds);
6156   float     targetValue(30.0f);
6157   float     relativeValue(targetValue - startValue);
6158   float     delay = 0.5f;
6159   animation.AnimateTo(Property(actor, index),
6160                       targetValue,
6161                       AlphaFunction::LINEAR,
6162                       TimePeriod(delay, durationSeconds - delay));
6163
6164   // Start the animation
6165   animation.Play();
6166
6167   bool                 signalReceived(false);
6168   AnimationFinishCheck finishCheck(signalReceived);
6169   animation.FinishedSignal().Connect(&application, finishCheck);
6170
6171   application.SendNotification();
6172   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6173
6174   // We didn't expect the animation to finish yet
6175   application.SendNotification();
6176   finishCheck.CheckSignalNotReceived();
6177   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6178
6179   application.SendNotification();
6180   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6181
6182   // We didn't expect the animation to finish yet
6183   application.SendNotification();
6184   finishCheck.CheckSignalNotReceived();
6185   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6186
6187   application.SendNotification();
6188   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6189
6190   // We did expect the animation to finish
6191   application.SendNotification();
6192   finishCheck.CheckSignalReceived();
6193   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6194   END_TEST;
6195 }
6196
6197 int UtcDaliAnimationAnimateToIntegerP(void)
6198 {
6199   TestApplication application;
6200
6201   Actor actor = Actor::New();
6202
6203   // Register an integer property
6204   int             startValue(10);
6205   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6206   application.GetScene().Add(actor);
6207   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6208   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6209
6210   // Build the animation
6211   float     durationSeconds(2.0f);
6212   Animation animation = Animation::New(durationSeconds);
6213   int       targetValue(50);
6214   int       relativeValue(targetValue - startValue);
6215   animation.AnimateTo(Property(actor, "testProperty"), targetValue);
6216
6217   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
6218
6219   // Start the animation
6220   animation.Play();
6221
6222   bool                 signalReceived(false);
6223   AnimationFinishCheck finishCheck(signalReceived);
6224   animation.FinishedSignal().Connect(&application, finishCheck);
6225
6226   application.SendNotification();
6227   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6228
6229   // We didn't expect the animation to finish yet
6230   application.SendNotification();
6231   finishCheck.CheckSignalNotReceived();
6232   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION);
6233
6234   application.SendNotification();
6235   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6236
6237   // We did expect the animation to finish
6238   application.SendNotification();
6239   finishCheck.CheckSignalReceived();
6240   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6241   END_TEST;
6242 }
6243
6244 int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void)
6245 {
6246   TestApplication application;
6247
6248   Actor actor = Actor::New();
6249
6250   // Register an integer property
6251   int             startValue(10);
6252   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6253   application.GetScene().Add(actor);
6254   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6255   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6256
6257   // Build the animation
6258   float     durationSeconds(1.0f);
6259   Animation animation = Animation::New(durationSeconds);
6260   int       targetValue(90);
6261   int       relativeValue(targetValue - startValue);
6262   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6263
6264   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
6265
6266   // Start the animation
6267   animation.Play();
6268
6269   bool                 signalReceived(false);
6270   AnimationFinishCheck finishCheck(signalReceived);
6271   animation.FinishedSignal().Connect(&application, finishCheck);
6272
6273   application.SendNotification();
6274   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6275
6276   // We didn't expect the animation to finish yet
6277   application.SendNotification();
6278   finishCheck.CheckSignalNotReceived();
6279
6280   // The position should have moved more, than with a linear alpha function
6281   int current(actor.GetCurrentProperty<int>(index));
6282   DALI_TEST_CHECK(current > ninetyFivePercentProgress);
6283
6284   application.SendNotification();
6285   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6286
6287   // We did expect the animation to finish
6288   application.SendNotification();
6289   finishCheck.CheckSignalReceived();
6290   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6291   END_TEST;
6292 }
6293
6294 int UtcDaliAnimationAnimateToIntegerTimePeriodP(void)
6295 {
6296   TestApplication application;
6297
6298   Actor actor = Actor::New();
6299
6300   // Register an integer property
6301   int             startValue(10);
6302   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6303   application.GetScene().Add(actor);
6304   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6305   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6306
6307   // Build the animation
6308   float     durationSeconds(1.0f);
6309   Animation animation = Animation::New(durationSeconds);
6310   int       targetValue(30);
6311   int       relativeValue(targetValue - startValue);
6312   float     delay = 0.5f;
6313   animation.AnimateTo(Property(actor, index),
6314                       targetValue,
6315                       TimePeriod(delay, durationSeconds - delay));
6316
6317   // Start the animation
6318   animation.Play();
6319
6320   bool                 signalReceived(false);
6321   AnimationFinishCheck finishCheck(signalReceived);
6322   animation.FinishedSignal().Connect(&application, finishCheck);
6323
6324   application.SendNotification();
6325   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6326
6327   // We didn't expect the animation to finish yet
6328   application.SendNotification();
6329   finishCheck.CheckSignalNotReceived();
6330   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6331
6332   application.SendNotification();
6333   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6334
6335   // We didn't expect the animation to finish yet
6336   application.SendNotification();
6337   finishCheck.CheckSignalNotReceived();
6338   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
6339
6340   application.SendNotification();
6341   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6342
6343   // We did expect the animation to finish
6344   application.SendNotification();
6345   finishCheck.CheckSignalReceived();
6346   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6347   END_TEST;
6348 }
6349
6350 int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void)
6351 {
6352   TestApplication application;
6353
6354   Actor actor = Actor::New();
6355
6356   // Register an integer property
6357   int             startValue(10);
6358   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6359   application.GetScene().Add(actor);
6360   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6361   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6362
6363   // Build the animation
6364   float     durationSeconds(1.0f);
6365   Animation animation = Animation::New(durationSeconds);
6366   int       targetValue(30);
6367   int       relativeValue(targetValue - startValue);
6368   float     delay = 0.5f;
6369   animation.AnimateTo(Property(actor, index),
6370                       targetValue,
6371                       AlphaFunction::LINEAR,
6372                       TimePeriod(delay, durationSeconds - delay));
6373
6374   // Start the animation
6375   animation.Play();
6376
6377   bool                 signalReceived(false);
6378   AnimationFinishCheck finishCheck(signalReceived);
6379   animation.FinishedSignal().Connect(&application, finishCheck);
6380
6381   application.SendNotification();
6382   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6383
6384   // We didn't expect the animation to finish yet
6385   application.SendNotification();
6386   finishCheck.CheckSignalNotReceived();
6387   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6388
6389   application.SendNotification();
6390   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6391
6392   // We didn't expect the animation to finish yet
6393   application.SendNotification();
6394   finishCheck.CheckSignalNotReceived();
6395   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
6396
6397   application.SendNotification();
6398   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6399
6400   // We did expect the animation to finish
6401   application.SendNotification();
6402   finishCheck.CheckSignalReceived();
6403   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6404   END_TEST;
6405 }
6406
6407 int UtcDaliAnimationAnimateToVector2P(void)
6408 {
6409   TestApplication application;
6410
6411   Actor actor = Actor::New();
6412
6413   // Register a Vector2 property
6414   Vector2         startValue(-50.0f, -50.0f);
6415   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6416   application.GetScene().Add(actor);
6417   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6418   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6419
6420   // Build the animation
6421   float     durationSeconds(2.0f);
6422   Animation animation = Animation::New(durationSeconds);
6423   Vector2   targetValue(50.0f, 50.0f);
6424   Vector2   relativeValue(targetValue - startValue);
6425   animation.AnimateTo(Property(actor, index), targetValue);
6426
6427   Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6428
6429   // Start the animation
6430   animation.Play();
6431
6432   bool                 signalReceived(false);
6433   AnimationFinishCheck finishCheck(signalReceived);
6434   animation.FinishedSignal().Connect(&application, finishCheck);
6435
6436   application.SendNotification();
6437   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6438
6439   // We didn't expect the animation to finish yet
6440   application.SendNotification();
6441   finishCheck.CheckSignalNotReceived();
6442   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION);
6443
6444   application.SendNotification();
6445   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6446
6447   // We did expect the animation to finish
6448   application.SendNotification();
6449   finishCheck.CheckSignalReceived();
6450   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6451   END_TEST;
6452 }
6453
6454 int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void)
6455 {
6456   TestApplication application;
6457
6458   Actor actor = Actor::New();
6459
6460   // Register a Vector2 property
6461   Vector2         startValue(1000.0f, 1000.0f);
6462   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6463   application.GetScene().Add(actor);
6464   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6465   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6466
6467   // Build the animation
6468   float     durationSeconds(1.0f);
6469   Animation animation = Animation::New(durationSeconds);
6470   Vector2   targetValue(9000.0f, 9000.0f);
6471   Vector2   relativeValue(targetValue - startValue);
6472   animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
6473
6474   Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6475
6476   // Start the animation
6477   animation.Play();
6478
6479   bool                 signalReceived(false);
6480   AnimationFinishCheck finishCheck(signalReceived);
6481   animation.FinishedSignal().Connect(&application, finishCheck);
6482
6483   application.SendNotification();
6484   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6485
6486   // We didn't expect the animation to finish yet
6487   application.SendNotification();
6488   finishCheck.CheckSignalNotReceived();
6489
6490   // The position should have moved more, than with a linear alpha function
6491   Vector2 current(actor.GetCurrentProperty<Vector2>(index));
6492   DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
6493   DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
6494
6495   application.SendNotification();
6496   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6497
6498   // We did expect the animation to finish
6499   application.SendNotification();
6500   finishCheck.CheckSignalReceived();
6501   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6502   END_TEST;
6503 }
6504
6505 int UtcDaliAnimationAnimateToVector2TimePeriodP(void)
6506 {
6507   TestApplication application;
6508
6509   Actor actor = Actor::New();
6510
6511   // Register a Vector2 property
6512   Vector2         startValue(10.0f, 10.0f);
6513   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6514   application.GetScene().Add(actor);
6515   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6516   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6517
6518   // Build the animation
6519   float     durationSeconds(1.0f);
6520   Animation animation = Animation::New(durationSeconds);
6521   Vector2   targetValue(-10.0f, 20.0f);
6522   Vector2   relativeValue(targetValue - startValue);
6523   float     delay = 0.5f;
6524   animation.AnimateTo(Property(actor, index),
6525                       targetValue,
6526                       TimePeriod(delay, durationSeconds - delay));
6527
6528   // Start the animation
6529   animation.Play();
6530
6531   bool                 signalReceived(false);
6532   AnimationFinishCheck finishCheck(signalReceived);
6533   animation.FinishedSignal().Connect(&application, finishCheck);
6534
6535   application.SendNotification();
6536   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6537
6538   // We didn't expect the animation to finish yet
6539   application.SendNotification();
6540   finishCheck.CheckSignalNotReceived();
6541   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6542
6543   application.SendNotification();
6544   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6545
6546   // We didn't expect the animation to finish yet
6547   application.SendNotification();
6548   finishCheck.CheckSignalNotReceived();
6549   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6550
6551   application.SendNotification();
6552   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6553
6554   // We did expect the animation to finish
6555   application.SendNotification();
6556   finishCheck.CheckSignalReceived();
6557   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6558   END_TEST;
6559 }
6560
6561 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void)
6562 {
6563   TestApplication application;
6564
6565   Actor actor = Actor::New();
6566
6567   // Register a Vector2 property
6568   Vector2         startValue(10.0f, 10.0f);
6569   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6570   application.GetScene().Add(actor);
6571   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6572   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6573
6574   // Build the animation
6575   float     durationSeconds(1.0f);
6576   Animation animation = Animation::New(durationSeconds);
6577   Vector2   targetValue(30.0f, 30.0f);
6578   Vector2   relativeValue(targetValue - startValue);
6579   float     delay = 0.5f;
6580   animation.AnimateTo(Property(actor, index),
6581                       targetValue,
6582                       AlphaFunction::LINEAR,
6583                       TimePeriod(delay, durationSeconds - delay));
6584
6585   // Start the animation
6586   animation.Play();
6587
6588   bool                 signalReceived(false);
6589   AnimationFinishCheck finishCheck(signalReceived);
6590   animation.FinishedSignal().Connect(&application, finishCheck);
6591
6592   application.SendNotification();
6593   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6594
6595   // We didn't expect the animation to finish yet, but cached value should be the final one
6596   application.SendNotification();
6597   finishCheck.CheckSignalNotReceived();
6598   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION);
6599   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6600
6601   application.SendNotification();
6602   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6603
6604   // We didn't expect the animation to finish yet
6605   application.SendNotification();
6606   finishCheck.CheckSignalNotReceived();
6607   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6608
6609   application.SendNotification();
6610   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6611
6612   // We did expect the animation to finish
6613   application.SendNotification();
6614   finishCheck.CheckSignalReceived();
6615   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6616   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION);
6617   END_TEST;
6618 }
6619
6620 int UtcDaliAnimationAnimateToVector3P(void)
6621 {
6622   TestApplication application;
6623
6624   Actor actor = Actor::New();
6625
6626   // Register a Vector3 property
6627   Vector3         startValue(-50.0f, -50.0f, -50.0f);
6628   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6629   application.GetScene().Add(actor);
6630   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6631   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6632
6633   // Build the animation
6634   float     durationSeconds(2.0f);
6635   Animation animation = Animation::New(durationSeconds);
6636   Vector3   targetValue(50.0f, 50.0f, 50.0f);
6637   Vector3   relativeValue(targetValue - startValue);
6638   animation.AnimateTo(Property(actor, index), targetValue);
6639
6640   Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6641
6642   // Start the animation
6643   animation.Play();
6644
6645   bool                 signalReceived(false);
6646   AnimationFinishCheck finishCheck(signalReceived);
6647   animation.FinishedSignal().Connect(&application, finishCheck);
6648
6649   application.SendNotification();
6650   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6651
6652   // We didn't expect the animation to finish yet
6653   application.SendNotification();
6654   finishCheck.CheckSignalNotReceived();
6655   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION);
6656
6657   application.SendNotification();
6658   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6659
6660   // We did expect the animation to finish
6661   application.SendNotification();
6662   finishCheck.CheckSignalReceived();
6663   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6664   END_TEST;
6665 }
6666
6667 int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void)
6668 {
6669   TestApplication application;
6670
6671   Actor actor = Actor::New();
6672
6673   // Register a Vector3 property
6674   Vector3         startValue(1000.0f, 1000.0f, 1000.0f);
6675   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6676   application.GetScene().Add(actor);
6677   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6678   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6679
6680   // Build the animation
6681   float     durationSeconds(1.0f);
6682   Animation animation = Animation::New(durationSeconds);
6683   Vector3   targetValue(9000.0f, 9000.0f, 9000.0f);
6684   Vector3   relativeValue(targetValue - startValue);
6685   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6686
6687   Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6688
6689   // Start the animation
6690   animation.Play();
6691
6692   bool                 signalReceived(false);
6693   AnimationFinishCheck finishCheck(signalReceived);
6694   animation.FinishedSignal().Connect(&application, finishCheck);
6695
6696   application.SendNotification();
6697   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6698
6699   // We didn't expect the animation to finish yet
6700   application.SendNotification();
6701   finishCheck.CheckSignalNotReceived();
6702
6703   // The position should have moved more, than with a linear alpha function
6704   Vector3 current(actor.GetCurrentProperty<Vector3>(index));
6705   DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
6706   DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
6707   DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z);
6708
6709   application.SendNotification();
6710   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6711
6712   // We did expect the animation to finish
6713   application.SendNotification();
6714   finishCheck.CheckSignalReceived();
6715   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6716   END_TEST;
6717 }
6718
6719 int UtcDaliAnimationAnimateToVector3TimePeriodP(void)
6720 {
6721   TestApplication application;
6722
6723   Actor actor = Actor::New();
6724
6725   // Register a Vector3 property
6726   Vector3         startValue(10.0f, 10.0f, 10.0f);
6727   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6728   application.GetScene().Add(actor);
6729   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6730   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6731
6732   // Build the animation
6733   float     durationSeconds(1.0f);
6734   Animation animation = Animation::New(durationSeconds);
6735   Vector3   targetValue(-10.0f, 20.0f, 100.0f);
6736   Vector3   relativeValue(targetValue - startValue);
6737   float     delay = 0.5f;
6738   animation.AnimateTo(Property(actor, index),
6739                       targetValue,
6740                       TimePeriod(delay, durationSeconds - delay));
6741
6742   // Start the animation
6743   animation.Play();
6744
6745   bool                 signalReceived(false);
6746   AnimationFinishCheck finishCheck(signalReceived);
6747   animation.FinishedSignal().Connect(&application, finishCheck);
6748
6749   application.SendNotification();
6750   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6751
6752   // We didn't expect the animation to finish yet
6753   application.SendNotification();
6754   finishCheck.CheckSignalNotReceived();
6755   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6756
6757   application.SendNotification();
6758   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6759
6760   // We didn't expect the animation to finish yet
6761   application.SendNotification();
6762   finishCheck.CheckSignalNotReceived();
6763   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6764
6765   application.SendNotification();
6766   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6767
6768   // We did expect the animation to finish
6769   application.SendNotification();
6770   finishCheck.CheckSignalReceived();
6771   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6772   END_TEST;
6773 }
6774
6775 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void)
6776 {
6777   TestApplication application;
6778
6779   Actor actor = Actor::New();
6780
6781   // Register a Vector3 property
6782   Vector3         startValue(10.0f, 10.0f, 10.0f);
6783   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6784   application.GetScene().Add(actor);
6785   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6786   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6787
6788   // Build the animation
6789   float     durationSeconds(1.0f);
6790   Animation animation = Animation::New(durationSeconds);
6791   Vector3   targetValue(30.0f, 30.0f, 30.0f);
6792   Vector3   relativeValue(targetValue - startValue);
6793   float     delay = 0.5f;
6794   animation.AnimateTo(Property(actor, "testProperty"),
6795                       targetValue,
6796                       AlphaFunction::LINEAR,
6797                       TimePeriod(delay, durationSeconds - delay));
6798
6799   // Start the animation
6800   animation.Play();
6801
6802   bool                 signalReceived(false);
6803   AnimationFinishCheck finishCheck(signalReceived);
6804   animation.FinishedSignal().Connect(&application, finishCheck);
6805
6806   application.SendNotification();
6807   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6808
6809   // We didn't expect the animation to finish yet
6810   application.SendNotification();
6811   finishCheck.CheckSignalNotReceived();
6812   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6813
6814   application.SendNotification();
6815   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6816
6817   // We didn't expect the animation to finish yet
6818   application.SendNotification();
6819   finishCheck.CheckSignalNotReceived();
6820   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6821
6822   application.SendNotification();
6823   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6824
6825   // We did expect the animation to finish
6826   application.SendNotification();
6827   finishCheck.CheckSignalReceived();
6828   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6829   END_TEST;
6830 }
6831
6832 int UtcDaliAnimationAnimateToVector3ComponentP(void)
6833 {
6834   TestApplication application;
6835
6836   Actor actor = Actor::New();
6837
6838   // Register a Vector3 property
6839   Vector3         startValue(10.0f, 10.0f, 10.0f);
6840   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6841   application.GetScene().Add(actor);
6842   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6843   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6844
6845   // Build the animation
6846   float     durationSeconds(1.0f);
6847   Animation animation = Animation::New(durationSeconds);
6848   Vector3   targetValue(30.0f, 30.0f, 10.0f);
6849   Vector3   relativeValue(targetValue - startValue);
6850   float     delay = 0.5f;
6851   animation.AnimateTo(Property(actor, "testProperty", 0),
6852                       30.0f,
6853                       AlphaFunction::LINEAR,
6854                       TimePeriod(delay, durationSeconds - delay));
6855   animation.AnimateTo(Property(actor, index, 1),
6856                       30.0f,
6857                       AlphaFunction::LINEAR,
6858                       TimePeriod(delay, durationSeconds - delay));
6859
6860   // Start the animation
6861   animation.Play();
6862
6863   bool                 signalReceived(false);
6864   AnimationFinishCheck finishCheck(signalReceived);
6865   animation.FinishedSignal().Connect(&application, finishCheck);
6866
6867   application.SendNotification();
6868   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6869
6870   // We didn't expect the animation to finish yet
6871   application.SendNotification();
6872   finishCheck.CheckSignalNotReceived();
6873   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6874
6875   application.SendNotification();
6876   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6877
6878   // We didn't expect the animation to finish yet
6879   application.SendNotification();
6880   finishCheck.CheckSignalNotReceived();
6881   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6882
6883   application.SendNotification();
6884   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6885
6886   // We did expect the animation to finish
6887   application.SendNotification();
6888   finishCheck.CheckSignalReceived();
6889   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6890   END_TEST;
6891 }
6892
6893 int UtcDaliAnimationAnimateToVector4P(void)
6894 {
6895   TestApplication application;
6896
6897   Actor actor = Actor::New();
6898
6899   // Register a Vector4 property
6900   Vector4         startValue(-50.0f, -40.0f, -30.0f, -20.0f);
6901   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6902   application.GetScene().Add(actor);
6903   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
6904   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
6905
6906   // Build the animation
6907   float     durationSeconds(2.0f);
6908   Animation animation = Animation::New(durationSeconds);
6909   Vector4   targetValue(50.0f, 50.0f, 50.0f, 50.0f);
6910   Vector4   relativeValue(targetValue - startValue);
6911   animation.AnimateTo(Property(actor, index), targetValue);
6912
6913   Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6914
6915   // Start the animation
6916   animation.Play();
6917
6918   bool                 signalReceived(false);
6919   AnimationFinishCheck finishCheck(signalReceived);
6920   animation.FinishedSignal().Connect(&application, finishCheck);
6921
6922   application.SendNotification();
6923   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6924
6925   // We didn't expect the animation to finish yet
6926   application.SendNotification();
6927   finishCheck.CheckSignalNotReceived();
6928   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION);
6929
6930   application.SendNotification();
6931   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6932
6933   // We did expect the animation to finish
6934   application.SendNotification();
6935   finishCheck.CheckSignalReceived();
6936   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
6937   END_TEST;
6938 }
6939
6940 int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void)
6941 {
6942   TestApplication application;
6943
6944   Actor actor = Actor::New();
6945
6946   // Register a Vector4 property
6947   Vector4         startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
6948   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6949   application.GetScene().Add(actor);
6950   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
6951   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
6952
6953   // Build the animation
6954   float     durationSeconds(1.0f);
6955   Animation animation = Animation::New(durationSeconds);
6956   Vector4   targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
6957   Vector4   relativeValue(targetValue - startValue);
6958   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6959
6960   Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6961
6962   // Start the animation
6963   animation.Play();
6964
6965   bool                 signalReceived(false);
6966   AnimationFinishCheck finishCheck(signalReceived);
6967   animation.FinishedSignal().Connect(&application, finishCheck);
6968
6969   application.SendNotification();
6970   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6971
6972   // We didn't expect the animation to finish yet
6973   application.SendNotification();
6974   finishCheck.CheckSignalNotReceived();
6975
6976   // The position should have moved more, than with a linear alpha function
6977   Vector4 current(actor.GetCurrentProperty<Vector4>(index));
6978   DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
6979   DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
6980   DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z);
6981   DALI_TEST_CHECK(current.w > ninetyFivePercentProgress.w);
6982
6983   application.SendNotification();
6984   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6985
6986   // We did expect the animation to finish
6987   application.SendNotification();
6988   finishCheck.CheckSignalReceived();
6989   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
6990   END_TEST;
6991 }
6992
6993 int UtcDaliAnimationAnimateToVector4TimePeriodP(void)
6994 {
6995   TestApplication application;
6996
6997   Actor actor = Actor::New();
6998
6999   // Register a Vector4 property
7000   Vector4         startValue(10.0f, 10.0f, 10.0f, 10.0f);
7001   Property::Index index = actor.RegisterProperty("testProperty", startValue);
7002   application.GetScene().Add(actor);
7003   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
7004   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION);
7005
7006   // Build the animation
7007   float     durationSeconds(1.0f);
7008   Animation animation = Animation::New(durationSeconds);
7009   Vector4   targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
7010   Vector4   relativeValue(targetValue - startValue);
7011   float     delay = 0.5f;
7012   animation.AnimateTo(Property(actor, index),
7013                       targetValue,
7014                       TimePeriod(delay, durationSeconds - delay));
7015
7016   // Start the animation
7017   animation.Play();
7018
7019   bool                 signalReceived(false);
7020   AnimationFinishCheck finishCheck(signalReceived);
7021   animation.FinishedSignal().Connect(&application, finishCheck);
7022
7023   application.SendNotification();
7024   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7025
7026   // We didn't expect the animation to finish yet
7027   application.SendNotification();
7028   finishCheck.CheckSignalNotReceived();
7029   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION);
7030
7031   application.SendNotification();
7032   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
7033
7034   // We didn't expect the animation to finish yet
7035   application.SendNotification();
7036   finishCheck.CheckSignalNotReceived();
7037   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), VECTOR4_EPSILON, TEST_LOCATION);
7038
7039   application.SendNotification();
7040   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7041
7042   // We did expect the animation to finish
7043   application.SendNotification();
7044   finishCheck.CheckSignalReceived();
7045   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, VECTOR4_EPSILON, TEST_LOCATION);
7046   END_TEST;
7047 }
7048
7049 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void)
7050 {
7051   TestApplication application;
7052
7053   Actor actor = Actor::New();
7054
7055   // Register a Vector4 property
7056   Vector4         startValue(10.0f, 10.0f, 10.0f, 10.0f);
7057   Property::Index index = actor.RegisterProperty("testProperty", startValue);
7058   application.GetScene().Add(actor);
7059   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
7060   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
7061
7062   // Build the animation
7063   float     durationSeconds(1.0f);
7064   Animation animation = Animation::New(durationSeconds);
7065   Vector4   targetValue(30.0f, 30.0f, 30.0f, 30.0f);
7066   Vector4   relativeValue(targetValue - startValue);
7067   float     delay = 0.5f;
7068   animation.AnimateTo(Property(actor, index),
7069                       targetValue,
7070                       AlphaFunction::LINEAR,
7071                       TimePeriod(delay, durationSeconds - delay));
7072
7073   // Start the animation
7074   animation.Play();
7075
7076   bool                 signalReceived(false);
7077   AnimationFinishCheck finishCheck(signalReceived);
7078   animation.FinishedSignal().Connect(&application, finishCheck);
7079
7080   application.SendNotification();
7081   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7082
7083   // We didn't expect the animation to finish yet
7084   application.SendNotification();
7085   finishCheck.CheckSignalNotReceived();
7086   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
7087
7088   application.SendNotification();
7089   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
7090
7091   // We didn't expect the animation to finish yet
7092   application.SendNotification();
7093   finishCheck.CheckSignalNotReceived();
7094   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
7095
7096   application.SendNotification();
7097   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7098
7099   // We did expect the animation to finish
7100   application.SendNotification();
7101   finishCheck.CheckSignalReceived();
7102   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
7103   END_TEST;
7104 }
7105
7106 int UtcDaliAnimationAnimateToActorParentOriginP(void)
7107 {
7108   TestApplication application;
7109
7110   Actor actor = Actor::New();
7111   application.GetScene().Add(actor);
7112   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_LEFT, TEST_LOCATION);
7113
7114   // Build the animation
7115   float     durationSeconds(1.0f);
7116   Animation animation = Animation::New(durationSeconds);
7117   Vector3   targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
7118
7119   DALI_TEST_ASSERTION(
7120     {
7121       animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin);
7122     },
7123     "Property is not animatable");
7124
7125   END_TEST;
7126 }
7127
7128 int UtcDaliAnimationAnimateToActorParentOriginXN(void)
7129 {
7130   TestApplication application;
7131
7132   Actor actor = Actor::New();
7133   application.GetScene().Add(actor);
7134   float startValue(0.0f);
7135   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).x, startValue, TEST_LOCATION);
7136   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION);
7137
7138   // Build the animation
7139   float     durationSeconds(1.0f);
7140   Animation animation = Animation::New(durationSeconds);
7141   float     targetX(1.0f);
7142
7143   DALI_TEST_ASSERTION(
7144     {
7145       animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX);
7146     },
7147     "Property is not animatable");
7148
7149   END_TEST;
7150 }
7151
7152 int UtcDaliAnimationAnimateToActorParentOriginYN(void)
7153 {
7154   TestApplication application;
7155
7156   Actor actor = Actor::New();
7157   application.GetScene().Add(actor);
7158   float startValue(0.0f);
7159   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).y, startValue, TEST_LOCATION);
7160   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION);
7161
7162   // Build the animation
7163   float     durationSeconds(1.0f);
7164   Animation animation = Animation::New(durationSeconds);
7165   float     targetY(1.0f);
7166
7167   DALI_TEST_ASSERTION(
7168     {
7169       animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY);
7170     },
7171     "Property is not animatable");
7172
7173   END_TEST;
7174 }
7175
7176 int UtcDaliAnimationAnimateToActorParentOriginZN(void)
7177 {
7178   TestApplication application;
7179
7180   Actor actor = Actor::New();
7181   application.GetScene().Add(actor);
7182   float startValue(0.5f);
7183   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).z, startValue, TEST_LOCATION);
7184   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION);
7185
7186   // Build the animation
7187   float     durationSeconds(1.0f);
7188   Animation animation = Animation::New(durationSeconds);
7189   float     targetZ(1.0f);
7190
7191   DALI_TEST_ASSERTION(
7192     {
7193       animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ);
7194     },
7195     "Property is not animatable");
7196
7197   END_TEST;
7198 }
7199
7200 int UtcDaliAnimationAnimateToActorAnchorPointN(void)
7201 {
7202   TestApplication application;
7203
7204   Actor actor = Actor::New();
7205   application.GetScene().Add(actor);
7206   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), AnchorPoint::CENTER, TEST_LOCATION);
7207
7208   // Build the animation
7209   float     durationSeconds(1.0f);
7210   Animation animation = Animation::New(durationSeconds);
7211   Vector3   targetAnchorPoint(AnchorPoint::TOP_LEFT);
7212
7213   DALI_TEST_ASSERTION(
7214     {
7215       animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
7216     },
7217     "Property is not animatable");
7218
7219   END_TEST;
7220 }
7221
7222 int UtcDaliAnimationAnimateToActorAnchorPointXN(void)
7223 {
7224   TestApplication application;
7225
7226   Actor actor = Actor::New();
7227   application.GetScene().Add(actor);
7228   float startValue(0.5f);
7229   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).x, startValue, TEST_LOCATION);
7230   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION);
7231
7232   // Build the animation
7233   float     durationSeconds(1.0f);
7234   Animation animation = Animation::New(durationSeconds);
7235   float     targetX(1.0f);
7236
7237   DALI_TEST_ASSERTION(
7238     {
7239       animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_X), targetX);
7240     },
7241     "Property is not animatable");
7242
7243   END_TEST;
7244 }
7245
7246 int UtcDaliAnimationAnimateToActorAnchorPointYN(void)
7247 {
7248   TestApplication application;
7249
7250   Actor actor = Actor::New();
7251   application.GetScene().Add(actor);
7252   float startValue(0.5f);
7253   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).y, startValue, TEST_LOCATION);
7254   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION);
7255
7256   // Build the animation
7257   float     durationSeconds(1.0f);
7258   Animation animation = Animation::New(durationSeconds);
7259   float     targetY(0.0f);
7260
7261   DALI_TEST_ASSERTION(
7262     {
7263       animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY);
7264     },
7265     "Property is not animatable");
7266
7267   END_TEST;
7268 }
7269
7270 int UtcDaliAnimationAnimateToActorAnchorPointZN(void)
7271 {
7272   TestApplication application;
7273
7274   Actor actor = Actor::New();
7275   application.GetScene().Add(actor);
7276   float startValue(0.5f);
7277   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).z, startValue, TEST_LOCATION);
7278   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION);
7279
7280   // Build the animation
7281   float     durationSeconds(1.0f);
7282   Animation animation = Animation::New(durationSeconds);
7283   float     targetZ(100.0f);
7284
7285   DALI_TEST_ASSERTION(
7286     {
7287       animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ);
7288     },
7289     "Property is not animatable");
7290
7291   END_TEST;
7292 }
7293
7294 int UtcDaliAnimationAnimateToActorSizeP(void)
7295 {
7296   TestApplication application;
7297
7298   Actor actor = Actor::New();
7299   application.GetScene().Add(actor);
7300   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7301
7302   // Build the animation
7303   float     durationSeconds(1.0f);
7304   Animation animation = Animation::New(durationSeconds);
7305   Vector3   targetSize(100.0f, 100.0f, 100.0f);
7306   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize);
7307
7308   Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7309
7310   // Should return the initial properties before play
7311   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7312   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), 0.0f, TEST_LOCATION);
7313   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), 0.0f, TEST_LOCATION);
7314   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), 0.0f, TEST_LOCATION);
7315
7316   // Start the animation
7317   animation.Play();
7318
7319   // Should return the target property after play
7320   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7321   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION);
7322   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION);
7323   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION);
7324
7325   bool                 signalReceived(false);
7326   AnimationFinishCheck finishCheck(signalReceived);
7327   animation.FinishedSignal().Connect(&application, finishCheck);
7328
7329   application.SendNotification();
7330   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7331
7332   // We didn't expect the animation to finish yet
7333   application.SendNotification();
7334   finishCheck.CheckSignalNotReceived();
7335   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), ninetyNinePercentProgress, TEST_LOCATION);
7336
7337   application.SendNotification();
7338   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7339
7340   // We did expect the animation to finish
7341   application.SendNotification();
7342   finishCheck.CheckSignalReceived();
7343   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7344
7345   // Reset everything
7346   finishCheck.Reset();
7347   actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7348   application.SendNotification();
7349   application.Render(0);
7350   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7351
7352   // Repeat with a different (ease-in) alpha function
7353   animation = Animation::New(durationSeconds);
7354   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
7355   animation.FinishedSignal().Connect(&application, finishCheck);
7356   animation.Play();
7357
7358   application.SendNotification();
7359   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7360
7361   // We didn't expect the animation to finish yet
7362   application.SendNotification();
7363   finishCheck.CheckSignalNotReceived();
7364
7365   // The size should have travelled less, than with a linear alpha function
7366   Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
7367   DALI_TEST_CHECK(current.x > 0.0f);
7368   DALI_TEST_CHECK(current.y > 0.0f);
7369   DALI_TEST_CHECK(current.z > 0.0f);
7370   DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
7371   DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
7372   DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z);
7373
7374   application.SendNotification();
7375   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7376
7377   // We did expect the animation to finish
7378   application.SendNotification();
7379   finishCheck.CheckSignalReceived();
7380   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7381
7382   // Reset everything
7383   finishCheck.Reset();
7384   actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7385   application.SendNotification();
7386   application.Render(0);
7387   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7388
7389   // Repeat with a delay
7390   float delay = 0.5f;
7391   animation   = Animation::New(durationSeconds);
7392   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7393   animation.FinishedSignal().Connect(&application, finishCheck);
7394   animation.Play();
7395
7396   application.SendNotification();
7397   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7398
7399   // We didn't expect the animation to finish yet
7400   application.SendNotification();
7401   finishCheck.CheckSignalNotReceived();
7402   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7403
7404   application.SendNotification();
7405   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7406
7407   // We did expect the animation to finish
7408   application.SendNotification();
7409   finishCheck.CheckSignalReceived();
7410   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7411   END_TEST;
7412 }
7413
7414 int UtcDaliAnimationAnimateToActorSizeWidthP(void)
7415 {
7416   TestApplication application;
7417
7418   Actor actor = Actor::New();
7419   application.GetScene().Add(actor);
7420   float startValue(0.0f);
7421   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, startValue, TEST_LOCATION);
7422   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION);
7423
7424   // Build the animation
7425   float     durationSeconds(1.0f);
7426   Animation animation = Animation::New(durationSeconds);
7427   float     targetWidth(10.0f);
7428   animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetWidth);
7429
7430   float fiftyPercentProgress(startValue + (targetWidth - startValue) * 0.5f);
7431
7432   // Should return the initial properties before play
7433   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7434   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION);
7435
7436   // Start the animation
7437   animation.Play();
7438
7439   // Should return the target property after play
7440   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(targetWidth, 0.0f, 0.0f), TEST_LOCATION);
7441   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION);
7442
7443   bool                 signalReceived(false);
7444   AnimationFinishCheck finishCheck(signalReceived);
7445   animation.FinishedSignal().Connect(&application, finishCheck);
7446
7447   application.SendNotification();
7448   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7449
7450   // We didn't expect the animation to finish yet
7451   application.SendNotification();
7452   finishCheck.CheckSignalNotReceived();
7453   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, fiftyPercentProgress, TEST_LOCATION);
7454
7455   application.SendNotification();
7456   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7457
7458   // We did expect the animation to finish
7459   application.SendNotification();
7460   finishCheck.CheckSignalReceived();
7461   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, targetWidth, TEST_LOCATION);
7462   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION);
7463   END_TEST;
7464 }
7465
7466 int UtcDaliAnimationAnimateToActorSizeHeightP(void)
7467 {
7468   TestApplication application;
7469
7470   Actor actor = Actor::New();
7471   application.GetScene().Add(actor);
7472   float startValue(0.0f);
7473   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, startValue, TEST_LOCATION);
7474   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION);
7475
7476   // Build the animation
7477   float     durationSeconds(1.0f);
7478   Animation animation = Animation::New(durationSeconds);
7479   float     targetHeight(-10.0f);
7480   animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight);
7481
7482   float fiftyPercentProgress(startValue + (targetHeight - startValue) * 0.5f);
7483
7484   // Should return the initial properties before play
7485   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7486   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION);
7487
7488   // Start the animation
7489   animation.Play();
7490
7491   // Should return the target property after play
7492   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(0.0f, targetHeight, 0.0f), TEST_LOCATION);
7493   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION);
7494
7495   bool                 signalReceived(false);
7496   AnimationFinishCheck finishCheck(signalReceived);
7497   animation.FinishedSignal().Connect(&application, finishCheck);
7498
7499   application.SendNotification();
7500   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7501
7502   // We didn't expect the animation to finish yet
7503   application.SendNotification();
7504   finishCheck.CheckSignalNotReceived();
7505   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, fiftyPercentProgress, TEST_LOCATION);
7506
7507   application.SendNotification();
7508   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7509
7510   // We did expect the animation to finish
7511   application.SendNotification();
7512   finishCheck.CheckSignalReceived();
7513   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, targetHeight, TEST_LOCATION);
7514   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION);
7515   END_TEST;
7516 }
7517
7518 int UtcDaliAnimationAnimateToActorSizeDepthP(void)
7519 {
7520   TestApplication application;
7521
7522   Actor actor = Actor::New();
7523   application.GetScene().Add(actor);
7524   float startValue(0.0f);
7525   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, startValue, TEST_LOCATION);
7526   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION);
7527
7528   // Build the animation
7529   float     durationSeconds(1.0f);
7530   Animation animation = Animation::New(durationSeconds);
7531   float     targetDepth(-10.0f);
7532   animation.AnimateTo(Property(actor, Actor::Property::SIZE_DEPTH), targetDepth);
7533
7534   float fiftyPercentProgress(startValue + (targetDepth - startValue) * 0.5f);
7535
7536   // Should return the initial properties before play
7537   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7538   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION);
7539
7540   // Start the animation
7541   animation.Play();
7542
7543   // Should return the target property after play
7544   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(0.0f, 0.0f, targetDepth), TEST_LOCATION);
7545   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION);
7546
7547   bool                 signalReceived(false);
7548   AnimationFinishCheck finishCheck(signalReceived);
7549   animation.FinishedSignal().Connect(&application, finishCheck);
7550
7551   application.SendNotification();
7552   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7553
7554   // We didn't expect the animation to finish yet
7555   application.SendNotification();
7556   finishCheck.CheckSignalNotReceived();
7557   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, fiftyPercentProgress, TEST_LOCATION);
7558
7559   application.SendNotification();
7560   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7561
7562   // We did expect the animation to finish
7563   application.SendNotification();
7564   finishCheck.CheckSignalReceived();
7565   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, targetDepth, TEST_LOCATION);
7566   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION);
7567   END_TEST;
7568 }
7569
7570 int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void)
7571 {
7572   TestApplication application;
7573
7574   Actor actor = Actor::New();
7575   application.GetScene().Add(actor);
7576   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7577
7578   // Build the animation
7579   float     durationSeconds(1.0f);
7580   Animation animation = Animation::New(durationSeconds);
7581   Vector3   targetSize(100.0f, 100.0f, 100.0f);
7582   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize);
7583
7584   Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7585
7586   // Start the animation
7587   animation.Play();
7588
7589   bool                 signalReceived(false);
7590   AnimationFinishCheck finishCheck(signalReceived);
7591   animation.FinishedSignal().Connect(&application, finishCheck);
7592
7593   application.SendNotification();
7594   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7595
7596   // We didn't expect the animation to finish yet
7597   application.SendNotification();
7598   finishCheck.CheckSignalNotReceived();
7599   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), ninetyNinePercentProgress, TEST_LOCATION);
7600
7601   application.SendNotification();
7602   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7603
7604   // We did expect the animation to finish
7605   application.SendNotification();
7606   finishCheck.CheckSignalReceived();
7607   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7608
7609   // Reset everything
7610   finishCheck.Reset();
7611   actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7612   application.SendNotification();
7613   application.Render(0);
7614   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7615
7616   // Repeat with a different (ease-in) alpha function
7617   animation = Animation::New(durationSeconds);
7618   animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetSize.x, AlphaFunction::EASE_IN);
7619   animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetSize.y, AlphaFunction::EASE_IN);
7620   animation.FinishedSignal().Connect(&application, finishCheck);
7621   animation.Play();
7622
7623   application.SendNotification();
7624   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7625
7626   // We didn't expect the animation to finish yet
7627   application.SendNotification();
7628   finishCheck.CheckSignalNotReceived();
7629
7630   // The size should have travelled less, than with a linear alpha function
7631   Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
7632   DALI_TEST_CHECK(current.x > 0.0f);
7633   DALI_TEST_CHECK(current.y > 0.0f);
7634   DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
7635   DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
7636
7637   application.SendNotification();
7638   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7639
7640   // We did expect the animation to finish
7641   application.SendNotification();
7642   finishCheck.CheckSignalReceived();
7643   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).x, targetSize.x, TEST_LOCATION);
7644   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).y, targetSize.y, TEST_LOCATION);
7645
7646   // Reset everything
7647   finishCheck.Reset();
7648   actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7649   application.SendNotification();
7650   application.Render(0);
7651   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7652
7653   // Repeat with a delay
7654   float delay = 0.5f;
7655   animation   = Animation::New(durationSeconds);
7656   animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetSize.x, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7657   animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetSize.y, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7658   animation.FinishedSignal().Connect(&application, finishCheck);
7659   animation.Play();
7660
7661   application.SendNotification();
7662   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7663
7664   // We didn't expect the animation to finish yet
7665   application.SendNotification();
7666   finishCheck.CheckSignalNotReceived();
7667   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7668
7669   application.SendNotification();
7670   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7671
7672   // We did expect the animation to finish
7673   application.SendNotification();
7674   finishCheck.CheckSignalReceived();
7675   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).x, targetSize.x, TEST_LOCATION);
7676   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).y, targetSize.y, TEST_LOCATION);
7677   END_TEST;
7678 }
7679
7680 int UtcDaliAnimationAnimateToActorPositionP(void)
7681 {
7682   TestApplication application;
7683
7684   Actor actor = Actor::New();
7685   application.GetScene().Add(actor);
7686   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7687
7688   // Build the animation
7689   float     durationSeconds(1.0f);
7690   Animation animation = Animation::New(durationSeconds);
7691   Vector3   targetPosition(200.0f, 200.0f, 200.0f);
7692   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
7693
7694   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7695
7696   // Should return the initial properties before play
7697   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7698   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
7699   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), 0.0f, TEST_LOCATION);
7700   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), 0.0f, TEST_LOCATION);
7701
7702   // Start the animation
7703   animation.Play();
7704
7705   // Should return the target property after play
7706   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7707   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
7708   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
7709   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
7710
7711   bool                 signalReceived(false);
7712   AnimationFinishCheck finishCheck(signalReceived);
7713   animation.FinishedSignal().Connect(&application, finishCheck);
7714
7715   application.SendNotification();
7716   application.Render(static_cast<unsigned int>(durationSeconds * 750.0f) /* 75% progress */);
7717
7718   // We didn't expect the animation to finish yet
7719   application.SendNotification();
7720   finishCheck.CheckSignalNotReceived();
7721   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION);
7722
7723   application.SendNotification();
7724   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7725
7726   // We did expect the animation to finish
7727   application.SendNotification();
7728   finishCheck.CheckSignalReceived();
7729   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7730   END_TEST;
7731 }
7732
7733 int UtcDaliAnimationAnimateToActorPositionXP(void)
7734 {
7735   TestApplication application;
7736
7737   Actor actor = Actor::New();
7738   application.GetScene().Add(actor);
7739   float startValue(0.0f);
7740   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, startValue, TEST_LOCATION);
7741   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7742   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7743   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7744
7745   // Build the animation
7746   float     durationSeconds(1.0f);
7747   Animation animation = Animation::New(durationSeconds);
7748   float     targetX(1.0f);
7749   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), targetX);
7750
7751   float fiftyPercentProgress(startValue + (targetX - startValue) * 0.5f);
7752
7753   // Should return the initial properties before play
7754   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7755   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7756
7757   // Start the animation
7758   animation.Play();
7759
7760   // Should return the target property after play
7761   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(targetX, 0.0f, 0.0f), TEST_LOCATION);
7762   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION);
7763
7764   bool                 signalReceived(false);
7765   AnimationFinishCheck finishCheck(signalReceived);
7766   animation.FinishedSignal().Connect(&application, finishCheck);
7767
7768   application.SendNotification();
7769   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7770
7771   // We didn't expect the animation to finish yet
7772   application.SendNotification();
7773   finishCheck.CheckSignalNotReceived();
7774   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, fiftyPercentProgress, TEST_LOCATION);
7775
7776   application.SendNotification();
7777   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7778
7779   // We did expect the animation to finish
7780   application.SendNotification();
7781   finishCheck.CheckSignalReceived();
7782   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, targetX, TEST_LOCATION);
7783   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION);
7784   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7785   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7786   END_TEST;
7787 }
7788
7789 int UtcDaliAnimationAnimateToActorPositionYP(void)
7790 {
7791   TestApplication application;
7792
7793   Actor actor = Actor::New();
7794   application.GetScene().Add(actor);
7795   float startValue(0.0f);
7796   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, startValue, TEST_LOCATION);
7797   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7798   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7799   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7800
7801   // Build the animation
7802   float     durationSeconds(1.0f);
7803   Animation animation = Animation::New(durationSeconds);
7804   float     targetY(10.0f);
7805   animation.AnimateTo(Property(actor, Actor::Property::POSITION_Y), targetY);
7806
7807   float fiftyPercentProgress(startValue + (targetY - startValue) * 0.5f);
7808
7809   // Should return the initial properties before play
7810   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7811   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7812
7813   // Start the animation
7814   animation.Play();
7815
7816   // Should return the target property after play
7817   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, targetY, 0.0f), TEST_LOCATION);
7818   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION);
7819
7820   bool                 signalReceived(false);
7821   AnimationFinishCheck finishCheck(signalReceived);
7822   animation.FinishedSignal().Connect(&application, finishCheck);
7823
7824   application.SendNotification();
7825   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7826
7827   // We didn't expect the animation to finish yet
7828   application.SendNotification();
7829   finishCheck.CheckSignalNotReceived();
7830   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, fiftyPercentProgress, TEST_LOCATION);
7831
7832   application.SendNotification();
7833   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7834
7835   // We did expect the animation to finish
7836   application.SendNotification();
7837   finishCheck.CheckSignalReceived();
7838   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, targetY, TEST_LOCATION);
7839   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7840   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION);
7841   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7842   END_TEST;
7843 }
7844
7845 int UtcDaliAnimationAnimateToActorPositionZP(void)
7846 {
7847   TestApplication application;
7848
7849   Actor actor = Actor::New();
7850   application.GetScene().Add(actor);
7851   float startValue(0.0f);
7852   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, startValue, TEST_LOCATION);
7853   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7854   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7855   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7856
7857   // Build the animation
7858   float     durationSeconds(1.0f);
7859   Animation animation = Animation::New(durationSeconds);
7860   float     targetZ(-5.0f);
7861   animation.AnimateTo(Property(actor, Actor::Property::POSITION_Z), targetZ);
7862
7863   float fiftyPercentProgress(startValue + (targetZ - startValue) * 0.5f);
7864
7865   // Should return the initial properties before play
7866   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7867   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7868
7869   // Start the animation
7870   animation.Play();
7871
7872   // Should return the target property after play
7873   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, targetZ), TEST_LOCATION);
7874   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION);
7875
7876   bool                 signalReceived(false);
7877   AnimationFinishCheck finishCheck(signalReceived);
7878   animation.FinishedSignal().Connect(&application, finishCheck);
7879
7880   application.SendNotification();
7881   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7882
7883   // We didn't expect the animation to finish yet
7884   application.SendNotification();
7885   finishCheck.CheckSignalNotReceived();
7886   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, fiftyPercentProgress, TEST_LOCATION);
7887
7888   application.SendNotification();
7889   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7890
7891   // We did expect the animation to finish
7892   application.SendNotification();
7893   finishCheck.CheckSignalReceived();
7894   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, targetZ, TEST_LOCATION);
7895   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7896   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7897   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION);
7898   END_TEST;
7899 }
7900
7901 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void)
7902 {
7903   TestApplication application;
7904
7905   Actor actor = Actor::New();
7906   application.GetScene().Add(actor);
7907   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7908
7909   // Build the animation
7910   float     durationSeconds(1.0f);
7911   Animation animation = Animation::New(durationSeconds);
7912   Vector3   targetPosition(200.0f, 200.0f, 200.0f);
7913   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
7914
7915   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7916
7917   // Start the animation
7918   animation.Play();
7919
7920   bool                 signalReceived(false);
7921   AnimationFinishCheck finishCheck(signalReceived);
7922   animation.FinishedSignal().Connect(&application, finishCheck);
7923
7924   application.SendNotification();
7925   application.Render(static_cast<unsigned int>(durationSeconds * 750.0f) /* 75% progress */);
7926
7927   // We didn't expect the animation to finish yet
7928   application.SendNotification();
7929   finishCheck.CheckSignalNotReceived();
7930
7931   // The position should have moved less, than with a linear alpha function
7932   Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
7933   DALI_TEST_CHECK(current.x > Vector3::ZERO.x);
7934   DALI_TEST_CHECK(current.y > Vector3::ZERO.y);
7935   DALI_TEST_CHECK(current.z > Vector3::ZERO.z);
7936   DALI_TEST_CHECK(current.x < seventyFivePercentProgress.x);
7937   DALI_TEST_CHECK(current.y < seventyFivePercentProgress.y);
7938   DALI_TEST_CHECK(current.z < seventyFivePercentProgress.z);
7939
7940   application.SendNotification();
7941   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7942
7943   // We did expect the animation to finish
7944   application.SendNotification();
7945   finishCheck.CheckSignalReceived();
7946   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7947   END_TEST;
7948 }
7949
7950 int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void)
7951 {
7952   TestApplication application;
7953
7954   Actor actor = Actor::New();
7955   application.GetScene().Add(actor);
7956   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7957
7958   // Build the animation
7959   float     durationSeconds(1.0f);
7960   Animation animation = Animation::New(durationSeconds);
7961   Vector3   targetPosition(200.0f, 200.0f, 200.0f);
7962   float     delay = 0.5f;
7963   animation.AnimateTo(Property(actor, Actor::Property::POSITION),
7964                       targetPosition,
7965                       TimePeriod(delay, durationSeconds - delay));
7966
7967   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7968
7969   // Start the animation
7970   animation.Play();
7971
7972   bool                 signalReceived(false);
7973   AnimationFinishCheck finishCheck(signalReceived);
7974   animation.FinishedSignal().Connect(&application, finishCheck);
7975
7976   application.SendNotification();
7977   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7978
7979   // We didn't expect the animation to finish yet
7980   application.SendNotification();
7981   finishCheck.CheckSignalNotReceived();
7982   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7983
7984   application.SendNotification();
7985   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.75) /* 7/8 animation progress, 3/4 animator progress */);
7986
7987   // We didn't expect the animation to finish yet
7988   application.SendNotification();
7989   finishCheck.CheckSignalNotReceived();
7990   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION);
7991
7992   application.SendNotification();
7993   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.25) + 1u /*just beyond the animation duration*/);
7994
7995   // We did expect the animation to finish
7996   application.SendNotification();
7997   finishCheck.CheckSignalReceived();
7998   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7999   END_TEST;
8000 }
8001
8002 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void)
8003 {
8004   TestApplication application;
8005
8006   Actor actor = Actor::New();
8007   application.GetScene().Add(actor);
8008   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
8009
8010   // Build the animation
8011   float     durationSeconds(1.0f);
8012   Animation animation = Animation::New(durationSeconds);
8013   Vector3   targetPosition(200.0f, 200.0f, 200.0f);
8014   float     delay = 0.5f;
8015   animation.AnimateTo(Property(actor, Actor::Property::POSITION),
8016                       targetPosition,
8017                       AlphaFunction::LINEAR,
8018                       TimePeriod(delay, durationSeconds - delay));
8019
8020   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
8021
8022   // Start the animation
8023   animation.Play();
8024
8025   bool                 signalReceived(false);
8026   AnimationFinishCheck finishCheck(signalReceived);
8027   animation.FinishedSignal().Connect(&application, finishCheck);
8028
8029   application.SendNotification();
8030   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
8031
8032   // We didn't expect the animation to finish yet
8033   application.SendNotification();
8034   finishCheck.CheckSignalNotReceived();
8035   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
8036
8037   application.SendNotification();
8038   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.75) /* 7/8 animation progress, 3/4 animator progress */);
8039
8040   // We didn't expect the animation to finish yet
8041   application.SendNotification();
8042   finishCheck.CheckSignalNotReceived();
8043   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION);
8044
8045   application.SendNotification();
8046   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.25) + 1u /*just beyond the animation duration*/);
8047
8048   // We did expect the animation to finish
8049   application.SendNotification();
8050   finishCheck.CheckSignalReceived();
8051   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
8052   END_TEST;
8053 }
8054
8055 int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void)
8056 {
8057   TestApplication application;
8058
8059   Actor actor = Actor::New();
8060   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8061   application.GetScene().Add(actor);
8062   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8063
8064   // Build the animation
8065   float     durationSeconds(1.0f);
8066   Animation animation = Animation::New(durationSeconds);
8067   Degree    targetRotationDegrees(90.0f);
8068   Radian    targetRotationRadians(targetRotationDegrees);
8069   animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS));
8070
8071   // Start the animation
8072   animation.Play();
8073
8074   // Target value should be retrievable straight away
8075   DALI_TEST_EQUALS(actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8076
8077   bool                 signalReceived(false);
8078   AnimationFinishCheck finishCheck(signalReceived);
8079   animation.FinishedSignal().Connect(&application, finishCheck);
8080
8081   application.SendNotification();
8082   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8083
8084   // We didn't expect the animation to finish yet
8085   application.SendNotification();
8086   finishCheck.CheckSignalNotReceived();
8087   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8088
8089   application.SendNotification();
8090   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8091
8092   // We didn't expect the animation to finish yet
8093   application.SendNotification();
8094   finishCheck.CheckSignalNotReceived();
8095   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8096
8097   application.SendNotification();
8098   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8099
8100   // We didn't expect the animation to finish yet
8101   application.SendNotification();
8102   finishCheck.CheckSignalNotReceived();
8103   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8104
8105   application.SendNotification();
8106   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8107
8108   // We did expect the animation to finish
8109   application.SendNotification();
8110   finishCheck.CheckSignalReceived();
8111   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8112   END_TEST;
8113 }
8114
8115 int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void)
8116 {
8117   TestApplication application;
8118
8119   Actor actor = Actor::New();
8120   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8121   application.GetScene().Add(actor);
8122   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8123
8124   // Build the animation
8125   float      durationSeconds(1.0f);
8126   Animation  animation = Animation::New(durationSeconds);
8127   Degree     targetRotationDegrees(90.0f);
8128   Radian     targetRotationRadians(targetRotationDegrees);
8129   Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
8130   animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), targetRotation);
8131
8132   // Start the animation
8133   animation.Play();
8134
8135   bool                 signalReceived(false);
8136   AnimationFinishCheck finishCheck(signalReceived);
8137   animation.FinishedSignal().Connect(&application, finishCheck);
8138
8139   application.SendNotification();
8140   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8141
8142   // We didn't expect the animation to finish yet
8143   application.SendNotification();
8144   finishCheck.CheckSignalNotReceived();
8145   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8146
8147   application.SendNotification();
8148   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8149
8150   // We didn't expect the animation to finish yet
8151   application.SendNotification();
8152   finishCheck.CheckSignalNotReceived();
8153   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8154
8155   application.SendNotification();
8156   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8157
8158   // We didn't expect the animation to finish yet
8159   application.SendNotification();
8160   finishCheck.CheckSignalNotReceived();
8161   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8162
8163   application.SendNotification();
8164   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8165
8166   // We did expect the animation to finish
8167   application.SendNotification();
8168   finishCheck.CheckSignalReceived();
8169   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8170   END_TEST;
8171 }
8172
8173 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void)
8174 {
8175   TestApplication application;
8176
8177   Actor actor = Actor::New();
8178   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8179   application.GetScene().Add(actor);
8180   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8181
8182   // Build the animation
8183   float     durationSeconds(1.0f);
8184   Animation animation = Animation::New(durationSeconds);
8185   Degree    targetRotationDegrees(90.0f);
8186   Radian    targetRotationRadians(targetRotationDegrees);
8187   animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
8188
8189   // Start the animation
8190   animation.Play();
8191
8192   bool                 signalReceived(false);
8193   AnimationFinishCheck finishCheck(signalReceived);
8194   animation.FinishedSignal().Connect(&application, finishCheck);
8195
8196   application.SendNotification();
8197   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8198
8199   // We didn't expect the animation to finish yet
8200   application.SendNotification();
8201   finishCheck.CheckSignalNotReceived();
8202   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f * 0.25f * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8203
8204   application.SendNotification();
8205   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8206
8207   // We didn't expect the animation to finish yet
8208   application.SendNotification();
8209   finishCheck.CheckSignalNotReceived();
8210   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f * 0.5f * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8211
8212   application.SendNotification();
8213   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8214
8215   // We didn't expect the animation to finish yet
8216   application.SendNotification();
8217   finishCheck.CheckSignalNotReceived();
8218   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f * 0.75f * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8219
8220   application.SendNotification();
8221   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8222
8223   // We did expect the animation to finish
8224   application.SendNotification();
8225   finishCheck.CheckSignalReceived();
8226   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8227   END_TEST;
8228 }
8229
8230 int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void)
8231 {
8232   TestApplication application;
8233
8234   Actor actor = Actor::New();
8235   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8236   application.GetScene().Add(actor);
8237   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8238
8239   // Build the animation
8240   float     durationSeconds(1.0f);
8241   Animation animation = Animation::New(durationSeconds);
8242   Degree    targetRotationDegrees(90.0f);
8243   Radian    targetRotationRadians(targetRotationDegrees);
8244   float     delay(0.1f);
8245   animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
8246
8247   // Start the animation
8248   animation.Play();
8249
8250   bool                 signalReceived(false);
8251   AnimationFinishCheck finishCheck(signalReceived);
8252   animation.FinishedSignal().Connect(&application, finishCheck);
8253
8254   application.SendNotification();
8255   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8256
8257   // We didn't expect the animation to finish yet
8258   application.SendNotification();
8259   finishCheck.CheckSignalNotReceived();
8260   float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
8261   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8262
8263   application.SendNotification();
8264   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8265
8266   // We didn't expect the animation to finish yet
8267   application.SendNotification();
8268   finishCheck.CheckSignalNotReceived();
8269   progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
8270   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8271
8272   application.SendNotification();
8273   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8274
8275   // We didn't expect the animation to finish yet
8276   application.SendNotification();
8277   finishCheck.CheckSignalNotReceived();
8278   progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
8279   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8280
8281   application.SendNotification();
8282   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8283
8284   // We did expect the animation to finish
8285   application.SendNotification();
8286   finishCheck.CheckSignalReceived();
8287   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8288   END_TEST;
8289 }
8290
8291 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void)
8292 {
8293   TestApplication application;
8294
8295   Actor actor = Actor::New();
8296   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8297   application.GetScene().Add(actor);
8298   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8299
8300   // Build the animation
8301   float     durationSeconds(1.0f);
8302   Animation animation = Animation::New(durationSeconds);
8303   Degree    targetRotationDegrees(90.0f);
8304   Radian    targetRotationRadians(targetRotationDegrees);
8305   float     delay(0.1f);
8306   animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
8307
8308   // Start the animation
8309   animation.Play();
8310
8311   bool                 signalReceived(false);
8312   AnimationFinishCheck finishCheck(signalReceived);
8313   animation.FinishedSignal().Connect(&application, finishCheck);
8314
8315   application.SendNotification();
8316   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8317
8318   // We didn't expect the animation to finish yet
8319   application.SendNotification();
8320   finishCheck.CheckSignalNotReceived();
8321   float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
8322   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8323
8324   application.SendNotification();
8325   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8326
8327   // We didn't expect the animation to finish yet
8328   application.SendNotification();
8329   finishCheck.CheckSignalNotReceived();
8330   progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
8331   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8332
8333   application.SendNotification();
8334   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8335
8336   // We didn't expect the animation to finish yet
8337   application.SendNotification();
8338   finishCheck.CheckSignalNotReceived();
8339   progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
8340   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8341
8342   application.SendNotification();
8343   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8344
8345   // We did expect the animation to finish
8346   application.SendNotification();
8347   finishCheck.CheckSignalReceived();
8348   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8349   END_TEST;
8350 }
8351
8352 int UtcDaliAnimationAnimateToActorScaleP(void)
8353 {
8354   TestApplication application;
8355
8356   Actor actor = Actor::New();
8357   application.GetScene().Add(actor);
8358   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8359
8360   // Build the animation
8361   float     durationSeconds(1.0f);
8362   Animation animation = Animation::New(durationSeconds);
8363   Vector3   targetScale(2.0f, 2.0f, 2.0f);
8364   animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale);
8365
8366   Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE) * 0.99f);
8367
8368   // Start the animation
8369   animation.Play();
8370
8371   // Target value should be retrievable straight away
8372   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8373   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), targetScale.x, TEST_LOCATION);
8374   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), targetScale.y, TEST_LOCATION);
8375   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), targetScale.z, TEST_LOCATION);
8376
8377   bool                 signalReceived(false);
8378   AnimationFinishCheck finishCheck(signalReceived);
8379   animation.FinishedSignal().Connect(&application, finishCheck);
8380
8381   application.SendNotification();
8382   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
8383
8384   // We didn't expect the animation to finish yet
8385   application.SendNotification();
8386   finishCheck.CheckSignalNotReceived();
8387   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), ninetyNinePercentProgress, TEST_LOCATION);
8388
8389   application.SendNotification();
8390   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
8391
8392   // We did expect the animation to finish
8393   application.SendNotification();
8394   finishCheck.CheckSignalReceived();
8395   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8396
8397   // Reset everything
8398   finishCheck.Reset();
8399   actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
8400   application.SendNotification();
8401   application.Render(0);
8402   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8403
8404   // Repeat with a different (ease-in) alpha function
8405   animation = Animation::New(durationSeconds);
8406   animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
8407   animation.FinishedSignal().Connect(&application, finishCheck);
8408   animation.Play();
8409
8410   application.SendNotification();
8411   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
8412
8413   // We didn't expect the animation to finish yet
8414   application.SendNotification();
8415   finishCheck.CheckSignalNotReceived();
8416
8417   // The scale should have grown less, than with a linear alpha function
8418   Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
8419   DALI_TEST_CHECK(current.x > 1.0f);
8420   DALI_TEST_CHECK(current.y > 1.0f);
8421   DALI_TEST_CHECK(current.z > 1.0f);
8422   DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
8423   DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
8424   DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z);
8425
8426   application.SendNotification();
8427   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
8428
8429   // We did expect the animation to finish
8430   application.SendNotification();
8431   finishCheck.CheckSignalReceived();
8432   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8433
8434   // Reset everything
8435   finishCheck.Reset();
8436   actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
8437   application.SendNotification();
8438   application.Render(0);
8439   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8440
8441   // Repeat with a delay
8442   float delay = 0.5f;
8443   animation   = Animation::New(durationSeconds);
8444   animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
8445   animation.FinishedSignal().Connect(&application, finishCheck);
8446   animation.Play();
8447
8448   application.SendNotification();
8449   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
8450
8451   // We didn't expect the animation to finish yet
8452   application.SendNotification();
8453   finishCheck.CheckSignalNotReceived();
8454   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8455
8456   application.SendNotification();
8457   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8458
8459   // We did expect the animation to finish
8460   application.SendNotification();
8461   finishCheck.CheckSignalReceived();
8462   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8463   END_TEST;
8464 }
8465
8466 int UtcDaliAnimationAnimateToActorScaleXP(void)
8467 {
8468   TestApplication application;
8469
8470   Actor actor = Actor::New();
8471   application.GetScene().Add(actor);
8472   float startValue(1.0f);
8473   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, startValue, TEST_LOCATION);
8474   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8475   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8476   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8477   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8478   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8479   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8480
8481   // Build the animation
8482   float     durationSeconds(1.0f);
8483   Animation animation = Animation::New(durationSeconds);
8484   float     targetX(10.0f);
8485   animation.AnimateTo(Property(actor, Actor::Property::SCALE_X), targetX);
8486
8487   float fiftyPercentProgress(startValue + (targetX - startValue) * 0.5f);
8488
8489   // Start the animation
8490   animation.Play();
8491
8492   // Target value should be retrievable straight away
8493   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3(targetX, startValue, startValue), TEST_LOCATION);
8494   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), targetX, TEST_LOCATION);
8495
8496   bool                 signalReceived(false);
8497   AnimationFinishCheck finishCheck(signalReceived);
8498   animation.FinishedSignal().Connect(&application, finishCheck);
8499
8500   application.SendNotification();
8501   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8502
8503   // We didn't expect the animation to finish yet
8504   application.SendNotification();
8505   finishCheck.CheckSignalNotReceived();
8506   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, fiftyPercentProgress, TEST_LOCATION);
8507   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), fiftyPercentProgress, TEST_LOCATION);
8508   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8509   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8510
8511   application.SendNotification();
8512   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8513
8514   // We did expect the animation to finish
8515   application.SendNotification();
8516   finishCheck.CheckSignalReceived();
8517   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, targetX, TEST_LOCATION);
8518   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), targetX, TEST_LOCATION);
8519   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8520   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8521   END_TEST;
8522 }
8523
8524 int UtcDaliAnimationAnimateToActorScaleYP(void)
8525 {
8526   TestApplication application;
8527
8528   Actor actor = Actor::New();
8529   application.GetScene().Add(actor);
8530   float startValue(1.0f);
8531   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, startValue, TEST_LOCATION);
8532   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8533   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8534   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8535   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8536   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8537   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8538
8539   // Build the animation
8540   float     durationSeconds(1.0f);
8541   Animation animation = Animation::New(durationSeconds);
8542   float     targetY(1000.0f);
8543   animation.AnimateTo(Property(actor, Actor::Property::SCALE_Y), targetY);
8544
8545   float fiftyPercentProgress(startValue + (targetY - startValue) * 0.5f);
8546
8547   // Start the animation
8548   animation.Play();
8549
8550   // Target value should be retrievable straight away
8551   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3(startValue, targetY, startValue), TEST_LOCATION);
8552   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), targetY, TEST_LOCATION);
8553
8554   bool                 signalReceived(false);
8555   AnimationFinishCheck finishCheck(signalReceived);
8556   animation.FinishedSignal().Connect(&application, finishCheck);
8557
8558   application.SendNotification();
8559   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8560
8561   // We didn't expect the animation to finish yet
8562   application.SendNotification();
8563   finishCheck.CheckSignalNotReceived();
8564   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, fiftyPercentProgress, TEST_LOCATION);
8565   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8566   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), fiftyPercentProgress, TEST_LOCATION);
8567   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8568
8569   application.SendNotification();
8570   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8571
8572   // We did expect the animation to finish
8573   application.SendNotification();
8574   finishCheck.CheckSignalReceived();
8575   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, targetY, TEST_LOCATION);
8576   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8577   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), targetY, TEST_LOCATION);
8578   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8579   END_TEST;
8580 }
8581
8582 int UtcDaliAnimationAnimateToActorScaleZP(void)
8583 {
8584   TestApplication application;
8585
8586   Actor actor = Actor::New();
8587   application.GetScene().Add(actor);
8588   float startValue(1.0f);
8589   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, startValue, TEST_LOCATION);
8590   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8591   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8592   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8593   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8594   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8595   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8596
8597   // Build the animation
8598   float     durationSeconds(1.0f);
8599   Animation animation = Animation::New(durationSeconds);
8600   float     targetZ(-1000.0f);
8601   animation.AnimateTo(Property(actor, Actor::Property::SCALE_Z), targetZ);
8602
8603   float fiftyPercentProgress(startValue + (targetZ - startValue) * 0.5f);
8604
8605   // Start the animation
8606   animation.Play();
8607
8608   // Target value should be retrievable straight away
8609   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3(startValue, startValue, targetZ), TEST_LOCATION);
8610   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), targetZ, TEST_LOCATION);
8611
8612   bool                 signalReceived(false);
8613   AnimationFinishCheck finishCheck(signalReceived);
8614   animation.FinishedSignal().Connect(&application, finishCheck);
8615
8616   application.SendNotification();
8617   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8618
8619   // We didn't expect the animation to finish yet
8620   application.SendNotification();
8621   finishCheck.CheckSignalNotReceived();
8622   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, fiftyPercentProgress, TEST_LOCATION);
8623   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8624   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8625   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), fiftyPercentProgress, TEST_LOCATION);
8626
8627   application.SendNotification();
8628   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8629
8630   // We did expect the animation to finish
8631   application.SendNotification();
8632   finishCheck.CheckSignalReceived();
8633   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, targetZ, TEST_LOCATION);
8634   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8635   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8636   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), targetZ, TEST_LOCATION);
8637   END_TEST;
8638 }
8639
8640 int UtcDaliAnimationAnimateToActorColorP(void)
8641 {
8642   TestApplication application;
8643
8644   Actor actor = Actor::New();
8645   application.GetScene().Add(actor);
8646   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
8647
8648   // Build the animation
8649   float     durationSeconds(1.0f);
8650   Animation animation = Animation::New(durationSeconds);
8651   Vector4   targetColor(Color::RED);
8652   animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor);
8653
8654   Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
8655   Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
8656
8657   // Start the animation
8658   animation.Play();
8659
8660   // Target value should be retrievable straight away
8661   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8662   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION);
8663   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION);
8664   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION);
8665   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION);
8666   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::OPACITY), targetColor.a, TEST_LOCATION);
8667
8668   bool                 signalReceived(false);
8669   AnimationFinishCheck finishCheck(signalReceived);
8670   animation.FinishedSignal().Connect(&application, finishCheck);
8671
8672   application.SendNotification();
8673   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
8674
8675   // We didn't expect the animation to finish yet
8676   application.SendNotification();
8677   finishCheck.CheckSignalNotReceived();
8678   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), tenPercentProgress, TEST_LOCATION);
8679
8680   application.SendNotification();
8681   application.Render(static_cast<unsigned int>(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/);
8682
8683   // We did expect the animation to finish
8684   application.SendNotification();
8685   finishCheck.CheckSignalReceived();
8686   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8687
8688   // Reset everything
8689   finishCheck.Reset();
8690   actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
8691   application.SendNotification();
8692   application.Render(0);
8693   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
8694
8695   // Repeat with a different (ease-in) alpha function
8696   animation = Animation::New(durationSeconds);
8697   animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
8698   animation.FinishedSignal().Connect(&application, finishCheck);
8699   animation.Play();
8700
8701   application.SendNotification();
8702   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
8703
8704   // We didn't expect the animation to finish yet
8705   application.SendNotification();
8706   finishCheck.CheckSignalNotReceived();
8707
8708   // The color should have changed less, than with a linear alpha function
8709   Vector4 current(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
8710   DALI_TEST_CHECK(current.x == 1.0f); // doesn't change
8711   DALI_TEST_CHECK(current.y < 1.0f);
8712   DALI_TEST_CHECK(current.y > tenPercentProgress.y);
8713   DALI_TEST_CHECK(current.z < 1.0f);
8714   DALI_TEST_CHECK(current.z > tenPercentProgress.z);
8715   DALI_TEST_CHECK(current.w == 1.0f); // doesn't change
8716
8717   application.SendNotification();
8718   application.Render(static_cast<unsigned int>(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/);
8719
8720   // We did expect the animation to finish
8721   application.SendNotification();
8722   finishCheck.CheckSignalReceived();
8723   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8724
8725   // Reset everything
8726   finishCheck.Reset();
8727   actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
8728   application.SendNotification();
8729   application.Render(0);
8730   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
8731
8732   // Repeat with a shorter animator duration
8733   float animatorDuration = 0.5f;
8734   animation              = Animation::New(durationSeconds);
8735   animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
8736   animation.FinishedSignal().Connect(&application, finishCheck);
8737   animation.Play();
8738
8739   application.SendNotification();
8740   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% animation progress, 20% animator progress */);
8741
8742   // We didn't expect the animation to finish yet
8743   application.SendNotification();
8744   finishCheck.CheckSignalNotReceived();
8745   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), twentyPercentProgress, TEST_LOCATION);
8746
8747   application.SendNotification();
8748   application.Render(static_cast<unsigned int>(durationSeconds * 400.0f) /* 50% animation progress, 100% animator progress */);
8749
8750   // We didn't expect the animation to finish yet
8751   application.SendNotification();
8752   finishCheck.CheckSignalNotReceived();
8753   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8754
8755   application.SendNotification();
8756   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8757
8758   // We did expect the animation to finish
8759   application.SendNotification();
8760   finishCheck.CheckSignalReceived();
8761   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8762   END_TEST;
8763 }
8764
8765 int UtcDaliAnimationAnimateToActorColorRedP(void)
8766 {
8767   TestApplication application;
8768
8769   Actor actor = Actor::New();
8770   application.GetScene().Add(actor);
8771   float startValue(1.0f);
8772   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, startValue, TEST_LOCATION);
8773   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8774   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8775   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8776   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8777   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8778   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8779   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8780   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8781
8782   // Build the animation
8783   float     durationSeconds(1.0f);
8784   Animation animation = Animation::New(durationSeconds);
8785   float     targetRed(0.5f);
8786   animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetRed);
8787
8788   float fiftyPercentProgress(startValue + (targetRed - startValue) * 0.5f);
8789
8790   // Start the animation
8791   animation.Play();
8792
8793   // Target value should be retrievable straight away
8794   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(targetRed, startValue, startValue, startValue), TEST_LOCATION);
8795   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetRed, TEST_LOCATION);
8796
8797   bool                 signalReceived(false);
8798   AnimationFinishCheck finishCheck(signalReceived);
8799   animation.FinishedSignal().Connect(&application, finishCheck);
8800
8801   application.SendNotification();
8802   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8803
8804   // We didn't expect the animation to finish yet
8805   application.SendNotification();
8806   finishCheck.CheckSignalNotReceived();
8807   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, fiftyPercentProgress, TEST_LOCATION);
8808   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION);
8809   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8810   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8811   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8812
8813   application.SendNotification();
8814   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8815
8816   // We did expect the animation to finish
8817   application.SendNotification();
8818   finishCheck.CheckSignalReceived();
8819   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, targetRed, TEST_LOCATION);
8820   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), targetRed, TEST_LOCATION);
8821   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8822   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8823   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8824   END_TEST;
8825 }
8826
8827 int UtcDaliAnimationAnimateToActorColorGreenP(void)
8828 {
8829   TestApplication application;
8830
8831   Actor actor = Actor::New();
8832   application.GetScene().Add(actor);
8833   float startValue(1.0f);
8834   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, startValue, TEST_LOCATION);
8835   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8836   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8837   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8838   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8839   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8840   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8841   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8842   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8843
8844   // Build the animation
8845   float     durationSeconds(1.0f);
8846   Animation animation = Animation::New(durationSeconds);
8847   float     targetGreen(0.5f);
8848   animation.AnimateTo(Property(actor, Actor::Property::COLOR_GREEN), targetGreen);
8849
8850   float fiftyPercentProgress(startValue + (targetGreen - startValue) * 0.5f);
8851
8852   // Start the animation
8853   animation.Play();
8854
8855   // Target value should be retrievable straight away
8856   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(startValue, targetGreen, startValue, startValue), TEST_LOCATION);
8857   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION);
8858
8859   bool                 signalReceived(false);
8860   AnimationFinishCheck finishCheck(signalReceived);
8861   animation.FinishedSignal().Connect(&application, finishCheck);
8862
8863   application.SendNotification();
8864   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8865
8866   // We didn't expect the animation to finish yet
8867   application.SendNotification();
8868   finishCheck.CheckSignalNotReceived();
8869   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, fiftyPercentProgress, TEST_LOCATION);
8870   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8871   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION);
8872   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8873   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8874
8875   application.SendNotification();
8876   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8877
8878   // We did expect the animation to finish
8879   application.SendNotification();
8880   finishCheck.CheckSignalReceived();
8881   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, targetGreen, TEST_LOCATION);
8882   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8883   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION);
8884   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8885   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8886   END_TEST;
8887 }
8888
8889 int UtcDaliAnimationAnimateToActorColorBlueP(void)
8890 {
8891   TestApplication application;
8892
8893   Actor actor = Actor::New();
8894   application.GetScene().Add(actor);
8895   float startValue(1.0f);
8896   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, startValue, TEST_LOCATION);
8897   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8898   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8899   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8900   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8901   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8902   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8903   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8904   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8905
8906   // Build the animation
8907   float     durationSeconds(1.0f);
8908   Animation animation = Animation::New(durationSeconds);
8909   float     targetBlue(0.5f);
8910   animation.AnimateTo(Property(actor, Actor::Property::COLOR_BLUE), targetBlue);
8911
8912   float fiftyPercentProgress(startValue + (targetBlue - startValue) * 0.5f);
8913
8914   // Start the animation
8915   animation.Play();
8916
8917   // Target value should be retrievable straight away
8918   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(startValue, startValue, targetBlue, startValue), TEST_LOCATION);
8919   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetBlue, TEST_LOCATION);
8920
8921   bool                 signalReceived(false);
8922   AnimationFinishCheck finishCheck(signalReceived);
8923   animation.FinishedSignal().Connect(&application, finishCheck);
8924
8925   application.SendNotification();
8926   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8927
8928   // We didn't expect the animation to finish yet
8929   application.SendNotification();
8930   finishCheck.CheckSignalNotReceived();
8931   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, fiftyPercentProgress, TEST_LOCATION);
8932   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8933   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8934   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), fiftyPercentProgress, TEST_LOCATION);
8935   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8936
8937   application.SendNotification();
8938   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8939
8940   // We did expect the animation to finish
8941   application.SendNotification();
8942   finishCheck.CheckSignalReceived();
8943   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, targetBlue, TEST_LOCATION);
8944   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8945   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8946   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), targetBlue, TEST_LOCATION);
8947   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8948   END_TEST;
8949 }
8950
8951 int UtcDaliAnimationAnimateToActorColorAlphaP(void)
8952 {
8953   TestApplication application;
8954
8955   Actor actor = Actor::New();
8956   application.GetScene().Add(actor);
8957   float startValue(1.0f);
8958   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
8959   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8960   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8961   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8962   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8963   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8964   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8965   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8966   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8967
8968   // Build the animation
8969   float     durationSeconds(1.0f);
8970   Animation animation = Animation::New(durationSeconds);
8971   float     targetAlpha(0.5f);
8972   animation.AnimateTo(Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha);
8973
8974   float fiftyPercentProgress(startValue + (targetAlpha - startValue) * 0.5f);
8975
8976   // Start the animation
8977   animation.Play();
8978
8979   // Target value should be retrievable straight away
8980   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(startValue, startValue, startValue, targetAlpha), TEST_LOCATION);
8981   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetAlpha, TEST_LOCATION);
8982   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::OPACITY), targetAlpha, TEST_LOCATION);
8983
8984   bool                 signalReceived(false);
8985   AnimationFinishCheck finishCheck(signalReceived);
8986   animation.FinishedSignal().Connect(&application, finishCheck);
8987
8988   application.SendNotification();
8989   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8990
8991   // We didn't expect the animation to finish yet
8992   application.SendNotification();
8993   finishCheck.CheckSignalNotReceived();
8994   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, fiftyPercentProgress, TEST_LOCATION);
8995   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8996   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8997   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8998   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), fiftyPercentProgress, TEST_LOCATION);
8999
9000   application.SendNotification();
9001   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
9002
9003   // We did expect the animation to finish
9004   application.SendNotification();
9005   finishCheck.CheckSignalReceived();
9006   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, targetAlpha, TEST_LOCATION);
9007   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9008   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9009   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9010   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), targetAlpha, TEST_LOCATION);
9011   END_TEST;
9012 }
9013
9014 int UtcDaliAnimationKeyFrames01P(void)
9015 {
9016   TestApplication application;
9017
9018   KeyFrames keyFrames = KeyFrames::New();
9019   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9020
9021   keyFrames.Add(0.0f, 0.1f);
9022
9023   DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
9024
9025   KeyFrames keyFrames2(keyFrames);
9026   DALI_TEST_CHECK(keyFrames2);
9027   DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
9028
9029   KeyFrames keyFrames3 = KeyFrames::New();
9030   keyFrames3.Add(0.6f, true);
9031   DALI_TEST_CHECK(keyFrames3);
9032   DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
9033
9034   keyFrames3 = keyFrames;
9035   DALI_TEST_CHECK(keyFrames3);
9036   DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
9037
9038   END_TEST;
9039 }
9040
9041 int UtcDaliAnimationKeyFrames02N(void)
9042 {
9043   TestApplication application;
9044
9045   KeyFrames keyFrames = KeyFrames::New();
9046   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9047
9048   keyFrames.Add(0.0f, 0.1f);
9049   keyFrames.Add(0.2f, 0.5f);
9050   keyFrames.Add(0.4f, 0.0f);
9051   keyFrames.Add(0.6f, 1.0f);
9052   keyFrames.Add(0.8f, 0.7f);
9053   keyFrames.Add(1.0f, 0.9f);
9054
9055   DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
9056
9057   DALI_TEST_ASSERTION(
9058     {
9059       keyFrames.Add(1.9f, false);
9060     },
9061     "mType == value.GetType()");
9062
9063   END_TEST;
9064 }
9065
9066 int UtcDaliAnimationKeyFrames03N(void)
9067 {
9068   TestApplication application;
9069
9070   KeyFrames keyFrames = KeyFrames::New();
9071   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9072
9073   keyFrames.Add(0.0f, true);
9074   keyFrames.Add(0.2f, false);
9075   keyFrames.Add(0.4f, false);
9076   keyFrames.Add(0.6f, true);
9077   keyFrames.Add(0.8f, true);
9078   keyFrames.Add(1.0f, false);
9079
9080   DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
9081
9082   DALI_TEST_ASSERTION(
9083     {
9084       keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
9085     },
9086     "mType == value.GetType()");
9087
9088   END_TEST;
9089 }
9090
9091 int UtcDaliAnimationKeyFrames04N(void)
9092 {
9093   TestApplication application;
9094
9095   KeyFrames keyFrames = KeyFrames::New();
9096   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9097
9098   keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
9099   keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
9100   keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
9101   keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
9102   keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
9103   keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
9104
9105   DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
9106
9107   DALI_TEST_ASSERTION(
9108     {
9109       keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
9110     },
9111     "mType == value.GetType()");
9112
9113   END_TEST;
9114 }
9115
9116 int UtcDaliAnimationKeyFrames05N(void)
9117 {
9118   TestApplication application;
9119
9120   KeyFrames keyFrames = KeyFrames::New();
9121   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9122
9123   keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
9124   keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
9125   keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
9126   keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
9127   keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
9128   keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
9129
9130   DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
9131
9132   DALI_TEST_ASSERTION(
9133     {
9134       keyFrames.Add(0.7f, 1.0f);
9135     },
9136     "mType == value.GetType()");
9137
9138   END_TEST;
9139 }
9140
9141 int UtcDaliAnimationKeyFrames06N(void)
9142 {
9143   TestApplication application;
9144
9145   KeyFrames keyFrames = KeyFrames::New();
9146   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9147
9148   keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
9149   keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9150   keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
9151   keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
9152   keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
9153   keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
9154
9155   DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
9156
9157   DALI_TEST_ASSERTION(
9158     {
9159       keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
9160     },
9161     "mType == value.GetType()");
9162
9163   END_TEST;
9164 }
9165
9166 int UtcDaliAnimationKeyFrames07N(void)
9167 {
9168   TestApplication application;
9169
9170   KeyFrames keyFrames = KeyFrames::New();
9171   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9172
9173   keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
9174   keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
9175   keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
9176   keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
9177   keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
9178   keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
9179
9180   DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
9181
9182   DALI_TEST_ASSERTION(
9183     {
9184       keyFrames.Add(0.7f, 1.1f);
9185     },
9186     "mType == value.GetType()");
9187
9188   END_TEST;
9189 }
9190
9191 int UtcDaliAnimationKeyFramesGetKeyFrameCountP(void)
9192 {
9193   TestApplication application;
9194
9195   KeyFrames keyFrames = KeyFrames::New();
9196   keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.6f));
9197   keyFrames.Add(0.6f, Vector4(0.0f, 0.0f, 0.0f, 0.3f));
9198   keyFrames.Add(1.0f, Vector4(0.0f, 0.0f, 0.0f, 0.8f));
9199
9200   DALI_TEST_EQUALS(DevelKeyFrames::GetKeyFrameCount(keyFrames), 3, TEST_LOCATION);
9201
9202   END_TEST;
9203 }
9204
9205 int UtcDaliAnimationKeyFramesGetKeyFrameP(void)
9206 {
9207   TestApplication application;
9208
9209   float   inputTime  = 0.6f;
9210   Vector4 inputValue = Vector4(0.0f, 0.0f, 0.0f, 0.3f);
9211
9212   KeyFrames keyFrames = KeyFrames::New();
9213   keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.6f));
9214   keyFrames.Add(inputTime, inputValue);
9215   keyFrames.Add(1.0f, Vector4(0.0f, 0.0f, 0.0f, 0.8f));
9216
9217   float           outputTime;
9218   Property::Value outputValue;
9219
9220   DevelKeyFrames::GetKeyFrame(keyFrames, 3, outputTime, outputValue);
9221
9222   DALI_TEST_EQUALS(outputValue.GetType(), Property::Type::NONE, TEST_LOCATION);
9223
9224   DevelKeyFrames::GetKeyFrame(keyFrames, 1, outputTime, outputValue);
9225
9226   DALI_TEST_EQUALS(outputTime, inputTime, TEST_LOCATION);
9227   DALI_TEST_EQUALS(outputValue.GetType(), Property::Type::VECTOR4, TEST_LOCATION);
9228   DALI_TEST_EQUALS(outputValue.Get<Vector4>(), inputValue, TEST_LOCATION);
9229
9230   END_TEST;
9231 }
9232
9233 int UtcDaliAnimationKeyFramesSetKeyFrameP(void)
9234 {
9235   TestApplication application;
9236
9237   float   inputTime  = 0.6f;
9238   Vector4 inputValue = Vector4(0.0f, 0.0f, 0.0f, 0.3f);
9239
9240   KeyFrames keyFrames = KeyFrames::New();
9241   keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.6f));
9242   keyFrames.Add(inputTime, inputValue);
9243   keyFrames.Add(1.0f, Vector4(0.0f, 0.0f, 0.0f, 0.8f));
9244
9245   float           outputTime;
9246   Property::Value outputValue;
9247
9248   DevelKeyFrames::GetKeyFrame(keyFrames, 3, outputTime, outputValue);
9249
9250   DALI_TEST_EQUALS(outputValue.GetType(), Property::Type::NONE, TEST_LOCATION);
9251
9252   DevelKeyFrames::GetKeyFrame(keyFrames, 1, outputTime, outputValue);
9253
9254   DALI_TEST_EQUALS(outputTime, inputTime, TEST_LOCATION);
9255   DALI_TEST_EQUALS(outputValue.GetType(), Property::Type::VECTOR4, TEST_LOCATION);
9256   DALI_TEST_EQUALS(outputValue.Get<Vector4>(), inputValue, TEST_LOCATION);
9257
9258   Vector4 newValue = Vector4(1.0f, 0.2f, 0.6f, 0.9f);
9259
9260   DevelKeyFrames::SetKeyFrameValue(keyFrames, 1, newValue);
9261
9262   DevelKeyFrames::GetKeyFrame(keyFrames, 1, outputTime, outputValue);
9263
9264   DALI_TEST_EQUALS(outputTime, inputTime, TEST_LOCATION);
9265   DALI_TEST_EQUALS(outputValue.GetType(), Property::Type::VECTOR4, TEST_LOCATION);
9266   DALI_TEST_EQUALS(outputValue.Get<Vector4>(), newValue, TEST_LOCATION);
9267
9268   END_TEST;
9269 }
9270
9271 int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
9272 {
9273   TestApplication application;
9274
9275   float startValue(1.0f);
9276   Actor actor = Actor::New();
9277   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9278   application.GetScene().Add(actor);
9279
9280   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9281   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9282   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9283   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9284   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9285   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9286   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9287   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9288   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9289
9290   // Build the animation
9291   float     durationSeconds(1.0f);
9292   Animation animation = Animation::New(durationSeconds);
9293
9294   KeyFrames keyFrames = KeyFrames::New();
9295   keyFrames.Add(0.0f, 0.1f);
9296   keyFrames.Add(0.2f, 0.5f);
9297   keyFrames.Add(0.4f, 0.0f);
9298   keyFrames.Add(0.6f, 1.0f);
9299   keyFrames.Add(0.8f, 0.7f);
9300   keyFrames.Add(1.0f, 0.9f);
9301
9302   animation.AnimateBetween(Property(actor, Actor::Property::COLOR_ALPHA), keyFrames);
9303
9304   // Start the animation
9305   animation.Play();
9306
9307   // Final key frame value should be retrievable straight away
9308   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, TEST_LOCATION);
9309
9310   bool                 signalReceived(false);
9311   AnimationFinishCheck finishCheck(signalReceived);
9312   animation.FinishedSignal().Connect(&application, finishCheck);
9313   application.SendNotification();
9314   application.Render(0);
9315   application.SendNotification();
9316   finishCheck.CheckSignalNotReceived();
9317   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.1f, TEST_LOCATION);
9318
9319   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
9320   application.SendNotification();
9321   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9322   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9323   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9324   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION);
9325   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.3f, 0.01f, TEST_LOCATION);
9326
9327   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% progress */);
9328   application.SendNotification();
9329   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9330   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9331   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9332   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION);
9333   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.25f, 0.01f, TEST_LOCATION);
9334
9335   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 40% progress */);
9336   application.SendNotification();
9337   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9338   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9339   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9340   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION);
9341   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.0f, 0.01f, TEST_LOCATION);
9342
9343   application.Render(static_cast<unsigned int>(durationSeconds * 400.0f) /* 80% progress */);
9344   application.SendNotification();
9345   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9346   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9347   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9348   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION);
9349   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.7f, 0.01f, TEST_LOCATION);
9350
9351   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 90% progress */);
9352   application.SendNotification();
9353   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9354   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9355   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9356   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION);
9357   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.8f, 0.01f, TEST_LOCATION);
9358
9359   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1 /* 100% progress */);
9360   application.SendNotification();
9361   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9362   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9363   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9364   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION);
9365   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.9f, 0.01f, TEST_LOCATION);
9366
9367   // We did expect the animation to finish
9368
9369   finishCheck.CheckSignalReceived();
9370   END_TEST;
9371 }
9372
9373 int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
9374 {
9375   TestApplication application;
9376
9377   float startValue(1.0f);
9378   Actor actor = Actor::New();
9379   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9380   application.GetScene().Add(actor);
9381
9382   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9383   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9384   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9385   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9386   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9387   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9388   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9389   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9390   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9391
9392   // Build the animation
9393   float     durationSeconds(1.0f);
9394   Animation animation = Animation::New(durationSeconds);
9395
9396   KeyFrames keyFrames = KeyFrames::New();
9397   keyFrames.Add(0.0f, 0.1f);
9398   keyFrames.Add(0.2f, 0.5f);
9399   keyFrames.Add(0.4f, 0.0f);
9400   keyFrames.Add(0.6f, 1.0f);
9401   keyFrames.Add(0.8f, 0.7f);
9402   keyFrames.Add(1.0f, 0.9f);
9403
9404   animation.AnimateBetween(Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::CUBIC);
9405
9406   // Start the animation
9407   animation.Play();
9408
9409   bool                 signalReceived(false);
9410   AnimationFinishCheck finishCheck(signalReceived);
9411   animation.FinishedSignal().Connect(&application, finishCheck);
9412   application.SendNotification();
9413   application.Render(0);
9414   application.SendNotification();
9415   finishCheck.CheckSignalNotReceived();
9416   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.1f, TEST_LOCATION);
9417
9418   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
9419   application.SendNotification();
9420   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9421   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9422   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9423   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.36f, 0.01f, TEST_LOCATION);
9424   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.36f, 0.01f, TEST_LOCATION);
9425
9426   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% progress */);
9427   application.SendNotification();
9428   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9429   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9430   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9431   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.21f, 0.01f, TEST_LOCATION);
9432   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.21f, 0.01f, TEST_LOCATION);
9433
9434   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 40% progress */);
9435   application.SendNotification();
9436   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9437   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9438   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9439   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION);
9440   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.0f, 0.01f, TEST_LOCATION);
9441
9442   application.Render(static_cast<unsigned int>(durationSeconds * 400.0f) /* 80% progress */);
9443   application.SendNotification();
9444   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9445   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9446   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9447   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION);
9448   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.7f, 0.01f, TEST_LOCATION);
9449
9450   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 90% progress */);
9451   application.SendNotification();
9452   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9453   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9454   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9455   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.76f, 0.01f, TEST_LOCATION);
9456   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.76f, 0.01f, TEST_LOCATION);
9457
9458   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1 /* 100% progress */);
9459   application.SendNotification();
9460   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9461   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9462   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9463   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION);
9464   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.9f, 0.01f, TEST_LOCATION);
9465
9466   // We did expect the animation to finish
9467
9468   finishCheck.CheckSignalReceived();
9469   END_TEST;
9470 }
9471
9472 int UtcDaliAnimationAnimateBetweenActorColorP(void)
9473 {
9474   TestApplication application;
9475
9476   float startValue(1.0f);
9477   Actor actor = Actor::New();
9478   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9479   application.GetScene().Add(actor);
9480
9481   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9482   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9483   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9484   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9485   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9486   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9487   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9488   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9489   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9490
9491   // Build the animation
9492   float     durationSeconds(1.0f);
9493   Animation animation = Animation::New(durationSeconds);
9494
9495   KeyFrames keyFrames = KeyFrames::New();
9496   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9497   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9498   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9499
9500   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames);
9501
9502   // Start the animation
9503   animation.Play();
9504
9505   bool                 signalReceived(false);
9506   AnimationFinishCheck finishCheck(signalReceived);
9507   animation.FinishedSignal().Connect(&application, finishCheck);
9508   application.SendNotification();
9509   application.Render(0);
9510   application.SendNotification();
9511   finishCheck.CheckSignalNotReceived();
9512   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
9513   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
9514   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
9515   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
9516
9517   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9518   application.SendNotification();
9519   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
9520   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
9521   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
9522   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
9523
9524   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9525   application.SendNotification();
9526   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
9527   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
9528   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
9529   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
9530
9531   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9532   application.SendNotification();
9533   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
9534   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
9535   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
9536   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
9537
9538   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9539   application.SendNotification();
9540   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
9541   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
9542   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
9543   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
9544
9545   // We did expect the animation to finish
9546
9547   finishCheck.CheckSignalReceived();
9548   END_TEST;
9549 }
9550
9551 int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
9552 {
9553   TestApplication application;
9554
9555   float startValue(1.0f);
9556   Actor actor = Actor::New();
9557   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9558   application.GetScene().Add(actor);
9559
9560   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9561   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9562   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9563   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9564   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9565   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9566   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9567   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9568   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9569
9570   // Build the animation
9571   float     durationSeconds(1.0f);
9572   Animation animation = Animation::New(durationSeconds);
9573
9574   KeyFrames keyFrames = KeyFrames::New();
9575   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9576   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9577   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9578
9579   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, Animation::CUBIC);
9580
9581   // Start the animation
9582   animation.Play();
9583
9584   bool                 signalReceived(false);
9585   AnimationFinishCheck finishCheck(signalReceived);
9586   animation.FinishedSignal().Connect(&application, finishCheck);
9587   application.SendNotification();
9588   application.Render(0);
9589   application.SendNotification();
9590   finishCheck.CheckSignalNotReceived();
9591   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
9592   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
9593   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
9594   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
9595
9596   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9597   application.SendNotification();
9598   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
9599   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
9600   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
9601   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
9602
9603   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9604   application.SendNotification();
9605   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
9606   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
9607   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
9608   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
9609
9610   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9611   application.SendNotification();
9612   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
9613   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
9614   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
9615   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
9616
9617   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9618   application.SendNotification();
9619   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
9620   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
9621   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
9622   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
9623
9624   // We did expect the animation to finish
9625
9626   finishCheck.CheckSignalReceived();
9627   END_TEST;
9628 }
9629
9630 int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
9631 {
9632   TestApplication application;
9633
9634   Actor     actor = Actor::New();
9635   AngleAxis aa(Degree(90), Vector3::XAXIS);
9636   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9637   application.GetScene().Add(actor);
9638
9639   application.SendNotification();
9640   application.Render(0);
9641
9642   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9643
9644   // Build the animation
9645   float     durationSeconds(1.0f);
9646   Animation animation = Animation::New(durationSeconds);
9647
9648   KeyFrames keyFrames = KeyFrames::New();
9649   keyFrames.Add(0.0f, false);
9650   keyFrames.Add(0.2f, true);
9651   keyFrames.Add(0.4f, true);
9652   keyFrames.Add(0.8f, false);
9653   keyFrames.Add(1.0f, true);
9654
9655   animation.AnimateBetween(Property(actor, Actor::Property::VISIBLE), keyFrames);
9656
9657   // Start the animation
9658   animation.Play();
9659
9660   // Final key frame value should be retrievable straight away
9661   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9662
9663   bool                 signalReceived(false);
9664   AnimationFinishCheck finishCheck(signalReceived);
9665   animation.FinishedSignal().Connect(&application, finishCheck);
9666   application.SendNotification();
9667   application.SendNotification();
9668   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9669   application.SendNotification();
9670   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9671   application.SendNotification();
9672
9673   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9674   finishCheck.CheckSignalReceived();
9675   END_TEST;
9676 }
9677
9678 int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
9679 {
9680   TestApplication application;
9681
9682   Actor     actor = Actor::New();
9683   AngleAxis aa(Degree(90), Vector3::XAXIS);
9684   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9685   application.GetScene().Add(actor);
9686
9687   application.SendNotification();
9688   application.Render(0);
9689
9690   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9691
9692   // Build the animation
9693   float     durationSeconds(1.0f);
9694   Animation animation = Animation::New(durationSeconds);
9695
9696   KeyFrames keyFrames = KeyFrames::New();
9697   keyFrames.Add(0.0f, false);
9698   keyFrames.Add(0.2f, true);
9699   keyFrames.Add(0.4f, true);
9700   keyFrames.Add(0.8f, false);
9701   keyFrames.Add(1.0f, true);
9702
9703   //Cubic interpolation for boolean values should be ignored
9704   animation.AnimateBetween(Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::CUBIC);
9705
9706   // Start the animation
9707   animation.Play();
9708
9709   bool                 signalReceived(false);
9710   AnimationFinishCheck finishCheck(signalReceived);
9711   animation.FinishedSignal().Connect(&application, finishCheck);
9712   application.SendNotification();
9713   application.SendNotification();
9714   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9715   application.SendNotification();
9716   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9717   application.SendNotification();
9718
9719   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9720   finishCheck.CheckSignalReceived();
9721   END_TEST;
9722 }
9723
9724 int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
9725 {
9726   TestApplication application;
9727
9728   Actor     actor = Actor::New();
9729   AngleAxis aa(Degree(90), Vector3::XAXIS);
9730   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9731   application.GetScene().Add(actor);
9732
9733   application.SendNotification();
9734   application.Render(0);
9735   Quaternion start(Radian(aa.angle), aa.axis);
9736   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9737
9738   // Build the animation
9739   float     durationSeconds(1.0f);
9740   Animation animation = Animation::New(durationSeconds);
9741
9742   KeyFrames keyFrames = KeyFrames::New();
9743   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9744
9745   animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames);
9746
9747   // Start the animation
9748   animation.Play();
9749
9750   // Final key frame value should be retrievable straight away
9751   DALI_TEST_EQUALS(actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Degree(60), Vector3::ZAXIS), TEST_LOCATION);
9752
9753   bool                 signalReceived(false);
9754   AnimationFinishCheck finishCheck(signalReceived);
9755   animation.FinishedSignal().Connect(&application, finishCheck);
9756   application.SendNotification();
9757   application.SendNotification();
9758   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9759   application.SendNotification();
9760   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9761   application.SendNotification();
9762
9763   Quaternion check(Radian(Degree(60)), Vector3::ZAXIS);
9764
9765   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9766   finishCheck.CheckSignalReceived();
9767   END_TEST;
9768 }
9769
9770 int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
9771 {
9772   TestApplication application;
9773
9774   Actor     actor = Actor::New();
9775   AngleAxis aa(Degree(90), Vector3::XAXIS);
9776   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9777   application.SendNotification();
9778   application.Render(0);
9779   application.GetScene().Add(actor);
9780
9781   Quaternion start(Radian(aa.angle), aa.axis);
9782   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9783
9784   // Build the animation
9785   float     durationSeconds(1.0f);
9786   Animation animation = Animation::New(durationSeconds);
9787
9788   KeyFrames keyFrames = KeyFrames::New();
9789   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9790   keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9791   keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9792
9793   animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames);
9794
9795   // Start the animation
9796   animation.Play();
9797
9798   bool                 signalReceived(false);
9799   AnimationFinishCheck finishCheck(signalReceived);
9800   animation.FinishedSignal().Connect(&application, finishCheck);
9801   application.SendNotification();
9802   application.Render(0);
9803   application.SendNotification();
9804   finishCheck.CheckSignalNotReceived();
9805
9806   Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9807   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9808
9809   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9810   application.SendNotification();
9811   check = Quaternion(Radian(Degree(90)), Vector3::XAXIS);
9812   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9813
9814   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9815   application.SendNotification();
9816   check = Quaternion(Radian(Degree(120)), Vector3::XAXIS);
9817   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9818
9819   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9820   application.SendNotification();
9821   check = Quaternion(Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f));
9822   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9823
9824   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9825   application.SendNotification();
9826   check = Quaternion(Radian(Degree(120)), Vector3::YAXIS);
9827   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9828
9829   // We did expect the animation to finish
9830
9831   finishCheck.CheckSignalReceived();
9832   END_TEST;
9833 }
9834
9835 int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
9836 {
9837   TestApplication application;
9838
9839   Actor     actor = Actor::New();
9840   AngleAxis aa(Degree(90), Vector3::XAXIS);
9841   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9842   application.GetScene().Add(actor);
9843
9844   application.SendNotification();
9845   application.Render(0);
9846   Quaternion start(Radian(aa.angle), aa.axis);
9847   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9848
9849   // Build the animation
9850   float     durationSeconds(1.0f);
9851   Animation animation = Animation::New(durationSeconds);
9852
9853   KeyFrames keyFrames = KeyFrames::New();
9854   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9855
9856   //Cubic interpolation should be ignored for quaternions
9857   animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::CUBIC);
9858
9859   // Start the animation
9860   animation.Play();
9861
9862   bool                 signalReceived(false);
9863   AnimationFinishCheck finishCheck(signalReceived);
9864   animation.FinishedSignal().Connect(&application, finishCheck);
9865   application.SendNotification();
9866   application.SendNotification();
9867   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9868   application.SendNotification();
9869   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9870   application.SendNotification();
9871
9872   Quaternion check(Radian(Degree(60)), Vector3::ZAXIS);
9873
9874   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9875   finishCheck.CheckSignalReceived();
9876   END_TEST;
9877 }
9878
9879 int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
9880 {
9881   TestApplication application;
9882
9883   Actor     actor = Actor::New();
9884   AngleAxis aa(Degree(90), Vector3::XAXIS);
9885   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9886   application.SendNotification();
9887   application.Render(0);
9888   application.GetScene().Add(actor);
9889
9890   Quaternion start(Radian(aa.angle), aa.axis);
9891   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9892
9893   // Build the animation
9894   float     durationSeconds(1.0f);
9895   Animation animation = Animation::New(durationSeconds);
9896
9897   KeyFrames keyFrames = KeyFrames::New();
9898   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9899   keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9900   keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9901
9902   //Cubic interpolation should be ignored for quaternions
9903   animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::CUBIC);
9904
9905   // Start the animation
9906   animation.Play();
9907
9908   bool                 signalReceived(false);
9909   AnimationFinishCheck finishCheck(signalReceived);
9910   animation.FinishedSignal().Connect(&application, finishCheck);
9911   application.SendNotification();
9912   application.Render(0);
9913   application.SendNotification();
9914   finishCheck.CheckSignalNotReceived();
9915
9916   Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9917   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9918
9919   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9920   application.SendNotification();
9921   check = Quaternion(Radian(Degree(90)), Vector3::XAXIS);
9922   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9923
9924   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9925   application.SendNotification();
9926   check = Quaternion(Radian(Degree(120)), Vector3::XAXIS);
9927   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9928
9929   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9930   application.SendNotification();
9931   check = Quaternion(Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f));
9932   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9933
9934   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9935   application.SendNotification();
9936   check = Quaternion(Radian(Degree(120)), Vector3::YAXIS);
9937   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9938
9939   // We did expect the animation to finish
9940
9941   finishCheck.CheckSignalReceived();
9942   END_TEST;
9943 }
9944
9945 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
9946 {
9947   TestApplication application;
9948
9949   float startValue(1.0f);
9950   Actor actor = Actor::New();
9951   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9952   application.GetScene().Add(actor);
9953
9954   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9955   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9956   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9957   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9958   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9959   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9960   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9961   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9962   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9963
9964   // Build the animation
9965   float     durationSeconds(1.0f);
9966   Animation animation = Animation::New(durationSeconds);
9967
9968   KeyFrames keyFrames = KeyFrames::New();
9969   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9970   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9971   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9972
9973   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR);
9974
9975   // Start the animation
9976   animation.Play();
9977
9978   bool                 signalReceived(false);
9979   AnimationFinishCheck finishCheck(signalReceived);
9980   animation.FinishedSignal().Connect(&application, finishCheck);
9981   application.SendNotification();
9982   application.Render(0);
9983   application.SendNotification();
9984   finishCheck.CheckSignalNotReceived();
9985   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
9986   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
9987   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
9988   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
9989
9990   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9991   application.SendNotification();
9992   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
9993   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
9994   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
9995   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
9996
9997   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9998   application.SendNotification();
9999   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10000   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10001   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10002   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10003
10004   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10005   application.SendNotification();
10006   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
10007   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
10008   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
10009   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
10010
10011   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10012   application.SendNotification();
10013   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10014   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10015   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10016   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10017
10018   // We did expect the animation to finish
10019
10020   finishCheck.CheckSignalReceived();
10021   END_TEST;
10022 }
10023
10024 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
10025 {
10026   TestApplication application;
10027
10028   float startValue(1.0f);
10029   Actor actor = Actor::New();
10030   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10031   application.GetScene().Add(actor);
10032
10033   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10034   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10035   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10036   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10037   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10038   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10039   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10040   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10041   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10042
10043   // Build the animation
10044   float     durationSeconds(1.0f);
10045   Animation animation = Animation::New(durationSeconds);
10046
10047   KeyFrames keyFrames = KeyFrames::New();
10048   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10049   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10050   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10051
10052   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::CUBIC);
10053
10054   // Start the animation
10055   animation.Play();
10056
10057   bool                 signalReceived(false);
10058   AnimationFinishCheck finishCheck(signalReceived);
10059   animation.FinishedSignal().Connect(&application, finishCheck);
10060   application.SendNotification();
10061   application.Render(0);
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 * 250.0f) /* 25% progress */);
10070   application.SendNotification();
10071   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
10072   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
10073   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
10074   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
10075
10076   application.Render(static_cast<unsigned int>(durationSeconds * 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 * 250.0f) /* 75% progress */);
10084   application.SendNotification();
10085   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
10086   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
10087   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
10088   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
10089
10090   application.Render(static_cast<unsigned int>(durationSeconds * 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 UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(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));
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.5f, 0.01f, TEST_LOCATION);
10153   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
10154   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
10155   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 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.95f, 0.01f, TEST_LOCATION);
10167   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
10168   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
10169   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 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 UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
10185 {
10186   TestApplication application;
10187
10188   float startValue(1.0f);
10189   Actor actor = Actor::New();
10190   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10191   application.GetScene().Add(actor);
10192
10193   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10194   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10195   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10196   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10197   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10198   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10199   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10200   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10201   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10202
10203   // Build the animation
10204   float     durationSeconds(1.0f);
10205   float     delay     = 0.5f;
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, TimePeriod(delay, durationSeconds - delay), Animation::CUBIC);
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.55f, 0.01f, TEST_LOCATION);
10234   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
10235   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
10236   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 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.99375f, 0.01f, TEST_LOCATION);
10248   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
10249   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
10250   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 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 UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
10266 {
10267   TestApplication application;
10268
10269   float startValue(1.0f);
10270   float delay = 0.5f;
10271   Actor actor = Actor::New();
10272   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10273   application.GetScene().Add(actor);
10274
10275   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10276   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10277   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10278   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10279   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10280   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10281   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10282   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10283   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10284
10285   // Build the animation
10286   float     durationSeconds(1.0f);
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));
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.5f, 0.01f, TEST_LOCATION);
10315   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
10316   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
10317   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 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.95f, 0.01f, TEST_LOCATION);
10329   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
10330   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
10331   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 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 UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void)
10347 {
10348   TestApplication application;
10349
10350   float startValue(1.0f);
10351   Actor actor = Actor::New();
10352   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10353   application.GetScene().Add(actor);
10354
10355   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10356   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10357   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10358   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10359   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10360   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10361   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10362   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10363   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10364
10365   // Build the animation
10366   float     durationSeconds(1.0f);
10367   float     delay     = 0.5f;
10368   Animation animation = Animation::New(durationSeconds);
10369
10370   KeyFrames keyFrames = KeyFrames::New();
10371   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10372   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10373   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10374
10375   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay), Animation::CUBIC);
10376
10377   // Start the animation
10378   animation.Play();
10379
10380   bool                 signalReceived(false);
10381   AnimationFinishCheck finishCheck(signalReceived);
10382   animation.FinishedSignal().Connect(&application, finishCheck);
10383   application.SendNotification();
10384
10385   application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
10386   application.SendNotification();
10387   finishCheck.CheckSignalNotReceived();
10388   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10389   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10390   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10391   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10392
10393   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
10394   application.SendNotification();
10395   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
10396   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
10397   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
10398   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
10399
10400   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
10401   application.SendNotification();
10402   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10403   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10404   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10405   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10406
10407   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
10408   application.SendNotification();
10409   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
10410   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
10411   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
10412   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
10413
10414   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10415   application.SendNotification();
10416   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10417   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10418   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10419   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10420
10421   // We did expect the animation to finish
10422
10423   finishCheck.CheckSignalReceived();
10424   END_TEST;
10425 }
10426
10427 int UtcDaliAnimationAnimateP(void)
10428 {
10429   TestApplication application;
10430
10431   Actor actor = Actor::New();
10432   application.GetScene().Add(actor);
10433
10434   //Build the path
10435   Vector3 position0(30.0, 80.0, 0.0);
10436   Vector3 position1(70.0, 120.0, 0.0);
10437   Vector3 position2(100.0, 100.0, 0.0);
10438
10439   Dali::Path path = Dali::Path::New();
10440   path.AddPoint(position0);
10441   path.AddPoint(position1);
10442   path.AddPoint(position2);
10443
10444   //Control points for first segment
10445   path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10446   path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10447
10448   //Control points for second segment
10449   path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10450   path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10451
10452   // Build the animation
10453   float     durationSeconds(1.0f);
10454   Animation animation = Animation::New(durationSeconds);
10455   animation.Animate(actor, path, Vector3::XAXIS);
10456
10457   // Start the animation
10458   animation.Play();
10459
10460   bool                 signalReceived(false);
10461   AnimationFinishCheck finishCheck(signalReceived);
10462   animation.FinishedSignal().Connect(&application, finishCheck);
10463   application.SendNotification();
10464   application.Render(0);
10465   application.SendNotification();
10466   finishCheck.CheckSignalNotReceived();
10467   Vector3    position, tangent;
10468   Quaternion rotation;
10469   path.Sample(0.0f, position, tangent);
10470   rotation = Quaternion(Vector3::XAXIS, tangent);
10471   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10472   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10473
10474   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10475   application.SendNotification();
10476   path.Sample(0.25f, position, tangent);
10477   rotation = Quaternion(Vector3::XAXIS, tangent);
10478   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10479   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10480
10481   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10482   application.SendNotification();
10483   path.Sample(0.5f, position, tangent);
10484   rotation = Quaternion(Vector3::XAXIS, tangent);
10485   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10486   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10487
10488   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10489   application.SendNotification();
10490   path.Sample(0.75f, position, tangent);
10491   rotation = Quaternion(Vector3::XAXIS, tangent);
10492   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10493   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10494
10495   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10496   application.SendNotification();
10497   path.Sample(1.0f, position, tangent);
10498   rotation = Quaternion(Vector3::XAXIS, tangent);
10499   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10500   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10501
10502   finishCheck.CheckSignalReceived();
10503   END_TEST;
10504 }
10505
10506 int UtcDaliAnimationAnimateAlphaFunctionP(void)
10507 {
10508   TestApplication application;
10509
10510   Actor actor = Actor::New();
10511   application.GetScene().Add(actor);
10512
10513   //Build the path
10514   Vector3 position0(30.0, 80.0, 0.0);
10515   Vector3 position1(70.0, 120.0, 0.0);
10516   Vector3 position2(100.0, 100.0, 0.0);
10517
10518   Dali::Path path = Dali::Path::New();
10519   path.AddPoint(position0);
10520   path.AddPoint(position1);
10521   path.AddPoint(position2);
10522
10523   //Control points for first segment
10524   path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10525   path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10526
10527   //Control points for second segment
10528   path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10529   path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10530
10531   // Build the animation
10532   float     durationSeconds(1.0f);
10533   Animation animation = Animation::New(durationSeconds);
10534   animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
10535
10536   // Start the animation
10537   animation.Play();
10538
10539   bool                 signalReceived(false);
10540   AnimationFinishCheck finishCheck(signalReceived);
10541   animation.FinishedSignal().Connect(&application, finishCheck);
10542   application.SendNotification();
10543   application.Render(0);
10544   application.SendNotification();
10545   finishCheck.CheckSignalNotReceived();
10546   Vector3    position, tangent;
10547   Quaternion rotation;
10548   path.Sample(0.0f, position, tangent);
10549   rotation = Quaternion(Vector3::XAXIS, tangent);
10550   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10551   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10552
10553   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10554   application.SendNotification();
10555   path.Sample(0.25f, position, tangent);
10556   rotation = Quaternion(Vector3::XAXIS, tangent);
10557   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10558   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10559
10560   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10561   application.SendNotification();
10562   path.Sample(0.5f, position, tangent);
10563   rotation = Quaternion(Vector3::XAXIS, tangent);
10564   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10565   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10566
10567   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10568   application.SendNotification();
10569   path.Sample(0.75f, position, tangent);
10570   rotation = Quaternion(Vector3::XAXIS, tangent);
10571   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10572   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10573
10574   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10575   application.SendNotification();
10576   path.Sample(1.0f, position, tangent);
10577   rotation = Quaternion(Vector3::XAXIS, tangent);
10578   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10579   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10580
10581   finishCheck.CheckSignalReceived();
10582   END_TEST;
10583 }
10584
10585 int UtcDaliAnimationAnimateTimePeriodP(void)
10586 {
10587   TestApplication application;
10588
10589   Actor actor = Actor::New();
10590   application.GetScene().Add(actor);
10591
10592   //Build the path
10593   Vector3 position0(30.0, 80.0, 0.0);
10594   Vector3 position1(70.0, 120.0, 0.0);
10595   Vector3 position2(100.0, 100.0, 0.0);
10596
10597   Dali::Path path = Dali::Path::New();
10598   path.AddPoint(position0);
10599   path.AddPoint(position1);
10600   path.AddPoint(position2);
10601
10602   //Control points for first segment
10603   path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10604   path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10605
10606   //Control points for second segment
10607   path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10608   path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10609
10610   // Build the animation
10611   float     durationSeconds(1.0f);
10612   Animation animation = Animation::New(durationSeconds);
10613   animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
10614
10615   // Start the animation
10616   animation.Play();
10617
10618   bool                 signalReceived(false);
10619   AnimationFinishCheck finishCheck(signalReceived);
10620   animation.FinishedSignal().Connect(&application, finishCheck);
10621   application.SendNotification();
10622   application.Render(0);
10623   application.SendNotification();
10624   finishCheck.CheckSignalNotReceived();
10625   Vector3    position, tangent;
10626   Quaternion rotation;
10627   path.Sample(0.0f, position, tangent);
10628   rotation = Quaternion(Vector3::XAXIS, tangent);
10629   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10630   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10631
10632   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10633   application.SendNotification();
10634   path.Sample(0.25f, position, tangent);
10635   rotation = Quaternion(Vector3::XAXIS, tangent);
10636   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10637   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10638
10639   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10640   application.SendNotification();
10641   path.Sample(0.5f, position, tangent);
10642   rotation = Quaternion(Vector3::XAXIS, tangent);
10643   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10644   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10645
10646   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10647   application.SendNotification();
10648   path.Sample(0.75f, position, tangent);
10649   rotation = Quaternion(Vector3::XAXIS, tangent);
10650   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10651   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10652
10653   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10654   application.SendNotification();
10655   path.Sample(1.0f, position, tangent);
10656   rotation = Quaternion(Vector3::XAXIS, tangent);
10657   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10658   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10659
10660   finishCheck.CheckSignalReceived();
10661   END_TEST;
10662 }
10663
10664 int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
10665 {
10666   TestApplication application;
10667
10668   Actor actor = Actor::New();
10669   application.GetScene().Add(actor);
10670
10671   //Build the path
10672   Vector3 position0(30.0, 80.0, 0.0);
10673   Vector3 position1(70.0, 120.0, 0.0);
10674   Vector3 position2(100.0, 100.0, 0.0);
10675
10676   Dali::Path path = Dali::Path::New();
10677   path.AddPoint(position0);
10678   path.AddPoint(position1);
10679   path.AddPoint(position2);
10680
10681   //Control points for first segment
10682   path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10683   path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10684
10685   //Control points for second segment
10686   path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10687   path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10688
10689   // Build the animation
10690   float     durationSeconds(1.0f);
10691   Animation animation = Animation::New(durationSeconds);
10692   animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
10693
10694   // Start the animation
10695   animation.Play();
10696
10697   bool                 signalReceived(false);
10698   AnimationFinishCheck finishCheck(signalReceived);
10699   animation.FinishedSignal().Connect(&application, finishCheck);
10700   application.SendNotification();
10701   application.Render(0);
10702   application.SendNotification();
10703   finishCheck.CheckSignalNotReceived();
10704   Vector3    position, tangent;
10705   Quaternion rotation;
10706   path.Sample(0.0f, position, tangent);
10707   rotation = Quaternion(Vector3::XAXIS, tangent);
10708   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10709   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10710
10711   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10712   application.SendNotification();
10713   path.Sample(0.25f, position, tangent);
10714   rotation = Quaternion(Vector3::XAXIS, tangent);
10715   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10716   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10717
10718   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10719   application.SendNotification();
10720   path.Sample(0.5f, position, tangent);
10721   rotation = Quaternion(Vector3::XAXIS, tangent);
10722   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10723   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10724
10725   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10726   application.SendNotification();
10727   path.Sample(0.75f, position, tangent);
10728   rotation = Quaternion(Vector3::XAXIS, tangent);
10729   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10730   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10731
10732   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10733   application.SendNotification();
10734   path.Sample(1.0f, position, tangent);
10735   rotation = Quaternion(Vector3::XAXIS, tangent);
10736   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10737   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10738
10739   finishCheck.CheckSignalReceived();
10740   END_TEST;
10741 }
10742
10743 int UtcDaliAnimationShowP(void)
10744 {
10745   TestApplication application;
10746
10747   Actor actor = Actor::New();
10748   actor.SetProperty(Actor::Property::VISIBLE, false);
10749   application.SendNotification();
10750   application.Render(0);
10751   DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10752   application.GetScene().Add(actor);
10753
10754   // Start the animation
10755   float     durationSeconds(10.0f);
10756   Animation animation = Animation::New(durationSeconds);
10757   animation.Show(actor, durationSeconds * 0.5f);
10758   animation.Play();
10759
10760   bool                 signalReceived(false);
10761   AnimationFinishCheck finishCheck(signalReceived);
10762   animation.FinishedSignal().Connect(&application, finishCheck);
10763
10764   application.SendNotification();
10765   application.Render(static_cast<unsigned int>(durationSeconds * 490.0f));
10766
10767   // We didn't expect the animation to finish yet
10768   application.SendNotification();
10769   finishCheck.CheckSignalNotReceived();
10770   DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10771
10772   application.SendNotification();
10773   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) /*Should be shown now*/);
10774
10775   // We didn't expect the animation to finish yet
10776   application.SendNotification();
10777   finishCheck.CheckSignalNotReceived();
10778   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10779
10780   application.SendNotification();
10781   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
10782
10783   // We did expect the animation to finish
10784   application.SendNotification();
10785   finishCheck.CheckSignalReceived();
10786   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10787   END_TEST;
10788 }
10789
10790 int UtcDaliAnimationHideP(void)
10791 {
10792   TestApplication application;
10793
10794   Actor actor = Actor::New();
10795   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10796   application.GetScene().Add(actor);
10797
10798   // Start the animation
10799   float     durationSeconds(10.0f);
10800   Animation animation = Animation::New(durationSeconds);
10801   animation.Hide(actor, durationSeconds * 0.5f);
10802   animation.Play();
10803
10804   bool                 signalReceived(false);
10805   AnimationFinishCheck finishCheck(signalReceived);
10806   animation.FinishedSignal().Connect(&application, finishCheck);
10807
10808   application.SendNotification();
10809   application.Render(static_cast<unsigned int>(durationSeconds * 490.0f));
10810
10811   // We didn't expect the animation to finish yet
10812   application.SendNotification();
10813   finishCheck.CheckSignalNotReceived();
10814   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10815
10816   application.SendNotification();
10817   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) /*Should be hidden now*/);
10818
10819   // We didn't expect the animation to finish yet
10820   application.SendNotification();
10821   finishCheck.CheckSignalNotReceived();
10822   DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10823
10824   application.SendNotification();
10825   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
10826
10827   // We did expect the animation to finish
10828   application.SendNotification();
10829   finishCheck.CheckSignalReceived();
10830   DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10831   END_TEST;
10832 }
10833
10834 int UtcDaliAnimationShowHideAtEndP(void)
10835 {
10836   // Test that show/hide delay can be the same as animation duration
10837   // i.e. to show/hide at the end of the animation
10838
10839   TestApplication application;
10840
10841   Actor actor = Actor::New();
10842   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10843   application.GetScene().Add(actor);
10844
10845   // Start Hide animation
10846   float     durationSeconds(10.0f);
10847   Animation animation = Animation::New(durationSeconds);
10848   animation.Hide(actor, durationSeconds /*Hide at end*/);
10849   animation.Play();
10850
10851   bool                 signalReceived(false);
10852   AnimationFinishCheck finishCheck(signalReceived);
10853   animation.FinishedSignal().Connect(&application, finishCheck);
10854
10855   application.SendNotification();
10856   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
10857
10858   // We did expect the animation to finish
10859   application.SendNotification();
10860   finishCheck.CheckSignalReceived();
10861   DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10862
10863   // Start Show animation
10864   animation = Animation::New(durationSeconds);
10865   animation.Show(actor, durationSeconds /*Show at end*/);
10866   animation.FinishedSignal().Connect(&application, finishCheck);
10867   animation.Play();
10868
10869   application.SendNotification();
10870   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
10871
10872   // We did expect the animation to finish
10873   application.SendNotification();
10874   finishCheck.CheckSignalReceived();
10875   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10876   END_TEST;
10877 }
10878
10879 int UtcDaliKeyFramesCreateDestroyP(void)
10880 {
10881   tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
10882
10883   KeyFrames* keyFrames = new KeyFrames;
10884   delete keyFrames;
10885   DALI_TEST_CHECK(true);
10886   END_TEST;
10887 }
10888
10889 int UtcDaliKeyFramesDownCastP(void)
10890 {
10891   TestApplication application;
10892   tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
10893
10894   KeyFrames  keyFrames = KeyFrames::New();
10895   BaseHandle object(keyFrames);
10896
10897   KeyFrames keyFrames2 = KeyFrames::DownCast(object);
10898   DALI_TEST_CHECK(keyFrames2);
10899
10900   KeyFrames keyFrames3 = DownCast<KeyFrames>(object);
10901   DALI_TEST_CHECK(keyFrames3);
10902
10903   BaseHandle unInitializedObject;
10904   KeyFrames  keyFrames4 = KeyFrames::DownCast(unInitializedObject);
10905   DALI_TEST_CHECK(!keyFrames4);
10906
10907   KeyFrames keyFrames5 = DownCast<KeyFrames>(unInitializedObject);
10908   DALI_TEST_CHECK(!keyFrames5);
10909   END_TEST;
10910 }
10911
10912 int UtcDaliAnimationCreateDestroyP(void)
10913 {
10914   TestApplication application;
10915   Animation*      animation = new Animation;
10916   DALI_TEST_CHECK(animation);
10917   delete animation;
10918   END_TEST;
10919 }
10920
10921 struct UpdateManagerTestConstraint
10922 {
10923   UpdateManagerTestConstraint(TestApplication& application)
10924   : mApplication(application)
10925   {
10926   }
10927
10928   void operator()(Vector3& current, const PropertyInputContainer& /* inputs */)
10929   {
10930     mApplication.SendNotification(); // Process events
10931   }
10932
10933   TestApplication& mApplication;
10934 };
10935
10936 int UtcDaliAnimationUpdateManagerP(void)
10937 {
10938   TestApplication application;
10939
10940   Actor actor = Actor::New();
10941   application.GetScene().Add(actor);
10942
10943   // Build the animation
10944   Animation animation = Animation::New(0.0f);
10945
10946   bool                 signalReceived = false;
10947   AnimationFinishCheck finishCheck(signalReceived);
10948   animation.FinishedSignal().Connect(&application, finishCheck);
10949
10950   Vector3         startValue(1.0f, 1.0f, 1.0f);
10951   Property::Index index      = actor.RegisterProperty("testProperty", startValue);
10952   Constraint      constraint = Constraint::New<Vector3>(actor, index, UpdateManagerTestConstraint(application));
10953   constraint.Apply();
10954
10955   // Apply animation to actor
10956   animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(100.f, 90.f, 80.f), AlphaFunction::LINEAR);
10957   animation.AnimateTo(Property(actor, Actor::Property::OPACITY), 0.3f, AlphaFunction::LINEAR);
10958
10959   animation.Play();
10960
10961   application.SendNotification();
10962   application.UpdateOnly(16);
10963
10964   finishCheck.CheckSignalNotReceived();
10965
10966   application.SendNotification(); // Process events
10967
10968   finishCheck.CheckSignalReceived();
10969
10970   END_TEST;
10971 }
10972
10973 int UtcDaliAnimationSignalOrderP(void)
10974 {
10975   TestApplication application;
10976
10977   Actor actor = Actor::New();
10978   application.GetScene().Add(actor);
10979
10980   // Build the animations
10981   Animation animation1 = Animation::New(0.0f);  // finishes first frame
10982   Animation animation2 = Animation::New(0.02f); // finishes in 20 ms
10983
10984   bool signal1Received = false;
10985   animation1.FinishedSignal().Connect(&application, AnimationFinishCheck(signal1Received));
10986
10987   bool signal2Received = false;
10988   animation2.FinishedSignal().Connect(&application, AnimationFinishCheck(signal2Received));
10989
10990   // Apply animations to actor
10991   animation1.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(3.0f, 2.0f, 1.0f), AlphaFunction::LINEAR);
10992   animation1.Play();
10993   animation2.AnimateTo(Property(actor, Actor::Property::SIZE), Vector3(10.0f, 20.0f, 30.0f), AlphaFunction::LINEAR);
10994   animation2.Play();
10995
10996   DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION);
10997   DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION);
10998
10999   application.SendNotification();
11000   application.UpdateOnly(10); // 10ms progress
11001
11002   // no notifications yet
11003   DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION);
11004   DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION);
11005
11006   application.SendNotification();
11007
11008   // first completed
11009   DALI_TEST_EQUALS(signal1Received, true, TEST_LOCATION);
11010   DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION);
11011   signal1Received = false;
11012
11013   // 1st animation is complete now, do another update with no ProcessEvents in between
11014   application.UpdateOnly(20); // 20ms progress
11015
11016   // ProcessEvents
11017   application.SendNotification();
11018
11019   // 2nd should complete now
11020   DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION);
11021   DALI_TEST_EQUALS(signal2Received, true, TEST_LOCATION);
11022
11023   END_TEST;
11024 }
11025
11026 int UtcDaliAnimationExtendDurationP(void)
11027 {
11028   TestApplication application;
11029
11030   Actor actor = Actor::New();
11031
11032   // Register a float property
11033   float           startValue(10.0f);
11034   Property::Index index = actor.RegisterProperty("testProperty", startValue);
11035   application.GetScene().Add(actor);
11036   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
11037   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
11038
11039   // Build the animation
11040   float     initialDurationSeconds(1.0f);
11041   float     animatorDelay = 5.0f;
11042   float     animatorDurationSeconds(5.0f);
11043   float     extendedDurationSeconds(animatorDelay + animatorDurationSeconds);
11044   Animation animation = Animation::New(initialDurationSeconds);
11045   float     targetValue(30.0f);
11046   float     relativeValue(targetValue - startValue);
11047
11048   animation.AnimateTo(Property(actor, index),
11049                       targetValue,
11050                       TimePeriod(animatorDelay, animatorDurationSeconds));
11051
11052   // The duration should have been extended
11053   DALI_TEST_EQUALS(animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION);
11054
11055   // Start the animation
11056   animation.Play();
11057
11058   bool                 signalReceived(false);
11059   AnimationFinishCheck finishCheck(signalReceived);
11060   animation.FinishedSignal().Connect(&application, finishCheck);
11061
11062   application.SendNotification();
11063   application.Render(static_cast<unsigned int>(extendedDurationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
11064
11065   // We didn't expect the animation to finish yet, but cached value should be the final one
11066   application.SendNotification();
11067   finishCheck.CheckSignalNotReceived();
11068   DALI_TEST_EQUALS(actor.GetProperty<float>(index), targetValue, TEST_LOCATION);
11069   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
11070
11071   application.SendNotification();
11072   application.Render(static_cast<unsigned int>(extendedDurationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
11073
11074   // We didn't expect the animation to finish yet
11075   application.SendNotification();
11076   finishCheck.CheckSignalNotReceived();
11077   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
11078
11079   application.SendNotification();
11080   application.Render(static_cast<unsigned int>(extendedDurationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
11081
11082   // We did expect the animation to finish
11083   application.SendNotification();
11084   finishCheck.CheckSignalReceived();
11085   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
11086   DALI_TEST_EQUALS(actor.GetProperty<float>(index), targetValue, TEST_LOCATION);
11087   END_TEST;
11088 }
11089
11090 int UtcDaliAnimationCustomIntProperty(void)
11091 {
11092   TestApplication application;
11093
11094   Actor actor = Actor::New();
11095   application.GetScene().Add(actor);
11096   int startValue(0u);
11097
11098   Property::Index index = actor.RegisterProperty("anIndex", startValue);
11099   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
11100   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11101
11102   // Build the animation
11103   float     durationSeconds(1.0f);
11104   Animation animation = Animation::New(durationSeconds);
11105   animation.AnimateTo(Property(actor, index), 20);
11106
11107   // Start the animation
11108   animation.Play();
11109
11110   // Target value should be retrievable straight away
11111   DALI_TEST_EQUALS(actor.GetProperty<int>(index), 20, TEST_LOCATION);
11112
11113   bool                 signalReceived(false);
11114   AnimationFinishCheck finishCheck(signalReceived);
11115   animation.FinishedSignal().Connect(&application, finishCheck);
11116
11117   application.SendNotification();
11118   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
11119
11120   // We didn't expect the animation to finish yet
11121   application.SendNotification();
11122   finishCheck.CheckSignalNotReceived();
11123   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), 10, TEST_LOCATION);
11124
11125   application.SendNotification();
11126   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
11127
11128   // We did expect the animation to finish
11129   application.SendNotification();
11130   finishCheck.CheckSignalReceived();
11131   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), 20, TEST_LOCATION);
11132   DALI_TEST_EQUALS(actor.GetProperty<int>(index), 20, TEST_LOCATION);
11133   END_TEST;
11134 }
11135
11136 int UtcDaliAnimationDuration(void)
11137 {
11138   TestApplication application;
11139
11140   Actor actor = Actor::New();
11141   application.GetScene().Add(actor);
11142
11143   Animation animation = Animation::New(0.0f);
11144   DALI_TEST_EQUALS(0.0f, animation.GetDuration(), TEST_LOCATION);
11145
11146   // The animation duration should automatically increase depending on the animator time period
11147
11148   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(0.0f, 1.0f));
11149   DALI_TEST_EQUALS(1.0f, animation.GetDuration(), TEST_LOCATION);
11150
11151   animation.AnimateTo(Property(actor, Actor::Property::POSITION_Y), 200.0f, TimePeriod(10.0f, 1.0f));
11152   DALI_TEST_EQUALS(11.0f, animation.GetDuration(), TEST_LOCATION);
11153
11154   END_TEST;
11155 }
11156
11157 int UtcDaliAnimationAnimateByNonAnimateableTypeN(void)
11158 {
11159   TestApplication application;
11160
11161   Actor actor = Actor::New();
11162
11163   // Register an integer property
11164   int             startValue(1);
11165   Property::Index index = actor.RegisterProperty("testProperty", startValue);
11166   application.GetScene().Add(actor);
11167   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11168
11169   DALI_TEST_ASSERTION(
11170     {
11171       // Build the animation
11172       Animation   animation     = Animation::New(2.0f);
11173       std::string relativeValue = "relative string";
11174       animation.AnimateBy(Property(actor, index), relativeValue);
11175       tet_result(TET_FAIL);
11176     },
11177     "Target value is not animatable");
11178
11179   END_TEST;
11180 }
11181
11182 int UtcDaliAnimationAnimateToNonAnimateableTypeN(void)
11183 {
11184   TestApplication application;
11185
11186   Actor actor = Actor::New();
11187
11188   // Register an integer property
11189   int             startValue(1);
11190   Property::Index index = actor.RegisterProperty("testProperty", startValue);
11191   application.GetScene().Add(actor);
11192   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11193
11194   DALI_TEST_ASSERTION(
11195     {
11196       // Build the animation
11197       Animation   animation     = Animation::New(2.0f);
11198       std::string relativeValue = "relative string";
11199       animation.AnimateTo(Property(actor, index), relativeValue);
11200     },
11201     "Target value is not animatable");
11202
11203   END_TEST;
11204 }
11205
11206 int UtcDaliAnimationAnimateBetweenNonAnimateableTypeN(void)
11207 {
11208   TestApplication application;
11209
11210   Actor actor = Actor::New();
11211
11212   // Register an integer property
11213   int             startValue(1);
11214   Property::Index index = actor.RegisterProperty("testProperty", startValue);
11215   application.GetScene().Add(actor);
11216   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11217
11218   DALI_TEST_ASSERTION(
11219     {
11220       // Build the animation
11221       KeyFrames keyFrames = KeyFrames::New();
11222       keyFrames.Add(0.0f, std::string("relative string1"));
11223       keyFrames.Add(1.0f, std::string("relative string2"));
11224       // no need to really create the animation as keyframes do the check
11225     },
11226     "Property type is not animatable");
11227
11228   END_TEST;
11229 }
11230
11231 int UtcDaliAnimationSetAndGetTargetBeforePlayP(void)
11232 {
11233   tet_infoline("Setting up an animation should not effect it's position property until the animation plays");
11234
11235   TestApplication application;
11236
11237   tet_infoline("Set initial position and set up animation to re-position actor");
11238
11239   Actor actor = Actor::New();
11240   application.GetScene().Add(actor);
11241   Vector3 initialPosition(0.0f, 0.0f, 0.0f);
11242   actor.SetProperty(Actor::Property::POSITION, initialPosition);
11243
11244   // Build the animation
11245   Animation animation = Animation::New(2.0f);
11246
11247   //Test GetCurrentProgress return 0.0 as the duration is 0.0
11248   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
11249   DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 0.0f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
11250
11251   tet_infoline("Set target position in animation without intiating play");
11252
11253   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11254   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
11255
11256   application.SendNotification();
11257   application.Render();
11258
11259   tet_infoline("Ensure position of actor is still at intial value");
11260
11261   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION);
11262   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION);
11263   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION);
11264
11265   tet_infoline("Play animation and ensure actor position is now target");
11266
11267   animation.Play();
11268   application.SendNotification();
11269   application.Render(1000u);
11270
11271   tet_infoline("Ensure position of actor is at target value when aninmation half way");
11272
11273   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
11274   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
11275   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
11276
11277   tet_printf("x position at half way point(%f)\n", actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x);
11278
11279   application.Render(2000u);
11280
11281   tet_infoline("Ensure position of actor is still at target value when aninmation complete");
11282
11283   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
11284   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
11285   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
11286
11287   END_TEST;
11288 }
11289
11290 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsPositionP(void)
11291 {
11292   tet_infoline("Setting up an animation should not effect it's position property until the animation plays even with mulitple animators");
11293
11294   TestApplication application;
11295
11296   std::vector<Vector3> targetPositions;
11297
11298   targetPositions.push_back(Vector3(100.0f, 100.0f, 100.0f));
11299   targetPositions.push_back(Vector3(200.0f, 1.0f, 100.0f));
11300   targetPositions.push_back(Vector3(50.0f, 10.0f, 100.0f));
11301
11302   tet_infoline("Set initial position and set up animation to re-position actor");
11303
11304   Actor actor = Actor::New();
11305   application.GetScene().Add(actor);
11306   Vector3 initialPosition(0.0f, 0.0f, 0.0f);
11307   actor.SetProperty(Actor::Property::POSITION, initialPosition);
11308
11309   // Build the animation
11310   Animation animation = Animation::New(2.0f);
11311
11312   //Test GetCurrentProgress return 0.0 as the duration is 0.0
11313   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
11314   DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 0.0f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
11315
11316   tet_infoline("Set target position in animation without intiating play");
11317
11318   for(unsigned int i = 0; i < targetPositions.size(); i++)
11319   {
11320     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[i], AlphaFunction::LINEAR);
11321   }
11322
11323   application.SendNotification();
11324   application.Render();
11325
11326   tet_infoline("Ensure position of actor is still at intial value");
11327
11328   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION);
11329   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION);
11330   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION);
11331
11332   tet_infoline("Play animation and ensure actor position is now target");
11333
11334   animation.Play();
11335   application.SendNotification();
11336   application.Render(1000u);
11337
11338   tet_infoline("Ensure position of actor is at target value when aninmation half way");
11339
11340   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION);
11341   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION);
11342   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION);
11343
11344   tet_printf("x position at half way point(%f)\n", actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x);
11345
11346   application.Render(2000u);
11347
11348   tet_infoline("Ensure position of actor is still at target value when aninmation complete");
11349
11350   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION);
11351   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION);
11352   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION);
11353
11354   END_TEST;
11355 }
11356
11357 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionP(void)
11358 {
11359   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");
11360
11361   TestApplication application;
11362
11363   std::vector<Vector3> targetSizes;
11364   std::vector<Vector3> targetPositions;
11365
11366   targetSizes.push_back(Vector3(100.0f, 100.0f, 100.0f));
11367   targetSizes.push_back(Vector3(50.0f, 10.0f, 100.0f));
11368
11369   targetPositions.push_back(Vector3(200.0f, 1.0f, 100.0f));
11370
11371   tet_infoline("Set initial position and set up animation to re-position actor");
11372
11373   Actor actor = Actor::New();
11374   application.GetScene().Add(actor);
11375   Vector3 initialSize(10.0f, 10.0f, 10.0f);
11376   Vector3 initialPosition(10.0f, 10.0f, 10.0f);
11377
11378   actor.SetProperty(Actor::Property::SIZE, initialSize);
11379   actor.SetProperty(Actor::Property::POSITION, initialPosition);
11380
11381   // Build the animation
11382   Animation animation = Animation::New(2.0f);
11383
11384   tet_infoline("Set target size in animation without intiating play");
11385   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
11386   tet_infoline("Set target position in animation without intiating play");
11387   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[0], AlphaFunction::LINEAR);
11388   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
11389
11390   application.SendNotification();
11391   application.Render();
11392
11393   tet_infoline("Ensure position of actor is still at intial size and position");
11394
11395   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION);
11396   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION);
11397   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION);
11398
11399   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialPosition.x, TEST_LOCATION);
11400   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialPosition.y, TEST_LOCATION);
11401   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialPosition.z, TEST_LOCATION);
11402
11403   tet_infoline("Play animation and ensure actor position and size is now matches targets");
11404
11405   animation.Play();
11406   application.SendNotification();
11407   application.Render(2000u);
11408
11409   tet_infoline("Ensure position and size of actor is at target value when aninmation playing");
11410
11411   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION);
11412   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION);
11413   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION);
11414
11415   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[0].x, TEST_LOCATION);
11416   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[0].y, TEST_LOCATION);
11417   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[0].z, TEST_LOCATION);
11418
11419   END_TEST;
11420 }
11421
11422 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionColourP(void)
11423 {
11424   tet_infoline("Setting up an animation should not effect it's size property until the animation plays even if other Properties animated");
11425
11426   TestApplication application;
11427
11428   std::vector<Vector3> targetSizes;
11429   std::vector<float>   targetColors;
11430
11431   targetSizes.push_back(Vector3(100.0f, 100.0f, 100.0f));
11432   targetSizes.push_back(Vector3(50.0f, 10.0f, 150.0f));
11433
11434   targetColors.push_back(1.0f);
11435
11436   tet_infoline("Set initial position and set up animation to re-position actor");
11437
11438   Actor actor = Actor::New();
11439   application.GetScene().Add(actor);
11440   Vector3 initialSize(10.0f, 5.0f, 10.0f);
11441
11442   actor.SetProperty(Actor::Property::SIZE, initialSize);
11443
11444   // Build the animation
11445   Animation animation = Animation::New(2.0f);
11446
11447   tet_infoline("Set target size in animation without initiating play");
11448   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
11449   tet_infoline("Set target position in animation without intiating play");
11450   animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetColors[0], AlphaFunction::LINEAR);
11451   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
11452
11453   application.SendNotification();
11454   application.Render();
11455
11456   tet_infoline("Ensure position of actor is still at initial size and position");
11457
11458   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION);
11459   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION);
11460   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION);
11461
11462   tet_infoline("Play animation and ensure actor position and size is now matches targets");
11463
11464   animation.Play();
11465   application.SendNotification();
11466   application.Render(2000u);
11467
11468   tet_infoline("Ensure position and size of actor is at target value when animation playing");
11469
11470   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION);
11471   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION);
11472   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION);
11473
11474   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColors[0], TEST_LOCATION);
11475
11476   END_TEST;
11477 }
11478
11479 int UtcDaliAnimationTimePeriodOrder(void)
11480 {
11481   tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place");
11482
11483   TestApplication application;
11484
11485   Actor actor = Actor::New();
11486   application.GetScene().Add(actor);
11487
11488   application.SendNotification();
11489   application.Render();
11490
11491   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11492   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11493   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11494   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11495   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11496
11497   //////////////////////////////////////////////////////////////////////////////////
11498
11499   tet_infoline("With two AnimateTo calls");
11500
11501   Animation animation = Animation::New(0.0f);
11502   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(3.0f, 1.0f));
11503   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(1.0f, 1.0f));
11504   animation.Play();
11505
11506   tet_infoline("The target position should change instantly");
11507   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11508   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11509
11510   application.SendNotification();
11511   application.Render(5000); // After the animation is complete
11512
11513   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11514   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11515   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11516
11517   //////////////////////////////////////////////////////////////////////////////////
11518
11519   tet_infoline("Same animation again but in a different order - should yield the same result");
11520
11521   actor.SetProperty(Actor::Property::POSITION_X, 0.0f);
11522   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11523   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11524
11525   application.SendNotification();
11526   application.Render();
11527
11528   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11529   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11530   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11531
11532   animation = Animation::New(0.0f);
11533   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(1.0f, 1.0f));
11534   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(3.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(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11539   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11540
11541   application.SendNotification();
11542   application.Render(5000); // After the animation is complete
11543
11544   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11545   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11546   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11547
11548   END_TEST;
11549 }
11550
11551 int UtcDaliAnimationTimePeriodOrderSeveralAnimateToCalls(void)
11552 {
11553   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");
11554
11555   TestApplication application;
11556
11557   Actor actor = Actor::New();
11558   application.GetScene().Add(actor);
11559
11560   application.SendNotification();
11561   application.Render();
11562
11563   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11564   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11565   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11566   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11567   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11568
11569   //////////////////////////////////////////////////////////////////////////////////
11570
11571   tet_infoline("");
11572
11573   Animation animation = Animation::New(0.0f);
11574   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1000.0f, TimePeriod(4.0f, 2.0f));
11575   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 145.0f, TimePeriod(3.0f, 10.0f));
11576   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 109.0f, TimePeriod(1.0f, 1.0f));
11577   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1.0f, TimePeriod(3.0f, 4.0f));
11578   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 200.0f, TimePeriod(2.0f, 5.0f));
11579   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(10.0f, 2.0f));
11580   animation.Play();
11581
11582   tet_infoline("The target position should change instantly");
11583   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11584   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11585
11586   application.SendNotification();
11587   application.Render(14000); // After the animation is complete
11588
11589   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11590   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11591   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11592
11593   //////////////////////////////////////////////////////////////////////////////////
11594
11595   tet_infoline("Same animation again but in a different order - should end up at the same point");
11596
11597   actor.SetProperty(Actor::Property::POSITION_X, 0.0f);
11598
11599   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11600   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11601
11602   application.SendNotification();
11603   application.Render();
11604
11605   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11606   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11607   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11608
11609   animation = Animation::New(0.0f);
11610   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 200.0f, TimePeriod(2.0f, 5.0f));
11611   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(10.0f, 2.0f));
11612   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 145.0f, TimePeriod(3.0f, 10.0f));
11613   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1000.0f, TimePeriod(4.0f, 2.0f));
11614   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1.0f, TimePeriod(3.0f, 4.0f));
11615   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 109.0f, TimePeriod(1.0f, 1.0f));
11616   animation.Play();
11617
11618   tet_infoline("The target position should change instantly");
11619   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11620   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11621
11622   application.SendNotification();
11623   application.Render(14000); // After the animation is complete
11624
11625   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11626   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11627   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11628
11629   END_TEST;
11630 }
11631
11632 int UtcDaliAnimationAnimateBetweenIntegerP(void)
11633 {
11634   TestApplication application;
11635
11636   int                   startValue(1);
11637   Actor                 actor = Actor::New();
11638   const Property::Index index = actor.RegisterProperty("customProperty", startValue);
11639   application.GetScene().Add(actor);
11640
11641   application.Render();
11642   application.SendNotification();
11643
11644   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11645
11646   // Build the animation
11647   float     durationSeconds(1.0f);
11648   Animation animation = Animation::New(durationSeconds);
11649
11650   KeyFrames keyFrames = KeyFrames::New();
11651   keyFrames.Add(0.0f, 10);
11652   keyFrames.Add(0.2f, 20);
11653   keyFrames.Add(0.4f, 30);
11654   keyFrames.Add(0.6f, 40);
11655   keyFrames.Add(0.8f, 50);
11656   keyFrames.Add(1.0f, 60);
11657
11658   animation.AnimateBetween(Property(actor, index), keyFrames);
11659
11660   // Start the animation
11661   animation.Play();
11662
11663   // Target value should change to the last key-frame's value straight away
11664   DALI_TEST_EQUALS(actor.GetProperty<int>(index), 60, TEST_LOCATION);
11665
11666   END_TEST;
11667 }
11668
11669 int UtcDaliAnimationAnimateBetweenVector2P(void)
11670 {
11671   TestApplication application;
11672
11673   Vector2               startValue(10.0f, 20.0f);
11674   Actor                 actor = Actor::New();
11675   const Property::Index index = actor.RegisterProperty("customProperty", startValue);
11676   application.GetScene().Add(actor);
11677
11678   application.Render();
11679   application.SendNotification();
11680
11681   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
11682
11683   // Build the animation
11684   float     durationSeconds(1.0f);
11685   Animation animation = Animation::New(durationSeconds);
11686
11687   KeyFrames keyFrames = KeyFrames::New();
11688   keyFrames.Add(0.0f, Vector2(0.0f, 5.0f));
11689   keyFrames.Add(0.2f, Vector2(30.0f, 25.0f));
11690   keyFrames.Add(0.4f, Vector2(40.0f, 35.0f));
11691   keyFrames.Add(0.6f, Vector2(50.0f, 45.0f));
11692   keyFrames.Add(0.8f, Vector2(60.0f, 55.0f));
11693   keyFrames.Add(1.0f, Vector2(70.0f, 65.0f));
11694
11695   animation.AnimateBetween(Property(actor, index), keyFrames);
11696
11697   // Start the animation
11698   animation.Play();
11699
11700   // Target value should change to the last key-frame's value straight away
11701   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), Vector2(70.0f, 65.0f), TEST_LOCATION);
11702
11703   END_TEST;
11704 }
11705
11706 int UtcDaliAnimationProgressCallbackP(void)
11707 {
11708   TestApplication application;
11709
11710   Actor actor = Actor::New();
11711   application.GetScene().Add(actor);
11712
11713   // Build the animation
11714   Animation animation = Animation::New(0.0f);
11715
11716   //Set duration
11717   float durationSeconds(1.0f);
11718   animation.SetDuration(durationSeconds);
11719
11720   bool finishedSignalReceived(false);
11721   bool progressSignalReceived(false);
11722
11723   AnimationFinishCheck finishCheck(finishedSignalReceived);
11724   animation.FinishedSignal().Connect(&application, finishCheck);
11725
11726   AnimationProgressCheck progressCheck(progressSignalReceived);
11727   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
11728   application.SendNotification();
11729
11730   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11731   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
11732
11733   tet_infoline("Animation Progress notification set to 30%");
11734   DevelAnimation::SetProgressNotification(animation, 0.3f);
11735
11736   application.SendNotification();
11737   application.Render();
11738
11739   DALI_TEST_EQUALS(0.3f, DevelAnimation::GetProgressNotification(animation), TEST_LOCATION);
11740
11741   progressCheck.CheckSignalNotReceived();
11742
11743   // Start the animation from 10% progress
11744   animation.SetCurrentProgress(0.1f);
11745   animation.Play();
11746
11747   tet_infoline("Animation Playing from 10%");
11748
11749   application.SendNotification();
11750   application.Render(0);                        // start animation
11751   application.Render(durationSeconds * 100.0f); // 20% progress
11752
11753   tet_infoline("Animation at 20%");
11754
11755   progressCheck.CheckSignalNotReceived();
11756
11757   application.SendNotification();
11758   application.Render(durationSeconds * 200.0f); // 40% progress
11759   application.SendNotification();
11760   tet_infoline("Animation at 40%");
11761   DALI_TEST_EQUALS(0.4f, animation.GetCurrentProgress(), TEST_LOCATION);
11762
11763   progressCheck.CheckSignalReceived();
11764
11765   tet_infoline("Progress check reset");
11766   progressCheck.Reset();
11767
11768   application.Render(durationSeconds * 100.0f); // 50% progress
11769   tet_infoline("Animation at 50%");
11770   application.SendNotification();
11771
11772   DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
11773
11774   progressCheck.CheckSignalNotReceived();
11775
11776   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 60% progress */);
11777   application.SendNotification();
11778
11779   tet_infoline("Animation at 60%");
11780
11781   finishCheck.CheckSignalNotReceived();
11782
11783   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
11784   application.SendNotification();
11785   DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
11786   tet_infoline("Animation at 80%");
11787
11788   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
11789   // We did expect the animation to finish
11790   application.SendNotification();
11791   finishCheck.CheckSignalReceived();
11792   tet_infoline("Animation finished");
11793   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11794
11795   END_TEST;
11796 }
11797
11798 int UtcDaliAnimationPlayAfterP(void)
11799 {
11800   TestApplication application;
11801
11802   tet_printf("Testing that playing after 2 seconds\n");
11803
11804   {
11805     Actor actor = Actor::New();
11806     application.GetScene().Add(actor);
11807
11808     // Build the animation
11809     float     durationSeconds(1.0f);
11810     Animation animation = Animation::New(durationSeconds);
11811
11812     bool                 signalReceived(false);
11813     AnimationFinishCheck finishCheck(signalReceived);
11814     animation.FinishedSignal().Connect(&application, finishCheck);
11815     application.SendNotification();
11816
11817     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11818     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
11819
11820     // Play animation after the initial delay time
11821     animation.PlayAfter(0.2f);
11822     application.SendNotification();
11823     application.Render(0); // start animation
11824
11825     application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
11826     application.SendNotification();
11827     finishCheck.CheckSignalNotReceived();
11828     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move
11829
11830     application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
11831
11832     // We didn't expect the animation to finish yet
11833     application.SendNotification();
11834     finishCheck.CheckSignalNotReceived();
11835     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
11836
11837     application.SendNotification();
11838     application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
11839
11840     application.SendNotification();
11841     finishCheck.CheckSignalNotReceived();
11842     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
11843
11844     application.SendNotification();
11845     application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
11846
11847     // We did expect the animation to finish
11848     application.SendNotification();
11849     finishCheck.CheckSignalReceived();
11850     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11851
11852     // Check that nothing has changed after a couple of buffer swaps
11853     application.Render(0);
11854     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11855   }
11856
11857   tet_printf("Testing that playing after 2 seconds with negative speedfactor\n");
11858   // SpeedFactor < 0
11859   {
11860     Actor actor = Actor::New();
11861     application.GetScene().Add(actor);
11862
11863     // Build the animation
11864     float     durationSeconds(1.0f);
11865     Animation animation = Animation::New(durationSeconds);
11866     animation.SetSpeedFactor(-1.0f); // Set SpeedFactor as < 0
11867
11868     bool                 signalReceived(false);
11869     AnimationFinishCheck finishCheck(signalReceived);
11870     animation.FinishedSignal().Connect(&application, finishCheck);
11871     application.SendNotification();
11872
11873     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11874     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
11875
11876     // Play animation after the initial delay time
11877     animation.PlayAfter(0.2f);
11878     application.SendNotification();
11879     application.Render(0); // start animation
11880
11881     application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
11882     application.SendNotification();
11883     finishCheck.CheckSignalNotReceived();
11884     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 1.0f), TEST_LOCATION); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
11885
11886     application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% animation progress, 50% animator progress */);
11887
11888     // We didn't expect the animation to finish yet
11889     application.SendNotification();
11890     finishCheck.CheckSignalNotReceived();
11891     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
11892
11893     application.SendNotification();
11894     application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% animation progress, 100% animator progress */);
11895
11896     application.SendNotification();
11897     finishCheck.CheckSignalNotReceived();
11898     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION);
11899
11900     application.SendNotification();
11901     application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
11902
11903     // We did expect the animation to finish
11904     application.SendNotification();
11905     finishCheck.CheckSignalReceived();
11906     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of Timeperiod in seconds
11907
11908     // Check that nothing has changed after a couple of buffer swaps
11909     application.Render(0);
11910     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0, 0.0, 0.0), TEST_LOCATION);
11911   }
11912
11913   END_TEST;
11914 }
11915
11916 int UtcDaliAnimationPlayAfterP2(void)
11917 {
11918   TestApplication application;
11919
11920   tet_printf("Testing that playing after 2 seconds before looping\n");
11921
11922   {
11923     Actor actor = Actor::New();
11924     application.GetScene().Add(actor);
11925
11926     // Build the animation
11927     float     durationSeconds(1.0f);
11928     Animation animation = Animation::New(durationSeconds);
11929     animation.SetLooping(true);
11930
11931     bool                 signalReceived(false);
11932     AnimationFinishCheck finishCheck(signalReceived);
11933     animation.FinishedSignal().Connect(&application, finishCheck);
11934     application.SendNotification();
11935
11936     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11937     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
11938
11939     // Play animation after the initial delay time
11940     animation.PlayAfter(0.2f);
11941     application.SendNotification();
11942     application.Render(0); // start animation
11943
11944     for(int iterations = 0; iterations < 3; ++iterations)
11945     {
11946       // The initial delay time of PlayAfter() applies only once in looping mode.
11947       if(iterations == 0)
11948       {
11949         application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
11950         application.SendNotification();
11951         finishCheck.CheckSignalNotReceived();
11952         DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move
11953       }
11954
11955       application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
11956
11957       // We didn't expect the animation to finish yet
11958       application.SendNotification();
11959       finishCheck.CheckSignalNotReceived();
11960       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
11961
11962       application.SendNotification();
11963       application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
11964
11965       application.SendNotification();
11966       finishCheck.CheckSignalNotReceived();
11967       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
11968
11969       application.SendNotification();
11970       application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% progress */);
11971
11972       // We did expect the animation to finish
11973       application.SendNotification();
11974       finishCheck.CheckSignalNotReceived();
11975       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11976     }
11977
11978     animation.SetLooping(false);
11979     application.SendNotification();
11980     application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
11981
11982     application.SendNotification();
11983     finishCheck.CheckSignalReceived();
11984     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11985   }
11986
11987   tet_printf("Testing that playing after 2 seconds before looping with negative speedfactor\n");
11988   // SpeedFactor < 0
11989   {
11990     Actor actor = Actor::New();
11991     application.GetScene().Add(actor);
11992
11993     // Build the animation
11994     float     durationSeconds(1.0f);
11995     Animation animation = Animation::New(durationSeconds);
11996     animation.SetLooping(true);
11997     animation.SetSpeedFactor(-1.0f); //Set SpeedFactor as < 0
11998
11999     bool                 signalReceived(false);
12000     AnimationFinishCheck finishCheck(signalReceived);
12001     animation.FinishedSignal().Connect(&application, finishCheck);
12002     application.SendNotification();
12003
12004     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12005     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
12006
12007     // Play animation after the initial delay time
12008     animation.PlayAfter(0.2f);
12009     application.SendNotification();
12010     application.Render(0); // start animation
12011
12012     for(int iterations = 0; iterations < 3; ++iterations)
12013     {
12014       // The initial delay time of PlayAfter() applies only once in looping mode.
12015       if(iterations == 0)
12016       {
12017         application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
12018         application.SendNotification();
12019         finishCheck.CheckSignalNotReceived();
12020         DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 1.0f), TEST_LOCATION); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
12021       }
12022
12023       application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% animation progress, 50% animator progress */);
12024
12025       // We didn't expect the animation to finish yet
12026       application.SendNotification();
12027       finishCheck.CheckSignalNotReceived();
12028       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
12029
12030       application.SendNotification();
12031       application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% animation progress, 100% animator progress */);
12032
12033       application.SendNotification();
12034       finishCheck.CheckSignalNotReceived();
12035       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION);
12036
12037       application.SendNotification();
12038       application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 100% progress */);
12039
12040       // We did expect the animation to finish
12041       application.SendNotification();
12042       finishCheck.CheckSignalNotReceived();
12043       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in second
12044     }
12045
12046     animation.SetLooping(false);
12047     application.SendNotification();
12048     application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
12049
12050     application.SendNotification();
12051     finishCheck.CheckSignalReceived();
12052     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0, 0.0, 0.0), TEST_LOCATION);
12053   }
12054
12055   END_TEST;
12056 }
12057
12058 int UtcDaliAnimationPlayAfterP3(void)
12059 {
12060   TestApplication application;
12061
12062   tet_printf("Testing that PlayAfter with the negative delay seconds\n");
12063
12064   Actor actor = Actor::New();
12065   application.GetScene().Add(actor);
12066
12067   // Build the animation
12068   float     durationSeconds(1.0f);
12069   Animation animation = Animation::New(durationSeconds);
12070
12071   bool                 signalReceived(false);
12072   AnimationFinishCheck finishCheck(signalReceived);
12073   animation.FinishedSignal().Connect(&application, finishCheck);
12074   application.SendNotification();
12075
12076   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12077   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
12078
12079   // When the delay time is negative value, it would treat as play immediately.
12080   animation.PlayAfter(-2.0f);
12081   application.SendNotification();
12082   application.Render(0); // start animation
12083
12084   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
12085
12086   // We didn't expect the animation to finish yet
12087   application.SendNotification();
12088   finishCheck.CheckSignalNotReceived();
12089   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
12090
12091   application.SendNotification();
12092   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
12093
12094   application.SendNotification();
12095   finishCheck.CheckSignalNotReceived();
12096   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
12097
12098   application.SendNotification();
12099   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
12100
12101   // We did expect the animation to finish
12102   application.SendNotification();
12103   finishCheck.CheckSignalReceived();
12104   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12105
12106   // Check that nothing has changed after a couple of buffer swaps
12107   application.Render(0);
12108   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12109   END_TEST;
12110 }
12111
12112 int UtcDaliAnimationPlayAfterP4(void)
12113 {
12114   TestApplication application;
12115
12116   tet_printf("Testing that PlayAfter with progress value\n");
12117
12118   Actor actor = Actor::New();
12119   application.GetScene().Add(actor);
12120
12121   // Build the animation
12122   float     durationSeconds(1.0f);
12123   Animation animation = Animation::New(durationSeconds);
12124
12125   bool                 signalReceived(false);
12126   AnimationFinishCheck finishCheck(signalReceived);
12127   animation.FinishedSignal().Connect(&application, finishCheck);
12128   application.SendNotification();
12129
12130   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12131   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
12132
12133   // Delay time is 0.3s. So after duration times, progress must be 70%. animation will finished at 1.3s.
12134   animation.PlayAfter(durationSeconds * 0.3f);
12135   application.SendNotification();
12136   application.Render(0); // start animation
12137
12138   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 5/6 delay progress, 0% animation progress, 0% animator progress */);
12139
12140   // We didn't expect the animation to finish yet
12141   application.SendNotification();
12142   finishCheck.CheckSignalNotReceived();
12143   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of PlayAfter
12144
12145   application.SendNotification();
12146   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 20% animation progress, 0% animator progress */);
12147
12148   application.SendNotification();
12149   finishCheck.CheckSignalNotReceived();
12150   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
12151
12152   application.SendNotification();
12153   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 45% animation progress, 0% animator progress */);
12154
12155   application.SendNotification();
12156   finishCheck.CheckSignalNotReceived();
12157   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
12158
12159   application.SendNotification();
12160   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 70% animation progress, 40% animator progress */);
12161
12162   application.SendNotification();
12163   finishCheck.CheckSignalNotReceived();
12164   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION); // 40% of animator progress
12165
12166   application.SendNotification();
12167   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 95% animation progress, 90% animator progress */);
12168
12169   application.SendNotification();
12170   finishCheck.CheckSignalNotReceived();
12171   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.9f), TEST_LOCATION); // 90% of animator progress
12172
12173   application.SendNotification();
12174   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
12175
12176   // We did expect the animation to finish
12177   application.SendNotification();
12178   finishCheck.CheckSignalReceived();
12179   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12180
12181   // Check that nothing has changed after a couple of buffer swaps
12182   application.Render(0);
12183   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12184   END_TEST;
12185 }
12186
12187 int UtcDaliAnimationSetLoopingModeP(void)
12188 {
12189   // Test Loop forever and Loop mode being set
12190   TestApplication    application;
12191   Integration::Scene stage(application.GetScene());
12192
12193   // Default: LoopingMode::RESTART
12194   {
12195     Actor actor = Actor::New();
12196     stage.Add(actor);
12197
12198     float     durationSeconds(1.0f);
12199     Animation animation = Animation::New(durationSeconds);
12200     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::RESTART);
12201
12202     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
12203     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12204
12205     // Start the animation
12206     animation.Play();
12207     application.SendNotification();
12208     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
12209
12210     actor.Unparent();
12211
12212     application.SendNotification();
12213     application.Render();
12214     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12215   }
12216
12217   // LoopingMode::AUTO_REVERSE
12218   {
12219     Actor actor = Actor::New();
12220     stage.Add(actor);
12221
12222     float     durationSeconds(1.0f);
12223     Animation animation = Animation::New(durationSeconds);
12224     animation.SetLooping(true);
12225
12226     bool                 signalReceived(false);
12227     AnimationFinishCheck finishCheck(signalReceived);
12228     animation.FinishedSignal().Connect(&application, finishCheck);
12229     application.SendNotification();
12230
12231     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12232     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12233
12234     animation.SetLoopingMode(Animation::LoopingMode::AUTO_REVERSE);
12235     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12236
12237     // Start the animation
12238     animation.Play();
12239     application.SendNotification();
12240     application.Render(0);
12241
12242     for(int iterations = 0; iterations < 3; ++iterations)
12243     {
12244       application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% time progress */);
12245       application.SendNotification();
12246       finishCheck.CheckSignalNotReceived();
12247
12248       // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12249       // and arrives at the beginning.
12250       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12251
12252       application.SendNotification();
12253       application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 100% time progress */);
12254
12255       // We did expect the animation to finish
12256       application.SendNotification();
12257       finishCheck.CheckSignalNotReceived();
12258       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12259     }
12260
12261     animation.SetLooping(false);
12262     application.SendNotification();
12263     application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
12264
12265     application.SendNotification();
12266     finishCheck.CheckSignalReceived();
12267
12268     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12269   }
12270
12271   // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12272   {
12273     Actor actor = Actor::New();
12274     stage.Add(actor);
12275
12276     float     durationSeconds(1.0f);
12277     Animation animation = Animation::New(durationSeconds);
12278     animation.SetLooping(true);
12279
12280     bool                 signalReceived(false);
12281     AnimationFinishCheck finishCheck(signalReceived);
12282     animation.FinishedSignal().Connect(&application, finishCheck);
12283     application.SendNotification();
12284
12285     // Specify a negative multiplier to play the animation in reverse
12286     animation.SetSpeedFactor(-1.0f);
12287
12288     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12289     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12290
12291     animation.SetLoopingMode(Animation::AUTO_REVERSE);
12292     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12293
12294     // Start the animation
12295     animation.Play();
12296     application.SendNotification();
12297     application.Render(0);
12298
12299     for(int iterations = 0; iterations < 3; ++iterations)
12300     {
12301       application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% time progress */);
12302       application.SendNotification();
12303       finishCheck.CheckSignalNotReceived();
12304
12305       // Setting a negative speed factor is to play the animation in reverse.
12306       // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12307       // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12308       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12309
12310       application.SendNotification();
12311       application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 100% time progress */);
12312
12313       // We did expect the animation to finish
12314       application.SendNotification();
12315       finishCheck.CheckSignalNotReceived();
12316       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12317     }
12318
12319     animation.SetLooping(false);
12320     application.SendNotification();
12321     application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
12322
12323     application.SendNotification();
12324     finishCheck.CheckSignalReceived();
12325
12326     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12327   }
12328
12329   END_TEST;
12330 }
12331
12332 int UtcDaliAnimationSetLoopingModeP2(void)
12333 {
12334   // Test Loop Count and Loop mode being set
12335   TestApplication    application;
12336   Integration::Scene stage(application.GetScene());
12337
12338   // LoopingMode::AUTO_REVERSE
12339   {
12340     Actor actor = Actor::New();
12341     stage.Add(actor);
12342
12343     float     durationSeconds(1.0f);
12344     Animation animation = Animation::New(durationSeconds);
12345     animation.SetLoopCount(3);
12346     DALI_TEST_CHECK(animation.IsLooping());
12347
12348     bool                 signalReceived(false);
12349     AnimationFinishCheck finishCheck(signalReceived);
12350     animation.FinishedSignal().Connect(&application, finishCheck);
12351     application.SendNotification();
12352
12353     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12354     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12355
12356     animation.SetLoopingMode(Animation::AUTO_REVERSE);
12357     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12358
12359     // Start the animation
12360     animation.Play();
12361
12362     application.Render(0);
12363     application.SendNotification();
12364     application.Render(0);
12365     application.SendNotification();
12366     application.Render(0);
12367     application.SendNotification();
12368     application.Render(0);
12369     application.SendNotification();
12370
12371     // Loop
12372     float intervalSeconds = 3.0f;
12373
12374     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12375     // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12376     // and arrives at the beginning.
12377     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12378
12379     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12380
12381     application.Render(0);
12382     application.SendNotification();
12383     application.Render(0);
12384     application.SendNotification();
12385     application.Render(0);
12386     application.SendNotification();
12387     application.Render(0);
12388     application.SendNotification();
12389     finishCheck.CheckSignalNotReceived();
12390
12391     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12392
12393     application.SendNotification();
12394     finishCheck.CheckSignalReceived();
12395     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12396
12397     finishCheck.Reset();
12398   }
12399
12400   // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12401   {
12402     Actor actor = Actor::New();
12403     stage.Add(actor);
12404
12405     float     durationSeconds(1.0f);
12406     Animation animation = Animation::New(durationSeconds);
12407     animation.SetLoopCount(3);
12408     DALI_TEST_CHECK(animation.IsLooping());
12409
12410     bool                 signalReceived(false);
12411     AnimationFinishCheck finishCheck(signalReceived);
12412     animation.FinishedSignal().Connect(&application, finishCheck);
12413     application.SendNotification();
12414
12415     // Specify a negative multiplier to play the animation in reverse
12416     animation.SetSpeedFactor(-1.0f);
12417
12418     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12419     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12420
12421     animation.SetLoopingMode(Animation::AUTO_REVERSE);
12422     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12423
12424     // Start the animation
12425     animation.Play();
12426
12427     application.Render(0);
12428     application.SendNotification();
12429     application.Render(0);
12430     application.SendNotification();
12431     application.Render(0);
12432     application.SendNotification();
12433     application.Render(0);
12434     application.SendNotification();
12435
12436     // Loop
12437     float intervalSeconds = 3.0f;
12438
12439     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12440     // Setting a negative speed factor is to play the animation in reverse.
12441     // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12442     // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12443     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12444
12445     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12446
12447     application.Render(0);
12448     application.SendNotification();
12449     application.Render(0);
12450     application.SendNotification();
12451     application.Render(0);
12452     application.SendNotification();
12453     application.Render(0);
12454     application.SendNotification();
12455     finishCheck.CheckSignalNotReceived();
12456
12457     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12458
12459     application.SendNotification();
12460     finishCheck.CheckSignalReceived();
12461     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12462
12463     finishCheck.Reset();
12464   }
12465
12466   END_TEST;
12467 }
12468
12469 int UtcDaliAnimationSetLoopingModeP3(void)
12470 {
12471   // Test Loop Count is 1 (== default) and Loop mode being set
12472   TestApplication    application;
12473   Integration::Scene stage(application.GetScene());
12474
12475   // LoopingMode::AUTO_REVERSE
12476   {
12477     Actor actor = Actor::New();
12478     stage.Add(actor);
12479
12480     float     durationSeconds(1.0f);
12481     Animation animation = Animation::New(durationSeconds);
12482     DALI_TEST_CHECK(1 == animation.GetLoopCount());
12483
12484     bool                 signalReceived(false);
12485     AnimationFinishCheck finishCheck(signalReceived);
12486     animation.FinishedSignal().Connect(&application, finishCheck);
12487     application.SendNotification();
12488
12489     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12490     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12491
12492     animation.SetLoopingMode(Animation::AUTO_REVERSE);
12493     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12494
12495     // Start the animation
12496     animation.Play();
12497     application.Render(0);
12498     application.SendNotification();
12499
12500     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 50% time progress */);
12501     application.SendNotification();
12502     finishCheck.CheckSignalNotReceived();
12503
12504     // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12505     // and arrives at the beginning.
12506     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12507
12508     application.SendNotification();
12509     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 100% time progress */);
12510
12511     application.SendNotification();
12512     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12513
12514     application.SendNotification();
12515     application.Render(static_cast<unsigned int>(durationSeconds * 1.0f * 1000.0f) + 1u /*just beyond the animation duration*/);
12516
12517     application.SendNotification();
12518     application.Render(0);
12519     application.SendNotification();
12520     finishCheck.CheckSignalReceived();
12521
12522     // After all animation finished, arrives at the beginning.
12523     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12524
12525     finishCheck.Reset();
12526   }
12527
12528   // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12529   {
12530     Actor actor = Actor::New();
12531     stage.Add(actor);
12532
12533     float     durationSeconds(1.0f);
12534     Animation animation = Animation::New(durationSeconds);
12535     DALI_TEST_CHECK(1 == animation.GetLoopCount());
12536
12537     bool                 signalReceived(false);
12538     AnimationFinishCheck finishCheck(signalReceived);
12539     animation.FinishedSignal().Connect(&application, finishCheck);
12540     application.SendNotification();
12541
12542     // Specify a negative multiplier to play the animation in reverse
12543     animation.SetSpeedFactor(-1.0f);
12544
12545     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12546     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12547
12548     animation.SetLoopingMode(Animation::AUTO_REVERSE);
12549     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12550
12551     // Start the animation
12552     animation.Play();
12553     application.Render(0);
12554     application.SendNotification();
12555
12556     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 50% time progress */);
12557     application.SendNotification();
12558     finishCheck.CheckSignalNotReceived();
12559
12560     // Setting a negative speed factor is to play the animation in reverse.
12561     // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12562     // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12563     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12564
12565     application.SendNotification();
12566     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 100% time progress */);
12567
12568     application.SendNotification();
12569     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12570
12571     application.SendNotification();
12572     application.Render(static_cast<unsigned int>(durationSeconds * 1.0f * 1000.0f) + 1u /*just beyond the animation duration*/);
12573
12574     application.SendNotification();
12575     application.Render(0);
12576     application.SendNotification();
12577     finishCheck.CheckSignalReceived();
12578
12579     // After all animation finished, arrives at the target.
12580     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12581
12582     finishCheck.Reset();
12583   }
12584
12585   END_TEST;
12586 }
12587
12588 int UtcDaliAnimationGetLoopingModeP(void)
12589 {
12590   TestApplication application;
12591
12592   Animation animation = Animation::New(1.0f);
12593
12594   // default mode
12595   DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::RESTART);
12596
12597   animation.SetLoopingMode(Animation::AUTO_REVERSE);
12598   DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12599
12600   END_TEST;
12601 }
12602
12603 int UtcDaliAnimationProgressSignalConnectionWithoutProgressMarkerP(void)
12604 {
12605   TestApplication application;
12606
12607   tet_infoline("Connect to ProgressReachedSignal but do not set a required Progress marker");
12608
12609   Actor actor = Actor::New();
12610   application.GetScene().Add(actor);
12611
12612   // Build the animation
12613   Animation animation = Animation::New(0.0f);
12614
12615   //Set duration
12616   float durationSeconds(1.0f);
12617   animation.SetDuration(durationSeconds);
12618
12619   bool finishedSignalReceived(false);
12620   bool progressSignalReceived(false);
12621
12622   AnimationFinishCheck finishCheck(finishedSignalReceived);
12623   animation.FinishedSignal().Connect(&application, finishCheck);
12624
12625   AnimationProgressCheck progressCheck(progressSignalReceived);
12626   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
12627   application.SendNotification();
12628
12629   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12630   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12631
12632   progressCheck.CheckSignalNotReceived();
12633
12634   animation.Play();
12635
12636   application.SendNotification();
12637   application.Render(0);                        // start animation
12638   application.Render(durationSeconds * 100.0f); // 10% progress
12639   application.SendNotification();
12640
12641   tet_infoline("Ensure after animation has started playing that ProgressReachedSignal not emitted");
12642   progressCheck.CheckSignalNotReceived();
12643
12644   application.Render(static_cast<unsigned int>(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/);
12645
12646   application.SendNotification();
12647   finishCheck.CheckSignalReceived();
12648   tet_infoline("Animation finished");
12649   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12650
12651   END_TEST;
12652 }
12653
12654 int UtcDaliAnimationMultipleProgressSignalsP(void)
12655 {
12656   tet_infoline("Multiple animations with different progress markers");
12657
12658   TestApplication application;
12659
12660   Actor actor = Actor::New();
12661   application.GetScene().Add(actor);
12662
12663   // Build the animation
12664   Animation animationAlpha = Animation::New(0.0f);
12665   Animation animationBeta  = Animation::New(0.0f);
12666
12667   //Set duration
12668   float durationSeconds(1.0f);
12669   animationAlpha.SetDuration(durationSeconds);
12670   animationBeta.SetDuration(durationSeconds);
12671
12672   bool progressSignalReceivedAlpha(false);
12673   bool progressSignalReceivedBeta(false);
12674
12675   AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12676   AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta");
12677
12678   DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha);
12679   DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta);
12680   application.SendNotification();
12681
12682   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12683   animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12684   animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12685
12686   tet_infoline("AnimationAlpha Progress notification set to 30%");
12687   DevelAnimation::SetProgressNotification(animationAlpha, 0.3f);
12688
12689   tet_infoline("AnimationBeta Progress notification set to 50%");
12690   DevelAnimation::SetProgressNotification(animationBeta, 0.5f);
12691
12692   application.SendNotification();
12693   application.Render();
12694
12695   progressCheckAlpha.CheckSignalNotReceived();
12696   progressCheckBeta.CheckSignalNotReceived();
12697
12698   // Start the animations from 10% progress
12699   animationAlpha.SetCurrentProgress(0.1f);
12700   animationBeta.SetCurrentProgress(0.1f);
12701   animationAlpha.Play();
12702   animationBeta.Play();
12703
12704   tet_infoline("Animation Playing from 10%");
12705
12706   application.SendNotification();
12707   application.Render(0);                        // start animation
12708   application.Render(durationSeconds * 100.0f); // 20% progress
12709
12710   tet_infoline("Animation at 20% - No signals to be received");
12711
12712   progressCheckAlpha.CheckSignalNotReceived();
12713   progressCheckBeta.CheckSignalNotReceived();
12714
12715   application.SendNotification();
12716   application.Render(durationSeconds * 200.0f); // 40% progress
12717   application.SendNotification();
12718   tet_infoline("Animation at 40% - Alpha signal should be received");
12719   DALI_TEST_EQUALS(0.4f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
12720
12721   progressCheckAlpha.CheckSignalReceived();
12722   progressCheckBeta.CheckSignalNotReceived();
12723
12724   tet_infoline("Progress check reset");
12725   progressCheckAlpha.Reset();
12726   progressCheckBeta.Reset();
12727
12728   application.Render(durationSeconds * 100.0f); // 50% progress
12729   tet_infoline("Animation at 50% - Beta should receive signal, Alpha should not");
12730   application.SendNotification();
12731
12732   DALI_TEST_EQUALS(0.5f, animationBeta.GetCurrentProgress(), TEST_LOCATION);
12733
12734   progressCheckAlpha.CheckSignalNotReceived();
12735   progressCheckBeta.CheckSignalReceived();
12736   tet_infoline("Progress check reset");
12737   progressCheckAlpha.Reset();
12738   progressCheckBeta.Reset();
12739
12740   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 60% progress */);
12741   application.SendNotification();
12742
12743   tet_infoline("Animation at 60%");
12744
12745   progressCheckAlpha.CheckSignalNotReceived();
12746   progressCheckBeta.CheckSignalNotReceived();
12747
12748   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
12749   application.SendNotification();
12750   tet_infoline("Animation at 80%");
12751
12752   progressCheckAlpha.CheckSignalNotReceived();
12753   progressCheckBeta.CheckSignalNotReceived();
12754
12755   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
12756   // We did expect the animation to finish
12757   tet_infoline("Animation finished");
12758
12759   END_TEST;
12760 }
12761
12762 int UtcDaliAnimationMultipleProgressSignalsP2(void)
12763 {
12764   tet_infoline("Multiple animations with different progress markers and big step time");
12765
12766   TestApplication application;
12767
12768   Actor actor = Actor::New();
12769   application.GetScene().Add(actor);
12770
12771   // Build the animation
12772   Animation animationAlpha = Animation::New(0.0f);
12773   Animation animationBeta  = Animation::New(0.0f);
12774
12775   //Set duration
12776   const float durationSeconds(1.0f);
12777   animationAlpha.SetDuration(durationSeconds);
12778   animationBeta.SetDuration(durationSeconds);
12779
12780   bool progressSignalReceivedAlpha(false);
12781   bool progressSignalReceivedBeta(false);
12782
12783   AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12784   AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta");
12785
12786   DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha);
12787   DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta);
12788   application.SendNotification();
12789
12790   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12791   animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12792   animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12793
12794   tet_infoline("AnimationAlpha Progress notification set to 1%");
12795   DevelAnimation::SetProgressNotification(animationAlpha, 0.01f);
12796
12797   tet_infoline("AnimationBeta Progress notification set to 99%");
12798   DevelAnimation::SetProgressNotification(animationBeta, 0.99f);
12799
12800   application.SendNotification();
12801   application.Render();
12802
12803   progressCheckAlpha.CheckSignalNotReceived();
12804   progressCheckBeta.CheckSignalNotReceived();
12805
12806   // Start the animations unlimited looping
12807   animationAlpha.SetLooping(true);
12808   animationBeta.SetLooping(true);
12809   animationAlpha.Play();
12810   animationBeta.Play();
12811
12812   application.SendNotification();
12813   application.Render(0);                       // start animation
12814   application.Render(durationSeconds * 20.0f); // 2% progress
12815   application.SendNotification();
12816   DALI_TEST_EQUALS(0.02f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
12817
12818   tet_infoline("Animation at 2% - Alpha signals should be received, Beta should not.");
12819
12820   progressCheckAlpha.CheckSignalReceived();
12821   progressCheckBeta.CheckSignalNotReceived();
12822
12823   tet_infoline("Progress check reset");
12824   progressCheckAlpha.Reset();
12825   progressCheckBeta.Reset();
12826
12827   application.SendNotification();
12828   application.Render(durationSeconds * 960.0f); // 98% progress
12829   application.SendNotification();
12830   tet_infoline("Animation at 98% - No signal received");
12831   DALI_TEST_EQUALS(0.98f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
12832
12833   progressCheckAlpha.CheckSignalNotReceived();
12834   progressCheckBeta.CheckSignalNotReceived();
12835
12836   application.SendNotification();
12837   application.Render(durationSeconds * 40.0f); // 2% progress
12838   application.SendNotification();
12839   tet_infoline("Animation loop once and now 2% - Alpha and Beta should receive signal");
12840   application.SendNotification();
12841
12842   DALI_TEST_EQUALS(0.02f, animationBeta.GetCurrentProgress(), TEST_LOCATION);
12843
12844   progressCheckAlpha.CheckSignalReceived();
12845   progressCheckBeta.CheckSignalReceived();
12846
12847   tet_infoline("Progress check reset");
12848   progressCheckAlpha.Reset();
12849   progressCheckBeta.Reset();
12850
12851   application.SendNotification();
12852   application.Render(durationSeconds * 980.0f); // 100% progress
12853   application.SendNotification();
12854   tet_infoline("Animation loop one more time. and now 100% - Beta should receive signal, Alhpa sholud not");
12855   application.SendNotification();
12856
12857   progressCheckAlpha.CheckSignalNotReceived();
12858   progressCheckBeta.CheckSignalReceived();
12859
12860   tet_infoline("Progress check reset");
12861   progressCheckAlpha.Reset();
12862   progressCheckBeta.Reset();
12863
12864   animationAlpha.SetLooping(false);
12865   animationBeta.SetLooping(false);
12866
12867   application.SendNotification();
12868   application.Render(static_cast<unsigned int>(durationSeconds * 2000.0f) + 1u /*just beyond the animation duration*/);
12869   application.SendNotification();
12870
12871   // We did expect the animation to finish
12872   tet_infoline("Animation finished");
12873
12874   END_TEST;
12875 }
12876
12877 int UtcDaliAnimationProgressSignalWithPlayAfterP(void)
12878 {
12879   tet_infoline("Multiple animations with different progress markers");
12880
12881   TestApplication application;
12882
12883   Actor actor = Actor::New();
12884   application.GetScene().Add(actor);
12885
12886   // Build the animation
12887   Animation animationAlpha = Animation::New(0.0f);
12888   Animation animationBeta  = Animation::New(0.0f);
12889
12890   //Set duration
12891   float durationSeconds(1.0f);
12892   float delaySeconds(0.5f);
12893   animationAlpha.SetDuration(durationSeconds);
12894   animationBeta.SetDuration(durationSeconds);
12895
12896   bool progressSignalReceivedAlpha(false);
12897   bool progressSignalReceivedBeta(false);
12898
12899   AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12900   AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta");
12901
12902   DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha);
12903   DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta);
12904   application.SendNotification();
12905
12906   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12907   animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12908   animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12909
12910   tet_infoline("AnimationAlpha Progress notification set to 30%");
12911   DevelAnimation::SetProgressNotification(animationAlpha, 0.3f);
12912
12913   tet_infoline("AnimationBeta Progress notification set to ~0% (==Notify when delay is done)");
12914   DevelAnimation::SetProgressNotification(animationBeta, Math::MACHINE_EPSILON_1);
12915
12916   application.SendNotification();
12917   application.Render();
12918
12919   progressCheckAlpha.CheckSignalNotReceived();
12920   progressCheckBeta.CheckSignalNotReceived();
12921
12922   // Start the animations from 10% progress
12923   animationAlpha.PlayAfter(delaySeconds);
12924   animationBeta.PlayAfter(delaySeconds);
12925
12926   application.SendNotification();
12927   application.Render(0);                     // start animation
12928   application.Render(delaySeconds * 500.0f); // 50% wait progress
12929
12930   tet_infoline("Delay at 50% - No signals to be received");
12931
12932   progressCheckAlpha.CheckSignalNotReceived();
12933   progressCheckBeta.CheckSignalNotReceived();
12934
12935   application.SendNotification();
12936   application.Render(delaySeconds * 500.0f + durationSeconds * 50.0f); // 100% wait, 5% progress
12937   application.SendNotification();
12938   tet_infoline("Delay at 100%, Animation at 5% - Beta signal should be received");
12939   DALI_TEST_EQUALS(0.05f, animationBeta.GetCurrentProgress(), TEST_LOCATION);
12940
12941   progressCheckBeta.CheckSignalReceived();
12942   progressCheckAlpha.CheckSignalNotReceived();
12943
12944   tet_infoline("Progress check reset");
12945   progressCheckAlpha.Reset();
12946   progressCheckBeta.Reset();
12947
12948   application.Render(durationSeconds * 200.0f); // 25% progress
12949   tet_infoline("Animation at 25% - No signals to be received");
12950   application.SendNotification();
12951
12952   progressCheckAlpha.CheckSignalNotReceived();
12953   progressCheckBeta.CheckSignalNotReceived();
12954
12955   application.Render(durationSeconds * 200.0f); // 45% progress
12956   tet_infoline("Animation at 45% - Alpha should receive signal, Beta should not");
12957   application.SendNotification();
12958
12959   DALI_TEST_EQUALS(0.45f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
12960
12961   progressCheckAlpha.CheckSignalReceived();
12962   progressCheckBeta.CheckSignalNotReceived();
12963
12964   tet_infoline("Progress check reset");
12965   progressCheckAlpha.Reset();
12966   progressCheckBeta.Reset();
12967
12968   application.Render(static_cast<unsigned int>(durationSeconds * 150.0f) /* 60% progress */);
12969   application.SendNotification();
12970
12971   tet_infoline("Animation at 60%");
12972
12973   progressCheckAlpha.CheckSignalNotReceived();
12974   progressCheckBeta.CheckSignalNotReceived();
12975
12976   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
12977   application.SendNotification();
12978   tet_infoline("Animation at 80%");
12979
12980   progressCheckAlpha.CheckSignalNotReceived();
12981   progressCheckBeta.CheckSignalNotReceived();
12982
12983   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
12984   // We did expect the animation to finish
12985   tet_infoline("Animation finished");
12986
12987   END_TEST;
12988 }
12989
12990 int UtcDaliAnimationProgressCallbackWithLoopingP(void)
12991 {
12992   TestApplication application;
12993
12994   Actor actor = Actor::New();
12995   application.GetScene().Add(actor);
12996
12997   // Build the animation
12998   Animation animation = Animation::New(0.0f);
12999
13000   //Set duration
13001   const float durationSeconds(1.0f);
13002   animation.SetDuration(durationSeconds);
13003
13004   // Set Looping Count
13005   const int loopCount(4);
13006   animation.SetLoopCount(loopCount);
13007
13008   bool finishedSignalReceived(false);
13009   bool progressSignalReceived(false);
13010
13011   AnimationFinishCheck finishCheck(finishedSignalReceived);
13012   animation.FinishedSignal().Connect(&application, finishCheck);
13013
13014   AnimationProgressCheck progressCheck(progressSignalReceived);
13015   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13016   application.SendNotification();
13017
13018   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13019   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13020
13021   tet_infoline("Animation Progress notification set to 50% with looping count 4");
13022   DevelAnimation::SetProgressNotification(animation, 0.5f);
13023
13024   application.SendNotification();
13025   application.Render();
13026
13027   progressCheck.CheckSignalNotReceived();
13028
13029   animation.Play();
13030
13031   for(int count = 0; count < loopCount; count++)
13032   {
13033     application.SendNotification();
13034     application.Render(0);                                // start animation
13035     application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13036     DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13037
13038     tet_infoline("Animation at 25%");
13039
13040     progressCheck.CheckSignalNotReceived();
13041
13042     application.SendNotification();
13043     application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13044     application.SendNotification();
13045     tet_infoline("Animation at 50%");
13046     DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13047
13048     progressCheck.CheckSignalReceived();
13049
13050     tet_infoline("Progress check reset");
13051     progressCheck.Reset();
13052
13053     application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13054     tet_infoline("Animation at 75%");
13055     application.SendNotification();
13056
13057     DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13058
13059     progressCheck.CheckSignalNotReceived();
13060
13061     application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
13062     tet_infoline("Animation at 100%");
13063     application.SendNotification();
13064
13065     //Nothing check at 100% progress. cause It can be both 100% and 0%.
13066     application.SendNotification();
13067   }
13068   application.Render(10u);
13069   application.SendNotification();
13070   application.Render(0u);
13071   application.SendNotification();
13072
13073   finishCheck.CheckSignalReceived();
13074
13075   END_TEST;
13076 }
13077
13078 int UtcDaliAnimationProgressCallbackWithLoopingP2(void)
13079 {
13080   TestApplication application;
13081
13082   Actor actor = Actor::New();
13083   application.GetScene().Add(actor);
13084
13085   // Build the animation
13086   Animation animation = Animation::New(0.0f);
13087
13088   //Set duration
13089   const float durationSeconds(1.0f);
13090   animation.SetDuration(durationSeconds);
13091
13092   // Set Looping Unlmited
13093   animation.SetLooping(true);
13094
13095   bool finishedSignalReceived(false);
13096   bool progressSignalReceived(false);
13097
13098   AnimationFinishCheck finishCheck(finishedSignalReceived);
13099   animation.FinishedSignal().Connect(&application, finishCheck);
13100
13101   AnimationProgressCheck progressCheck(progressSignalReceived);
13102   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13103   application.SendNotification();
13104
13105   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13106   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13107
13108   tet_infoline("Animation Progress notification set to 50% with unlimited looping");
13109   DevelAnimation::SetProgressNotification(animation, 0.5f);
13110
13111   application.SendNotification();
13112   application.Render();
13113
13114   progressCheck.CheckSignalNotReceived();
13115
13116   animation.Play();
13117
13118   for(int count = 0; count < 4; count++)
13119   {
13120     application.SendNotification();
13121     application.Render(0);                                // start animation
13122     application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13123     DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13124
13125     tet_infoline("Animation at 25%");
13126
13127     progressCheck.CheckSignalNotReceived();
13128
13129     application.SendNotification();
13130     application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13131     application.SendNotification();
13132     tet_infoline("Animation at 50%");
13133     DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13134
13135     progressCheck.CheckSignalReceived();
13136
13137     tet_infoline("Progress check reset");
13138     progressCheck.Reset();
13139
13140     application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13141     tet_infoline("Animation at 75%");
13142     application.SendNotification();
13143
13144     DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13145
13146     progressCheck.CheckSignalNotReceived();
13147
13148     application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
13149     tet_infoline("Animation at 100%");
13150     application.SendNotification();
13151
13152     //Nothing check at 100% progress. cause It can be both 100% and 0%.
13153     finishCheck.CheckSignalNotReceived();
13154     application.SendNotification();
13155   }
13156   finishCheck.CheckSignalNotReceived();
13157
13158   animation.SetLooping(false);
13159   application.Render(0u);
13160   application.SendNotification();
13161   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 10u);
13162   application.SendNotification();
13163   application.Render(0u);
13164   application.SendNotification();
13165
13166   finishCheck.CheckSignalReceived();
13167
13168   END_TEST;
13169 }
13170
13171 int UtcDaliAnimationProgressCallbackNegativeSpeed(void)
13172 {
13173   TestApplication application;
13174
13175   Actor actor = Actor::New();
13176   application.GetScene().Add(actor);
13177
13178   // Build the animation
13179   Animation animation = Animation::New(0.0f);
13180
13181   //Set duration
13182   const float durationSeconds(1.0f);
13183   animation.SetDuration(durationSeconds);
13184
13185   //Set speed negative
13186   animation.SetSpeedFactor(-1.0f);
13187
13188   // Set Looping Unlmited
13189   animation.SetLooping(true);
13190
13191   bool finishedSignalReceived(false);
13192   bool progressSignalReceived(false);
13193
13194   AnimationFinishCheck finishCheck(finishedSignalReceived);
13195   animation.FinishedSignal().Connect(&application, finishCheck);
13196
13197   AnimationProgressCheck progressCheck(progressSignalReceived);
13198   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13199   application.SendNotification();
13200
13201   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13202   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13203
13204   tet_infoline("Animation Progress notification set to 50%");
13205   DevelAnimation::SetProgressNotification(animation, 0.5f);
13206
13207   application.SendNotification();
13208   application.Render();
13209
13210   progressCheck.CheckSignalNotReceived();
13211
13212   animation.Play();
13213
13214   for(int count = 0; count < 4; count++)
13215   {
13216     application.SendNotification();
13217     application.Render(0); // start animation
13218     progressCheck.CheckSignalNotReceived();
13219
13220     application.SendNotification();
13221     application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13222     DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13223
13224     tet_infoline("Animation at 25%");
13225
13226     progressCheck.CheckSignalNotReceived();
13227
13228     application.SendNotification();
13229     application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13230     application.SendNotification();
13231     tet_infoline("Animation at 50%");
13232     DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13233
13234     progressCheck.CheckSignalReceived();
13235
13236     tet_infoline("Progress check reset");
13237     progressCheck.Reset();
13238
13239     application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13240     tet_infoline("Animation at 75%");
13241     application.SendNotification();
13242
13243     DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13244
13245     progressCheck.CheckSignalNotReceived();
13246
13247     application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
13248     tet_infoline("Animation at 100%");
13249     application.SendNotification();
13250
13251     //Nothing check at 100% progress. cause It can be both 100% and 0%.
13252     finishCheck.CheckSignalNotReceived();
13253     application.SendNotification();
13254   }
13255   finishCheck.CheckSignalNotReceived();
13256
13257   animation.Stop();
13258   animation.SetLooping(false);
13259   animation.SetLoopCount(4);
13260   animation.Play();
13261   application.Render(0u);
13262   application.SendNotification();
13263
13264   for(int count = 0; count < 4; count++)
13265   {
13266     application.SendNotification();
13267     application.Render(0); // start animation
13268     progressCheck.CheckSignalNotReceived();
13269
13270     application.SendNotification();
13271     application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13272     DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13273
13274     tet_infoline("Animation at 25%");
13275
13276     progressCheck.CheckSignalNotReceived();
13277
13278     application.SendNotification();
13279     application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13280     application.SendNotification();
13281     tet_infoline("Animation at 50%");
13282     DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13283
13284     progressCheck.CheckSignalReceived();
13285
13286     tet_infoline("Progress check reset");
13287     progressCheck.Reset();
13288
13289     application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13290     tet_infoline("Animation at 75%");
13291     application.SendNotification();
13292
13293     DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13294
13295     progressCheck.CheckSignalNotReceived();
13296
13297     application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
13298     tet_infoline("Animation at 100%");
13299     application.SendNotification();
13300
13301     //Nothing check at 100% progress. cause It can be both 100% and 0%.
13302     application.SendNotification();
13303   }
13304   application.Render(10u);
13305   application.SendNotification();
13306   application.Render(0u);
13307   application.SendNotification();
13308
13309   finishCheck.CheckSignalReceived();
13310
13311   END_TEST;
13312 }
13313
13314 int UtcDaliAnimationProgressCallbackInvalidSignalN(void)
13315 {
13316   TestApplication application;
13317
13318   Actor actor = Actor::New();
13319   application.GetScene().Add(actor);
13320
13321   // Build the animation
13322   Animation animation = Animation::New(0.0f);
13323
13324   //Set duration
13325   const float durationSeconds(1.0f);
13326   animation.SetDuration(durationSeconds);
13327
13328   bool finishedSignalReceived(false);
13329   bool progressSignalReceived(false);
13330
13331   AnimationFinishCheck finishCheck(finishedSignalReceived);
13332   animation.FinishedSignal().Connect(&application, finishCheck);
13333
13334   AnimationProgressCheck progressCheck(progressSignalReceived);
13335   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13336   application.SendNotification();
13337
13338   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13339   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13340
13341   tet_infoline("Animation Progress PlayRange as 10% ~ 90%");
13342   animation.SetPlayRange(Vector2(0.1f, 0.9f));
13343
13344   tet_infoline("Animation Progress notification set to >90% that never can notificated");
13345   DevelAnimation::SetProgressNotification(animation, 0.9f + Math::MACHINE_EPSILON_1);
13346
13347   application.SendNotification();
13348   application.Render();
13349
13350   progressCheck.CheckSignalNotReceived();
13351
13352   animation.Play();
13353
13354   application.SendNotification();
13355   application.Render(0);                                // start animation
13356   application.Render(durationSeconds * 0.25 * 1000.0f); // 35% progress
13357   DALI_TEST_EQUALS(0.35f, animation.GetCurrentProgress(), TEST_LOCATION);
13358
13359   tet_infoline("Animation at 35%");
13360
13361   progressCheck.CheckSignalNotReceived();
13362
13363   application.SendNotification();
13364   application.Render(durationSeconds * 0.25 * 1000.0f); // 60% progress
13365   application.SendNotification();
13366   DALI_TEST_EQUALS(0.6f, animation.GetCurrentProgress(), TEST_LOCATION);
13367
13368   tet_infoline("Animation at 60%");
13369
13370   progressCheck.CheckSignalNotReceived();
13371
13372   application.Render(durationSeconds * 0.25 * 1000.0f); // 85% progress
13373   tet_infoline("Animation at 85%");
13374   application.SendNotification();
13375   DALI_TEST_EQUALS(0.85f, animation.GetCurrentProgress(), TEST_LOCATION);
13376
13377   progressCheck.CheckSignalNotReceived();
13378
13379   application.Render(durationSeconds * 0.25 * 1000.0f); // 90% progress
13380   tet_infoline("Animation over 90%");
13381   application.SendNotification();
13382
13383   // progress never signaled because playrange is 90%
13384   progressCheck.CheckSignalNotReceived();
13385
13386   END_TEST;
13387 }
13388
13389 int UtcDaliAnimationProgressCallbackLongDurationP(void)
13390 {
13391   TestApplication application;
13392
13393   Actor actor = Actor::New();
13394   application.GetScene().Add(actor);
13395
13396   // Build the animation
13397   Animation animation = Animation::New(0.0f);
13398
13399   //Set duration
13400   float durationSeconds(5.0f);
13401   animation.SetDuration(durationSeconds);
13402
13403   bool finishedSignalReceived(false);
13404   bool progressSignalReceived(false);
13405
13406   AnimationFinishCheck finishCheck(finishedSignalReceived);
13407   animation.FinishedSignal().Connect(&application, finishCheck);
13408
13409   AnimationProgressCheck progressCheck(progressSignalReceived);
13410   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13411   application.SendNotification();
13412
13413   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13414   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13415
13416   tet_infoline("Animation Progress notification set to 50%");
13417   DevelAnimation::SetProgressNotification(animation, 0.5f);
13418
13419   application.SendNotification();
13420   application.Render();
13421
13422   progressCheck.CheckSignalNotReceived();
13423
13424   animation.Play();
13425
13426   application.SendNotification();
13427   application.Render(0);                                // start animation
13428   application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13429   DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13430
13431   tet_infoline("Animation at 25%");
13432
13433   progressCheck.CheckSignalNotReceived();
13434
13435   application.SendNotification();
13436   application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13437   application.SendNotification();
13438   tet_infoline("Animation at 50%");
13439   DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13440
13441   progressCheck.CheckSignalReceived();
13442
13443   tet_infoline("Progress check reset");
13444   progressCheck.Reset();
13445
13446   application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13447   tet_infoline("Animation at 75%");
13448   application.SendNotification();
13449
13450   DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13451
13452   progressCheck.CheckSignalNotReceived();
13453
13454   END_TEST;
13455 }
13456
13457 int UtcDaliAnimationAnimateByInvalidParameters(void)
13458 {
13459   TestApplication application;
13460
13461   Actor actor = Actor::New();
13462   application.GetScene().Add(actor);
13463
13464   // Create the animation
13465   Animation animation = Animation::New(1.0f);
13466
13467   DALI_TEST_ASSERTION(
13468     {
13469       // non animateable property (STRING)
13470       animation.AnimateBy(Property(actor, Actor::Property::LAYOUT_DIRECTION), Property::Value("new direction"));
13471     },
13472     "Property type is not animatable");
13473
13474   DALI_TEST_ASSERTION(
13475     {
13476       // non animateable property (MATRIX)
13477       Property::Index index = actor.RegisterProperty("Foobar", Property::Value(Dali::Matrix()), Property::ANIMATABLE);
13478       animation.AnimateBy(Property(actor, index), Property::Value(Property::MATRIX));
13479     },
13480     "Property type is not animatable");
13481
13482   // AnimateBy
13483   DALI_TEST_ASSERTION(
13484     {
13485       // non animateable target (NONE)
13486       animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value());
13487     },
13488     "Target value is not animatable");
13489
13490   DALI_TEST_ASSERTION(
13491     {
13492       // non animateable target (STRING)
13493       animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value("foo"));
13494     },
13495     "Target value is not animatable");
13496
13497   DALI_TEST_ASSERTION(
13498     {
13499       // not mathing properties (VECTOR3, FLOAT)
13500       animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(10.f));
13501     },
13502     "Property and target types don't match");
13503
13504   DALI_TEST_ASSERTION(
13505     {
13506       // not mathing properties (VECTOR3.A, VECTOR2)
13507       animation.AnimateBy(Property(actor, Actor::Property::COLOR_ALPHA), Property::Value(Property::VECTOR2));
13508     },
13509     "Property and target types don't match");
13510
13511   DALI_TEST_ASSERTION(
13512     {
13513       // negative duration
13514       animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(Vector3(1, 2, 3)), TimePeriod(-1));
13515     },
13516     "Duration must be >=0");
13517
13518   END_TEST;
13519 }
13520
13521 int UtcDaliAnimationAnimateToInvalidParameters(void)
13522 {
13523   TestApplication application;
13524
13525   Actor actor = Actor::New();
13526   application.GetScene().Add(actor);
13527
13528   // Create the animation
13529   Animation animation = Animation::New(1.0f);
13530
13531   // AnimateTo
13532   DALI_TEST_ASSERTION(
13533     {
13534       // non animateable property (MAP)
13535       Property::Index index = actor.RegisterProperty("Foobar", Property::Value(Property::MAP), Property::ANIMATABLE);
13536       animation.AnimateTo(Property(actor, index), Property::Value(Property::MAP));
13537     },
13538     "Property type is not animatable");
13539
13540   DALI_TEST_ASSERTION(
13541     {
13542       // non animateable target (NONE)
13543       animation.AnimateTo(Property(actor, Actor::Property::CLIPPING_MODE), Property::Value());
13544     },
13545     "Property type is not animatable");
13546
13547   DALI_TEST_ASSERTION(
13548     {
13549       // non animateable target (ARRAY)
13550       animation.AnimateTo(Property(actor, Actor::Property::POSITION), Property::Value(Property::ARRAY));
13551     },
13552     "Target value is not animatable");
13553
13554   DALI_TEST_ASSERTION(
13555     {
13556       // non animateable target (RECTANGLE)
13557       animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(Rect<int32_t>()));
13558     },
13559     "Target value is not animatable");
13560
13561   DALI_TEST_ASSERTION(
13562     {
13563       // not mathing properties (FLOAT, INT)
13564       animation.AnimateTo(Property(actor, Actor::Property::SCALE_Y), Property::Value(10));
13565     },
13566     "Property and target types don't match");
13567
13568   DALI_TEST_ASSERTION(
13569     {
13570       // not mathing properties (VECTOR3, VECTOR2)
13571       animation.AnimateTo(Property(actor, Actor::Property::COLOR), Property::Value(Property::VECTOR2));
13572     },
13573     "Property and target types don't match");
13574
13575   DALI_TEST_ASSERTION(
13576     {
13577       // negative duration
13578       animation.AnimateTo(Property(actor, Actor::Property::POSITION), Property::Value(Vector3(1, 2, 3)), TimePeriod(-1));
13579     },
13580     "Duration must be >=0");
13581
13582   END_TEST;
13583 }
13584
13585 int UtcDaliAnimationAnimateBetweenInvalidParameters(void)
13586 {
13587   TestApplication application;
13588
13589   Actor actor = Actor::New();
13590   application.GetScene().Add(actor);
13591
13592   // Create the animation
13593   Animation animation = Animation::New(1.0f);
13594
13595   // AnimateBetween
13596   DALI_TEST_ASSERTION(
13597     {
13598       // non animateable property (ARRAY)
13599       Property::Index index     = actor.RegisterProperty("Foobar", Property::Value(Property::ARRAY), Property::ANIMATABLE);
13600       KeyFrames       keyframes = KeyFrames::New();
13601       keyframes.Add(0.5f, Property::Value(Property::ARRAY));
13602       animation.AnimateBetween(Property(actor, index), keyframes);
13603     },
13604     "Property type is not animatable");
13605
13606   DALI_TEST_ASSERTION(
13607     {
13608       // non animateable target (NONE)
13609       KeyFrames keyframes = KeyFrames::New();
13610       keyframes.Add(0.5f, Property::Value());
13611       animation.AnimateBetween(Property(actor, Actor::Property::CLIPPING_MODE), keyframes);
13612     },
13613     "Property type is not animatable");
13614
13615   DALI_TEST_ASSERTION(
13616     {
13617       // non animateable target (EXTENTS)
13618       KeyFrames keyframes = KeyFrames::New();
13619       keyframes.Add(0.5f, Property::Value(Property::EXTENTS)); // throws
13620       animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes);
13621     },
13622     "Property type is not animatable");
13623
13624   DALI_TEST_ASSERTION(
13625     {
13626       // non animateable target (RECTANGLE)
13627       KeyFrames keyframes = KeyFrames::New();
13628       keyframes.Add(0.5f, Property::Value(Property::MAP)); // throws
13629       animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes);
13630     },
13631     "Property type is not animatable");
13632
13633   DALI_TEST_ASSERTION(
13634     {
13635       // not mathing properties (VECTOR2, VECTOR4)
13636       KeyFrames keyframes = KeyFrames::New();
13637       keyframes.Add(0.5f, Property::Value(Vector4(1, 2, 3, 4)));
13638       animation.AnimateBetween(Property(actor, Actor::Property::MAXIMUM_SIZE), keyframes);
13639     },
13640     "Property and target types don't match");
13641
13642   DALI_TEST_ASSERTION(
13643     {
13644       // negative duration
13645       KeyFrames keyframes = KeyFrames::New();
13646       keyframes.Add(0.5f, Property::Value(Vector3(1, 2, 3)));
13647       animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, TimePeriod(-1));
13648     },
13649     "Duration must be >=0");
13650
13651   END_TEST;
13652 }
13653
13654 namespace // Purposefully left this in the middle as the values in this namespace are only used for the subsequent two test cases
13655 {
13656 enum TestFunction
13657 {
13658   STOP,
13659   CLEAR
13660 };
13661
13662 void CheckPropertyValuesWhenCallingAnimationMethod(TestFunction functionToTest, const char* testName)
13663 {
13664   tet_printf("Testing %s\n", testName);
13665
13666   // When an Animation::Stop() or Animation::Clear() is called, the event-side property needs to be updated appropriately
13667   // This test checks that that is being done
13668
13669   const float   durationSeconds(1.0f);
13670   unsigned int  halfAnimationDuration(static_cast<unsigned int>(durationSeconds * 1000.0f * 0.5f));
13671   const Vector3 originalPosition(Vector3::ZERO);
13672   const Vector3 targetPosition(10.0f, 10.0f, 10.0f);
13673   const Vector3 halfWayToTarget(targetPosition * 0.5f);
13674
13675   struct ExpectedValue
13676   {
13677     Animation::EndAction endAction;
13678     Vector3              expectedGetPropertyValue;
13679   };
13680
13681   ExpectedValue expectedValueTable[] =
13682     {
13683       {Animation::BAKE, halfWayToTarget},      // When baking, the current value is the final value.
13684       {Animation::BAKE_FINAL, targetPosition}, // When BakeFinal, we should jump to the final value when clearing or stopping.
13685       {Animation::DISCARD, originalPosition},  // When discarding, we should jump back to the original value when clearing or stopping.
13686     };
13687   const auto expectedValueTableCount = sizeof(expectedValueTable) / sizeof(ExpectedValue);
13688
13689   for(auto i = 0u; i < expectedValueTableCount; ++i)
13690   {
13691     TestApplication application;
13692
13693     Actor actor = Actor::New();
13694     application.GetScene().Add(actor);
13695
13696     // Build the animation
13697     Animation animation = Animation::New(durationSeconds);
13698     animation.SetEndAction(expectedValueTable[i].endAction);
13699     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13700
13701     // Start the animation
13702     animation.Play();
13703
13704     application.SendNotification();
13705     application.Render(halfAnimationDuration);
13706
13707     // Stop or Clear the animation early, both have the same effect
13708     if(functionToTest == TestFunction::STOP)
13709     {
13710       animation.Stop();
13711     }
13712     else
13713     {
13714       animation.Clear();
13715     }
13716
13717     // 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
13718     DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION);
13719     DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13720
13721     // After one frame, both values should match regardless of the End Action
13722     application.SendNotification();
13723     application.Render();
13724
13725     DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION);
13726     DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION);
13727   }
13728 }
13729 } // unnamed namespace
13730
13731 int UtcDaliAnimationStopPropertyValue(void)
13732 {
13733   CheckPropertyValuesWhenCallingAnimationMethod(TestFunction::STOP, "UtcDaliAnimationStopPropertyValue");
13734   END_TEST;
13735 }
13736
13737 int UtcDaliAnimationClearPropertyValue01(void)
13738 {
13739   CheckPropertyValuesWhenCallingAnimationMethod(TestFunction::CLEAR, "UtcDaliAnimationStopPropertyValue");
13740   END_TEST;
13741 }
13742
13743 int UtcDaliAnimationClearPropertyValue02(void)
13744 {
13745   TestApplication application;
13746
13747   Actor actor = Actor::New();
13748   application.GetScene().Add(actor);
13749
13750   const float   durationSeconds(1.0f);
13751   const Vector3 targetPosition1(10.0f, 10.0f, 10.0f);
13752   const Vector3 targetPosition2(20.0f, 20.0f, 20.0f);
13753
13754   // Build the animation
13755   Animation animation1 = Animation::New(durationSeconds);
13756   animation1.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition1, AlphaFunction::LINEAR);
13757   animation1.Play();
13758
13759   application.SendNotification();
13760   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
13761
13762   // The event side property should be set the current value immediately
13763   DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), targetPosition1, VECTOR3_EPSILON, TEST_LOCATION);
13764
13765   application.SendNotification();
13766   application.Render(2u /*just beyond the animation duration*/);
13767
13768   // Build a new animation
13769   Animation animation2 = Animation::New(durationSeconds);
13770   animation2.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition2, AlphaFunction::LINEAR);
13771   animation2.Play();
13772
13773   application.SendNotification();
13774   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
13775
13776   // The event side property should be set the current value immediately
13777   DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), targetPosition2, VECTOR3_EPSILON, TEST_LOCATION);
13778
13779   // Clear the first animation after finished
13780   animation1.Clear();
13781
13782   application.SendNotification();
13783   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
13784
13785   // The property should not be changed.
13786   DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), targetPosition2, VECTOR3_EPSILON, TEST_LOCATION);
13787
13788   END_TEST;
13789 }
13790
13791 int UtcDaliAnimationPausePropertyValue(void)
13792 {
13793   const float   durationSeconds(1.0f);
13794   unsigned int  halfAnimationDuration(static_cast<unsigned int>(durationSeconds * 1000.0f * 0.5f));
13795   const Vector3 targetPosition(10.0f, 10.0f, 10.0f);
13796   const Vector3 halfWayToTarget(targetPosition * 0.5f);
13797
13798   Animation::EndAction endActions[] =
13799     {
13800       Animation::BAKE,
13801       Animation::BAKE_FINAL,
13802       Animation::DISCARD,
13803     };
13804   const auto endActionCount = sizeof(endActions) / sizeof(endActions[0]);
13805
13806   // For all end actions, when pausing, we stay at the current value
13807   for(auto i = 0u; i < endActionCount; ++i)
13808   {
13809     TestApplication application;
13810
13811     Actor actor = Actor::New();
13812     application.GetScene().Add(actor);
13813
13814     // Build the animation
13815     Animation animation = Animation::New(durationSeconds);
13816     animation.SetEndAction(endActions[i]);
13817     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13818
13819     // Start the animation
13820     animation.Play();
13821
13822     application.SendNotification();
13823     application.Render(halfAnimationDuration);
13824
13825     // Puase the animation early
13826     animation.Pause();
13827
13828     // The event side property should be set the current value immediately, the update side property will still only be halfway
13829     DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13830     DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13831
13832     // After one frame, both values should match regardless of the End Action
13833     application.SendNotification();
13834     application.Render();
13835
13836     DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13837     DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13838   }
13839
13840   END_TEST;
13841 }
13842
13843 int UtcDaliAnimationPlayFromWithLoopCount(void)
13844 {
13845   TestApplication application;
13846
13847   auto actor = Actor::New();
13848   application.GetScene().Add(actor);
13849
13850   auto animation = Animation::New(1.0f);
13851   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f);
13852   animation.SetLoopCount(2);
13853   animation.Play();
13854
13855   application.SendNotification();
13856   application.Render(1001);
13857
13858   // One loop completed
13859
13860   application.Render(2005);
13861   application.SendNotification();
13862
13863   // 2 loops should have completed
13864   DALI_TEST_EQUALS(animation.GetCurrentLoop(), 2u, TEST_LOCATION);
13865
13866   // Another render needs to occur after all the loops end
13867   application.SendNotification();
13868   application.Render(1000);
13869
13870   // Stop the animation and use PlayFrom, previously we got an Assert here
13871   animation.Stop();
13872   animation.PlayFrom(0.5f);
13873
13874   application.SendNotification();
13875   application.Render(1000);
13876
13877   DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
13878
13879   END_TEST;
13880 }
13881
13882 int UtcDaliAnimationCombineToAndByWithStop(void)
13883 {
13884   tet_infoline("Ensure the Y Position is not modified when animating the X position using AnimateTo and AnimateBy");
13885
13886   TestApplication application;
13887
13888   auto actor = Actor::New();
13889   actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
13890   application.GetScene().Add(actor);
13891
13892   auto        animation = Animation::New(1.0f);
13893   const float origY     = actor.GetProperty(Actor::Property::POSITION_Y).Get<float>();
13894   animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(150.0f, origY, 0.0f), TimePeriod(1.0f));
13895   animation.AnimateBy(Property(actor, Actor::Property::POSITION), Vector3(-30.0f, 0.0f, 0.0f), TimePeriod(1.0f, 1.0f));
13896   animation.Play();
13897
13898   application.SendNotification();
13899   application.Render(500);
13900
13901   application.SendNotification();
13902   application.Render(500);
13903
13904   application.SendNotification();
13905   application.Render(500);
13906
13907   // Stop and clear the animation using the current values
13908   animation.Stop();
13909   animation.Clear();
13910
13911   // Check the y position, it should be the same as before
13912   DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Y).Get<float>(), origY, TEST_LOCATION);
13913
13914   END_TEST;
13915 }
13916
13917 int UtcDaliAnimationCountAndGetAnimationAt(void)
13918 {
13919   tet_infoline("UtcDaliAnimationCountAndGetAnimationAt");
13920
13921   TestApplication application;
13922
13923   auto actor = Actor::New();
13924   actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
13925   application.GetScene().Add(actor);
13926
13927   auto        animation = Animation::New(1.0f);
13928   const float origY     = actor.GetProperty(Actor::Property::POSITION_Y).Get<float>();
13929   animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(150.0f, origY, 0.0f), TimePeriod(1.0f));
13930   animation.Play();
13931
13932   application.SendNotification();
13933   application.Render(500);
13934
13935   uint32_t animationCount = Dali::DevelAnimation::GetAnimationCount();
13936   DALI_TEST_EQUALS(animationCount, 1, TEST_LOCATION);
13937
13938   DALI_TEST_CHECK(!Dali::DevelAnimation::GetAnimationAt(5));
13939
13940   Dali::Animation animationReturned = Dali::DevelAnimation::GetAnimationAt(0);
13941   DALI_TEST_EQUALS(animationReturned.GetState(), Dali::Animation::State::PLAYING, TEST_LOCATION);
13942
13943   DALI_TEST_EQUALS(animation.GetDuration(), animationReturned.GetDuration(), TEST_LOCATION);
13944   DALI_TEST_EQUALS(animation.GetLoopCount(), animationReturned.GetLoopCount(), TEST_LOCATION);
13945   DALI_TEST_EQUALS(animation.IsLooping(), animationReturned.IsLooping(), TEST_LOCATION);
13946   DALI_TEST_EQUALS(animation.GetEndAction(), animationReturned.GetEndAction(), TEST_LOCATION);
13947   DALI_TEST_EQUALS(animation.GetState(), animationReturned.GetState(), TEST_LOCATION);
13948
13949   // Stop and clear the animation using the current values
13950   animation.Stop();
13951   animation.Clear();
13952
13953   END_TEST;
13954 }
13955
13956 int UtcDaliAnimationSetLoopingNegative(void)
13957 {
13958   TestApplication application;
13959   Dali::Animation instance;
13960   try
13961   {
13962     bool arg1(false);
13963     instance.SetLooping(arg1);
13964     DALI_TEST_CHECK(false); // Should not get here
13965   }
13966   catch(...)
13967   {
13968     DALI_TEST_CHECK(true); // We expect an assert
13969   }
13970   END_TEST;
13971 }
13972
13973 int UtcDaliAnimationSetDurationNegative(void)
13974 {
13975   TestApplication application;
13976   Dali::Animation instance;
13977   try
13978   {
13979     float arg1(0.0f);
13980     instance.SetDuration(arg1);
13981     DALI_TEST_CHECK(false); // Should not get here
13982   }
13983   catch(...)
13984   {
13985     DALI_TEST_CHECK(true); // We expect an assert
13986   }
13987   END_TEST;
13988 }
13989
13990 int UtcDaliAnimationGetLoopCountNegative(void)
13991 {
13992   TestApplication application;
13993   Dali::Animation instance;
13994   try
13995   {
13996     instance.GetLoopCount();
13997     DALI_TEST_CHECK(false); // Should not get here
13998   }
13999   catch(...)
14000   {
14001     DALI_TEST_CHECK(true); // We expect an assert
14002   }
14003   END_TEST;
14004 }
14005
14006 int UtcDaliAnimationSetEndActionNegative(void)
14007 {
14008   TestApplication application;
14009   Dali::Animation instance;
14010   try
14011   {
14012     Dali::Animation::EndAction arg1(Animation::BAKE);
14013     instance.SetEndAction(arg1);
14014     DALI_TEST_CHECK(false); // Should not get here
14015   }
14016   catch(...)
14017   {
14018     DALI_TEST_CHECK(true); // We expect an assert
14019   }
14020   END_TEST;
14021 }
14022
14023 int UtcDaliAnimationSetLoopCountNegative(void)
14024 {
14025   TestApplication application;
14026   Dali::Animation instance;
14027   try
14028   {
14029     int arg1(0);
14030     instance.SetLoopCount(arg1);
14031     DALI_TEST_CHECK(false); // Should not get here
14032   }
14033   catch(...)
14034   {
14035     DALI_TEST_CHECK(true); // We expect an assert
14036   }
14037   END_TEST;
14038 }
14039
14040 int UtcDaliAnimationSetPlayRangeNegative(void)
14041 {
14042   TestApplication application;
14043   Dali::Animation instance;
14044   try
14045   {
14046     Dali::Vector2 arg1;
14047     instance.SetPlayRange(arg1);
14048     DALI_TEST_CHECK(false); // Should not get here
14049   }
14050   catch(...)
14051   {
14052     DALI_TEST_CHECK(true); // We expect an assert
14053   }
14054   END_TEST;
14055 }
14056
14057 int UtcDaliAnimationAnimateBetweenNegative01(void)
14058 {
14059   TestApplication application;
14060   Dali::Animation instance;
14061   Dali::Actor     actor;
14062   try
14063   {
14064     Dali::Property  arg1(actor, Actor::Property::POSITION);
14065     Dali::KeyFrames arg2;
14066     instance.AnimateBetween(arg1, arg2);
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 UtcDaliAnimationAnimateBetweenNegative02(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::Animation::Interpolation arg3(Animation::LINEAR);
14086     instance.AnimateBetween(arg1, arg2, arg3);
14087     DALI_TEST_CHECK(false); // Should not get here
14088   }
14089   catch(...)
14090   {
14091     DALI_TEST_CHECK(true); // We expect an assert
14092   }
14093   END_TEST;
14094 }
14095
14096 int UtcDaliAnimationAnimateBetweenNegative03(void)
14097 {
14098   TestApplication application;
14099   Dali::Animation instance;
14100   Dali::Actor     actor;
14101   try
14102   {
14103     Dali::Property   arg1(actor, Actor::Property::POSITION);
14104     Dali::KeyFrames  arg2;
14105     Dali::TimePeriod arg3(1.0f);
14106     instance.AnimateBetween(arg1, arg2, arg3);
14107     DALI_TEST_CHECK(false); // Should not get here
14108   }
14109   catch(...)
14110   {
14111     DALI_TEST_CHECK(true); // We expect an assert
14112   }
14113   END_TEST;
14114 }
14115
14116 int UtcDaliAnimationAnimateBetweenNegative04(void)
14117 {
14118   TestApplication application;
14119   Dali::Animation instance;
14120   Dali::Actor     actor;
14121   try
14122   {
14123     Dali::Property                 arg1(actor, Actor::Property::POSITION);
14124     Dali::KeyFrames                arg2;
14125     Dali::TimePeriod               arg3(1.0f);
14126     Dali::Animation::Interpolation arg4(Animation::LINEAR);
14127     instance.AnimateBetween(arg1, arg2, arg3, arg4);
14128     DALI_TEST_CHECK(false); // Should not get here
14129   }
14130   catch(...)
14131   {
14132     DALI_TEST_CHECK(true); // We expect an assert
14133   }
14134   END_TEST;
14135 }
14136
14137 int UtcDaliAnimationAnimateBetweenNegative05(void)
14138 {
14139   TestApplication application;
14140   Dali::Animation instance;
14141   Dali::Actor     actor;
14142   try
14143   {
14144     Dali::Property      arg1(actor, Actor::Property::POSITION);
14145     Dali::KeyFrames     arg2;
14146     Dali::AlphaFunction arg3;
14147     instance.AnimateBetween(arg1, arg2, arg3);
14148     DALI_TEST_CHECK(false); // Should not get here
14149   }
14150   catch(...)
14151   {
14152     DALI_TEST_CHECK(true); // We expect an assert
14153   }
14154   END_TEST;
14155 }
14156
14157 int UtcDaliAnimationAnimateBetweenNegative06(void)
14158 {
14159   TestApplication application;
14160   Dali::Animation instance;
14161   Dali::Actor     actor;
14162   try
14163   {
14164     Dali::Property                 arg1(actor, Actor::Property::POSITION);
14165     Dali::KeyFrames                arg2;
14166     Dali::AlphaFunction            arg3;
14167     Dali::Animation::Interpolation arg4(Animation::LINEAR);
14168     instance.AnimateBetween(arg1, arg2, arg3, arg4);
14169     DALI_TEST_CHECK(false); // Should not get here
14170   }
14171   catch(...)
14172   {
14173     DALI_TEST_CHECK(true); // We expect an assert
14174   }
14175   END_TEST;
14176 }
14177
14178 int UtcDaliAnimationAnimateBetweenNegative07(void)
14179 {
14180   TestApplication application;
14181   Dali::Animation instance;
14182   Dali::Actor     actor;
14183   try
14184   {
14185     Dali::Property      arg1(actor, Actor::Property::POSITION);
14186     Dali::KeyFrames     arg2;
14187     Dali::AlphaFunction arg3;
14188     Dali::TimePeriod    arg4(1.0f);
14189     instance.AnimateBetween(arg1, arg2, arg3, arg4);
14190     DALI_TEST_CHECK(false); // Should not get here
14191   }
14192   catch(...)
14193   {
14194     DALI_TEST_CHECK(true); // We expect an assert
14195   }
14196   END_TEST;
14197 }
14198
14199 int UtcDaliAnimationAnimateBetweenNegative08(void)
14200 {
14201   TestApplication application;
14202   Dali::Animation instance;
14203   Dali::Actor     actor;
14204   try
14205   {
14206     Dali::Property                 arg1(actor, Actor::Property::POSITION);
14207     Dali::KeyFrames                arg2;
14208     Dali::AlphaFunction            arg3;
14209     Dali::TimePeriod               arg4(1.0f);
14210     Dali::Animation::Interpolation arg5(Animation::LINEAR);
14211     instance.AnimateBetween(arg1, arg2, arg3, arg4, arg5);
14212     DALI_TEST_CHECK(false); // Should not get here
14213   }
14214   catch(...)
14215   {
14216     DALI_TEST_CHECK(true); // We expect an assert
14217   }
14218   END_TEST;
14219 }
14220
14221 int UtcDaliAnimationFinishedSignalNegative(void)
14222 {
14223   TestApplication application;
14224   Dali::Animation instance;
14225   try
14226   {
14227     instance.FinishedSignal();
14228     DALI_TEST_CHECK(false); // Should not get here
14229   }
14230   catch(...)
14231   {
14232     DALI_TEST_CHECK(true); // We expect an assert
14233   }
14234   END_TEST;
14235 }
14236
14237 int UtcDaliAnimationGetCurrentLoopNegative(void)
14238 {
14239   TestApplication application;
14240   Dali::Animation instance;
14241   try
14242   {
14243     instance.GetCurrentLoop();
14244     DALI_TEST_CHECK(false); // Should not get here
14245   }
14246   catch(...)
14247   {
14248     DALI_TEST_CHECK(true); // We expect an assert
14249   }
14250   END_TEST;
14251 }
14252
14253 int UtcDaliAnimationSetLoopingModeNegative(void)
14254 {
14255   TestApplication application;
14256   Dali::Animation instance;
14257   try
14258   {
14259     Dali::Animation::LoopingMode arg1(Animation::RESTART);
14260     instance.SetLoopingMode(arg1);
14261     DALI_TEST_CHECK(false); // Should not get here
14262   }
14263   catch(...)
14264   {
14265     DALI_TEST_CHECK(true); // We expect an assert
14266   }
14267   END_TEST;
14268 }
14269
14270 int UtcDaliAnimationSetSpeedFactorNegative(void)
14271 {
14272   TestApplication application;
14273   Dali::Animation instance;
14274   try
14275   {
14276     float arg1(0.0f);
14277     instance.SetSpeedFactor(arg1);
14278     DALI_TEST_CHECK(false); // Should not get here
14279   }
14280   catch(...)
14281   {
14282     DALI_TEST_CHECK(true); // We expect an assert
14283   }
14284   END_TEST;
14285 }
14286
14287 int UtcDaliAnimationGetCurrentProgressNegative(void)
14288 {
14289   TestApplication application;
14290   Dali::Animation instance;
14291   try
14292   {
14293     instance.GetCurrentProgress();
14294     DALI_TEST_CHECK(false); // Should not get here
14295   }
14296   catch(...)
14297   {
14298     DALI_TEST_CHECK(true); // We expect an assert
14299   }
14300   END_TEST;
14301 }
14302
14303 int UtcDaliAnimationSetCurrentProgressNegative(void)
14304 {
14305   TestApplication application;
14306   Dali::Animation instance;
14307   try
14308   {
14309     float arg1(0.0f);
14310     instance.SetCurrentProgress(arg1);
14311     DALI_TEST_CHECK(false); // Should not get here
14312   }
14313   catch(...)
14314   {
14315     DALI_TEST_CHECK(true); // We expect an assert
14316   }
14317   END_TEST;
14318 }
14319
14320 int UtcDaliAnimationSetDisconnectActionNegative(void)
14321 {
14322   TestApplication application;
14323   Dali::Animation instance;
14324   try
14325   {
14326     Dali::Animation::EndAction arg1(Animation::BAKE);
14327     instance.SetDisconnectAction(arg1);
14328     DALI_TEST_CHECK(false); // Should not get here
14329   }
14330   catch(...)
14331   {
14332     DALI_TEST_CHECK(true); // We expect an assert
14333   }
14334   END_TEST;
14335 }
14336
14337 int UtcDaliAnimationSetDefaultAlphaFunctionNegative(void)
14338 {
14339   TestApplication application;
14340   Dali::Animation instance;
14341   try
14342   {
14343     Dali::AlphaFunction arg1;
14344     instance.SetDefaultAlphaFunction(arg1);
14345     DALI_TEST_CHECK(false); // Should not get here
14346   }
14347   catch(...)
14348   {
14349     DALI_TEST_CHECK(true); // We expect an assert
14350   }
14351   END_TEST;
14352 }
14353
14354 int UtcDaliAnimationHideNegative(void)
14355 {
14356   TestApplication application;
14357   Dali::Animation instance;
14358   try
14359   {
14360     Dali::Actor arg1;
14361     float       arg2(0.0f);
14362     instance.Hide(arg1, arg2);
14363     DALI_TEST_CHECK(false); // Should not get here
14364   }
14365   catch(...)
14366   {
14367     DALI_TEST_CHECK(true); // We expect an assert
14368   }
14369   END_TEST;
14370 }
14371
14372 int UtcDaliAnimationPlayNegative(void)
14373 {
14374   TestApplication application;
14375   Dali::Animation instance;
14376   try
14377   {
14378     instance.Play();
14379     DALI_TEST_CHECK(false); // Should not get here
14380   }
14381   catch(...)
14382   {
14383     DALI_TEST_CHECK(true); // We expect an assert
14384   }
14385   END_TEST;
14386 }
14387
14388 int UtcDaliAnimationShowNegative(void)
14389 {
14390   TestApplication application;
14391   Dali::Animation instance;
14392   try
14393   {
14394     Dali::Actor arg1;
14395     float       arg2(0.0f);
14396     instance.Show(arg1, arg2);
14397     DALI_TEST_CHECK(false); // Should not get here
14398   }
14399   catch(...)
14400   {
14401     DALI_TEST_CHECK(true); // We expect an assert
14402   }
14403   END_TEST;
14404 }
14405
14406 int UtcDaliAnimationStopNegative(void)
14407 {
14408   TestApplication application;
14409   Dali::Animation instance;
14410   try
14411   {
14412     instance.Stop();
14413     DALI_TEST_CHECK(false); // Should not get here
14414   }
14415   catch(...)
14416   {
14417     DALI_TEST_CHECK(true); // We expect an assert
14418   }
14419   END_TEST;
14420 }
14421
14422 int UtcDaliAnimationClearNegative(void)
14423 {
14424   TestApplication application;
14425   Dali::Animation instance;
14426   try
14427   {
14428     instance.Clear();
14429     DALI_TEST_CHECK(false); // Should not get here
14430   }
14431   catch(...)
14432   {
14433     DALI_TEST_CHECK(true); // We expect an assert
14434   }
14435   END_TEST;
14436 }
14437
14438 int UtcDaliAnimationPauseNegative(void)
14439 {
14440   TestApplication application;
14441   Dali::Animation instance;
14442   try
14443   {
14444     instance.Pause();
14445     DALI_TEST_CHECK(false); // Should not get here
14446   }
14447   catch(...)
14448   {
14449     DALI_TEST_CHECK(true); // We expect an assert
14450   }
14451   END_TEST;
14452 }
14453
14454 int UtcDaliAnimationAnimateNegative01(void)
14455 {
14456   TestApplication application;
14457   Dali::Animation instance;
14458   try
14459   {
14460     Dali::Actor   arg1;
14461     Dali::Path    arg2;
14462     Dali::Vector3 arg3;
14463     instance.Animate(arg1, arg2, arg3);
14464     DALI_TEST_CHECK(false); // Should not get here
14465   }
14466   catch(...)
14467   {
14468     DALI_TEST_CHECK(true); // We expect an assert
14469   }
14470   END_TEST;
14471 }
14472
14473 int UtcDaliAnimationAnimateNegative02(void)
14474 {
14475   TestApplication application;
14476   Dali::Animation instance;
14477   try
14478   {
14479     Dali::Actor      arg1;
14480     Dali::Path       arg2;
14481     Dali::Vector3    arg3;
14482     Dali::TimePeriod arg4(1.0f);
14483     instance.Animate(arg1, arg2, arg3, arg4);
14484     DALI_TEST_CHECK(false); // Should not get here
14485   }
14486   catch(...)
14487   {
14488     DALI_TEST_CHECK(true); // We expect an assert
14489   }
14490   END_TEST;
14491 }
14492
14493 int UtcDaliAnimationAnimateNegative03(void)
14494 {
14495   TestApplication application;
14496   Dali::Animation instance;
14497   try
14498   {
14499     Dali::Actor         arg1;
14500     Dali::Path          arg2;
14501     Dali::Vector3       arg3;
14502     Dali::AlphaFunction arg4;
14503     instance.Animate(arg1, arg2, arg3, arg4);
14504     DALI_TEST_CHECK(false); // Should not get here
14505   }
14506   catch(...)
14507   {
14508     DALI_TEST_CHECK(true); // We expect an assert
14509   }
14510   END_TEST;
14511 }
14512
14513 int UtcDaliAnimationAnimateNegative04(void)
14514 {
14515   TestApplication application;
14516   Dali::Animation instance;
14517   try
14518   {
14519     Dali::Actor         arg1;
14520     Dali::Path          arg2;
14521     Dali::Vector3       arg3;
14522     Dali::AlphaFunction arg4;
14523     Dali::TimePeriod    arg5(1.0f);
14524     instance.Animate(arg1, arg2, arg3, arg4, arg5);
14525     DALI_TEST_CHECK(false); // Should not get here
14526   }
14527   catch(...)
14528   {
14529     DALI_TEST_CHECK(true); // We expect an assert
14530   }
14531   END_TEST;
14532 }
14533
14534 int UtcDaliAnimationPlayFromNegative(void)
14535 {
14536   TestApplication application;
14537   Dali::Animation instance;
14538   try
14539   {
14540     float arg1(0.0f);
14541     instance.PlayFrom(arg1);
14542     DALI_TEST_CHECK(false); // Should not get here
14543   }
14544   catch(...)
14545   {
14546     DALI_TEST_CHECK(true); // We expect an assert
14547   }
14548   END_TEST;
14549 }
14550
14551 int UtcDaliAnimationAnimateByNegative01(void)
14552 {
14553   TestApplication application;
14554   Dali::Animation instance;
14555   Dali::Actor     actor;
14556   try
14557   {
14558     Dali::Property        arg1(actor, Actor::Property::POSITION);
14559     Dali::Property::Value arg2;
14560     instance.AnimateBy(arg1, arg2);
14561     DALI_TEST_CHECK(false); // Should not get here
14562   }
14563   catch(...)
14564   {
14565     DALI_TEST_CHECK(true); // We expect an assert
14566   }
14567   END_TEST;
14568 }
14569
14570 int UtcDaliAnimationAnimateByNegative02(void)
14571 {
14572   TestApplication application;
14573   Dali::Animation instance;
14574   Dali::Actor     actor;
14575   try
14576   {
14577     Dali::Property        arg1(actor, Actor::Property::POSITION);
14578     Dali::Property::Value arg2;
14579     Dali::TimePeriod      arg3(1.0f);
14580     instance.AnimateBy(arg1, arg2, arg3);
14581     DALI_TEST_CHECK(false); // Should not get here
14582   }
14583   catch(...)
14584   {
14585     DALI_TEST_CHECK(true); // We expect an assert
14586   }
14587   END_TEST;
14588 }
14589
14590 int UtcDaliAnimationAnimateByNegative03(void)
14591 {
14592   TestApplication application;
14593   Dali::Animation instance;
14594   Dali::Actor     actor;
14595   try
14596   {
14597     Dali::Property        arg1(actor, Actor::Property::POSITION);
14598     Dali::Property::Value arg2;
14599     Dali::AlphaFunction   arg3;
14600     instance.AnimateBy(arg1, arg2, arg3);
14601     DALI_TEST_CHECK(false); // Should not get here
14602   }
14603   catch(...)
14604   {
14605     DALI_TEST_CHECK(true); // We expect an assert
14606   }
14607   END_TEST;
14608 }
14609
14610 int UtcDaliAnimationAnimateByNegative04(void)
14611 {
14612   TestApplication application;
14613   Dali::Animation instance;
14614   Dali::Actor     actor;
14615   try
14616   {
14617     Dali::Property        arg1(actor, Actor::Property::POSITION);
14618     Dali::Property::Value arg2;
14619     Dali::AlphaFunction   arg3;
14620     Dali::TimePeriod      arg4(1.0f);
14621     instance.AnimateBy(arg1, arg2, arg3, arg4);
14622     DALI_TEST_CHECK(false); // Should not get here
14623   }
14624   catch(...)
14625   {
14626     DALI_TEST_CHECK(true); // We expect an assert
14627   }
14628   END_TEST;
14629 }
14630
14631 int UtcDaliAnimationAnimateToNegative01(void)
14632 {
14633   TestApplication application;
14634   Dali::Actor     actor;
14635   Dali::Animation instance;
14636   try
14637   {
14638     Dali::Property        arg1(actor, Actor::Property::POSITION);
14639     Dali::Property::Value arg2;
14640     instance.AnimateTo(arg1, arg2);
14641     DALI_TEST_CHECK(false); // Should not get here
14642   }
14643   catch(...)
14644   {
14645     DALI_TEST_CHECK(true); // We expect an assert
14646   }
14647   END_TEST;
14648 }
14649
14650 int UtcDaliAnimationAnimateToNegative02(void)
14651 {
14652   TestApplication application;
14653   Dali::Animation instance;
14654   Dali::Actor     actor;
14655   try
14656   {
14657     Dali::Property        arg1(actor, Actor::Property::POSITION);
14658     Dali::Property::Value arg2;
14659     Dali::TimePeriod      arg3(1.0f);
14660     instance.AnimateTo(arg1, arg2, arg3);
14661     DALI_TEST_CHECK(false); // Should not get here
14662   }
14663   catch(...)
14664   {
14665     DALI_TEST_CHECK(true); // We expect an assert
14666   }
14667   END_TEST;
14668 }
14669
14670 int UtcDaliAnimationAnimateToNegative03(void)
14671 {
14672   TestApplication application;
14673   Dali::Animation instance;
14674   Dali::Actor     actor;
14675   try
14676   {
14677     Dali::Property        arg1(actor, Actor::Property::POSITION);
14678     Dali::Property::Value arg2;
14679     Dali::AlphaFunction   arg3;
14680     instance.AnimateTo(arg1, arg2, arg3);
14681     DALI_TEST_CHECK(false); // Should not get here
14682   }
14683   catch(...)
14684   {
14685     DALI_TEST_CHECK(true); // We expect an assert
14686   }
14687   END_TEST;
14688 }
14689
14690 int UtcDaliAnimationAnimateToNegative04(void)
14691 {
14692   TestApplication application;
14693   Dali::Animation instance;
14694   Dali::Actor     actor;
14695   try
14696   {
14697     Dali::Property        arg1(actor, Actor::Property::POSITION);
14698     Dali::Property::Value arg2;
14699     Dali::AlphaFunction   arg3;
14700     Dali::TimePeriod      arg4(1.0f);
14701     instance.AnimateTo(arg1, arg2, arg3, arg4);
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 UtcDaliAnimationPlayAfterNegative(void)
14712 {
14713   TestApplication application;
14714   Dali::Animation instance;
14715   try
14716   {
14717     float arg1(0.0f);
14718     instance.PlayAfter(arg1);
14719     DALI_TEST_CHECK(false); // Should not get here
14720   }
14721   catch(...)
14722   {
14723     DALI_TEST_CHECK(true); // We expect an assert
14724   }
14725   END_TEST;
14726 }
14727
14728 int UtcDaliAnimationGetDurationNegative(void)
14729 {
14730   TestApplication application;
14731   Dali::Animation instance;
14732   try
14733   {
14734     instance.GetDuration();
14735     DALI_TEST_CHECK(false); // Should not get here
14736   }
14737   catch(...)
14738   {
14739     DALI_TEST_CHECK(true); // We expect an assert
14740   }
14741   END_TEST;
14742 }
14743
14744 int UtcDaliAnimationGetEndActionNegative(void)
14745 {
14746   TestApplication application;
14747   Dali::Animation instance;
14748   try
14749   {
14750     instance.GetEndAction();
14751     DALI_TEST_CHECK(false); // Should not get here
14752   }
14753   catch(...)
14754   {
14755     DALI_TEST_CHECK(true); // We expect an assert
14756   }
14757   END_TEST;
14758 }
14759
14760 int UtcDaliAnimationGetPlayRangeNegative(void)
14761 {
14762   TestApplication application;
14763   Dali::Animation instance;
14764   try
14765   {
14766     instance.GetPlayRange();
14767     DALI_TEST_CHECK(false); // Should not get here
14768   }
14769   catch(...)
14770   {
14771     DALI_TEST_CHECK(true); // We expect an assert
14772   }
14773   END_TEST;
14774 }
14775
14776 int UtcDaliAnimationGetLoopingModeNegative(void)
14777 {
14778   TestApplication application;
14779   Dali::Animation instance;
14780   try
14781   {
14782     instance.GetLoopingMode();
14783     DALI_TEST_CHECK(false); // Should not get here
14784   }
14785   catch(...)
14786   {
14787     DALI_TEST_CHECK(true); // We expect an assert
14788   }
14789   END_TEST;
14790 }
14791
14792 int UtcDaliAnimationGetSpeedFactorNegative(void)
14793 {
14794   TestApplication application;
14795   Dali::Animation instance;
14796   try
14797   {
14798     instance.GetSpeedFactor();
14799     DALI_TEST_CHECK(false); // Should not get here
14800   }
14801   catch(...)
14802   {
14803     DALI_TEST_CHECK(true); // We expect an assert
14804   }
14805   END_TEST;
14806 }
14807
14808 int UtcDaliAnimationGetDisconnectActionNegative(void)
14809 {
14810   TestApplication application;
14811   Dali::Animation instance;
14812   try
14813   {
14814     instance.GetDisconnectAction();
14815     DALI_TEST_CHECK(false); // Should not get here
14816   }
14817   catch(...)
14818   {
14819     DALI_TEST_CHECK(true); // We expect an assert
14820   }
14821   END_TEST;
14822 }
14823
14824 int UtcDaliAnimationGetDefaultAlphaFunctionNegative(void)
14825 {
14826   TestApplication application;
14827   Dali::Animation instance;
14828   try
14829   {
14830     instance.GetDefaultAlphaFunction();
14831     DALI_TEST_CHECK(false); // Should not get here
14832   }
14833   catch(...)
14834   {
14835     DALI_TEST_CHECK(true); // We expect an assert
14836   }
14837   END_TEST;
14838 }
14839
14840 int UtcDaliAnimationGetStateNegative(void)
14841 {
14842   TestApplication application;
14843   Dali::Animation instance;
14844   try
14845   {
14846     instance.GetState();
14847     DALI_TEST_CHECK(false); // Should not get here
14848   }
14849   catch(...)
14850   {
14851     DALI_TEST_CHECK(true); // We expect an assert
14852   }
14853   END_TEST;
14854 }
14855
14856 int UtcDaliAnimationIsLoopingNegative(void)
14857 {
14858   TestApplication application;
14859   Dali::Animation instance;
14860   try
14861   {
14862     instance.IsLooping();
14863     DALI_TEST_CHECK(false); // Should not get here
14864   }
14865   catch(...)
14866   {
14867     DALI_TEST_CHECK(true); // We expect an assert
14868   }
14869   END_TEST;
14870 }
14871
14872 int UtcDaliKeyFramesAddNegative01(void)
14873 {
14874   TestApplication application;
14875   Dali::KeyFrames instance;
14876   try
14877   {
14878     float                 arg1(0.0f);
14879     Dali::Property::Value arg2;
14880     instance.Add(arg1, arg2);
14881     DALI_TEST_CHECK(false); // Should not get here
14882   }
14883   catch(...)
14884   {
14885     DALI_TEST_CHECK(true); // We expect an assert
14886   }
14887   END_TEST;
14888 }
14889
14890 int UtcDaliKeyFramesAddNegative02(void)
14891 {
14892   TestApplication application;
14893   Dali::KeyFrames instance;
14894   try
14895   {
14896     float                 arg1(0.0f);
14897     Dali::Property::Value arg2;
14898     Dali::AlphaFunction   arg3;
14899     instance.Add(arg1, arg2, arg3);
14900     DALI_TEST_CHECK(false); // Should not get here
14901   }
14902   catch(...)
14903   {
14904     DALI_TEST_CHECK(true); // We expect an assert
14905   }
14906   END_TEST;
14907 }
14908
14909 int UtcDaliKeyFramesGetTypeNegative(void)
14910 {
14911   TestApplication application;
14912   Dali::KeyFrames instance;
14913   try
14914   {
14915     instance.GetType();
14916     DALI_TEST_CHECK(false); // Should not get here
14917   }
14918   catch(...)
14919   {
14920     DALI_TEST_CHECK(true); // We expect an assert
14921   }
14922   END_TEST;
14923 }