Fix some keyframes devel api crash issue
[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 UtcDaliAnimationStopEmitFinishedSignalImmediateP(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   bool                 signalReceived(false);
3188   AnimationFinishCheck finishCheck(signalReceived);
3189   animation.FinishedSignal().Connect(&application, finishCheck);
3190
3191   // Play
3192   {
3193     tet_printf("Play and Stop immediately\n");
3194     // Start the animation, and stop immediately.
3195     animation.Play();
3196     animation.Stop();
3197
3198     finishCheck.CheckSignalNotReceived();
3199
3200     application.SendNotification();
3201     application.Render(0);
3202
3203     // expect finished signal recieved due to Stop API.
3204     application.SendNotification();
3205     finishCheck.CheckSignalReceived();
3206     finishCheck.Reset();
3207
3208     application.SendNotification();
3209     application.Render(0);
3210   }
3211   // Play multiple times
3212   {
3213     tet_printf("Play and Stop immediately 2\n");
3214     // Start the animation, and stop immediately.
3215     animation.Play();
3216     animation.Stop();
3217     animation.Play();
3218     animation.Stop();
3219     animation.Play();
3220     animation.Play();
3221     animation.Stop();
3222
3223     finishCheck.CheckSignalNotReceived();
3224
3225     application.SendNotification();
3226     application.Render(0);
3227
3228     // expect finished signal recieved due to Stop API.
3229     application.SendNotification();
3230     finishCheck.CheckSignalReceived();
3231     finishCheck.Reset();
3232
3233     application.SendNotification();
3234     application.Render(0);
3235   }
3236   // PlayAfter
3237   {
3238     tet_printf("PlayAfter and Stop immediately\n");
3239     // Start the animation, and stop immediately.
3240     animation.PlayAfter(1.0f);
3241     animation.Stop();
3242
3243     finishCheck.CheckSignalNotReceived();
3244
3245     application.SendNotification();
3246     application.Render(0);
3247
3248     // expect finished signal recieved due to Stop API.
3249     application.SendNotification();
3250     finishCheck.CheckSignalReceived();
3251     finishCheck.Reset();
3252
3253     application.SendNotification();
3254     application.Render(0);
3255   }
3256   // PlayFrom
3257   {
3258     tet_printf("PlayFrom and Stop immediately\n");
3259     // Start the animation, and stop immediately.
3260     animation.PlayFrom(0.5f);
3261     animation.Stop();
3262
3263     finishCheck.CheckSignalNotReceived();
3264
3265     application.SendNotification();
3266     application.Render(0);
3267
3268     // expect finished signal recieved due to Stop API.
3269     application.SendNotification();
3270     finishCheck.CheckSignalReceived();
3271     finishCheck.Reset();
3272
3273     application.SendNotification();
3274     application.Render(0);
3275   }
3276   // Play and Pause
3277   {
3278     tet_printf("Play and Pause and Stop immediately\n");
3279     // Pause the animation, and stop immediately.
3280     animation.Play();
3281     animation.Pause();
3282     animation.Stop();
3283
3284     finishCheck.CheckSignalNotReceived();
3285
3286     application.SendNotification();
3287     application.Render(0);
3288
3289     // expect finished signal recieved due to Stop API.
3290     application.SendNotification();
3291     finishCheck.CheckSignalReceived();
3292     finishCheck.Reset();
3293
3294     application.SendNotification();
3295     application.Render(0);
3296   }
3297
3298   // Check finished signal not emmited if animation was not play state.
3299   {
3300     tet_printf("Check whether stop-only case didnt send finished signal\n");
3301     // Stop only.
3302     animation.Stop();
3303     animation.Stop();
3304     animation.Stop();
3305
3306     finishCheck.CheckSignalNotReceived();
3307
3308     application.SendNotification();
3309     application.Render(0);
3310
3311     // expect finished signal recieved due to Stop API.
3312     application.SendNotification();
3313     finishCheck.CheckSignalNotReceived();
3314     finishCheck.Reset();
3315
3316     application.SendNotification();
3317     application.Render(0);
3318   }
3319   {
3320     tet_printf("Check whether pause-stop case didnt send finished signal\n");
3321     // Pause and Stop.
3322     animation.Pause();
3323     animation.Stop();
3324
3325     finishCheck.CheckSignalNotReceived();
3326
3327     application.SendNotification();
3328     application.Render(0);
3329
3330     // expect finished signal recieved due to Stop API.
3331     application.SendNotification();
3332     finishCheck.CheckSignalNotReceived();
3333     finishCheck.Reset();
3334
3335     application.SendNotification();
3336     application.Render(0);
3337   }
3338
3339   END_TEST;
3340 }
3341
3342 int UtcDaliAnimationClearP(void)
3343 {
3344   TestApplication application;
3345
3346   Actor actor = Actor::New();
3347   application.GetScene().Add(actor);
3348
3349   // Build the animation
3350   float     durationSeconds(1.0f);
3351   Animation animation = Animation::New(durationSeconds);
3352   Vector3   targetPosition(100.0f, 100.0f, 100.0f);
3353   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
3354
3355   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
3356
3357   // Start the animation
3358   animation.Play();
3359
3360   bool                 signalReceived(false);
3361   AnimationFinishCheck finishCheck(signalReceived);
3362   animation.FinishedSignal().Connect(&application, finishCheck);
3363
3364   application.SendNotification();
3365   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3366
3367   // We didn't expect the animation to finish yet
3368   application.SendNotification();
3369   finishCheck.CheckSignalNotReceived();
3370   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
3371
3372   // Clear the animation
3373   animation.Clear();
3374   application.SendNotification();
3375
3376   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
3377
3378   // We don't expect the animation to finish now
3379   application.SendNotification();
3380   finishCheck.CheckSignalNotReceived();
3381   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress since the animator was destroyed */, TEST_LOCATION);
3382
3383   // Restart as a scale animation; this should not move the actor's position
3384   finishCheck.Reset();
3385   actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO);
3386   Vector3 targetScale(3.0f, 3.0f, 3.0f);
3387   animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR);
3388   animation.Play();
3389
3390   application.SendNotification();
3391   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3392
3393   // We didn't expect the animation to finish yet
3394   application.SendNotification();
3395   finishCheck.CheckSignalNotReceived();
3396   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO /*Check move-animator was destroyed*/, TEST_LOCATION);
3397   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION);
3398
3399   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
3400
3401   // We did expect the animation to finish
3402   application.SendNotification();
3403   finishCheck.CheckSignalReceived();
3404   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO /*Check move-animator was destroyed*/, TEST_LOCATION);
3405   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
3406   END_TEST;
3407 }
3408
3409 int UtcDaliAnimationFinishedSignalP(void)
3410 {
3411   TestApplication application;
3412
3413   // Start the empty animation
3414   float     durationSeconds(1.0f);
3415   Animation animation = Animation::New(durationSeconds);
3416   animation.Play();
3417
3418   bool                 signalReceived(false);
3419   AnimationFinishCheck finishCheck(signalReceived);
3420   animation.FinishedSignal().Connect(&application, finishCheck);
3421
3422   application.SendNotification();
3423   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*beyond the animation duration*/);
3424
3425   // We did expect the animation to finish
3426   application.SendNotification();
3427   finishCheck.CheckSignalReceived();
3428   END_TEST;
3429 }
3430
3431 int UtcDaliAnimationAnimateByBooleanP(void)
3432 {
3433   TestApplication application;
3434
3435   Actor actor = Actor::New();
3436
3437   // Register a boolean property
3438   bool            startValue(false);
3439   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3440   application.GetScene().Add(actor);
3441   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3442   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3443
3444   // Build the animation
3445   float      durationSeconds(2.0f);
3446   Animation  animation = Animation::New(durationSeconds);
3447   const bool relativeValue(true);
3448   const bool finalValue(false || relativeValue);
3449   animation.AnimateBy(Property(actor, index), relativeValue);
3450
3451   // Start the animation
3452   animation.Play();
3453
3454   // Target value should be retrievable straight away
3455   DALI_TEST_EQUALS(actor.GetProperty<bool>(index), finalValue, TEST_LOCATION);
3456
3457   bool                 signalReceived(false);
3458   AnimationFinishCheck finishCheck(signalReceived);
3459   animation.FinishedSignal().Connect(&application, finishCheck);
3460
3461   application.SendNotification();
3462   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3463
3464   // We didn't expect the animation to finish yet
3465   application.SendNotification();
3466   finishCheck.CheckSignalNotReceived();
3467   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3468
3469   application.SendNotification();
3470   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3471
3472   // We did expect the animation to finish
3473   application.SendNotification();
3474   finishCheck.CheckSignalReceived();
3475   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3476
3477   // Check that nothing has changed after a couple of buffer swaps
3478   application.Render(0);
3479   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3480   application.Render(0);
3481   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3482
3483   // Repeat with relative value "false" - this should be an NOOP
3484   animation = Animation::New(durationSeconds);
3485   bool noOpValue(false);
3486   animation.AnimateBy(Property(actor, index), noOpValue);
3487
3488   // Start the animation
3489   animation.Play();
3490
3491   finishCheck.Reset();
3492   animation.FinishedSignal().Connect(&application, finishCheck);
3493
3494   application.SendNotification();
3495   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3496
3497   // We didn't expect the animation to finish yet
3498   application.SendNotification();
3499   finishCheck.CheckSignalNotReceived();
3500   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3501
3502   application.SendNotification();
3503   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3504
3505   // We did expect the animation to finish
3506   application.SendNotification();
3507   finishCheck.CheckSignalReceived();
3508   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3509
3510   // Check that nothing has changed after a couple of buffer swaps
3511   application.Render(0);
3512   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3513   application.Render(0);
3514   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3515   END_TEST;
3516 }
3517
3518 int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void)
3519 {
3520   TestApplication application;
3521
3522   Actor actor = Actor::New();
3523
3524   // Register a boolean property
3525   bool            startValue(false);
3526   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3527   application.GetScene().Add(actor);
3528   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3529   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3530
3531   // Build the animation
3532   float     durationSeconds(2.0f);
3533   Animation animation = Animation::New(durationSeconds);
3534   bool      relativeValue(true);
3535   bool      finalValue(false || relativeValue);
3536   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN);
3537
3538   // Start the animation
3539   animation.Play();
3540
3541   bool                 signalReceived(false);
3542   AnimationFinishCheck finishCheck(signalReceived);
3543   animation.FinishedSignal().Connect(&application, finishCheck);
3544
3545   application.SendNotification();
3546   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3547
3548   // We didn't expect the animation to finish yet
3549   application.SendNotification();
3550   finishCheck.CheckSignalNotReceived();
3551   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3552
3553   application.SendNotification();
3554   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3555
3556   // We did expect the animation to finish
3557   application.SendNotification();
3558   finishCheck.CheckSignalReceived();
3559   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3560
3561   // Check that nothing has changed after a couple of buffer swaps
3562   application.Render(0);
3563   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3564   application.Render(0);
3565   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3566
3567   // Repeat with relative value "false" - this should be an NOOP
3568   animation = Animation::New(durationSeconds);
3569   bool noOpValue(false);
3570   animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunction::EASE_IN);
3571
3572   // Start the animation
3573   animation.Play();
3574
3575   finishCheck.Reset();
3576   animation.FinishedSignal().Connect(&application, finishCheck);
3577
3578   application.SendNotification();
3579   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3580
3581   // We didn't expect the animation to finish yet
3582   application.SendNotification();
3583   finishCheck.CheckSignalNotReceived();
3584   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3585
3586   application.SendNotification();
3587   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3588
3589   // We did expect the animation to finish
3590   application.SendNotification();
3591   finishCheck.CheckSignalReceived();
3592   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3593   END_TEST;
3594 }
3595
3596 int UtcDaliAnimationAnimateByBooleanTimePeriodP(void)
3597 {
3598   TestApplication application;
3599
3600   Actor actor = Actor::New();
3601
3602   // Register a boolean property
3603   bool            startValue(false);
3604   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3605   application.GetScene().Add(actor);
3606   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3607   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3608
3609   // Build the animation
3610   float     durationSeconds(2.0f);
3611   Animation animation = Animation::New(durationSeconds);
3612   bool      relativeValue(true);
3613   bool      finalValue(false || relativeValue);
3614   float     animatorDurationSeconds(durationSeconds * 0.5f);
3615   animation.AnimateBy(Property(actor, index),
3616                       relativeValue,
3617                       TimePeriod(animatorDurationSeconds));
3618
3619   // Start the animation
3620   animation.Play();
3621
3622   bool                 signalReceived(false);
3623   AnimationFinishCheck finishCheck(signalReceived);
3624   animation.FinishedSignal().Connect(&application, finishCheck);
3625
3626   application.SendNotification();
3627   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
3628
3629   // We didn't expect the animation to finish yet
3630   application.SendNotification();
3631   finishCheck.CheckSignalNotReceived();
3632   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3633
3634   application.SendNotification();
3635   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
3636
3637   // We didn't expect the animation to finish yet...
3638   application.SendNotification();
3639   finishCheck.CheckSignalNotReceived();
3640
3641   // ...however we should have reached the final value
3642   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3643
3644   application.SendNotification();
3645   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
3646
3647   // We did expect the animation to finish
3648   application.SendNotification();
3649   finishCheck.CheckSignalReceived();
3650   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3651
3652   // Check that nothing has changed after a couple of buffer swaps
3653   application.Render(0);
3654   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3655   application.Render(0);
3656   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3657   END_TEST;
3658 }
3659
3660 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void)
3661 {
3662   TestApplication application;
3663
3664   Actor actor = Actor::New();
3665
3666   // Register a boolean property
3667   bool            startValue(false);
3668   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3669   application.GetScene().Add(actor);
3670   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3671   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3672
3673   // Build the animation
3674   float     durationSeconds(2.0f);
3675   Animation animation = Animation::New(durationSeconds);
3676   bool      relativeValue(true);
3677   bool      finalValue(false || relativeValue);
3678   float     animatorDurationSeconds(durationSeconds * 0.5f);
3679   animation.AnimateBy(Property(actor, index),
3680                       relativeValue,
3681                       AlphaFunction::EASE_IN_OUT,
3682                       TimePeriod(animatorDurationSeconds));
3683
3684   // Start the animation
3685   animation.Play();
3686
3687   bool                 signalReceived(false);
3688   AnimationFinishCheck finishCheck(signalReceived);
3689   animation.FinishedSignal().Connect(&application, finishCheck);
3690
3691   application.SendNotification();
3692   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
3693
3694   // We didn't expect the animation to finish yet
3695   application.SendNotification();
3696   finishCheck.CheckSignalNotReceived();
3697   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3698
3699   application.SendNotification();
3700   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
3701
3702   // We didn't expect the animation to finish yet...
3703   application.SendNotification();
3704   finishCheck.CheckSignalNotReceived();
3705
3706   // ...however we should have reached the final value
3707   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3708
3709   application.SendNotification();
3710   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
3711
3712   // We did expect the animation to finish
3713   application.SendNotification();
3714   finishCheck.CheckSignalReceived();
3715   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3716
3717   // Check that nothing has changed after a couple of buffer swaps
3718   application.Render(0);
3719   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3720   application.Render(0);
3721   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3722   END_TEST;
3723 }
3724
3725 int UtcDaliAnimationAnimateByFloatP(void)
3726 {
3727   TestApplication application;
3728
3729   Actor actor = Actor::New();
3730
3731   // Register a float property
3732   float           startValue(10.0f);
3733   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3734   application.GetScene().Add(actor);
3735   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3736   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3737
3738   // Build the animation
3739   float     durationSeconds(2.0f);
3740   Animation animation = Animation::New(durationSeconds);
3741   float     targetValue(50.0f);
3742   float     relativeValue(targetValue - startValue);
3743   animation.AnimateBy(Property(actor, index), relativeValue);
3744
3745   float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
3746
3747   // Start the animation
3748   animation.Play();
3749
3750   // Target value should be retrievable straight away
3751   DALI_TEST_EQUALS(actor.GetProperty<float>(index), targetValue, TEST_LOCATION);
3752
3753   bool                 signalReceived(false);
3754   AnimationFinishCheck finishCheck(signalReceived);
3755   animation.FinishedSignal().Connect(&application, finishCheck);
3756
3757   application.SendNotification();
3758   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3759
3760   // We didn't expect the animation to finish yet
3761   application.SendNotification();
3762   finishCheck.CheckSignalNotReceived();
3763   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION);
3764
3765   application.SendNotification();
3766   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3767
3768   // We did expect the animation to finish
3769   application.SendNotification();
3770   finishCheck.CheckSignalReceived();
3771   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3772
3773   // Check that nothing has changed after a couple of buffer swaps
3774   application.Render(0);
3775   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3776   application.Render(0);
3777   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3778   END_TEST;
3779 }
3780
3781 int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void)
3782 {
3783   TestApplication application;
3784
3785   Actor actor = Actor::New();
3786
3787   // Register a float property
3788   float           startValue(10.0f);
3789   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3790   application.GetScene().Add(actor);
3791   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3792   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3793
3794   // Build the animation
3795   float     durationSeconds(1.0f);
3796   Animation animation = Animation::New(durationSeconds);
3797   float     targetValue(90.0f);
3798   float     relativeValue(targetValue - startValue);
3799   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3800
3801   float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
3802
3803   // Start the animation
3804   animation.Play();
3805
3806   bool                 signalReceived(false);
3807   AnimationFinishCheck finishCheck(signalReceived);
3808   animation.FinishedSignal().Connect(&application, finishCheck);
3809
3810   application.SendNotification();
3811   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3812
3813   // We didn't expect the animation to finish yet
3814   application.SendNotification();
3815   finishCheck.CheckSignalNotReceived();
3816
3817   // The position should have moved more, than with a linear alpha function
3818   float current(actor.GetCurrentProperty<float>(index));
3819   DALI_TEST_CHECK(current > ninetyFivePercentProgress);
3820
3821   application.SendNotification();
3822   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3823
3824   // We did expect the animation to finish
3825   application.SendNotification();
3826   finishCheck.CheckSignalReceived();
3827   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3828
3829   // Check that nothing has changed after a couple of buffer swaps
3830   application.Render(0);
3831   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3832   application.Render(0);
3833   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3834   END_TEST;
3835 }
3836
3837 int UtcDaliAnimationAnimateByFloatTimePeriodP(void)
3838 {
3839   TestApplication application;
3840
3841   Actor actor = Actor::New();
3842
3843   // Register a float property
3844   float           startValue(10.0f);
3845   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3846   application.GetScene().Add(actor);
3847   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3848   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3849
3850   // Build the animation
3851   float     durationSeconds(1.0f);
3852   Animation animation = Animation::New(durationSeconds);
3853   float     targetValue(30.0f);
3854   float     relativeValue(targetValue - startValue);
3855   float     delay = 0.5f;
3856   animation.AnimateBy(Property(actor, index),
3857                       relativeValue,
3858                       TimePeriod(delay, durationSeconds - delay));
3859
3860   // Start the animation
3861   animation.Play();
3862
3863   bool                 signalReceived(false);
3864   AnimationFinishCheck finishCheck(signalReceived);
3865   animation.FinishedSignal().Connect(&application, finishCheck);
3866
3867   application.SendNotification();
3868   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
3869
3870   // We didn't expect the animation to finish yet
3871   application.SendNotification();
3872   finishCheck.CheckSignalNotReceived();
3873   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3874
3875   application.SendNotification();
3876   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
3877
3878   // We didn't expect the animation to finish yet
3879   application.SendNotification();
3880   finishCheck.CheckSignalNotReceived();
3881   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
3882
3883   application.SendNotification();
3884   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
3885
3886   // We did expect the animation to finish
3887   application.SendNotification();
3888   finishCheck.CheckSignalReceived();
3889   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3890
3891   // Check that nothing has changed after a couple of buffer swaps
3892   application.Render(0);
3893   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3894   application.Render(0);
3895   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3896   END_TEST;
3897 }
3898
3899 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void)
3900 {
3901   TestApplication application;
3902
3903   Actor actor = Actor::New();
3904
3905   // Register a float property
3906   float           startValue(10.0f);
3907   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3908   application.GetScene().Add(actor);
3909   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3910   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3911
3912   // Build the animation
3913   float     durationSeconds(1.0f);
3914   Animation animation = Animation::New(durationSeconds);
3915   float     targetValue(30.0f);
3916   float     relativeValue(targetValue - startValue);
3917   float     delay = 0.5f;
3918   animation.AnimateBy(Property(actor, index),
3919                       relativeValue,
3920                       AlphaFunction::LINEAR,
3921                       TimePeriod(delay, durationSeconds - delay));
3922
3923   // Start the animation
3924   animation.Play();
3925
3926   bool                 signalReceived(false);
3927   AnimationFinishCheck finishCheck(signalReceived);
3928   animation.FinishedSignal().Connect(&application, finishCheck);
3929
3930   application.SendNotification();
3931   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
3932
3933   // We didn't expect the animation to finish yet
3934   application.SendNotification();
3935   finishCheck.CheckSignalNotReceived();
3936   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3937
3938   application.SendNotification();
3939   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
3940
3941   // We didn't expect the animation to finish yet
3942   application.SendNotification();
3943   finishCheck.CheckSignalNotReceived();
3944   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
3945
3946   application.SendNotification();
3947   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
3948
3949   // We did expect the animation to finish
3950   application.SendNotification();
3951   finishCheck.CheckSignalReceived();
3952   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3953
3954   // Check that nothing has changed after a couple of buffer swaps
3955   application.Render(0);
3956   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3957   application.Render(0);
3958   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3959   END_TEST;
3960 }
3961
3962 int UtcDaliAnimationAnimateByIntegerP(void)
3963 {
3964   TestApplication application;
3965
3966   Actor actor = Actor::New();
3967
3968   // Register an integer property
3969   int             startValue(1);
3970   Property::Index index = actor.RegisterProperty("testProperty", startValue);
3971   application.GetScene().Add(actor);
3972   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
3973   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3974
3975   // Build the animation
3976   float     durationSeconds(2.0f);
3977   Animation animation = Animation::New(durationSeconds);
3978   int       targetValue(50);
3979   int       relativeValue(targetValue - startValue);
3980   animation.AnimateBy(Property(actor, index), relativeValue);
3981
3982   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
3983
3984   // Start the animation
3985   animation.Play();
3986
3987   // Target value should be retrievable straight away
3988   DALI_TEST_EQUALS(actor.GetProperty<int>(index), targetValue, TEST_LOCATION);
3989
3990   bool                 signalReceived(false);
3991   AnimationFinishCheck finishCheck(signalReceived);
3992   animation.FinishedSignal().Connect(&application, finishCheck);
3993
3994   application.SendNotification();
3995   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3996
3997   // We didn't expect the animation to finish yet
3998   application.SendNotification();
3999   finishCheck.CheckSignalNotReceived();
4000   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION);
4001
4002   application.SendNotification();
4003   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4004
4005   // We did expect the animation to finish
4006   application.SendNotification();
4007   finishCheck.CheckSignalReceived();
4008   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4009
4010   // Check that nothing has changed after a couple of buffer swaps
4011   application.Render(0);
4012   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4013   application.Render(0);
4014   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4015   END_TEST;
4016 }
4017
4018 int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void)
4019 {
4020   TestApplication application;
4021
4022   Actor actor = Actor::New();
4023
4024   // Register an integer property
4025   int             startValue(1);
4026   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4027   application.GetScene().Add(actor);
4028   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
4029   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
4030
4031   // Build the animation
4032   float     durationSeconds(1.0f);
4033   Animation animation = Animation::New(durationSeconds);
4034   int       targetValue(90);
4035   int       relativeValue(targetValue - startValue);
4036   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4037
4038   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
4039
4040   // Start the animation
4041   animation.Play();
4042
4043   bool                 signalReceived(false);
4044   AnimationFinishCheck finishCheck(signalReceived);
4045   animation.FinishedSignal().Connect(&application, finishCheck);
4046
4047   application.SendNotification();
4048   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4049
4050   // We didn't expect the animation to finish yet
4051   application.SendNotification();
4052   finishCheck.CheckSignalNotReceived();
4053
4054   // The position should have moved more, than with a linear alpha function
4055   int current(actor.GetCurrentProperty<int>(index));
4056   DALI_TEST_CHECK(current > ninetyFivePercentProgress);
4057
4058   application.SendNotification();
4059   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4060
4061   // We did expect the animation to finish
4062   application.SendNotification();
4063   finishCheck.CheckSignalReceived();
4064   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4065
4066   // Check that nothing has changed after a couple of buffer swaps
4067   application.Render(0);
4068   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4069   application.Render(0);
4070   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4071   END_TEST;
4072 }
4073
4074 int UtcDaliAnimationAnimateByIntegerTimePeriodP(void)
4075 {
4076   TestApplication application;
4077
4078   Actor actor = Actor::New();
4079
4080   // Register an integer property
4081   int             startValue(10);
4082   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4083   application.GetScene().Add(actor);
4084   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
4085   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
4086
4087   // Build the animation
4088   float     durationSeconds(1.0f);
4089   Animation animation = Animation::New(durationSeconds);
4090   int       targetValue(30);
4091   int       relativeValue(targetValue - startValue);
4092   float     delay = 0.5f;
4093   animation.AnimateBy(Property(actor, index),
4094                       relativeValue,
4095                       TimePeriod(delay, durationSeconds - delay));
4096
4097   // Start the animation
4098   animation.Play();
4099
4100   bool                 signalReceived(false);
4101   AnimationFinishCheck finishCheck(signalReceived);
4102   animation.FinishedSignal().Connect(&application, finishCheck);
4103
4104   application.SendNotification();
4105   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4106
4107   // We didn't expect the animation to finish yet
4108   application.SendNotification();
4109   finishCheck.CheckSignalNotReceived();
4110   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
4111
4112   application.SendNotification();
4113   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4114
4115   // We didn't expect the animation to finish yet
4116   application.SendNotification();
4117   finishCheck.CheckSignalNotReceived();
4118   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
4119
4120   application.SendNotification();
4121   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4122
4123   // We did expect the animation to finish
4124   application.SendNotification();
4125   finishCheck.CheckSignalReceived();
4126   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4127
4128   // Check that nothing has changed after a couple of buffer swaps
4129   application.Render(0);
4130   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4131   application.Render(0);
4132   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4133   END_TEST;
4134 }
4135
4136 int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void)
4137 {
4138   TestApplication application;
4139
4140   Actor actor = Actor::New();
4141
4142   // Register an integer property
4143   int             startValue(10);
4144   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4145   application.GetScene().Add(actor);
4146   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
4147   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
4148
4149   // Build the animation
4150   float     durationSeconds(1.0f);
4151   Animation animation = Animation::New(durationSeconds);
4152   int       targetValue(30);
4153   int       relativeValue(targetValue - startValue);
4154   float     delay = 0.5f;
4155   animation.AnimateBy(Property(actor, index),
4156                       relativeValue,
4157                       AlphaFunction::LINEAR,
4158                       TimePeriod(delay, durationSeconds - delay));
4159
4160   // Start the animation
4161   animation.Play();
4162
4163   bool                 signalReceived(false);
4164   AnimationFinishCheck finishCheck(signalReceived);
4165   animation.FinishedSignal().Connect(&application, finishCheck);
4166
4167   application.SendNotification();
4168   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4169
4170   // We didn't expect the animation to finish yet
4171   application.SendNotification();
4172   finishCheck.CheckSignalNotReceived();
4173   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
4174
4175   application.SendNotification();
4176   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4177
4178   // We didn't expect the animation to finish yet
4179   application.SendNotification();
4180   finishCheck.CheckSignalNotReceived();
4181   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
4182
4183   application.SendNotification();
4184   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4185
4186   // We did expect the animation to finish
4187   application.SendNotification();
4188   finishCheck.CheckSignalReceived();
4189   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4190
4191   // Check that nothing has changed after a couple of buffer swaps
4192   application.Render(0);
4193   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4194   application.Render(0);
4195   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4196   END_TEST;
4197 }
4198
4199 int UtcDaliAnimationAnimateByQuaternionP(void)
4200 {
4201   TestApplication application;
4202
4203   Actor actor = Actor::New();
4204
4205   // Register a quaternion property
4206   const Quaternion startValue(Degree(90), Vector3::XAXIS);
4207   Property::Index  index = actor.RegisterProperty("testProperty", startValue);
4208   application.GetScene().Add(actor);
4209   DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == startValue);
4210   DALI_TEST_CHECK(actor.GetCurrentProperty<Quaternion>(index) == startValue);
4211
4212   // Build the animation
4213   float            durationSeconds(2.0f);
4214   Animation        animation = Animation::New(durationSeconds);
4215   const Quaternion relativeValue(Degree(90), Vector3::ZAXIS);
4216   const Quaternion finalValue(startValue * relativeValue);
4217   animation.AnimateBy(Property(actor, index), relativeValue);
4218
4219   DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == startValue);
4220   DALI_TEST_CHECK(actor.GetCurrentProperty<Quaternion>(index) == startValue);
4221
4222   // Start the animation
4223   animation.Play();
4224
4225   // Target value should be retrievable straight away
4226   DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == finalValue);
4227
4228   application.SendNotification();
4229   application.Render(2000); // animation complete
4230
4231   DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == finalValue);
4232   DALI_TEST_CHECK(actor.GetCurrentProperty<Quaternion>(index) == finalValue);
4233
4234   END_TEST;
4235 }
4236
4237 int UtcDaliAnimationAnimateByVector2P(void)
4238 {
4239   TestApplication application;
4240
4241   Actor actor = Actor::New();
4242
4243   // Register a Vector2 property
4244   Vector2         startValue(10.0f, 10.0f);
4245   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4246   application.GetScene().Add(actor);
4247   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4248   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4249
4250   // Build the animation
4251   float     durationSeconds(2.0f);
4252   Animation animation = Animation::New(durationSeconds);
4253   Vector2   targetValue(60.0f, 60.0f);
4254   Vector2   relativeValue(targetValue - startValue);
4255   animation.AnimateBy(Property(actor, index), relativeValue);
4256
4257   Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4258
4259   // Start the animation
4260   animation.Play();
4261
4262   // Target value should be retrievable straight away
4263   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION);
4264
4265   bool                 signalReceived(false);
4266   AnimationFinishCheck finishCheck(signalReceived);
4267   animation.FinishedSignal().Connect(&application, finishCheck);
4268
4269   application.SendNotification();
4270   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4271
4272   // We didn't expect the animation to finish yet
4273   application.SendNotification();
4274   finishCheck.CheckSignalNotReceived();
4275   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION);
4276
4277   application.SendNotification();
4278   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4279
4280   // We did expect the animation to finish
4281   application.SendNotification();
4282   finishCheck.CheckSignalReceived();
4283   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4284
4285   // Check that nothing has changed after a couple of buffer swaps
4286   application.Render(0);
4287   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4288   application.Render(0);
4289   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4290   END_TEST;
4291 }
4292
4293 int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void)
4294 {
4295   TestApplication application;
4296
4297   Actor actor = Actor::New();
4298
4299   // Register a Vector2 property
4300   Vector2         startValue(100.0f, 100.0f);
4301   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4302   application.GetScene().Add(actor);
4303   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4304   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4305
4306   // Build the animation
4307   float     durationSeconds(1.0f);
4308   Animation animation = Animation::New(durationSeconds);
4309   Vector2   targetValue(20.0f, 20.0f);
4310   Vector2   relativeValue(targetValue - startValue);
4311   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4312
4313   Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4314
4315   // Start the animation
4316   animation.Play();
4317
4318   bool                 signalReceived(false);
4319   AnimationFinishCheck finishCheck(signalReceived);
4320   animation.FinishedSignal().Connect(&application, finishCheck);
4321
4322   application.SendNotification();
4323   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4324
4325   // We didn't expect the animation to finish yet
4326   application.SendNotification();
4327   finishCheck.CheckSignalNotReceived();
4328
4329   // The position should have moved more, than with a linear alpha function
4330   Vector2 current(actor.GetCurrentProperty<Vector2>(index));
4331   DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x);
4332   DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y);
4333
4334   application.SendNotification();
4335   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4336
4337   // We did expect the animation to finish
4338   application.SendNotification();
4339   finishCheck.CheckSignalReceived();
4340   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4341
4342   // Check that nothing has changed after a couple of buffer swaps
4343   application.Render(0);
4344   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4345   application.Render(0);
4346   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4347   END_TEST;
4348 }
4349
4350 int UtcDaliAnimationAnimateByVector2TimePeriodP(void)
4351 {
4352   TestApplication application;
4353
4354   Actor actor = Actor::New();
4355
4356   // Register a Vector2 property
4357   Vector2         startValue(10.0f, 10.0f);
4358   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4359   application.GetScene().Add(actor);
4360   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4361   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4362
4363   // Build the animation
4364   float     durationSeconds(1.0f);
4365   Animation animation = Animation::New(durationSeconds);
4366   Vector2   targetValue(30.0f, 30.0f);
4367   Vector2   relativeValue(targetValue - startValue);
4368   float     delay = 0.5f;
4369   animation.AnimateBy(Property(actor, index),
4370                       relativeValue,
4371                       TimePeriod(delay, durationSeconds - delay));
4372
4373   // Start the animation
4374   animation.Play();
4375
4376   bool                 signalReceived(false);
4377   AnimationFinishCheck finishCheck(signalReceived);
4378   animation.FinishedSignal().Connect(&application, finishCheck);
4379
4380   application.SendNotification();
4381   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4382
4383   // We didn't expect the animation to finish yet
4384   application.SendNotification();
4385   finishCheck.CheckSignalNotReceived();
4386   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4387
4388   application.SendNotification();
4389   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4390
4391   // We didn't expect the animation to finish yet
4392   application.SendNotification();
4393   finishCheck.CheckSignalNotReceived();
4394   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4395
4396   application.SendNotification();
4397   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4398
4399   // We did expect the animation to finish
4400   application.SendNotification();
4401   finishCheck.CheckSignalReceived();
4402   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4403
4404   // Check that nothing has changed after a couple of buffer swaps
4405   application.Render(0);
4406   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4407   application.Render(0);
4408   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4409   END_TEST;
4410 }
4411
4412 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void)
4413 {
4414   TestApplication application;
4415
4416   Actor actor = Actor::New();
4417
4418   // Register a Vector2 property
4419   Vector2         startValue(5.0f, 5.0f);
4420   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4421   application.GetScene().Add(actor);
4422   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4423   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4424
4425   // Build the animation
4426   float     durationSeconds(1.0f);
4427   Animation animation = Animation::New(durationSeconds);
4428   Vector2   targetValue(10.0f, 10.0f);
4429   Vector2   relativeValue(targetValue - startValue);
4430   float     delay = 0.5f;
4431   animation.AnimateBy(Property(actor, index),
4432                       relativeValue,
4433                       AlphaFunction::LINEAR,
4434                       TimePeriod(delay, durationSeconds - delay));
4435
4436   // Start the animation
4437   animation.Play();
4438
4439   bool                 signalReceived(false);
4440   AnimationFinishCheck finishCheck(signalReceived);
4441   animation.FinishedSignal().Connect(&application, finishCheck);
4442
4443   application.SendNotification();
4444   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4445
4446   // We didn't expect the animation to finish yet
4447   application.SendNotification();
4448   finishCheck.CheckSignalNotReceived();
4449   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4450
4451   application.SendNotification();
4452   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% 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<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4458
4459   application.SendNotification();
4460   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4461
4462   // We did expect the animation to finish
4463   application.SendNotification();
4464   finishCheck.CheckSignalReceived();
4465   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4466
4467   // Check that nothing has changed after a couple of buffer swaps
4468   application.Render(0);
4469   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4470   application.Render(0);
4471   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4472   END_TEST;
4473 }
4474
4475 int UtcDaliAnimationAnimateByVector3P(void)
4476 {
4477   TestApplication application;
4478
4479   Actor actor = Actor::New();
4480
4481   // Register a Vector3 property
4482   Vector3         startValue(10.0f, 10.0f, 10.0f);
4483   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4484   application.GetScene().Add(actor);
4485   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4486   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4487
4488   // Build the animation
4489   float     durationSeconds(2.0f);
4490   Animation animation = Animation::New(durationSeconds);
4491   Vector3   targetValue(60.0f, 60.0f, 60.0f);
4492   Vector3   relativeValue(targetValue - startValue);
4493   animation.AnimateBy(Property(actor, index), relativeValue);
4494
4495   Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4496
4497   // Start the animation
4498   animation.Play();
4499
4500   // Target value should be retrievable straight away
4501   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION);
4502
4503   bool                 signalReceived(false);
4504   AnimationFinishCheck finishCheck(signalReceived);
4505   animation.FinishedSignal().Connect(&application, finishCheck);
4506
4507   application.SendNotification();
4508   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4509
4510   // We didn't expect the animation to finish yet
4511   application.SendNotification();
4512   finishCheck.CheckSignalNotReceived();
4513   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION);
4514
4515   application.SendNotification();
4516   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4517
4518   // We did expect the animation to finish
4519   application.SendNotification();
4520   finishCheck.CheckSignalReceived();
4521   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4522
4523   // Check that nothing has changed after a couple of buffer swaps
4524   application.Render(0);
4525   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4526   application.Render(0);
4527   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4528   END_TEST;
4529 }
4530
4531 int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void)
4532 {
4533   TestApplication application;
4534
4535   Actor actor = Actor::New();
4536
4537   // Register a Vector3 property
4538   Vector3         startValue(100.0f, 100.0f, 100.0f);
4539   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4540   application.GetScene().Add(actor);
4541   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4542   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4543
4544   // Build the animation
4545   float     durationSeconds(1.0f);
4546   Animation animation = Animation::New(durationSeconds);
4547   Vector3   targetValue(20.0f, 20.0f, 20.0f);
4548   Vector3   relativeValue(targetValue - startValue);
4549   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4550
4551   Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4552
4553   // Start the animation
4554   animation.Play();
4555
4556   bool                 signalReceived(false);
4557   AnimationFinishCheck finishCheck(signalReceived);
4558   animation.FinishedSignal().Connect(&application, finishCheck);
4559
4560   application.SendNotification();
4561   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4562
4563   // We didn't expect the animation to finish yet
4564   application.SendNotification();
4565   finishCheck.CheckSignalNotReceived();
4566
4567   // The position should have moved more, than with a linear alpha function
4568   Vector3 current(actor.GetCurrentProperty<Vector3>(index));
4569   DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x);
4570   DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y);
4571   DALI_TEST_CHECK(current.z < ninetyFivePercentProgress.z);
4572
4573   application.SendNotification();
4574   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4575
4576   // We did expect the animation to finish
4577   application.SendNotification();
4578   finishCheck.CheckSignalReceived();
4579   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4580
4581   // Check that nothing has changed after a couple of buffer swaps
4582   application.Render(0);
4583   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4584   application.Render(0);
4585   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4586   END_TEST;
4587 }
4588
4589 int UtcDaliAnimationAnimateByVector3TimePeriodP(void)
4590 {
4591   TestApplication application;
4592
4593   Actor actor = Actor::New();
4594
4595   // Register a Vector3 property
4596   Vector3         startValue(10.0f, 10.0f, 10.0f);
4597   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4598   application.GetScene().Add(actor);
4599   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4600   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4601
4602   // Build the animation
4603   float     durationSeconds(1.0f);
4604   Animation animation = Animation::New(durationSeconds);
4605   Vector3   targetValue(30.0f, 30.0f, 30.0f);
4606   Vector3   relativeValue(targetValue - startValue);
4607   float     delay = 0.5f;
4608   animation.AnimateBy(Property(actor, index),
4609                       relativeValue,
4610                       TimePeriod(delay, durationSeconds - delay));
4611
4612   // Start the animation
4613   animation.Play();
4614
4615   bool                 signalReceived(false);
4616   AnimationFinishCheck finishCheck(signalReceived);
4617   animation.FinishedSignal().Connect(&application, finishCheck);
4618
4619   application.SendNotification();
4620   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4621
4622   // We didn't expect the animation to finish yet
4623   application.SendNotification();
4624   finishCheck.CheckSignalNotReceived();
4625   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4626
4627   application.SendNotification();
4628   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4629
4630   // We didn't expect the animation to finish yet
4631   application.SendNotification();
4632   finishCheck.CheckSignalNotReceived();
4633   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4634
4635   application.SendNotification();
4636   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4637
4638   // We did expect the animation to finish
4639   application.SendNotification();
4640   finishCheck.CheckSignalReceived();
4641   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4642
4643   // Check that nothing has changed after a couple of buffer swaps
4644   application.Render(0);
4645   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4646   application.Render(0);
4647   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4648   END_TEST;
4649 }
4650
4651 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void)
4652 {
4653   TestApplication application;
4654
4655   Actor actor = Actor::New();
4656
4657   // Register a Vector3 property
4658   Vector3         startValue(5.0f, 5.0f, 5.0f);
4659   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4660   application.GetScene().Add(actor);
4661   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4662   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4663
4664   // Build the animation
4665   float     durationSeconds(1.0f);
4666   Animation animation = Animation::New(durationSeconds);
4667   Vector3   targetValue(10.0f, 10.0f, 10.0f);
4668   Vector3   relativeValue(targetValue - startValue);
4669   float     delay = 0.5f;
4670   animation.AnimateBy(Property(actor, index),
4671                       relativeValue,
4672                       AlphaFunction::LINEAR,
4673                       TimePeriod(delay, durationSeconds - delay));
4674
4675   // Start the animation
4676   animation.Play();
4677
4678   bool                 signalReceived(false);
4679   AnimationFinishCheck finishCheck(signalReceived);
4680   animation.FinishedSignal().Connect(&application, finishCheck);
4681
4682   application.SendNotification();
4683   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4684
4685   // We didn't expect the animation to finish yet
4686   application.SendNotification();
4687   finishCheck.CheckSignalNotReceived();
4688   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4689
4690   application.SendNotification();
4691   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4692
4693   // We didn't expect the animation to finish yet
4694   application.SendNotification();
4695   finishCheck.CheckSignalNotReceived();
4696   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4697
4698   application.SendNotification();
4699   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4700
4701   // We did expect the animation to finish
4702   application.SendNotification();
4703   finishCheck.CheckSignalReceived();
4704   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4705
4706   // Check that nothing has changed after a couple of buffer swaps
4707   application.Render(0);
4708   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4709   application.Render(0);
4710   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4711   END_TEST;
4712 }
4713
4714 int UtcDaliAnimationAnimateByVector4P(void)
4715 {
4716   TestApplication application;
4717
4718   Actor actor = Actor::New();
4719
4720   // Register a Vector4 property
4721   Vector4         startValue(10.0f, 10.0f, 10.0f, 10.0f);
4722   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4723   application.GetScene().Add(actor);
4724   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4725   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4726
4727   // Build the animation
4728   float     durationSeconds(2.0f);
4729   Animation animation = Animation::New(durationSeconds);
4730   Vector4   targetValue(60.0f, 60.0f, 60.0f, 60.0f);
4731   Vector4   relativeValue(targetValue - startValue);
4732   animation.AnimateBy(Property(actor, index), relativeValue);
4733
4734   Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4735
4736   // Start the animation
4737   animation.Play();
4738
4739   // Target value should be retrievable straight away
4740   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION);
4741
4742   bool                 signalReceived(false);
4743   AnimationFinishCheck finishCheck(signalReceived);
4744   animation.FinishedSignal().Connect(&application, finishCheck);
4745
4746   application.SendNotification();
4747   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4748
4749   // We didn't expect the animation to finish yet
4750   application.SendNotification();
4751   finishCheck.CheckSignalNotReceived();
4752   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION);
4753
4754   application.SendNotification();
4755   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4756
4757   // We did expect the animation to finish
4758   application.SendNotification();
4759   finishCheck.CheckSignalReceived();
4760   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4761
4762   // Check that nothing has changed after a couple of buffer swaps
4763   application.Render(0);
4764   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4765   application.Render(0);
4766   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4767   END_TEST;
4768 }
4769
4770 int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void)
4771 {
4772   TestApplication application;
4773
4774   Actor actor = Actor::New();
4775
4776   // Register a Vector4 property
4777   Vector4         startValue(100.0f, 100.0f, 100.0f, 100.0f);
4778   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4779   application.GetScene().Add(actor);
4780   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4781   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4782
4783   // Build the animation
4784   float     durationSeconds(1.0f);
4785   Animation animation = Animation::New(durationSeconds);
4786   Vector4   targetValue(20.0f, 20.0f, 20.0f, 20.0f);
4787   Vector4   relativeValue(targetValue - startValue);
4788   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4789
4790   Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4791
4792   // Start the animation
4793   animation.Play();
4794
4795   bool                 signalReceived(false);
4796   AnimationFinishCheck finishCheck(signalReceived);
4797   animation.FinishedSignal().Connect(&application, finishCheck);
4798
4799   application.SendNotification();
4800   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4801
4802   // We didn't expect the animation to finish yet
4803   application.SendNotification();
4804   finishCheck.CheckSignalNotReceived();
4805
4806   // The position should have moved more, than with a linear alpha function
4807   Vector4 current(actor.GetCurrentProperty<Vector4>(index));
4808   DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x);
4809   DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y);
4810   DALI_TEST_CHECK(current.z < ninetyFivePercentProgress.z);
4811   DALI_TEST_CHECK(current.w < ninetyFivePercentProgress.w);
4812
4813   application.SendNotification();
4814   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4815
4816   // We did expect the animation to finish
4817   application.SendNotification();
4818   finishCheck.CheckSignalReceived();
4819   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4820
4821   // Check that nothing has changed after a couple of buffer swaps
4822   application.Render(0);
4823   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4824   application.Render(0);
4825   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4826   END_TEST;
4827 }
4828
4829 int UtcDaliAnimationAnimateByVector4TimePeriodP(void)
4830 {
4831   TestApplication application;
4832
4833   Actor actor = Actor::New();
4834
4835   // Register a Vector4 property
4836   Vector4         startValue(10.0f, 10.0f, 10.0f, 10.0f);
4837   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4838   application.GetScene().Add(actor);
4839   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4840   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4841
4842   // Build the animation
4843   float     durationSeconds(1.0f);
4844   Animation animation = Animation::New(durationSeconds);
4845   Vector4   targetValue(30.0f, 30.0f, 30.0f, 30.0f);
4846   Vector4   relativeValue(targetValue - startValue);
4847   float     delay = 0.5f;
4848   animation.AnimateBy(Property(actor, index),
4849                       relativeValue,
4850                       TimePeriod(delay, durationSeconds - delay));
4851
4852   // Start the animation
4853   animation.Play();
4854
4855   bool                 signalReceived(false);
4856   AnimationFinishCheck finishCheck(signalReceived);
4857   animation.FinishedSignal().Connect(&application, finishCheck);
4858
4859   application.SendNotification();
4860   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4861
4862   // We didn't expect the animation to finish yet
4863   application.SendNotification();
4864   finishCheck.CheckSignalNotReceived();
4865   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4866
4867   application.SendNotification();
4868   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4869
4870   // We didn't expect the animation to finish yet
4871   application.SendNotification();
4872   finishCheck.CheckSignalNotReceived();
4873   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4874
4875   application.SendNotification();
4876   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4877
4878   // We did expect the animation to finish
4879   application.SendNotification();
4880   finishCheck.CheckSignalReceived();
4881   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4882
4883   // Check that nothing has changed after a couple of buffer swaps
4884   application.Render(0);
4885   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4886   application.Render(0);
4887   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4888   END_TEST;
4889 }
4890
4891 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void)
4892 {
4893   TestApplication application;
4894
4895   Actor actor = Actor::New();
4896
4897   // Register a Vector4 property
4898   Vector4         startValue(5.0f, 5.0f, 5.0f, 5.0f);
4899   Property::Index index = actor.RegisterProperty("testProperty", startValue);
4900   application.GetScene().Add(actor);
4901   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4902   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4903
4904   // Build the animation
4905   float     durationSeconds(1.0f);
4906   Animation animation = Animation::New(durationSeconds);
4907   Vector4   targetValue(10.0f, 10.0f, 10.0f, 10.0f);
4908   Vector4   relativeValue(targetValue - startValue);
4909   float     delay = 0.5f;
4910   animation.AnimateBy(Property(actor, index),
4911                       relativeValue,
4912                       AlphaFunction::LINEAR,
4913                       TimePeriod(delay, durationSeconds - delay));
4914
4915   // Start the animation
4916   animation.Play();
4917
4918   bool                 signalReceived(false);
4919   AnimationFinishCheck finishCheck(signalReceived);
4920   animation.FinishedSignal().Connect(&application, finishCheck);
4921
4922   application.SendNotification();
4923   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4924
4925   // We didn't expect the animation to finish yet
4926   application.SendNotification();
4927   finishCheck.CheckSignalNotReceived();
4928   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4929
4930   application.SendNotification();
4931   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4932
4933   // We didn't expect the animation to finish yet
4934   application.SendNotification();
4935   finishCheck.CheckSignalNotReceived();
4936   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4937
4938   application.SendNotification();
4939   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4940
4941   // We did expect the animation to finish
4942   application.SendNotification();
4943   finishCheck.CheckSignalReceived();
4944   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4945
4946   // Check that nothing has changed after a couple of buffer swaps
4947   application.Render(0);
4948   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4949   application.Render(0);
4950   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4951   END_TEST;
4952 }
4953
4954 int UtcDaliAnimationAnimateByActorPositionP(void)
4955 {
4956   TestApplication application;
4957
4958   Actor   actor = Actor::New();
4959   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4960   actor.SetProperty(Actor::Property::POSITION, startPosition);
4961   application.GetScene().Add(actor);
4962   application.SendNotification();
4963   application.Render(0);
4964   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4965
4966   // Build the animation
4967   float     durationSeconds(1.0f);
4968   Animation animation = Animation::New(durationSeconds);
4969   Vector3   targetPosition(20.0f, 20.0f, 20.0f);
4970   Vector3   relativePosition(targetPosition - startPosition);
4971   animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition);
4972
4973   Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
4974
4975   // Start the animation
4976   animation.Play();
4977
4978   // Target value should be retrievable straight away
4979   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4980
4981   bool                 signalReceived(false);
4982   AnimationFinishCheck finishCheck(signalReceived);
4983   animation.FinishedSignal().Connect(&application, finishCheck);
4984
4985   application.SendNotification();
4986   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4987
4988   // We didn't expect the animation to finish yet
4989   application.SendNotification();
4990   finishCheck.CheckSignalNotReceived();
4991   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), ninetyFivePercentProgress, TEST_LOCATION);
4992
4993   application.SendNotification();
4994   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4995
4996   // We did expect the animation to finish
4997   application.SendNotification();
4998   finishCheck.CheckSignalReceived();
4999   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5000
5001   // Check that nothing has changed after a couple of buffer swaps
5002   application.Render(0);
5003   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5004   application.Render(0);
5005   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5006   END_TEST;
5007 }
5008
5009 int UtcDaliAnimationAnimateByActorPositionComponentsP(void)
5010 {
5011   TestApplication application;
5012
5013   Actor actor = Actor::New();
5014   application.GetScene().Add(actor);
5015   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
5016
5017   // Build the animation
5018   float     durationSeconds(1.0f);
5019   Animation animation = Animation::New(durationSeconds);
5020   Vector3   targetPosition(200.0f, 300.0f, 400.0f);
5021   Vector3   relativePosition(targetPosition - Vector3::ZERO);
5022   animation.AnimateBy(Property(actor, Actor::Property::POSITION_X), relativePosition.x);
5023   animation.AnimateBy(Property(actor, Actor::Property::POSITION_Y), relativePosition.y);
5024   animation.AnimateBy(Property(actor, Actor::Property::POSITION_Z), relativePosition.z);
5025
5026   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
5027   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
5028
5029   // Start the animation
5030   animation.Play();
5031
5032   // Target value should be retrievable straight away
5033   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5034   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
5035   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
5036   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
5037
5038   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); // Not changed yet
5039
5040   application.SendNotification();
5041   application.Render(1000); // 1 second progress
5042
5043   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5044
5045   END_TEST;
5046 }
5047
5048 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
5049 {
5050   TestApplication application;
5051
5052   Actor   actor = Actor::New();
5053   Vector3 startPosition(10.0f, 10.0f, 10.0f);
5054   actor.SetProperty(Actor::Property::POSITION, startPosition);
5055   application.GetScene().Add(actor);
5056   application.SendNotification();
5057   application.Render(0);
5058   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
5059
5060   // Build the animation
5061   float     durationSeconds(1.0f);
5062   Animation animation = Animation::New(durationSeconds);
5063   Vector3   targetPosition(20.0f, 20.0f, 20.0f);
5064   Vector3   relativePosition(targetPosition - startPosition);
5065   animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
5066
5067   Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
5068
5069   // Start the animation
5070   animation.Play();
5071
5072   bool                 signalReceived(false);
5073   AnimationFinishCheck finishCheck(signalReceived);
5074   animation.FinishedSignal().Connect(&application, finishCheck);
5075
5076   application.SendNotification();
5077   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5078
5079   // We didn't expect the animation to finish yet
5080   application.SendNotification();
5081   finishCheck.CheckSignalNotReceived();
5082
5083   // The position should have moved more, than with a linear alpha function
5084   Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
5085   DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
5086   DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
5087   DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z);
5088
5089   application.SendNotification();
5090   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5091
5092   // We did expect the animation to finish
5093   application.SendNotification();
5094   finishCheck.CheckSignalReceived();
5095   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5096
5097   // Check that nothing has changed after a couple of buffer swaps
5098   application.Render(0);
5099   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5100   application.Render(0);
5101   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5102   END_TEST;
5103 }
5104
5105 int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void)
5106 {
5107   TestApplication application;
5108
5109   Actor   actor = Actor::New();
5110   Vector3 startPosition(10.0f, 10.0f, 10.0f);
5111   actor.SetProperty(Actor::Property::POSITION, startPosition);
5112   application.GetScene().Add(actor);
5113   application.SendNotification();
5114   application.Render(0);
5115   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
5116
5117   // Build the animation
5118   float     durationSeconds(1.0f);
5119   Animation animation = Animation::New(durationSeconds);
5120   Vector3   targetPosition(20.0f, 20.0f, 20.0f);
5121   Vector3   relativePosition(targetPosition - startPosition);
5122   float     delay = 0.5f;
5123   animation.AnimateBy(Property(actor, Actor::Property::POSITION),
5124                       relativePosition,
5125                       TimePeriod(delay, durationSeconds - delay));
5126
5127   Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
5128
5129   // Start the animation
5130   animation.Play();
5131
5132   bool                 signalReceived(false);
5133   AnimationFinishCheck finishCheck(signalReceived);
5134   animation.FinishedSignal().Connect(&application, finishCheck);
5135
5136   application.SendNotification();
5137   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
5138
5139   // We didn't expect the animation to finish yet
5140   application.SendNotification();
5141   finishCheck.CheckSignalNotReceived();
5142   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
5143
5144   application.SendNotification();
5145   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
5146
5147   // We did expect the animation to finish
5148   application.SendNotification();
5149   finishCheck.CheckSignalReceived();
5150   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5151
5152   // Check that nothing has changed after a couple of buffer swaps
5153   application.Render(0);
5154   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5155   application.Render(0);
5156   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5157   END_TEST;
5158 }
5159
5160 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void)
5161 {
5162   TestApplication application;
5163
5164   Actor   actor = Actor::New();
5165   Vector3 startPosition(10.0f, 10.0f, 10.0f);
5166   actor.SetProperty(Actor::Property::POSITION, startPosition);
5167   application.GetScene().Add(actor);
5168   application.SendNotification();
5169   application.Render(0);
5170   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
5171
5172   // Build the animation
5173   float     durationSeconds(1.0f);
5174   Animation animation = Animation::New(durationSeconds);
5175   Vector3   targetPosition(20.0f, 20.0f, 20.0f);
5176   Vector3   relativePosition(targetPosition - startPosition);
5177   float     delay = 0.5f;
5178   animation.AnimateBy(Property(actor, Actor::Property::POSITION),
5179                       relativePosition,
5180                       AlphaFunction::LINEAR,
5181                       TimePeriod(delay, durationSeconds - delay));
5182
5183   Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
5184
5185   // Start the animation
5186   animation.Play();
5187
5188   bool                 signalReceived(false);
5189   AnimationFinishCheck finishCheck(signalReceived);
5190   animation.FinishedSignal().Connect(&application, finishCheck);
5191
5192   application.SendNotification();
5193   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
5194
5195   // We didn't expect the animation to finish yet
5196   application.SendNotification();
5197   finishCheck.CheckSignalNotReceived();
5198   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
5199
5200   application.SendNotification();
5201   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
5202
5203   // We did expect the animation to finish
5204   application.SendNotification();
5205   finishCheck.CheckSignalReceived();
5206   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5207
5208   // Check that nothing has changed after a couple of buffer swaps
5209   application.Render(0);
5210   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5211   application.Render(0);
5212   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5213   END_TEST;
5214 }
5215
5216 int UtcDaliAnimationAnimateByActorOrientationP1(void)
5217 {
5218   TestApplication application;
5219
5220   Actor actor = Actor::New();
5221   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
5222   application.GetScene().Add(actor);
5223   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5224
5225   // Build the animation
5226   float     durationSeconds(1.0f);
5227   Animation animation = Animation::New(durationSeconds);
5228   Degree    relativeRotationDegrees(360.0f);
5229   Radian    relativeRotationRadians(relativeRotationDegrees);
5230   animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS));
5231
5232   // Start the animation
5233   animation.Play();
5234
5235   // Target value should be retrievable straight away
5236   DALI_TEST_EQUALS(actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), TEST_LOCATION);
5237
5238   bool                 signalReceived(false);
5239   AnimationFinishCheck finishCheck(signalReceived);
5240   animation.FinishedSignal().Connect(&application, finishCheck);
5241
5242   application.SendNotification();
5243   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5244
5245   // We didn't expect the animation to finish yet
5246   application.SendNotification();
5247   finishCheck.CheckSignalNotReceived();
5248   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5249
5250   application.SendNotification();
5251   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5252
5253   // We didn't expect the animation to finish yet
5254   application.SendNotification();
5255   finishCheck.CheckSignalNotReceived();
5256   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5257
5258   application.SendNotification();
5259   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5260
5261   // We didn't expect the animation to finish yet
5262   application.SendNotification();
5263   finishCheck.CheckSignalNotReceived();
5264   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5265
5266   application.SendNotification();
5267   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5268
5269   // We did expect the animation to finish
5270   application.SendNotification();
5271   finishCheck.CheckSignalReceived();
5272   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5273   END_TEST;
5274 }
5275
5276 int UtcDaliAnimationAnimateByActorOrientationP2(void)
5277 {
5278   TestApplication application;
5279
5280   tet_printf("Testing that rotation angle > 360 performs full rotations\n");
5281
5282   Actor actor = Actor::New();
5283   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::ZAXIS));
5284   application.GetScene().Add(actor);
5285   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5286
5287   // Build the animation
5288   float     durationSeconds(1.0f);
5289   Animation animation = Animation::New(durationSeconds);
5290   Degree    relativeRotationDegrees(710.0f);
5291   Radian    relativeRotationRadians(relativeRotationDegrees);
5292
5293   animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), AngleAxis(relativeRotationRadians, Vector3::ZAXIS));
5294
5295   // Start the animation
5296   animation.Play();
5297
5298   bool                 signalReceived(false);
5299   AnimationFinishCheck finishCheck(signalReceived);
5300   animation.FinishedSignal().Connect(&application, finishCheck);
5301
5302   application.SendNotification();
5303   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5304
5305   // We didn't expect the animation to finish yet
5306   application.SendNotification();
5307   finishCheck.CheckSignalNotReceived();
5308   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5309
5310   application.SendNotification();
5311   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5312
5313   // We didn't expect the animation to finish yet
5314   application.SendNotification();
5315   finishCheck.CheckSignalNotReceived();
5316   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5317
5318   application.SendNotification();
5319   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5320
5321   // We didn't expect the animation to finish yet
5322   application.SendNotification();
5323   finishCheck.CheckSignalNotReceived();
5324   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5325
5326   application.SendNotification();
5327   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5328
5329   // We did expect the animation to finish
5330   application.SendNotification();
5331   finishCheck.CheckSignalReceived();
5332   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5333   END_TEST;
5334 }
5335
5336 int UtcDaliAnimationAnimateByActorOrientationP3(void)
5337 {
5338   TestApplication application;
5339
5340   tet_printf("Testing that rotation angle > 360 performs partial rotations when cast to Quaternion\n");
5341
5342   Actor actor = Actor::New();
5343   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::ZAXIS));
5344   application.GetScene().Add(actor);
5345   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5346
5347   // Build the animation
5348   float     durationSeconds(1.0f);
5349   Animation animation = Animation::New(durationSeconds);
5350   Degree    relativeRotationDegrees(730.0f);
5351   Radian    relativeRotationRadians(relativeRotationDegrees);
5352
5353   Radian actualRotationRadians(Degree(10.0f));
5354
5355   animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS));
5356
5357   // Start the animation
5358   animation.Play();
5359
5360   bool                 signalReceived(false);
5361   AnimationFinishCheck finishCheck(signalReceived);
5362   animation.FinishedSignal().Connect(&application, finishCheck);
5363
5364   application.SendNotification();
5365   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5366
5367   // We didn't expect the animation to finish yet
5368   application.SendNotification();
5369   finishCheck.CheckSignalNotReceived();
5370   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5371
5372   application.SendNotification();
5373   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5374
5375   // We didn't expect the animation to finish yet
5376   application.SendNotification();
5377   finishCheck.CheckSignalNotReceived();
5378   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5379
5380   application.SendNotification();
5381   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5382
5383   // We didn't expect the animation to finish yet
5384   application.SendNotification();
5385   finishCheck.CheckSignalNotReceived();
5386   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5387
5388   application.SendNotification();
5389   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5390
5391   // We did expect the animation to finish
5392   application.SendNotification();
5393   finishCheck.CheckSignalReceived();
5394   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5395   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5396   END_TEST;
5397 }
5398
5399 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
5400 {
5401   TestApplication application;
5402
5403   Actor actor = Actor::New();
5404   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
5405   application.GetScene().Add(actor);
5406   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5407
5408   // Build the animation
5409   float     durationSeconds(1.0f);
5410   Animation animation = Animation::New(durationSeconds);
5411   Degree    relativeRotationDegrees(360.0f);
5412   Radian    relativeRotationRadians(relativeRotationDegrees);
5413   animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), AlphaFunction::EASE_IN);
5414
5415   // Start the animation
5416   animation.Play();
5417
5418   bool                 signalReceived(false);
5419   AnimationFinishCheck finishCheck(signalReceived);
5420   animation.FinishedSignal().Connect(&application, finishCheck);
5421
5422   application.SendNotification();
5423   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5424
5425   // We didn't expect the animation to finish yet
5426   application.SendNotification();
5427   finishCheck.CheckSignalNotReceived();
5428   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f * 0.25f * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5429
5430   application.SendNotification();
5431   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5432
5433   // We didn't expect the animation to finish yet
5434   application.SendNotification();
5435   finishCheck.CheckSignalNotReceived();
5436   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f * 0.5f * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5437
5438   application.SendNotification();
5439   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5440
5441   // We didn't expect the animation to finish yet
5442   application.SendNotification();
5443   finishCheck.CheckSignalNotReceived();
5444   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f * 0.75f * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5445
5446   application.SendNotification();
5447   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5448
5449   // We did expect the animation to finish
5450   application.SendNotification();
5451   finishCheck.CheckSignalReceived();
5452   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5453   END_TEST;
5454 }
5455
5456 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void)
5457 {
5458   TestApplication application;
5459
5460   Actor actor = Actor::New();
5461   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
5462   application.GetScene().Add(actor);
5463   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5464
5465   // Build the animation
5466   float     durationSeconds(1.0f);
5467   Animation animation = Animation::New(durationSeconds);
5468   Degree    relativeRotationDegrees(360.0f);
5469   Radian    relativeRotationRadians(relativeRotationDegrees);
5470   float     delay = 0.3f;
5471   animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
5472
5473   // Start the animation
5474   animation.Play();
5475
5476   bool                 signalReceived(false);
5477   AnimationFinishCheck finishCheck(signalReceived);
5478   animation.FinishedSignal().Connect(&application, finishCheck);
5479
5480   application.SendNotification();
5481   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5482
5483   // We didn't expect the animation to finish yet
5484   application.SendNotification();
5485   finishCheck.CheckSignalNotReceived();
5486   float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
5487   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5488
5489   application.SendNotification();
5490   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5491
5492   // We didn't expect the animation to finish yet
5493   application.SendNotification();
5494   finishCheck.CheckSignalNotReceived();
5495   progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
5496   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5497
5498   application.SendNotification();
5499   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5500
5501   // We didn't expect the animation to finish yet
5502   application.SendNotification();
5503   finishCheck.CheckSignalNotReceived();
5504   progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
5505   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5506
5507   application.SendNotification();
5508   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5509
5510   // We did expect the animation to finish
5511   application.SendNotification();
5512   finishCheck.CheckSignalReceived();
5513   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5514   END_TEST;
5515 }
5516
5517 int UtcDaliAnimationAnimateByActorScaleP(void)
5518 {
5519   TestApplication application;
5520
5521   Actor actor = Actor::New();
5522   application.GetScene().Add(actor);
5523   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5524
5525   // Build the animation
5526   float     durationSeconds(1.0f);
5527   Animation animation = Animation::New(durationSeconds);
5528   Vector3   targetScale(2.0f, 2.0f, 2.0f);
5529   Vector3   relativeScale(targetScale - Vector3::ONE);
5530   animation.AnimateBy(Property(actor, Actor::Property::SCALE), Vector3(relativeScale.x, relativeScale.y, relativeScale.z));
5531
5532   Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale * 0.99f);
5533
5534   // Start the animation
5535   animation.Play();
5536
5537   // Target value should be retrievable straight away
5538   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5539
5540   bool                 signalReceived(false);
5541   AnimationFinishCheck finishCheck(signalReceived);
5542   animation.FinishedSignal().Connect(&application, finishCheck);
5543
5544   application.SendNotification();
5545   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
5546
5547   // We didn't expect the animation to finish yet
5548   application.SendNotification();
5549   finishCheck.CheckSignalNotReceived();
5550   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), ninetyNinePercentProgress, TEST_LOCATION);
5551
5552   application.SendNotification();
5553   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
5554
5555   // We did expect the animation to finish
5556   application.SendNotification();
5557   finishCheck.CheckSignalReceived();
5558   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5559
5560   // Reset everything
5561   finishCheck.Reset();
5562   actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
5563   application.SendNotification();
5564   application.Render(0);
5565   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5566
5567   // Repeat with a different (ease-in) alpha function
5568   animation = Animation::New(durationSeconds);
5569   animation.AnimateBy(Property(actor, Actor::Property::SCALE), relativeScale, AlphaFunction::EASE_IN);
5570   animation.FinishedSignal().Connect(&application, finishCheck);
5571   animation.Play();
5572
5573   application.SendNotification();
5574   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
5575
5576   // We didn't expect the animation to finish yet
5577   application.SendNotification();
5578   finishCheck.CheckSignalNotReceived();
5579
5580   // The scale should have grown less, than with a linear alpha function
5581   Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
5582   DALI_TEST_CHECK(current.x > 1.0f);
5583   DALI_TEST_CHECK(current.y > 1.0f);
5584   DALI_TEST_CHECK(current.z > 1.0f);
5585   DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
5586   DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
5587   DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z);
5588
5589   application.SendNotification();
5590   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
5591
5592   // We did expect the animation to finish
5593   application.SendNotification();
5594   finishCheck.CheckSignalReceived();
5595   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5596
5597   // Reset everything
5598   finishCheck.Reset();
5599   actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
5600   application.SendNotification();
5601   application.Render(0);
5602   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5603
5604   // Repeat with a delay
5605   float delay = 0.5f;
5606   animation   = Animation::New(durationSeconds);
5607   animation.AnimateBy(Property(actor, Actor::Property::SCALE), relativeScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
5608   animation.FinishedSignal().Connect(&application, finishCheck);
5609   animation.Play();
5610
5611   application.SendNotification();
5612   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
5613
5614   // We didn't expect the animation to finish yet
5615   application.SendNotification();
5616   finishCheck.CheckSignalNotReceived();
5617   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5618
5619   application.SendNotification();
5620   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
5621
5622   // We did expect the animation to finish
5623   application.SendNotification();
5624   finishCheck.CheckSignalReceived();
5625   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5626   END_TEST;
5627 }
5628
5629 int UtcDaliAnimationAnimateByActorScaleComponentsP(void)
5630 {
5631   TestApplication application;
5632
5633   Actor actor = Actor::New();
5634   application.GetScene().Add(actor);
5635   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5636
5637   // Build the animation
5638   float     durationSeconds(1.0f);
5639   Animation animation = Animation::New(durationSeconds);
5640   Vector3   targetScale(2.0f, 3.0f, 4.0f);
5641   Vector3   relativeScale(targetScale - Vector3::ONE);
5642   animation.AnimateBy(Property(actor, Actor::Property::SCALE_X), relativeScale.x);
5643   animation.AnimateBy(Property(actor, Actor::Property::SCALE_Y), relativeScale.y);
5644   animation.AnimateBy(Property(actor, Actor::Property::SCALE_Z), relativeScale.z);
5645
5646   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5647   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5648
5649   // Start the animation
5650   animation.Play();
5651
5652   // Target value should be retrievable straight away
5653   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5654   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), targetScale.x, TEST_LOCATION);
5655   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), targetScale.y, TEST_LOCATION);
5656   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), targetScale.z, TEST_LOCATION);
5657
5658   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION); // Not changed yet
5659
5660   application.SendNotification();
5661   application.Render(1000); // 1 second progress
5662
5663   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5664
5665   END_TEST;
5666 }
5667
5668 int UtcDaliAnimationAnimateByActorColorP(void)
5669 {
5670   TestApplication application;
5671
5672   Actor actor = Actor::New();
5673   application.GetScene().Add(actor);
5674   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5675
5676   // Build the animation
5677   float     durationSeconds(1.0f);
5678   Animation animation = Animation::New(durationSeconds);
5679   Vector4   targetColor(0.5f, 0.75f, 0.8f, 0.1f);
5680   Vector4   relativeColor(targetColor - Color::WHITE);
5681   animation.AnimateBy(Property(actor, Actor::Property::COLOR), relativeColor);
5682
5683   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5684   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5685
5686   // Start the animation
5687   animation.Play();
5688
5689   // Target value should be retrievable straight away
5690   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5691   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION);
5692   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION);
5693   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION);
5694   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION);
5695
5696   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); // Not changed yet
5697
5698   application.SendNotification();
5699   application.Render(1000); // 1 second progress
5700
5701   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5702
5703   END_TEST;
5704 }
5705
5706 int UtcDaliAnimationAnimateByActorColorComponentsP(void)
5707 {
5708   TestApplication application;
5709
5710   Actor actor = Actor::New();
5711   application.GetScene().Add(actor);
5712   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5713
5714   // Build the animation
5715   float     durationSeconds(1.0f);
5716   Animation animation = Animation::New(durationSeconds);
5717   Vector4   targetColor(0.5f, 0.75f, 0.8f, 0.1f);
5718   Vector4   relativeColor(targetColor - Color::WHITE);
5719   animation.AnimateBy(Property(actor, Actor::Property::COLOR_RED), relativeColor.r);
5720   animation.AnimateBy(Property(actor, Actor::Property::COLOR_GREEN), relativeColor.g);
5721   animation.AnimateBy(Property(actor, Actor::Property::COLOR_BLUE), relativeColor.b);
5722   animation.AnimateBy(Property(actor, Actor::Property::COLOR_ALPHA), relativeColor.a);
5723
5724   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5725   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5726
5727   // Start the animation
5728   animation.Play();
5729
5730   // Target value should be retrievable straight away
5731   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5732   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION);
5733   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION);
5734   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION);
5735   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION);
5736
5737   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); // Not changed yet
5738
5739   application.SendNotification();
5740   application.Render(1000); // 1 second progress
5741
5742   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5743
5744   END_TEST;
5745 }
5746
5747 int UtcDaliAnimationAnimateByActorSizeP(void)
5748 {
5749   TestApplication application;
5750
5751   Actor actor = Actor::New();
5752   application.GetScene().Add(actor);
5753   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5754
5755   // Build the animation
5756   float     durationSeconds(1.0f);
5757   Animation animation = Animation::New(durationSeconds);
5758   Vector3   targetSize(100.0f, 200.0f, 300.0f);
5759   Vector3   relativeSize(targetSize - Vector3::ZERO);
5760   animation.AnimateBy(Property(actor, Actor::Property::SIZE), relativeSize);
5761
5762   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5763   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5764
5765   // Start the animation
5766   animation.Play();
5767
5768   // Target value should be retrievable straight away
5769   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5770   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION);
5771   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION);
5772   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION);
5773
5774   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Not changed yet
5775
5776   application.SendNotification();
5777   application.Render(1000); // 1 second progress
5778
5779   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5780
5781   END_TEST;
5782 }
5783
5784 int UtcDaliAnimationAnimateByActorSizeComponentsP(void)
5785 {
5786   TestApplication application;
5787
5788   Actor actor = Actor::New();
5789   application.GetScene().Add(actor);
5790   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5791
5792   // Build the animation
5793   float     durationSeconds(1.0f);
5794   Animation animation = Animation::New(durationSeconds);
5795   Vector3   targetSize(100.0f, 200.0f, 300.0f);
5796   Vector3   relativeSize(targetSize - Vector3::ZERO);
5797   animation.AnimateBy(Property(actor, Actor::Property::SIZE_WIDTH), relativeSize.width);
5798   animation.AnimateBy(Property(actor, Actor::Property::SIZE_HEIGHT), relativeSize.height);
5799   animation.AnimateBy(Property(actor, Actor::Property::SIZE_DEPTH), relativeSize.depth);
5800
5801   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5802   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5803
5804   // Start the animation
5805   animation.Play();
5806
5807   // Target value should be retrievable straight away
5808   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5809   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION);
5810   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION);
5811   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION);
5812
5813   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Not changed yet
5814
5815   application.SendNotification();
5816   application.Render(1000); // 1 second progress
5817
5818   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5819
5820   END_TEST;
5821 }
5822
5823 int UtcDaliAnimationAnimateByActorVisibilityP(void)
5824 {
5825   TestApplication application;
5826
5827   Actor actor = Actor::New();
5828   application.GetScene().Add(actor);
5829   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
5830
5831   actor.SetProperty(Actor::Property::VISIBLE, false);
5832
5833   application.SendNotification();
5834   application.Render();
5835
5836   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
5837
5838   // Build the animation
5839   float     durationSeconds(1.0f);
5840   Animation animation = Animation::New(durationSeconds);
5841   bool      targetVisibility(true);
5842   bool      relativeVisibility(targetVisibility);
5843   animation.AnimateBy(Property(actor, Actor::Property::VISIBLE), relativeVisibility);
5844
5845   DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
5846
5847   // Start the animation
5848   animation.Play();
5849
5850   // Target value should be retrievable straight away
5851   DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), targetVisibility, TEST_LOCATION);
5852   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION); // Not changed yet
5853
5854   application.SendNotification();
5855   application.Render(1000); // 1 second progress
5856
5857   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
5858
5859   END_TEST;
5860 }
5861
5862 int UtcDaliAnimationAnimateToBooleanP(void)
5863 {
5864   TestApplication application;
5865
5866   Actor actor = Actor::New();
5867
5868   // Register a boolean property
5869   const bool      startValue(false);
5870   Property::Index index = actor.RegisterProperty("testProperty", startValue);
5871   application.GetScene().Add(actor);
5872   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5873   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5874
5875   // Build the animation
5876   float      durationSeconds(2.0f);
5877   Animation  animation = Animation::New(durationSeconds);
5878   const bool targetValue(!startValue);
5879   animation.AnimateTo(Property(actor, index), targetValue);
5880
5881   // Start the animation
5882   animation.Play();
5883
5884   bool                 signalReceived(false);
5885   AnimationFinishCheck finishCheck(signalReceived);
5886   animation.FinishedSignal().Connect(&application, finishCheck);
5887
5888   application.SendNotification();
5889   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5890
5891   // We didn't expect the animation to finish yet
5892   application.SendNotification();
5893   finishCheck.CheckSignalNotReceived();
5894   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5895
5896   application.SendNotification();
5897   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5898
5899   // We did expect the animation to finish
5900   application.SendNotification();
5901   finishCheck.CheckSignalReceived();
5902   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5903
5904   // Check that nothing has changed after a couple of buffer swaps
5905   application.Render(0);
5906   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5907   application.Render(0);
5908   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5909
5910   // Repeat with target value "false"
5911   animation = Animation::New(durationSeconds);
5912   const bool finalValue(!targetValue);
5913   animation.AnimateTo(Property(actor, index), finalValue);
5914
5915   // Start the animation
5916   animation.Play();
5917
5918   finishCheck.Reset();
5919   animation.FinishedSignal().Connect(&application, finishCheck);
5920
5921   application.SendNotification();
5922   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5923
5924   // We didn't expect the animation to finish yet
5925   application.SendNotification();
5926   finishCheck.CheckSignalNotReceived();
5927   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5928
5929   application.SendNotification();
5930   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5931
5932   // We did expect the animation to finish
5933   application.SendNotification();
5934   finishCheck.CheckSignalReceived();
5935   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5936
5937   // Check that nothing has changed after a couple of buffer swaps
5938   application.Render(0);
5939   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5940   application.Render(0);
5941   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5942   END_TEST;
5943 }
5944
5945 int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void)
5946 {
5947   TestApplication application;
5948
5949   Actor actor = Actor::New();
5950
5951   // Register a boolean property
5952   const bool      startValue(false);
5953   Property::Index index = actor.RegisterProperty("testProperty", startValue);
5954   application.GetScene().Add(actor);
5955   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5956   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5957
5958   // Build the animation
5959   float      durationSeconds(2.0f);
5960   Animation  animation = Animation::New(durationSeconds);
5961   const bool targetValue(!startValue);
5962   animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
5963
5964   // Start the animation
5965   animation.Play();
5966
5967   bool                 signalReceived(false);
5968   AnimationFinishCheck finishCheck(signalReceived);
5969   animation.FinishedSignal().Connect(&application, finishCheck);
5970
5971   application.SendNotification();
5972   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5973
5974   // We didn't expect the animation to finish yet
5975   application.SendNotification();
5976   finishCheck.CheckSignalNotReceived();
5977   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5978
5979   application.SendNotification();
5980   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5981
5982   // We did expect the animation to finish
5983   application.SendNotification();
5984   finishCheck.CheckSignalReceived();
5985   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5986
5987   // Check that nothing has changed after a couple of buffer swaps
5988   application.Render(0);
5989   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5990   application.Render(0);
5991   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5992
5993   // Repeat with target value "false"
5994   animation = Animation::New(durationSeconds);
5995   const bool finalValue(!targetValue);
5996   animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
5997
5998   // Start the animation
5999   animation.Play();
6000
6001   finishCheck.Reset();
6002   animation.FinishedSignal().Connect(&application, finishCheck);
6003
6004   application.SendNotification();
6005   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6006
6007   // We didn't expect the animation to finish yet
6008   application.SendNotification();
6009   finishCheck.CheckSignalNotReceived();
6010   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
6011
6012   application.SendNotification();
6013   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6014
6015   // We did expect the animation to finish
6016   application.SendNotification();
6017   finishCheck.CheckSignalReceived();
6018   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
6019
6020   // Check that nothing has changed after a couple of buffer swaps
6021   application.Render(0);
6022   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
6023   application.Render(0);
6024   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
6025   END_TEST;
6026 }
6027
6028 int UtcDaliAnimationAnimateToBooleanTimePeriodP(void)
6029 {
6030   TestApplication application;
6031
6032   Actor actor = Actor::New();
6033
6034   // Register a boolean property
6035   bool            startValue(false);
6036   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6037   application.GetScene().Add(actor);
6038   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
6039   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
6040
6041   // Build the animation
6042   float     durationSeconds(2.0f);
6043   Animation animation = Animation::New(durationSeconds);
6044   bool      finalValue(!startValue);
6045   float     animatorDurationSeconds(durationSeconds * 0.5f);
6046   animation.AnimateTo(Property(actor, index),
6047                       finalValue,
6048                       TimePeriod(animatorDurationSeconds));
6049
6050   // Start the animation
6051   animation.Play();
6052
6053   bool                 signalReceived(false);
6054   AnimationFinishCheck finishCheck(signalReceived);
6055   animation.FinishedSignal().Connect(&application, finishCheck);
6056
6057   application.SendNotification();
6058   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
6059
6060   // We didn't expect the animation to finish yet
6061   application.SendNotification();
6062   finishCheck.CheckSignalNotReceived();
6063   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
6064
6065   application.SendNotification();
6066   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
6067
6068   // We didn't expect the animation to finish yet...
6069   application.SendNotification();
6070   finishCheck.CheckSignalNotReceived();
6071
6072   // ...however we should have reached the final value
6073   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
6074
6075   application.SendNotification();
6076   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
6077
6078   // We did expect the animation to finish
6079   application.SendNotification();
6080   finishCheck.CheckSignalReceived();
6081   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
6082
6083   // Check that nothing has changed after a couple of buffer swaps
6084   application.Render(0);
6085   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
6086   application.Render(0);
6087   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
6088   END_TEST;
6089 }
6090
6091 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void)
6092 {
6093   TestApplication application;
6094
6095   Actor actor = Actor::New();
6096
6097   // Register a boolean property
6098   bool            startValue(false);
6099   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6100   application.GetScene().Add(actor);
6101   DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
6102   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
6103
6104   // Build the animation
6105   float     durationSeconds(2.0f);
6106   Animation animation = Animation::New(durationSeconds);
6107   bool      finalValue(!startValue);
6108   float     animatorDurationSeconds(durationSeconds * 0.5f);
6109   animation.AnimateTo(Property(actor, index),
6110                       finalValue,
6111                       AlphaFunction::LINEAR,
6112                       TimePeriod(animatorDurationSeconds));
6113
6114   // Start the animation
6115   animation.Play();
6116
6117   bool                 signalReceived(false);
6118   AnimationFinishCheck finishCheck(signalReceived);
6119   animation.FinishedSignal().Connect(&application, finishCheck);
6120
6121   application.SendNotification();
6122   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
6123
6124   // We didn't expect the animation to finish yet
6125   application.SendNotification();
6126   finishCheck.CheckSignalNotReceived();
6127   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
6128
6129   application.SendNotification();
6130   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
6131
6132   // We didn't expect the animation to finish yet...
6133   application.SendNotification();
6134   finishCheck.CheckSignalNotReceived();
6135
6136   // ...however we should have reached the final value
6137   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
6138
6139   application.SendNotification();
6140   application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
6141
6142   // We did expect the animation to finish
6143   application.SendNotification();
6144   finishCheck.CheckSignalReceived();
6145   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
6146
6147   // Check that nothing has changed after a couple of buffer swaps
6148   application.Render(0);
6149   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
6150   application.Render(0);
6151   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
6152   END_TEST;
6153 }
6154
6155 int UtcDaliAnimationAnimateToFloatP(void)
6156 {
6157   TestApplication application;
6158
6159   Actor actor = Actor::New();
6160
6161   // Register a float property
6162   float           startValue(10.0f);
6163   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6164   application.GetScene().Add(actor);
6165   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
6166   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6167
6168   // Build the animation
6169   float     durationSeconds(2.0f);
6170   Animation animation = Animation::New(durationSeconds);
6171   float     targetValue(50.0f);
6172   float     relativeValue(targetValue - startValue);
6173   animation.AnimateTo(Property(actor, "testProperty"), targetValue);
6174
6175   float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6176
6177   // Start the animation
6178   animation.Play();
6179
6180   bool                 signalReceived(false);
6181   AnimationFinishCheck finishCheck(signalReceived);
6182   animation.FinishedSignal().Connect(&application, finishCheck);
6183
6184   application.SendNotification();
6185   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6186
6187   // We didn't expect the animation to finish yet
6188   application.SendNotification();
6189   finishCheck.CheckSignalNotReceived();
6190   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION);
6191
6192   application.SendNotification();
6193   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6194
6195   // We did expect the animation to finish
6196   application.SendNotification();
6197   finishCheck.CheckSignalReceived();
6198   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6199   END_TEST;
6200 }
6201
6202 int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void)
6203 {
6204   TestApplication application;
6205
6206   Actor actor = Actor::New();
6207
6208   // Register a float property
6209   float           startValue(10.0f);
6210   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6211   application.GetScene().Add(actor);
6212   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
6213   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6214
6215   // Build the animation
6216   float     durationSeconds(1.0f);
6217   Animation animation = Animation::New(durationSeconds);
6218   float     targetValue(90.0f);
6219   float     relativeValue(targetValue - startValue);
6220   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6221
6222   float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6223
6224   // Start the animation
6225   animation.Play();
6226
6227   bool                 signalReceived(false);
6228   AnimationFinishCheck finishCheck(signalReceived);
6229   animation.FinishedSignal().Connect(&application, finishCheck);
6230
6231   application.SendNotification();
6232   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6233
6234   // We didn't expect the animation to finish yet
6235   application.SendNotification();
6236   finishCheck.CheckSignalNotReceived();
6237
6238   // The position should have moved more, than with a linear alpha function
6239   float current(actor.GetCurrentProperty<float>(index));
6240   DALI_TEST_CHECK(current > ninetyFivePercentProgress);
6241
6242   application.SendNotification();
6243   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6244
6245   // We did expect the animation to finish
6246   application.SendNotification();
6247   finishCheck.CheckSignalReceived();
6248   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6249   END_TEST;
6250 }
6251
6252 int UtcDaliAnimationAnimateToFloatTimePeriodP(void)
6253 {
6254   TestApplication application;
6255
6256   Actor actor = Actor::New();
6257
6258   // Register a float property
6259   float           startValue(10.0f);
6260   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6261   application.GetScene().Add(actor);
6262   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
6263   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6264
6265   // Build the animation
6266   float     durationSeconds(1.0f);
6267   Animation animation = Animation::New(durationSeconds);
6268   float     targetValue(30.0f);
6269   float     relativeValue(targetValue - startValue);
6270   float     delay = 0.5f;
6271   animation.AnimateTo(Property(actor, index),
6272                       targetValue,
6273                       TimePeriod(delay, durationSeconds - delay));
6274
6275   // Start the animation
6276   animation.Play();
6277
6278   bool                 signalReceived(false);
6279   AnimationFinishCheck finishCheck(signalReceived);
6280   animation.FinishedSignal().Connect(&application, finishCheck);
6281
6282   application.SendNotification();
6283   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6284
6285   // We didn't expect the animation to finish yet
6286   application.SendNotification();
6287   finishCheck.CheckSignalNotReceived();
6288   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6289
6290   application.SendNotification();
6291   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6292
6293   // We didn't expect the animation to finish yet
6294   application.SendNotification();
6295   finishCheck.CheckSignalNotReceived();
6296   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6297
6298   application.SendNotification();
6299   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6300
6301   // We did expect the animation to finish
6302   application.SendNotification();
6303   finishCheck.CheckSignalReceived();
6304   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6305   END_TEST;
6306 }
6307
6308 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void)
6309 {
6310   TestApplication application;
6311
6312   Actor actor = Actor::New();
6313
6314   // Register a float property
6315   float           startValue(10.0f);
6316   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6317   application.GetScene().Add(actor);
6318   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
6319   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6320
6321   // Build the animation
6322   float     durationSeconds(1.0f);
6323   Animation animation = Animation::New(durationSeconds);
6324   float     targetValue(30.0f);
6325   float     relativeValue(targetValue - startValue);
6326   float     delay = 0.5f;
6327   animation.AnimateTo(Property(actor, index),
6328                       targetValue,
6329                       AlphaFunction::LINEAR,
6330                       TimePeriod(delay, durationSeconds - delay));
6331
6332   // Start the animation
6333   animation.Play();
6334
6335   bool                 signalReceived(false);
6336   AnimationFinishCheck finishCheck(signalReceived);
6337   animation.FinishedSignal().Connect(&application, finishCheck);
6338
6339   application.SendNotification();
6340   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6341
6342   // We didn't expect the animation to finish yet
6343   application.SendNotification();
6344   finishCheck.CheckSignalNotReceived();
6345   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6346
6347   application.SendNotification();
6348   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6349
6350   // We didn't expect the animation to finish yet
6351   application.SendNotification();
6352   finishCheck.CheckSignalNotReceived();
6353   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6354
6355   application.SendNotification();
6356   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6357
6358   // We did expect the animation to finish
6359   application.SendNotification();
6360   finishCheck.CheckSignalReceived();
6361   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6362   END_TEST;
6363 }
6364
6365 int UtcDaliAnimationAnimateToIntegerP(void)
6366 {
6367   TestApplication application;
6368
6369   Actor actor = Actor::New();
6370
6371   // Register an integer property
6372   int             startValue(10);
6373   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6374   application.GetScene().Add(actor);
6375   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6376   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6377
6378   // Build the animation
6379   float     durationSeconds(2.0f);
6380   Animation animation = Animation::New(durationSeconds);
6381   int       targetValue(50);
6382   int       relativeValue(targetValue - startValue);
6383   animation.AnimateTo(Property(actor, "testProperty"), targetValue);
6384
6385   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
6386
6387   // Start the animation
6388   animation.Play();
6389
6390   bool                 signalReceived(false);
6391   AnimationFinishCheck finishCheck(signalReceived);
6392   animation.FinishedSignal().Connect(&application, finishCheck);
6393
6394   application.SendNotification();
6395   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6396
6397   // We didn't expect the animation to finish yet
6398   application.SendNotification();
6399   finishCheck.CheckSignalNotReceived();
6400   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION);
6401
6402   application.SendNotification();
6403   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6404
6405   // We did expect the animation to finish
6406   application.SendNotification();
6407   finishCheck.CheckSignalReceived();
6408   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6409   END_TEST;
6410 }
6411
6412 int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void)
6413 {
6414   TestApplication application;
6415
6416   Actor actor = Actor::New();
6417
6418   // Register an integer property
6419   int             startValue(10);
6420   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6421   application.GetScene().Add(actor);
6422   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6423   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6424
6425   // Build the animation
6426   float     durationSeconds(1.0f);
6427   Animation animation = Animation::New(durationSeconds);
6428   int       targetValue(90);
6429   int       relativeValue(targetValue - startValue);
6430   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6431
6432   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
6433
6434   // Start the animation
6435   animation.Play();
6436
6437   bool                 signalReceived(false);
6438   AnimationFinishCheck finishCheck(signalReceived);
6439   animation.FinishedSignal().Connect(&application, finishCheck);
6440
6441   application.SendNotification();
6442   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6443
6444   // We didn't expect the animation to finish yet
6445   application.SendNotification();
6446   finishCheck.CheckSignalNotReceived();
6447
6448   // The position should have moved more, than with a linear alpha function
6449   int current(actor.GetCurrentProperty<int>(index));
6450   DALI_TEST_CHECK(current > ninetyFivePercentProgress);
6451
6452   application.SendNotification();
6453   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6454
6455   // We did expect the animation to finish
6456   application.SendNotification();
6457   finishCheck.CheckSignalReceived();
6458   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6459   END_TEST;
6460 }
6461
6462 int UtcDaliAnimationAnimateToIntegerTimePeriodP(void)
6463 {
6464   TestApplication application;
6465
6466   Actor actor = Actor::New();
6467
6468   // Register an integer property
6469   int             startValue(10);
6470   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6471   application.GetScene().Add(actor);
6472   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6473   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6474
6475   // Build the animation
6476   float     durationSeconds(1.0f);
6477   Animation animation = Animation::New(durationSeconds);
6478   int       targetValue(30);
6479   int       relativeValue(targetValue - startValue);
6480   float     delay = 0.5f;
6481   animation.AnimateTo(Property(actor, index),
6482                       targetValue,
6483                       TimePeriod(delay, durationSeconds - delay));
6484
6485   // Start the animation
6486   animation.Play();
6487
6488   bool                 signalReceived(false);
6489   AnimationFinishCheck finishCheck(signalReceived);
6490   animation.FinishedSignal().Connect(&application, finishCheck);
6491
6492   application.SendNotification();
6493   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6494
6495   // We didn't expect the animation to finish yet
6496   application.SendNotification();
6497   finishCheck.CheckSignalNotReceived();
6498   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6499
6500   application.SendNotification();
6501   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6502
6503   // We didn't expect the animation to finish yet
6504   application.SendNotification();
6505   finishCheck.CheckSignalNotReceived();
6506   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
6507
6508   application.SendNotification();
6509   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6510
6511   // We did expect the animation to finish
6512   application.SendNotification();
6513   finishCheck.CheckSignalReceived();
6514   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6515   END_TEST;
6516 }
6517
6518 int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void)
6519 {
6520   TestApplication application;
6521
6522   Actor actor = Actor::New();
6523
6524   // Register an integer property
6525   int             startValue(10);
6526   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6527   application.GetScene().Add(actor);
6528   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6529   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6530
6531   // Build the animation
6532   float     durationSeconds(1.0f);
6533   Animation animation = Animation::New(durationSeconds);
6534   int       targetValue(30);
6535   int       relativeValue(targetValue - startValue);
6536   float     delay = 0.5f;
6537   animation.AnimateTo(Property(actor, index),
6538                       targetValue,
6539                       AlphaFunction::LINEAR,
6540                       TimePeriod(delay, durationSeconds - delay));
6541
6542   // Start the animation
6543   animation.Play();
6544
6545   bool                 signalReceived(false);
6546   AnimationFinishCheck finishCheck(signalReceived);
6547   animation.FinishedSignal().Connect(&application, finishCheck);
6548
6549   application.SendNotification();
6550   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6551
6552   // We didn't expect the animation to finish yet
6553   application.SendNotification();
6554   finishCheck.CheckSignalNotReceived();
6555   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6556
6557   application.SendNotification();
6558   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6559
6560   // We didn't expect the animation to finish yet
6561   application.SendNotification();
6562   finishCheck.CheckSignalNotReceived();
6563   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
6564
6565   application.SendNotification();
6566   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6567
6568   // We did expect the animation to finish
6569   application.SendNotification();
6570   finishCheck.CheckSignalReceived();
6571   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6572   END_TEST;
6573 }
6574
6575 int UtcDaliAnimationAnimateToVector2P(void)
6576 {
6577   TestApplication application;
6578
6579   Actor actor = Actor::New();
6580
6581   // Register a Vector2 property
6582   Vector2         startValue(-50.0f, -50.0f);
6583   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6584   application.GetScene().Add(actor);
6585   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6586   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6587
6588   // Build the animation
6589   float     durationSeconds(2.0f);
6590   Animation animation = Animation::New(durationSeconds);
6591   Vector2   targetValue(50.0f, 50.0f);
6592   Vector2   relativeValue(targetValue - startValue);
6593   animation.AnimateTo(Property(actor, index), targetValue);
6594
6595   Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6596
6597   // Start the animation
6598   animation.Play();
6599
6600   bool                 signalReceived(false);
6601   AnimationFinishCheck finishCheck(signalReceived);
6602   animation.FinishedSignal().Connect(&application, finishCheck);
6603
6604   application.SendNotification();
6605   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6606
6607   // We didn't expect the animation to finish yet
6608   application.SendNotification();
6609   finishCheck.CheckSignalNotReceived();
6610   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION);
6611
6612   application.SendNotification();
6613   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6614
6615   // We did expect the animation to finish
6616   application.SendNotification();
6617   finishCheck.CheckSignalReceived();
6618   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6619   END_TEST;
6620 }
6621
6622 int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void)
6623 {
6624   TestApplication application;
6625
6626   Actor actor = Actor::New();
6627
6628   // Register a Vector2 property
6629   Vector2         startValue(1000.0f, 1000.0f);
6630   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6631   application.GetScene().Add(actor);
6632   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6633   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6634
6635   // Build the animation
6636   float     durationSeconds(1.0f);
6637   Animation animation = Animation::New(durationSeconds);
6638   Vector2   targetValue(9000.0f, 9000.0f);
6639   Vector2   relativeValue(targetValue - startValue);
6640   animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
6641
6642   Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6643
6644   // Start the animation
6645   animation.Play();
6646
6647   bool                 signalReceived(false);
6648   AnimationFinishCheck finishCheck(signalReceived);
6649   animation.FinishedSignal().Connect(&application, finishCheck);
6650
6651   application.SendNotification();
6652   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6653
6654   // We didn't expect the animation to finish yet
6655   application.SendNotification();
6656   finishCheck.CheckSignalNotReceived();
6657
6658   // The position should have moved more, than with a linear alpha function
6659   Vector2 current(actor.GetCurrentProperty<Vector2>(index));
6660   DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
6661   DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
6662
6663   application.SendNotification();
6664   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6665
6666   // We did expect the animation to finish
6667   application.SendNotification();
6668   finishCheck.CheckSignalReceived();
6669   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6670   END_TEST;
6671 }
6672
6673 int UtcDaliAnimationAnimateToVector2TimePeriodP(void)
6674 {
6675   TestApplication application;
6676
6677   Actor actor = Actor::New();
6678
6679   // Register a Vector2 property
6680   Vector2         startValue(10.0f, 10.0f);
6681   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6682   application.GetScene().Add(actor);
6683   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6684   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6685
6686   // Build the animation
6687   float     durationSeconds(1.0f);
6688   Animation animation = Animation::New(durationSeconds);
6689   Vector2   targetValue(-10.0f, 20.0f);
6690   Vector2   relativeValue(targetValue - startValue);
6691   float     delay = 0.5f;
6692   animation.AnimateTo(Property(actor, index),
6693                       targetValue,
6694                       TimePeriod(delay, durationSeconds - delay));
6695
6696   // Start the animation
6697   animation.Play();
6698
6699   bool                 signalReceived(false);
6700   AnimationFinishCheck finishCheck(signalReceived);
6701   animation.FinishedSignal().Connect(&application, finishCheck);
6702
6703   application.SendNotification();
6704   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6705
6706   // We didn't expect the animation to finish yet
6707   application.SendNotification();
6708   finishCheck.CheckSignalNotReceived();
6709   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6710
6711   application.SendNotification();
6712   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6713
6714   // We didn't expect the animation to finish yet
6715   application.SendNotification();
6716   finishCheck.CheckSignalNotReceived();
6717   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6718
6719   application.SendNotification();
6720   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6721
6722   // We did expect the animation to finish
6723   application.SendNotification();
6724   finishCheck.CheckSignalReceived();
6725   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6726   END_TEST;
6727 }
6728
6729 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void)
6730 {
6731   TestApplication application;
6732
6733   Actor actor = Actor::New();
6734
6735   // Register a Vector2 property
6736   Vector2         startValue(10.0f, 10.0f);
6737   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6738   application.GetScene().Add(actor);
6739   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6740   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6741
6742   // Build the animation
6743   float     durationSeconds(1.0f);
6744   Animation animation = Animation::New(durationSeconds);
6745   Vector2   targetValue(30.0f, 30.0f);
6746   Vector2   relativeValue(targetValue - startValue);
6747   float     delay = 0.5f;
6748   animation.AnimateTo(Property(actor, index),
6749                       targetValue,
6750                       AlphaFunction::LINEAR,
6751                       TimePeriod(delay, durationSeconds - delay));
6752
6753   // Start the animation
6754   animation.Play();
6755
6756   bool                 signalReceived(false);
6757   AnimationFinishCheck finishCheck(signalReceived);
6758   animation.FinishedSignal().Connect(&application, finishCheck);
6759
6760   application.SendNotification();
6761   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6762
6763   // We didn't expect the animation to finish yet, but cached value should be the final one
6764   application.SendNotification();
6765   finishCheck.CheckSignalNotReceived();
6766   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION);
6767   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6768
6769   application.SendNotification();
6770   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6771
6772   // We didn't expect the animation to finish yet
6773   application.SendNotification();
6774   finishCheck.CheckSignalNotReceived();
6775   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6776
6777   application.SendNotification();
6778   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6779
6780   // We did expect the animation to finish
6781   application.SendNotification();
6782   finishCheck.CheckSignalReceived();
6783   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6784   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION);
6785   END_TEST;
6786 }
6787
6788 int UtcDaliAnimationAnimateToVector3P(void)
6789 {
6790   TestApplication application;
6791
6792   Actor actor = Actor::New();
6793
6794   // Register a Vector3 property
6795   Vector3         startValue(-50.0f, -50.0f, -50.0f);
6796   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6797   application.GetScene().Add(actor);
6798   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6799   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6800
6801   // Build the animation
6802   float     durationSeconds(2.0f);
6803   Animation animation = Animation::New(durationSeconds);
6804   Vector3   targetValue(50.0f, 50.0f, 50.0f);
6805   Vector3   relativeValue(targetValue - startValue);
6806   animation.AnimateTo(Property(actor, index), targetValue);
6807
6808   Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6809
6810   // Start the animation
6811   animation.Play();
6812
6813   bool                 signalReceived(false);
6814   AnimationFinishCheck finishCheck(signalReceived);
6815   animation.FinishedSignal().Connect(&application, finishCheck);
6816
6817   application.SendNotification();
6818   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6819
6820   // We didn't expect the animation to finish yet
6821   application.SendNotification();
6822   finishCheck.CheckSignalNotReceived();
6823   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION);
6824
6825   application.SendNotification();
6826   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6827
6828   // We did expect the animation to finish
6829   application.SendNotification();
6830   finishCheck.CheckSignalReceived();
6831   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6832   END_TEST;
6833 }
6834
6835 int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void)
6836 {
6837   TestApplication application;
6838
6839   Actor actor = Actor::New();
6840
6841   // Register a Vector3 property
6842   Vector3         startValue(1000.0f, 1000.0f, 1000.0f);
6843   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6844   application.GetScene().Add(actor);
6845   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6846   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6847
6848   // Build the animation
6849   float     durationSeconds(1.0f);
6850   Animation animation = Animation::New(durationSeconds);
6851   Vector3   targetValue(9000.0f, 9000.0f, 9000.0f);
6852   Vector3   relativeValue(targetValue - startValue);
6853   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6854
6855   Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6856
6857   // Start the animation
6858   animation.Play();
6859
6860   bool                 signalReceived(false);
6861   AnimationFinishCheck finishCheck(signalReceived);
6862   animation.FinishedSignal().Connect(&application, finishCheck);
6863
6864   application.SendNotification();
6865   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6866
6867   // We didn't expect the animation to finish yet
6868   application.SendNotification();
6869   finishCheck.CheckSignalNotReceived();
6870
6871   // The position should have moved more, than with a linear alpha function
6872   Vector3 current(actor.GetCurrentProperty<Vector3>(index));
6873   DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
6874   DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
6875   DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z);
6876
6877   application.SendNotification();
6878   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6879
6880   // We did expect the animation to finish
6881   application.SendNotification();
6882   finishCheck.CheckSignalReceived();
6883   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6884   END_TEST;
6885 }
6886
6887 int UtcDaliAnimationAnimateToVector3TimePeriodP(void)
6888 {
6889   TestApplication application;
6890
6891   Actor actor = Actor::New();
6892
6893   // Register a Vector3 property
6894   Vector3         startValue(10.0f, 10.0f, 10.0f);
6895   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6896   application.GetScene().Add(actor);
6897   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6898   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6899
6900   // Build the animation
6901   float     durationSeconds(1.0f);
6902   Animation animation = Animation::New(durationSeconds);
6903   Vector3   targetValue(-10.0f, 20.0f, 100.0f);
6904   Vector3   relativeValue(targetValue - startValue);
6905   float     delay = 0.5f;
6906   animation.AnimateTo(Property(actor, index),
6907                       targetValue,
6908                       TimePeriod(delay, durationSeconds - delay));
6909
6910   // Start the animation
6911   animation.Play();
6912
6913   bool                 signalReceived(false);
6914   AnimationFinishCheck finishCheck(signalReceived);
6915   animation.FinishedSignal().Connect(&application, finishCheck);
6916
6917   application.SendNotification();
6918   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6919
6920   // We didn't expect the animation to finish yet
6921   application.SendNotification();
6922   finishCheck.CheckSignalNotReceived();
6923   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6924
6925   application.SendNotification();
6926   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6927
6928   // We didn't expect the animation to finish yet
6929   application.SendNotification();
6930   finishCheck.CheckSignalNotReceived();
6931   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6932
6933   application.SendNotification();
6934   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6935
6936   // We did expect the animation to finish
6937   application.SendNotification();
6938   finishCheck.CheckSignalReceived();
6939   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6940   END_TEST;
6941 }
6942
6943 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void)
6944 {
6945   TestApplication application;
6946
6947   Actor actor = Actor::New();
6948
6949   // Register a Vector3 property
6950   Vector3         startValue(10.0f, 10.0f, 10.0f);
6951   Property::Index index = actor.RegisterProperty("testProperty", startValue);
6952   application.GetScene().Add(actor);
6953   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6954   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6955
6956   // Build the animation
6957   float     durationSeconds(1.0f);
6958   Animation animation = Animation::New(durationSeconds);
6959   Vector3   targetValue(30.0f, 30.0f, 30.0f);
6960   Vector3   relativeValue(targetValue - startValue);
6961   float     delay = 0.5f;
6962   animation.AnimateTo(Property(actor, "testProperty"),
6963                       targetValue,
6964                       AlphaFunction::LINEAR,
6965                       TimePeriod(delay, durationSeconds - delay));
6966
6967   // Start the animation
6968   animation.Play();
6969
6970   bool                 signalReceived(false);
6971   AnimationFinishCheck finishCheck(signalReceived);
6972   animation.FinishedSignal().Connect(&application, finishCheck);
6973
6974   application.SendNotification();
6975   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6976
6977   // We didn't expect the animation to finish yet
6978   application.SendNotification();
6979   finishCheck.CheckSignalNotReceived();
6980   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6981
6982   application.SendNotification();
6983   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6984
6985   // We didn't expect the animation to finish yet
6986   application.SendNotification();
6987   finishCheck.CheckSignalNotReceived();
6988   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6989
6990   application.SendNotification();
6991   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6992
6993   // We did expect the animation to finish
6994   application.SendNotification();
6995   finishCheck.CheckSignalReceived();
6996   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6997   END_TEST;
6998 }
6999
7000 int UtcDaliAnimationAnimateToVector3ComponentP(void)
7001 {
7002   TestApplication application;
7003
7004   Actor actor = Actor::New();
7005
7006   // Register a Vector3 property
7007   Vector3         startValue(10.0f, 10.0f, 10.0f);
7008   Property::Index index = actor.RegisterProperty("testProperty", startValue);
7009   application.GetScene().Add(actor);
7010   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
7011   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
7012
7013   // Build the animation
7014   float     durationSeconds(1.0f);
7015   Animation animation = Animation::New(durationSeconds);
7016   Vector3   targetValue(30.0f, 30.0f, 10.0f);
7017   Vector3   relativeValue(targetValue - startValue);
7018   float     delay = 0.5f;
7019   animation.AnimateTo(Property(actor, "testProperty", 0),
7020                       30.0f,
7021                       AlphaFunction::LINEAR,
7022                       TimePeriod(delay, durationSeconds - delay));
7023   animation.AnimateTo(Property(actor, index, 1),
7024                       30.0f,
7025                       AlphaFunction::LINEAR,
7026                       TimePeriod(delay, durationSeconds - delay));
7027
7028   // Start the animation
7029   animation.Play();
7030
7031   bool                 signalReceived(false);
7032   AnimationFinishCheck finishCheck(signalReceived);
7033   animation.FinishedSignal().Connect(&application, finishCheck);
7034
7035   application.SendNotification();
7036   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7037
7038   // We didn't expect the animation to finish yet
7039   application.SendNotification();
7040   finishCheck.CheckSignalNotReceived();
7041   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
7042
7043   application.SendNotification();
7044   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
7045
7046   // We didn't expect the animation to finish yet
7047   application.SendNotification();
7048   finishCheck.CheckSignalNotReceived();
7049   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
7050
7051   application.SendNotification();
7052   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7053
7054   // We did expect the animation to finish
7055   application.SendNotification();
7056   finishCheck.CheckSignalReceived();
7057   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
7058   END_TEST;
7059 }
7060
7061 int UtcDaliAnimationAnimateToVector4P(void)
7062 {
7063   TestApplication application;
7064
7065   Actor actor = Actor::New();
7066
7067   // Register a Vector4 property
7068   Vector4         startValue(-50.0f, -40.0f, -30.0f, -20.0f);
7069   Property::Index index = actor.RegisterProperty("testProperty", startValue);
7070   application.GetScene().Add(actor);
7071   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
7072   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
7073
7074   // Build the animation
7075   float     durationSeconds(2.0f);
7076   Animation animation = Animation::New(durationSeconds);
7077   Vector4   targetValue(50.0f, 50.0f, 50.0f, 50.0f);
7078   Vector4   relativeValue(targetValue - startValue);
7079   animation.AnimateTo(Property(actor, index), targetValue);
7080
7081   Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
7082
7083   // Start the animation
7084   animation.Play();
7085
7086   bool                 signalReceived(false);
7087   AnimationFinishCheck finishCheck(signalReceived);
7088   animation.FinishedSignal().Connect(&application, finishCheck);
7089
7090   application.SendNotification();
7091   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
7092
7093   // We didn't expect the animation to finish yet
7094   application.SendNotification();
7095   finishCheck.CheckSignalNotReceived();
7096   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION);
7097
7098   application.SendNotification();
7099   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
7100
7101   // We did expect the animation to finish
7102   application.SendNotification();
7103   finishCheck.CheckSignalReceived();
7104   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
7105   END_TEST;
7106 }
7107
7108 int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void)
7109 {
7110   TestApplication application;
7111
7112   Actor actor = Actor::New();
7113
7114   // Register a Vector4 property
7115   Vector4         startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
7116   Property::Index index = actor.RegisterProperty("testProperty", startValue);
7117   application.GetScene().Add(actor);
7118   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
7119   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
7120
7121   // Build the animation
7122   float     durationSeconds(1.0f);
7123   Animation animation = Animation::New(durationSeconds);
7124   Vector4   targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
7125   Vector4   relativeValue(targetValue - startValue);
7126   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
7127
7128   Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
7129
7130   // Start the animation
7131   animation.Play();
7132
7133   bool                 signalReceived(false);
7134   AnimationFinishCheck finishCheck(signalReceived);
7135   animation.FinishedSignal().Connect(&application, finishCheck);
7136
7137   application.SendNotification();
7138   application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
7139
7140   // We didn't expect the animation to finish yet
7141   application.SendNotification();
7142   finishCheck.CheckSignalNotReceived();
7143
7144   // The position should have moved more, than with a linear alpha function
7145   Vector4 current(actor.GetCurrentProperty<Vector4>(index));
7146   DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
7147   DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
7148   DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z);
7149   DALI_TEST_CHECK(current.w > ninetyFivePercentProgress.w);
7150
7151   application.SendNotification();
7152   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
7153
7154   // We did expect the animation to finish
7155   application.SendNotification();
7156   finishCheck.CheckSignalReceived();
7157   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
7158   END_TEST;
7159 }
7160
7161 int UtcDaliAnimationAnimateToVector4TimePeriodP(void)
7162 {
7163   TestApplication application;
7164
7165   Actor actor = Actor::New();
7166
7167   // Register a Vector4 property
7168   Vector4         startValue(10.0f, 10.0f, 10.0f, 10.0f);
7169   Property::Index index = actor.RegisterProperty("testProperty", startValue);
7170   application.GetScene().Add(actor);
7171   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
7172   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION);
7173
7174   // Build the animation
7175   float     durationSeconds(1.0f);
7176   Animation animation = Animation::New(durationSeconds);
7177   Vector4   targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
7178   Vector4   relativeValue(targetValue - startValue);
7179   float     delay = 0.5f;
7180   animation.AnimateTo(Property(actor, index),
7181                       targetValue,
7182                       TimePeriod(delay, durationSeconds - delay));
7183
7184   // Start the animation
7185   animation.Play();
7186
7187   bool                 signalReceived(false);
7188   AnimationFinishCheck finishCheck(signalReceived);
7189   animation.FinishedSignal().Connect(&application, finishCheck);
7190
7191   application.SendNotification();
7192   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7193
7194   // We didn't expect the animation to finish yet
7195   application.SendNotification();
7196   finishCheck.CheckSignalNotReceived();
7197   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION);
7198
7199   application.SendNotification();
7200   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
7201
7202   // We didn't expect the animation to finish yet
7203   application.SendNotification();
7204   finishCheck.CheckSignalNotReceived();
7205   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), VECTOR4_EPSILON, TEST_LOCATION);
7206
7207   application.SendNotification();
7208   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7209
7210   // We did expect the animation to finish
7211   application.SendNotification();
7212   finishCheck.CheckSignalReceived();
7213   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, VECTOR4_EPSILON, TEST_LOCATION);
7214   END_TEST;
7215 }
7216
7217 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void)
7218 {
7219   TestApplication application;
7220
7221   Actor actor = Actor::New();
7222
7223   // Register a Vector4 property
7224   Vector4         startValue(10.0f, 10.0f, 10.0f, 10.0f);
7225   Property::Index index = actor.RegisterProperty("testProperty", startValue);
7226   application.GetScene().Add(actor);
7227   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
7228   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
7229
7230   // Build the animation
7231   float     durationSeconds(1.0f);
7232   Animation animation = Animation::New(durationSeconds);
7233   Vector4   targetValue(30.0f, 30.0f, 30.0f, 30.0f);
7234   Vector4   relativeValue(targetValue - startValue);
7235   float     delay = 0.5f;
7236   animation.AnimateTo(Property(actor, index),
7237                       targetValue,
7238                       AlphaFunction::LINEAR,
7239                       TimePeriod(delay, durationSeconds - delay));
7240
7241   // Start the animation
7242   animation.Play();
7243
7244   bool                 signalReceived(false);
7245   AnimationFinishCheck finishCheck(signalReceived);
7246   animation.FinishedSignal().Connect(&application, finishCheck);
7247
7248   application.SendNotification();
7249   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7250
7251   // We didn't expect the animation to finish yet
7252   application.SendNotification();
7253   finishCheck.CheckSignalNotReceived();
7254   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
7255
7256   application.SendNotification();
7257   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
7258
7259   // We didn't expect the animation to finish yet
7260   application.SendNotification();
7261   finishCheck.CheckSignalNotReceived();
7262   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
7263
7264   application.SendNotification();
7265   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7266
7267   // We did expect the animation to finish
7268   application.SendNotification();
7269   finishCheck.CheckSignalReceived();
7270   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
7271   END_TEST;
7272 }
7273
7274 int UtcDaliAnimationAnimateToActorParentOriginP(void)
7275 {
7276   TestApplication application;
7277
7278   Actor actor = Actor::New();
7279   application.GetScene().Add(actor);
7280   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_LEFT, TEST_LOCATION);
7281
7282   // Build the animation
7283   float     durationSeconds(1.0f);
7284   Animation animation = Animation::New(durationSeconds);
7285   Vector3   targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
7286
7287   DALI_TEST_ASSERTION(
7288     {
7289       animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin);
7290     },
7291     "Property is not animatable");
7292
7293   END_TEST;
7294 }
7295
7296 int UtcDaliAnimationAnimateToActorParentOriginXN(void)
7297 {
7298   TestApplication application;
7299
7300   Actor actor = Actor::New();
7301   application.GetScene().Add(actor);
7302   float startValue(0.0f);
7303   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).x, startValue, TEST_LOCATION);
7304   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION);
7305
7306   // Build the animation
7307   float     durationSeconds(1.0f);
7308   Animation animation = Animation::New(durationSeconds);
7309   float     targetX(1.0f);
7310
7311   DALI_TEST_ASSERTION(
7312     {
7313       animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX);
7314     },
7315     "Property is not animatable");
7316
7317   END_TEST;
7318 }
7319
7320 int UtcDaliAnimationAnimateToActorParentOriginYN(void)
7321 {
7322   TestApplication application;
7323
7324   Actor actor = Actor::New();
7325   application.GetScene().Add(actor);
7326   float startValue(0.0f);
7327   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).y, startValue, TEST_LOCATION);
7328   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION);
7329
7330   // Build the animation
7331   float     durationSeconds(1.0f);
7332   Animation animation = Animation::New(durationSeconds);
7333   float     targetY(1.0f);
7334
7335   DALI_TEST_ASSERTION(
7336     {
7337       animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY);
7338     },
7339     "Property is not animatable");
7340
7341   END_TEST;
7342 }
7343
7344 int UtcDaliAnimationAnimateToActorParentOriginZN(void)
7345 {
7346   TestApplication application;
7347
7348   Actor actor = Actor::New();
7349   application.GetScene().Add(actor);
7350   float startValue(0.5f);
7351   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).z, startValue, TEST_LOCATION);
7352   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION);
7353
7354   // Build the animation
7355   float     durationSeconds(1.0f);
7356   Animation animation = Animation::New(durationSeconds);
7357   float     targetZ(1.0f);
7358
7359   DALI_TEST_ASSERTION(
7360     {
7361       animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ);
7362     },
7363     "Property is not animatable");
7364
7365   END_TEST;
7366 }
7367
7368 int UtcDaliAnimationAnimateToActorAnchorPointN(void)
7369 {
7370   TestApplication application;
7371
7372   Actor actor = Actor::New();
7373   application.GetScene().Add(actor);
7374   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), AnchorPoint::CENTER, TEST_LOCATION);
7375
7376   // Build the animation
7377   float     durationSeconds(1.0f);
7378   Animation animation = Animation::New(durationSeconds);
7379   Vector3   targetAnchorPoint(AnchorPoint::TOP_LEFT);
7380
7381   DALI_TEST_ASSERTION(
7382     {
7383       animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
7384     },
7385     "Property is not animatable");
7386
7387   END_TEST;
7388 }
7389
7390 int UtcDaliAnimationAnimateToActorAnchorPointXN(void)
7391 {
7392   TestApplication application;
7393
7394   Actor actor = Actor::New();
7395   application.GetScene().Add(actor);
7396   float startValue(0.5f);
7397   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).x, startValue, TEST_LOCATION);
7398   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION);
7399
7400   // Build the animation
7401   float     durationSeconds(1.0f);
7402   Animation animation = Animation::New(durationSeconds);
7403   float     targetX(1.0f);
7404
7405   DALI_TEST_ASSERTION(
7406     {
7407       animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_X), targetX);
7408     },
7409     "Property is not animatable");
7410
7411   END_TEST;
7412 }
7413
7414 int UtcDaliAnimationAnimateToActorAnchorPointYN(void)
7415 {
7416   TestApplication application;
7417
7418   Actor actor = Actor::New();
7419   application.GetScene().Add(actor);
7420   float startValue(0.5f);
7421   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).y, startValue, TEST_LOCATION);
7422   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION);
7423
7424   // Build the animation
7425   float     durationSeconds(1.0f);
7426   Animation animation = Animation::New(durationSeconds);
7427   float     targetY(0.0f);
7428
7429   DALI_TEST_ASSERTION(
7430     {
7431       animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY);
7432     },
7433     "Property is not animatable");
7434
7435   END_TEST;
7436 }
7437
7438 int UtcDaliAnimationAnimateToActorAnchorPointZN(void)
7439 {
7440   TestApplication application;
7441
7442   Actor actor = Actor::New();
7443   application.GetScene().Add(actor);
7444   float startValue(0.5f);
7445   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).z, startValue, TEST_LOCATION);
7446   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION);
7447
7448   // Build the animation
7449   float     durationSeconds(1.0f);
7450   Animation animation = Animation::New(durationSeconds);
7451   float     targetZ(100.0f);
7452
7453   DALI_TEST_ASSERTION(
7454     {
7455       animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ);
7456     },
7457     "Property is not animatable");
7458
7459   END_TEST;
7460 }
7461
7462 int UtcDaliAnimationAnimateToActorSizeP(void)
7463 {
7464   TestApplication application;
7465
7466   Actor actor = Actor::New();
7467   application.GetScene().Add(actor);
7468   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7469
7470   // Build the animation
7471   float     durationSeconds(1.0f);
7472   Animation animation = Animation::New(durationSeconds);
7473   Vector3   targetSize(100.0f, 100.0f, 100.0f);
7474   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize);
7475
7476   Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7477
7478   // Should return the initial properties before play
7479   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7480   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), 0.0f, TEST_LOCATION);
7481   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), 0.0f, TEST_LOCATION);
7482   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), 0.0f, TEST_LOCATION);
7483
7484   // Start the animation
7485   animation.Play();
7486
7487   // Should return the target property after play
7488   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7489   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION);
7490   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION);
7491   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION);
7492
7493   bool                 signalReceived(false);
7494   AnimationFinishCheck finishCheck(signalReceived);
7495   animation.FinishedSignal().Connect(&application, finishCheck);
7496
7497   application.SendNotification();
7498   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7499
7500   // We didn't expect the animation to finish yet
7501   application.SendNotification();
7502   finishCheck.CheckSignalNotReceived();
7503   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), ninetyNinePercentProgress, TEST_LOCATION);
7504
7505   application.SendNotification();
7506   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7507
7508   // We did expect the animation to finish
7509   application.SendNotification();
7510   finishCheck.CheckSignalReceived();
7511   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7512
7513   // Reset everything
7514   finishCheck.Reset();
7515   actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7516   application.SendNotification();
7517   application.Render(0);
7518   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7519
7520   // Repeat with a different (ease-in) alpha function
7521   animation = Animation::New(durationSeconds);
7522   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
7523   animation.FinishedSignal().Connect(&application, finishCheck);
7524   animation.Play();
7525
7526   application.SendNotification();
7527   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7528
7529   // We didn't expect the animation to finish yet
7530   application.SendNotification();
7531   finishCheck.CheckSignalNotReceived();
7532
7533   // The size should have travelled less, than with a linear alpha function
7534   Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
7535   DALI_TEST_CHECK(current.x > 0.0f);
7536   DALI_TEST_CHECK(current.y > 0.0f);
7537   DALI_TEST_CHECK(current.z > 0.0f);
7538   DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
7539   DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
7540   DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z);
7541
7542   application.SendNotification();
7543   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7544
7545   // We did expect the animation to finish
7546   application.SendNotification();
7547   finishCheck.CheckSignalReceived();
7548   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7549
7550   // Reset everything
7551   finishCheck.Reset();
7552   actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7553   application.SendNotification();
7554   application.Render(0);
7555   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7556
7557   // Repeat with a delay
7558   float delay = 0.5f;
7559   animation   = Animation::New(durationSeconds);
7560   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7561   animation.FinishedSignal().Connect(&application, finishCheck);
7562   animation.Play();
7563
7564   application.SendNotification();
7565   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7566
7567   // We didn't expect the animation to finish yet
7568   application.SendNotification();
7569   finishCheck.CheckSignalNotReceived();
7570   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7571
7572   application.SendNotification();
7573   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7574
7575   // We did expect the animation to finish
7576   application.SendNotification();
7577   finishCheck.CheckSignalReceived();
7578   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7579   END_TEST;
7580 }
7581
7582 int UtcDaliAnimationAnimateToActorSizeWidthP(void)
7583 {
7584   TestApplication application;
7585
7586   Actor actor = Actor::New();
7587   application.GetScene().Add(actor);
7588   float startValue(0.0f);
7589   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, startValue, TEST_LOCATION);
7590   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION);
7591
7592   // Build the animation
7593   float     durationSeconds(1.0f);
7594   Animation animation = Animation::New(durationSeconds);
7595   float     targetWidth(10.0f);
7596   animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetWidth);
7597
7598   float fiftyPercentProgress(startValue + (targetWidth - startValue) * 0.5f);
7599
7600   // Should return the initial properties before play
7601   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7602   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION);
7603
7604   // Start the animation
7605   animation.Play();
7606
7607   // Should return the target property after play
7608   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(targetWidth, 0.0f, 0.0f), TEST_LOCATION);
7609   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION);
7610
7611   bool                 signalReceived(false);
7612   AnimationFinishCheck finishCheck(signalReceived);
7613   animation.FinishedSignal().Connect(&application, finishCheck);
7614
7615   application.SendNotification();
7616   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7617
7618   // We didn't expect the animation to finish yet
7619   application.SendNotification();
7620   finishCheck.CheckSignalNotReceived();
7621   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, fiftyPercentProgress, TEST_LOCATION);
7622
7623   application.SendNotification();
7624   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7625
7626   // We did expect the animation to finish
7627   application.SendNotification();
7628   finishCheck.CheckSignalReceived();
7629   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, targetWidth, TEST_LOCATION);
7630   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION);
7631   END_TEST;
7632 }
7633
7634 int UtcDaliAnimationAnimateToActorSizeHeightP(void)
7635 {
7636   TestApplication application;
7637
7638   Actor actor = Actor::New();
7639   application.GetScene().Add(actor);
7640   float startValue(0.0f);
7641   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, startValue, TEST_LOCATION);
7642   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION);
7643
7644   // Build the animation
7645   float     durationSeconds(1.0f);
7646   Animation animation = Animation::New(durationSeconds);
7647   float     targetHeight(-10.0f);
7648   animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight);
7649
7650   float fiftyPercentProgress(startValue + (targetHeight - startValue) * 0.5f);
7651
7652   // Should return the initial properties before play
7653   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7654   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION);
7655
7656   // Start the animation
7657   animation.Play();
7658
7659   // Should return the target property after play
7660   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(0.0f, targetHeight, 0.0f), TEST_LOCATION);
7661   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION);
7662
7663   bool                 signalReceived(false);
7664   AnimationFinishCheck finishCheck(signalReceived);
7665   animation.FinishedSignal().Connect(&application, finishCheck);
7666
7667   application.SendNotification();
7668   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7669
7670   // We didn't expect the animation to finish yet
7671   application.SendNotification();
7672   finishCheck.CheckSignalNotReceived();
7673   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, fiftyPercentProgress, TEST_LOCATION);
7674
7675   application.SendNotification();
7676   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7677
7678   // We did expect the animation to finish
7679   application.SendNotification();
7680   finishCheck.CheckSignalReceived();
7681   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, targetHeight, TEST_LOCATION);
7682   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION);
7683   END_TEST;
7684 }
7685
7686 int UtcDaliAnimationAnimateToActorSizeDepthP(void)
7687 {
7688   TestApplication application;
7689
7690   Actor actor = Actor::New();
7691   application.GetScene().Add(actor);
7692   float startValue(0.0f);
7693   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, startValue, TEST_LOCATION);
7694   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION);
7695
7696   // Build the animation
7697   float     durationSeconds(1.0f);
7698   Animation animation = Animation::New(durationSeconds);
7699   float     targetDepth(-10.0f);
7700   animation.AnimateTo(Property(actor, Actor::Property::SIZE_DEPTH), targetDepth);
7701
7702   float fiftyPercentProgress(startValue + (targetDepth - startValue) * 0.5f);
7703
7704   // Should return the initial properties before play
7705   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7706   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION);
7707
7708   // Start the animation
7709   animation.Play();
7710
7711   // Should return the target property after play
7712   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(0.0f, 0.0f, targetDepth), TEST_LOCATION);
7713   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION);
7714
7715   bool                 signalReceived(false);
7716   AnimationFinishCheck finishCheck(signalReceived);
7717   animation.FinishedSignal().Connect(&application, finishCheck);
7718
7719   application.SendNotification();
7720   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7721
7722   // We didn't expect the animation to finish yet
7723   application.SendNotification();
7724   finishCheck.CheckSignalNotReceived();
7725   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, fiftyPercentProgress, TEST_LOCATION);
7726
7727   application.SendNotification();
7728   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7729
7730   // We did expect the animation to finish
7731   application.SendNotification();
7732   finishCheck.CheckSignalReceived();
7733   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, targetDepth, TEST_LOCATION);
7734   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION);
7735   END_TEST;
7736 }
7737
7738 int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void)
7739 {
7740   TestApplication application;
7741
7742   Actor actor = Actor::New();
7743   application.GetScene().Add(actor);
7744   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7745
7746   // Build the animation
7747   float     durationSeconds(1.0f);
7748   Animation animation = Animation::New(durationSeconds);
7749   Vector3   targetSize(100.0f, 100.0f, 100.0f);
7750   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize);
7751
7752   Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7753
7754   // Start the animation
7755   animation.Play();
7756
7757   bool                 signalReceived(false);
7758   AnimationFinishCheck finishCheck(signalReceived);
7759   animation.FinishedSignal().Connect(&application, finishCheck);
7760
7761   application.SendNotification();
7762   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7763
7764   // We didn't expect the animation to finish yet
7765   application.SendNotification();
7766   finishCheck.CheckSignalNotReceived();
7767   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), ninetyNinePercentProgress, TEST_LOCATION);
7768
7769   application.SendNotification();
7770   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7771
7772   // We did expect the animation to finish
7773   application.SendNotification();
7774   finishCheck.CheckSignalReceived();
7775   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7776
7777   // Reset everything
7778   finishCheck.Reset();
7779   actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7780   application.SendNotification();
7781   application.Render(0);
7782   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7783
7784   // Repeat with a different (ease-in) alpha function
7785   animation = Animation::New(durationSeconds);
7786   animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetSize.x, AlphaFunction::EASE_IN);
7787   animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetSize.y, AlphaFunction::EASE_IN);
7788   animation.FinishedSignal().Connect(&application, finishCheck);
7789   animation.Play();
7790
7791   application.SendNotification();
7792   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7793
7794   // We didn't expect the animation to finish yet
7795   application.SendNotification();
7796   finishCheck.CheckSignalNotReceived();
7797
7798   // The size should have travelled less, than with a linear alpha function
7799   Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
7800   DALI_TEST_CHECK(current.x > 0.0f);
7801   DALI_TEST_CHECK(current.y > 0.0f);
7802   DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
7803   DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
7804
7805   application.SendNotification();
7806   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7807
7808   // We did expect the animation to finish
7809   application.SendNotification();
7810   finishCheck.CheckSignalReceived();
7811   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).x, targetSize.x, TEST_LOCATION);
7812   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).y, targetSize.y, TEST_LOCATION);
7813
7814   // Reset everything
7815   finishCheck.Reset();
7816   actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7817   application.SendNotification();
7818   application.Render(0);
7819   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7820
7821   // Repeat with a delay
7822   float delay = 0.5f;
7823   animation   = Animation::New(durationSeconds);
7824   animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetSize.x, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7825   animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetSize.y, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7826   animation.FinishedSignal().Connect(&application, finishCheck);
7827   animation.Play();
7828
7829   application.SendNotification();
7830   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7831
7832   // We didn't expect the animation to finish yet
7833   application.SendNotification();
7834   finishCheck.CheckSignalNotReceived();
7835   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7836
7837   application.SendNotification();
7838   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7839
7840   // We did expect the animation to finish
7841   application.SendNotification();
7842   finishCheck.CheckSignalReceived();
7843   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).x, targetSize.x, TEST_LOCATION);
7844   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).y, targetSize.y, TEST_LOCATION);
7845   END_TEST;
7846 }
7847
7848 int UtcDaliAnimationAnimateToActorPositionP(void)
7849 {
7850   TestApplication application;
7851
7852   Actor actor = Actor::New();
7853   application.GetScene().Add(actor);
7854   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7855
7856   // Build the animation
7857   float     durationSeconds(1.0f);
7858   Animation animation = Animation::New(durationSeconds);
7859   Vector3   targetPosition(200.0f, 200.0f, 200.0f);
7860   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
7861
7862   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7863
7864   // Should return the initial properties before play
7865   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7866   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
7867   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), 0.0f, TEST_LOCATION);
7868   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), 0.0f, TEST_LOCATION);
7869
7870   // Start the animation
7871   animation.Play();
7872
7873   // Should return the target property after play
7874   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7875   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
7876   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
7877   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
7878
7879   bool                 signalReceived(false);
7880   AnimationFinishCheck finishCheck(signalReceived);
7881   animation.FinishedSignal().Connect(&application, finishCheck);
7882
7883   application.SendNotification();
7884   application.Render(static_cast<unsigned int>(durationSeconds * 750.0f) /* 75% progress */);
7885
7886   // We didn't expect the animation to finish yet
7887   application.SendNotification();
7888   finishCheck.CheckSignalNotReceived();
7889   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION);
7890
7891   application.SendNotification();
7892   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7893
7894   // We did expect the animation to finish
7895   application.SendNotification();
7896   finishCheck.CheckSignalReceived();
7897   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7898   END_TEST;
7899 }
7900
7901 int UtcDaliAnimationAnimateToActorPositionXP(void)
7902 {
7903   TestApplication application;
7904
7905   Actor actor = Actor::New();
7906   application.GetScene().Add(actor);
7907   float startValue(0.0f);
7908   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, startValue, TEST_LOCATION);
7909   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7910   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7911   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7912
7913   // Build the animation
7914   float     durationSeconds(1.0f);
7915   Animation animation = Animation::New(durationSeconds);
7916   float     targetX(1.0f);
7917   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), targetX);
7918
7919   float fiftyPercentProgress(startValue + (targetX - startValue) * 0.5f);
7920
7921   // Should return the initial properties before play
7922   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7923   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7924
7925   // Start the animation
7926   animation.Play();
7927
7928   // Should return the target property after play
7929   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(targetX, 0.0f, 0.0f), TEST_LOCATION);
7930   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION);
7931
7932   bool                 signalReceived(false);
7933   AnimationFinishCheck finishCheck(signalReceived);
7934   animation.FinishedSignal().Connect(&application, finishCheck);
7935
7936   application.SendNotification();
7937   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7938
7939   // We didn't expect the animation to finish yet
7940   application.SendNotification();
7941   finishCheck.CheckSignalNotReceived();
7942   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, fiftyPercentProgress, TEST_LOCATION);
7943
7944   application.SendNotification();
7945   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7946
7947   // We did expect the animation to finish
7948   application.SendNotification();
7949   finishCheck.CheckSignalReceived();
7950   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, targetX, TEST_LOCATION);
7951   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION);
7952   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7953   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7954   END_TEST;
7955 }
7956
7957 int UtcDaliAnimationAnimateToActorPositionYP(void)
7958 {
7959   TestApplication application;
7960
7961   Actor actor = Actor::New();
7962   application.GetScene().Add(actor);
7963   float startValue(0.0f);
7964   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, startValue, TEST_LOCATION);
7965   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7966   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7967   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7968
7969   // Build the animation
7970   float     durationSeconds(1.0f);
7971   Animation animation = Animation::New(durationSeconds);
7972   float     targetY(10.0f);
7973   animation.AnimateTo(Property(actor, Actor::Property::POSITION_Y), targetY);
7974
7975   float fiftyPercentProgress(startValue + (targetY - startValue) * 0.5f);
7976
7977   // Should return the initial properties before play
7978   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7979   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7980
7981   // Start the animation
7982   animation.Play();
7983
7984   // Should return the target property after play
7985   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, targetY, 0.0f), TEST_LOCATION);
7986   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION);
7987
7988   bool                 signalReceived(false);
7989   AnimationFinishCheck finishCheck(signalReceived);
7990   animation.FinishedSignal().Connect(&application, finishCheck);
7991
7992   application.SendNotification();
7993   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7994
7995   // We didn't expect the animation to finish yet
7996   application.SendNotification();
7997   finishCheck.CheckSignalNotReceived();
7998   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, fiftyPercentProgress, TEST_LOCATION);
7999
8000   application.SendNotification();
8001   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8002
8003   // We did expect the animation to finish
8004   application.SendNotification();
8005   finishCheck.CheckSignalReceived();
8006   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, targetY, TEST_LOCATION);
8007   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
8008   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION);
8009   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
8010   END_TEST;
8011 }
8012
8013 int UtcDaliAnimationAnimateToActorPositionZP(void)
8014 {
8015   TestApplication application;
8016
8017   Actor actor = Actor::New();
8018   application.GetScene().Add(actor);
8019   float startValue(0.0f);
8020   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, startValue, TEST_LOCATION);
8021   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
8022   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
8023   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
8024
8025   // Build the animation
8026   float     durationSeconds(1.0f);
8027   Animation animation = Animation::New(durationSeconds);
8028   float     targetZ(-5.0f);
8029   animation.AnimateTo(Property(actor, Actor::Property::POSITION_Z), targetZ);
8030
8031   float fiftyPercentProgress(startValue + (targetZ - startValue) * 0.5f);
8032
8033   // Should return the initial properties before play
8034   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
8035   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
8036
8037   // Start the animation
8038   animation.Play();
8039
8040   // Should return the target property after play
8041   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, targetZ), TEST_LOCATION);
8042   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION);
8043
8044   bool                 signalReceived(false);
8045   AnimationFinishCheck finishCheck(signalReceived);
8046   animation.FinishedSignal().Connect(&application, finishCheck);
8047
8048   application.SendNotification();
8049   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8050
8051   // We didn't expect the animation to finish yet
8052   application.SendNotification();
8053   finishCheck.CheckSignalNotReceived();
8054   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, fiftyPercentProgress, TEST_LOCATION);
8055
8056   application.SendNotification();
8057   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8058
8059   // We did expect the animation to finish
8060   application.SendNotification();
8061   finishCheck.CheckSignalReceived();
8062   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, targetZ, TEST_LOCATION);
8063   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
8064   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
8065   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION);
8066   END_TEST;
8067 }
8068
8069 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void)
8070 {
8071   TestApplication application;
8072
8073   Actor actor = Actor::New();
8074   application.GetScene().Add(actor);
8075   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
8076
8077   // Build the animation
8078   float     durationSeconds(1.0f);
8079   Animation animation = Animation::New(durationSeconds);
8080   Vector3   targetPosition(200.0f, 200.0f, 200.0f);
8081   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
8082
8083   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
8084
8085   // Start the animation
8086   animation.Play();
8087
8088   bool                 signalReceived(false);
8089   AnimationFinishCheck finishCheck(signalReceived);
8090   animation.FinishedSignal().Connect(&application, finishCheck);
8091
8092   application.SendNotification();
8093   application.Render(static_cast<unsigned int>(durationSeconds * 750.0f) /* 75% progress */);
8094
8095   // We didn't expect the animation to finish yet
8096   application.SendNotification();
8097   finishCheck.CheckSignalNotReceived();
8098
8099   // The position should have moved less, than with a linear alpha function
8100   Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
8101   DALI_TEST_CHECK(current.x > Vector3::ZERO.x);
8102   DALI_TEST_CHECK(current.y > Vector3::ZERO.y);
8103   DALI_TEST_CHECK(current.z > Vector3::ZERO.z);
8104   DALI_TEST_CHECK(current.x < seventyFivePercentProgress.x);
8105   DALI_TEST_CHECK(current.y < seventyFivePercentProgress.y);
8106   DALI_TEST_CHECK(current.z < seventyFivePercentProgress.z);
8107
8108   application.SendNotification();
8109   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8110
8111   // We did expect the animation to finish
8112   application.SendNotification();
8113   finishCheck.CheckSignalReceived();
8114   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
8115   END_TEST;
8116 }
8117
8118 int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void)
8119 {
8120   TestApplication application;
8121
8122   Actor actor = Actor::New();
8123   application.GetScene().Add(actor);
8124   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
8125
8126   // Build the animation
8127   float     durationSeconds(1.0f);
8128   Animation animation = Animation::New(durationSeconds);
8129   Vector3   targetPosition(200.0f, 200.0f, 200.0f);
8130   float     delay = 0.5f;
8131   animation.AnimateTo(Property(actor, Actor::Property::POSITION),
8132                       targetPosition,
8133                       TimePeriod(delay, durationSeconds - delay));
8134
8135   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
8136
8137   // Start the animation
8138   animation.Play();
8139
8140   bool                 signalReceived(false);
8141   AnimationFinishCheck finishCheck(signalReceived);
8142   animation.FinishedSignal().Connect(&application, finishCheck);
8143
8144   application.SendNotification();
8145   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
8146
8147   // We didn't expect the animation to finish yet
8148   application.SendNotification();
8149   finishCheck.CheckSignalNotReceived();
8150   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
8151
8152   application.SendNotification();
8153   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.75) /* 7/8 animation progress, 3/4 animator progress */);
8154
8155   // We didn't expect the animation to finish yet
8156   application.SendNotification();
8157   finishCheck.CheckSignalNotReceived();
8158   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION);
8159
8160   application.SendNotification();
8161   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.25) + 1u /*just beyond the animation duration*/);
8162
8163   // We did expect the animation to finish
8164   application.SendNotification();
8165   finishCheck.CheckSignalReceived();
8166   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
8167   END_TEST;
8168 }
8169
8170 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void)
8171 {
8172   TestApplication application;
8173
8174   Actor actor = Actor::New();
8175   application.GetScene().Add(actor);
8176   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
8177
8178   // Build the animation
8179   float     durationSeconds(1.0f);
8180   Animation animation = Animation::New(durationSeconds);
8181   Vector3   targetPosition(200.0f, 200.0f, 200.0f);
8182   float     delay = 0.5f;
8183   animation.AnimateTo(Property(actor, Actor::Property::POSITION),
8184                       targetPosition,
8185                       AlphaFunction::LINEAR,
8186                       TimePeriod(delay, durationSeconds - delay));
8187
8188   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
8189
8190   // Start the animation
8191   animation.Play();
8192
8193   bool                 signalReceived(false);
8194   AnimationFinishCheck finishCheck(signalReceived);
8195   animation.FinishedSignal().Connect(&application, finishCheck);
8196
8197   application.SendNotification();
8198   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
8199
8200   // We didn't expect the animation to finish yet
8201   application.SendNotification();
8202   finishCheck.CheckSignalNotReceived();
8203   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
8204
8205   application.SendNotification();
8206   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.75) /* 7/8 animation progress, 3/4 animator progress */);
8207
8208   // We didn't expect the animation to finish yet
8209   application.SendNotification();
8210   finishCheck.CheckSignalNotReceived();
8211   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION);
8212
8213   application.SendNotification();
8214   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.25) + 1u /*just beyond the animation duration*/);
8215
8216   // We did expect the animation to finish
8217   application.SendNotification();
8218   finishCheck.CheckSignalReceived();
8219   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
8220   END_TEST;
8221 }
8222
8223 int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void)
8224 {
8225   TestApplication application;
8226
8227   Actor actor = Actor::New();
8228   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8229   application.GetScene().Add(actor);
8230   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8231
8232   // Build the animation
8233   float     durationSeconds(1.0f);
8234   Animation animation = Animation::New(durationSeconds);
8235   Degree    targetRotationDegrees(90.0f);
8236   Radian    targetRotationRadians(targetRotationDegrees);
8237   animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS));
8238
8239   // Start the animation
8240   animation.Play();
8241
8242   // Target value should be retrievable straight away
8243   DALI_TEST_EQUALS(actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8244
8245   bool                 signalReceived(false);
8246   AnimationFinishCheck finishCheck(signalReceived);
8247   animation.FinishedSignal().Connect(&application, finishCheck);
8248
8249   application.SendNotification();
8250   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8251
8252   // We didn't expect the animation to finish yet
8253   application.SendNotification();
8254   finishCheck.CheckSignalNotReceived();
8255   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8256
8257   application.SendNotification();
8258   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8259
8260   // We didn't expect the animation to finish yet
8261   application.SendNotification();
8262   finishCheck.CheckSignalNotReceived();
8263   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8264
8265   application.SendNotification();
8266   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8267
8268   // We didn't expect the animation to finish yet
8269   application.SendNotification();
8270   finishCheck.CheckSignalNotReceived();
8271   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8272
8273   application.SendNotification();
8274   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8275
8276   // We did expect the animation to finish
8277   application.SendNotification();
8278   finishCheck.CheckSignalReceived();
8279   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8280   END_TEST;
8281 }
8282
8283 int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void)
8284 {
8285   TestApplication application;
8286
8287   Actor actor = Actor::New();
8288   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8289   application.GetScene().Add(actor);
8290   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8291
8292   // Build the animation
8293   float      durationSeconds(1.0f);
8294   Animation  animation = Animation::New(durationSeconds);
8295   Degree     targetRotationDegrees(90.0f);
8296   Radian     targetRotationRadians(targetRotationDegrees);
8297   Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
8298   animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), targetRotation);
8299
8300   // Start the animation
8301   animation.Play();
8302
8303   bool                 signalReceived(false);
8304   AnimationFinishCheck finishCheck(signalReceived);
8305   animation.FinishedSignal().Connect(&application, finishCheck);
8306
8307   application.SendNotification();
8308   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8309
8310   // We didn't expect the animation to finish yet
8311   application.SendNotification();
8312   finishCheck.CheckSignalNotReceived();
8313   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8314
8315   application.SendNotification();
8316   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8317
8318   // We didn't expect the animation to finish yet
8319   application.SendNotification();
8320   finishCheck.CheckSignalNotReceived();
8321   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8322
8323   application.SendNotification();
8324   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8325
8326   // We didn't expect the animation to finish yet
8327   application.SendNotification();
8328   finishCheck.CheckSignalNotReceived();
8329   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8330
8331   application.SendNotification();
8332   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8333
8334   // We did expect the animation to finish
8335   application.SendNotification();
8336   finishCheck.CheckSignalReceived();
8337   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8338   END_TEST;
8339 }
8340
8341 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void)
8342 {
8343   TestApplication application;
8344
8345   Actor actor = Actor::New();
8346   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8347   application.GetScene().Add(actor);
8348   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8349
8350   // Build the animation
8351   float     durationSeconds(1.0f);
8352   Animation animation = Animation::New(durationSeconds);
8353   Degree    targetRotationDegrees(90.0f);
8354   Radian    targetRotationRadians(targetRotationDegrees);
8355   animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
8356
8357   // Start the animation
8358   animation.Play();
8359
8360   bool                 signalReceived(false);
8361   AnimationFinishCheck finishCheck(signalReceived);
8362   animation.FinishedSignal().Connect(&application, finishCheck);
8363
8364   application.SendNotification();
8365   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8366
8367   // We didn't expect the animation to finish yet
8368   application.SendNotification();
8369   finishCheck.CheckSignalNotReceived();
8370   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f * 0.25f * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8371
8372   application.SendNotification();
8373   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8374
8375   // We didn't expect the animation to finish yet
8376   application.SendNotification();
8377   finishCheck.CheckSignalNotReceived();
8378   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f * 0.5f * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8379
8380   application.SendNotification();
8381   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8382
8383   // We didn't expect the animation to finish yet
8384   application.SendNotification();
8385   finishCheck.CheckSignalNotReceived();
8386   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f * 0.75f * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8387
8388   application.SendNotification();
8389   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8390
8391   // We did expect the animation to finish
8392   application.SendNotification();
8393   finishCheck.CheckSignalReceived();
8394   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8395   END_TEST;
8396 }
8397
8398 int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void)
8399 {
8400   TestApplication application;
8401
8402   Actor actor = Actor::New();
8403   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8404   application.GetScene().Add(actor);
8405   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8406
8407   // Build the animation
8408   float     durationSeconds(1.0f);
8409   Animation animation = Animation::New(durationSeconds);
8410   Degree    targetRotationDegrees(90.0f);
8411   Radian    targetRotationRadians(targetRotationDegrees);
8412   float     delay(0.1f);
8413   animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
8414
8415   // Start the animation
8416   animation.Play();
8417
8418   bool                 signalReceived(false);
8419   AnimationFinishCheck finishCheck(signalReceived);
8420   animation.FinishedSignal().Connect(&application, finishCheck);
8421
8422   application.SendNotification();
8423   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8424
8425   // We didn't expect the animation to finish yet
8426   application.SendNotification();
8427   finishCheck.CheckSignalNotReceived();
8428   float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
8429   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8430
8431   application.SendNotification();
8432   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8433
8434   // We didn't expect the animation to finish yet
8435   application.SendNotification();
8436   finishCheck.CheckSignalNotReceived();
8437   progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
8438   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8439
8440   application.SendNotification();
8441   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8442
8443   // We didn't expect the animation to finish yet
8444   application.SendNotification();
8445   finishCheck.CheckSignalNotReceived();
8446   progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
8447   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8448
8449   application.SendNotification();
8450   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8451
8452   // We did expect the animation to finish
8453   application.SendNotification();
8454   finishCheck.CheckSignalReceived();
8455   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8456   END_TEST;
8457 }
8458
8459 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void)
8460 {
8461   TestApplication application;
8462
8463   Actor actor = Actor::New();
8464   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8465   application.GetScene().Add(actor);
8466   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8467
8468   // Build the animation
8469   float     durationSeconds(1.0f);
8470   Animation animation = Animation::New(durationSeconds);
8471   Degree    targetRotationDegrees(90.0f);
8472   Radian    targetRotationRadians(targetRotationDegrees);
8473   float     delay(0.1f);
8474   animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
8475
8476   // Start the animation
8477   animation.Play();
8478
8479   bool                 signalReceived(false);
8480   AnimationFinishCheck finishCheck(signalReceived);
8481   animation.FinishedSignal().Connect(&application, finishCheck);
8482
8483   application.SendNotification();
8484   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8485
8486   // We didn't expect the animation to finish yet
8487   application.SendNotification();
8488   finishCheck.CheckSignalNotReceived();
8489   float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
8490   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8491
8492   application.SendNotification();
8493   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8494
8495   // We didn't expect the animation to finish yet
8496   application.SendNotification();
8497   finishCheck.CheckSignalNotReceived();
8498   progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
8499   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8500
8501   application.SendNotification();
8502   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8503
8504   // We didn't expect the animation to finish yet
8505   application.SendNotification();
8506   finishCheck.CheckSignalNotReceived();
8507   progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
8508   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8509
8510   application.SendNotification();
8511   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8512
8513   // We did expect the animation to finish
8514   application.SendNotification();
8515   finishCheck.CheckSignalReceived();
8516   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8517   END_TEST;
8518 }
8519
8520 int UtcDaliAnimationAnimateToActorScaleP(void)
8521 {
8522   TestApplication application;
8523
8524   Actor actor = Actor::New();
8525   application.GetScene().Add(actor);
8526   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8527
8528   // Build the animation
8529   float     durationSeconds(1.0f);
8530   Animation animation = Animation::New(durationSeconds);
8531   Vector3   targetScale(2.0f, 2.0f, 2.0f);
8532   animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale);
8533
8534   Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE) * 0.99f);
8535
8536   // Start the animation
8537   animation.Play();
8538
8539   // Target value should be retrievable straight away
8540   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8541   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), targetScale.x, TEST_LOCATION);
8542   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), targetScale.y, TEST_LOCATION);
8543   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), targetScale.z, TEST_LOCATION);
8544
8545   bool                 signalReceived(false);
8546   AnimationFinishCheck finishCheck(signalReceived);
8547   animation.FinishedSignal().Connect(&application, finishCheck);
8548
8549   application.SendNotification();
8550   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
8551
8552   // We didn't expect the animation to finish yet
8553   application.SendNotification();
8554   finishCheck.CheckSignalNotReceived();
8555   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), ninetyNinePercentProgress, TEST_LOCATION);
8556
8557   application.SendNotification();
8558   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
8559
8560   // We did expect the animation to finish
8561   application.SendNotification();
8562   finishCheck.CheckSignalReceived();
8563   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8564
8565   // Reset everything
8566   finishCheck.Reset();
8567   actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
8568   application.SendNotification();
8569   application.Render(0);
8570   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8571
8572   // Repeat with a different (ease-in) alpha function
8573   animation = Animation::New(durationSeconds);
8574   animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
8575   animation.FinishedSignal().Connect(&application, finishCheck);
8576   animation.Play();
8577
8578   application.SendNotification();
8579   application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
8580
8581   // We didn't expect the animation to finish yet
8582   application.SendNotification();
8583   finishCheck.CheckSignalNotReceived();
8584
8585   // The scale should have grown less, than with a linear alpha function
8586   Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
8587   DALI_TEST_CHECK(current.x > 1.0f);
8588   DALI_TEST_CHECK(current.y > 1.0f);
8589   DALI_TEST_CHECK(current.z > 1.0f);
8590   DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
8591   DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
8592   DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z);
8593
8594   application.SendNotification();
8595   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
8596
8597   // We did expect the animation to finish
8598   application.SendNotification();
8599   finishCheck.CheckSignalReceived();
8600   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8601
8602   // Reset everything
8603   finishCheck.Reset();
8604   actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
8605   application.SendNotification();
8606   application.Render(0);
8607   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8608
8609   // Repeat with a delay
8610   float delay = 0.5f;
8611   animation   = Animation::New(durationSeconds);
8612   animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
8613   animation.FinishedSignal().Connect(&application, finishCheck);
8614   animation.Play();
8615
8616   application.SendNotification();
8617   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator 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), Vector3::ONE, TEST_LOCATION);
8623
8624   application.SendNotification();
8625   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8626
8627   // We did expect the animation to finish
8628   application.SendNotification();
8629   finishCheck.CheckSignalReceived();
8630   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8631   END_TEST;
8632 }
8633
8634 int UtcDaliAnimationAnimateToActorScaleXP(void)
8635 {
8636   TestApplication application;
8637
8638   Actor actor = Actor::New();
8639   application.GetScene().Add(actor);
8640   float startValue(1.0f);
8641   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, startValue, TEST_LOCATION);
8642   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8643   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8644   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8645   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8646   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8647   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8648
8649   // Build the animation
8650   float     durationSeconds(1.0f);
8651   Animation animation = Animation::New(durationSeconds);
8652   float     targetX(10.0f);
8653   animation.AnimateTo(Property(actor, Actor::Property::SCALE_X), targetX);
8654
8655   float fiftyPercentProgress(startValue + (targetX - startValue) * 0.5f);
8656
8657   // Start the animation
8658   animation.Play();
8659
8660   // Target value should be retrievable straight away
8661   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3(targetX, startValue, startValue), TEST_LOCATION);
8662   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), targetX, TEST_LOCATION);
8663
8664   bool                 signalReceived(false);
8665   AnimationFinishCheck finishCheck(signalReceived);
8666   animation.FinishedSignal().Connect(&application, finishCheck);
8667
8668   application.SendNotification();
8669   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8670
8671   // We didn't expect the animation to finish yet
8672   application.SendNotification();
8673   finishCheck.CheckSignalNotReceived();
8674   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, fiftyPercentProgress, TEST_LOCATION);
8675   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), fiftyPercentProgress, TEST_LOCATION);
8676   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8677   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8678
8679   application.SendNotification();
8680   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8681
8682   // We did expect the animation to finish
8683   application.SendNotification();
8684   finishCheck.CheckSignalReceived();
8685   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, targetX, TEST_LOCATION);
8686   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), targetX, TEST_LOCATION);
8687   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8688   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8689   END_TEST;
8690 }
8691
8692 int UtcDaliAnimationAnimateToActorScaleYP(void)
8693 {
8694   TestApplication application;
8695
8696   Actor actor = Actor::New();
8697   application.GetScene().Add(actor);
8698   float startValue(1.0f);
8699   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, startValue, TEST_LOCATION);
8700   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8701   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8702   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8703   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8704   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8705   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8706
8707   // Build the animation
8708   float     durationSeconds(1.0f);
8709   Animation animation = Animation::New(durationSeconds);
8710   float     targetY(1000.0f);
8711   animation.AnimateTo(Property(actor, Actor::Property::SCALE_Y), targetY);
8712
8713   float fiftyPercentProgress(startValue + (targetY - startValue) * 0.5f);
8714
8715   // Start the animation
8716   animation.Play();
8717
8718   // Target value should be retrievable straight away
8719   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3(startValue, targetY, startValue), TEST_LOCATION);
8720   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), targetY, TEST_LOCATION);
8721
8722   bool                 signalReceived(false);
8723   AnimationFinishCheck finishCheck(signalReceived);
8724   animation.FinishedSignal().Connect(&application, finishCheck);
8725
8726   application.SendNotification();
8727   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8728
8729   // We didn't expect the animation to finish yet
8730   application.SendNotification();
8731   finishCheck.CheckSignalNotReceived();
8732   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, fiftyPercentProgress, TEST_LOCATION);
8733   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8734   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), fiftyPercentProgress, TEST_LOCATION);
8735   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8736
8737   application.SendNotification();
8738   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8739
8740   // We did expect the animation to finish
8741   application.SendNotification();
8742   finishCheck.CheckSignalReceived();
8743   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, targetY, TEST_LOCATION);
8744   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8745   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), targetY, TEST_LOCATION);
8746   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8747   END_TEST;
8748 }
8749
8750 int UtcDaliAnimationAnimateToActorScaleZP(void)
8751 {
8752   TestApplication application;
8753
8754   Actor actor = Actor::New();
8755   application.GetScene().Add(actor);
8756   float startValue(1.0f);
8757   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, startValue, TEST_LOCATION);
8758   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8759   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8760   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8761   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8762   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8763   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8764
8765   // Build the animation
8766   float     durationSeconds(1.0f);
8767   Animation animation = Animation::New(durationSeconds);
8768   float     targetZ(-1000.0f);
8769   animation.AnimateTo(Property(actor, Actor::Property::SCALE_Z), targetZ);
8770
8771   float fiftyPercentProgress(startValue + (targetZ - startValue) * 0.5f);
8772
8773   // Start the animation
8774   animation.Play();
8775
8776   // Target value should be retrievable straight away
8777   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3(startValue, startValue, targetZ), TEST_LOCATION);
8778   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), targetZ, TEST_LOCATION);
8779
8780   bool                 signalReceived(false);
8781   AnimationFinishCheck finishCheck(signalReceived);
8782   animation.FinishedSignal().Connect(&application, finishCheck);
8783
8784   application.SendNotification();
8785   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8786
8787   // We didn't expect the animation to finish yet
8788   application.SendNotification();
8789   finishCheck.CheckSignalNotReceived();
8790   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, fiftyPercentProgress, TEST_LOCATION);
8791   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8792   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8793   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), fiftyPercentProgress, TEST_LOCATION);
8794
8795   application.SendNotification();
8796   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8797
8798   // We did expect the animation to finish
8799   application.SendNotification();
8800   finishCheck.CheckSignalReceived();
8801   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, targetZ, TEST_LOCATION);
8802   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8803   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8804   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), targetZ, TEST_LOCATION);
8805   END_TEST;
8806 }
8807
8808 int UtcDaliAnimationAnimateToActorColorP(void)
8809 {
8810   TestApplication application;
8811
8812   Actor actor = Actor::New();
8813   application.GetScene().Add(actor);
8814   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
8815
8816   // Build the animation
8817   float     durationSeconds(1.0f);
8818   Animation animation = Animation::New(durationSeconds);
8819   Vector4   targetColor(Color::RED);
8820   animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor);
8821
8822   Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
8823   Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
8824
8825   // Start the animation
8826   animation.Play();
8827
8828   // Target value should be retrievable straight away
8829   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8830   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION);
8831   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION);
8832   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION);
8833   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION);
8834   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::OPACITY), targetColor.a, TEST_LOCATION);
8835
8836   bool                 signalReceived(false);
8837   AnimationFinishCheck finishCheck(signalReceived);
8838   animation.FinishedSignal().Connect(&application, finishCheck);
8839
8840   application.SendNotification();
8841   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
8842
8843   // We didn't expect the animation to finish yet
8844   application.SendNotification();
8845   finishCheck.CheckSignalNotReceived();
8846   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), tenPercentProgress, TEST_LOCATION);
8847
8848   application.SendNotification();
8849   application.Render(static_cast<unsigned int>(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/);
8850
8851   // We did expect the animation to finish
8852   application.SendNotification();
8853   finishCheck.CheckSignalReceived();
8854   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8855
8856   // Reset everything
8857   finishCheck.Reset();
8858   actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
8859   application.SendNotification();
8860   application.Render(0);
8861   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
8862
8863   // Repeat with a different (ease-in) alpha function
8864   animation = Animation::New(durationSeconds);
8865   animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
8866   animation.FinishedSignal().Connect(&application, finishCheck);
8867   animation.Play();
8868
8869   application.SendNotification();
8870   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
8871
8872   // We didn't expect the animation to finish yet
8873   application.SendNotification();
8874   finishCheck.CheckSignalNotReceived();
8875
8876   // The color should have changed less, than with a linear alpha function
8877   Vector4 current(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
8878   DALI_TEST_CHECK(current.x == 1.0f); // doesn't change
8879   DALI_TEST_CHECK(current.y < 1.0f);
8880   DALI_TEST_CHECK(current.y > tenPercentProgress.y);
8881   DALI_TEST_CHECK(current.z < 1.0f);
8882   DALI_TEST_CHECK(current.z > tenPercentProgress.z);
8883   DALI_TEST_CHECK(current.w == 1.0f); // doesn't change
8884
8885   application.SendNotification();
8886   application.Render(static_cast<unsigned int>(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/);
8887
8888   // We did expect the animation to finish
8889   application.SendNotification();
8890   finishCheck.CheckSignalReceived();
8891   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8892
8893   // Reset everything
8894   finishCheck.Reset();
8895   actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
8896   application.SendNotification();
8897   application.Render(0);
8898   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
8899
8900   // Repeat with a shorter animator duration
8901   float animatorDuration = 0.5f;
8902   animation              = Animation::New(durationSeconds);
8903   animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
8904   animation.FinishedSignal().Connect(&application, finishCheck);
8905   animation.Play();
8906
8907   application.SendNotification();
8908   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% animation progress, 20% animator progress */);
8909
8910   // We didn't expect the animation to finish yet
8911   application.SendNotification();
8912   finishCheck.CheckSignalNotReceived();
8913   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), twentyPercentProgress, TEST_LOCATION);
8914
8915   application.SendNotification();
8916   application.Render(static_cast<unsigned int>(durationSeconds * 400.0f) /* 50% animation progress, 100% animator progress */);
8917
8918   // We didn't expect the animation to finish yet
8919   application.SendNotification();
8920   finishCheck.CheckSignalNotReceived();
8921   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8922
8923   application.SendNotification();
8924   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8925
8926   // We did expect the animation to finish
8927   application.SendNotification();
8928   finishCheck.CheckSignalReceived();
8929   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8930   END_TEST;
8931 }
8932
8933 int UtcDaliAnimationAnimateToActorColorRedP(void)
8934 {
8935   TestApplication application;
8936
8937   Actor actor = Actor::New();
8938   application.GetScene().Add(actor);
8939   float startValue(1.0f);
8940   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, startValue, TEST_LOCATION);
8941   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8942   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8943   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8944   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8945   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8946   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8947   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8948   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8949
8950   // Build the animation
8951   float     durationSeconds(1.0f);
8952   Animation animation = Animation::New(durationSeconds);
8953   float     targetRed(0.5f);
8954   animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetRed);
8955
8956   float fiftyPercentProgress(startValue + (targetRed - startValue) * 0.5f);
8957
8958   // Start the animation
8959   animation.Play();
8960
8961   // Target value should be retrievable straight away
8962   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(targetRed, startValue, startValue, startValue), TEST_LOCATION);
8963   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetRed, TEST_LOCATION);
8964
8965   bool                 signalReceived(false);
8966   AnimationFinishCheck finishCheck(signalReceived);
8967   animation.FinishedSignal().Connect(&application, finishCheck);
8968
8969   application.SendNotification();
8970   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8971
8972   // We didn't expect the animation to finish yet
8973   application.SendNotification();
8974   finishCheck.CheckSignalNotReceived();
8975   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, fiftyPercentProgress, TEST_LOCATION);
8976   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION);
8977   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8978   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8979   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8980
8981   application.SendNotification();
8982   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8983
8984   // We did expect the animation to finish
8985   application.SendNotification();
8986   finishCheck.CheckSignalReceived();
8987   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, targetRed, TEST_LOCATION);
8988   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), targetRed, TEST_LOCATION);
8989   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8990   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8991   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8992   END_TEST;
8993 }
8994
8995 int UtcDaliAnimationAnimateToActorColorGreenP(void)
8996 {
8997   TestApplication application;
8998
8999   Actor actor = Actor::New();
9000   application.GetScene().Add(actor);
9001   float startValue(1.0f);
9002   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, startValue, TEST_LOCATION);
9003   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9004   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9005   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9006   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, 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), startValue, TEST_LOCATION);
9011
9012   // Build the animation
9013   float     durationSeconds(1.0f);
9014   Animation animation = Animation::New(durationSeconds);
9015   float     targetGreen(0.5f);
9016   animation.AnimateTo(Property(actor, Actor::Property::COLOR_GREEN), targetGreen);
9017
9018   float fiftyPercentProgress(startValue + (targetGreen - startValue) * 0.5f);
9019
9020   // Start the animation
9021   animation.Play();
9022
9023   // Target value should be retrievable straight away
9024   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(startValue, targetGreen, startValue, startValue), TEST_LOCATION);
9025   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION);
9026
9027   bool                 signalReceived(false);
9028   AnimationFinishCheck finishCheck(signalReceived);
9029   animation.FinishedSignal().Connect(&application, finishCheck);
9030
9031   application.SendNotification();
9032   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
9033
9034   // We didn't expect the animation to finish yet
9035   application.SendNotification();
9036   finishCheck.CheckSignalNotReceived();
9037   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, fiftyPercentProgress, TEST_LOCATION);
9038   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9039   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION);
9040   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9041   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9042
9043   application.SendNotification();
9044   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
9045
9046   // We did expect the animation to finish
9047   application.SendNotification();
9048   finishCheck.CheckSignalReceived();
9049   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, targetGreen, TEST_LOCATION);
9050   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9051   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION);
9052   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9053   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9054   END_TEST;
9055 }
9056
9057 int UtcDaliAnimationAnimateToActorColorBlueP(void)
9058 {
9059   TestApplication application;
9060
9061   Actor actor = Actor::New();
9062   application.GetScene().Add(actor);
9063   float startValue(1.0f);
9064   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, startValue, TEST_LOCATION);
9065   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9066   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9067   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9068   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9069   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9070   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9071   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9072   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9073
9074   // Build the animation
9075   float     durationSeconds(1.0f);
9076   Animation animation = Animation::New(durationSeconds);
9077   float     targetBlue(0.5f);
9078   animation.AnimateTo(Property(actor, Actor::Property::COLOR_BLUE), targetBlue);
9079
9080   float fiftyPercentProgress(startValue + (targetBlue - startValue) * 0.5f);
9081
9082   // Start the animation
9083   animation.Play();
9084
9085   // Target value should be retrievable straight away
9086   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(startValue, startValue, targetBlue, startValue), TEST_LOCATION);
9087   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetBlue, TEST_LOCATION);
9088
9089   bool                 signalReceived(false);
9090   AnimationFinishCheck finishCheck(signalReceived);
9091   animation.FinishedSignal().Connect(&application, finishCheck);
9092
9093   application.SendNotification();
9094   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
9095
9096   // We didn't expect the animation to finish yet
9097   application.SendNotification();
9098   finishCheck.CheckSignalNotReceived();
9099   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, fiftyPercentProgress, TEST_LOCATION);
9100   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9101   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9102   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), fiftyPercentProgress, TEST_LOCATION);
9103   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9104
9105   application.SendNotification();
9106   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
9107
9108   // We did expect the animation to finish
9109   application.SendNotification();
9110   finishCheck.CheckSignalReceived();
9111   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, targetBlue, TEST_LOCATION);
9112   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9113   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9114   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), targetBlue, TEST_LOCATION);
9115   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9116   END_TEST;
9117 }
9118
9119 int UtcDaliAnimationAnimateToActorColorAlphaP(void)
9120 {
9121   TestApplication application;
9122
9123   Actor actor = Actor::New();
9124   application.GetScene().Add(actor);
9125   float startValue(1.0f);
9126   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9127   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9128   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9129   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9130   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9131   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9132   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9133   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9134   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9135
9136   // Build the animation
9137   float     durationSeconds(1.0f);
9138   Animation animation = Animation::New(durationSeconds);
9139   float     targetAlpha(0.5f);
9140   animation.AnimateTo(Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha);
9141
9142   float fiftyPercentProgress(startValue + (targetAlpha - startValue) * 0.5f);
9143
9144   // Start the animation
9145   animation.Play();
9146
9147   // Target value should be retrievable straight away
9148   DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(startValue, startValue, startValue, targetAlpha), TEST_LOCATION);
9149   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetAlpha, TEST_LOCATION);
9150   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::OPACITY), targetAlpha, TEST_LOCATION);
9151
9152   bool                 signalReceived(false);
9153   AnimationFinishCheck finishCheck(signalReceived);
9154   animation.FinishedSignal().Connect(&application, finishCheck);
9155
9156   application.SendNotification();
9157   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
9158
9159   // We didn't expect the animation to finish yet
9160   application.SendNotification();
9161   finishCheck.CheckSignalNotReceived();
9162   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, fiftyPercentProgress, TEST_LOCATION);
9163   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9164   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9165   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9166   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), fiftyPercentProgress, TEST_LOCATION);
9167
9168   application.SendNotification();
9169   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
9170
9171   // We did expect the animation to finish
9172   application.SendNotification();
9173   finishCheck.CheckSignalReceived();
9174   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, targetAlpha, TEST_LOCATION);
9175   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9176   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9177   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9178   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), targetAlpha, TEST_LOCATION);
9179   END_TEST;
9180 }
9181
9182 int UtcDaliAnimationKeyFrames01P(void)
9183 {
9184   TestApplication application;
9185
9186   KeyFrames keyFrames = KeyFrames::New();
9187   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9188
9189   keyFrames.Add(0.0f, 0.1f);
9190
9191   DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
9192
9193   KeyFrames keyFrames2(keyFrames);
9194   DALI_TEST_CHECK(keyFrames2);
9195   DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
9196
9197   KeyFrames keyFrames3 = KeyFrames::New();
9198   keyFrames3.Add(0.6f, true);
9199   DALI_TEST_CHECK(keyFrames3);
9200   DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
9201
9202   keyFrames3 = keyFrames;
9203   DALI_TEST_CHECK(keyFrames3);
9204   DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
9205
9206   END_TEST;
9207 }
9208
9209 int UtcDaliAnimationKeyFrames02N(void)
9210 {
9211   TestApplication application;
9212
9213   KeyFrames keyFrames = KeyFrames::New();
9214   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9215
9216   keyFrames.Add(0.0f, 0.1f);
9217   keyFrames.Add(0.2f, 0.5f);
9218   keyFrames.Add(0.4f, 0.0f);
9219   keyFrames.Add(0.6f, 1.0f);
9220   keyFrames.Add(0.8f, 0.7f);
9221   keyFrames.Add(1.0f, 0.9f);
9222
9223   DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
9224
9225   DALI_TEST_ASSERTION(
9226     {
9227       keyFrames.Add(1.9f, false);
9228     },
9229     "mType == value.GetType()");
9230
9231   END_TEST;
9232 }
9233
9234 int UtcDaliAnimationKeyFrames03N(void)
9235 {
9236   TestApplication application;
9237
9238   KeyFrames keyFrames = KeyFrames::New();
9239   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9240
9241   keyFrames.Add(0.0f, true);
9242   keyFrames.Add(0.2f, false);
9243   keyFrames.Add(0.4f, false);
9244   keyFrames.Add(0.6f, true);
9245   keyFrames.Add(0.8f, true);
9246   keyFrames.Add(1.0f, false);
9247
9248   DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
9249
9250   DALI_TEST_ASSERTION(
9251     {
9252       keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
9253     },
9254     "mType == value.GetType()");
9255
9256   END_TEST;
9257 }
9258
9259 int UtcDaliAnimationKeyFrames04N(void)
9260 {
9261   TestApplication application;
9262
9263   KeyFrames keyFrames = KeyFrames::New();
9264   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9265
9266   keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
9267   keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
9268   keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
9269   keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
9270   keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
9271   keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
9272
9273   DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
9274
9275   DALI_TEST_ASSERTION(
9276     {
9277       keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
9278     },
9279     "mType == value.GetType()");
9280
9281   END_TEST;
9282 }
9283
9284 int UtcDaliAnimationKeyFrames05N(void)
9285 {
9286   TestApplication application;
9287
9288   KeyFrames keyFrames = KeyFrames::New();
9289   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9290
9291   keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
9292   keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
9293   keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
9294   keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
9295   keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
9296   keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
9297
9298   DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
9299
9300   DALI_TEST_ASSERTION(
9301     {
9302       keyFrames.Add(0.7f, 1.0f);
9303     },
9304     "mType == value.GetType()");
9305
9306   END_TEST;
9307 }
9308
9309 int UtcDaliAnimationKeyFrames06N(void)
9310 {
9311   TestApplication application;
9312
9313   KeyFrames keyFrames = KeyFrames::New();
9314   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9315
9316   keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
9317   keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9318   keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
9319   keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
9320   keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
9321   keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
9322
9323   DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
9324
9325   DALI_TEST_ASSERTION(
9326     {
9327       keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
9328     },
9329     "mType == value.GetType()");
9330
9331   END_TEST;
9332 }
9333
9334 int UtcDaliAnimationKeyFrames07N(void)
9335 {
9336   TestApplication application;
9337
9338   KeyFrames keyFrames = KeyFrames::New();
9339   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9340
9341   keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
9342   keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
9343   keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
9344   keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
9345   keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
9346   keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
9347
9348   DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
9349
9350   DALI_TEST_ASSERTION(
9351     {
9352       keyFrames.Add(0.7f, 1.1f);
9353     },
9354     "mType == value.GetType()");
9355
9356   END_TEST;
9357 }
9358
9359 int UtcDaliAnimationKeyFramesGetKeyFrameCountP(void)
9360 {
9361   TestApplication application;
9362
9363   KeyFrames keyFrames = KeyFrames::New();
9364
9365   DALI_TEST_EQUALS(DevelKeyFrames::GetKeyFrameCount(keyFrames), 0, TEST_LOCATION);
9366
9367   keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.6f));
9368   keyFrames.Add(0.6f, Vector4(0.0f, 0.0f, 0.0f, 0.3f));
9369   keyFrames.Add(1.0f, Vector4(0.0f, 0.0f, 0.0f, 0.8f));
9370
9371   DALI_TEST_EQUALS(DevelKeyFrames::GetKeyFrameCount(keyFrames), 3, TEST_LOCATION);
9372
9373   END_TEST;
9374 }
9375
9376 int UtcDaliAnimationKeyFramesGetKeyFrameP(void)
9377 {
9378   TestApplication application;
9379
9380   float   inputTime  = 0.6f;
9381   Vector4 inputValue = Vector4(0.0f, 0.0f, 0.0f, 0.3f);
9382
9383   float           outputTime;
9384   Property::Value outputValue;
9385   KeyFrames       keyFrames = KeyFrames::New();
9386
9387   DevelKeyFrames::GetKeyFrame(keyFrames, 0, outputTime, outputValue);
9388
9389   DALI_TEST_EQUALS(outputValue.GetType(), Property::Type::NONE, TEST_LOCATION);
9390
9391   keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.6f));
9392   keyFrames.Add(inputTime, inputValue);
9393   keyFrames.Add(1.0f, Vector4(0.0f, 0.0f, 0.0f, 0.8f));
9394
9395   DevelKeyFrames::GetKeyFrame(keyFrames, 3, outputTime, outputValue);
9396
9397   DALI_TEST_EQUALS(outputValue.GetType(), Property::Type::NONE, TEST_LOCATION);
9398
9399   DevelKeyFrames::GetKeyFrame(keyFrames, 1, outputTime, outputValue);
9400
9401   DALI_TEST_EQUALS(outputTime, inputTime, TEST_LOCATION);
9402   DALI_TEST_EQUALS(outputValue.GetType(), Property::Type::VECTOR4, TEST_LOCATION);
9403   DALI_TEST_EQUALS(outputValue.Get<Vector4>(), inputValue, TEST_LOCATION);
9404
9405   END_TEST;
9406 }
9407
9408 int UtcDaliAnimationKeyFramesSetKeyFrameP(void)
9409 {
9410   TestApplication application;
9411
9412   float   inputTime  = 0.6f;
9413   Vector4 inputValue = Vector4(0.0f, 0.0f, 0.0f, 0.3f);
9414
9415   KeyFrames keyFrames = KeyFrames::New();
9416   keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.6f));
9417   keyFrames.Add(inputTime, inputValue);
9418   keyFrames.Add(1.0f, Vector4(0.0f, 0.0f, 0.0f, 0.8f));
9419
9420   float           outputTime;
9421   Property::Value outputValue;
9422
9423   DevelKeyFrames::GetKeyFrame(keyFrames, 3, outputTime, outputValue);
9424
9425   DALI_TEST_EQUALS(outputValue.GetType(), Property::Type::NONE, TEST_LOCATION);
9426
9427   DevelKeyFrames::GetKeyFrame(keyFrames, 1, outputTime, outputValue);
9428
9429   DALI_TEST_EQUALS(outputTime, inputTime, TEST_LOCATION);
9430   DALI_TEST_EQUALS(outputValue.GetType(), Property::Type::VECTOR4, TEST_LOCATION);
9431   DALI_TEST_EQUALS(outputValue.Get<Vector4>(), inputValue, TEST_LOCATION);
9432
9433   Vector4 newValue = Vector4(1.0f, 0.2f, 0.6f, 0.9f);
9434
9435   DevelKeyFrames::SetKeyFrameValue(keyFrames, 1, newValue);
9436
9437   DevelKeyFrames::GetKeyFrame(keyFrames, 1, outputTime, outputValue);
9438
9439   DALI_TEST_EQUALS(outputTime, inputTime, TEST_LOCATION);
9440   DALI_TEST_EQUALS(outputValue.GetType(), Property::Type::VECTOR4, TEST_LOCATION);
9441   DALI_TEST_EQUALS(outputValue.Get<Vector4>(), newValue, TEST_LOCATION);
9442
9443   Vector3 newUnmatchedValue = Vector3(0.0f, 1.0f, 0.2f);
9444
9445   // Check nothing happened if we set unmatched value type.
9446   DevelKeyFrames::SetKeyFrameValue(keyFrames, 1, newUnmatchedValue);
9447
9448   DevelKeyFrames::GetKeyFrame(keyFrames, 1, outputTime, outputValue);
9449
9450   DALI_TEST_EQUALS(outputTime, inputTime, TEST_LOCATION);
9451   DALI_TEST_EQUALS(outputValue.GetType(), Property::Type::VECTOR4, TEST_LOCATION);
9452   DALI_TEST_EQUALS(outputValue.Get<Vector4>(), newValue, TEST_LOCATION);
9453
9454   END_TEST;
9455 }
9456
9457 int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
9458 {
9459   TestApplication application;
9460
9461   float startValue(1.0f);
9462   Actor actor = Actor::New();
9463   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9464   application.GetScene().Add(actor);
9465
9466   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9467   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9468   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9469   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9470   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9471   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9472   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9473   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9474   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9475
9476   // Build the animation
9477   float     durationSeconds(1.0f);
9478   Animation animation = Animation::New(durationSeconds);
9479
9480   KeyFrames keyFrames = KeyFrames::New();
9481   keyFrames.Add(0.0f, 0.1f);
9482   keyFrames.Add(0.2f, 0.5f);
9483   keyFrames.Add(0.4f, 0.0f);
9484   keyFrames.Add(0.6f, 1.0f);
9485   keyFrames.Add(0.8f, 0.7f);
9486   keyFrames.Add(1.0f, 0.9f);
9487
9488   animation.AnimateBetween(Property(actor, Actor::Property::COLOR_ALPHA), keyFrames);
9489
9490   // Start the animation
9491   animation.Play();
9492
9493   // Final key frame value should be retrievable straight away
9494   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, TEST_LOCATION);
9495
9496   bool                 signalReceived(false);
9497   AnimationFinishCheck finishCheck(signalReceived);
9498   animation.FinishedSignal().Connect(&application, finishCheck);
9499   application.SendNotification();
9500   application.Render(0);
9501   application.SendNotification();
9502   finishCheck.CheckSignalNotReceived();
9503   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.1f, TEST_LOCATION);
9504
9505   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
9506   application.SendNotification();
9507   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9508   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9509   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9510   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION);
9511   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.3f, 0.01f, TEST_LOCATION);
9512
9513   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% progress */);
9514   application.SendNotification();
9515   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9516   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9517   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9518   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION);
9519   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.25f, 0.01f, TEST_LOCATION);
9520
9521   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 40% progress */);
9522   application.SendNotification();
9523   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9524   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9525   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9526   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION);
9527   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.0f, 0.01f, TEST_LOCATION);
9528
9529   application.Render(static_cast<unsigned int>(durationSeconds * 400.0f) /* 80% progress */);
9530   application.SendNotification();
9531   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9532   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9533   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9534   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION);
9535   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.7f, 0.01f, TEST_LOCATION);
9536
9537   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 90% progress */);
9538   application.SendNotification();
9539   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9540   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9541   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9542   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION);
9543   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.8f, 0.01f, TEST_LOCATION);
9544
9545   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1 /* 100% progress */);
9546   application.SendNotification();
9547   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9548   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9549   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9550   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION);
9551   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.9f, 0.01f, TEST_LOCATION);
9552
9553   // We did expect the animation to finish
9554
9555   finishCheck.CheckSignalReceived();
9556   END_TEST;
9557 }
9558
9559 int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
9560 {
9561   TestApplication application;
9562
9563   float startValue(1.0f);
9564   Actor actor = Actor::New();
9565   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9566   application.GetScene().Add(actor);
9567
9568   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9569   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9570   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9571   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9572   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9573   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9574   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9575   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9576   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9577
9578   // Build the animation
9579   float     durationSeconds(1.0f);
9580   Animation animation = Animation::New(durationSeconds);
9581
9582   KeyFrames keyFrames = KeyFrames::New();
9583   keyFrames.Add(0.0f, 0.1f);
9584   keyFrames.Add(0.2f, 0.5f);
9585   keyFrames.Add(0.4f, 0.0f);
9586   keyFrames.Add(0.6f, 1.0f);
9587   keyFrames.Add(0.8f, 0.7f);
9588   keyFrames.Add(1.0f, 0.9f);
9589
9590   animation.AnimateBetween(Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::CUBIC);
9591
9592   // Start the animation
9593   animation.Play();
9594
9595   bool                 signalReceived(false);
9596   AnimationFinishCheck finishCheck(signalReceived);
9597   animation.FinishedSignal().Connect(&application, finishCheck);
9598   application.SendNotification();
9599   application.Render(0);
9600   application.SendNotification();
9601   finishCheck.CheckSignalNotReceived();
9602   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.1f, TEST_LOCATION);
9603
9604   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
9605   application.SendNotification();
9606   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9607   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9608   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9609   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.36f, 0.01f, TEST_LOCATION);
9610   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.36f, 0.01f, TEST_LOCATION);
9611
9612   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% progress */);
9613   application.SendNotification();
9614   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9615   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9616   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9617   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.21f, 0.01f, TEST_LOCATION);
9618   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.21f, 0.01f, TEST_LOCATION);
9619
9620   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 40% progress */);
9621   application.SendNotification();
9622   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9623   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9624   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9625   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION);
9626   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.0f, 0.01f, TEST_LOCATION);
9627
9628   application.Render(static_cast<unsigned int>(durationSeconds * 400.0f) /* 80% progress */);
9629   application.SendNotification();
9630   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9631   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9632   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9633   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION);
9634   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.7f, 0.01f, TEST_LOCATION);
9635
9636   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 90% progress */);
9637   application.SendNotification();
9638   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9639   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9640   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9641   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.76f, 0.01f, TEST_LOCATION);
9642   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.76f, 0.01f, TEST_LOCATION);
9643
9644   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1 /* 100% progress */);
9645   application.SendNotification();
9646   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9647   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9648   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9649   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION);
9650   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.9f, 0.01f, TEST_LOCATION);
9651
9652   // We did expect the animation to finish
9653
9654   finishCheck.CheckSignalReceived();
9655   END_TEST;
9656 }
9657
9658 int UtcDaliAnimationAnimateBetweenActorColorP(void)
9659 {
9660   TestApplication application;
9661
9662   float startValue(1.0f);
9663   Actor actor = Actor::New();
9664   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9665   application.GetScene().Add(actor);
9666
9667   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9668   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9669   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9670   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9671   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9672   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9673   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9674   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9675   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9676
9677   // Build the animation
9678   float     durationSeconds(1.0f);
9679   Animation animation = Animation::New(durationSeconds);
9680
9681   KeyFrames keyFrames = KeyFrames::New();
9682   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9683   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9684   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9685
9686   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames);
9687
9688   // Start the animation
9689   animation.Play();
9690
9691   bool                 signalReceived(false);
9692   AnimationFinishCheck finishCheck(signalReceived);
9693   animation.FinishedSignal().Connect(&application, finishCheck);
9694   application.SendNotification();
9695   application.Render(0);
9696   application.SendNotification();
9697   finishCheck.CheckSignalNotReceived();
9698   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
9699   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
9700   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
9701   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
9702
9703   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9704   application.SendNotification();
9705   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
9706   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
9707   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
9708   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
9709
9710   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9711   application.SendNotification();
9712   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
9713   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
9714   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
9715   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
9716
9717   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9718   application.SendNotification();
9719   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
9720   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
9721   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
9722   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
9723
9724   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9725   application.SendNotification();
9726   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
9727   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
9728   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
9729   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
9730
9731   // We did expect the animation to finish
9732
9733   finishCheck.CheckSignalReceived();
9734   END_TEST;
9735 }
9736
9737 int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
9738 {
9739   TestApplication application;
9740
9741   float startValue(1.0f);
9742   Actor actor = Actor::New();
9743   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9744   application.GetScene().Add(actor);
9745
9746   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9747   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9748   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9749   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9750   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9751   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9752   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9753   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9754   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9755
9756   // Build the animation
9757   float     durationSeconds(1.0f);
9758   Animation animation = Animation::New(durationSeconds);
9759
9760   KeyFrames keyFrames = KeyFrames::New();
9761   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9762   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9763   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9764
9765   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, Animation::CUBIC);
9766
9767   // Start the animation
9768   animation.Play();
9769
9770   bool                 signalReceived(false);
9771   AnimationFinishCheck finishCheck(signalReceived);
9772   animation.FinishedSignal().Connect(&application, finishCheck);
9773   application.SendNotification();
9774   application.Render(0);
9775   application.SendNotification();
9776   finishCheck.CheckSignalNotReceived();
9777   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
9778   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
9779   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
9780   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
9781
9782   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9783   application.SendNotification();
9784   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
9785   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
9786   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
9787   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
9788
9789   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9790   application.SendNotification();
9791   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
9792   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
9793   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
9794   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
9795
9796   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9797   application.SendNotification();
9798   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
9799   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
9800   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
9801   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
9802
9803   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9804   application.SendNotification();
9805   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
9806   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
9807   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
9808   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
9809
9810   // We did expect the animation to finish
9811
9812   finishCheck.CheckSignalReceived();
9813   END_TEST;
9814 }
9815
9816 int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
9817 {
9818   TestApplication application;
9819
9820   Actor     actor = Actor::New();
9821   AngleAxis aa(Degree(90), Vector3::XAXIS);
9822   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9823   application.GetScene().Add(actor);
9824
9825   application.SendNotification();
9826   application.Render(0);
9827
9828   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9829
9830   // Build the animation
9831   float     durationSeconds(1.0f);
9832   Animation animation = Animation::New(durationSeconds);
9833
9834   KeyFrames keyFrames = KeyFrames::New();
9835   keyFrames.Add(0.0f, false);
9836   keyFrames.Add(0.2f, true);
9837   keyFrames.Add(0.4f, true);
9838   keyFrames.Add(0.8f, false);
9839   keyFrames.Add(1.0f, true);
9840
9841   animation.AnimateBetween(Property(actor, Actor::Property::VISIBLE), keyFrames);
9842
9843   // Start the animation
9844   animation.Play();
9845
9846   // Final key frame value should be retrievable straight away
9847   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9848
9849   bool                 signalReceived(false);
9850   AnimationFinishCheck finishCheck(signalReceived);
9851   animation.FinishedSignal().Connect(&application, finishCheck);
9852   application.SendNotification();
9853   application.SendNotification();
9854   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9855   application.SendNotification();
9856   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9857   application.SendNotification();
9858
9859   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9860   finishCheck.CheckSignalReceived();
9861   END_TEST;
9862 }
9863
9864 int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
9865 {
9866   TestApplication application;
9867
9868   Actor     actor = Actor::New();
9869   AngleAxis aa(Degree(90), Vector3::XAXIS);
9870   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9871   application.GetScene().Add(actor);
9872
9873   application.SendNotification();
9874   application.Render(0);
9875
9876   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9877
9878   // Build the animation
9879   float     durationSeconds(1.0f);
9880   Animation animation = Animation::New(durationSeconds);
9881
9882   KeyFrames keyFrames = KeyFrames::New();
9883   keyFrames.Add(0.0f, false);
9884   keyFrames.Add(0.2f, true);
9885   keyFrames.Add(0.4f, true);
9886   keyFrames.Add(0.8f, false);
9887   keyFrames.Add(1.0f, true);
9888
9889   //Cubic interpolation for boolean values should be ignored
9890   animation.AnimateBetween(Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::CUBIC);
9891
9892   // Start the animation
9893   animation.Play();
9894
9895   bool                 signalReceived(false);
9896   AnimationFinishCheck finishCheck(signalReceived);
9897   animation.FinishedSignal().Connect(&application, finishCheck);
9898   application.SendNotification();
9899   application.SendNotification();
9900   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9901   application.SendNotification();
9902   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9903   application.SendNotification();
9904
9905   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9906   finishCheck.CheckSignalReceived();
9907   END_TEST;
9908 }
9909
9910 int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
9911 {
9912   TestApplication application;
9913
9914   Actor     actor = Actor::New();
9915   AngleAxis aa(Degree(90), Vector3::XAXIS);
9916   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9917   application.GetScene().Add(actor);
9918
9919   application.SendNotification();
9920   application.Render(0);
9921   Quaternion start(Radian(aa.angle), aa.axis);
9922   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9923
9924   // Build the animation
9925   float     durationSeconds(1.0f);
9926   Animation animation = Animation::New(durationSeconds);
9927
9928   KeyFrames keyFrames = KeyFrames::New();
9929   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9930
9931   animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames);
9932
9933   // Start the animation
9934   animation.Play();
9935
9936   // Final key frame value should be retrievable straight away
9937   DALI_TEST_EQUALS(actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Degree(60), Vector3::ZAXIS), TEST_LOCATION);
9938
9939   bool                 signalReceived(false);
9940   AnimationFinishCheck finishCheck(signalReceived);
9941   animation.FinishedSignal().Connect(&application, finishCheck);
9942   application.SendNotification();
9943   application.SendNotification();
9944   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9945   application.SendNotification();
9946   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9947   application.SendNotification();
9948
9949   Quaternion check(Radian(Degree(60)), Vector3::ZAXIS);
9950
9951   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9952   finishCheck.CheckSignalReceived();
9953   END_TEST;
9954 }
9955
9956 int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
9957 {
9958   TestApplication application;
9959
9960   Actor     actor = Actor::New();
9961   AngleAxis aa(Degree(90), Vector3::XAXIS);
9962   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9963   application.SendNotification();
9964   application.Render(0);
9965   application.GetScene().Add(actor);
9966
9967   Quaternion start(Radian(aa.angle), aa.axis);
9968   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9969
9970   // Build the animation
9971   float     durationSeconds(1.0f);
9972   Animation animation = Animation::New(durationSeconds);
9973
9974   KeyFrames keyFrames = KeyFrames::New();
9975   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9976   keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9977   keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9978
9979   animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames);
9980
9981   // Start the animation
9982   animation.Play();
9983
9984   bool                 signalReceived(false);
9985   AnimationFinishCheck finishCheck(signalReceived);
9986   animation.FinishedSignal().Connect(&application, finishCheck);
9987   application.SendNotification();
9988   application.Render(0);
9989   application.SendNotification();
9990   finishCheck.CheckSignalNotReceived();
9991
9992   Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9993   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9994
9995   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9996   application.SendNotification();
9997   check = Quaternion(Radian(Degree(90)), Vector3::XAXIS);
9998   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9999
10000   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10001   application.SendNotification();
10002   check = Quaternion(Radian(Degree(120)), Vector3::XAXIS);
10003   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
10004
10005   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10006   application.SendNotification();
10007   check = Quaternion(Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f));
10008   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
10009
10010   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10011   application.SendNotification();
10012   check = Quaternion(Radian(Degree(120)), Vector3::YAXIS);
10013   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
10014
10015   // We did expect the animation to finish
10016
10017   finishCheck.CheckSignalReceived();
10018   END_TEST;
10019 }
10020
10021 int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
10022 {
10023   TestApplication application;
10024
10025   Actor     actor = Actor::New();
10026   AngleAxis aa(Degree(90), Vector3::XAXIS);
10027   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
10028   application.GetScene().Add(actor);
10029
10030   application.SendNotification();
10031   application.Render(0);
10032   Quaternion start(Radian(aa.angle), aa.axis);
10033   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
10034
10035   // Build the animation
10036   float     durationSeconds(1.0f);
10037   Animation animation = Animation::New(durationSeconds);
10038
10039   KeyFrames keyFrames = KeyFrames::New();
10040   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
10041
10042   //Cubic interpolation should be ignored for quaternions
10043   animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::CUBIC);
10044
10045   // Start the animation
10046   animation.Play();
10047
10048   bool                 signalReceived(false);
10049   AnimationFinishCheck finishCheck(signalReceived);
10050   animation.FinishedSignal().Connect(&application, finishCheck);
10051   application.SendNotification();
10052   application.SendNotification();
10053   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
10054   application.SendNotification();
10055   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
10056   application.SendNotification();
10057
10058   Quaternion check(Radian(Degree(60)), Vector3::ZAXIS);
10059
10060   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
10061   finishCheck.CheckSignalReceived();
10062   END_TEST;
10063 }
10064
10065 int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
10066 {
10067   TestApplication application;
10068
10069   Actor     actor = Actor::New();
10070   AngleAxis aa(Degree(90), Vector3::XAXIS);
10071   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
10072   application.SendNotification();
10073   application.Render(0);
10074   application.GetScene().Add(actor);
10075
10076   Quaternion start(Radian(aa.angle), aa.axis);
10077   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
10078
10079   // Build the animation
10080   float     durationSeconds(1.0f);
10081   Animation animation = Animation::New(durationSeconds);
10082
10083   KeyFrames keyFrames = KeyFrames::New();
10084   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
10085   keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
10086   keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
10087
10088   //Cubic interpolation should be ignored for quaternions
10089   animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::CUBIC);
10090
10091   // Start the animation
10092   animation.Play();
10093
10094   bool                 signalReceived(false);
10095   AnimationFinishCheck finishCheck(signalReceived);
10096   animation.FinishedSignal().Connect(&application, finishCheck);
10097   application.SendNotification();
10098   application.Render(0);
10099   application.SendNotification();
10100   finishCheck.CheckSignalNotReceived();
10101
10102   Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
10103   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
10104
10105   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10106   application.SendNotification();
10107   check = Quaternion(Radian(Degree(90)), Vector3::XAXIS);
10108   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
10109
10110   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10111   application.SendNotification();
10112   check = Quaternion(Radian(Degree(120)), Vector3::XAXIS);
10113   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
10114
10115   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10116   application.SendNotification();
10117   check = Quaternion(Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f));
10118   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
10119
10120   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10121   application.SendNotification();
10122   check = Quaternion(Radian(Degree(120)), Vector3::YAXIS);
10123   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
10124
10125   // We did expect the animation to finish
10126
10127   finishCheck.CheckSignalReceived();
10128   END_TEST;
10129 }
10130
10131 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
10132 {
10133   TestApplication application;
10134
10135   float startValue(1.0f);
10136   Actor actor = Actor::New();
10137   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10138   application.GetScene().Add(actor);
10139
10140   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10141   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10142   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10143   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10144   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10145   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10146   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10147   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10148   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10149
10150   // Build the animation
10151   float     durationSeconds(1.0f);
10152   Animation animation = Animation::New(durationSeconds);
10153
10154   KeyFrames keyFrames = KeyFrames::New();
10155   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10156   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10157   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10158
10159   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR);
10160
10161   // Start the animation
10162   animation.Play();
10163
10164   bool                 signalReceived(false);
10165   AnimationFinishCheck finishCheck(signalReceived);
10166   animation.FinishedSignal().Connect(&application, finishCheck);
10167   application.SendNotification();
10168   application.Render(0);
10169   application.SendNotification();
10170   finishCheck.CheckSignalNotReceived();
10171   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10172   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10173   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10174   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10175
10176   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10177   application.SendNotification();
10178   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
10179   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
10180   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
10181   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
10182
10183   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10184   application.SendNotification();
10185   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10186   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10187   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10188   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10189
10190   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10191   application.SendNotification();
10192   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
10193   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
10194   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
10195   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
10196
10197   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10198   application.SendNotification();
10199   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10200   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10201   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10202   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10203
10204   // We did expect the animation to finish
10205
10206   finishCheck.CheckSignalReceived();
10207   END_TEST;
10208 }
10209
10210 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
10211 {
10212   TestApplication application;
10213
10214   float startValue(1.0f);
10215   Actor actor = Actor::New();
10216   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10217   application.GetScene().Add(actor);
10218
10219   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10220   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10221   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10222   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10223   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10224   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10225   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10226   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10227   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10228
10229   // Build the animation
10230   float     durationSeconds(1.0f);
10231   Animation animation = Animation::New(durationSeconds);
10232
10233   KeyFrames keyFrames = KeyFrames::New();
10234   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10235   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10236   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10237
10238   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::CUBIC);
10239
10240   // Start the animation
10241   animation.Play();
10242
10243   bool                 signalReceived(false);
10244   AnimationFinishCheck finishCheck(signalReceived);
10245   animation.FinishedSignal().Connect(&application, finishCheck);
10246   application.SendNotification();
10247   application.Render(0);
10248   application.SendNotification();
10249   finishCheck.CheckSignalNotReceived();
10250   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10251   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10252   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10253   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10254
10255   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10256   application.SendNotification();
10257   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
10258   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
10259   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
10260   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
10261
10262   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10263   application.SendNotification();
10264   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10265   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10266   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10267   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10268
10269   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10270   application.SendNotification();
10271   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
10272   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
10273   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
10274   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
10275
10276   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10277   application.SendNotification();
10278   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10279   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10280   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10281   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10282
10283   // We did expect the animation to finish
10284
10285   finishCheck.CheckSignalReceived();
10286   END_TEST;
10287 }
10288
10289 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void)
10290 {
10291   TestApplication application;
10292
10293   float startValue(1.0f);
10294   Actor actor = Actor::New();
10295   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10296   application.GetScene().Add(actor);
10297
10298   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10299   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10300   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10301   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10302   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10303   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10304   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10305   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10306   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10307
10308   // Build the animation
10309   float     durationSeconds(1.0f);
10310   float     delay     = 0.5f;
10311   Animation animation = Animation::New(durationSeconds);
10312
10313   KeyFrames keyFrames = KeyFrames::New();
10314   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10315   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10316   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10317
10318   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod(delay, durationSeconds - delay));
10319
10320   // Start the animation
10321   animation.Play();
10322
10323   bool                 signalReceived(false);
10324   AnimationFinishCheck finishCheck(signalReceived);
10325   animation.FinishedSignal().Connect(&application, finishCheck);
10326   application.SendNotification();
10327
10328   application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
10329   application.SendNotification();
10330   finishCheck.CheckSignalNotReceived();
10331   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10332   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10333   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10334   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10335
10336   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
10337   application.SendNotification();
10338   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
10339   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
10340   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
10341   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
10342
10343   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
10344   application.SendNotification();
10345   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10346   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10347   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10348   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10349
10350   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
10351   application.SendNotification();
10352   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
10353   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
10354   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
10355   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
10356
10357   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10358   application.SendNotification();
10359   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10360   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10361   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10362   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10363
10364   // We did expect the animation to finish
10365
10366   finishCheck.CheckSignalReceived();
10367   END_TEST;
10368 }
10369
10370 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
10371 {
10372   TestApplication application;
10373
10374   float startValue(1.0f);
10375   Actor actor = Actor::New();
10376   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10377   application.GetScene().Add(actor);
10378
10379   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10380   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10381   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10382   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10383   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10384   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10385   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10386   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10387   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10388
10389   // Build the animation
10390   float     durationSeconds(1.0f);
10391   float     delay     = 0.5f;
10392   Animation animation = Animation::New(durationSeconds);
10393
10394   KeyFrames keyFrames = KeyFrames::New();
10395   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10396   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10397   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10398
10399   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod(delay, durationSeconds - delay), Animation::CUBIC);
10400
10401   // Start the animation
10402   animation.Play();
10403
10404   bool                 signalReceived(false);
10405   AnimationFinishCheck finishCheck(signalReceived);
10406   animation.FinishedSignal().Connect(&application, finishCheck);
10407   application.SendNotification();
10408
10409   application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
10410   application.SendNotification();
10411   finishCheck.CheckSignalNotReceived();
10412   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10413   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10414   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10415   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10416
10417   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
10418   application.SendNotification();
10419   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
10420   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
10421   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
10422   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
10423
10424   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
10425   application.SendNotification();
10426   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10427   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10428   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10429   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10430
10431   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
10432   application.SendNotification();
10433   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
10434   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
10435   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
10436   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
10437
10438   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10439   application.SendNotification();
10440   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10441   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10442   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10443   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10444
10445   // We did expect the animation to finish
10446
10447   finishCheck.CheckSignalReceived();
10448   END_TEST;
10449 }
10450
10451 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
10452 {
10453   TestApplication application;
10454
10455   float startValue(1.0f);
10456   float delay = 0.5f;
10457   Actor actor = Actor::New();
10458   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10459   application.GetScene().Add(actor);
10460
10461   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10462   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10463   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10464   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10465   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10466   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10467   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10468   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10469   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10470
10471   // Build the animation
10472   float     durationSeconds(1.0f);
10473   Animation animation = Animation::New(durationSeconds);
10474
10475   KeyFrames keyFrames = KeyFrames::New();
10476   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10477   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10478   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10479
10480   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
10481
10482   // Start the animation
10483   animation.Play();
10484
10485   bool                 signalReceived(false);
10486   AnimationFinishCheck finishCheck(signalReceived);
10487   animation.FinishedSignal().Connect(&application, finishCheck);
10488   application.SendNotification();
10489
10490   application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
10491   application.SendNotification();
10492   finishCheck.CheckSignalNotReceived();
10493   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10494   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10495   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10496   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10497
10498   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
10499   application.SendNotification();
10500   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
10501   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
10502   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
10503   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
10504
10505   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
10506   application.SendNotification();
10507   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10508   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10509   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10510   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10511
10512   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
10513   application.SendNotification();
10514   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
10515   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
10516   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
10517   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
10518
10519   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10520   application.SendNotification();
10521   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10522   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10523   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10524   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10525
10526   // We did expect the animation to finish
10527
10528   finishCheck.CheckSignalReceived();
10529   END_TEST;
10530 }
10531
10532 int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void)
10533 {
10534   TestApplication application;
10535
10536   float startValue(1.0f);
10537   Actor actor = Actor::New();
10538   actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10539   application.GetScene().Add(actor);
10540
10541   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10542   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10543   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10544   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10545   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10546   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10547   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10548   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10549   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10550
10551   // Build the animation
10552   float     durationSeconds(1.0f);
10553   float     delay     = 0.5f;
10554   Animation animation = Animation::New(durationSeconds);
10555
10556   KeyFrames keyFrames = KeyFrames::New();
10557   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10558   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10559   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10560
10561   animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay), Animation::CUBIC);
10562
10563   // Start the animation
10564   animation.Play();
10565
10566   bool                 signalReceived(false);
10567   AnimationFinishCheck finishCheck(signalReceived);
10568   animation.FinishedSignal().Connect(&application, finishCheck);
10569   application.SendNotification();
10570
10571   application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
10572   application.SendNotification();
10573   finishCheck.CheckSignalNotReceived();
10574   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10575   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10576   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10577   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10578
10579   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
10580   application.SendNotification();
10581   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
10582   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
10583   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
10584   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
10585
10586   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
10587   application.SendNotification();
10588   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10589   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10590   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10591   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10592
10593   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
10594   application.SendNotification();
10595   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
10596   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
10597   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
10598   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
10599
10600   application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10601   application.SendNotification();
10602   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10603   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10604   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10605   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10606
10607   // We did expect the animation to finish
10608
10609   finishCheck.CheckSignalReceived();
10610   END_TEST;
10611 }
10612
10613 int UtcDaliAnimationAnimateP(void)
10614 {
10615   TestApplication application;
10616
10617   Actor actor = Actor::New();
10618   application.GetScene().Add(actor);
10619
10620   //Build the path
10621   Vector3 position0(30.0, 80.0, 0.0);
10622   Vector3 position1(70.0, 120.0, 0.0);
10623   Vector3 position2(100.0, 100.0, 0.0);
10624
10625   Dali::Path path = Dali::Path::New();
10626   path.AddPoint(position0);
10627   path.AddPoint(position1);
10628   path.AddPoint(position2);
10629
10630   //Control points for first segment
10631   path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10632   path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10633
10634   //Control points for second segment
10635   path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10636   path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10637
10638   // Build the animation
10639   float     durationSeconds(1.0f);
10640   Animation animation = Animation::New(durationSeconds);
10641   animation.Animate(actor, path, Vector3::XAXIS);
10642
10643   // Start the animation
10644   animation.Play();
10645
10646   bool                 signalReceived(false);
10647   AnimationFinishCheck finishCheck(signalReceived);
10648   animation.FinishedSignal().Connect(&application, finishCheck);
10649   application.SendNotification();
10650   application.Render(0);
10651   application.SendNotification();
10652   finishCheck.CheckSignalNotReceived();
10653   Vector3    position, tangent;
10654   Quaternion rotation;
10655   path.Sample(0.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   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10661   application.SendNotification();
10662   path.Sample(0.25f, position, tangent);
10663   rotation = Quaternion(Vector3::XAXIS, tangent);
10664   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10665   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10666
10667   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10668   application.SendNotification();
10669   path.Sample(0.5f, position, tangent);
10670   rotation = Quaternion(Vector3::XAXIS, tangent);
10671   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10672   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10673
10674   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10675   application.SendNotification();
10676   path.Sample(0.75f, position, tangent);
10677   rotation = Quaternion(Vector3::XAXIS, tangent);
10678   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10679   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10680
10681   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10682   application.SendNotification();
10683   path.Sample(1.0f, position, tangent);
10684   rotation = Quaternion(Vector3::XAXIS, tangent);
10685   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10686   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10687
10688   finishCheck.CheckSignalReceived();
10689   END_TEST;
10690 }
10691
10692 int UtcDaliAnimationAnimateAlphaFunctionP(void)
10693 {
10694   TestApplication application;
10695
10696   Actor actor = Actor::New();
10697   application.GetScene().Add(actor);
10698
10699   //Build the path
10700   Vector3 position0(30.0, 80.0, 0.0);
10701   Vector3 position1(70.0, 120.0, 0.0);
10702   Vector3 position2(100.0, 100.0, 0.0);
10703
10704   Dali::Path path = Dali::Path::New();
10705   path.AddPoint(position0);
10706   path.AddPoint(position1);
10707   path.AddPoint(position2);
10708
10709   //Control points for first segment
10710   path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10711   path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10712
10713   //Control points for second segment
10714   path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10715   path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10716
10717   // Build the animation
10718   float     durationSeconds(1.0f);
10719   Animation animation = Animation::New(durationSeconds);
10720   animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
10721
10722   // Start the animation
10723   animation.Play();
10724
10725   bool                 signalReceived(false);
10726   AnimationFinishCheck finishCheck(signalReceived);
10727   animation.FinishedSignal().Connect(&application, finishCheck);
10728   application.SendNotification();
10729   application.Render(0);
10730   application.SendNotification();
10731   finishCheck.CheckSignalNotReceived();
10732   Vector3    position, tangent;
10733   Quaternion rotation;
10734   path.Sample(0.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   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10740   application.SendNotification();
10741   path.Sample(0.25f, position, tangent);
10742   rotation = Quaternion(Vector3::XAXIS, tangent);
10743   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10744   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10745
10746   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10747   application.SendNotification();
10748   path.Sample(0.5f, position, tangent);
10749   rotation = Quaternion(Vector3::XAXIS, tangent);
10750   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10751   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10752
10753   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10754   application.SendNotification();
10755   path.Sample(0.75f, position, tangent);
10756   rotation = Quaternion(Vector3::XAXIS, tangent);
10757   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10758   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10759
10760   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10761   application.SendNotification();
10762   path.Sample(1.0f, position, tangent);
10763   rotation = Quaternion(Vector3::XAXIS, tangent);
10764   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10765   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10766
10767   finishCheck.CheckSignalReceived();
10768   END_TEST;
10769 }
10770
10771 int UtcDaliAnimationAnimateTimePeriodP(void)
10772 {
10773   TestApplication application;
10774
10775   Actor actor = Actor::New();
10776   application.GetScene().Add(actor);
10777
10778   //Build the path
10779   Vector3 position0(30.0, 80.0, 0.0);
10780   Vector3 position1(70.0, 120.0, 0.0);
10781   Vector3 position2(100.0, 100.0, 0.0);
10782
10783   Dali::Path path = Dali::Path::New();
10784   path.AddPoint(position0);
10785   path.AddPoint(position1);
10786   path.AddPoint(position2);
10787
10788   //Control points for first segment
10789   path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10790   path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10791
10792   //Control points for second segment
10793   path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10794   path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10795
10796   // Build the animation
10797   float     durationSeconds(1.0f);
10798   Animation animation = Animation::New(durationSeconds);
10799   animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
10800
10801   // Start the animation
10802   animation.Play();
10803
10804   bool                 signalReceived(false);
10805   AnimationFinishCheck finishCheck(signalReceived);
10806   animation.FinishedSignal().Connect(&application, finishCheck);
10807   application.SendNotification();
10808   application.Render(0);
10809   application.SendNotification();
10810   finishCheck.CheckSignalNotReceived();
10811   Vector3    position, tangent;
10812   Quaternion rotation;
10813   path.Sample(0.0f, position, tangent);
10814   rotation = Quaternion(Vector3::XAXIS, tangent);
10815   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10816   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10817
10818   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10819   application.SendNotification();
10820   path.Sample(0.25f, position, tangent);
10821   rotation = Quaternion(Vector3::XAXIS, tangent);
10822   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10823   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10824
10825   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10826   application.SendNotification();
10827   path.Sample(0.5f, position, tangent);
10828   rotation = Quaternion(Vector3::XAXIS, tangent);
10829   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10830   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10831
10832   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10833   application.SendNotification();
10834   path.Sample(0.75f, position, tangent);
10835   rotation = Quaternion(Vector3::XAXIS, tangent);
10836   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10837   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10838
10839   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10840   application.SendNotification();
10841   path.Sample(1.0f, position, tangent);
10842   rotation = Quaternion(Vector3::XAXIS, tangent);
10843   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10844   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10845
10846   finishCheck.CheckSignalReceived();
10847   END_TEST;
10848 }
10849
10850 int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
10851 {
10852   TestApplication application;
10853
10854   Actor actor = Actor::New();
10855   application.GetScene().Add(actor);
10856
10857   //Build the path
10858   Vector3 position0(30.0, 80.0, 0.0);
10859   Vector3 position1(70.0, 120.0, 0.0);
10860   Vector3 position2(100.0, 100.0, 0.0);
10861
10862   Dali::Path path = Dali::Path::New();
10863   path.AddPoint(position0);
10864   path.AddPoint(position1);
10865   path.AddPoint(position2);
10866
10867   //Control points for first segment
10868   path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10869   path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10870
10871   //Control points for second segment
10872   path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10873   path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10874
10875   // Build the animation
10876   float     durationSeconds(1.0f);
10877   Animation animation = Animation::New(durationSeconds);
10878   animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
10879
10880   // Start the animation
10881   animation.Play();
10882
10883   bool                 signalReceived(false);
10884   AnimationFinishCheck finishCheck(signalReceived);
10885   animation.FinishedSignal().Connect(&application, finishCheck);
10886   application.SendNotification();
10887   application.Render(0);
10888   application.SendNotification();
10889   finishCheck.CheckSignalNotReceived();
10890   Vector3    position, tangent;
10891   Quaternion rotation;
10892   path.Sample(0.0f, position, tangent);
10893   rotation = Quaternion(Vector3::XAXIS, tangent);
10894   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10895   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10896
10897   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10898   application.SendNotification();
10899   path.Sample(0.25f, position, tangent);
10900   rotation = Quaternion(Vector3::XAXIS, tangent);
10901   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10902   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10903
10904   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10905   application.SendNotification();
10906   path.Sample(0.5f, position, tangent);
10907   rotation = Quaternion(Vector3::XAXIS, tangent);
10908   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10909   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10910
10911   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10912   application.SendNotification();
10913   path.Sample(0.75f, position, tangent);
10914   rotation = Quaternion(Vector3::XAXIS, tangent);
10915   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10916   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10917
10918   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10919   application.SendNotification();
10920   path.Sample(1.0f, position, tangent);
10921   rotation = Quaternion(Vector3::XAXIS, tangent);
10922   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10923   DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10924
10925   finishCheck.CheckSignalReceived();
10926   END_TEST;
10927 }
10928
10929 int UtcDaliAnimationShowP(void)
10930 {
10931   TestApplication application;
10932
10933   Actor actor = Actor::New();
10934   actor.SetProperty(Actor::Property::VISIBLE, false);
10935   application.SendNotification();
10936   application.Render(0);
10937   DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10938   application.GetScene().Add(actor);
10939
10940   // Start the animation
10941   float     durationSeconds(10.0f);
10942   Animation animation = Animation::New(durationSeconds);
10943   animation.Show(actor, durationSeconds * 0.5f);
10944   animation.Play();
10945
10946   bool                 signalReceived(false);
10947   AnimationFinishCheck finishCheck(signalReceived);
10948   animation.FinishedSignal().Connect(&application, finishCheck);
10949
10950   application.SendNotification();
10951   application.Render(static_cast<unsigned int>(durationSeconds * 490.0f));
10952
10953   // We didn't expect the animation to finish yet
10954   application.SendNotification();
10955   finishCheck.CheckSignalNotReceived();
10956   DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10957
10958   application.SendNotification();
10959   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) /*Should be shown now*/);
10960
10961   // We didn't expect the animation to finish yet
10962   application.SendNotification();
10963   finishCheck.CheckSignalNotReceived();
10964   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10965
10966   application.SendNotification();
10967   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
10968
10969   // We did expect the animation to finish
10970   application.SendNotification();
10971   finishCheck.CheckSignalReceived();
10972   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10973   END_TEST;
10974 }
10975
10976 int UtcDaliAnimationHideP(void)
10977 {
10978   TestApplication application;
10979
10980   Actor actor = Actor::New();
10981   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10982   application.GetScene().Add(actor);
10983
10984   // Start the animation
10985   float     durationSeconds(10.0f);
10986   Animation animation = Animation::New(durationSeconds);
10987   animation.Hide(actor, durationSeconds * 0.5f);
10988   animation.Play();
10989
10990   bool                 signalReceived(false);
10991   AnimationFinishCheck finishCheck(signalReceived);
10992   animation.FinishedSignal().Connect(&application, finishCheck);
10993
10994   application.SendNotification();
10995   application.Render(static_cast<unsigned int>(durationSeconds * 490.0f));
10996
10997   // We didn't expect the animation to finish yet
10998   application.SendNotification();
10999   finishCheck.CheckSignalNotReceived();
11000   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
11001
11002   application.SendNotification();
11003   application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) /*Should be hidden now*/);
11004
11005   // We didn't expect the animation to finish yet
11006   application.SendNotification();
11007   finishCheck.CheckSignalNotReceived();
11008   DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
11009
11010   application.SendNotification();
11011   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
11012
11013   // We did expect the animation to finish
11014   application.SendNotification();
11015   finishCheck.CheckSignalReceived();
11016   DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
11017   END_TEST;
11018 }
11019
11020 int UtcDaliAnimationShowHideAtEndP(void)
11021 {
11022   // Test that show/hide delay can be the same as animation duration
11023   // i.e. to show/hide at the end of the animation
11024
11025   TestApplication application;
11026
11027   Actor actor = Actor::New();
11028   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
11029   application.GetScene().Add(actor);
11030
11031   // Start Hide animation
11032   float     durationSeconds(10.0f);
11033   Animation animation = Animation::New(durationSeconds);
11034   animation.Hide(actor, durationSeconds /*Hide at end*/);
11035   animation.Play();
11036
11037   bool                 signalReceived(false);
11038   AnimationFinishCheck finishCheck(signalReceived);
11039   animation.FinishedSignal().Connect(&application, finishCheck);
11040
11041   application.SendNotification();
11042   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
11043
11044   // We did expect the animation to finish
11045   application.SendNotification();
11046   finishCheck.CheckSignalReceived();
11047   DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
11048
11049   // Start Show animation
11050   animation = Animation::New(durationSeconds);
11051   animation.Show(actor, durationSeconds /*Show at end*/);
11052   animation.FinishedSignal().Connect(&application, finishCheck);
11053   animation.Play();
11054
11055   application.SendNotification();
11056   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
11057
11058   // We did expect the animation to finish
11059   application.SendNotification();
11060   finishCheck.CheckSignalReceived();
11061   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
11062   END_TEST;
11063 }
11064
11065 int UtcDaliKeyFramesCreateDestroyP(void)
11066 {
11067   tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
11068
11069   KeyFrames* keyFrames = new KeyFrames;
11070   delete keyFrames;
11071   DALI_TEST_CHECK(true);
11072   END_TEST;
11073 }
11074
11075 int UtcDaliKeyFramesDownCastP(void)
11076 {
11077   TestApplication application;
11078   tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
11079
11080   KeyFrames  keyFrames = KeyFrames::New();
11081   BaseHandle object(keyFrames);
11082
11083   KeyFrames keyFrames2 = KeyFrames::DownCast(object);
11084   DALI_TEST_CHECK(keyFrames2);
11085
11086   KeyFrames keyFrames3 = DownCast<KeyFrames>(object);
11087   DALI_TEST_CHECK(keyFrames3);
11088
11089   BaseHandle unInitializedObject;
11090   KeyFrames  keyFrames4 = KeyFrames::DownCast(unInitializedObject);
11091   DALI_TEST_CHECK(!keyFrames4);
11092
11093   KeyFrames keyFrames5 = DownCast<KeyFrames>(unInitializedObject);
11094   DALI_TEST_CHECK(!keyFrames5);
11095   END_TEST;
11096 }
11097
11098 int UtcDaliAnimationCreateDestroyP(void)
11099 {
11100   TestApplication application;
11101   Animation*      animation = new Animation;
11102   DALI_TEST_CHECK(animation);
11103   delete animation;
11104   END_TEST;
11105 }
11106
11107 struct UpdateManagerTestConstraint
11108 {
11109   UpdateManagerTestConstraint(TestApplication& application)
11110   : mApplication(application)
11111   {
11112   }
11113
11114   void operator()(Vector3& current, const PropertyInputContainer& /* inputs */)
11115   {
11116     mApplication.SendNotification(); // Process events
11117   }
11118
11119   TestApplication& mApplication;
11120 };
11121
11122 int UtcDaliAnimationUpdateManagerP(void)
11123 {
11124   TestApplication application;
11125
11126   Actor actor = Actor::New();
11127   application.GetScene().Add(actor);
11128
11129   // Build the animation
11130   Animation animation = Animation::New(0.0f);
11131
11132   bool                 signalReceived = false;
11133   AnimationFinishCheck finishCheck(signalReceived);
11134   animation.FinishedSignal().Connect(&application, finishCheck);
11135
11136   Vector3         startValue(1.0f, 1.0f, 1.0f);
11137   Property::Index index      = actor.RegisterProperty("testProperty", startValue);
11138   Constraint      constraint = Constraint::New<Vector3>(actor, index, UpdateManagerTestConstraint(application));
11139   constraint.Apply();
11140
11141   // Apply animation to actor
11142   animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(100.f, 90.f, 80.f), AlphaFunction::LINEAR);
11143   animation.AnimateTo(Property(actor, Actor::Property::OPACITY), 0.3f, AlphaFunction::LINEAR);
11144
11145   animation.Play();
11146
11147   application.SendNotification();
11148   application.UpdateOnly(16);
11149
11150   finishCheck.CheckSignalNotReceived();
11151
11152   application.SendNotification(); // Process events
11153
11154   finishCheck.CheckSignalReceived();
11155
11156   END_TEST;
11157 }
11158
11159 int UtcDaliAnimationSignalOrderP(void)
11160 {
11161   TestApplication application;
11162
11163   Actor actor = Actor::New();
11164   application.GetScene().Add(actor);
11165
11166   // Build the animations
11167   Animation animation1 = Animation::New(0.0f);  // finishes first frame
11168   Animation animation2 = Animation::New(0.02f); // finishes in 20 ms
11169
11170   bool signal1Received = false;
11171   animation1.FinishedSignal().Connect(&application, AnimationFinishCheck(signal1Received));
11172
11173   bool signal2Received = false;
11174   animation2.FinishedSignal().Connect(&application, AnimationFinishCheck(signal2Received));
11175
11176   // Apply animations to actor
11177   animation1.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(3.0f, 2.0f, 1.0f), AlphaFunction::LINEAR);
11178   animation1.Play();
11179   animation2.AnimateTo(Property(actor, Actor::Property::SIZE), Vector3(10.0f, 20.0f, 30.0f), AlphaFunction::LINEAR);
11180   animation2.Play();
11181
11182   DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION);
11183   DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION);
11184
11185   application.SendNotification();
11186   application.UpdateOnly(10); // 10ms progress
11187
11188   // no notifications yet
11189   DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION);
11190   DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION);
11191
11192   application.SendNotification();
11193
11194   // first completed
11195   DALI_TEST_EQUALS(signal1Received, true, TEST_LOCATION);
11196   DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION);
11197   signal1Received = false;
11198
11199   // 1st animation is complete now, do another update with no ProcessEvents in between
11200   application.UpdateOnly(20); // 20ms progress
11201
11202   // ProcessEvents
11203   application.SendNotification();
11204
11205   // 2nd should complete now
11206   DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION);
11207   DALI_TEST_EQUALS(signal2Received, true, TEST_LOCATION);
11208
11209   END_TEST;
11210 }
11211
11212 int UtcDaliAnimationExtendDurationP(void)
11213 {
11214   TestApplication application;
11215
11216   Actor actor = Actor::New();
11217
11218   // Register a float property
11219   float           startValue(10.0f);
11220   Property::Index index = actor.RegisterProperty("testProperty", startValue);
11221   application.GetScene().Add(actor);
11222   DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
11223   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
11224
11225   // Build the animation
11226   float     initialDurationSeconds(1.0f);
11227   float     animatorDelay = 5.0f;
11228   float     animatorDurationSeconds(5.0f);
11229   float     extendedDurationSeconds(animatorDelay + animatorDurationSeconds);
11230   Animation animation = Animation::New(initialDurationSeconds);
11231   float     targetValue(30.0f);
11232   float     relativeValue(targetValue - startValue);
11233
11234   animation.AnimateTo(Property(actor, index),
11235                       targetValue,
11236                       TimePeriod(animatorDelay, animatorDurationSeconds));
11237
11238   // The duration should have been extended
11239   DALI_TEST_EQUALS(animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION);
11240
11241   // Start the animation
11242   animation.Play();
11243
11244   bool                 signalReceived(false);
11245   AnimationFinishCheck finishCheck(signalReceived);
11246   animation.FinishedSignal().Connect(&application, finishCheck);
11247
11248   application.SendNotification();
11249   application.Render(static_cast<unsigned int>(extendedDurationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
11250
11251   // We didn't expect the animation to finish yet, but cached value should be the final one
11252   application.SendNotification();
11253   finishCheck.CheckSignalNotReceived();
11254   DALI_TEST_EQUALS(actor.GetProperty<float>(index), targetValue, TEST_LOCATION);
11255   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
11256
11257   application.SendNotification();
11258   application.Render(static_cast<unsigned int>(extendedDurationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
11259
11260   // We didn't expect the animation to finish yet
11261   application.SendNotification();
11262   finishCheck.CheckSignalNotReceived();
11263   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
11264
11265   application.SendNotification();
11266   application.Render(static_cast<unsigned int>(extendedDurationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
11267
11268   // We did expect the animation to finish
11269   application.SendNotification();
11270   finishCheck.CheckSignalReceived();
11271   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
11272   DALI_TEST_EQUALS(actor.GetProperty<float>(index), targetValue, TEST_LOCATION);
11273   END_TEST;
11274 }
11275
11276 int UtcDaliAnimationCustomIntProperty(void)
11277 {
11278   TestApplication application;
11279
11280   Actor actor = Actor::New();
11281   application.GetScene().Add(actor);
11282   int startValue(0u);
11283
11284   Property::Index index = actor.RegisterProperty("anIndex", startValue);
11285   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
11286   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11287
11288   // Build the animation
11289   float     durationSeconds(1.0f);
11290   Animation animation = Animation::New(durationSeconds);
11291   animation.AnimateTo(Property(actor, index), 20);
11292
11293   // Start the animation
11294   animation.Play();
11295
11296   // Target value should be retrievable straight away
11297   DALI_TEST_EQUALS(actor.GetProperty<int>(index), 20, TEST_LOCATION);
11298
11299   bool                 signalReceived(false);
11300   AnimationFinishCheck finishCheck(signalReceived);
11301   animation.FinishedSignal().Connect(&application, finishCheck);
11302
11303   application.SendNotification();
11304   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
11305
11306   // We didn't expect the animation to finish yet
11307   application.SendNotification();
11308   finishCheck.CheckSignalNotReceived();
11309   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), 10, TEST_LOCATION);
11310
11311   application.SendNotification();
11312   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
11313
11314   // We did expect the animation to finish
11315   application.SendNotification();
11316   finishCheck.CheckSignalReceived();
11317   DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), 20, TEST_LOCATION);
11318   DALI_TEST_EQUALS(actor.GetProperty<int>(index), 20, TEST_LOCATION);
11319   END_TEST;
11320 }
11321
11322 int UtcDaliAnimationDuration(void)
11323 {
11324   TestApplication application;
11325
11326   Actor actor = Actor::New();
11327   application.GetScene().Add(actor);
11328
11329   Animation animation = Animation::New(0.0f);
11330   DALI_TEST_EQUALS(0.0f, animation.GetDuration(), TEST_LOCATION);
11331
11332   // The animation duration should automatically increase depending on the animator time period
11333
11334   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(0.0f, 1.0f));
11335   DALI_TEST_EQUALS(1.0f, animation.GetDuration(), TEST_LOCATION);
11336
11337   animation.AnimateTo(Property(actor, Actor::Property::POSITION_Y), 200.0f, TimePeriod(10.0f, 1.0f));
11338   DALI_TEST_EQUALS(11.0f, animation.GetDuration(), TEST_LOCATION);
11339
11340   END_TEST;
11341 }
11342
11343 int UtcDaliAnimationAnimateByNonAnimateableTypeN(void)
11344 {
11345   TestApplication application;
11346
11347   Actor actor = Actor::New();
11348
11349   // Register an integer property
11350   int             startValue(1);
11351   Property::Index index = actor.RegisterProperty("testProperty", startValue);
11352   application.GetScene().Add(actor);
11353   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11354
11355   DALI_TEST_ASSERTION(
11356     {
11357       // Build the animation
11358       Animation   animation     = Animation::New(2.0f);
11359       std::string relativeValue = "relative string";
11360       animation.AnimateBy(Property(actor, index), relativeValue);
11361       tet_result(TET_FAIL);
11362     },
11363     "Target value is not animatable");
11364
11365   END_TEST;
11366 }
11367
11368 int UtcDaliAnimationAnimateToNonAnimateableTypeN(void)
11369 {
11370   TestApplication application;
11371
11372   Actor actor = Actor::New();
11373
11374   // Register an integer property
11375   int             startValue(1);
11376   Property::Index index = actor.RegisterProperty("testProperty", startValue);
11377   application.GetScene().Add(actor);
11378   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11379
11380   DALI_TEST_ASSERTION(
11381     {
11382       // Build the animation
11383       Animation   animation     = Animation::New(2.0f);
11384       std::string relativeValue = "relative string";
11385       animation.AnimateTo(Property(actor, index), relativeValue);
11386     },
11387     "Target value is not animatable");
11388
11389   END_TEST;
11390 }
11391
11392 int UtcDaliAnimationAnimateBetweenNonAnimateableTypeN(void)
11393 {
11394   TestApplication application;
11395
11396   Actor actor = Actor::New();
11397
11398   // Register an integer property
11399   int             startValue(1);
11400   Property::Index index = actor.RegisterProperty("testProperty", startValue);
11401   application.GetScene().Add(actor);
11402   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11403
11404   DALI_TEST_ASSERTION(
11405     {
11406       // Build the animation
11407       KeyFrames keyFrames = KeyFrames::New();
11408       keyFrames.Add(0.0f, std::string("relative string1"));
11409       keyFrames.Add(1.0f, std::string("relative string2"));
11410       // no need to really create the animation as keyframes do the check
11411     },
11412     "Property type is not animatable");
11413
11414   END_TEST;
11415 }
11416
11417 int UtcDaliAnimationSetAndGetTargetBeforePlayP(void)
11418 {
11419   tet_infoline("Setting up an animation should not effect it's position property until the animation plays");
11420
11421   TestApplication application;
11422
11423   tet_infoline("Set initial position and set up animation to re-position actor");
11424
11425   Actor actor = Actor::New();
11426   application.GetScene().Add(actor);
11427   Vector3 initialPosition(0.0f, 0.0f, 0.0f);
11428   actor.SetProperty(Actor::Property::POSITION, initialPosition);
11429
11430   // Build the animation
11431   Animation animation = Animation::New(2.0f);
11432
11433   //Test GetCurrentProgress return 0.0 as the duration is 0.0
11434   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
11435   DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 0.0f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
11436
11437   tet_infoline("Set target position in animation without intiating play");
11438
11439   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11440   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
11441
11442   application.SendNotification();
11443   application.Render();
11444
11445   tet_infoline("Ensure position of actor is still at intial value");
11446
11447   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION);
11448   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION);
11449   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION);
11450
11451   tet_infoline("Play animation and ensure actor position is now target");
11452
11453   animation.Play();
11454   application.SendNotification();
11455   application.Render(1000u);
11456
11457   tet_infoline("Ensure position of actor is at target value when aninmation half way");
11458
11459   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
11460   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
11461   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
11462
11463   tet_printf("x position at half way point(%f)\n", actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x);
11464
11465   application.Render(2000u);
11466
11467   tet_infoline("Ensure position of actor is still at target value when aninmation complete");
11468
11469   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
11470   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
11471   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
11472
11473   END_TEST;
11474 }
11475
11476 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsPositionP(void)
11477 {
11478   tet_infoline("Setting up an animation should not effect it's position property until the animation plays even with mulitple animators");
11479
11480   TestApplication application;
11481
11482   std::vector<Vector3> targetPositions;
11483
11484   targetPositions.push_back(Vector3(100.0f, 100.0f, 100.0f));
11485   targetPositions.push_back(Vector3(200.0f, 1.0f, 100.0f));
11486   targetPositions.push_back(Vector3(50.0f, 10.0f, 100.0f));
11487
11488   tet_infoline("Set initial position and set up animation to re-position actor");
11489
11490   Actor actor = Actor::New();
11491   application.GetScene().Add(actor);
11492   Vector3 initialPosition(0.0f, 0.0f, 0.0f);
11493   actor.SetProperty(Actor::Property::POSITION, initialPosition);
11494
11495   // Build the animation
11496   Animation animation = Animation::New(2.0f);
11497
11498   //Test GetCurrentProgress return 0.0 as the duration is 0.0
11499   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
11500   DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 0.0f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
11501
11502   tet_infoline("Set target position in animation without intiating play");
11503
11504   for(unsigned int i = 0; i < targetPositions.size(); i++)
11505   {
11506     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[i], AlphaFunction::LINEAR);
11507   }
11508
11509   application.SendNotification();
11510   application.Render();
11511
11512   tet_infoline("Ensure position of actor is still at intial value");
11513
11514   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION);
11515   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION);
11516   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION);
11517
11518   tet_infoline("Play animation and ensure actor position is now target");
11519
11520   animation.Play();
11521   application.SendNotification();
11522   application.Render(1000u);
11523
11524   tet_infoline("Ensure position of actor is at target value when aninmation half way");
11525
11526   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION);
11527   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION);
11528   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION);
11529
11530   tet_printf("x position at half way point(%f)\n", actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x);
11531
11532   application.Render(2000u);
11533
11534   tet_infoline("Ensure position of actor is still at target value when aninmation complete");
11535
11536   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION);
11537   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION);
11538   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION);
11539
11540   END_TEST;
11541 }
11542
11543 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionP(void)
11544 {
11545   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");
11546
11547   TestApplication application;
11548
11549   std::vector<Vector3> targetSizes;
11550   std::vector<Vector3> targetPositions;
11551
11552   targetSizes.push_back(Vector3(100.0f, 100.0f, 100.0f));
11553   targetSizes.push_back(Vector3(50.0f, 10.0f, 100.0f));
11554
11555   targetPositions.push_back(Vector3(200.0f, 1.0f, 100.0f));
11556
11557   tet_infoline("Set initial position and set up animation to re-position actor");
11558
11559   Actor actor = Actor::New();
11560   application.GetScene().Add(actor);
11561   Vector3 initialSize(10.0f, 10.0f, 10.0f);
11562   Vector3 initialPosition(10.0f, 10.0f, 10.0f);
11563
11564   actor.SetProperty(Actor::Property::SIZE, initialSize);
11565   actor.SetProperty(Actor::Property::POSITION, initialPosition);
11566
11567   // Build the animation
11568   Animation animation = Animation::New(2.0f);
11569
11570   tet_infoline("Set target size in animation without intiating play");
11571   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
11572   tet_infoline("Set target position in animation without intiating play");
11573   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[0], AlphaFunction::LINEAR);
11574   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
11575
11576   application.SendNotification();
11577   application.Render();
11578
11579   tet_infoline("Ensure position of actor is still at intial size and position");
11580
11581   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION);
11582   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION);
11583   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION);
11584
11585   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialPosition.x, TEST_LOCATION);
11586   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialPosition.y, TEST_LOCATION);
11587   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialPosition.z, TEST_LOCATION);
11588
11589   tet_infoline("Play animation and ensure actor position and size is now matches targets");
11590
11591   animation.Play();
11592   application.SendNotification();
11593   application.Render(2000u);
11594
11595   tet_infoline("Ensure position and size of actor is at target value when aninmation playing");
11596
11597   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION);
11598   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION);
11599   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION);
11600
11601   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[0].x, TEST_LOCATION);
11602   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[0].y, TEST_LOCATION);
11603   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[0].z, TEST_LOCATION);
11604
11605   END_TEST;
11606 }
11607
11608 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionColourP(void)
11609 {
11610   tet_infoline("Setting up an animation should not effect it's size property until the animation plays even if other Properties animated");
11611
11612   TestApplication application;
11613
11614   std::vector<Vector3> targetSizes;
11615   std::vector<float>   targetColors;
11616
11617   targetSizes.push_back(Vector3(100.0f, 100.0f, 100.0f));
11618   targetSizes.push_back(Vector3(50.0f, 10.0f, 150.0f));
11619
11620   targetColors.push_back(1.0f);
11621
11622   tet_infoline("Set initial position and set up animation to re-position actor");
11623
11624   Actor actor = Actor::New();
11625   application.GetScene().Add(actor);
11626   Vector3 initialSize(10.0f, 5.0f, 10.0f);
11627
11628   actor.SetProperty(Actor::Property::SIZE, initialSize);
11629
11630   // Build the animation
11631   Animation animation = Animation::New(2.0f);
11632
11633   tet_infoline("Set target size in animation without initiating play");
11634   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
11635   tet_infoline("Set target position in animation without intiating play");
11636   animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetColors[0], AlphaFunction::LINEAR);
11637   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
11638
11639   application.SendNotification();
11640   application.Render();
11641
11642   tet_infoline("Ensure position of actor is still at initial size and position");
11643
11644   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION);
11645   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION);
11646   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION);
11647
11648   tet_infoline("Play animation and ensure actor position and size is now matches targets");
11649
11650   animation.Play();
11651   application.SendNotification();
11652   application.Render(2000u);
11653
11654   tet_infoline("Ensure position and size of actor is at target value when animation playing");
11655
11656   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION);
11657   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION);
11658   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION);
11659
11660   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColors[0], TEST_LOCATION);
11661
11662   END_TEST;
11663 }
11664
11665 int UtcDaliAnimationTimePeriodOrder(void)
11666 {
11667   tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place");
11668
11669   TestApplication application;
11670
11671   Actor actor = Actor::New();
11672   application.GetScene().Add(actor);
11673
11674   application.SendNotification();
11675   application.Render();
11676
11677   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11678   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11679   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11680   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11681   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11682
11683   //////////////////////////////////////////////////////////////////////////////////
11684
11685   tet_infoline("With two AnimateTo calls");
11686
11687   Animation animation = Animation::New(0.0f);
11688   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(3.0f, 1.0f));
11689   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(1.0f, 1.0f));
11690   animation.Play();
11691
11692   tet_infoline("The target position should change instantly");
11693   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11694   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11695
11696   application.SendNotification();
11697   application.Render(5000); // After the animation is complete
11698
11699   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11700   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11701   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11702
11703   //////////////////////////////////////////////////////////////////////////////////
11704
11705   tet_infoline("Same animation again but in a different order - should yield the same result");
11706
11707   actor.SetProperty(Actor::Property::POSITION_X, 0.0f);
11708   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11709   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11710
11711   application.SendNotification();
11712   application.Render();
11713
11714   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11715   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11716   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11717
11718   animation = Animation::New(0.0f);
11719   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(1.0f, 1.0f));
11720   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(3.0f, 1.0f));
11721   animation.Play();
11722
11723   tet_infoline("The target position should change instantly");
11724   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11725   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11726
11727   application.SendNotification();
11728   application.Render(5000); // After the animation is complete
11729
11730   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11731   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11732   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11733
11734   END_TEST;
11735 }
11736
11737 int UtcDaliAnimationTimePeriodOrderSeveralAnimateToCalls(void)
11738 {
11739   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");
11740
11741   TestApplication application;
11742
11743   Actor actor = Actor::New();
11744   application.GetScene().Add(actor);
11745
11746   application.SendNotification();
11747   application.Render();
11748
11749   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11750   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11751   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11752   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11753   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11754
11755   //////////////////////////////////////////////////////////////////////////////////
11756
11757   tet_infoline("");
11758
11759   Animation animation = Animation::New(0.0f);
11760   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1000.0f, TimePeriod(4.0f, 2.0f));
11761   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 145.0f, TimePeriod(3.0f, 10.0f));
11762   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 109.0f, TimePeriod(1.0f, 1.0f));
11763   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1.0f, TimePeriod(3.0f, 4.0f));
11764   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 200.0f, TimePeriod(2.0f, 5.0f));
11765   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(10.0f, 2.0f));
11766   animation.Play();
11767
11768   tet_infoline("The target position should change instantly");
11769   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11770   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11771
11772   application.SendNotification();
11773   application.Render(14000); // After the animation is complete
11774
11775   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11776   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11777   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11778
11779   //////////////////////////////////////////////////////////////////////////////////
11780
11781   tet_infoline("Same animation again but in a different order - should end up at the same point");
11782
11783   actor.SetProperty(Actor::Property::POSITION_X, 0.0f);
11784
11785   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11786   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11787
11788   application.SendNotification();
11789   application.Render();
11790
11791   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11792   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11793   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11794
11795   animation = Animation::New(0.0f);
11796   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 200.0f, TimePeriod(2.0f, 5.0f));
11797   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(10.0f, 2.0f));
11798   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 145.0f, TimePeriod(3.0f, 10.0f));
11799   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1000.0f, TimePeriod(4.0f, 2.0f));
11800   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1.0f, TimePeriod(3.0f, 4.0f));
11801   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 109.0f, TimePeriod(1.0f, 1.0f));
11802   animation.Play();
11803
11804   tet_infoline("The target position should change instantly");
11805   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11806   DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11807
11808   application.SendNotification();
11809   application.Render(14000); // After the animation is complete
11810
11811   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11812   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11813   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11814
11815   END_TEST;
11816 }
11817
11818 int UtcDaliAnimationAnimateBetweenIntegerP(void)
11819 {
11820   TestApplication application;
11821
11822   int                   startValue(1);
11823   Actor                 actor = Actor::New();
11824   const Property::Index index = actor.RegisterProperty("customProperty", startValue);
11825   application.GetScene().Add(actor);
11826
11827   application.Render();
11828   application.SendNotification();
11829
11830   DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11831
11832   // Build the animation
11833   float     durationSeconds(1.0f);
11834   Animation animation = Animation::New(durationSeconds);
11835
11836   KeyFrames keyFrames = KeyFrames::New();
11837   keyFrames.Add(0.0f, 10);
11838   keyFrames.Add(0.2f, 20);
11839   keyFrames.Add(0.4f, 30);
11840   keyFrames.Add(0.6f, 40);
11841   keyFrames.Add(0.8f, 50);
11842   keyFrames.Add(1.0f, 60);
11843
11844   animation.AnimateBetween(Property(actor, index), keyFrames);
11845
11846   // Start the animation
11847   animation.Play();
11848
11849   // Target value should change to the last key-frame's value straight away
11850   DALI_TEST_EQUALS(actor.GetProperty<int>(index), 60, TEST_LOCATION);
11851
11852   END_TEST;
11853 }
11854
11855 int UtcDaliAnimationAnimateBetweenVector2P(void)
11856 {
11857   TestApplication application;
11858
11859   Vector2               startValue(10.0f, 20.0f);
11860   Actor                 actor = Actor::New();
11861   const Property::Index index = actor.RegisterProperty("customProperty", startValue);
11862   application.GetScene().Add(actor);
11863
11864   application.Render();
11865   application.SendNotification();
11866
11867   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
11868
11869   // Build the animation
11870   float     durationSeconds(1.0f);
11871   Animation animation = Animation::New(durationSeconds);
11872
11873   KeyFrames keyFrames = KeyFrames::New();
11874   keyFrames.Add(0.0f, Vector2(0.0f, 5.0f));
11875   keyFrames.Add(0.2f, Vector2(30.0f, 25.0f));
11876   keyFrames.Add(0.4f, Vector2(40.0f, 35.0f));
11877   keyFrames.Add(0.6f, Vector2(50.0f, 45.0f));
11878   keyFrames.Add(0.8f, Vector2(60.0f, 55.0f));
11879   keyFrames.Add(1.0f, Vector2(70.0f, 65.0f));
11880
11881   animation.AnimateBetween(Property(actor, index), keyFrames);
11882
11883   // Start the animation
11884   animation.Play();
11885
11886   // Target value should change to the last key-frame's value straight away
11887   DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), Vector2(70.0f, 65.0f), TEST_LOCATION);
11888
11889   END_TEST;
11890 }
11891
11892 int UtcDaliAnimationProgressCallbackP(void)
11893 {
11894   TestApplication application;
11895
11896   Actor actor = Actor::New();
11897   application.GetScene().Add(actor);
11898
11899   // Build the animation
11900   Animation animation = Animation::New(0.0f);
11901
11902   //Set duration
11903   float durationSeconds(1.0f);
11904   animation.SetDuration(durationSeconds);
11905
11906   bool finishedSignalReceived(false);
11907   bool progressSignalReceived(false);
11908
11909   AnimationFinishCheck finishCheck(finishedSignalReceived);
11910   animation.FinishedSignal().Connect(&application, finishCheck);
11911
11912   AnimationProgressCheck progressCheck(progressSignalReceived);
11913   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
11914   application.SendNotification();
11915
11916   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11917   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
11918
11919   tet_infoline("Animation Progress notification set to 30%");
11920   DevelAnimation::SetProgressNotification(animation, 0.3f);
11921
11922   application.SendNotification();
11923   application.Render();
11924
11925   DALI_TEST_EQUALS(0.3f, DevelAnimation::GetProgressNotification(animation), TEST_LOCATION);
11926
11927   progressCheck.CheckSignalNotReceived();
11928
11929   // Start the animation from 10% progress
11930   animation.SetCurrentProgress(0.1f);
11931   animation.Play();
11932
11933   tet_infoline("Animation Playing from 10%");
11934
11935   application.SendNotification();
11936   application.Render(0);                        // start animation
11937   application.Render(durationSeconds * 100.0f); // 20% progress
11938
11939   tet_infoline("Animation at 20%");
11940
11941   progressCheck.CheckSignalNotReceived();
11942
11943   application.SendNotification();
11944   application.Render(durationSeconds * 200.0f); // 40% progress
11945   application.SendNotification();
11946   tet_infoline("Animation at 40%");
11947   DALI_TEST_EQUALS(0.4f, animation.GetCurrentProgress(), TEST_LOCATION);
11948
11949   progressCheck.CheckSignalReceived();
11950
11951   tet_infoline("Progress check reset");
11952   progressCheck.Reset();
11953
11954   application.Render(durationSeconds * 100.0f); // 50% progress
11955   tet_infoline("Animation at 50%");
11956   application.SendNotification();
11957
11958   DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
11959
11960   progressCheck.CheckSignalNotReceived();
11961
11962   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 60% progress */);
11963   application.SendNotification();
11964
11965   tet_infoline("Animation at 60%");
11966
11967   finishCheck.CheckSignalNotReceived();
11968
11969   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
11970   application.SendNotification();
11971   DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
11972   tet_infoline("Animation at 80%");
11973
11974   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
11975   // We did expect the animation to finish
11976   application.SendNotification();
11977   finishCheck.CheckSignalReceived();
11978   tet_infoline("Animation finished");
11979   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11980
11981   END_TEST;
11982 }
11983
11984 int UtcDaliAnimationPlayAfterP(void)
11985 {
11986   TestApplication application;
11987
11988   tet_printf("Testing that playing after 2 seconds\n");
11989
11990   {
11991     Actor actor = Actor::New();
11992     application.GetScene().Add(actor);
11993
11994     // Build the animation
11995     float     durationSeconds(1.0f);
11996     Animation animation = Animation::New(durationSeconds);
11997
11998     bool                 signalReceived(false);
11999     AnimationFinishCheck finishCheck(signalReceived);
12000     animation.FinishedSignal().Connect(&application, finishCheck);
12001     application.SendNotification();
12002
12003     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12004     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
12005
12006     // Play animation after the initial delay time
12007     animation.PlayAfter(0.2f);
12008     application.SendNotification();
12009     application.Render(0); // start animation
12010
12011     application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
12012     application.SendNotification();
12013     finishCheck.CheckSignalNotReceived();
12014     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move
12015
12016     application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
12017
12018     // We didn't expect the animation to finish yet
12019     application.SendNotification();
12020     finishCheck.CheckSignalNotReceived();
12021     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
12022
12023     application.SendNotification();
12024     application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
12025
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) + 1u /*just beyond the animation duration*/);
12032
12033     // We did expect the animation to finish
12034     application.SendNotification();
12035     finishCheck.CheckSignalReceived();
12036     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12037
12038     // Check that nothing has changed after a couple of buffer swaps
12039     application.Render(0);
12040     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12041   }
12042
12043   tet_printf("Testing that playing after 2 seconds with negative speedfactor\n");
12044   // SpeedFactor < 0
12045   {
12046     Actor actor = Actor::New();
12047     application.GetScene().Add(actor);
12048
12049     // Build the animation
12050     float     durationSeconds(1.0f);
12051     Animation animation = Animation::New(durationSeconds);
12052     animation.SetSpeedFactor(-1.0f); // Set SpeedFactor as < 0
12053
12054     bool                 signalReceived(false);
12055     AnimationFinishCheck finishCheck(signalReceived);
12056     animation.FinishedSignal().Connect(&application, finishCheck);
12057     application.SendNotification();
12058
12059     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12060     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
12061
12062     // Play animation after the initial delay time
12063     animation.PlayAfter(0.2f);
12064     application.SendNotification();
12065     application.Render(0); // start animation
12066
12067     application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
12068     application.SendNotification();
12069     finishCheck.CheckSignalNotReceived();
12070     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 1.0f), TEST_LOCATION); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
12071
12072     application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% animation progress, 50% animator progress */);
12073
12074     // We didn't expect the animation to finish yet
12075     application.SendNotification();
12076     finishCheck.CheckSignalNotReceived();
12077     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
12078
12079     application.SendNotification();
12080     application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% animation progress, 100% animator progress */);
12081
12082     application.SendNotification();
12083     finishCheck.CheckSignalNotReceived();
12084     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION);
12085
12086     application.SendNotification();
12087     application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
12088
12089     // We did expect the animation to finish
12090     application.SendNotification();
12091     finishCheck.CheckSignalReceived();
12092     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of Timeperiod in seconds
12093
12094     // Check that nothing has changed after a couple of buffer swaps
12095     application.Render(0);
12096     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0, 0.0, 0.0), TEST_LOCATION);
12097   }
12098
12099   END_TEST;
12100 }
12101
12102 int UtcDaliAnimationPlayAfterP2(void)
12103 {
12104   TestApplication application;
12105
12106   tet_printf("Testing that playing after 2 seconds before looping\n");
12107
12108   {
12109     Actor actor = Actor::New();
12110     application.GetScene().Add(actor);
12111
12112     // Build the animation
12113     float     durationSeconds(1.0f);
12114     Animation animation = Animation::New(durationSeconds);
12115     animation.SetLooping(true);
12116
12117     bool                 signalReceived(false);
12118     AnimationFinishCheck finishCheck(signalReceived);
12119     animation.FinishedSignal().Connect(&application, finishCheck);
12120     application.SendNotification();
12121
12122     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12123     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
12124
12125     // Play animation after the initial delay time
12126     animation.PlayAfter(0.2f);
12127     application.SendNotification();
12128     application.Render(0); // start animation
12129
12130     for(int iterations = 0; iterations < 3; ++iterations)
12131     {
12132       // The initial delay time of PlayAfter() applies only once in looping mode.
12133       if(iterations == 0)
12134       {
12135         application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
12136         application.SendNotification();
12137         finishCheck.CheckSignalNotReceived();
12138         DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move
12139       }
12140
12141       application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
12142
12143       // We didn't expect the animation to finish yet
12144       application.SendNotification();
12145       finishCheck.CheckSignalNotReceived();
12146       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
12147
12148       application.SendNotification();
12149       application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
12150
12151       application.SendNotification();
12152       finishCheck.CheckSignalNotReceived();
12153       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
12154
12155       application.SendNotification();
12156       application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% progress */);
12157
12158       // We did expect the animation to finish
12159       application.SendNotification();
12160       finishCheck.CheckSignalNotReceived();
12161       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12162     }
12163
12164     animation.SetLooping(false);
12165     application.SendNotification();
12166     application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
12167
12168     application.SendNotification();
12169     finishCheck.CheckSignalReceived();
12170     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12171   }
12172
12173   tet_printf("Testing that playing after 2 seconds before looping with negative speedfactor\n");
12174   // SpeedFactor < 0
12175   {
12176     Actor actor = Actor::New();
12177     application.GetScene().Add(actor);
12178
12179     // Build the animation
12180     float     durationSeconds(1.0f);
12181     Animation animation = Animation::New(durationSeconds);
12182     animation.SetLooping(true);
12183     animation.SetSpeedFactor(-1.0f); //Set SpeedFactor as < 0
12184
12185     bool                 signalReceived(false);
12186     AnimationFinishCheck finishCheck(signalReceived);
12187     animation.FinishedSignal().Connect(&application, finishCheck);
12188     application.SendNotification();
12189
12190     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12191     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
12192
12193     // Play animation after the initial delay time
12194     animation.PlayAfter(0.2f);
12195     application.SendNotification();
12196     application.Render(0); // start animation
12197
12198     for(int iterations = 0; iterations < 3; ++iterations)
12199     {
12200       // The initial delay time of PlayAfter() applies only once in looping mode.
12201       if(iterations == 0)
12202       {
12203         application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
12204         application.SendNotification();
12205         finishCheck.CheckSignalNotReceived();
12206         DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 1.0f), TEST_LOCATION); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
12207       }
12208
12209       application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% animation progress, 50% animator progress */);
12210
12211       // We didn't expect the animation to finish yet
12212       application.SendNotification();
12213       finishCheck.CheckSignalNotReceived();
12214       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
12215
12216       application.SendNotification();
12217       application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% animation progress, 100% animator progress */);
12218
12219       application.SendNotification();
12220       finishCheck.CheckSignalNotReceived();
12221       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION);
12222
12223       application.SendNotification();
12224       application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 100% progress */);
12225
12226       // We did expect the animation to finish
12227       application.SendNotification();
12228       finishCheck.CheckSignalNotReceived();
12229       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in second
12230     }
12231
12232     animation.SetLooping(false);
12233     application.SendNotification();
12234     application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
12235
12236     application.SendNotification();
12237     finishCheck.CheckSignalReceived();
12238     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0, 0.0, 0.0), TEST_LOCATION);
12239   }
12240
12241   END_TEST;
12242 }
12243
12244 int UtcDaliAnimationPlayAfterP3(void)
12245 {
12246   TestApplication application;
12247
12248   tet_printf("Testing that PlayAfter with the negative delay seconds\n");
12249
12250   Actor actor = Actor::New();
12251   application.GetScene().Add(actor);
12252
12253   // Build the animation
12254   float     durationSeconds(1.0f);
12255   Animation animation = Animation::New(durationSeconds);
12256
12257   bool                 signalReceived(false);
12258   AnimationFinishCheck finishCheck(signalReceived);
12259   animation.FinishedSignal().Connect(&application, finishCheck);
12260   application.SendNotification();
12261
12262   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12263   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
12264
12265   // When the delay time is negative value, it would treat as play immediately.
12266   animation.PlayAfter(-2.0f);
12267   application.SendNotification();
12268   application.Render(0); // start animation
12269
12270   application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
12271
12272   // We didn't expect the animation to finish yet
12273   application.SendNotification();
12274   finishCheck.CheckSignalNotReceived();
12275   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
12276
12277   application.SendNotification();
12278   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
12279
12280   application.SendNotification();
12281   finishCheck.CheckSignalNotReceived();
12282   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
12283
12284   application.SendNotification();
12285   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
12286
12287   // We did expect the animation to finish
12288   application.SendNotification();
12289   finishCheck.CheckSignalReceived();
12290   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12291
12292   // Check that nothing has changed after a couple of buffer swaps
12293   application.Render(0);
12294   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12295   END_TEST;
12296 }
12297
12298 int UtcDaliAnimationPlayAfterP4(void)
12299 {
12300   TestApplication application;
12301
12302   tet_printf("Testing that PlayAfter with progress value\n");
12303
12304   Actor actor = Actor::New();
12305   application.GetScene().Add(actor);
12306
12307   // Build the animation
12308   float     durationSeconds(1.0f);
12309   Animation animation = Animation::New(durationSeconds);
12310
12311   bool                 signalReceived(false);
12312   AnimationFinishCheck finishCheck(signalReceived);
12313   animation.FinishedSignal().Connect(&application, finishCheck);
12314   application.SendNotification();
12315
12316   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12317   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
12318
12319   // Delay time is 0.3s. So after duration times, progress must be 70%. animation will finished at 1.3s.
12320   animation.PlayAfter(durationSeconds * 0.3f);
12321   application.SendNotification();
12322   application.Render(0); // start animation
12323
12324   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 5/6 delay progress, 0% animation progress, 0% animator progress */);
12325
12326   // We didn't expect the animation to finish yet
12327   application.SendNotification();
12328   finishCheck.CheckSignalNotReceived();
12329   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of PlayAfter
12330
12331   application.SendNotification();
12332   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 20% animation progress, 0% animator progress */);
12333
12334   application.SendNotification();
12335   finishCheck.CheckSignalNotReceived();
12336   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
12337
12338   application.SendNotification();
12339   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 45% animation progress, 0% animator progress */);
12340
12341   application.SendNotification();
12342   finishCheck.CheckSignalNotReceived();
12343   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
12344
12345   application.SendNotification();
12346   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 70% animation progress, 40% animator progress */);
12347
12348   application.SendNotification();
12349   finishCheck.CheckSignalNotReceived();
12350   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION); // 40% of animator progress
12351
12352   application.SendNotification();
12353   application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 95% animation progress, 90% animator progress */);
12354
12355   application.SendNotification();
12356   finishCheck.CheckSignalNotReceived();
12357   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.9f), TEST_LOCATION); // 90% of animator progress
12358
12359   application.SendNotification();
12360   application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
12361
12362   // We did expect the animation to finish
12363   application.SendNotification();
12364   finishCheck.CheckSignalReceived();
12365   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12366
12367   // Check that nothing has changed after a couple of buffer swaps
12368   application.Render(0);
12369   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12370   END_TEST;
12371 }
12372
12373 int UtcDaliAnimationSetLoopingModeP(void)
12374 {
12375   // Test Loop forever and Loop mode being set
12376   TestApplication    application;
12377   Integration::Scene stage(application.GetScene());
12378
12379   // Default: LoopingMode::RESTART
12380   {
12381     Actor actor = Actor::New();
12382     stage.Add(actor);
12383
12384     float     durationSeconds(1.0f);
12385     Animation animation = Animation::New(durationSeconds);
12386     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::RESTART);
12387
12388     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
12389     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12390
12391     // Start the animation
12392     animation.Play();
12393     application.SendNotification();
12394     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
12395
12396     actor.Unparent();
12397
12398     application.SendNotification();
12399     application.Render();
12400     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12401   }
12402
12403   // LoopingMode::AUTO_REVERSE
12404   {
12405     Actor actor = Actor::New();
12406     stage.Add(actor);
12407
12408     float     durationSeconds(1.0f);
12409     Animation animation = Animation::New(durationSeconds);
12410     animation.SetLooping(true);
12411
12412     bool                 signalReceived(false);
12413     AnimationFinishCheck finishCheck(signalReceived);
12414     animation.FinishedSignal().Connect(&application, finishCheck);
12415     application.SendNotification();
12416
12417     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12418     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12419
12420     animation.SetLoopingMode(Animation::LoopingMode::AUTO_REVERSE);
12421     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12422
12423     // Start the animation
12424     animation.Play();
12425     application.SendNotification();
12426     application.Render(0);
12427
12428     for(int iterations = 0; iterations < 3; ++iterations)
12429     {
12430       application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% time progress */);
12431       application.SendNotification();
12432       finishCheck.CheckSignalNotReceived();
12433
12434       // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12435       // and arrives at the beginning.
12436       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12437
12438       application.SendNotification();
12439       application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 100% time progress */);
12440
12441       // We did expect the animation to finish
12442       application.SendNotification();
12443       finishCheck.CheckSignalNotReceived();
12444       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12445     }
12446
12447     animation.SetLooping(false);
12448     application.SendNotification();
12449     application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
12450
12451     application.SendNotification();
12452     finishCheck.CheckSignalReceived();
12453
12454     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12455   }
12456
12457   // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12458   {
12459     Actor actor = Actor::New();
12460     stage.Add(actor);
12461
12462     float     durationSeconds(1.0f);
12463     Animation animation = Animation::New(durationSeconds);
12464     animation.SetLooping(true);
12465
12466     bool                 signalReceived(false);
12467     AnimationFinishCheck finishCheck(signalReceived);
12468     animation.FinishedSignal().Connect(&application, finishCheck);
12469     application.SendNotification();
12470
12471     // Specify a negative multiplier to play the animation in reverse
12472     animation.SetSpeedFactor(-1.0f);
12473
12474     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12475     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12476
12477     animation.SetLoopingMode(Animation::AUTO_REVERSE);
12478     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12479
12480     // Start the animation
12481     animation.Play();
12482     application.SendNotification();
12483     application.Render(0);
12484
12485     for(int iterations = 0; iterations < 3; ++iterations)
12486     {
12487       application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% time progress */);
12488       application.SendNotification();
12489       finishCheck.CheckSignalNotReceived();
12490
12491       // Setting a negative speed factor is to play the animation in reverse.
12492       // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12493       // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12494       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12495
12496       application.SendNotification();
12497       application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 100% time progress */);
12498
12499       // We did expect the animation to finish
12500       application.SendNotification();
12501       finishCheck.CheckSignalNotReceived();
12502       DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12503     }
12504
12505     animation.SetLooping(false);
12506     application.SendNotification();
12507     application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
12508
12509     application.SendNotification();
12510     finishCheck.CheckSignalReceived();
12511
12512     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12513   }
12514
12515   END_TEST;
12516 }
12517
12518 int UtcDaliAnimationSetLoopingModeP2(void)
12519 {
12520   // Test Loop Count and Loop mode being set
12521   TestApplication    application;
12522   Integration::Scene stage(application.GetScene());
12523
12524   // LoopingMode::AUTO_REVERSE
12525   {
12526     Actor actor = Actor::New();
12527     stage.Add(actor);
12528
12529     float     durationSeconds(1.0f);
12530     Animation animation = Animation::New(durationSeconds);
12531     animation.SetLoopCount(3);
12532     DALI_TEST_CHECK(animation.IsLooping());
12533
12534     bool                 signalReceived(false);
12535     AnimationFinishCheck finishCheck(signalReceived);
12536     animation.FinishedSignal().Connect(&application, finishCheck);
12537     application.SendNotification();
12538
12539     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12540     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12541
12542     animation.SetLoopingMode(Animation::AUTO_REVERSE);
12543     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12544
12545     // Start the animation
12546     animation.Play();
12547
12548     application.Render(0);
12549     application.SendNotification();
12550     application.Render(0);
12551     application.SendNotification();
12552     application.Render(0);
12553     application.SendNotification();
12554     application.Render(0);
12555     application.SendNotification();
12556
12557     // Loop
12558     float intervalSeconds = 3.0f;
12559
12560     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12561     // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12562     // and arrives at the beginning.
12563     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12564
12565     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12566
12567     application.Render(0);
12568     application.SendNotification();
12569     application.Render(0);
12570     application.SendNotification();
12571     application.Render(0);
12572     application.SendNotification();
12573     application.Render(0);
12574     application.SendNotification();
12575     finishCheck.CheckSignalNotReceived();
12576
12577     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12578
12579     application.SendNotification();
12580     finishCheck.CheckSignalReceived();
12581     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12582
12583     finishCheck.Reset();
12584   }
12585
12586   // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12587   {
12588     Actor actor = Actor::New();
12589     stage.Add(actor);
12590
12591     float     durationSeconds(1.0f);
12592     Animation animation = Animation::New(durationSeconds);
12593     animation.SetLoopCount(3);
12594     DALI_TEST_CHECK(animation.IsLooping());
12595
12596     bool                 signalReceived(false);
12597     AnimationFinishCheck finishCheck(signalReceived);
12598     animation.FinishedSignal().Connect(&application, finishCheck);
12599     application.SendNotification();
12600
12601     // Specify a negative multiplier to play the animation in reverse
12602     animation.SetSpeedFactor(-1.0f);
12603
12604     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12605     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12606
12607     animation.SetLoopingMode(Animation::AUTO_REVERSE);
12608     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12609
12610     // Start the animation
12611     animation.Play();
12612
12613     application.Render(0);
12614     application.SendNotification();
12615     application.Render(0);
12616     application.SendNotification();
12617     application.Render(0);
12618     application.SendNotification();
12619     application.Render(0);
12620     application.SendNotification();
12621
12622     // Loop
12623     float intervalSeconds = 3.0f;
12624
12625     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12626     // Setting a negative speed factor is to play the animation in reverse.
12627     // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12628     // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12629     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12630
12631     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12632
12633     application.Render(0);
12634     application.SendNotification();
12635     application.Render(0);
12636     application.SendNotification();
12637     application.Render(0);
12638     application.SendNotification();
12639     application.Render(0);
12640     application.SendNotification();
12641     finishCheck.CheckSignalNotReceived();
12642
12643     application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12644
12645     application.SendNotification();
12646     finishCheck.CheckSignalReceived();
12647     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12648
12649     finishCheck.Reset();
12650   }
12651
12652   END_TEST;
12653 }
12654
12655 int UtcDaliAnimationSetLoopingModeP3(void)
12656 {
12657   // Test Loop Count is 1 (== default) and Loop mode being set
12658   TestApplication    application;
12659   Integration::Scene stage(application.GetScene());
12660
12661   // LoopingMode::AUTO_REVERSE
12662   {
12663     Actor actor = Actor::New();
12664     stage.Add(actor);
12665
12666     float     durationSeconds(1.0f);
12667     Animation animation = Animation::New(durationSeconds);
12668     DALI_TEST_CHECK(1 == animation.GetLoopCount());
12669
12670     bool                 signalReceived(false);
12671     AnimationFinishCheck finishCheck(signalReceived);
12672     animation.FinishedSignal().Connect(&application, finishCheck);
12673     application.SendNotification();
12674
12675     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12676     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12677
12678     animation.SetLoopingMode(Animation::AUTO_REVERSE);
12679     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12680
12681     // Start the animation
12682     animation.Play();
12683     application.Render(0);
12684     application.SendNotification();
12685
12686     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 50% time progress */);
12687     application.SendNotification();
12688     finishCheck.CheckSignalNotReceived();
12689
12690     // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12691     // and arrives at the beginning.
12692     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12693
12694     application.SendNotification();
12695     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 100% time progress */);
12696
12697     application.SendNotification();
12698     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12699
12700     application.SendNotification();
12701     application.Render(static_cast<unsigned int>(durationSeconds * 1.0f * 1000.0f) + 1u /*just beyond the animation duration*/);
12702
12703     application.SendNotification();
12704     application.Render(0);
12705     application.SendNotification();
12706     finishCheck.CheckSignalReceived();
12707
12708     // After all animation finished, arrives at the beginning.
12709     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12710
12711     finishCheck.Reset();
12712   }
12713
12714   // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12715   {
12716     Actor actor = Actor::New();
12717     stage.Add(actor);
12718
12719     float     durationSeconds(1.0f);
12720     Animation animation = Animation::New(durationSeconds);
12721     DALI_TEST_CHECK(1 == animation.GetLoopCount());
12722
12723     bool                 signalReceived(false);
12724     AnimationFinishCheck finishCheck(signalReceived);
12725     animation.FinishedSignal().Connect(&application, finishCheck);
12726     application.SendNotification();
12727
12728     // Specify a negative multiplier to play the animation in reverse
12729     animation.SetSpeedFactor(-1.0f);
12730
12731     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12732     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12733
12734     animation.SetLoopingMode(Animation::AUTO_REVERSE);
12735     DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12736
12737     // Start the animation
12738     animation.Play();
12739     application.Render(0);
12740     application.SendNotification();
12741
12742     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 50% time progress */);
12743     application.SendNotification();
12744     finishCheck.CheckSignalNotReceived();
12745
12746     // Setting a negative speed factor is to play the animation in reverse.
12747     // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12748     // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12749     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12750
12751     application.SendNotification();
12752     application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 100% time progress */);
12753
12754     application.SendNotification();
12755     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12756
12757     application.SendNotification();
12758     application.Render(static_cast<unsigned int>(durationSeconds * 1.0f * 1000.0f) + 1u /*just beyond the animation duration*/);
12759
12760     application.SendNotification();
12761     application.Render(0);
12762     application.SendNotification();
12763     finishCheck.CheckSignalReceived();
12764
12765     // After all animation finished, arrives at the target.
12766     DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12767
12768     finishCheck.Reset();
12769   }
12770
12771   END_TEST;
12772 }
12773
12774 int UtcDaliAnimationGetLoopingModeP(void)
12775 {
12776   TestApplication application;
12777
12778   Animation animation = Animation::New(1.0f);
12779
12780   // default mode
12781   DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::RESTART);
12782
12783   animation.SetLoopingMode(Animation::AUTO_REVERSE);
12784   DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12785
12786   END_TEST;
12787 }
12788
12789 int UtcDaliAnimationProgressSignalConnectionWithoutProgressMarkerP(void)
12790 {
12791   TestApplication application;
12792
12793   tet_infoline("Connect to ProgressReachedSignal but do not set a required Progress marker");
12794
12795   Actor actor = Actor::New();
12796   application.GetScene().Add(actor);
12797
12798   // Build the animation
12799   Animation animation = Animation::New(0.0f);
12800
12801   //Set duration
12802   float durationSeconds(1.0f);
12803   animation.SetDuration(durationSeconds);
12804
12805   bool finishedSignalReceived(false);
12806   bool progressSignalReceived(false);
12807
12808   AnimationFinishCheck finishCheck(finishedSignalReceived);
12809   animation.FinishedSignal().Connect(&application, finishCheck);
12810
12811   AnimationProgressCheck progressCheck(progressSignalReceived);
12812   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
12813   application.SendNotification();
12814
12815   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12816   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12817
12818   progressCheck.CheckSignalNotReceived();
12819
12820   animation.Play();
12821
12822   application.SendNotification();
12823   application.Render(0);                        // start animation
12824   application.Render(durationSeconds * 100.0f); // 10% progress
12825   application.SendNotification();
12826
12827   tet_infoline("Ensure after animation has started playing that ProgressReachedSignal not emitted");
12828   finishCheck.CheckSignalNotReceived();
12829   progressCheck.CheckSignalNotReceived();
12830
12831   application.Render(static_cast<unsigned int>(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/);
12832
12833   application.SendNotification();
12834   finishCheck.CheckSignalReceived();
12835   tet_infoline("Animation finished");
12836   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12837
12838   END_TEST;
12839 }
12840
12841 int UtcDaliAnimationMultipleProgressSignalsP(void)
12842 {
12843   tet_infoline("Multiple animations with different progress markers");
12844
12845   TestApplication application;
12846
12847   Actor actor = Actor::New();
12848   application.GetScene().Add(actor);
12849
12850   // Build the animation
12851   Animation animationAlpha = Animation::New(0.0f);
12852   Animation animationBeta  = Animation::New(0.0f);
12853
12854   //Set duration
12855   float durationSeconds(1.0f);
12856   animationAlpha.SetDuration(durationSeconds);
12857   animationBeta.SetDuration(durationSeconds);
12858
12859   bool progressSignalReceivedAlpha(false);
12860   bool progressSignalReceivedBeta(false);
12861
12862   AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12863   AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta");
12864
12865   DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha);
12866   DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta);
12867   application.SendNotification();
12868
12869   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12870   animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12871   animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12872
12873   tet_infoline("AnimationAlpha Progress notification set to 30%");
12874   DevelAnimation::SetProgressNotification(animationAlpha, 0.3f);
12875
12876   tet_infoline("AnimationBeta Progress notification set to 50%");
12877   DevelAnimation::SetProgressNotification(animationBeta, 0.5f);
12878
12879   application.SendNotification();
12880   application.Render();
12881
12882   progressCheckAlpha.CheckSignalNotReceived();
12883   progressCheckBeta.CheckSignalNotReceived();
12884
12885   // Start the animations from 10% progress
12886   animationAlpha.SetCurrentProgress(0.1f);
12887   animationBeta.SetCurrentProgress(0.1f);
12888   animationAlpha.Play();
12889   animationBeta.Play();
12890
12891   tet_infoline("Animation Playing from 10%");
12892
12893   application.SendNotification();
12894   application.Render(0);                        // start animation
12895   application.Render(durationSeconds * 100.0f); // 20% progress
12896
12897   tet_infoline("Animation at 20% - No signals to be received");
12898
12899   progressCheckAlpha.CheckSignalNotReceived();
12900   progressCheckBeta.CheckSignalNotReceived();
12901
12902   application.SendNotification();
12903   application.Render(durationSeconds * 200.0f); // 40% progress
12904   application.SendNotification();
12905   tet_infoline("Animation at 40% - Alpha signal should be received");
12906   DALI_TEST_EQUALS(0.4f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
12907
12908   progressCheckAlpha.CheckSignalReceived();
12909   progressCheckBeta.CheckSignalNotReceived();
12910
12911   tet_infoline("Progress check reset");
12912   progressCheckAlpha.Reset();
12913   progressCheckBeta.Reset();
12914
12915   application.Render(durationSeconds * 100.0f); // 50% progress
12916   tet_infoline("Animation at 50% - Beta should receive signal, Alpha should not");
12917   application.SendNotification();
12918
12919   DALI_TEST_EQUALS(0.5f, animationBeta.GetCurrentProgress(), TEST_LOCATION);
12920
12921   progressCheckAlpha.CheckSignalNotReceived();
12922   progressCheckBeta.CheckSignalReceived();
12923   tet_infoline("Progress check reset");
12924   progressCheckAlpha.Reset();
12925   progressCheckBeta.Reset();
12926
12927   application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 60% progress */);
12928   application.SendNotification();
12929
12930   tet_infoline("Animation at 60%");
12931
12932   progressCheckAlpha.CheckSignalNotReceived();
12933   progressCheckBeta.CheckSignalNotReceived();
12934
12935   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
12936   application.SendNotification();
12937   tet_infoline("Animation at 80%");
12938
12939   progressCheckAlpha.CheckSignalNotReceived();
12940   progressCheckBeta.CheckSignalNotReceived();
12941
12942   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
12943   // We did expect the animation to finish
12944   tet_infoline("Animation finished");
12945
12946   END_TEST;
12947 }
12948
12949 int UtcDaliAnimationMultipleProgressSignalsP2(void)
12950 {
12951   tet_infoline("Multiple animations with different progress markers and big step time");
12952
12953   TestApplication application;
12954
12955   Actor actor = Actor::New();
12956   application.GetScene().Add(actor);
12957
12958   // Build the animation
12959   Animation animationAlpha = Animation::New(0.0f);
12960   Animation animationBeta  = Animation::New(0.0f);
12961
12962   //Set duration
12963   const float durationSeconds(1.0f);
12964   animationAlpha.SetDuration(durationSeconds);
12965   animationBeta.SetDuration(durationSeconds);
12966
12967   bool progressSignalReceivedAlpha(false);
12968   bool progressSignalReceivedBeta(false);
12969
12970   AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12971   AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta");
12972
12973   DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha);
12974   DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta);
12975   application.SendNotification();
12976
12977   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12978   animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12979   animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12980
12981   tet_infoline("AnimationAlpha Progress notification set to 1%");
12982   DevelAnimation::SetProgressNotification(animationAlpha, 0.01f);
12983
12984   tet_infoline("AnimationBeta Progress notification set to 99%");
12985   DevelAnimation::SetProgressNotification(animationBeta, 0.99f);
12986
12987   application.SendNotification();
12988   application.Render();
12989
12990   progressCheckAlpha.CheckSignalNotReceived();
12991   progressCheckBeta.CheckSignalNotReceived();
12992
12993   // Start the animations unlimited looping
12994   animationAlpha.SetLooping(true);
12995   animationBeta.SetLooping(true);
12996   animationAlpha.Play();
12997   animationBeta.Play();
12998
12999   application.SendNotification();
13000   application.Render(0);                       // start animation
13001   application.Render(durationSeconds * 20.0f); // 2% progress
13002   application.SendNotification();
13003   DALI_TEST_EQUALS(0.02f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
13004
13005   tet_infoline("Animation at 2% - Alpha signals should be received, Beta should not.");
13006
13007   progressCheckAlpha.CheckSignalReceived();
13008   progressCheckBeta.CheckSignalNotReceived();
13009
13010   tet_infoline("Progress check reset");
13011   progressCheckAlpha.Reset();
13012   progressCheckBeta.Reset();
13013
13014   application.SendNotification();
13015   application.Render(durationSeconds * 960.0f); // 98% progress
13016   application.SendNotification();
13017   tet_infoline("Animation at 98% - No signal received");
13018   DALI_TEST_EQUALS(0.98f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
13019
13020   progressCheckAlpha.CheckSignalNotReceived();
13021   progressCheckBeta.CheckSignalNotReceived();
13022
13023   application.SendNotification();
13024   application.Render(durationSeconds * 40.0f); // 2% progress
13025   application.SendNotification();
13026   tet_infoline("Animation loop once and now 2% - Alpha and Beta should receive signal");
13027   application.SendNotification();
13028
13029   DALI_TEST_EQUALS(0.02f, animationBeta.GetCurrentProgress(), TEST_LOCATION);
13030
13031   progressCheckAlpha.CheckSignalReceived();
13032   progressCheckBeta.CheckSignalReceived();
13033
13034   tet_infoline("Progress check reset");
13035   progressCheckAlpha.Reset();
13036   progressCheckBeta.Reset();
13037
13038   application.SendNotification();
13039   application.Render(durationSeconds * 980.0f); // 100% progress
13040   application.SendNotification();
13041   tet_infoline("Animation loop one more time. and now 100% - Beta should receive signal, Alhpa sholud not");
13042   application.SendNotification();
13043
13044   progressCheckAlpha.CheckSignalNotReceived();
13045   progressCheckBeta.CheckSignalReceived();
13046
13047   tet_infoline("Progress check reset");
13048   progressCheckAlpha.Reset();
13049   progressCheckBeta.Reset();
13050
13051   animationAlpha.SetLooping(false);
13052   animationBeta.SetLooping(false);
13053
13054   application.SendNotification();
13055   application.Render(static_cast<unsigned int>(durationSeconds * 2000.0f) + 1u /*just beyond the animation duration*/);
13056   application.SendNotification();
13057
13058   // We did expect the animation to finish
13059   tet_infoline("Animation finished");
13060
13061   END_TEST;
13062 }
13063
13064 int UtcDaliAnimationProgressSignalWithPlayAfterP(void)
13065 {
13066   tet_infoline("Multiple animations with different progress markers");
13067
13068   TestApplication application;
13069
13070   Actor actor = Actor::New();
13071   application.GetScene().Add(actor);
13072
13073   // Build the animation
13074   Animation animationAlpha = Animation::New(0.0f);
13075   Animation animationBeta  = Animation::New(0.0f);
13076
13077   //Set duration
13078   float durationSeconds(1.0f);
13079   float delaySeconds(0.5f);
13080   animationAlpha.SetDuration(durationSeconds);
13081   animationBeta.SetDuration(durationSeconds);
13082
13083   bool progressSignalReceivedAlpha(false);
13084   bool progressSignalReceivedBeta(false);
13085
13086   AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
13087   AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta");
13088
13089   DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha);
13090   DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta);
13091   application.SendNotification();
13092
13093   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13094   animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13095   animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13096
13097   tet_infoline("AnimationAlpha Progress notification set to 30%");
13098   DevelAnimation::SetProgressNotification(animationAlpha, 0.3f);
13099
13100   tet_infoline("AnimationBeta Progress notification set to ~0% (==Notify when delay is done)");
13101   DevelAnimation::SetProgressNotification(animationBeta, Math::MACHINE_EPSILON_1);
13102
13103   application.SendNotification();
13104   application.Render();
13105
13106   progressCheckAlpha.CheckSignalNotReceived();
13107   progressCheckBeta.CheckSignalNotReceived();
13108
13109   // Start the animations from 10% progress
13110   animationAlpha.PlayAfter(delaySeconds);
13111   animationBeta.PlayAfter(delaySeconds);
13112
13113   application.SendNotification();
13114   application.Render(0);                     // start animation
13115   application.Render(delaySeconds * 500.0f); // 50% wait progress
13116
13117   tet_infoline("Delay at 50% - No signals to be received");
13118
13119   progressCheckAlpha.CheckSignalNotReceived();
13120   progressCheckBeta.CheckSignalNotReceived();
13121
13122   application.SendNotification();
13123   application.Render(delaySeconds * 500.0f + durationSeconds * 50.0f); // 100% wait, 5% progress
13124   application.SendNotification();
13125   tet_infoline("Delay at 100%, Animation at 5% - Beta signal should be received");
13126   DALI_TEST_EQUALS(0.05f, animationBeta.GetCurrentProgress(), TEST_LOCATION);
13127
13128   progressCheckBeta.CheckSignalReceived();
13129   progressCheckAlpha.CheckSignalNotReceived();
13130
13131   tet_infoline("Progress check reset");
13132   progressCheckAlpha.Reset();
13133   progressCheckBeta.Reset();
13134
13135   application.Render(durationSeconds * 200.0f); // 25% progress
13136   tet_infoline("Animation at 25% - No signals to be received");
13137   application.SendNotification();
13138
13139   progressCheckAlpha.CheckSignalNotReceived();
13140   progressCheckBeta.CheckSignalNotReceived();
13141
13142   application.Render(durationSeconds * 200.0f); // 45% progress
13143   tet_infoline("Animation at 45% - Alpha should receive signal, Beta should not");
13144   application.SendNotification();
13145
13146   DALI_TEST_EQUALS(0.45f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
13147
13148   progressCheckAlpha.CheckSignalReceived();
13149   progressCheckBeta.CheckSignalNotReceived();
13150
13151   tet_infoline("Progress check reset");
13152   progressCheckAlpha.Reset();
13153   progressCheckBeta.Reset();
13154
13155   application.Render(static_cast<unsigned int>(durationSeconds * 150.0f) /* 60% progress */);
13156   application.SendNotification();
13157
13158   tet_infoline("Animation at 60%");
13159
13160   progressCheckAlpha.CheckSignalNotReceived();
13161   progressCheckBeta.CheckSignalNotReceived();
13162
13163   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
13164   application.SendNotification();
13165   tet_infoline("Animation at 80%");
13166
13167   progressCheckAlpha.CheckSignalNotReceived();
13168   progressCheckBeta.CheckSignalNotReceived();
13169
13170   application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
13171   // We did expect the animation to finish
13172   tet_infoline("Animation finished");
13173
13174   END_TEST;
13175 }
13176
13177 int UtcDaliAnimationProgressCallbackWithLoopingP(void)
13178 {
13179   TestApplication application;
13180
13181   Actor actor = Actor::New();
13182   application.GetScene().Add(actor);
13183
13184   // Build the animation
13185   Animation animation = Animation::New(0.0f);
13186
13187   //Set duration
13188   const float durationSeconds(1.0f);
13189   animation.SetDuration(durationSeconds);
13190
13191   // Set Looping Count
13192   const int loopCount(4);
13193   animation.SetLoopCount(loopCount);
13194
13195   bool finishedSignalReceived(false);
13196   bool progressSignalReceived(false);
13197
13198   AnimationFinishCheck finishCheck(finishedSignalReceived);
13199   animation.FinishedSignal().Connect(&application, finishCheck);
13200
13201   AnimationProgressCheck progressCheck(progressSignalReceived);
13202   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13203   application.SendNotification();
13204
13205   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13206   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13207
13208   tet_infoline("Animation Progress notification set to 50% with looping count 4");
13209   DevelAnimation::SetProgressNotification(animation, 0.5f);
13210
13211   application.SendNotification();
13212   application.Render();
13213
13214   progressCheck.CheckSignalNotReceived();
13215
13216   animation.Play();
13217
13218   for(int count = 0; count < loopCount; count++)
13219   {
13220     application.SendNotification();
13221     application.Render(0); // start animation
13222     finishCheck.CheckSignalNotReceived();
13223
13224     application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13225     DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13226
13227     tet_infoline("Animation at 25%");
13228
13229     progressCheck.CheckSignalNotReceived();
13230
13231     application.SendNotification();
13232     application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13233     application.SendNotification();
13234     tet_infoline("Animation at 50%");
13235     DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13236
13237     progressCheck.CheckSignalReceived();
13238
13239     tet_infoline("Progress check reset");
13240     progressCheck.Reset();
13241
13242     application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13243     tet_infoline("Animation at 75%");
13244     application.SendNotification();
13245
13246     DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13247
13248     progressCheck.CheckSignalNotReceived();
13249
13250     application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
13251     tet_infoline("Animation at 100%");
13252     application.SendNotification();
13253
13254     //Nothing check at 100% progress. cause It can be both 100% and 0%.
13255     application.SendNotification();
13256   }
13257   application.Render(10u);
13258   application.SendNotification();
13259   application.Render(0u);
13260   application.SendNotification();
13261
13262   finishCheck.CheckSignalReceived();
13263
13264   END_TEST;
13265 }
13266
13267 int UtcDaliAnimationProgressCallbackWithLoopingP2(void)
13268 {
13269   TestApplication application;
13270
13271   Actor actor = Actor::New();
13272   application.GetScene().Add(actor);
13273
13274   // Build the animation
13275   Animation animation = Animation::New(0.0f);
13276
13277   //Set duration
13278   const float durationSeconds(1.0f);
13279   animation.SetDuration(durationSeconds);
13280
13281   // Set Looping Unlmited
13282   animation.SetLooping(true);
13283
13284   bool finishedSignalReceived(false);
13285   bool progressSignalReceived(false);
13286
13287   AnimationFinishCheck finishCheck(finishedSignalReceived);
13288   animation.FinishedSignal().Connect(&application, finishCheck);
13289
13290   AnimationProgressCheck progressCheck(progressSignalReceived);
13291   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13292   application.SendNotification();
13293
13294   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13295   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13296
13297   tet_infoline("Animation Progress notification set to 50% with unlimited looping");
13298   DevelAnimation::SetProgressNotification(animation, 0.5f);
13299
13300   application.SendNotification();
13301   application.Render();
13302
13303   progressCheck.CheckSignalNotReceived();
13304
13305   animation.Play();
13306
13307   for(int count = 0; count < 4; count++)
13308   {
13309     application.SendNotification();
13310     application.Render(0);                                // start animation
13311     application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13312     DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13313
13314     tet_infoline("Animation at 25%");
13315
13316     progressCheck.CheckSignalNotReceived();
13317
13318     application.SendNotification();
13319     application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13320     application.SendNotification();
13321     tet_infoline("Animation at 50%");
13322     DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13323
13324     progressCheck.CheckSignalReceived();
13325
13326     tet_infoline("Progress check reset");
13327     progressCheck.Reset();
13328
13329     application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13330     tet_infoline("Animation at 75%");
13331     application.SendNotification();
13332
13333     DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13334
13335     progressCheck.CheckSignalNotReceived();
13336
13337     application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
13338     tet_infoline("Animation at 100%");
13339     application.SendNotification();
13340
13341     //Nothing check at 100% progress. cause It can be both 100% and 0%.
13342     finishCheck.CheckSignalNotReceived();
13343     application.SendNotification();
13344   }
13345   finishCheck.CheckSignalNotReceived();
13346
13347   animation.SetLooping(false);
13348   application.Render(0u);
13349   application.SendNotification();
13350   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 10u);
13351   application.SendNotification();
13352   application.Render(0u);
13353   application.SendNotification();
13354
13355   finishCheck.CheckSignalReceived();
13356
13357   END_TEST;
13358 }
13359
13360 int UtcDaliAnimationProgressCallbackNegativeSpeed(void)
13361 {
13362   TestApplication application;
13363
13364   Actor actor = Actor::New();
13365   application.GetScene().Add(actor);
13366
13367   // Build the animation
13368   Animation animation = Animation::New(0.0f);
13369
13370   //Set duration
13371   const float durationSeconds(1.0f);
13372   animation.SetDuration(durationSeconds);
13373
13374   //Set speed negative
13375   animation.SetSpeedFactor(-1.0f);
13376
13377   // Set Looping Unlmited
13378   animation.SetLooping(true);
13379
13380   bool finishedSignalReceived(false);
13381   bool progressSignalReceived(false);
13382
13383   AnimationFinishCheck finishCheck(finishedSignalReceived);
13384   animation.FinishedSignal().Connect(&application, finishCheck);
13385
13386   AnimationProgressCheck progressCheck(progressSignalReceived);
13387   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13388   application.SendNotification();
13389
13390   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13391   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13392
13393   tet_infoline("Animation Progress notification set to 50%");
13394   DevelAnimation::SetProgressNotification(animation, 0.5f);
13395
13396   application.SendNotification();
13397   application.Render();
13398
13399   progressCheck.CheckSignalNotReceived();
13400
13401   animation.Play();
13402
13403   for(int count = 0; count < 4; count++)
13404   {
13405     application.SendNotification();
13406     application.Render(0); // start animation
13407     progressCheck.CheckSignalNotReceived();
13408
13409     application.SendNotification();
13410     application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13411     DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13412
13413     tet_infoline("Animation at 25%");
13414
13415     progressCheck.CheckSignalNotReceived();
13416
13417     application.SendNotification();
13418     application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13419     application.SendNotification();
13420     tet_infoline("Animation at 50%");
13421     DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13422
13423     progressCheck.CheckSignalReceived();
13424
13425     tet_infoline("Progress check reset");
13426     progressCheck.Reset();
13427
13428     application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13429     tet_infoline("Animation at 75%");
13430     application.SendNotification();
13431
13432     DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13433
13434     progressCheck.CheckSignalNotReceived();
13435
13436     application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
13437     tet_infoline("Animation at 100%");
13438     application.SendNotification();
13439
13440     //Nothing check at 100% progress. cause It can be both 100% and 0%.
13441     finishCheck.CheckSignalNotReceived();
13442     application.SendNotification();
13443   }
13444   finishCheck.CheckSignalNotReceived();
13445
13446   animation.Stop();
13447   animation.SetLooping(false);
13448   animation.SetLoopCount(4);
13449   animation.Play();
13450   application.SendNotification(); // Send Stop event into update thread
13451   application.Render(0u);         // Send Notification into event thread
13452   application.SendNotification(); // Execute finished signal.
13453
13454   finishCheck.CheckSignalReceived(); // Due to stop called.
13455   finishCheck.Reset();
13456
13457   for(int count = 0; count < 4; count++)
13458   {
13459     application.SendNotification();
13460     application.Render(0); // start animation
13461     progressCheck.CheckSignalNotReceived();
13462     finishCheck.CheckSignalNotReceived();
13463
13464     application.SendNotification();
13465     application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13466     DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13467
13468     tet_infoline("Animation at 25%");
13469
13470     progressCheck.CheckSignalNotReceived();
13471
13472     application.SendNotification();
13473     application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13474     application.SendNotification();
13475     tet_infoline("Animation at 50%");
13476     DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13477
13478     progressCheck.CheckSignalReceived();
13479
13480     tet_infoline("Progress check reset");
13481     progressCheck.Reset();
13482
13483     application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13484     tet_infoline("Animation at 75%");
13485     application.SendNotification();
13486
13487     DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13488
13489     progressCheck.CheckSignalNotReceived();
13490
13491     application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
13492     tet_infoline("Animation at 100%");
13493     application.SendNotification();
13494
13495     //Nothing check at 100% progress. cause It can be both 100% and 0%.
13496     application.SendNotification();
13497   }
13498   application.Render(10u);
13499   application.SendNotification();
13500   application.Render(0u);
13501   application.SendNotification();
13502
13503   finishCheck.CheckSignalReceived();
13504
13505   END_TEST;
13506 }
13507
13508 int UtcDaliAnimationProgressCallbackInvalidSignalN(void)
13509 {
13510   TestApplication application;
13511
13512   Actor actor = Actor::New();
13513   application.GetScene().Add(actor);
13514
13515   // Build the animation
13516   Animation animation = Animation::New(0.0f);
13517
13518   //Set duration
13519   const float durationSeconds(1.0f);
13520   animation.SetDuration(durationSeconds);
13521
13522   bool finishedSignalReceived(false);
13523   bool progressSignalReceived(false);
13524
13525   AnimationFinishCheck finishCheck(finishedSignalReceived);
13526   animation.FinishedSignal().Connect(&application, finishCheck);
13527
13528   AnimationProgressCheck progressCheck(progressSignalReceived);
13529   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13530   application.SendNotification();
13531
13532   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13533   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13534
13535   tet_infoline("Animation Progress PlayRange as 10% ~ 90%");
13536   animation.SetPlayRange(Vector2(0.1f, 0.9f));
13537
13538   tet_infoline("Animation Progress notification set to >90% that never can notificated");
13539   DevelAnimation::SetProgressNotification(animation, 0.9f + Math::MACHINE_EPSILON_1);
13540
13541   application.SendNotification();
13542   application.Render();
13543
13544   progressCheck.CheckSignalNotReceived();
13545
13546   animation.Play();
13547
13548   application.SendNotification();
13549   application.Render(0);                                // start animation
13550   application.Render(durationSeconds * 0.25 * 1000.0f); // 35% progress
13551   DALI_TEST_EQUALS(0.35f, animation.GetCurrentProgress(), TEST_LOCATION);
13552
13553   tet_infoline("Animation at 35%");
13554
13555   progressCheck.CheckSignalNotReceived();
13556
13557   application.SendNotification();
13558   application.Render(durationSeconds * 0.25 * 1000.0f); // 60% progress
13559   application.SendNotification();
13560   DALI_TEST_EQUALS(0.6f, animation.GetCurrentProgress(), TEST_LOCATION);
13561
13562   tet_infoline("Animation at 60%");
13563
13564   progressCheck.CheckSignalNotReceived();
13565
13566   application.Render(durationSeconds * 0.25 * 1000.0f); // 85% progress
13567   tet_infoline("Animation at 85%");
13568   application.SendNotification();
13569   DALI_TEST_EQUALS(0.85f, animation.GetCurrentProgress(), TEST_LOCATION);
13570
13571   progressCheck.CheckSignalNotReceived();
13572
13573   application.Render(durationSeconds * 0.25 * 1000.0f); // 90% progress
13574   tet_infoline("Animation over 90%");
13575   application.SendNotification();
13576
13577   // progress never signaled because playrange is 90%
13578   progressCheck.CheckSignalNotReceived();
13579
13580   END_TEST;
13581 }
13582
13583 int UtcDaliAnimationProgressCallbackLongDurationP(void)
13584 {
13585   TestApplication application;
13586
13587   Actor actor = Actor::New();
13588   application.GetScene().Add(actor);
13589
13590   // Build the animation
13591   Animation animation = Animation::New(0.0f);
13592
13593   //Set duration
13594   float durationSeconds(5.0f);
13595   animation.SetDuration(durationSeconds);
13596
13597   bool finishedSignalReceived(false);
13598   bool progressSignalReceived(false);
13599
13600   AnimationFinishCheck finishCheck(finishedSignalReceived);
13601   animation.FinishedSignal().Connect(&application, finishCheck);
13602
13603   AnimationProgressCheck progressCheck(progressSignalReceived);
13604   DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13605   application.SendNotification();
13606
13607   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13608   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13609
13610   tet_infoline("Animation Progress notification set to 50%");
13611   DevelAnimation::SetProgressNotification(animation, 0.5f);
13612
13613   application.SendNotification();
13614   application.Render();
13615
13616   progressCheck.CheckSignalNotReceived();
13617
13618   animation.Play();
13619
13620   application.SendNotification();
13621   application.Render(0);                                // start animation
13622   application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13623   DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13624
13625   tet_infoline("Animation at 25%");
13626
13627   progressCheck.CheckSignalNotReceived();
13628
13629   application.SendNotification();
13630   application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13631   application.SendNotification();
13632   tet_infoline("Animation at 50%");
13633   DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13634
13635   progressCheck.CheckSignalReceived();
13636
13637   tet_infoline("Progress check reset");
13638   progressCheck.Reset();
13639
13640   application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13641   tet_infoline("Animation at 75%");
13642   application.SendNotification();
13643
13644   DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13645
13646   progressCheck.CheckSignalNotReceived();
13647
13648   END_TEST;
13649 }
13650
13651 int UtcDaliAnimationAnimateByInvalidParameters(void)
13652 {
13653   TestApplication application;
13654
13655   Actor actor = Actor::New();
13656   application.GetScene().Add(actor);
13657
13658   // Create the animation
13659   Animation animation = Animation::New(1.0f);
13660
13661   DALI_TEST_ASSERTION(
13662     {
13663       // non animateable property (STRING)
13664       animation.AnimateBy(Property(actor, Actor::Property::LAYOUT_DIRECTION), Property::Value("new direction"));
13665     },
13666     "Property type is not animatable");
13667
13668   DALI_TEST_ASSERTION(
13669     {
13670       // non animateable property (MATRIX)
13671       Property::Index index = actor.RegisterProperty("Foobar", Property::Value(Dali::Matrix()), Property::ANIMATABLE);
13672       animation.AnimateBy(Property(actor, index), Property::Value(Property::MATRIX));
13673     },
13674     "Property type is not animatable");
13675
13676   // AnimateBy
13677   DALI_TEST_ASSERTION(
13678     {
13679       // non animateable target (NONE)
13680       animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value());
13681     },
13682     "Target value is not animatable");
13683
13684   DALI_TEST_ASSERTION(
13685     {
13686       // non animateable target (STRING)
13687       animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value("foo"));
13688     },
13689     "Target value is not animatable");
13690
13691   DALI_TEST_ASSERTION(
13692     {
13693       // not mathing properties (VECTOR3, FLOAT)
13694       animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(10.f));
13695     },
13696     "Property and target types don't match");
13697
13698   DALI_TEST_ASSERTION(
13699     {
13700       // not mathing properties (VECTOR3.A, VECTOR2)
13701       animation.AnimateBy(Property(actor, Actor::Property::COLOR_ALPHA), Property::Value(Property::VECTOR2));
13702     },
13703     "Property and target types don't match");
13704
13705   DALI_TEST_ASSERTION(
13706     {
13707       // negative duration
13708       animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(Vector3(1, 2, 3)), TimePeriod(-1));
13709     },
13710     "Duration must be >=0");
13711
13712   END_TEST;
13713 }
13714
13715 int UtcDaliAnimationAnimateToInvalidParameters(void)
13716 {
13717   TestApplication application;
13718
13719   Actor actor = Actor::New();
13720   application.GetScene().Add(actor);
13721
13722   // Create the animation
13723   Animation animation = Animation::New(1.0f);
13724
13725   // AnimateTo
13726   DALI_TEST_ASSERTION(
13727     {
13728       // non animateable property (MAP)
13729       Property::Index index = actor.RegisterProperty("Foobar", Property::Value(Property::MAP), Property::ANIMATABLE);
13730       animation.AnimateTo(Property(actor, index), Property::Value(Property::MAP));
13731     },
13732     "Property type is not animatable");
13733
13734   DALI_TEST_ASSERTION(
13735     {
13736       // non animateable target (NONE)
13737       animation.AnimateTo(Property(actor, Actor::Property::CLIPPING_MODE), Property::Value());
13738     },
13739     "Property type is not animatable");
13740
13741   DALI_TEST_ASSERTION(
13742     {
13743       // non animateable target (ARRAY)
13744       animation.AnimateTo(Property(actor, Actor::Property::POSITION), Property::Value(Property::ARRAY));
13745     },
13746     "Target value is not animatable");
13747
13748   DALI_TEST_ASSERTION(
13749     {
13750       // non animateable target (RECTANGLE)
13751       animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(Rect<int32_t>()));
13752     },
13753     "Target value is not animatable");
13754
13755   DALI_TEST_ASSERTION(
13756     {
13757       // not mathing properties (FLOAT, INT)
13758       animation.AnimateTo(Property(actor, Actor::Property::SCALE_Y), Property::Value(10));
13759     },
13760     "Property and target types don't match");
13761
13762   DALI_TEST_ASSERTION(
13763     {
13764       // not mathing properties (VECTOR3, VECTOR2)
13765       animation.AnimateTo(Property(actor, Actor::Property::COLOR), Property::Value(Property::VECTOR2));
13766     },
13767     "Property and target types don't match");
13768
13769   DALI_TEST_ASSERTION(
13770     {
13771       // negative duration
13772       animation.AnimateTo(Property(actor, Actor::Property::POSITION), Property::Value(Vector3(1, 2, 3)), TimePeriod(-1));
13773     },
13774     "Duration must be >=0");
13775
13776   END_TEST;
13777 }
13778
13779 int UtcDaliAnimationAnimateBetweenInvalidParameters(void)
13780 {
13781   TestApplication application;
13782
13783   Actor actor = Actor::New();
13784   application.GetScene().Add(actor);
13785
13786   // Create the animation
13787   Animation animation = Animation::New(1.0f);
13788
13789   // AnimateBetween
13790   DALI_TEST_ASSERTION(
13791     {
13792       // non animateable property (ARRAY)
13793       Property::Index index     = actor.RegisterProperty("Foobar", Property::Value(Property::ARRAY), Property::ANIMATABLE);
13794       KeyFrames       keyframes = KeyFrames::New();
13795       keyframes.Add(0.5f, Property::Value(Property::ARRAY));
13796       animation.AnimateBetween(Property(actor, index), keyframes);
13797     },
13798     "Property type is not animatable");
13799
13800   DALI_TEST_ASSERTION(
13801     {
13802       // non animateable target (NONE)
13803       KeyFrames keyframes = KeyFrames::New();
13804       keyframes.Add(0.5f, Property::Value());
13805       animation.AnimateBetween(Property(actor, Actor::Property::CLIPPING_MODE), keyframes);
13806     },
13807     "Property type is not animatable");
13808
13809   DALI_TEST_ASSERTION(
13810     {
13811       // non animateable target (EXTENTS)
13812       KeyFrames keyframes = KeyFrames::New();
13813       keyframes.Add(0.5f, Property::Value(Property::EXTENTS)); // throws
13814       animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes);
13815     },
13816     "Property type is not animatable");
13817
13818   DALI_TEST_ASSERTION(
13819     {
13820       // non animateable target (RECTANGLE)
13821       KeyFrames keyframes = KeyFrames::New();
13822       keyframes.Add(0.5f, Property::Value(Property::MAP)); // throws
13823       animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes);
13824     },
13825     "Property type is not animatable");
13826
13827   DALI_TEST_ASSERTION(
13828     {
13829       // not mathing properties (VECTOR2, VECTOR4)
13830       KeyFrames keyframes = KeyFrames::New();
13831       keyframes.Add(0.5f, Property::Value(Vector4(1, 2, 3, 4)));
13832       animation.AnimateBetween(Property(actor, Actor::Property::MAXIMUM_SIZE), keyframes);
13833     },
13834     "Property and target types don't match");
13835
13836   DALI_TEST_ASSERTION(
13837     {
13838       // negative duration
13839       KeyFrames keyframes = KeyFrames::New();
13840       keyframes.Add(0.5f, Property::Value(Vector3(1, 2, 3)));
13841       animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, TimePeriod(-1));
13842     },
13843     "Duration must be >=0");
13844
13845   END_TEST;
13846 }
13847
13848 namespace // Purposefully left this in the middle as the values in this namespace are only used for the subsequent two test cases
13849 {
13850 enum TestFunction
13851 {
13852   STOP,
13853   CLEAR
13854 };
13855
13856 void CheckPropertyValuesWhenCallingAnimationMethod(TestFunction functionToTest, const char* testName)
13857 {
13858   tet_printf("Testing %s\n", testName);
13859
13860   // When an Animation::Stop() or Animation::Clear() is called, the event-side property needs to be updated appropriately
13861   // This test checks that that is being done
13862
13863   const float   durationSeconds(1.0f);
13864   unsigned int  halfAnimationDuration(static_cast<unsigned int>(durationSeconds * 1000.0f * 0.5f));
13865   const Vector3 originalPosition(Vector3::ZERO);
13866   const Vector3 targetPosition(10.0f, 10.0f, 10.0f);
13867   const Vector3 halfWayToTarget(targetPosition * 0.5f);
13868
13869   struct ExpectedValue
13870   {
13871     Animation::EndAction endAction;
13872     Vector3              expectedGetPropertyValue;
13873   };
13874
13875   ExpectedValue expectedValueTable[] =
13876     {
13877       {Animation::BAKE, halfWayToTarget},      // When baking, the current value is the final value.
13878       {Animation::BAKE_FINAL, targetPosition}, // When BakeFinal, we should jump to the final value when clearing or stopping.
13879       {Animation::DISCARD, originalPosition},  // When discarding, we should jump back to the original value when clearing or stopping.
13880     };
13881   const auto expectedValueTableCount = sizeof(expectedValueTable) / sizeof(ExpectedValue);
13882
13883   for(auto i = 0u; i < expectedValueTableCount; ++i)
13884   {
13885     TestApplication application;
13886
13887     Actor actor = Actor::New();
13888     application.GetScene().Add(actor);
13889
13890     // Build the animation
13891     Animation animation = Animation::New(durationSeconds);
13892     animation.SetEndAction(expectedValueTable[i].endAction);
13893     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13894
13895     // Start the animation
13896     animation.Play();
13897
13898     application.SendNotification();
13899     application.Render(halfAnimationDuration);
13900
13901     // Stop or Clear the animation early, both have the same effect
13902     if(functionToTest == TestFunction::STOP)
13903     {
13904       animation.Stop();
13905     }
13906     else
13907     {
13908       animation.Clear();
13909     }
13910
13911     // 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
13912     DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION);
13913     DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13914
13915     // After one frame, both values should match regardless of the End Action
13916     application.SendNotification();
13917     application.Render();
13918
13919     DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION);
13920     DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION);
13921   }
13922 }
13923 } // unnamed namespace
13924
13925 int UtcDaliAnimationStopPropertyValue(void)
13926 {
13927   CheckPropertyValuesWhenCallingAnimationMethod(TestFunction::STOP, "UtcDaliAnimationStopPropertyValue");
13928   END_TEST;
13929 }
13930
13931 int UtcDaliAnimationClearPropertyValue01(void)
13932 {
13933   CheckPropertyValuesWhenCallingAnimationMethod(TestFunction::CLEAR, "UtcDaliAnimationStopPropertyValue");
13934   END_TEST;
13935 }
13936
13937 int UtcDaliAnimationClearPropertyValue02(void)
13938 {
13939   TestApplication application;
13940
13941   Actor actor = Actor::New();
13942   application.GetScene().Add(actor);
13943
13944   const float   durationSeconds(1.0f);
13945   const Vector3 targetPosition1(10.0f, 10.0f, 10.0f);
13946   const Vector3 targetPosition2(20.0f, 20.0f, 20.0f);
13947
13948   // Build the animation
13949   Animation animation1 = Animation::New(durationSeconds);
13950   animation1.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition1, AlphaFunction::LINEAR);
13951   animation1.Play();
13952
13953   application.SendNotification();
13954   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
13955
13956   // The event side property should be set the current value immediately
13957   DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), targetPosition1, VECTOR3_EPSILON, TEST_LOCATION);
13958
13959   application.SendNotification();
13960   application.Render(2u /*just beyond the animation duration*/);
13961
13962   // Build a new animation
13963   Animation animation2 = Animation::New(durationSeconds);
13964   animation2.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition2, AlphaFunction::LINEAR);
13965   animation2.Play();
13966
13967   application.SendNotification();
13968   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
13969
13970   // The event side property should be set the current value immediately
13971   DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), targetPosition2, VECTOR3_EPSILON, TEST_LOCATION);
13972
13973   // Clear the first animation after finished
13974   animation1.Clear();
13975
13976   application.SendNotification();
13977   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
13978
13979   // The property should not be changed.
13980   DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), targetPosition2, VECTOR3_EPSILON, TEST_LOCATION);
13981
13982   END_TEST;
13983 }
13984
13985 int UtcDaliAnimationPausePropertyValue(void)
13986 {
13987   const float   durationSeconds(1.0f);
13988   unsigned int  halfAnimationDuration(static_cast<unsigned int>(durationSeconds * 1000.0f * 0.5f));
13989   const Vector3 targetPosition(10.0f, 10.0f, 10.0f);
13990   const Vector3 halfWayToTarget(targetPosition * 0.5f);
13991
13992   Animation::EndAction endActions[] =
13993     {
13994       Animation::BAKE,
13995       Animation::BAKE_FINAL,
13996       Animation::DISCARD,
13997     };
13998   const auto endActionCount = sizeof(endActions) / sizeof(endActions[0]);
13999
14000   // For all end actions, when pausing, we stay at the current value
14001   for(auto i = 0u; i < endActionCount; ++i)
14002   {
14003     TestApplication application;
14004
14005     Actor actor = Actor::New();
14006     application.GetScene().Add(actor);
14007
14008     // Build the animation
14009     Animation animation = Animation::New(durationSeconds);
14010     animation.SetEndAction(endActions[i]);
14011     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
14012
14013     // Start the animation
14014     animation.Play();
14015
14016     application.SendNotification();
14017     application.Render(halfAnimationDuration);
14018
14019     // Puase the animation early
14020     animation.Pause();
14021
14022     // The event side property should be set the current value immediately, the update side property will still only be halfway
14023     DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
14024     DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
14025
14026     // After one frame, both values should match regardless of the End Action
14027     application.SendNotification();
14028     application.Render();
14029
14030     DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
14031     DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
14032   }
14033
14034   END_TEST;
14035 }
14036
14037 int UtcDaliAnimationPlayFromWithLoopCount(void)
14038 {
14039   TestApplication application;
14040
14041   auto actor = Actor::New();
14042   application.GetScene().Add(actor);
14043
14044   auto animation = Animation::New(1.0f);
14045   animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f);
14046   animation.SetLoopCount(2);
14047   animation.Play();
14048
14049   application.SendNotification();
14050   application.Render(1001);
14051
14052   // One loop completed
14053
14054   application.Render(2005);
14055   application.SendNotification();
14056
14057   // 2 loops should have completed
14058   DALI_TEST_EQUALS(animation.GetCurrentLoop(), 2u, TEST_LOCATION);
14059
14060   // Another render needs to occur after all the loops end
14061   application.SendNotification();
14062   application.Render(1000);
14063
14064   // Stop the animation and use PlayFrom, previously we got an Assert here
14065   animation.Stop();
14066   animation.PlayFrom(0.5f);
14067
14068   application.SendNotification();
14069   application.Render(1000);
14070
14071   DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
14072
14073   END_TEST;
14074 }
14075
14076 int UtcDaliAnimationCombineToAndByWithStop(void)
14077 {
14078   tet_infoline("Ensure the Y Position is not modified when animating the X position using AnimateTo and AnimateBy");
14079
14080   TestApplication application;
14081
14082   auto actor = Actor::New();
14083   actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
14084   application.GetScene().Add(actor);
14085
14086   auto        animation = Animation::New(1.0f);
14087   const float origY     = actor.GetProperty(Actor::Property::POSITION_Y).Get<float>();
14088   animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(150.0f, origY, 0.0f), TimePeriod(1.0f));
14089   animation.AnimateBy(Property(actor, Actor::Property::POSITION), Vector3(-30.0f, 0.0f, 0.0f), TimePeriod(1.0f, 1.0f));
14090   animation.Play();
14091
14092   application.SendNotification();
14093   application.Render(500);
14094
14095   application.SendNotification();
14096   application.Render(500);
14097
14098   application.SendNotification();
14099   application.Render(500);
14100
14101   // Stop and clear the animation using the current values
14102   animation.Stop();
14103   animation.Clear();
14104
14105   // Check the y position, it should be the same as before
14106   DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Y).Get<float>(), origY, TEST_LOCATION);
14107
14108   END_TEST;
14109 }
14110
14111 int UtcDaliAnimationCountAndGetAnimationAt(void)
14112 {
14113   tet_infoline("UtcDaliAnimationCountAndGetAnimationAt");
14114
14115   TestApplication application;
14116
14117   auto actor = Actor::New();
14118   actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
14119   application.GetScene().Add(actor);
14120
14121   auto        animation = Animation::New(1.0f);
14122   const float origY     = actor.GetProperty(Actor::Property::POSITION_Y).Get<float>();
14123   animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(150.0f, origY, 0.0f), TimePeriod(1.0f));
14124   animation.Play();
14125
14126   application.SendNotification();
14127   application.Render(500);
14128
14129   uint32_t animationCount = Dali::DevelAnimation::GetAnimationCount();
14130   DALI_TEST_EQUALS(animationCount, 1, TEST_LOCATION);
14131
14132   DALI_TEST_CHECK(!Dali::DevelAnimation::GetAnimationAt(5));
14133
14134   Dali::Animation animationReturned = Dali::DevelAnimation::GetAnimationAt(0);
14135   DALI_TEST_EQUALS(animationReturned.GetState(), Dali::Animation::State::PLAYING, TEST_LOCATION);
14136
14137   DALI_TEST_EQUALS(animation.GetDuration(), animationReturned.GetDuration(), TEST_LOCATION);
14138   DALI_TEST_EQUALS(animation.GetLoopCount(), animationReturned.GetLoopCount(), TEST_LOCATION);
14139   DALI_TEST_EQUALS(animation.IsLooping(), animationReturned.IsLooping(), TEST_LOCATION);
14140   DALI_TEST_EQUALS(animation.GetEndAction(), animationReturned.GetEndAction(), TEST_LOCATION);
14141   DALI_TEST_EQUALS(animation.GetState(), animationReturned.GetState(), TEST_LOCATION);
14142
14143   // Stop and clear the animation using the current values
14144   animation.Stop();
14145   animation.Clear();
14146
14147   END_TEST;
14148 }
14149
14150 int UtcDaliAnimationSetLoopingNegative(void)
14151 {
14152   TestApplication application;
14153   Dali::Animation instance;
14154   try
14155   {
14156     bool arg1(false);
14157     instance.SetLooping(arg1);
14158     DALI_TEST_CHECK(false); // Should not get here
14159   }
14160   catch(...)
14161   {
14162     DALI_TEST_CHECK(true); // We expect an assert
14163   }
14164   END_TEST;
14165 }
14166
14167 int UtcDaliAnimationSetDurationNegative(void)
14168 {
14169   TestApplication application;
14170   Dali::Animation instance;
14171   try
14172   {
14173     float arg1(0.0f);
14174     instance.SetDuration(arg1);
14175     DALI_TEST_CHECK(false); // Should not get here
14176   }
14177   catch(...)
14178   {
14179     DALI_TEST_CHECK(true); // We expect an assert
14180   }
14181   END_TEST;
14182 }
14183
14184 int UtcDaliAnimationGetLoopCountNegative(void)
14185 {
14186   TestApplication application;
14187   Dali::Animation instance;
14188   try
14189   {
14190     instance.GetLoopCount();
14191     DALI_TEST_CHECK(false); // Should not get here
14192   }
14193   catch(...)
14194   {
14195     DALI_TEST_CHECK(true); // We expect an assert
14196   }
14197   END_TEST;
14198 }
14199
14200 int UtcDaliAnimationSetEndActionNegative(void)
14201 {
14202   TestApplication application;
14203   Dali::Animation instance;
14204   try
14205   {
14206     Dali::Animation::EndAction arg1(Animation::BAKE);
14207     instance.SetEndAction(arg1);
14208     DALI_TEST_CHECK(false); // Should not get here
14209   }
14210   catch(...)
14211   {
14212     DALI_TEST_CHECK(true); // We expect an assert
14213   }
14214   END_TEST;
14215 }
14216
14217 int UtcDaliAnimationSetLoopCountNegative(void)
14218 {
14219   TestApplication application;
14220   Dali::Animation instance;
14221   try
14222   {
14223     int arg1(0);
14224     instance.SetLoopCount(arg1);
14225     DALI_TEST_CHECK(false); // Should not get here
14226   }
14227   catch(...)
14228   {
14229     DALI_TEST_CHECK(true); // We expect an assert
14230   }
14231   END_TEST;
14232 }
14233
14234 int UtcDaliAnimationSetPlayRangeNegative(void)
14235 {
14236   TestApplication application;
14237   Dali::Animation instance;
14238   try
14239   {
14240     Dali::Vector2 arg1;
14241     instance.SetPlayRange(arg1);
14242     DALI_TEST_CHECK(false); // Should not get here
14243   }
14244   catch(...)
14245   {
14246     DALI_TEST_CHECK(true); // We expect an assert
14247   }
14248   END_TEST;
14249 }
14250
14251 int UtcDaliAnimationAnimateBetweenNegative01(void)
14252 {
14253   TestApplication application;
14254   Dali::Animation instance;
14255   Dali::Actor     actor;
14256   try
14257   {
14258     Dali::Property  arg1(actor, Actor::Property::POSITION);
14259     Dali::KeyFrames arg2;
14260     instance.AnimateBetween(arg1, arg2);
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 UtcDaliAnimationAnimateBetweenNegative02(void)
14271 {
14272   TestApplication application;
14273   Dali::Animation instance;
14274   Dali::Actor     actor;
14275   try
14276   {
14277     Dali::Property                 arg1(actor, Actor::Property::POSITION);
14278     Dali::KeyFrames                arg2;
14279     Dali::Animation::Interpolation arg3(Animation::LINEAR);
14280     instance.AnimateBetween(arg1, arg2, arg3);
14281     DALI_TEST_CHECK(false); // Should not get here
14282   }
14283   catch(...)
14284   {
14285     DALI_TEST_CHECK(true); // We expect an assert
14286   }
14287   END_TEST;
14288 }
14289
14290 int UtcDaliAnimationAnimateBetweenNegative03(void)
14291 {
14292   TestApplication application;
14293   Dali::Animation instance;
14294   Dali::Actor     actor;
14295   try
14296   {
14297     Dali::Property   arg1(actor, Actor::Property::POSITION);
14298     Dali::KeyFrames  arg2;
14299     Dali::TimePeriod arg3(1.0f);
14300     instance.AnimateBetween(arg1, arg2, arg3);
14301     DALI_TEST_CHECK(false); // Should not get here
14302   }
14303   catch(...)
14304   {
14305     DALI_TEST_CHECK(true); // We expect an assert
14306   }
14307   END_TEST;
14308 }
14309
14310 int UtcDaliAnimationAnimateBetweenNegative04(void)
14311 {
14312   TestApplication application;
14313   Dali::Animation instance;
14314   Dali::Actor     actor;
14315   try
14316   {
14317     Dali::Property                 arg1(actor, Actor::Property::POSITION);
14318     Dali::KeyFrames                arg2;
14319     Dali::TimePeriod               arg3(1.0f);
14320     Dali::Animation::Interpolation arg4(Animation::LINEAR);
14321     instance.AnimateBetween(arg1, arg2, arg3, arg4);
14322     DALI_TEST_CHECK(false); // Should not get here
14323   }
14324   catch(...)
14325   {
14326     DALI_TEST_CHECK(true); // We expect an assert
14327   }
14328   END_TEST;
14329 }
14330
14331 int UtcDaliAnimationAnimateBetweenNegative05(void)
14332 {
14333   TestApplication application;
14334   Dali::Animation instance;
14335   Dali::Actor     actor;
14336   try
14337   {
14338     Dali::Property      arg1(actor, Actor::Property::POSITION);
14339     Dali::KeyFrames     arg2;
14340     Dali::AlphaFunction arg3;
14341     instance.AnimateBetween(arg1, arg2, arg3);
14342     DALI_TEST_CHECK(false); // Should not get here
14343   }
14344   catch(...)
14345   {
14346     DALI_TEST_CHECK(true); // We expect an assert
14347   }
14348   END_TEST;
14349 }
14350
14351 int UtcDaliAnimationAnimateBetweenNegative06(void)
14352 {
14353   TestApplication application;
14354   Dali::Animation instance;
14355   Dali::Actor     actor;
14356   try
14357   {
14358     Dali::Property                 arg1(actor, Actor::Property::POSITION);
14359     Dali::KeyFrames                arg2;
14360     Dali::AlphaFunction            arg3;
14361     Dali::Animation::Interpolation arg4(Animation::LINEAR);
14362     instance.AnimateBetween(arg1, arg2, arg3, arg4);
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 UtcDaliAnimationAnimateBetweenNegative07(void)
14373 {
14374   TestApplication application;
14375   Dali::Animation instance;
14376   Dali::Actor     actor;
14377   try
14378   {
14379     Dali::Property      arg1(actor, Actor::Property::POSITION);
14380     Dali::KeyFrames     arg2;
14381     Dali::AlphaFunction arg3;
14382     Dali::TimePeriod    arg4(1.0f);
14383     instance.AnimateBetween(arg1, arg2, arg3, arg4);
14384     DALI_TEST_CHECK(false); // Should not get here
14385   }
14386   catch(...)
14387   {
14388     DALI_TEST_CHECK(true); // We expect an assert
14389   }
14390   END_TEST;
14391 }
14392
14393 int UtcDaliAnimationAnimateBetweenNegative08(void)
14394 {
14395   TestApplication application;
14396   Dali::Animation instance;
14397   Dali::Actor     actor;
14398   try
14399   {
14400     Dali::Property                 arg1(actor, Actor::Property::POSITION);
14401     Dali::KeyFrames                arg2;
14402     Dali::AlphaFunction            arg3;
14403     Dali::TimePeriod               arg4(1.0f);
14404     Dali::Animation::Interpolation arg5(Animation::LINEAR);
14405     instance.AnimateBetween(arg1, arg2, arg3, arg4, arg5);
14406     DALI_TEST_CHECK(false); // Should not get here
14407   }
14408   catch(...)
14409   {
14410     DALI_TEST_CHECK(true); // We expect an assert
14411   }
14412   END_TEST;
14413 }
14414
14415 int UtcDaliAnimationFinishedSignalNegative(void)
14416 {
14417   TestApplication application;
14418   Dali::Animation instance;
14419   try
14420   {
14421     instance.FinishedSignal();
14422     DALI_TEST_CHECK(false); // Should not get here
14423   }
14424   catch(...)
14425   {
14426     DALI_TEST_CHECK(true); // We expect an assert
14427   }
14428   END_TEST;
14429 }
14430
14431 int UtcDaliAnimationGetCurrentLoopNegative(void)
14432 {
14433   TestApplication application;
14434   Dali::Animation instance;
14435   try
14436   {
14437     instance.GetCurrentLoop();
14438     DALI_TEST_CHECK(false); // Should not get here
14439   }
14440   catch(...)
14441   {
14442     DALI_TEST_CHECK(true); // We expect an assert
14443   }
14444   END_TEST;
14445 }
14446
14447 int UtcDaliAnimationSetLoopingModeNegative(void)
14448 {
14449   TestApplication application;
14450   Dali::Animation instance;
14451   try
14452   {
14453     Dali::Animation::LoopingMode arg1(Animation::RESTART);
14454     instance.SetLoopingMode(arg1);
14455     DALI_TEST_CHECK(false); // Should not get here
14456   }
14457   catch(...)
14458   {
14459     DALI_TEST_CHECK(true); // We expect an assert
14460   }
14461   END_TEST;
14462 }
14463
14464 int UtcDaliAnimationSetSpeedFactorNegative(void)
14465 {
14466   TestApplication application;
14467   Dali::Animation instance;
14468   try
14469   {
14470     float arg1(0.0f);
14471     instance.SetSpeedFactor(arg1);
14472     DALI_TEST_CHECK(false); // Should not get here
14473   }
14474   catch(...)
14475   {
14476     DALI_TEST_CHECK(true); // We expect an assert
14477   }
14478   END_TEST;
14479 }
14480
14481 int UtcDaliAnimationGetCurrentProgressNegative(void)
14482 {
14483   TestApplication application;
14484   Dali::Animation instance;
14485   try
14486   {
14487     instance.GetCurrentProgress();
14488     DALI_TEST_CHECK(false); // Should not get here
14489   }
14490   catch(...)
14491   {
14492     DALI_TEST_CHECK(true); // We expect an assert
14493   }
14494   END_TEST;
14495 }
14496
14497 int UtcDaliAnimationSetCurrentProgressNegative(void)
14498 {
14499   TestApplication application;
14500   Dali::Animation instance;
14501   try
14502   {
14503     float arg1(0.0f);
14504     instance.SetCurrentProgress(arg1);
14505     DALI_TEST_CHECK(false); // Should not get here
14506   }
14507   catch(...)
14508   {
14509     DALI_TEST_CHECK(true); // We expect an assert
14510   }
14511   END_TEST;
14512 }
14513
14514 int UtcDaliAnimationSetDisconnectActionNegative(void)
14515 {
14516   TestApplication application;
14517   Dali::Animation instance;
14518   try
14519   {
14520     Dali::Animation::EndAction arg1(Animation::BAKE);
14521     instance.SetDisconnectAction(arg1);
14522     DALI_TEST_CHECK(false); // Should not get here
14523   }
14524   catch(...)
14525   {
14526     DALI_TEST_CHECK(true); // We expect an assert
14527   }
14528   END_TEST;
14529 }
14530
14531 int UtcDaliAnimationSetDefaultAlphaFunctionNegative(void)
14532 {
14533   TestApplication application;
14534   Dali::Animation instance;
14535   try
14536   {
14537     Dali::AlphaFunction arg1;
14538     instance.SetDefaultAlphaFunction(arg1);
14539     DALI_TEST_CHECK(false); // Should not get here
14540   }
14541   catch(...)
14542   {
14543     DALI_TEST_CHECK(true); // We expect an assert
14544   }
14545   END_TEST;
14546 }
14547
14548 int UtcDaliAnimationHideNegative(void)
14549 {
14550   TestApplication application;
14551   Dali::Animation instance;
14552   try
14553   {
14554     Dali::Actor arg1;
14555     float       arg2(0.0f);
14556     instance.Hide(arg1, arg2);
14557     DALI_TEST_CHECK(false); // Should not get here
14558   }
14559   catch(...)
14560   {
14561     DALI_TEST_CHECK(true); // We expect an assert
14562   }
14563   END_TEST;
14564 }
14565
14566 int UtcDaliAnimationPlayNegative(void)
14567 {
14568   TestApplication application;
14569   Dali::Animation instance;
14570   try
14571   {
14572     instance.Play();
14573     DALI_TEST_CHECK(false); // Should not get here
14574   }
14575   catch(...)
14576   {
14577     DALI_TEST_CHECK(true); // We expect an assert
14578   }
14579   END_TEST;
14580 }
14581
14582 int UtcDaliAnimationShowNegative(void)
14583 {
14584   TestApplication application;
14585   Dali::Animation instance;
14586   try
14587   {
14588     Dali::Actor arg1;
14589     float       arg2(0.0f);
14590     instance.Show(arg1, arg2);
14591     DALI_TEST_CHECK(false); // Should not get here
14592   }
14593   catch(...)
14594   {
14595     DALI_TEST_CHECK(true); // We expect an assert
14596   }
14597   END_TEST;
14598 }
14599
14600 int UtcDaliAnimationStopNegative(void)
14601 {
14602   TestApplication application;
14603   Dali::Animation instance;
14604   try
14605   {
14606     instance.Stop();
14607     DALI_TEST_CHECK(false); // Should not get here
14608   }
14609   catch(...)
14610   {
14611     DALI_TEST_CHECK(true); // We expect an assert
14612   }
14613   END_TEST;
14614 }
14615
14616 int UtcDaliAnimationClearNegative(void)
14617 {
14618   TestApplication application;
14619   Dali::Animation instance;
14620   try
14621   {
14622     instance.Clear();
14623     DALI_TEST_CHECK(false); // Should not get here
14624   }
14625   catch(...)
14626   {
14627     DALI_TEST_CHECK(true); // We expect an assert
14628   }
14629   END_TEST;
14630 }
14631
14632 int UtcDaliAnimationPauseNegative(void)
14633 {
14634   TestApplication application;
14635   Dali::Animation instance;
14636   try
14637   {
14638     instance.Pause();
14639     DALI_TEST_CHECK(false); // Should not get here
14640   }
14641   catch(...)
14642   {
14643     DALI_TEST_CHECK(true); // We expect an assert
14644   }
14645   END_TEST;
14646 }
14647
14648 int UtcDaliAnimationAnimateNegative01(void)
14649 {
14650   TestApplication application;
14651   Dali::Animation instance;
14652   try
14653   {
14654     Dali::Actor   arg1;
14655     Dali::Path    arg2;
14656     Dali::Vector3 arg3;
14657     instance.Animate(arg1, arg2, arg3);
14658     DALI_TEST_CHECK(false); // Should not get here
14659   }
14660   catch(...)
14661   {
14662     DALI_TEST_CHECK(true); // We expect an assert
14663   }
14664   END_TEST;
14665 }
14666
14667 int UtcDaliAnimationAnimateNegative02(void)
14668 {
14669   TestApplication application;
14670   Dali::Animation instance;
14671   try
14672   {
14673     Dali::Actor      arg1;
14674     Dali::Path       arg2;
14675     Dali::Vector3    arg3;
14676     Dali::TimePeriod arg4(1.0f);
14677     instance.Animate(arg1, arg2, arg3, arg4);
14678     DALI_TEST_CHECK(false); // Should not get here
14679   }
14680   catch(...)
14681   {
14682     DALI_TEST_CHECK(true); // We expect an assert
14683   }
14684   END_TEST;
14685 }
14686
14687 int UtcDaliAnimationAnimateNegative03(void)
14688 {
14689   TestApplication application;
14690   Dali::Animation instance;
14691   try
14692   {
14693     Dali::Actor         arg1;
14694     Dali::Path          arg2;
14695     Dali::Vector3       arg3;
14696     Dali::AlphaFunction arg4;
14697     instance.Animate(arg1, arg2, arg3, arg4);
14698     DALI_TEST_CHECK(false); // Should not get here
14699   }
14700   catch(...)
14701   {
14702     DALI_TEST_CHECK(true); // We expect an assert
14703   }
14704   END_TEST;
14705 }
14706
14707 int UtcDaliAnimationAnimateNegative04(void)
14708 {
14709   TestApplication application;
14710   Dali::Animation instance;
14711   try
14712   {
14713     Dali::Actor         arg1;
14714     Dali::Path          arg2;
14715     Dali::Vector3       arg3;
14716     Dali::AlphaFunction arg4;
14717     Dali::TimePeriod    arg5(1.0f);
14718     instance.Animate(arg1, arg2, arg3, arg4, arg5);
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 UtcDaliAnimationPlayFromNegative(void)
14729 {
14730   TestApplication application;
14731   Dali::Animation instance;
14732   try
14733   {
14734     float arg1(0.0f);
14735     instance.PlayFrom(arg1);
14736     DALI_TEST_CHECK(false); // Should not get here
14737   }
14738   catch(...)
14739   {
14740     DALI_TEST_CHECK(true); // We expect an assert
14741   }
14742   END_TEST;
14743 }
14744
14745 int UtcDaliAnimationAnimateByNegative01(void)
14746 {
14747   TestApplication application;
14748   Dali::Animation instance;
14749   Dali::Actor     actor;
14750   try
14751   {
14752     Dali::Property        arg1(actor, Actor::Property::POSITION);
14753     Dali::Property::Value arg2;
14754     instance.AnimateBy(arg1, arg2);
14755     DALI_TEST_CHECK(false); // Should not get here
14756   }
14757   catch(...)
14758   {
14759     DALI_TEST_CHECK(true); // We expect an assert
14760   }
14761   END_TEST;
14762 }
14763
14764 int UtcDaliAnimationAnimateByNegative02(void)
14765 {
14766   TestApplication application;
14767   Dali::Animation instance;
14768   Dali::Actor     actor;
14769   try
14770   {
14771     Dali::Property        arg1(actor, Actor::Property::POSITION);
14772     Dali::Property::Value arg2;
14773     Dali::TimePeriod      arg3(1.0f);
14774     instance.AnimateBy(arg1, arg2, arg3);
14775     DALI_TEST_CHECK(false); // Should not get here
14776   }
14777   catch(...)
14778   {
14779     DALI_TEST_CHECK(true); // We expect an assert
14780   }
14781   END_TEST;
14782 }
14783
14784 int UtcDaliAnimationAnimateByNegative03(void)
14785 {
14786   TestApplication application;
14787   Dali::Animation instance;
14788   Dali::Actor     actor;
14789   try
14790   {
14791     Dali::Property        arg1(actor, Actor::Property::POSITION);
14792     Dali::Property::Value arg2;
14793     Dali::AlphaFunction   arg3;
14794     instance.AnimateBy(arg1, arg2, arg3);
14795     DALI_TEST_CHECK(false); // Should not get here
14796   }
14797   catch(...)
14798   {
14799     DALI_TEST_CHECK(true); // We expect an assert
14800   }
14801   END_TEST;
14802 }
14803
14804 int UtcDaliAnimationAnimateByNegative04(void)
14805 {
14806   TestApplication application;
14807   Dali::Animation instance;
14808   Dali::Actor     actor;
14809   try
14810   {
14811     Dali::Property        arg1(actor, Actor::Property::POSITION);
14812     Dali::Property::Value arg2;
14813     Dali::AlphaFunction   arg3;
14814     Dali::TimePeriod      arg4(1.0f);
14815     instance.AnimateBy(arg1, arg2, arg3, arg4);
14816     DALI_TEST_CHECK(false); // Should not get here
14817   }
14818   catch(...)
14819   {
14820     DALI_TEST_CHECK(true); // We expect an assert
14821   }
14822   END_TEST;
14823 }
14824
14825 int UtcDaliAnimationAnimateToNegative01(void)
14826 {
14827   TestApplication application;
14828   Dali::Actor     actor;
14829   Dali::Animation instance;
14830   try
14831   {
14832     Dali::Property        arg1(actor, Actor::Property::POSITION);
14833     Dali::Property::Value arg2;
14834     instance.AnimateTo(arg1, arg2);
14835     DALI_TEST_CHECK(false); // Should not get here
14836   }
14837   catch(...)
14838   {
14839     DALI_TEST_CHECK(true); // We expect an assert
14840   }
14841   END_TEST;
14842 }
14843
14844 int UtcDaliAnimationAnimateToNegative02(void)
14845 {
14846   TestApplication application;
14847   Dali::Animation instance;
14848   Dali::Actor     actor;
14849   try
14850   {
14851     Dali::Property        arg1(actor, Actor::Property::POSITION);
14852     Dali::Property::Value arg2;
14853     Dali::TimePeriod      arg3(1.0f);
14854     instance.AnimateTo(arg1, arg2, arg3);
14855     DALI_TEST_CHECK(false); // Should not get here
14856   }
14857   catch(...)
14858   {
14859     DALI_TEST_CHECK(true); // We expect an assert
14860   }
14861   END_TEST;
14862 }
14863
14864 int UtcDaliAnimationAnimateToNegative03(void)
14865 {
14866   TestApplication application;
14867   Dali::Animation instance;
14868   Dali::Actor     actor;
14869   try
14870   {
14871     Dali::Property        arg1(actor, Actor::Property::POSITION);
14872     Dali::Property::Value arg2;
14873     Dali::AlphaFunction   arg3;
14874     instance.AnimateTo(arg1, arg2, arg3);
14875     DALI_TEST_CHECK(false); // Should not get here
14876   }
14877   catch(...)
14878   {
14879     DALI_TEST_CHECK(true); // We expect an assert
14880   }
14881   END_TEST;
14882 }
14883
14884 int UtcDaliAnimationAnimateToNegative04(void)
14885 {
14886   TestApplication application;
14887   Dali::Animation instance;
14888   Dali::Actor     actor;
14889   try
14890   {
14891     Dali::Property        arg1(actor, Actor::Property::POSITION);
14892     Dali::Property::Value arg2;
14893     Dali::AlphaFunction   arg3;
14894     Dali::TimePeriod      arg4(1.0f);
14895     instance.AnimateTo(arg1, arg2, arg3, arg4);
14896     DALI_TEST_CHECK(false); // Should not get here
14897   }
14898   catch(...)
14899   {
14900     DALI_TEST_CHECK(true); // We expect an assert
14901   }
14902   END_TEST;
14903 }
14904
14905 int UtcDaliAnimationPlayAfterNegative(void)
14906 {
14907   TestApplication application;
14908   Dali::Animation instance;
14909   try
14910   {
14911     float arg1(0.0f);
14912     instance.PlayAfter(arg1);
14913     DALI_TEST_CHECK(false); // Should not get here
14914   }
14915   catch(...)
14916   {
14917     DALI_TEST_CHECK(true); // We expect an assert
14918   }
14919   END_TEST;
14920 }
14921
14922 int UtcDaliAnimationGetDurationNegative(void)
14923 {
14924   TestApplication application;
14925   Dali::Animation instance;
14926   try
14927   {
14928     instance.GetDuration();
14929     DALI_TEST_CHECK(false); // Should not get here
14930   }
14931   catch(...)
14932   {
14933     DALI_TEST_CHECK(true); // We expect an assert
14934   }
14935   END_TEST;
14936 }
14937
14938 int UtcDaliAnimationGetEndActionNegative(void)
14939 {
14940   TestApplication application;
14941   Dali::Animation instance;
14942   try
14943   {
14944     instance.GetEndAction();
14945     DALI_TEST_CHECK(false); // Should not get here
14946   }
14947   catch(...)
14948   {
14949     DALI_TEST_CHECK(true); // We expect an assert
14950   }
14951   END_TEST;
14952 }
14953
14954 int UtcDaliAnimationGetPlayRangeNegative(void)
14955 {
14956   TestApplication application;
14957   Dali::Animation instance;
14958   try
14959   {
14960     instance.GetPlayRange();
14961     DALI_TEST_CHECK(false); // Should not get here
14962   }
14963   catch(...)
14964   {
14965     DALI_TEST_CHECK(true); // We expect an assert
14966   }
14967   END_TEST;
14968 }
14969
14970 int UtcDaliAnimationGetLoopingModeNegative(void)
14971 {
14972   TestApplication application;
14973   Dali::Animation instance;
14974   try
14975   {
14976     instance.GetLoopingMode();
14977     DALI_TEST_CHECK(false); // Should not get here
14978   }
14979   catch(...)
14980   {
14981     DALI_TEST_CHECK(true); // We expect an assert
14982   }
14983   END_TEST;
14984 }
14985
14986 int UtcDaliAnimationGetSpeedFactorNegative(void)
14987 {
14988   TestApplication application;
14989   Dali::Animation instance;
14990   try
14991   {
14992     instance.GetSpeedFactor();
14993     DALI_TEST_CHECK(false); // Should not get here
14994   }
14995   catch(...)
14996   {
14997     DALI_TEST_CHECK(true); // We expect an assert
14998   }
14999   END_TEST;
15000 }
15001
15002 int UtcDaliAnimationGetDisconnectActionNegative(void)
15003 {
15004   TestApplication application;
15005   Dali::Animation instance;
15006   try
15007   {
15008     instance.GetDisconnectAction();
15009     DALI_TEST_CHECK(false); // Should not get here
15010   }
15011   catch(...)
15012   {
15013     DALI_TEST_CHECK(true); // We expect an assert
15014   }
15015   END_TEST;
15016 }
15017
15018 int UtcDaliAnimationGetDefaultAlphaFunctionNegative(void)
15019 {
15020   TestApplication application;
15021   Dali::Animation instance;
15022   try
15023   {
15024     instance.GetDefaultAlphaFunction();
15025     DALI_TEST_CHECK(false); // Should not get here
15026   }
15027   catch(...)
15028   {
15029     DALI_TEST_CHECK(true); // We expect an assert
15030   }
15031   END_TEST;
15032 }
15033
15034 int UtcDaliAnimationGetStateNegative(void)
15035 {
15036   TestApplication application;
15037   Dali::Animation instance;
15038   try
15039   {
15040     instance.GetState();
15041     DALI_TEST_CHECK(false); // Should not get here
15042   }
15043   catch(...)
15044   {
15045     DALI_TEST_CHECK(true); // We expect an assert
15046   }
15047   END_TEST;
15048 }
15049
15050 int UtcDaliAnimationIsLoopingNegative(void)
15051 {
15052   TestApplication application;
15053   Dali::Animation instance;
15054   try
15055   {
15056     instance.IsLooping();
15057     DALI_TEST_CHECK(false); // Should not get here
15058   }
15059   catch(...)
15060   {
15061     DALI_TEST_CHECK(true); // We expect an assert
15062   }
15063   END_TEST;
15064 }
15065
15066 int UtcDaliKeyFramesAddNegative01(void)
15067 {
15068   TestApplication application;
15069   Dali::KeyFrames instance;
15070   try
15071   {
15072     float                 arg1(0.0f);
15073     Dali::Property::Value arg2;
15074     instance.Add(arg1, arg2);
15075     DALI_TEST_CHECK(false); // Should not get here
15076   }
15077   catch(...)
15078   {
15079     DALI_TEST_CHECK(true); // We expect an assert
15080   }
15081   END_TEST;
15082 }
15083
15084 int UtcDaliKeyFramesAddNegative02(void)
15085 {
15086   TestApplication application;
15087   Dali::KeyFrames instance;
15088   try
15089   {
15090     float                 arg1(0.0f);
15091     Dali::Property::Value arg2;
15092     Dali::AlphaFunction   arg3;
15093     instance.Add(arg1, arg2, arg3);
15094     DALI_TEST_CHECK(false); // Should not get here
15095   }
15096   catch(...)
15097   {
15098     DALI_TEST_CHECK(true); // We expect an assert
15099   }
15100   END_TEST;
15101 }
15102
15103 int UtcDaliKeyFramesGetTypeNegative(void)
15104 {
15105   TestApplication application;
15106   Dali::KeyFrames instance;
15107   try
15108   {
15109     instance.GetType();
15110     DALI_TEST_CHECK(false); // Should not get here
15111   }
15112   catch(...)
15113   {
15114     DALI_TEST_CHECK(true); // We expect an assert
15115   }
15116   END_TEST;
15117 }
15118
15119 int UtcDaliAnimationSetGetBlendPoint(void)
15120 {
15121   TestApplication application;
15122
15123   Animation animation = Animation::New(1.0f);
15124   DALI_TEST_EQUALS(animation.GetBlendPoint(), 0.0f, 0.01f, TEST_LOCATION);
15125
15126   animation.SetBlendPoint(0.5f);
15127
15128   DALI_TEST_EQUALS(animation.GetBlendPoint(), 0.5f, 0.01f, TEST_LOCATION);
15129
15130   animation.SetBlendPoint(-0.5f);
15131
15132   DALI_TEST_EQUALS(animation.GetBlendPoint(), 0.5f, 0.01f, TEST_LOCATION);
15133
15134   animation.SetBlendPoint(1.5f);
15135
15136   DALI_TEST_EQUALS(animation.GetBlendPoint(), 0.5f, 0.01f, TEST_LOCATION);
15137
15138   animation.SetBlendPoint(0.7f);
15139
15140   DALI_TEST_EQUALS(animation.GetBlendPoint(), 0.7f, 0.01f, TEST_LOCATION);
15141
15142   END_TEST;
15143 }
15144
15145 int UtcDaliAnimationPlayBlendFloatCubic(void)
15146 {
15147   TestApplication application;
15148
15149   Actor actor = Actor::New();
15150   application.GetScene().Add(actor);
15151   Property::Index index = actor.RegisterProperty("property", 0.0f);
15152
15153   Animation animation = Animation::New(1.0f);
15154   KeyFrames keyframes = KeyFrames::New();
15155   keyframes.Add(0.0f, 3.0f);
15156   keyframes.Add(0.4f, 1.0f);
15157   keyframes.Add(0.6f, 1.0f);
15158   keyframes.Add(1.0f, 3.0f);
15159   animation.AnimateBetween(Property(actor, index), keyframes, AlphaFunction::LINEAR, Animation::Interpolation::CUBIC);
15160
15161   application.SendNotification();
15162   application.Render(20);
15163
15164   animation.SetBlendPoint(0.5f);
15165   animation.Play();
15166
15167   application.SendNotification();
15168   application.Render(250);
15169
15170   float value = actor.GetCurrentProperty<float>(index);
15171   DALI_TEST_EQUALS(value, 0.989258f, 0.05f, TEST_LOCATION); // original value : 1.603516 (Same value as when progress is 0.75.)
15172                                                             // current value : 0.0f
15173                                                             // value when progress is 0.5 : 0.75
15174
15175   application.SendNotification();
15176   application.Render(250);
15177
15178   value = actor.GetCurrentProperty<float>(index);
15179   DALI_TEST_EQUALS(value, 0.750000f, 0.05f, TEST_LOCATION); // value is less than 1.0f
15180
15181   application.SendNotification();
15182   application.Render(250);
15183
15184   value = actor.GetCurrentProperty<float>(index);
15185   DALI_TEST_EQUALS(value, 1.603516f, 0.05f, TEST_LOCATION);
15186
15187   application.SendNotification();
15188   application.Render(250);
15189
15190   value = actor.GetCurrentProperty<float>(index);
15191   DALI_TEST_EQUALS(value, 3.0f, 0.05f, TEST_LOCATION);
15192
15193   END_TEST;
15194 }
15195
15196 int UtcDaliAnimationPlayBlendFloat1(void)
15197 {
15198   TestApplication application;
15199
15200   Actor actor = Actor::New();
15201   application.GetScene().Add(actor);
15202   Property::Index index = actor.RegisterProperty("property", 0.0f);
15203
15204   Animation animation = Animation::New(1.0f);
15205   KeyFrames keyframes = KeyFrames::New();
15206   keyframes.Add(0.0f, 1.0f);
15207   keyframes.Add(0.2f, 2.0f);
15208   keyframes.Add(0.4f, 3.0f);
15209   keyframes.Add(0.6f, 4.0f);
15210   keyframes.Add(0.8f, 5.0f);
15211   keyframes.Add(1.0f, 6.0f);
15212   animation.AnimateBetween(Property(actor, index), keyframes, AlphaFunction::LINEAR);
15213
15214   application.SendNotification();
15215   application.Render(20);
15216
15217   animation.SetBlendPoint(0.9f);
15218   animation.Play();
15219
15220   application.SendNotification();
15221   application.Render(250);
15222
15223   float value = actor.GetCurrentProperty<float>(index);
15224   DALI_TEST_EQUALS(value, 1.728395f, 0.05f, TEST_LOCATION);
15225
15226   application.SendNotification();
15227   application.Render(250);
15228
15229   value = actor.GetCurrentProperty<float>(index);
15230   DALI_TEST_EQUALS(value, 3.302469f, 0.05f, TEST_LOCATION);
15231
15232   application.SendNotification();
15233   application.Render(250);
15234
15235   value = actor.GetCurrentProperty<float>(index);
15236   DALI_TEST_EQUALS(value, 4.722222f, 0.05f, TEST_LOCATION);
15237
15238   application.SendNotification();
15239   application.Render(250);
15240
15241   value = actor.GetCurrentProperty<float>(index);
15242   DALI_TEST_EQUALS(value, 6.0f, 0.05f, TEST_LOCATION);
15243
15244   END_TEST;
15245 }
15246
15247 int UtcDaliAnimationPlayBlendFloat2(void)
15248 {
15249   TestApplication application;
15250
15251   Actor actor = Actor::New();
15252   application.GetScene().Add(actor);
15253   Property::Index index = actor.RegisterProperty("property", 0.0f);
15254
15255   Animation animation = Animation::New(1.0f);
15256   KeyFrames keyframes = KeyFrames::New();
15257   keyframes.Add(0.0f, 0.0f);
15258   keyframes.Add(1.0f, 1.0f);
15259   animation.AnimateBetween(Property(actor, index), keyframes, AlphaFunction::LINEAR);
15260
15261   application.SendNotification();
15262   application.Render(20);
15263
15264   animation.SetBlendPoint(0.5f);
15265   animation.Play();
15266
15267   application.SendNotification();
15268   application.Render(250);
15269
15270   float value = actor.GetCurrentProperty<float>(index);
15271   DALI_TEST_EQUALS(value, 0.25f, 0.05f, TEST_LOCATION);
15272
15273   application.SendNotification();
15274   application.Render(250);
15275
15276   value = actor.GetCurrentProperty<float>(index);
15277   DALI_TEST_EQUALS(value, 0.5f, 0.05f, TEST_LOCATION);
15278
15279   END_TEST;
15280 }
15281
15282 int UtcDaliAnimationPlayBlendFloat3(void)
15283 {
15284   TestApplication application;
15285
15286   Actor actor = Actor::New();
15287   application.GetScene().Add(actor);
15288   Property::Index index = actor.RegisterProperty("property", 0.0f);
15289
15290   Animation animation = Animation::New(1.0f);
15291   KeyFrames keyframes = KeyFrames::New();
15292   keyframes.Add(0.0f, 1.0f);
15293   keyframes.Add(1.0f, 2.0f);
15294   animation.AnimateBetween(Property(actor, index), keyframes, AlphaFunction::LINEAR);
15295
15296   application.SendNotification();
15297   application.Render(20);
15298
15299   animation.SetBlendPoint(0.5f);
15300   animation.Play();
15301
15302   application.SendNotification();
15303   application.Render(250);
15304
15305   float value = actor.GetCurrentProperty<float>(index);
15306   DALI_TEST_EQUALS(value, 1.0f, 0.05f, TEST_LOCATION);
15307
15308   application.SendNotification();
15309   application.Render(250);
15310
15311   value = actor.GetCurrentProperty<float>(index);
15312   DALI_TEST_EQUALS(value, 1.5f, 0.05f, TEST_LOCATION);
15313
15314   END_TEST;
15315 }
15316
15317 int UtcDaliAnimationPlayBlendFloat4(void)
15318 {
15319   TestApplication application;
15320
15321   Actor actor = Actor::New();
15322   application.GetScene().Add(actor);
15323   Property::Index index = actor.RegisterProperty("property", 0.0f);
15324
15325   Animation animation = Animation::New(1.0f);
15326   KeyFrames keyframes = KeyFrames::New();
15327   keyframes.Add(0.0f, 1.0f);
15328   keyframes.Add(1.0f, 2.0f);
15329   animation.AnimateBetween(Property(actor, index), keyframes, AlphaFunction::LINEAR);
15330
15331   application.SendNotification();
15332   application.Render(20);
15333
15334   animation.SetBlendPoint(0.5f);
15335   animation.Play();
15336
15337   application.SendNotification();
15338   application.Render(250);
15339
15340   float value = actor.GetCurrentProperty<float>(index);
15341   DALI_TEST_EQUALS(value, 1.0f, 0.05f, TEST_LOCATION);
15342
15343   application.SendNotification();
15344   application.Render(250);
15345
15346   value = actor.GetCurrentProperty<float>(index);
15347   DALI_TEST_EQUALS(value, 1.5f, 0.05f, TEST_LOCATION);
15348
15349   application.SendNotification();
15350   application.Render(550);
15351
15352   actor.SetProperty(index, 0.0f);
15353   animation.Play();
15354
15355   application.SendNotification();
15356   application.Render(250);
15357
15358   value = actor.GetCurrentProperty<float>(index);
15359   DALI_TEST_EQUALS(value, 1.0f, 0.05f, TEST_LOCATION);
15360
15361   application.SendNotification();
15362   application.Render(250);
15363
15364   value = actor.GetCurrentProperty<float>(index);
15365   DALI_TEST_EQUALS(value, 1.5f, 0.05f, TEST_LOCATION);
15366
15367   END_TEST;
15368 }
15369
15370 int UtcDaliAnimationPlayBlendInt(void)
15371 {
15372   TestApplication application;
15373
15374   Actor actor = Actor::New();
15375   application.GetScene().Add(actor);
15376   Property::Index index = actor.RegisterProperty("property", 0);
15377
15378   Animation animation = Animation::New(1.0f);
15379   KeyFrames keyframes = KeyFrames::New();
15380   keyframes.Add(0.0f, 100);
15381   keyframes.Add(1.0f, 200);
15382   animation.AnimateBetween(Property(actor, index), keyframes, AlphaFunction::LINEAR);
15383
15384   application.SendNotification();
15385   application.Render(20);
15386
15387   animation.SetBlendPoint(0.5f);
15388   animation.Play();
15389
15390   application.SendNotification();
15391   application.Render(250);
15392
15393   int32_t value = actor.GetCurrentProperty<int32_t>(index);
15394   DALI_TEST_EQUALS(value, 100, TEST_LOCATION);
15395
15396   application.SendNotification();
15397   application.Render(250);
15398
15399   value = actor.GetCurrentProperty<int32_t>(index);
15400   DALI_TEST_EQUALS(value, 150, TEST_LOCATION);
15401
15402   END_TEST;
15403 }
15404
15405 int UtcDaliAnimationPlayBlendVector2(void)
15406 {
15407   TestApplication application;
15408
15409   Actor actor = Actor::New();
15410   application.GetScene().Add(actor);
15411   Property::Index index = actor.RegisterProperty("property", Vector2::ZERO);
15412
15413   Animation animation = Animation::New(1.0f);
15414   KeyFrames keyframes = KeyFrames::New();
15415   keyframes.Add(0.0f, Vector2::ONE);
15416   keyframes.Add(1.0f, Vector2::ONE * 2.0f);
15417   animation.AnimateBetween(Property(actor, index), keyframes, AlphaFunction::LINEAR);
15418
15419   application.SendNotification();
15420   application.Render(20);
15421
15422   animation.SetBlendPoint(0.5f);
15423   animation.Play();
15424
15425   application.SendNotification();
15426   application.Render(250);
15427
15428   Vector2 value = actor.GetCurrentProperty<Vector2>(index);
15429   DALI_TEST_EQUALS(value, Vector2::ONE, 0.05f, TEST_LOCATION);
15430
15431   application.SendNotification();
15432   application.Render(250);
15433
15434   value = actor.GetCurrentProperty<Vector2>(index);
15435   DALI_TEST_EQUALS(value, Vector2::ONE * 1.5f, 0.05f, TEST_LOCATION);
15436
15437   END_TEST;
15438 }
15439
15440 int UtcDaliAnimationPlayBlendVector3(void)
15441 {
15442   TestApplication application;
15443
15444   Actor actor = Actor::New();
15445   application.GetScene().Add(actor);
15446   Property::Index index = actor.RegisterProperty("property", Vector3::ZERO);
15447
15448   Animation animation = Animation::New(1.0f);
15449   KeyFrames keyframes = KeyFrames::New();
15450   keyframes.Add(0.0f, Vector3::ONE);
15451   keyframes.Add(1.0f, Vector3::ONE * 2.0f);
15452   animation.AnimateBetween(Property(actor, index), keyframes, AlphaFunction::LINEAR);
15453
15454   application.SendNotification();
15455   application.Render(20);
15456
15457   animation.SetBlendPoint(0.5f);
15458   animation.Play();
15459
15460   application.SendNotification();
15461   application.Render(250);
15462
15463   Vector3 value = actor.GetCurrentProperty<Vector3>(index);
15464   DALI_TEST_EQUALS(value, Vector3::ONE, 0.05f, TEST_LOCATION);
15465
15466   application.SendNotification();
15467   application.Render(250);
15468
15469   value = actor.GetCurrentProperty<Vector3>(index);
15470   DALI_TEST_EQUALS(value, Vector3::ONE * 1.5f, 0.05f, TEST_LOCATION);
15471
15472   END_TEST;
15473 }
15474
15475 int UtcDaliAnimationPlayBlendVector4(void)
15476 {
15477   TestApplication application;
15478
15479   Actor actor = Actor::New();
15480   application.GetScene().Add(actor);
15481   Property::Index index = actor.RegisterProperty("property", Vector4::ZERO);
15482
15483   Animation animation = Animation::New(1.0f);
15484   KeyFrames keyframes = KeyFrames::New();
15485   keyframes.Add(0.0f, Vector4::ONE);
15486   keyframes.Add(1.0f, Vector4::ONE * 2.0f);
15487   animation.AnimateBetween(Property(actor, index), keyframes, AlphaFunction::LINEAR);
15488
15489   application.SendNotification();
15490   application.Render(20);
15491
15492   animation.SetBlendPoint(0.5f);
15493   animation.Play();
15494
15495   application.SendNotification();
15496   application.Render(250);
15497
15498   Vector4 value = actor.GetCurrentProperty<Vector4>(index);
15499   DALI_TEST_EQUALS(value, Vector4::ONE, 0.05f, TEST_LOCATION);
15500
15501   application.SendNotification();
15502   application.Render(250);
15503
15504   value = actor.GetCurrentProperty<Vector4>(index);
15505   DALI_TEST_EQUALS(value, Vector4::ONE * 1.5f, 0.05f, TEST_LOCATION);
15506
15507   END_TEST;
15508 }
15509
15510 int UtcDaliAnimationPlayBlendQuaternion(void)
15511 {
15512   TestApplication application;
15513
15514   Actor actor = Actor::New();
15515   application.GetScene().Add(actor);
15516   Property::Index index = actor.RegisterProperty("property", Quaternion(Dali::Radian(0.0f), Vector3::ZAXIS));
15517
15518   Animation animation = Animation::New(1.0f);
15519   KeyFrames keyframes = KeyFrames::New();
15520   keyframes.Add(0.0f, Quaternion(Dali::Radian(1.0f), Vector3::ZAXIS));
15521   keyframes.Add(1.0f, Quaternion(Dali::Radian(2.0f), Vector3::ZAXIS));
15522   animation.AnimateBetween(Property(actor, index), keyframes, AlphaFunction::LINEAR);
15523
15524   application.SendNotification();
15525   application.Render(20);
15526
15527   animation.SetBlendPoint(0.5f);
15528   animation.Play();
15529
15530   application.SendNotification();
15531   application.Render(250);
15532
15533   Quaternion   value = actor.GetCurrentProperty<Quaternion>(index);
15534   Vector3      axis;
15535   Dali::Radian angle;
15536   DALI_TEST_EQUALS(value.ToAxisAngle(axis, angle), true, TEST_LOCATION);
15537   DALI_TEST_EQUALS(angle.radian, 1.0f, 0.05f, TEST_LOCATION);
15538
15539   application.SendNotification();
15540   application.Render(250);
15541
15542   value = actor.GetCurrentProperty<Quaternion>(index);
15543   DALI_TEST_EQUALS(value.ToAxisAngle(axis, angle), true, TEST_LOCATION);
15544   DALI_TEST_EQUALS(angle.radian, 1.5f, 0.05f, TEST_LOCATION);
15545
15546   END_TEST;
15547 }