fec88e84024a4e82f31f7051861fe3b371899768
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-Animation.cpp
1 /*
2  * Copyright (c) 2014 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 <iostream>
19 #include <algorithm>
20
21 #include <stdlib.h>
22 #include <dali/public-api/dali-core.h>
23 #include <dali-test-suite-utils.h>
24
25 using std::max;
26 using namespace Dali;
27
28 void utc_dali_animation_startuP(void)
29 {
30   test_return_value = TET_UNDEF;
31 }
32
33 void utc_dali_animation_cleanuP(void)
34 {
35   test_return_value = TET_PASS;
36 }
37
38 namespace
39 {
40
41 static const float ROTATION_EPSILON = 0.0001f;
42 static const float VECTOR4_EPSILON = 0.0001f;
43
44 // Functor to test whether a Finish signal is emitted
45 struct AnimationFinishCheck
46 {
47   AnimationFinishCheck(bool& signalReceived)
48   : mSignalReceived(signalReceived)
49   {
50   }
51
52   void operator()(Animation& animation)
53   {
54     mSignalReceived = true;
55   }
56
57   void Reset()
58   {
59     mSignalReceived = false;
60   }
61
62   void CheckSignalReceived()
63   {
64     if (!mSignalReceived)
65     {
66       tet_printf("Expected Finish signal was not received\n");
67       tet_result(TET_FAIL);
68     }
69     else
70     {
71       tet_result(TET_PASS);
72     }
73   }
74
75   void CheckSignalNotReceived()
76   {
77     if (mSignalReceived)
78     {
79       tet_printf("Unexpected Finish signal was received\n");
80       tet_result(TET_FAIL);
81     }
82     else
83     {
84       tet_result(TET_PASS);
85     }
86   }
87
88   bool& mSignalReceived; // owned by individual tests
89 };
90
91 } // anon namespace
92
93 int UtcDaliAnimationConstructorP(void)
94 {
95   TestApplication application;
96
97   Animation animation;
98
99   DALI_TEST_CHECK( !animation );
100   END_TEST;
101 }
102
103 int UtcDaliAnimationNewP(void)
104 {
105   TestApplication application;
106
107   Animation animation = Animation::New( 1.0f );
108
109   DALI_TEST_CHECK(animation);
110   END_TEST;
111 }
112
113 int UtcDaliAnimationNewN(void)
114 {
115   TestApplication application;
116
117   Animation animation = Animation::New( -1.0f );
118
119   DALI_TEST_CHECK(animation);
120   DALI_TEST_EQUALS(animation.GetDuration(), 0.0f, TEST_LOCATION);
121   END_TEST;
122 }
123
124 int UtcDaliAnimationDownCastP(void)
125 {
126   TestApplication application;
127
128   tet_infoline("Testing Dali::Animation::DownCast()");
129
130   float durationSeconds(1.0f);
131   Animation animation = Animation::New(durationSeconds);
132
133   BaseHandle object(animation);
134
135   Animation animation2 = Animation::DownCast(object);
136   DALI_TEST_CHECK(animation2);
137
138   Animation animation3 = DownCast< Animation >(object);
139   DALI_TEST_CHECK(animation3);
140   END_TEST;
141 }
142
143 int UtcDaliAnimationDownCastN(void)
144 {
145   TestApplication application;
146
147   BaseHandle unInitializedObject;
148
149   Animation animation1 = Animation::DownCast( unInitializedObject );
150   DALI_TEST_CHECK( !animation1 );
151
152   Animation animation2 = DownCast< Animation >( unInitializedObject );
153   DALI_TEST_CHECK( !animation2 );
154   END_TEST;
155 }
156
157 int UtcDaliAnimationCopyConstructorP(void)
158 {
159   TestApplication application;
160
161   // Initialize an object, ref count == 1
162   Animation animation = Animation::New( 1.0f );
163
164   Animation copy( animation );
165   DALI_TEST_CHECK( copy );
166
167   DALI_TEST_CHECK( copy.GetDuration() == animation.GetDuration() );
168   END_TEST;
169 }
170
171 int UtcDaliAnimationAssignmentOperatorP(void)
172 {
173   TestApplication application;
174
175   Animation animation = Animation::New( 1.0f );
176
177   Animation copy = animation;
178   DALI_TEST_CHECK( copy );
179
180   DALI_TEST_CHECK( animation == copy );
181
182   DALI_TEST_CHECK( copy.GetDuration() == animation.GetDuration() );
183   END_TEST;
184 }
185
186 int UtcDaliAnimationSetDurationP(void)
187 {
188   TestApplication application;
189
190   Actor actor = Actor::New();
191   Stage::GetCurrent().Add(actor);
192
193   // Build the animation
194   float durationSeconds(1.0f);
195   Animation animation = Animation::New(durationSeconds);
196   DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
197
198   // Start the animation
199   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
200   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
201   animation.Play();
202
203   bool signalReceived(false);
204   AnimationFinishCheck finishCheck(signalReceived);
205   animation.FinishedSignal().Connect(&application, finishCheck);
206
207   application.SendNotification();
208   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
209
210   // We didn't expect the animation to finish yet
211   application.SendNotification();
212   finishCheck.CheckSignalNotReceived();
213
214   application.Render(2u/*just beyond the animation duration*/);
215
216   // We did expect the animation to finish
217   application.SendNotification();
218   finishCheck.CheckSignalReceived();
219   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
220
221   // Restart the animation, with a different duration
222   finishCheck.Reset();
223   actor.SetPosition(Vector3::ZERO);
224   durationSeconds = 3.5f;
225   animation.SetDuration(durationSeconds);
226   DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
227   animation.Play();
228
229   application.SendNotification();
230   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
231
232   // We didn't expect the animation to finish yet
233   application.SendNotification();
234   finishCheck.CheckSignalNotReceived();
235
236   application.Render(2u/*just beyond the animation duration*/);
237
238   // We did expect the animation to finish
239   application.SendNotification();
240   finishCheck.CheckSignalReceived();
241   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
242
243   // Check that nothing has changed after a couple of buffer swaps
244   application.Render(0);
245   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
246   application.Render(0);
247   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
248   END_TEST;
249 }
250
251 int UtcDaliAnimationSetDurationN(void)
252 {
253   TestApplication application;
254
255   Animation animation = Animation::New( 1.0f );
256   DALI_TEST_EQUALS( animation.GetDuration(), 1.0f, TEST_LOCATION );
257
258   animation.SetDuration( -1.0f );
259   DALI_TEST_EQUALS( animation.GetDuration(), 0.0f, TEST_LOCATION );
260   END_TEST;
261 }
262
263 int UtcDaliAnimationGetDurationP(void)
264 {
265   TestApplication application;
266
267   Animation animation = Animation::New(1.0f);
268   DALI_TEST_EQUALS(animation.GetDuration(), 1.0f, TEST_LOCATION);
269
270   animation.SetDuration(2.0f);
271   DALI_TEST_EQUALS(animation.GetDuration(), 2.0f, TEST_LOCATION);
272   END_TEST;
273 }
274
275 int UtcDaliAnimationSetLoopingP(void)
276 {
277   TestApplication application;
278
279   Actor actor = Actor::New();
280   Stage::GetCurrent().Add(actor);
281
282   // Build the animation
283   float durationSeconds(1.0f);
284   Animation animation = Animation::New(durationSeconds);
285   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
286   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
287
288   // Start the animation
289   animation.SetLooping(true);
290   DALI_TEST_CHECK(animation.IsLooping());
291   animation.Play();
292
293   bool signalReceived(false);
294   AnimationFinishCheck finishCheck(signalReceived);
295   animation.FinishedSignal().Connect(&application, finishCheck);
296
297   application.SendNotification();
298
299   // Loop 5 times
300   float intervalSeconds = 0.25f;
301   float progress = 0.0f;
302   for (int iterations = 0; iterations < 5;)
303   {
304     application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
305
306     progress += intervalSeconds;
307     DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
308
309     if (progress >= 1.0f)
310     {
311       progress = progress - 1.0f;
312       ++iterations;
313     }
314   }
315
316   // We didn't expect the animation to finish yet
317   application.SendNotification();
318   finishCheck.CheckSignalNotReceived();
319
320   animation.SetLooping(false);
321   DALI_TEST_CHECK(!animation.IsLooping());
322
323   application.SendNotification();
324   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
325
326   // We did expect the animation to finish
327   application.SendNotification();
328   finishCheck.CheckSignalReceived();
329   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
330
331   // Check that nothing has changed after a couple of buffer swaps
332   application.Render(0);
333   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
334   application.Render(0);
335   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
336   END_TEST;
337 }
338
339 int UtcDaliAnimationSetLoopCountP(void)
340 {
341   TestApplication application;
342
343   Actor actor = Actor::New();
344   Stage::GetCurrent().Add(actor);
345
346   // Build the animation
347   float durationSeconds(1.0f);
348   Animation animation = Animation::New(durationSeconds);
349   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
350   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
351
352   // Start the animation
353   animation.SetLoopCount(3);
354   DALI_TEST_CHECK(animation.IsLooping());
355   animation.Play();
356
357   bool signalReceived(false);
358   AnimationFinishCheck finishCheck(signalReceived);
359   animation.FinishedSignal().Connect(&application, finishCheck);
360
361   application.Render(0);
362   application.SendNotification();
363   application.Render(0);
364   application.SendNotification();
365   application.Render(0);
366   application.SendNotification();
367   application.Render(0);
368   application.SendNotification();
369
370   // Loop
371   float intervalSeconds = 3.0f;
372
373   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
374   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
375
376   application.Render(0);
377   application.SendNotification();
378   application.Render(0);
379   application.SendNotification();
380   application.Render(0);
381   application.SendNotification();
382   application.Render(0);
383   application.SendNotification();
384   finishCheck.CheckSignalNotReceived();
385
386   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
387
388   application.SendNotification();
389   finishCheck.CheckSignalReceived();
390   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
391
392   finishCheck.Reset();
393
394   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
395   application.SendNotification();
396   finishCheck.CheckSignalNotReceived();
397
398   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
399   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
400   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
401   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
402   application.SendNotification();
403   finishCheck.CheckSignalNotReceived();
404
405   END_TEST;
406 }
407
408 int UtcDaliAnimationSetLoopCountP2(void)
409 {
410   TestApplication application;
411
412   //
413   // switching between forever and loop count
414   //
415
416   Actor actor = Actor::New();
417   Stage::GetCurrent().Add(actor);
418
419   // Build the animation
420   float durationSeconds(1.0f);
421   Animation animation = Animation::New(durationSeconds);
422   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
423   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
424   animation.SetEndAction(Animation::Discard);
425
426   // Start the animation
427   animation.SetLoopCount(3);
428   DALI_TEST_CHECK(animation.IsLooping());
429   animation.Play();
430
431   bool signalReceived(false);
432   AnimationFinishCheck finishCheck(signalReceived);
433   animation.FinishedSignal().Connect(&application, finishCheck);
434
435   float intervalSeconds = 3.0f;
436
437   application.SendNotification();
438   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
439   application.SendNotification();
440   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
441   application.SendNotification();
442   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
443   application.SendNotification();
444
445   application.SendNotification();
446   finishCheck.CheckSignalReceived();
447
448   finishCheck.Reset();
449
450   // Loop forever
451   animation.SetLooping(true);
452   DALI_TEST_CHECK(animation.IsLooping());
453
454   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
455   application.SendNotification();
456   finishCheck.CheckSignalNotReceived();
457
458   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
459   application.SendNotification();
460   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
461   application.SendNotification();
462   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
463   application.SendNotification();
464   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
465   application.SendNotification();
466   application.SendNotification();
467   finishCheck.CheckSignalNotReceived();
468
469   finishCheck.Reset();
470
471   // Loop N again
472   animation.SetLoopCount(3);
473   DALI_TEST_CHECK(animation.IsLooping());
474   animation.Play();
475
476   application.SendNotification();
477   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
478   application.SendNotification();
479   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
480   application.SendNotification();
481   finishCheck.CheckSignalNotReceived();
482
483   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
484   application.SendNotification();
485   finishCheck.CheckSignalReceived();
486
487   finishCheck.Reset();
488
489   // loop forever
490   animation.SetLooping(true);
491   DALI_TEST_CHECK(animation.IsLooping());
492
493   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
494   application.SendNotification();
495   finishCheck.CheckSignalNotReceived();
496
497   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
498   application.SendNotification();
499   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
500   application.SendNotification();
501   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
502   application.SendNotification();
503   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
504   application.SendNotification();
505   finishCheck.CheckSignalNotReceived();
506
507   finishCheck.Reset();
508
509   // Loop N again
510   animation.SetLoopCount(3);
511   DALI_TEST_CHECK(animation.IsLooping());
512
513   application.SendNotification();
514   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
515   application.SendNotification();
516   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
517   application.SendNotification();
518   finishCheck.CheckSignalNotReceived();
519
520   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
521   application.SendNotification();
522   finishCheck.CheckSignalNotReceived(); // we never hit play
523
524   finishCheck.Reset();
525
526
527   END_TEST;
528 }
529
530 int UtcDaliAnimationSetLoopCountP3(void)
531 {
532   TestApplication application;
533
534   //
535   // switching between forever and loop count
536   //
537   Actor actor = Actor::New();
538   Stage::GetCurrent().Add(actor);
539
540   // Build the animation
541   float durationSeconds(1.0f);
542   Animation animation = Animation::New(durationSeconds);
543   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
544   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
545   animation.SetEndAction(Animation::Discard);
546
547   float intervalSeconds = 3.0f;
548
549   bool signalReceived(false);
550   AnimationFinishCheck finishCheck(signalReceived);
551   animation.FinishedSignal().Connect(&application, finishCheck);
552
553   // loop forever
554   animation.SetLooping(true);
555   DALI_TEST_CHECK(animation.IsLooping());
556
557   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
558   application.SendNotification();
559   finishCheck.CheckSignalNotReceived();
560
561   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
562   application.SendNotification();
563   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
564   application.SendNotification();
565   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
566   application.SendNotification();
567   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
568   application.SendNotification();
569   finishCheck.CheckSignalNotReceived();
570
571   finishCheck.Reset();
572
573   // Loop N again
574   animation.SetLoopCount(3);
575   DALI_TEST_CHECK(animation.IsLooping());
576
577   application.SendNotification();
578   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
579   application.SendNotification();
580   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
581   application.SendNotification();
582   finishCheck.CheckSignalNotReceived();
583
584   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
585   application.SendNotification();
586   finishCheck.CheckSignalNotReceived(); // we never hit play
587
588   finishCheck.Reset();
589
590
591   END_TEST;
592 }
593
594 int UtcDaliAnimationSetLoopCountP4(void)
595 {
596   TestApplication application;
597
598   //
599   // ..and play again
600   //
601   Actor actor = Actor::New();
602   Stage::GetCurrent().Add(actor);
603
604   // Build the animation
605   float durationSeconds(1.0f);
606   Animation animation = Animation::New(durationSeconds);
607   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
608   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
609   animation.SetEndAction(Animation::Bake);
610
611   float intervalSeconds = 3.0f;
612
613   bool signalReceived(false);
614   AnimationFinishCheck finishCheck(signalReceived);
615   animation.FinishedSignal().Connect(&application, finishCheck);
616
617   animation.SetLoopCount(1);
618   animation.Play();
619   DALI_TEST_CHECK(!animation.IsLooping());
620
621   application.SendNotification();
622   finishCheck.CheckSignalNotReceived();
623   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
624   application.SendNotification();
625   finishCheck.CheckSignalReceived();
626
627   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
628   actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f) );
629
630   finishCheck.Reset();
631
632   animation.Play(); // again
633   DALI_TEST_CHECK(!animation.IsLooping());
634
635   application.SendNotification();
636   finishCheck.CheckSignalNotReceived();
637   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
638   application.SendNotification();
639   finishCheck.CheckSignalReceived();
640
641   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
642
643   END_TEST;
644 }
645
646 int UtcDaliAnimationGetLoopCountP(void)
647 {
648   TestApplication application;
649
650   Actor actor = Actor::New();
651   Stage::GetCurrent().Add(actor);
652
653   // Build the animation
654   float durationSeconds(1.0f);
655   Animation animation = Animation::New(durationSeconds);
656   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
657   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
658
659   DALI_TEST_CHECK(1 == animation.GetLoopCount());
660
661   // Start the animation
662   animation.SetLoopCount(3);
663   DALI_TEST_CHECK(animation.IsLooping());
664   DALI_TEST_CHECK(3 == animation.GetLoopCount());
665
666   animation.Play();
667
668   application.Render(0);
669   application.SendNotification();
670
671   // Loop
672   float intervalSeconds = 3.0f;
673
674   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
675   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
676
677   application.Render(0);
678   application.SendNotification();
679
680   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
681   application.SendNotification();
682
683   animation.SetLoopCount(0);
684   DALI_TEST_CHECK(animation.IsLooping());
685   DALI_TEST_CHECK(0 == animation.GetLoopCount());
686
687   animation.SetLoopCount(1);
688   DALI_TEST_CHECK(!animation.IsLooping());
689   DALI_TEST_CHECK(1 == animation.GetLoopCount());
690
691   END_TEST;
692 }
693
694
695 int UtcDaliAnimationGetCurrentLoopP(void)
696 {
697   TestApplication application;
698
699   Actor actor = Actor::New();
700   Stage::GetCurrent().Add(actor);
701
702   // Build the animation
703   float durationSeconds(1.0f);
704   Animation animation = Animation::New(durationSeconds);
705   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
706   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
707
708   // Start the animation
709   animation.SetLoopCount(3);
710   DALI_TEST_CHECK(animation.IsLooping());
711   DALI_TEST_CHECK(0 == animation.GetCurrentLoop());
712   animation.Play();
713
714   bool signalReceived(false);
715   AnimationFinishCheck finishCheck(signalReceived);
716   animation.FinishedSignal().Connect(&application, finishCheck);
717
718   application.SendNotification();
719
720   // Loop
721   float intervalSeconds = 3.0f;
722
723   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
724   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
725
726   application.SendNotification();
727   finishCheck.CheckSignalNotReceived();
728   DALI_TEST_CHECK(2 == animation.GetCurrentLoop());
729
730   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
731
732   application.SendNotification();
733   finishCheck.CheckSignalReceived();
734   DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
735   DALI_TEST_CHECK(animation.GetLoopCount() == animation.GetCurrentLoop());
736
737   finishCheck.Reset();
738
739   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
740   application.SendNotification();
741   finishCheck.CheckSignalNotReceived();
742   DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
743
744   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
745   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
746   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
747   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
748   application.SendNotification();
749   finishCheck.CheckSignalNotReceived();
750   DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
751
752   END_TEST;
753 }
754
755 int UtcDaliAnimationIsLoopingP(void)
756 {
757   TestApplication application;
758
759   Animation animation = Animation::New(1.0f);
760   DALI_TEST_CHECK(!animation.IsLooping());
761
762   animation.SetLooping(true);
763   DALI_TEST_CHECK(animation.IsLooping());
764   END_TEST;
765 }
766
767 int UtcDaliAnimationSetEndActioN(void)
768 {
769   TestApplication application;
770
771   Actor actor = Actor::New();
772   Stage::GetCurrent().Add(actor);
773
774   // Build the animation
775   float durationSeconds(1.0f);
776   Animation animation = Animation::New(durationSeconds);
777   DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
778
779   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
780   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
781
782   // Start the animation
783   animation.Play();
784
785   bool signalReceived(false);
786   AnimationFinishCheck finishCheck(signalReceived);
787   animation.FinishedSignal().Connect(&application, finishCheck);
788
789   application.SendNotification();
790   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
791
792   // We did expect the animation to finish
793   application.SendNotification();
794   finishCheck.CheckSignalReceived();
795   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
796
797   // Go back to the start
798   actor.SetPosition(Vector3::ZERO);
799   application.SendNotification();
800   application.Render(0);
801   DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
802
803   // Test BakeFinal, animate again, for half the duration
804   finishCheck.Reset();
805   animation.SetEndAction(Animation::BakeFinal);
806   DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
807   animation.Play();
808
809   application.SendNotification();
810   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f*0.5f) /*half of the animation duration*/);
811
812   // Stop the animation early
813   animation.Stop();
814
815   // We did NOT expect the animation to finish
816   application.SendNotification();
817   finishCheck.CheckSignalNotReceived();
818   DALI_TEST_EQUALS( targetPosition * 0.5f, actor.GetCurrentPosition(), VECTOR4_EPSILON, TEST_LOCATION );
819
820   // The position should be same with target position in the next frame
821   application.Render(0);
822   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
823
824   // Go back to the start
825   actor.SetPosition(Vector3::ZERO);
826   application.SendNotification();
827   application.Render(0);
828   DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
829
830   // Test EndAction::Discard, animate again, but don't bake this time
831   finishCheck.Reset();
832   animation.SetEndAction(Animation::Discard);
833   DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
834   animation.Play();
835
836   application.SendNotification();
837   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
838
839   // We did expect the animation to finish
840   application.SendNotification();
841   finishCheck.CheckSignalReceived();
842   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
843
844   // The position should be discarded in the next frame
845   application.Render(0);
846   DALI_TEST_EQUALS( Vector3::ZERO/*discarded*/, actor.GetCurrentPosition(), TEST_LOCATION );
847
848   // Check that nothing has changed after a couple of buffer swaps
849   application.Render(0);
850   DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
851   application.Render(0);
852   DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
853   END_TEST;
854 }
855
856 int UtcDaliAnimationGetEndActionP(void)
857 {
858   TestApplication application;
859
860   Animation animation = Animation::New(1.0f);
861   DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
862
863   animation.SetEndAction(Animation::Discard);
864   DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
865
866   animation.SetEndAction(Animation::BakeFinal);
867   DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
868
869   END_TEST;
870 }
871
872 int UtcDaliAnimationSetDisconnectActionP(void)
873 {
874   TestApplication application;
875   Stage stage( Stage::GetCurrent() );
876
877   // Default: BakeFinal
878   {
879     Actor actor = Actor::New();
880     stage.Add(actor);
881
882     // Build the animation
883     float durationSeconds(1.0f);
884     Animation animation = Animation::New(durationSeconds);
885     DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal);
886
887     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
888     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
889
890     // Start the animation
891     animation.Play();
892
893     application.SendNotification();
894     application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
895
896     actor.Unparent();
897
898     application.SendNotification();
899     application.Render();
900
901     DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
902   }
903
904   // Bake
905   {
906     Actor actor = Actor::New();
907     stage.Add(actor);
908
909     // Build the animation
910     float durationSeconds(1.0f);
911     Animation animation = Animation::New(durationSeconds);
912     animation.SetDisconnectAction( Animation::Bake );
913
914     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
915     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
916
917     // Start the animation
918     animation.Play();
919
920     application.SendNotification();
921     application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
922
923     actor.Unparent();
924
925     application.SendNotification();
926     application.Render();
927
928     DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition*0.5f, TEST_LOCATION );
929   }
930
931   // Discard
932   {
933     Actor actor = Actor::New();
934     stage.Add(actor);
935
936     // Build the animation
937     float durationSeconds(1.0f);
938     Animation animation = Animation::New(durationSeconds);
939     animation.SetDisconnectAction( Animation::Discard );
940
941     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
942     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
943
944     // Start the animation
945     animation.Play();
946
947     application.SendNotification();
948     application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
949
950     actor.Unparent();
951
952     application.SendNotification();
953     application.Render();
954
955     DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
956   }
957
958   // Don't play the animation: disconnect action should not be applied
959   {
960     Actor actor = Actor::New();
961     stage.Add(actor);
962
963     // Build the animation
964     float durationSeconds(1.0f);
965     Animation animation = Animation::New(durationSeconds);
966
967     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
968     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
969
970     application.SendNotification();
971     application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
972
973     actor.Unparent();
974
975     application.SendNotification();
976     application.Render();
977
978     DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
979   }
980
981   END_TEST;
982 }
983
984 int UtcDaliAnimationGetDisconnectActionP(void)
985 {
986   TestApplication application;
987   Animation animation = Animation::New(1.0f);
988   DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal); // default!
989
990   animation.SetDisconnectAction(Animation::Discard);
991   DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Discard);
992
993   animation.SetDisconnectAction(Animation::Bake);
994   DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Bake);
995
996   END_TEST;
997 }
998
999 int UtcDaliAnimationSetDefaultAlphaFunctionP(void)
1000 {
1001   TestApplication application;
1002
1003   Animation animation = Animation::New(1.0f);
1004   AlphaFunction func = animation.GetDefaultAlphaFunction();
1005   DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1006
1007   animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1008   AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1009   DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1010   END_TEST;
1011 }
1012
1013 int UtcDaliAnimationGetDefaultAlphaFunctionP(void)
1014 {
1015   TestApplication application;
1016
1017   Animation animation = Animation::New(1.0f);
1018   AlphaFunction func = animation.GetDefaultAlphaFunction();
1019
1020   // Test that the default is linear
1021   DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1022
1023   animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1024   AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1025   DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1026
1027   END_TEST;
1028 }
1029
1030 int UtcDaliAnimationSetCurrentProgressP(void)
1031 {
1032   TestApplication application;
1033
1034   Actor actor = Actor::New();
1035   Stage::GetCurrent().Add(actor);
1036
1037   // Build the animation
1038   Animation animation = Animation::New(0.0f);
1039
1040   //Set duration
1041   float durationSeconds(1.0f);
1042   animation.SetDuration(durationSeconds);
1043
1044   bool signalReceived(false);
1045   AnimationFinishCheck finishCheck(signalReceived);
1046   animation.FinishedSignal().Connect(&application, finishCheck);
1047   application.SendNotification();
1048
1049   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1050   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1051
1052   // Start the animation from 40% progress
1053   animation.SetCurrentProgress( 0.4f );
1054   animation.Play();
1055
1056   application.SendNotification();
1057   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1058
1059   // We didn't expect the animation to finish yet
1060   application.SendNotification();
1061   finishCheck.CheckSignalNotReceived();
1062   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1063   DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
1064
1065   animation.Play(); // Test that calling play has no effect, when animation is already playing
1066   application.SendNotification();
1067
1068   //Set the progress to 70%
1069   animation.SetCurrentProgress( 0.7f );
1070   application.SendNotification();
1071   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 80% progress */);
1072   DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1073
1074   application.SendNotification();
1075   finishCheck.CheckSignalNotReceived();
1076   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1077   DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1078
1079   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1080   // We did expect the animation to finish
1081   application.SendNotification();
1082   finishCheck.CheckSignalReceived();
1083   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1084
1085   // Check that nothing has changed after a couple of buffer swaps
1086   application.Render(0);
1087   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1088   application.Render(0);
1089   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1090   END_TEST;
1091 }
1092
1093 int UtcDaliAnimationSetCurrentProgressN(void)
1094 {
1095   TestApplication application;
1096
1097   Actor actor = Actor::New();
1098   Stage::GetCurrent().Add(actor);
1099
1100   // Build the animation
1101   Animation animation = Animation::New(0.0f);
1102
1103   //Set duration
1104   float durationSeconds(1.0f);
1105   animation.SetDuration(durationSeconds);
1106
1107   bool signalReceived(false);
1108   AnimationFinishCheck finishCheck(signalReceived);
1109   animation.FinishedSignal().Connect(&application, finishCheck);
1110   application.SendNotification();
1111
1112   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1113   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1114
1115   //Trying to set the current cursor outside the range [0..1] is ignored
1116   animation.SetCurrentProgress( -1.0f);
1117   application.SendNotification();
1118   DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1119
1120   animation.SetCurrentProgress( 100.0f);
1121   application.SendNotification();
1122   DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1123   END_TEST;
1124 }
1125
1126 int UtcDaliAnimationGetCurrentProgressP(void)
1127 {
1128   TestApplication application;
1129
1130   Actor actor = Actor::New();
1131   Stage::GetCurrent().Add(actor);
1132
1133   // Build the animation
1134   Animation animation = Animation::New(0.0f);
1135   animation.Play();
1136
1137   //Test GetCurrentProgress return 0.0 as the duration is 0.0
1138   DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1139
1140   animation.SetCurrentProgress( 0.5f );
1141   application.SendNotification();
1142   application.Render(static_cast<unsigned int>(100.0f));
1143
1144   //Progress should still be 0.0
1145   DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1146
1147   //Set duration
1148   float durationSeconds(1.0f);
1149   animation.SetDuration(durationSeconds);
1150   application.SendNotification();
1151
1152   bool signalReceived(false);
1153   AnimationFinishCheck finishCheck(signalReceived);
1154   animation.FinishedSignal().Connect(&application, finishCheck);
1155   application.SendNotification();
1156
1157   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1158   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1159
1160   // Start the animation from 40% progress
1161   animation.SetCurrentProgress( 0.4f );
1162   animation.Play();
1163
1164   application.SendNotification();
1165   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1166
1167   // We didn't expect the animation to finish yet
1168   application.SendNotification();
1169   finishCheck.CheckSignalNotReceived();
1170   DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
1171
1172   animation.Play(); // Test that calling play has no effect, when animation is already playing
1173   application.SendNotification();
1174
1175   //Set the progress to 70%
1176   animation.SetCurrentProgress( 0.7f );
1177   application.SendNotification();
1178   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 80% progress */);
1179   DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1180
1181   application.SendNotification();
1182   finishCheck.CheckSignalNotReceived();
1183   DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1184
1185   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1186   // We did expect the animation to finish
1187   application.SendNotification();
1188   finishCheck.CheckSignalReceived();
1189   END_TEST;
1190 }
1191
1192 int UtcDaliAnimationSetSpeedFactorP(void)
1193 {
1194   TestApplication application;
1195
1196   Actor actor = Actor::New();
1197   Stage::GetCurrent().Add(actor);
1198
1199   // Build the animation
1200   float durationSeconds(1.0f);
1201   Animation animation = Animation::New(durationSeconds);
1202
1203   const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1204   const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1205
1206   KeyFrames keyframes = KeyFrames::New();
1207   keyframes.Add( 0.0f, initialPosition);
1208   keyframes.Add( 1.0f, targetPosition );
1209   animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1210
1211   //Set speed to be x2
1212   animation.SetSpeedFactor(2.0f);
1213
1214   // Start the animation
1215   animation.Play();
1216
1217   bool signalReceived(false);
1218   AnimationFinishCheck finishCheck(signalReceived);
1219   animation.FinishedSignal().Connect(&application, finishCheck);
1220
1221   application.SendNotification();
1222   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1223
1224   // We didn't expect the animation to finish yet
1225   application.SendNotification();
1226   finishCheck.CheckSignalNotReceived();
1227   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1228
1229   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1230
1231   // We didn't expect the animation to finish yet
1232   application.SendNotification();
1233   finishCheck.CheckSignalNotReceived();
1234   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1235
1236   application.Render(static_cast<unsigned int>(durationSeconds*100.0f) + 1u/*just beyond half the duration*/);
1237
1238   // We did expect the animation to finish
1239   application.SendNotification();
1240   finishCheck.CheckSignalReceived();
1241   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1242
1243   // Check that nothing has changed after a couple of buffer swaps
1244   application.Render(0);
1245   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1246   application.Render(0);
1247   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1248
1249   finishCheck.Reset();
1250
1251   //Test -1 speed factor. Animation will play in reverse at normal speed
1252   animation.SetSpeedFactor( -1.0f );
1253
1254   // Start the animation
1255   animation.Play();
1256
1257   application.SendNotification();
1258   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1259
1260   // We didn't expect the animation to finish yet
1261   application.SendNotification();
1262   finishCheck.CheckSignalNotReceived();
1263   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1264
1265   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1266
1267   // We didn't expect the animation to finish yet
1268   application.SendNotification();
1269   finishCheck.CheckSignalNotReceived();
1270   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1271
1272   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1273
1274   // We didn't expect the animation to finish yet
1275   application.SendNotification();
1276   finishCheck.CheckSignalNotReceived();
1277   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1278
1279   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1280
1281   // We didn't expect the animation to finish yet
1282   application.SendNotification();
1283   finishCheck.CheckSignalNotReceived();
1284   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1285
1286   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1287
1288   // We did expect the animation to finish
1289   application.SendNotification();
1290   finishCheck.CheckSignalReceived();
1291   DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
1292
1293   // Check that nothing has changed after a couple of buffer swaps
1294   application.Render(0);
1295   DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1296   application.Render(0);
1297   DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1298
1299   //Test change speed factor on the fly
1300   finishCheck.Reset();
1301
1302   //Set speed to be half of normal speed
1303   animation.SetSpeedFactor( 0.5f );
1304
1305   // Start the animation
1306   animation.Play();
1307
1308   application.SendNotification();
1309   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1310
1311   // We didn't expect the animation to finish yet
1312   application.SendNotification();
1313   finishCheck.CheckSignalNotReceived();
1314   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), TEST_LOCATION );
1315
1316   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1317
1318   // We didn't expect the animation to finish yet
1319   application.SendNotification();
1320   finishCheck.CheckSignalNotReceived();
1321   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1322
1323   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
1324
1325   // We didn't expect the animation to finish yet
1326   application.SendNotification();
1327   finishCheck.CheckSignalNotReceived();
1328   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.3f), TEST_LOCATION );
1329
1330   //Change speed factor while animation still playing.
1331   animation.SetSpeedFactor(-1.0f);
1332   application.SendNotification();
1333   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1334
1335   // We didn't expect the animation to finish yet
1336   application.SendNotification();
1337   finishCheck.CheckSignalNotReceived();
1338   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), TEST_LOCATION );
1339
1340   application.Render(static_cast<unsigned int>(durationSeconds*100.0f) + 1u/*just beyond the animation duration*/);
1341
1342   // We did expect the animation to finish
1343   application.SendNotification();
1344   finishCheck.CheckSignalReceived();
1345   DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
1346
1347   // Check that nothing has changed after a couple of buffer swaps
1348   application.Render(0);
1349   DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1350   application.Render(0);
1351   DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1352   END_TEST;
1353 }
1354
1355 int UtcDaliAnimationGetSpeedFactorP(void)
1356 {
1357   TestApplication application;
1358
1359   Animation animation = Animation::New(1.0f);
1360   animation.SetSpeedFactor(0.5f);
1361   DALI_TEST_EQUALS(animation.GetSpeedFactor(), 0.5f, TEST_LOCATION);
1362
1363   animation.SetSpeedFactor(-2.5f);
1364   DALI_TEST_EQUALS(animation.GetSpeedFactor(), -2.5f, TEST_LOCATION);
1365   END_TEST;
1366 }
1367
1368 int UtcDaliAnimationSetPlayRangeP(void)
1369 {
1370   TestApplication application;
1371
1372   Actor actor = Actor::New();
1373   Stage::GetCurrent().Add( actor );
1374
1375   // Build the animation
1376   float durationSeconds( 1.0f );
1377   Animation animation = Animation::New( durationSeconds );
1378
1379   bool signalReceived( false );
1380   AnimationFinishCheck finishCheck( signalReceived );
1381   animation.FinishedSignal().Connect( &application, finishCheck );
1382   application.SendNotification();
1383
1384   // Set range between 0.4 and 0.8
1385   animation.SetPlayRange( Vector2( 0.4f, 0.9f ) );
1386   application.SendNotification();
1387   DALI_TEST_EQUALS( Vector2( 0.4f, 0.9f ), animation.GetPlayRange(), TEST_LOCATION );
1388
1389   Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
1390   animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR );
1391
1392   // Start the animation from 40% progress
1393   animation.Play();
1394
1395   application.SendNotification();
1396   application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 60% progress */ );
1397
1398   // We didn't expect the animation to finish yet
1399   application.SendNotification();
1400   finishCheck.CheckSignalNotReceived();
1401   DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.6f ), TEST_LOCATION );
1402
1403   application.SendNotification();
1404   application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 80% progress */ );
1405
1406   application.SendNotification();
1407   finishCheck.CheckSignalNotReceived();
1408   DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.8f ), TEST_LOCATION );
1409
1410   application.SendNotification();
1411   application.Render( static_cast< unsigned int >( durationSeconds*100.0f ) + 1u/*just beyond the animation duration*/ );
1412
1413   // We did expect the animation to finish
1414   application.SendNotification();
1415   finishCheck.CheckSignalReceived();
1416   DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.9f ), TEST_LOCATION );
1417   END_TEST;
1418 }
1419
1420 int UtcDaliAnimationSetPlayRangeN(void)
1421 {
1422   TestApplication application;
1423
1424   Actor actor = Actor::New();
1425   Stage::GetCurrent().Add(actor);
1426
1427   // Build the animation
1428   Animation animation = Animation::New(0);
1429   application.SendNotification();
1430
1431   //PlayRange out of bounds
1432   animation.SetPlayRange( Vector2(-1.0f,1.0f) );
1433   application.SendNotification();
1434   DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
1435   animation.SetPlayRange( Vector2(0.0f,2.0f) );
1436   application.SendNotification();
1437   DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
1438
1439   //If playRange is not in the correct order it has to be ordered
1440   animation.SetPlayRange( Vector2(0.8f,0.2f) );
1441   application.SendNotification();
1442   DALI_TEST_EQUALS( Vector2(0.2f,0.8f), animation.GetPlayRange(), TEST_LOCATION );
1443
1444   END_TEST;
1445 }
1446
1447 int UtcDaliAnimationGetPlayRangeP(void)
1448 {
1449   TestApplication application;
1450
1451   Actor actor = Actor::New();
1452   Stage::GetCurrent().Add( actor );
1453
1454   // Build the animation
1455   Animation animation = Animation::New( 1.0f );
1456   application.SendNotification();
1457
1458   //If PlayRange not specified it should be 0.0-1.0 by default
1459   DALI_TEST_EQUALS( Vector2( 0.0f,1.0f ), animation.GetPlayRange(), TEST_LOCATION );
1460
1461   // Set range between 0.4 and 0.8
1462   animation.SetPlayRange( Vector2( 0.4f, 0.8f ) );
1463   application.SendNotification();
1464   DALI_TEST_EQUALS( Vector2( 0.4f, 0.8f ), animation.GetPlayRange(), TEST_LOCATION );
1465
1466   END_TEST;
1467 }
1468
1469 int UtcDaliAnimationPlayP(void)
1470 {
1471   TestApplication application;
1472
1473   Actor actor = Actor::New();
1474   Stage::GetCurrent().Add(actor);
1475
1476   // Build the animation
1477   float durationSeconds(1.0f);
1478   Animation animation = Animation::New(durationSeconds);
1479   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1480   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1481
1482   // Start the animation
1483   animation.Play();
1484
1485   bool signalReceived(false);
1486   AnimationFinishCheck finishCheck(signalReceived);
1487   animation.FinishedSignal().Connect(&application, finishCheck);
1488
1489   application.SendNotification();
1490   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1491
1492   // We didn't expect the animation to finish yet
1493   application.SendNotification();
1494   finishCheck.CheckSignalNotReceived();
1495   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1496
1497   animation.Play(); // Test that calling play has no effect, when animation is already playing
1498   application.SendNotification();
1499   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1500
1501   // We didn't expect the animation to finish yet
1502   application.SendNotification();
1503   finishCheck.CheckSignalNotReceived();
1504   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1505
1506   animation.Play(); // Test that calling play has no effect, when animation is already playing
1507   application.SendNotification();
1508   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1509
1510   // We didn't expect the animation to finish yet
1511   application.SendNotification();
1512   finishCheck.CheckSignalNotReceived();
1513   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1514
1515   animation.Play(); // Test that calling play has no effect, when animation is already playing
1516   application.SendNotification();
1517   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1518
1519   // We didn't expect the animation to finish yet
1520   application.SendNotification();
1521   finishCheck.CheckSignalNotReceived();
1522   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1523
1524   animation.Play(); // Test that calling play has no effect, when animation is already playing
1525   application.SendNotification();
1526   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1527
1528   // We did expect the animation to finish
1529   application.SendNotification();
1530   finishCheck.CheckSignalReceived();
1531   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1532
1533   // Check that nothing has changed after a couple of buffer swaps
1534   application.Render(0);
1535   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1536   application.Render(0);
1537   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1538   END_TEST;
1539 }
1540
1541 int UtcDaliAnimationPlayOffStageP(void)
1542 {
1543   // Test that an animation can be played, when the actor is off-stage.
1544   // When the actor is added to the stage, it should appear at the current position
1545   // i.e. where it would have been anyway, if on-stage from the beginning.
1546
1547   TestApplication application;
1548
1549   Actor actor = Actor::New();
1550   Vector3 basePosition(Vector3::ZERO);
1551   DALI_TEST_EQUALS( actor.GetCurrentPosition(), basePosition, TEST_LOCATION );
1552   // Not added to the stage!
1553
1554   // Build the animation
1555   float durationSeconds(1.0f);
1556   Animation animation = Animation::New(durationSeconds);
1557   animation.SetDisconnectAction( Animation::Discard );
1558   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1559   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1560
1561   // Start the animation
1562   animation.Play();
1563
1564   bool signalReceived(false);
1565   AnimationFinishCheck finishCheck(signalReceived);
1566   animation.FinishedSignal().Connect(&application, finishCheck);
1567
1568   application.SendNotification();
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.GetCurrentPosition(), Vector3::ZERO/*off-stage*/, TEST_LOCATION );
1575
1576   // Add to the stage
1577   Stage::GetCurrent().Add(actor);
1578
1579   application.SendNotification();
1580   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1581
1582   // We didn't expect the animation to finish yet
1583   application.SendNotification();
1584   finishCheck.CheckSignalNotReceived();
1585   Vector3 expectedPosition(basePosition + (targetPosition - basePosition)*0.4f);
1586   DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition/*on-stage*/, TEST_LOCATION );
1587
1588   // Remove from the stage
1589   Stage::GetCurrent().Remove(actor);
1590
1591   application.SendNotification();
1592   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1593
1594   // We didn't expect the animation to finish yet
1595   application.SendNotification();
1596   finishCheck.CheckSignalNotReceived();
1597   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*back to start position*/, TEST_LOCATION );
1598
1599   // Add to the stage
1600   Stage::GetCurrent().Add(actor);
1601
1602   application.SendNotification();
1603   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1604
1605   // We didn't expect the animation to finish yet
1606   application.SendNotification();
1607   finishCheck.CheckSignalNotReceived();
1608   expectedPosition = Vector3(basePosition + (targetPosition - basePosition)*0.8f);
1609   DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition, TEST_LOCATION );
1610
1611   application.SendNotification();
1612   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1613
1614   // We did expect the animation to finish
1615   application.SendNotification();
1616   finishCheck.CheckSignalReceived();
1617   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1618
1619   // Check that nothing has changed after a couple of buffer swaps
1620   application.Render(0);
1621   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1622   application.Render(0);
1623   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1624   END_TEST;
1625 }
1626
1627 int UtcDaliAnimationPlayDiscardHandleP(void)
1628 {
1629   TestApplication application;
1630
1631   Actor actor = Actor::New();
1632   Stage::GetCurrent().Add(actor);
1633
1634   // Build the animation
1635   float durationSeconds(1.0f);
1636   Animation animation = Animation::New(durationSeconds);
1637   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1638   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1639
1640   bool signalReceived(false);
1641   AnimationFinishCheck finishCheck(signalReceived);
1642   animation.FinishedSignal().Connect(&application, finishCheck);
1643
1644   // Start the animation
1645   animation.Play();
1646
1647   // This is a test of the "Fire and Forget" behaviour
1648   // Discard the animation handle!
1649   animation.Reset();
1650   DALI_TEST_CHECK( !animation );
1651
1652   application.SendNotification();
1653   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1654
1655   // We didn't expect the animation to finish yet
1656   application.SendNotification();
1657   finishCheck.CheckSignalNotReceived();
1658   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1659
1660   application.SendNotification();
1661   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1662
1663   // We didn't expect the animation to finish yet
1664   application.SendNotification();
1665   finishCheck.CheckSignalNotReceived();
1666   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1667
1668   application.SendNotification();
1669   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1670
1671   // We didn't expect the animation to finish yet
1672   application.SendNotification();
1673   finishCheck.CheckSignalNotReceived();
1674   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1675
1676   application.SendNotification();
1677   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1678
1679   // We didn't expect the animation to finish yet
1680   application.SendNotification();
1681   finishCheck.CheckSignalNotReceived();
1682   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1683
1684   application.SendNotification();
1685   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1686
1687   // We did expect the animation to finish
1688   application.SendNotification();
1689   finishCheck.CheckSignalReceived();
1690   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1691
1692   // Check that nothing has changed after a couple of buffer swaps
1693   application.Render(0);
1694   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1695   application.Render(0);
1696   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1697   END_TEST;
1698 }
1699
1700 int UtcDaliAnimationPlayStopDiscardHandleP(void)
1701 {
1702   TestApplication application;
1703
1704   Actor actor = Actor::New();
1705   Stage::GetCurrent().Add(actor);
1706
1707   // Build the animation
1708   float durationSeconds(1.0f);
1709   Animation animation = Animation::New(durationSeconds);
1710   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1711   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1712
1713   // Start the animation
1714   animation.Play();
1715
1716   bool signalReceived(false);
1717   AnimationFinishCheck finishCheck(signalReceived);
1718   animation.FinishedSignal().Connect(&application, finishCheck);
1719
1720   application.SendNotification();
1721   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1722
1723   // We didn't expect the animation to finish yet
1724   application.SendNotification();
1725   finishCheck.CheckSignalNotReceived();
1726   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1727
1728   // This is a test of the "Fire and Forget" behaviour
1729   // Stop the animation, and Discard the animation handle!
1730   animation.Stop();
1731   animation.Reset();
1732   DALI_TEST_CHECK( !animation );
1733
1734   application.SendNotification();
1735   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1736
1737   // We expect the animation to finish at 20% progress
1738   application.SendNotification();
1739   finishCheck.CheckSignalReceived();
1740   finishCheck.Reset();
1741   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1742
1743   application.SendNotification();
1744   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1745
1746   // Check that nothing has changed
1747   application.SendNotification();
1748   finishCheck.CheckSignalNotReceived();
1749   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1750
1751   application.SendNotification();
1752   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1753
1754   // Check that nothing has changed
1755   application.SendNotification();
1756   finishCheck.CheckSignalNotReceived();
1757   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1758
1759   application.SendNotification();
1760   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 100% progress */);
1761
1762   // Check that nothing has changed
1763   application.SendNotification();
1764   finishCheck.CheckSignalNotReceived();
1765   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1766   END_TEST;
1767 }
1768
1769 int UtcDaliAnimationPlayRangeP(void)
1770 {
1771   TestApplication application;
1772
1773   Actor actor = Actor::New();
1774   Stage::GetCurrent().Add(actor);
1775
1776   // Build the animation
1777   float durationSeconds(1.0f);
1778   Animation animation = Animation::New(durationSeconds);
1779   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1780   KeyFrames keyframes = KeyFrames::New();
1781   keyframes.Add( 0.0f , Vector3(0.0f,0.0f,0.0f ) );
1782   keyframes.Add( 1.0f , Vector3(100.0f,100.0f,100.0f ) );
1783
1784   animation.AnimateBetween( Property( actor, Actor::Property::POSITION), keyframes );
1785
1786   // Set range between 0.4 and 0.8
1787   animation.SetPlayRange( Vector2(0.4f,0.8f) );
1788   animation.Play();
1789
1790   bool signalReceived(false);
1791   AnimationFinishCheck finishCheck(signalReceived);
1792   animation.FinishedSignal().Connect(&application, finishCheck);
1793
1794   //Test that setting progress outside the range doesn't work
1795   animation.SetCurrentProgress( 0.9f );
1796   application.SendNotification();
1797   application.Render(0);
1798   DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
1799   animation.SetCurrentProgress( 0.2f );
1800   application.SendNotification();
1801   application.Render(0);
1802   DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
1803
1804   application.SendNotification();
1805   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1806
1807   // We didn't expect the animation to finish yet
1808   application.SendNotification();
1809   finishCheck.CheckSignalNotReceived();
1810   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1811
1812   animation.Play(); // Test that calling play has no effect, when animation is already playing
1813   application.SendNotification();
1814   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/* 80% progress */);
1815
1816   // We did expect the animation to finish
1817   application.SendNotification();
1818   finishCheck.CheckSignalReceived();
1819   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1820
1821   // Check that nothing has changed after a couple of buffer swaps
1822   application.Render(0);
1823   DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentPosition(), TEST_LOCATION );
1824   application.Render(0);
1825   DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentPosition(), TEST_LOCATION );
1826
1827
1828   //Loop inside the range
1829   finishCheck.Reset();
1830   animation.SetLooping( true );
1831   animation.Play();
1832   application.SendNotification();
1833   float intervalSeconds = 0.1f;
1834   float progress = 0.4f;
1835   for (int iterations = 0; iterations < 10; ++iterations )
1836   {
1837     application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
1838
1839     progress += intervalSeconds;
1840     if (progress > 0.8f)
1841     {
1842       progress = progress - 0.4f;
1843     }
1844
1845     DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
1846   }
1847
1848   // We didn't expect the animation to finish yet
1849   application.SendNotification();
1850   finishCheck.CheckSignalNotReceived();
1851
1852
1853   //Test change range on the fly
1854   animation.SetPlayRange( Vector2( 0.2f, 0.9f ) );
1855   application.SendNotification();
1856
1857   for (int iterations = 0; iterations < 10; ++iterations )
1858   {
1859     application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
1860
1861     progress += intervalSeconds;
1862     if (progress > 0.9f)
1863     {
1864       progress = progress - 0.7f;
1865     }
1866
1867     DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
1868   }
1869
1870   END_TEST;
1871 }
1872
1873 int UtcDaliAnimationPlayFromP(void)
1874 {
1875   TestApplication application;
1876
1877   Actor actor = Actor::New();
1878   Stage::GetCurrent().Add(actor);
1879
1880   // Build the animation
1881   float durationSeconds(1.0f);
1882   Animation animation = Animation::New(durationSeconds);
1883   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1884   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1885
1886   // Start the animation from 40% progress
1887   animation.PlayFrom( 0.4f );
1888
1889   bool signalReceived(false);
1890   AnimationFinishCheck finishCheck(signalReceived);
1891   animation.FinishedSignal().Connect(&application, finishCheck);
1892
1893   application.SendNotification();
1894   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1895
1896   // We didn't expect the animation to finish yet
1897   application.SendNotification();
1898   finishCheck.CheckSignalNotReceived();
1899   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1900
1901   animation.Play(); // Test that calling play has no effect, when animation is already playing
1902   application.SendNotification();
1903   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1904
1905   // We didn't expect the animation to finish yet
1906   application.SendNotification();
1907   finishCheck.CheckSignalNotReceived();
1908   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1909
1910   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1911   // We did expect the animation to finish
1912   application.SendNotification();
1913   finishCheck.CheckSignalReceived();
1914   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1915
1916   // Check that nothing has changed after a couple of buffer swaps
1917   application.Render(0);
1918   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1919   application.Render(0);
1920   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1921   END_TEST;
1922 }
1923
1924 int UtcDaliAnimationPlayFromN(void)
1925 {
1926   TestApplication application;
1927
1928   Actor actor = Actor::New();
1929   Stage::GetCurrent().Add(actor);
1930
1931   // Build the animation
1932   float durationSeconds(1.0f);
1933   Animation animation = Animation::New(durationSeconds);
1934   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1935   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1936
1937   //PlayFrom with an argument outside the range [0..1] will be ignored
1938   animation.PlayFrom(-1.0f);
1939   application.SendNotification();
1940   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1941
1942   animation.PlayFrom(100.0f);
1943   application.SendNotification();
1944   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1945   END_TEST;
1946 }
1947
1948 int UtcDaliAnimationPauseP(void)
1949 {
1950   TestApplication application;
1951
1952   Actor actor = Actor::New();
1953   Stage::GetCurrent().Add(actor);
1954
1955   // Build the animation
1956   float durationSeconds(1.0f);
1957   Animation animation = Animation::New(durationSeconds);
1958   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1959   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1960
1961   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
1962
1963   // Start the animation
1964   animation.Play();
1965
1966   bool signalReceived(false);
1967   AnimationFinishCheck finishCheck(signalReceived);
1968   animation.FinishedSignal().Connect(&application, finishCheck);
1969
1970   application.SendNotification();
1971   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
1972
1973   // We didn't expect the animation to finish yet
1974   application.SendNotification();
1975   finishCheck.CheckSignalNotReceived();
1976   DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
1977
1978   // Pause the animation
1979   animation.Pause();
1980   application.SendNotification();
1981
1982   // Loop 5 times
1983   for (int i=0; i<5; ++i)
1984   {
1985     application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
1986
1987     // We didn't expect the animation to finish yet
1988     application.SendNotification();
1989     finishCheck.CheckSignalNotReceived();
1990     DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
1991   }
1992
1993   // Keep going
1994   animation.Play();
1995   application.SendNotification();
1996   application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
1997
1998   // We didn't expect the animation to finish yet
1999   application.SendNotification();
2000   finishCheck.CheckSignalNotReceived();
2001
2002   application.SendNotification();
2003   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2004
2005   // We did expect the animation to finish
2006   application.SendNotification();
2007   finishCheck.CheckSignalReceived();
2008   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2009
2010   // Check that nothing has changed after a couple of buffer swaps
2011   application.Render(0);
2012   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2013   application.Render(0);
2014   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2015   END_TEST;
2016 }
2017
2018 int UtcDaliAnimationStoP(void)
2019 {
2020   TestApplication application;
2021
2022   Actor actor = Actor::New();
2023   Stage::GetCurrent().Add(actor);
2024
2025   // Build the animation
2026   float durationSeconds(1.0f);
2027   Animation animation = Animation::New(durationSeconds);
2028   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2029   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2030
2031   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2032
2033   // Start the animation
2034   animation.Play();
2035
2036   bool signalReceived(false);
2037   AnimationFinishCheck finishCheck(signalReceived);
2038   animation.FinishedSignal().Connect(&application, finishCheck);
2039
2040   application.SendNotification();
2041   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2042
2043   // We didn't expect the animation to finish yet
2044   application.SendNotification();
2045   finishCheck.CheckSignalNotReceived();
2046   DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2047
2048   // Stop the animation
2049   animation.Stop();
2050   application.SendNotification();
2051
2052   // Loop 5 times
2053   for (int i=0; i<5; ++i)
2054   {
2055     application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2056
2057     // We did expect the animation to finish
2058     application.SendNotification();
2059     finishCheck.CheckSignalReceived();
2060     DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when stopped */, TEST_LOCATION );
2061   }
2062   END_TEST;
2063 }
2064
2065 int UtcDaliAnimationStopSetPositionP(void)
2066 {
2067   // Test that Animation::Stop & Actor::SetPosition can be used in conjunction
2068   // i.e. to check that the animation does not interfere with the position set.
2069
2070   TestApplication application;
2071
2072   Actor actor = Actor::New();
2073   Stage::GetCurrent().Add(actor);
2074
2075   // Build the animation
2076   float durationSeconds(1.0f);
2077   Animation animation = Animation::New(durationSeconds);
2078   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2079   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2080
2081   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2082
2083   // Start the animation
2084   animation.Play();
2085
2086   bool signalReceived(false);
2087   AnimationFinishCheck finishCheck(signalReceived);
2088   animation.FinishedSignal().Connect(&application, finishCheck);
2089
2090   application.SendNotification();
2091   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2092
2093   // We didn't expect the animation to finish yet
2094   application.SendNotification();
2095   finishCheck.CheckSignalNotReceived();
2096   DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2097
2098   // Stop the animation
2099   animation.Stop();
2100   Vector3 positionSet(2.0f, 3.0f, 4.0f);
2101   actor.SetPosition(positionSet);
2102   application.SendNotification();
2103
2104   // Loop 5 times
2105   for (int i=0; i<5; ++i)
2106   {
2107     application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2108
2109     // We did expect the animation to finish
2110     application.SendNotification();
2111     finishCheck.CheckSignalReceived();
2112     DALI_TEST_EQUALS( actor.GetCurrentPosition(), positionSet/*Animation should not interfere with this*/, TEST_LOCATION );
2113   }
2114   END_TEST;
2115 }
2116
2117 int UtcDaliAnimationClearP(void)
2118 {
2119   TestApplication application;
2120
2121   Actor actor = Actor::New();
2122   Stage::GetCurrent().Add(actor);
2123
2124   // Build the animation
2125   float durationSeconds(1.0f);
2126   Animation animation = Animation::New(durationSeconds);
2127   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2128   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2129
2130   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2131
2132   // Start the animation
2133   animation.Play();
2134
2135   bool signalReceived(false);
2136   AnimationFinishCheck finishCheck(signalReceived);
2137   animation.FinishedSignal().Connect(&application, finishCheck);
2138
2139   application.SendNotification();
2140   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2141
2142   // We didn't expect the animation to finish yet
2143   application.SendNotification();
2144   finishCheck.CheckSignalNotReceived();
2145   DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2146
2147   // Clear the animation
2148   animation.Clear();
2149   application.SendNotification();
2150
2151   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2152
2153   // We don't expect the animation to finish now
2154   application.SendNotification();
2155   finishCheck.CheckSignalNotReceived();
2156   DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress since the animator was destroyed */, TEST_LOCATION );
2157
2158   // Restart as a scale animation; this should not move the actor's position
2159   finishCheck.Reset();
2160   actor.SetPosition(Vector3::ZERO);
2161   Vector3 targetScale(3.0f, 3.0f, 3.0f);
2162   animation.AnimateTo( Property( actor, Actor::Property::SCALE ), targetScale, AlphaFunction::LINEAR );
2163   animation.Play();
2164
2165   application.SendNotification();
2166   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2167
2168   // We didn't expect the animation to finish yet
2169   application.SendNotification();
2170   finishCheck.CheckSignalNotReceived();
2171   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
2172   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION );
2173
2174   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2175
2176   // We did expect the animation to finish
2177   application.SendNotification();
2178   finishCheck.CheckSignalReceived();
2179   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
2180   DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
2181   END_TEST;
2182 }
2183
2184 int UtcDaliAnimationFinishedSignalP(void)
2185 {
2186   TestApplication application;
2187
2188   // Start the empty animation
2189   float durationSeconds(1.0f);
2190   Animation animation = Animation::New(durationSeconds);
2191   animation.Play();
2192
2193   bool signalReceived(false);
2194   AnimationFinishCheck finishCheck(signalReceived);
2195   animation.FinishedSignal().Connect(&application, finishCheck);
2196
2197   application.SendNotification();
2198   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*beyond the animation duration*/);
2199
2200   // We did expect the animation to finish
2201   application.SendNotification();
2202   finishCheck.CheckSignalReceived();
2203   END_TEST;
2204 }
2205
2206 int UtcDaliAnimationAnimateByBooleanP(void)
2207 {
2208   TestApplication application;
2209
2210   Actor actor = Actor::New();
2211
2212   // Register a boolean property
2213   bool startValue(false);
2214   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
2215   Stage::GetCurrent().Add(actor);
2216   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2217
2218   // Build the animation
2219   float durationSeconds(2.0f);
2220   Animation animation = Animation::New(durationSeconds);
2221   const bool relativeValue(true);
2222   const bool finalValue( false || relativeValue );
2223   animation.AnimateBy(Property(actor, index), relativeValue);
2224
2225   // Start the animation
2226   animation.Play();
2227
2228   bool signalReceived(false);
2229   AnimationFinishCheck finishCheck(signalReceived);
2230   animation.FinishedSignal().Connect(&application, finishCheck);
2231
2232   application.SendNotification();
2233   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2234
2235   // We didn't expect the animation to finish yet
2236   application.SendNotification();
2237   finishCheck.CheckSignalNotReceived();
2238   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2239
2240   application.SendNotification();
2241   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2242
2243   // We did expect the animation to finish
2244   application.SendNotification();
2245   finishCheck.CheckSignalReceived();
2246   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2247
2248   // Check that nothing has changed after a couple of buffer swaps
2249   application.Render(0);
2250   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2251   application.Render(0);
2252   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2253
2254   // Repeat with relative value "false" - this should be an NOOP
2255   animation = Animation::New(durationSeconds);
2256   bool noOpValue(false);
2257   animation.AnimateBy(Property(actor, index), noOpValue);
2258
2259   // Start the animation
2260   animation.Play();
2261
2262   finishCheck.Reset();
2263   animation.FinishedSignal().Connect(&application, finishCheck);
2264
2265   application.SendNotification();
2266   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2267
2268   // We didn't expect the animation to finish yet
2269   application.SendNotification();
2270   finishCheck.CheckSignalNotReceived();
2271   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2272
2273   application.SendNotification();
2274   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2275
2276   // We did expect the animation to finish
2277   application.SendNotification();
2278   finishCheck.CheckSignalReceived();
2279   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2280
2281   // Check that nothing has changed after a couple of buffer swaps
2282   application.Render(0);
2283   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2284   application.Render(0);
2285   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2286   END_TEST;
2287 }
2288
2289 int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void)
2290 {
2291   TestApplication application;
2292
2293   Actor actor = Actor::New();
2294
2295   // Register a boolean property
2296   bool startValue(false);
2297   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
2298   Stage::GetCurrent().Add(actor);
2299   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2300
2301   // Build the animation
2302   float durationSeconds(2.0f);
2303   Animation animation = Animation::New(durationSeconds);
2304   bool relativeValue(true);
2305   bool finalValue( false || relativeValue );
2306   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN);
2307
2308   // Start the animation
2309   animation.Play();
2310
2311   bool signalReceived(false);
2312   AnimationFinishCheck finishCheck(signalReceived);
2313   animation.FinishedSignal().Connect(&application, finishCheck);
2314
2315   application.SendNotification();
2316   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2317
2318   // We didn't expect the animation to finish yet
2319   application.SendNotification();
2320   finishCheck.CheckSignalNotReceived();
2321   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2322
2323   application.SendNotification();
2324   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2325
2326   // We did expect the animation to finish
2327   application.SendNotification();
2328   finishCheck.CheckSignalReceived();
2329   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2330
2331   // Check that nothing has changed after a couple of buffer swaps
2332   application.Render(0);
2333   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2334   application.Render(0);
2335   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2336
2337   // Repeat with relative value "false" - this should be an NOOP
2338   animation = Animation::New(durationSeconds);
2339   bool noOpValue(false);
2340   animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunction::EASE_IN);
2341
2342   // Start the animation
2343   animation.Play();
2344
2345   finishCheck.Reset();
2346   animation.FinishedSignal().Connect(&application, finishCheck);
2347
2348   application.SendNotification();
2349   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2350
2351   // We didn't expect the animation to finish yet
2352   application.SendNotification();
2353   finishCheck.CheckSignalNotReceived();
2354   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2355
2356   application.SendNotification();
2357   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2358
2359   // We did expect the animation to finish
2360   application.SendNotification();
2361   finishCheck.CheckSignalReceived();
2362   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2363   END_TEST;
2364 }
2365
2366 int UtcDaliAnimationAnimateByBooleanTimePeriodP(void)
2367 {
2368   TestApplication application;
2369
2370   Actor actor = Actor::New();
2371
2372   // Register a boolean property
2373   bool startValue(false);
2374   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
2375   Stage::GetCurrent().Add(actor);
2376   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2377
2378   // Build the animation
2379   float durationSeconds(2.0f);
2380   Animation animation = Animation::New(durationSeconds);
2381   bool relativeValue(true);
2382   bool finalValue( false || relativeValue );
2383   float animatorDurationSeconds(durationSeconds * 0.5f);
2384   animation.AnimateBy( Property(actor, index),
2385                        relativeValue,
2386                        TimePeriod( animatorDurationSeconds ) );
2387
2388   // Start the animation
2389   animation.Play();
2390
2391   bool signalReceived(false);
2392   AnimationFinishCheck finishCheck(signalReceived);
2393   animation.FinishedSignal().Connect(&application, finishCheck);
2394
2395   application.SendNotification();
2396   application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
2397
2398   // We didn't expect the animation to finish yet
2399   application.SendNotification();
2400   finishCheck.CheckSignalNotReceived();
2401   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2402
2403   application.SendNotification();
2404   application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
2405
2406   // We didn't expect the animation to finish yet...
2407   application.SendNotification();
2408   finishCheck.CheckSignalNotReceived();
2409
2410   // ...however we should have reached the final value
2411   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2412
2413   application.SendNotification();
2414   application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
2415
2416   // We did expect the animation to finish
2417   application.SendNotification();
2418   finishCheck.CheckSignalReceived();
2419   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2420
2421   // Check that nothing has changed after a couple of buffer swaps
2422   application.Render(0);
2423   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2424   application.Render(0);
2425   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2426   END_TEST;
2427 }
2428
2429 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void)
2430 {
2431   TestApplication application;
2432
2433   Actor actor = Actor::New();
2434
2435   // Register a boolean property
2436   bool startValue(false);
2437   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
2438   Stage::GetCurrent().Add(actor);
2439   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2440
2441   // Build the animation
2442   float durationSeconds(2.0f);
2443   Animation animation = Animation::New(durationSeconds);
2444   bool relativeValue(true);
2445   bool finalValue( false || relativeValue );
2446   float animatorDurationSeconds(durationSeconds * 0.5f);
2447   animation.AnimateBy( Property(actor, index),
2448                        relativeValue,
2449                        AlphaFunction::EASE_IN_OUT,
2450                        TimePeriod( animatorDurationSeconds ) );
2451
2452   // Start the animation
2453   animation.Play();
2454
2455   bool signalReceived(false);
2456   AnimationFinishCheck finishCheck(signalReceived);
2457   animation.FinishedSignal().Connect(&application, finishCheck);
2458
2459   application.SendNotification();
2460   application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
2461
2462   // We didn't expect the animation to finish yet
2463   application.SendNotification();
2464   finishCheck.CheckSignalNotReceived();
2465   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2466
2467   application.SendNotification();
2468   application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
2469
2470   // We didn't expect the animation to finish yet...
2471   application.SendNotification();
2472   finishCheck.CheckSignalNotReceived();
2473
2474   // ...however we should have reached the final value
2475   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2476
2477   application.SendNotification();
2478   application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
2479
2480   // We did expect the animation to finish
2481   application.SendNotification();
2482   finishCheck.CheckSignalReceived();
2483   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2484
2485   // Check that nothing has changed after a couple of buffer swaps
2486   application.Render(0);
2487   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2488   application.Render(0);
2489   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2490   END_TEST;
2491 }
2492
2493 int UtcDaliAnimationAnimateByFloatP(void)
2494 {
2495   TestApplication application;
2496
2497   Actor actor = Actor::New();
2498
2499   // Register a float property
2500   float startValue(10.0f);
2501   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
2502   Stage::GetCurrent().Add(actor);
2503   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2504
2505   // Build the animation
2506   float durationSeconds(2.0f);
2507   Animation animation = Animation::New(durationSeconds);
2508   float targetValue(50.0f);
2509   float relativeValue(targetValue - startValue);
2510   animation.AnimateBy(Property(actor, index), relativeValue);
2511
2512   float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2513
2514   // Start the animation
2515   animation.Play();
2516
2517   bool signalReceived(false);
2518   AnimationFinishCheck finishCheck(signalReceived);
2519   animation.FinishedSignal().Connect(&application, finishCheck);
2520
2521   application.SendNotification();
2522   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2523
2524   // We didn't expect the animation to finish yet
2525   application.SendNotification();
2526   finishCheck.CheckSignalNotReceived();
2527   DALI_TEST_EQUALS( actor.GetProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION );
2528
2529   application.SendNotification();
2530   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2531
2532   // We did expect the animation to finish
2533   application.SendNotification();
2534   finishCheck.CheckSignalReceived();
2535   DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2536
2537   // Check that nothing has changed after a couple of buffer swaps
2538   application.Render(0);
2539   DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2540   application.Render(0);
2541   DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2542   END_TEST;
2543 }
2544
2545 int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void)
2546 {
2547   TestApplication application;
2548
2549   Actor actor = Actor::New();
2550
2551   // Register a float property
2552   float startValue(10.0f);
2553   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
2554   Stage::GetCurrent().Add(actor);
2555   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2556
2557   // Build the animation
2558   float durationSeconds(1.0f);
2559   Animation animation = Animation::New(durationSeconds);
2560   float targetValue(90.0f);
2561   float relativeValue(targetValue - startValue);
2562   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
2563
2564   float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2565
2566   // Start the animation
2567   animation.Play();
2568
2569   bool signalReceived(false);
2570   AnimationFinishCheck finishCheck(signalReceived);
2571   animation.FinishedSignal().Connect(&application, finishCheck);
2572
2573   application.SendNotification();
2574   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2575
2576   // We didn't expect the animation to finish yet
2577   application.SendNotification();
2578   finishCheck.CheckSignalNotReceived();
2579
2580   // The position should have moved more, than with a linear alpha function
2581   float current(actor.GetProperty<float>(index));
2582   DALI_TEST_CHECK( current > ninetyFivePercentProgress );
2583
2584   application.SendNotification();
2585   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2586
2587   // We did expect the animation to finish
2588   application.SendNotification();
2589   finishCheck.CheckSignalReceived();
2590   DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2591
2592   // Check that nothing has changed after a couple of buffer swaps
2593   application.Render(0);
2594   DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2595   application.Render(0);
2596   DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2597   END_TEST;
2598 }
2599
2600 int UtcDaliAnimationAnimateByFloatTimePeriodP(void)
2601 {
2602   TestApplication application;
2603
2604   Actor actor = Actor::New();
2605
2606   // Register a float property
2607   float startValue(10.0f);
2608   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
2609   Stage::GetCurrent().Add(actor);
2610   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2611
2612   // Build the animation
2613   float durationSeconds(1.0f);
2614   Animation animation = Animation::New(durationSeconds);
2615   float targetValue(30.0f);
2616   float relativeValue(targetValue - startValue);
2617   float delay = 0.5f;
2618   animation.AnimateBy(Property(actor, index),
2619                       relativeValue,
2620                       TimePeriod(delay, durationSeconds - delay));
2621
2622   // Start the animation
2623   animation.Play();
2624
2625   bool signalReceived(false);
2626   AnimationFinishCheck finishCheck(signalReceived);
2627   animation.FinishedSignal().Connect(&application, finishCheck);
2628
2629   application.SendNotification();
2630   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2631
2632   // We didn't expect the animation to finish yet
2633   application.SendNotification();
2634   finishCheck.CheckSignalNotReceived();
2635   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2636
2637   application.SendNotification();
2638   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2639
2640   // We didn't expect the animation to finish yet
2641   application.SendNotification();
2642   finishCheck.CheckSignalNotReceived();
2643   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2644
2645   application.SendNotification();
2646   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2647
2648   // We did expect the animation to finish
2649   application.SendNotification();
2650   finishCheck.CheckSignalReceived();
2651   DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2652
2653   // Check that nothing has changed after a couple of buffer swaps
2654   application.Render(0);
2655   DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2656   application.Render(0);
2657   DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2658   END_TEST;
2659 }
2660
2661 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void)
2662 {
2663   TestApplication application;
2664
2665   Actor actor = Actor::New();
2666
2667   // Register a float property
2668   float startValue(10.0f);
2669   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
2670   Stage::GetCurrent().Add(actor);
2671   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2672
2673   // Build the animation
2674   float durationSeconds(1.0f);
2675   Animation animation = Animation::New(durationSeconds);
2676   float targetValue(30.0f);
2677   float relativeValue(targetValue - startValue);
2678   float delay = 0.5f;
2679   animation.AnimateBy(Property(actor, index),
2680                       relativeValue,
2681                       AlphaFunction::LINEAR,
2682                       TimePeriod(delay, durationSeconds - delay));
2683
2684   // Start the animation
2685   animation.Play();
2686
2687   bool signalReceived(false);
2688   AnimationFinishCheck finishCheck(signalReceived);
2689   animation.FinishedSignal().Connect(&application, finishCheck);
2690
2691   application.SendNotification();
2692   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2693
2694   // We didn't expect the animation to finish yet
2695   application.SendNotification();
2696   finishCheck.CheckSignalNotReceived();
2697   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2698
2699   application.SendNotification();
2700   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2701
2702   // We didn't expect the animation to finish yet
2703   application.SendNotification();
2704   finishCheck.CheckSignalNotReceived();
2705   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2706
2707   application.SendNotification();
2708   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2709
2710   // We did expect the animation to finish
2711   application.SendNotification();
2712   finishCheck.CheckSignalReceived();
2713   DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2714
2715   // Check that nothing has changed after a couple of buffer swaps
2716   application.Render(0);
2717   DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2718   application.Render(0);
2719   DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2720   END_TEST;
2721 }
2722
2723 int UtcDaliAnimationAnimateByIntegerP(void)
2724 {
2725   TestApplication application;
2726
2727   Actor actor = Actor::New();
2728
2729   // Register an integer property
2730   int startValue(1);
2731   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
2732   Stage::GetCurrent().Add(actor);
2733   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
2734
2735   // Build the animation
2736   float durationSeconds(2.0f);
2737   Animation animation = Animation::New(durationSeconds);
2738   int targetValue(50);
2739   int relativeValue(targetValue - startValue);
2740   animation.AnimateBy(Property(actor, index), relativeValue);
2741
2742   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
2743
2744   // Start the animation
2745   animation.Play();
2746
2747   bool signalReceived(false);
2748   AnimationFinishCheck finishCheck(signalReceived);
2749   animation.FinishedSignal().Connect(&application, finishCheck);
2750
2751   application.SendNotification();
2752   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2753
2754   // We didn't expect the animation to finish yet
2755   application.SendNotification();
2756   finishCheck.CheckSignalNotReceived();
2757   DALI_TEST_EQUALS( actor.GetProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION );
2758
2759   application.SendNotification();
2760   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2761
2762   // We did expect the animation to finish
2763   application.SendNotification();
2764   finishCheck.CheckSignalReceived();
2765   DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2766
2767   // Check that nothing has changed after a couple of buffer swaps
2768   application.Render(0);
2769   DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2770   application.Render(0);
2771   DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2772   END_TEST;
2773 }
2774
2775 int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void)
2776 {
2777   TestApplication application;
2778
2779   Actor actor = Actor::New();
2780
2781   // Register an integer property
2782   int startValue(1);
2783   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
2784   Stage::GetCurrent().Add(actor);
2785   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
2786
2787   // Build the animation
2788   float durationSeconds(1.0f);
2789   Animation animation = Animation::New(durationSeconds);
2790   int targetValue(90);
2791   int relativeValue(targetValue - startValue);
2792   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
2793
2794   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
2795
2796   // Start the animation
2797   animation.Play();
2798
2799   bool signalReceived(false);
2800   AnimationFinishCheck finishCheck(signalReceived);
2801   animation.FinishedSignal().Connect(&application, finishCheck);
2802
2803   application.SendNotification();
2804   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2805
2806   // We didn't expect the animation to finish yet
2807   application.SendNotification();
2808   finishCheck.CheckSignalNotReceived();
2809
2810   // The position should have moved more, than with a linear alpha function
2811   int current(actor.GetProperty<int>(index));
2812   DALI_TEST_CHECK( current > ninetyFivePercentProgress );
2813
2814   application.SendNotification();
2815   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2816
2817   // We did expect the animation to finish
2818   application.SendNotification();
2819   finishCheck.CheckSignalReceived();
2820   DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2821
2822   // Check that nothing has changed after a couple of buffer swaps
2823   application.Render(0);
2824   DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2825   application.Render(0);
2826   DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2827   END_TEST;
2828 }
2829
2830 int UtcDaliAnimationAnimateByIntegerTimePeriodP(void)
2831 {
2832   TestApplication application;
2833
2834   Actor actor = Actor::New();
2835
2836   // Register an integer property
2837   int startValue(10);
2838   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
2839   Stage::GetCurrent().Add(actor);
2840   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
2841
2842   // Build the animation
2843   float durationSeconds(1.0f);
2844   Animation animation = Animation::New(durationSeconds);
2845   int targetValue(30);
2846   int relativeValue(targetValue - startValue);
2847   float delay = 0.5f;
2848   animation.AnimateBy(Property(actor, index),
2849                       relativeValue,
2850                       TimePeriod(delay, durationSeconds - delay));
2851
2852   // Start the animation
2853   animation.Play();
2854
2855   bool signalReceived(false);
2856   AnimationFinishCheck finishCheck(signalReceived);
2857   animation.FinishedSignal().Connect(&application, finishCheck);
2858
2859   application.SendNotification();
2860   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2861
2862   // We didn't expect the animation to finish yet
2863   application.SendNotification();
2864   finishCheck.CheckSignalNotReceived();
2865   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
2866
2867   application.SendNotification();
2868   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2869
2870   // We didn't expect the animation to finish yet
2871   application.SendNotification();
2872   finishCheck.CheckSignalNotReceived();
2873   DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
2874
2875   application.SendNotification();
2876   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2877
2878   // We did expect the animation to finish
2879   application.SendNotification();
2880   finishCheck.CheckSignalReceived();
2881   DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2882
2883   // Check that nothing has changed after a couple of buffer swaps
2884   application.Render(0);
2885   DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2886   application.Render(0);
2887   DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2888   END_TEST;
2889 }
2890
2891 int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void)
2892 {
2893   TestApplication application;
2894
2895   Actor actor = Actor::New();
2896
2897   // Register an integer property
2898   int startValue(10);
2899   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
2900   Stage::GetCurrent().Add(actor);
2901   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
2902
2903   // Build the animation
2904   float durationSeconds(1.0f);
2905   Animation animation = Animation::New(durationSeconds);
2906   int targetValue(30);
2907   int relativeValue(targetValue - startValue);
2908   float delay = 0.5f;
2909   animation.AnimateBy(Property(actor, index),
2910                       relativeValue,
2911                       AlphaFunction::LINEAR,
2912                       TimePeriod(delay, durationSeconds - delay));
2913
2914   // Start the animation
2915   animation.Play();
2916
2917   bool signalReceived(false);
2918   AnimationFinishCheck finishCheck(signalReceived);
2919   animation.FinishedSignal().Connect(&application, finishCheck);
2920
2921   application.SendNotification();
2922   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2923
2924   // We didn't expect the animation to finish yet
2925   application.SendNotification();
2926   finishCheck.CheckSignalNotReceived();
2927   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
2928
2929   application.SendNotification();
2930   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2931
2932   // We didn't expect the animation to finish yet
2933   application.SendNotification();
2934   finishCheck.CheckSignalNotReceived();
2935   DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
2936
2937   application.SendNotification();
2938   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2939
2940   // We did expect the animation to finish
2941   application.SendNotification();
2942   finishCheck.CheckSignalReceived();
2943   DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2944
2945   // Check that nothing has changed after a couple of buffer swaps
2946   application.Render(0);
2947   DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2948   application.Render(0);
2949   DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
2950   END_TEST;
2951 }
2952
2953 int UtcDaliAnimationAnimateByVector2P(void)
2954 {
2955   TestApplication application;
2956
2957   Actor actor = Actor::New();
2958
2959   // Register a Vector2 property
2960   Vector2 startValue(10.0f, 10.0f);
2961   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
2962   Stage::GetCurrent().Add(actor);
2963   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
2964
2965   // Build the animation
2966   float durationSeconds(2.0f);
2967   Animation animation = Animation::New(durationSeconds);
2968   Vector2 targetValue(60.0f, 60.0f);
2969   Vector2 relativeValue(targetValue - startValue);
2970   animation.AnimateBy(Property(actor, index), relativeValue);
2971
2972   Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2973
2974   // Start the animation
2975   animation.Play();
2976
2977   bool signalReceived(false);
2978   AnimationFinishCheck finishCheck(signalReceived);
2979   animation.FinishedSignal().Connect(&application, finishCheck);
2980
2981   application.SendNotification();
2982   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2983
2984   // We didn't expect the animation to finish yet
2985   application.SendNotification();
2986   finishCheck.CheckSignalNotReceived();
2987   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION );
2988
2989   application.SendNotification();
2990   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2991
2992   // We did expect the animation to finish
2993   application.SendNotification();
2994   finishCheck.CheckSignalReceived();
2995   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
2996
2997   // Check that nothing has changed after a couple of buffer swaps
2998   application.Render(0);
2999   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3000   application.Render(0);
3001   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3002   END_TEST;
3003 }
3004
3005 int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void)
3006 {
3007   TestApplication application;
3008
3009   Actor actor = Actor::New();
3010
3011   // Register a Vector2 property
3012   Vector2 startValue(100.0f, 100.0f);
3013   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3014   Stage::GetCurrent().Add(actor);
3015   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3016
3017   // Build the animation
3018   float durationSeconds(1.0f);
3019   Animation animation = Animation::New(durationSeconds);
3020   Vector2 targetValue(20.0f, 20.0f);
3021   Vector2 relativeValue(targetValue - startValue);
3022   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3023
3024   Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3025
3026   // Start the animation
3027   animation.Play();
3028
3029   bool signalReceived(false);
3030   AnimationFinishCheck finishCheck(signalReceived);
3031   animation.FinishedSignal().Connect(&application, finishCheck);
3032
3033   application.SendNotification();
3034   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3035
3036   // We didn't expect the animation to finish yet
3037   application.SendNotification();
3038   finishCheck.CheckSignalNotReceived();
3039
3040   // The position should have moved more, than with a linear alpha function
3041   Vector2 current(actor.GetProperty<Vector2>(index));
3042   DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3043   DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3044
3045   application.SendNotification();
3046   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3047
3048   // We did expect the animation to finish
3049   application.SendNotification();
3050   finishCheck.CheckSignalReceived();
3051   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3052
3053   // Check that nothing has changed after a couple of buffer swaps
3054   application.Render(0);
3055   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3056   application.Render(0);
3057   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3058   END_TEST;
3059 }
3060
3061 int UtcDaliAnimationAnimateByVector2TimePeriodP(void)
3062 {
3063   TestApplication application;
3064
3065   Actor actor = Actor::New();
3066
3067   // Register a Vector2 property
3068   Vector2 startValue(10.0f, 10.0f);
3069   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3070   Stage::GetCurrent().Add(actor);
3071   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3072
3073   // Build the animation
3074   float durationSeconds(1.0f);
3075   Animation animation = Animation::New(durationSeconds);
3076   Vector2 targetValue(30.0f, 30.0f);
3077   Vector2 relativeValue(targetValue - startValue);
3078   float delay = 0.5f;
3079   animation.AnimateBy(Property(actor, index),
3080                       relativeValue,
3081                       TimePeriod(delay, durationSeconds - delay));
3082
3083   // Start the animation
3084   animation.Play();
3085
3086   bool signalReceived(false);
3087   AnimationFinishCheck finishCheck(signalReceived);
3088   animation.FinishedSignal().Connect(&application, finishCheck);
3089
3090   application.SendNotification();
3091   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3092
3093   // We didn't expect the animation to finish yet
3094   application.SendNotification();
3095   finishCheck.CheckSignalNotReceived();
3096   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3097
3098   application.SendNotification();
3099   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3100
3101   // We didn't expect the animation to finish yet
3102   application.SendNotification();
3103   finishCheck.CheckSignalNotReceived();
3104   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3105
3106   application.SendNotification();
3107   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3108
3109   // We did expect the animation to finish
3110   application.SendNotification();
3111   finishCheck.CheckSignalReceived();
3112   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3113
3114   // Check that nothing has changed after a couple of buffer swaps
3115   application.Render(0);
3116   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3117   application.Render(0);
3118   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3119   END_TEST;
3120 }
3121
3122 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void)
3123 {
3124   TestApplication application;
3125
3126   Actor actor = Actor::New();
3127
3128   // Register a Vector2 property
3129   Vector2 startValue(5.0f, 5.0f);
3130   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3131   Stage::GetCurrent().Add(actor);
3132   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3133
3134   // Build the animation
3135   float durationSeconds(1.0f);
3136   Animation animation = Animation::New(durationSeconds);
3137   Vector2 targetValue(10.0f, 10.0f);
3138   Vector2 relativeValue(targetValue - startValue);
3139   float delay = 0.5f;
3140   animation.AnimateBy(Property(actor, index),
3141                       relativeValue,
3142                       AlphaFunction::LINEAR,
3143                       TimePeriod(delay, durationSeconds - delay));
3144
3145   // Start the animation
3146   animation.Play();
3147
3148   bool signalReceived(false);
3149   AnimationFinishCheck finishCheck(signalReceived);
3150   animation.FinishedSignal().Connect(&application, finishCheck);
3151
3152   application.SendNotification();
3153   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3154
3155   // We didn't expect the animation to finish yet
3156   application.SendNotification();
3157   finishCheck.CheckSignalNotReceived();
3158   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3159
3160   application.SendNotification();
3161   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3162
3163   // We didn't expect the animation to finish yet
3164   application.SendNotification();
3165   finishCheck.CheckSignalNotReceived();
3166   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3167
3168   application.SendNotification();
3169   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3170
3171   // We did expect the animation to finish
3172   application.SendNotification();
3173   finishCheck.CheckSignalReceived();
3174   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3175
3176   // Check that nothing has changed after a couple of buffer swaps
3177   application.Render(0);
3178   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3179   application.Render(0);
3180   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3181   END_TEST;
3182 }
3183
3184 int UtcDaliAnimationAnimateByVector3P(void)
3185 {
3186   TestApplication application;
3187
3188   Actor actor = Actor::New();
3189
3190   // Register a Vector3 property
3191   Vector3 startValue(10.0f, 10.0f, 10.0f);
3192   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3193   Stage::GetCurrent().Add(actor);
3194   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3195
3196   // Build the animation
3197   float durationSeconds(2.0f);
3198   Animation animation = Animation::New(durationSeconds);
3199   Vector3 targetValue(60.0f, 60.0f, 60.0f);
3200   Vector3 relativeValue(targetValue - startValue);
3201   animation.AnimateBy(Property(actor, index), relativeValue);
3202
3203   Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3204
3205   // Start the animation
3206   animation.Play();
3207
3208   bool signalReceived(false);
3209   AnimationFinishCheck finishCheck(signalReceived);
3210   animation.FinishedSignal().Connect(&application, finishCheck);
3211
3212   application.SendNotification();
3213   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3214
3215   // We didn't expect the animation to finish yet
3216   application.SendNotification();
3217   finishCheck.CheckSignalNotReceived();
3218   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION );
3219
3220   application.SendNotification();
3221   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3222
3223   // We did expect the animation to finish
3224   application.SendNotification();
3225   finishCheck.CheckSignalReceived();
3226   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3227
3228   // Check that nothing has changed after a couple of buffer swaps
3229   application.Render(0);
3230   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3231   application.Render(0);
3232   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3233   END_TEST;
3234 }
3235
3236 int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void)
3237 {
3238   TestApplication application;
3239
3240   Actor actor = Actor::New();
3241
3242   // Register a Vector3 property
3243   Vector3 startValue(100.0f, 100.0f, 100.0f);
3244   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3245   Stage::GetCurrent().Add(actor);
3246   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3247
3248   // Build the animation
3249   float durationSeconds(1.0f);
3250   Animation animation = Animation::New(durationSeconds);
3251   Vector3 targetValue(20.0f, 20.0f, 20.0f);
3252   Vector3 relativeValue(targetValue - startValue);
3253   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3254
3255   Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3256
3257   // Start the animation
3258   animation.Play();
3259
3260   bool signalReceived(false);
3261   AnimationFinishCheck finishCheck(signalReceived);
3262   animation.FinishedSignal().Connect(&application, finishCheck);
3263
3264   application.SendNotification();
3265   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3266
3267   // We didn't expect the animation to finish yet
3268   application.SendNotification();
3269   finishCheck.CheckSignalNotReceived();
3270
3271   // The position should have moved more, than with a linear alpha function
3272   Vector3 current(actor.GetProperty<Vector3>(index));
3273   DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3274   DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3275   DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
3276
3277   application.SendNotification();
3278   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3279
3280   // We did expect the animation to finish
3281   application.SendNotification();
3282   finishCheck.CheckSignalReceived();
3283   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3284
3285   // Check that nothing has changed after a couple of buffer swaps
3286   application.Render(0);
3287   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3288   application.Render(0);
3289   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3290   END_TEST;
3291 }
3292
3293 int UtcDaliAnimationAnimateByVector3TimePeriodP(void)
3294 {
3295   TestApplication application;
3296
3297   Actor actor = Actor::New();
3298
3299   // Register a Vector3 property
3300   Vector3 startValue(10.0f, 10.0f, 10.0f);
3301   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3302   Stage::GetCurrent().Add(actor);
3303   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3304
3305   // Build the animation
3306   float durationSeconds(1.0f);
3307   Animation animation = Animation::New(durationSeconds);
3308   Vector3 targetValue(30.0f, 30.0f, 30.0f);
3309   Vector3 relativeValue(targetValue - startValue);
3310   float delay = 0.5f;
3311   animation.AnimateBy(Property(actor, index),
3312                       relativeValue,
3313                       TimePeriod(delay, durationSeconds - delay));
3314
3315   // Start the animation
3316   animation.Play();
3317
3318   bool signalReceived(false);
3319   AnimationFinishCheck finishCheck(signalReceived);
3320   animation.FinishedSignal().Connect(&application, finishCheck);
3321
3322   application.SendNotification();
3323   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3324
3325   // We didn't expect the animation to finish yet
3326   application.SendNotification();
3327   finishCheck.CheckSignalNotReceived();
3328   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3329
3330   application.SendNotification();
3331   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3332
3333   // We didn't expect the animation to finish yet
3334   application.SendNotification();
3335   finishCheck.CheckSignalNotReceived();
3336   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3337
3338   application.SendNotification();
3339   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3340
3341   // We did expect the animation to finish
3342   application.SendNotification();
3343   finishCheck.CheckSignalReceived();
3344   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3345
3346   // Check that nothing has changed after a couple of buffer swaps
3347   application.Render(0);
3348   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3349   application.Render(0);
3350   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3351   END_TEST;
3352 }
3353
3354 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void)
3355 {
3356   TestApplication application;
3357
3358   Actor actor = Actor::New();
3359
3360   // Register a Vector3 property
3361   Vector3 startValue(5.0f, 5.0f, 5.0f);
3362   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3363   Stage::GetCurrent().Add(actor);
3364   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3365
3366   // Build the animation
3367   float durationSeconds(1.0f);
3368   Animation animation = Animation::New(durationSeconds);
3369   Vector3 targetValue(10.0f, 10.0f, 10.0f);
3370   Vector3 relativeValue(targetValue - startValue);
3371   float delay = 0.5f;
3372   animation.AnimateBy(Property(actor, index),
3373                       relativeValue,
3374                       AlphaFunction::LINEAR,
3375                       TimePeriod(delay, durationSeconds - delay));
3376
3377   // Start the animation
3378   animation.Play();
3379
3380   bool signalReceived(false);
3381   AnimationFinishCheck finishCheck(signalReceived);
3382   animation.FinishedSignal().Connect(&application, finishCheck);
3383
3384   application.SendNotification();
3385   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3386
3387   // We didn't expect the animation to finish yet
3388   application.SendNotification();
3389   finishCheck.CheckSignalNotReceived();
3390   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3391
3392   application.SendNotification();
3393   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3394
3395   // We didn't expect the animation to finish yet
3396   application.SendNotification();
3397   finishCheck.CheckSignalNotReceived();
3398   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3399
3400   application.SendNotification();
3401   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3402
3403   // We did expect the animation to finish
3404   application.SendNotification();
3405   finishCheck.CheckSignalReceived();
3406   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3407
3408   // Check that nothing has changed after a couple of buffer swaps
3409   application.Render(0);
3410   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3411   application.Render(0);
3412   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3413   END_TEST;
3414 }
3415
3416 int UtcDaliAnimationAnimateByVector4P(void)
3417 {
3418   TestApplication application;
3419
3420   Actor actor = Actor::New();
3421
3422   // Register a Vector4 property
3423   Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
3424   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3425   Stage::GetCurrent().Add(actor);
3426   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3427
3428   // Build the animation
3429   float durationSeconds(2.0f);
3430   Animation animation = Animation::New(durationSeconds);
3431   Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f);
3432   Vector4 relativeValue(targetValue - startValue);
3433   animation.AnimateBy(Property(actor, index), relativeValue);
3434
3435   Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3436
3437   // Start the animation
3438   animation.Play();
3439
3440   bool signalReceived(false);
3441   AnimationFinishCheck finishCheck(signalReceived);
3442   animation.FinishedSignal().Connect(&application, finishCheck);
3443
3444   application.SendNotification();
3445   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3446
3447   // We didn't expect the animation to finish yet
3448   application.SendNotification();
3449   finishCheck.CheckSignalNotReceived();
3450   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION );
3451
3452   application.SendNotification();
3453   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3454
3455   // We did expect the animation to finish
3456   application.SendNotification();
3457   finishCheck.CheckSignalReceived();
3458   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3459
3460   // Check that nothing has changed after a couple of buffer swaps
3461   application.Render(0);
3462   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3463   application.Render(0);
3464   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3465   END_TEST;
3466 }
3467
3468 int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void)
3469 {
3470   TestApplication application;
3471
3472   Actor actor = Actor::New();
3473
3474   // Register a Vector4 property
3475   Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f);
3476   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3477   Stage::GetCurrent().Add(actor);
3478   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3479
3480   // Build the animation
3481   float durationSeconds(1.0f);
3482   Animation animation = Animation::New(durationSeconds);
3483   Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
3484   Vector4 relativeValue(targetValue - startValue);
3485   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3486
3487   Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3488
3489   // Start the animation
3490   animation.Play();
3491
3492   bool signalReceived(false);
3493   AnimationFinishCheck finishCheck(signalReceived);
3494   animation.FinishedSignal().Connect(&application, finishCheck);
3495
3496   application.SendNotification();
3497   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3498
3499   // We didn't expect the animation to finish yet
3500   application.SendNotification();
3501   finishCheck.CheckSignalNotReceived();
3502
3503   // The position should have moved more, than with a linear alpha function
3504   Vector4 current(actor.GetProperty<Vector4>(index));
3505   DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3506   DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3507   DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
3508   DALI_TEST_CHECK( current.w < ninetyFivePercentProgress.w );
3509
3510   application.SendNotification();
3511   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3512
3513   // We did expect the animation to finish
3514   application.SendNotification();
3515   finishCheck.CheckSignalReceived();
3516   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3517
3518   // Check that nothing has changed after a couple of buffer swaps
3519   application.Render(0);
3520   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3521   application.Render(0);
3522   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3523   END_TEST;
3524 }
3525
3526 int UtcDaliAnimationAnimateByVector4TimePeriodP(void)
3527 {
3528   TestApplication application;
3529
3530   Actor actor = Actor::New();
3531
3532   // Register a Vector4 property
3533   Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
3534   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3535   Stage::GetCurrent().Add(actor);
3536   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3537
3538   // Build the animation
3539   float durationSeconds(1.0f);
3540   Animation animation = Animation::New(durationSeconds);
3541   Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
3542   Vector4 relativeValue(targetValue - startValue);
3543   float delay = 0.5f;
3544   animation.AnimateBy(Property(actor, index),
3545                       relativeValue,
3546                       TimePeriod(delay, durationSeconds - delay));
3547
3548   // Start the animation
3549   animation.Play();
3550
3551   bool signalReceived(false);
3552   AnimationFinishCheck finishCheck(signalReceived);
3553   animation.FinishedSignal().Connect(&application, finishCheck);
3554
3555   application.SendNotification();
3556   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3557
3558   // We didn't expect the animation to finish yet
3559   application.SendNotification();
3560   finishCheck.CheckSignalNotReceived();
3561   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3562
3563   application.SendNotification();
3564   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3565
3566   // We didn't expect the animation to finish yet
3567   application.SendNotification();
3568   finishCheck.CheckSignalNotReceived();
3569   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3570
3571   application.SendNotification();
3572   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3573
3574   // We did expect the animation to finish
3575   application.SendNotification();
3576   finishCheck.CheckSignalReceived();
3577   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3578
3579   // Check that nothing has changed after a couple of buffer swaps
3580   application.Render(0);
3581   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3582   application.Render(0);
3583   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3584   END_TEST;
3585 }
3586
3587 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void)
3588 {
3589   TestApplication application;
3590
3591   Actor actor = Actor::New();
3592
3593   // Register a Vector4 property
3594   Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f);
3595   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3596   Stage::GetCurrent().Add(actor);
3597   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3598
3599   // Build the animation
3600   float durationSeconds(1.0f);
3601   Animation animation = Animation::New(durationSeconds);
3602   Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f);
3603   Vector4 relativeValue(targetValue - startValue);
3604   float delay = 0.5f;
3605   animation.AnimateBy(Property(actor, index),
3606                       relativeValue,
3607                       AlphaFunction::LINEAR,
3608                       TimePeriod(delay, durationSeconds - delay));
3609
3610   // Start the animation
3611   animation.Play();
3612
3613   bool signalReceived(false);
3614   AnimationFinishCheck finishCheck(signalReceived);
3615   animation.FinishedSignal().Connect(&application, finishCheck);
3616
3617   application.SendNotification();
3618   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3619
3620   // We didn't expect the animation to finish yet
3621   application.SendNotification();
3622   finishCheck.CheckSignalNotReceived();
3623   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3624
3625   application.SendNotification();
3626   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3627
3628   // We didn't expect the animation to finish yet
3629   application.SendNotification();
3630   finishCheck.CheckSignalNotReceived();
3631   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3632
3633   application.SendNotification();
3634   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3635
3636   // We did expect the animation to finish
3637   application.SendNotification();
3638   finishCheck.CheckSignalReceived();
3639   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3640
3641   // Check that nothing has changed after a couple of buffer swaps
3642   application.Render(0);
3643   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3644   application.Render(0);
3645   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3646   END_TEST;
3647 }
3648
3649 int UtcDaliAnimationAnimateByActorPositionP(void)
3650 {
3651   TestApplication application;
3652
3653   Actor actor = Actor::New();
3654   Vector3 startPosition(10.0f, 10.0f, 10.0f);
3655   actor.SetPosition(startPosition);
3656   Stage::GetCurrent().Add(actor);
3657   application.SendNotification();
3658   application.Render(0);
3659   DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
3660
3661   // Build the animation
3662   float durationSeconds(1.0f);
3663   Animation animation = Animation::New(durationSeconds);
3664   Vector3 targetPosition(20.0f, 20.0f, 20.0f);
3665   Vector3 relativePosition(targetPosition - startPosition);
3666   animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition);
3667
3668   Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
3669
3670   // Start the animation
3671   animation.Play();
3672
3673   bool signalReceived(false);
3674   AnimationFinishCheck finishCheck(signalReceived);
3675   animation.FinishedSignal().Connect(&application, finishCheck);
3676
3677   application.SendNotification();
3678   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3679
3680   // We didn't expect the animation to finish yet
3681   application.SendNotification();
3682   finishCheck.CheckSignalNotReceived();
3683   DALI_TEST_EQUALS( actor.GetCurrentPosition(), ninetyFivePercentProgress, TEST_LOCATION );
3684
3685   application.SendNotification();
3686   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3687
3688   // We did expect the animation to finish
3689   application.SendNotification();
3690   finishCheck.CheckSignalReceived();
3691   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3692
3693   // Check that nothing has changed after a couple of buffer swaps
3694   application.Render(0);
3695   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3696   application.Render(0);
3697   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3698   END_TEST;
3699 }
3700
3701 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
3702 {
3703   TestApplication application;
3704
3705   Actor actor = Actor::New();
3706   Vector3 startPosition(10.0f, 10.0f, 10.0f);
3707   actor.SetPosition(startPosition);
3708   Stage::GetCurrent().Add(actor);
3709   application.SendNotification();
3710   application.Render(0);
3711   DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
3712
3713   // Build the animation
3714   float durationSeconds(1.0f);
3715   Animation animation = Animation::New(durationSeconds);
3716   Vector3 targetPosition(20.0f, 20.0f, 20.0f);
3717   Vector3 relativePosition(targetPosition - startPosition);
3718   animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
3719
3720   Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
3721
3722   // Start the animation
3723   animation.Play();
3724
3725   bool signalReceived(false);
3726   AnimationFinishCheck finishCheck(signalReceived);
3727   animation.FinishedSignal().Connect(&application, finishCheck);
3728
3729   application.SendNotification();
3730   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3731
3732   // We didn't expect the animation to finish yet
3733   application.SendNotification();
3734   finishCheck.CheckSignalNotReceived();
3735
3736   // The position should have moved more, than with a linear alpha function
3737   Vector3 current(actor.GetCurrentPosition());
3738   DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
3739   DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
3740   DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
3741
3742   application.SendNotification();
3743   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3744
3745   // We did expect the animation to finish
3746   application.SendNotification();
3747   finishCheck.CheckSignalReceived();
3748   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3749
3750   // Check that nothing has changed after a couple of buffer swaps
3751   application.Render(0);
3752   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3753   application.Render(0);
3754   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3755   END_TEST;
3756 }
3757
3758 int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void)
3759 {
3760   TestApplication application;
3761
3762   Actor actor = Actor::New();
3763   Vector3 startPosition(10.0f, 10.0f, 10.0f);
3764   actor.SetPosition(startPosition);
3765   Stage::GetCurrent().Add(actor);
3766   application.SendNotification();
3767   application.Render(0);
3768   DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
3769
3770   // Build the animation
3771   float durationSeconds(1.0f);
3772   Animation animation = Animation::New(durationSeconds);
3773   Vector3 targetPosition(20.0f, 20.0f, 20.0f);
3774   Vector3 relativePosition(targetPosition - startPosition);
3775   float delay = 0.5f;
3776   animation.AnimateBy(Property(actor, Actor::Property::POSITION),
3777                       relativePosition,
3778                       TimePeriod(delay, durationSeconds - delay));
3779
3780   Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
3781
3782   // Start the animation
3783   animation.Play();
3784
3785   bool signalReceived(false);
3786   AnimationFinishCheck finishCheck(signalReceived);
3787   animation.FinishedSignal().Connect(&application, finishCheck);
3788
3789   application.SendNotification();
3790   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3791
3792   // We didn't expect the animation to finish yet
3793   application.SendNotification();
3794   finishCheck.CheckSignalNotReceived();
3795   DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
3796
3797   application.SendNotification();
3798   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
3799
3800   // We did expect the animation to finish
3801   application.SendNotification();
3802   finishCheck.CheckSignalReceived();
3803   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3804
3805   // Check that nothing has changed after a couple of buffer swaps
3806   application.Render(0);
3807   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3808   application.Render(0);
3809   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3810   END_TEST;
3811 }
3812
3813 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void)
3814 {
3815   TestApplication application;
3816
3817   Actor actor = Actor::New();
3818   Vector3 startPosition(10.0f, 10.0f, 10.0f);
3819   actor.SetPosition(startPosition);
3820   Stage::GetCurrent().Add(actor);
3821   application.SendNotification();
3822   application.Render(0);
3823   DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
3824
3825   // Build the animation
3826   float durationSeconds(1.0f);
3827   Animation animation = Animation::New(durationSeconds);
3828   Vector3 targetPosition(20.0f, 20.0f, 20.0f);
3829   Vector3 relativePosition(targetPosition - startPosition);
3830   float delay = 0.5f;
3831   animation.AnimateBy(Property(actor, Actor::Property::POSITION),
3832                       relativePosition,
3833                       AlphaFunction::LINEAR,
3834                       TimePeriod(delay, durationSeconds - delay));
3835
3836   Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
3837
3838   // Start the animation
3839   animation.Play();
3840
3841   bool signalReceived(false);
3842   AnimationFinishCheck finishCheck(signalReceived);
3843   animation.FinishedSignal().Connect(&application, finishCheck);
3844
3845   application.SendNotification();
3846   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3847
3848   // We didn't expect the animation to finish yet
3849   application.SendNotification();
3850   finishCheck.CheckSignalNotReceived();
3851   DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
3852
3853   application.SendNotification();
3854   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
3855
3856   // We did expect the animation to finish
3857   application.SendNotification();
3858   finishCheck.CheckSignalReceived();
3859   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3860
3861   // Check that nothing has changed after a couple of buffer swaps
3862   application.Render(0);
3863   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3864   application.Render(0);
3865   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
3866   END_TEST;
3867 }
3868
3869 int UtcDaliAnimationAnimateByActorOrientationP(void)
3870 {
3871   TestApplication application;
3872
3873   Actor actor = Actor::New();
3874   actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
3875   Stage::GetCurrent().Add(actor);
3876   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
3877
3878   // Build the animation
3879   float durationSeconds(1.0f);
3880   Animation animation = Animation::New(durationSeconds);
3881   Degree relativeRotationDegrees(360.0f);
3882   Radian relativeRotationRadians(relativeRotationDegrees);
3883   animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ) );
3884
3885   // Start the animation
3886   animation.Play();
3887
3888   bool signalReceived(false);
3889   AnimationFinishCheck finishCheck(signalReceived);
3890   animation.FinishedSignal().Connect(&application, finishCheck);
3891
3892   application.SendNotification();
3893   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
3894
3895   // We didn't expect the animation to finish yet
3896   application.SendNotification();
3897   finishCheck.CheckSignalNotReceived();
3898   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
3899
3900   application.SendNotification();
3901   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
3902
3903   // We didn't expect the animation to finish yet
3904   application.SendNotification();
3905   finishCheck.CheckSignalNotReceived();
3906   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
3907
3908   application.SendNotification();
3909   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
3910
3911   // We didn't expect the animation to finish yet
3912   application.SendNotification();
3913   finishCheck.CheckSignalNotReceived();
3914   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
3915
3916   application.SendNotification();
3917   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3918
3919   // We did expect the animation to finish
3920   application.SendNotification();
3921   finishCheck.CheckSignalReceived();
3922   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
3923   END_TEST;
3924 }
3925
3926 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
3927 {
3928   TestApplication application;
3929
3930   Actor actor = Actor::New();
3931   actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
3932   Stage::GetCurrent().Add(actor);
3933   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
3934
3935   // Build the animation
3936   float durationSeconds(1.0f);
3937   Animation animation = Animation::New(durationSeconds);
3938   Degree relativeRotationDegrees(360.0f);
3939   Radian relativeRotationRadians(relativeRotationDegrees);
3940   animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ), AlphaFunction::EASE_IN );
3941
3942   // Start the animation
3943   animation.Play();
3944
3945   bool signalReceived(false);
3946   AnimationFinishCheck finishCheck(signalReceived);
3947   animation.FinishedSignal().Connect(&application, finishCheck);
3948
3949   application.SendNotification();
3950   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
3951
3952   // We didn't expect the animation to finish yet
3953   application.SendNotification();
3954   finishCheck.CheckSignalNotReceived();
3955   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
3956
3957   application.SendNotification();
3958   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
3959
3960   // We didn't expect the animation to finish yet
3961   application.SendNotification();
3962   finishCheck.CheckSignalNotReceived();
3963   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
3964
3965   application.SendNotification();
3966   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
3967
3968   // We didn't expect the animation to finish yet
3969   application.SendNotification();
3970   finishCheck.CheckSignalNotReceived();
3971   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
3972
3973   application.SendNotification();
3974   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3975
3976   // We did expect the animation to finish
3977   application.SendNotification();
3978   finishCheck.CheckSignalReceived();
3979   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
3980   END_TEST;
3981 }
3982
3983 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void)
3984 {
3985   TestApplication application;
3986
3987   Actor actor = Actor::New();
3988   actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
3989   Stage::GetCurrent().Add(actor);
3990   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
3991
3992   // Build the animation
3993   float durationSeconds(1.0f);
3994   Animation animation = Animation::New(durationSeconds);
3995   Degree relativeRotationDegrees(360.0f);
3996   Radian relativeRotationRadians(relativeRotationDegrees);
3997   float delay = 0.3f;
3998   animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ),
3999                        AlphaFunction::EASE_IN, TimePeriod( delay, durationSeconds - delay ) );
4000
4001   // Start the animation
4002   animation.Play();
4003
4004   bool signalReceived(false);
4005   AnimationFinishCheck finishCheck(signalReceived);
4006   animation.FinishedSignal().Connect(&application, finishCheck);
4007
4008   application.SendNotification();
4009   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4010
4011   // We didn't expect the animation to finish yet
4012   application.SendNotification();
4013   finishCheck.CheckSignalNotReceived();
4014   float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
4015   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4016
4017   application.SendNotification();
4018   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4019
4020   // We didn't expect the animation to finish yet
4021   application.SendNotification();
4022   finishCheck.CheckSignalNotReceived();
4023   progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
4024   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4025
4026   application.SendNotification();
4027   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4028
4029   // We didn't expect the animation to finish yet
4030   application.SendNotification();
4031   finishCheck.CheckSignalNotReceived();
4032   progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
4033   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4034
4035   application.SendNotification();
4036   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4037
4038   // We did expect the animation to finish
4039   application.SendNotification();
4040   finishCheck.CheckSignalReceived();
4041   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4042   END_TEST;
4043 }
4044
4045 int UtcDaliAnimationAnimateByActorScaleP(void)
4046 {
4047   TestApplication application;
4048
4049   Actor actor = Actor::New();
4050   Stage::GetCurrent().Add(actor);
4051   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4052
4053   // Build the animation
4054   float durationSeconds(1.0f);
4055   Animation animation = Animation::New(durationSeconds);
4056   Vector3 targetScale(2.0f, 2.0f, 2.0f);
4057   Vector3 relativeScale(targetScale - Vector3::ONE);
4058   animation.AnimateBy( Property( actor, Actor::Property::SCALE ), Vector3( relativeScale.x, relativeScale.y, relativeScale.z ) );
4059
4060   Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale*0.99f);
4061
4062   // Start the animation
4063   animation.Play();
4064
4065   bool signalReceived(false);
4066   AnimationFinishCheck finishCheck(signalReceived);
4067   animation.FinishedSignal().Connect(&application, finishCheck);
4068
4069   application.SendNotification();
4070   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4071
4072   // We didn't expect the animation to finish yet
4073   application.SendNotification();
4074   finishCheck.CheckSignalNotReceived();
4075   DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
4076
4077   application.SendNotification();
4078   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4079
4080   // We did expect the animation to finish
4081   application.SendNotification();
4082   finishCheck.CheckSignalReceived();
4083   DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4084
4085   // Reset everything
4086   finishCheck.Reset();
4087   actor.SetScale(Vector3::ONE);
4088   application.SendNotification();
4089   application.Render(0);
4090   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4091
4092   // Repeat with a different (ease-in) alpha function
4093   animation = Animation::New(durationSeconds);
4094   animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::EASE_IN );
4095   animation.FinishedSignal().Connect(&application, finishCheck);
4096   animation.Play();
4097
4098   application.SendNotification();
4099   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4100
4101   // We didn't expect the animation to finish yet
4102   application.SendNotification();
4103   finishCheck.CheckSignalNotReceived();
4104
4105   // The scale should have grown less, than with a linear alpha function
4106   Vector3 current(actor.GetCurrentScale());
4107   DALI_TEST_CHECK( current.x > 1.0f );
4108   DALI_TEST_CHECK( current.y > 1.0f );
4109   DALI_TEST_CHECK( current.z > 1.0f );
4110   DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
4111   DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
4112   DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
4113
4114   application.SendNotification();
4115   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4116
4117   // We did expect the animation to finish
4118   application.SendNotification();
4119   finishCheck.CheckSignalReceived();
4120   DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4121
4122   // Reset everything
4123   finishCheck.Reset();
4124   actor.SetScale(Vector3::ONE);
4125   application.SendNotification();
4126   application.Render(0);
4127   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4128
4129   // Repeat with a delay
4130   float delay = 0.5f;
4131   animation = Animation::New(durationSeconds);
4132   animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
4133   animation.FinishedSignal().Connect(&application, finishCheck);
4134   animation.Play();
4135
4136   application.SendNotification();
4137   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4138
4139   // We didn't expect the animation to finish yet
4140   application.SendNotification();
4141   finishCheck.CheckSignalNotReceived();
4142   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4143
4144   application.SendNotification();
4145   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4146
4147   // We did expect the animation to finish
4148   application.SendNotification();
4149   finishCheck.CheckSignalReceived();
4150   DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4151   END_TEST;
4152 }
4153
4154 int UtcDaliAnimationAnimateToBooleanP(void)
4155 {
4156   TestApplication application;
4157
4158   Actor actor = Actor::New();
4159
4160   // Register a boolean property
4161   const bool startValue(false);
4162   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4163   Stage::GetCurrent().Add(actor);
4164   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4165
4166   // Build the animation
4167   float durationSeconds(2.0f);
4168   Animation animation = Animation::New(durationSeconds);
4169   const bool targetValue( !startValue );
4170   animation.AnimateTo(Property(actor, index), targetValue);
4171
4172   // Start the animation
4173   animation.Play();
4174
4175   bool signalReceived(false);
4176   AnimationFinishCheck finishCheck(signalReceived);
4177   animation.FinishedSignal().Connect(&application, finishCheck);
4178
4179   application.SendNotification();
4180   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4181
4182   // We didn't expect the animation to finish yet
4183   application.SendNotification();
4184   finishCheck.CheckSignalNotReceived();
4185   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4186
4187   application.SendNotification();
4188   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4189
4190   // We did expect the animation to finish
4191   application.SendNotification();
4192   finishCheck.CheckSignalReceived();
4193   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4194
4195   // Check that nothing has changed after a couple of buffer swaps
4196   application.Render(0);
4197   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4198   application.Render(0);
4199   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4200
4201   // Repeat with target value "false"
4202   animation = Animation::New(durationSeconds);
4203   const bool finalValue( !targetValue );
4204   animation.AnimateTo(Property(actor, index), finalValue);
4205
4206   // Start the animation
4207   animation.Play();
4208
4209   finishCheck.Reset();
4210   animation.FinishedSignal().Connect(&application, finishCheck);
4211
4212   application.SendNotification();
4213   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4214
4215   // We didn't expect the animation to finish yet
4216   application.SendNotification();
4217   finishCheck.CheckSignalNotReceived();
4218   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4219
4220   application.SendNotification();
4221   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4222
4223   // We did expect the animation to finish
4224   application.SendNotification();
4225   finishCheck.CheckSignalReceived();
4226   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4227
4228   // Check that nothing has changed after a couple of buffer swaps
4229   application.Render(0);
4230   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4231   application.Render(0);
4232   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4233   END_TEST;
4234 }
4235
4236 int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void)
4237 {
4238   TestApplication application;
4239
4240   Actor actor = Actor::New();
4241
4242   // Register a boolean property
4243   const bool startValue(false);
4244   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4245   Stage::GetCurrent().Add(actor);
4246   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4247
4248   // Build the animation
4249   float durationSeconds(2.0f);
4250   Animation animation = Animation::New(durationSeconds);
4251   const bool targetValue( !startValue );
4252   animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
4253
4254   // Start the animation
4255   animation.Play();
4256
4257   bool signalReceived(false);
4258   AnimationFinishCheck finishCheck(signalReceived);
4259   animation.FinishedSignal().Connect(&application, finishCheck);
4260
4261   application.SendNotification();
4262   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4263
4264   // We didn't expect the animation to finish yet
4265   application.SendNotification();
4266   finishCheck.CheckSignalNotReceived();
4267   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4268
4269   application.SendNotification();
4270   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4271
4272   // We did expect the animation to finish
4273   application.SendNotification();
4274   finishCheck.CheckSignalReceived();
4275   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4276
4277   // Check that nothing has changed after a couple of buffer swaps
4278   application.Render(0);
4279   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4280   application.Render(0);
4281   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4282
4283   // Repeat with target value "false"
4284   animation = Animation::New(durationSeconds);
4285   const bool finalValue( !targetValue );
4286   animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
4287
4288   // Start the animation
4289   animation.Play();
4290
4291   finishCheck.Reset();
4292   animation.FinishedSignal().Connect(&application, finishCheck);
4293
4294   application.SendNotification();
4295   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4296
4297   // We didn't expect the animation to finish yet
4298   application.SendNotification();
4299   finishCheck.CheckSignalNotReceived();
4300   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4301
4302   application.SendNotification();
4303   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4304
4305   // We did expect the animation to finish
4306   application.SendNotification();
4307   finishCheck.CheckSignalReceived();
4308   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4309
4310   // Check that nothing has changed after a couple of buffer swaps
4311   application.Render(0);
4312   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4313   application.Render(0);
4314   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4315   END_TEST;
4316 }
4317
4318 int UtcDaliAnimationAnimateToBooleanTimePeriodP(void)
4319 {
4320   TestApplication application;
4321
4322   Actor actor = Actor::New();
4323
4324   // Register a boolean property
4325   bool startValue(false);
4326   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4327   Stage::GetCurrent().Add(actor);
4328   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4329
4330   // Build the animation
4331   float durationSeconds(2.0f);
4332   Animation animation = Animation::New(durationSeconds);
4333   bool finalValue( !startValue );
4334   float animatorDurationSeconds(durationSeconds * 0.5f);
4335   animation.AnimateTo( Property(actor, index),
4336                        finalValue,
4337                        TimePeriod( animatorDurationSeconds ) );
4338
4339   // Start the animation
4340   animation.Play();
4341
4342   bool signalReceived(false);
4343   AnimationFinishCheck finishCheck(signalReceived);
4344   animation.FinishedSignal().Connect(&application, finishCheck);
4345
4346   application.SendNotification();
4347   application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
4348
4349   // We didn't expect the animation to finish yet
4350   application.SendNotification();
4351   finishCheck.CheckSignalNotReceived();
4352   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4353
4354   application.SendNotification();
4355   application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
4356
4357   // We didn't expect the animation to finish yet...
4358   application.SendNotification();
4359   finishCheck.CheckSignalNotReceived();
4360
4361   // ...however we should have reached the final value
4362   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4363
4364   application.SendNotification();
4365   application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
4366
4367   // We did expect the animation to finish
4368   application.SendNotification();
4369   finishCheck.CheckSignalReceived();
4370   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4371
4372   // Check that nothing has changed after a couple of buffer swaps
4373   application.Render(0);
4374   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4375   application.Render(0);
4376   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4377   END_TEST;
4378 }
4379
4380 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void)
4381 {
4382   TestApplication application;
4383
4384   Actor actor = Actor::New();
4385
4386   // Register a boolean property
4387   bool startValue(false);
4388   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4389   Stage::GetCurrent().Add(actor);
4390   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4391
4392   // Build the animation
4393   float durationSeconds(2.0f);
4394   Animation animation = Animation::New(durationSeconds);
4395   bool finalValue( !startValue );
4396   float animatorDurationSeconds(durationSeconds * 0.5f);
4397   animation.AnimateTo( Property(actor, index),
4398                        finalValue,
4399                        AlphaFunction::LINEAR,
4400                        TimePeriod( animatorDurationSeconds ) );
4401
4402   // Start the animation
4403   animation.Play();
4404
4405   bool signalReceived(false);
4406   AnimationFinishCheck finishCheck(signalReceived);
4407   animation.FinishedSignal().Connect(&application, finishCheck);
4408
4409   application.SendNotification();
4410   application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
4411
4412   // We didn't expect the animation to finish yet
4413   application.SendNotification();
4414   finishCheck.CheckSignalNotReceived();
4415   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4416
4417   application.SendNotification();
4418   application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
4419
4420   // We didn't expect the animation to finish yet...
4421   application.SendNotification();
4422   finishCheck.CheckSignalNotReceived();
4423
4424   // ...however we should have reached the final value
4425   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4426
4427   application.SendNotification();
4428   application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
4429
4430   // We did expect the animation to finish
4431   application.SendNotification();
4432   finishCheck.CheckSignalReceived();
4433   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4434
4435   // Check that nothing has changed after a couple of buffer swaps
4436   application.Render(0);
4437   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4438   application.Render(0);
4439   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4440   END_TEST;
4441 }
4442
4443 int UtcDaliAnimationAnimateToFloatP(void)
4444 {
4445   TestApplication application;
4446
4447   Actor actor = Actor::New();
4448
4449   // Register a float property
4450   float startValue(10.0f);
4451   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4452   Stage::GetCurrent().Add(actor);
4453   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
4454
4455   // Build the animation
4456   float durationSeconds(2.0f);
4457   Animation animation = Animation::New(durationSeconds);
4458   float targetValue(50.0f);
4459   float relativeValue(targetValue - startValue);
4460   animation.AnimateTo(Property(actor, "testProperty"), targetValue);
4461
4462   float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4463
4464   // Start the animation
4465   animation.Play();
4466
4467   bool signalReceived(false);
4468   AnimationFinishCheck finishCheck(signalReceived);
4469   animation.FinishedSignal().Connect(&application, finishCheck);
4470
4471   application.SendNotification();
4472   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4473
4474   // We didn't expect the animation to finish yet
4475   application.SendNotification();
4476   finishCheck.CheckSignalNotReceived();
4477   DALI_TEST_EQUALS( actor.GetProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION );
4478
4479   application.SendNotification();
4480   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4481
4482   // We did expect the animation to finish
4483   application.SendNotification();
4484   finishCheck.CheckSignalReceived();
4485   DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
4486   END_TEST;
4487 }
4488
4489 int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void)
4490 {
4491   TestApplication application;
4492
4493   Actor actor = Actor::New();
4494
4495   // Register a float property
4496   float startValue(10.0f);
4497   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4498   Stage::GetCurrent().Add(actor);
4499   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
4500
4501   // Build the animation
4502   float durationSeconds(1.0f);
4503   Animation animation = Animation::New(durationSeconds);
4504   float targetValue(90.0f);
4505   float relativeValue(targetValue - startValue);
4506   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
4507
4508   float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4509
4510   // Start the animation
4511   animation.Play();
4512
4513   bool signalReceived(false);
4514   AnimationFinishCheck finishCheck(signalReceived);
4515   animation.FinishedSignal().Connect(&application, finishCheck);
4516
4517   application.SendNotification();
4518   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4519
4520   // We didn't expect the animation to finish yet
4521   application.SendNotification();
4522   finishCheck.CheckSignalNotReceived();
4523
4524   // The position should have moved more, than with a linear alpha function
4525   float current(actor.GetProperty<float>(index));
4526   DALI_TEST_CHECK( current > ninetyFivePercentProgress );
4527
4528   application.SendNotification();
4529   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4530
4531   // We did expect the animation to finish
4532   application.SendNotification();
4533   finishCheck.CheckSignalReceived();
4534   DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
4535   END_TEST;
4536 }
4537
4538 int UtcDaliAnimationAnimateToFloatTimePeriodP(void)
4539 {
4540   TestApplication application;
4541
4542   Actor actor = Actor::New();
4543
4544   // Register a float property
4545   float startValue(10.0f);
4546   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4547   Stage::GetCurrent().Add(actor);
4548   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
4549
4550   // Build the animation
4551   float durationSeconds(1.0f);
4552   Animation animation = Animation::New(durationSeconds);
4553   float targetValue(30.0f);
4554   float relativeValue(targetValue - startValue);
4555   float delay = 0.5f;
4556   animation.AnimateTo(Property(actor, index),
4557                       targetValue,
4558                       TimePeriod(delay, durationSeconds - delay));
4559
4560   // Start the animation
4561   animation.Play();
4562
4563   bool signalReceived(false);
4564   AnimationFinishCheck finishCheck(signalReceived);
4565   animation.FinishedSignal().Connect(&application, finishCheck);
4566
4567   application.SendNotification();
4568   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4569
4570   // We didn't expect the animation to finish yet
4571   application.SendNotification();
4572   finishCheck.CheckSignalNotReceived();
4573   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
4574
4575   application.SendNotification();
4576   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4577
4578   // We didn't expect the animation to finish yet
4579   application.SendNotification();
4580   finishCheck.CheckSignalNotReceived();
4581   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
4582
4583   application.SendNotification();
4584   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4585
4586   // We did expect the animation to finish
4587   application.SendNotification();
4588   finishCheck.CheckSignalReceived();
4589   DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
4590   END_TEST;
4591 }
4592
4593 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void)
4594 {
4595   TestApplication application;
4596
4597   Actor actor = Actor::New();
4598
4599   // Register a float property
4600   float startValue(10.0f);
4601   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4602   Stage::GetCurrent().Add(actor);
4603   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
4604
4605   // Build the animation
4606   float durationSeconds(1.0f);
4607   Animation animation = Animation::New(durationSeconds);
4608   float targetValue(30.0f);
4609   float relativeValue(targetValue - startValue);
4610   float delay = 0.5f;
4611   animation.AnimateTo(Property(actor, index),
4612                       targetValue,
4613                       AlphaFunction::LINEAR,
4614                       TimePeriod(delay, durationSeconds - delay));
4615
4616   // Start the animation
4617   animation.Play();
4618
4619   bool signalReceived(false);
4620   AnimationFinishCheck finishCheck(signalReceived);
4621   animation.FinishedSignal().Connect(&application, finishCheck);
4622
4623   application.SendNotification();
4624   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4625
4626   // We didn't expect the animation to finish yet
4627   application.SendNotification();
4628   finishCheck.CheckSignalNotReceived();
4629   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
4630
4631   application.SendNotification();
4632   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4633
4634   // We didn't expect the animation to finish yet
4635   application.SendNotification();
4636   finishCheck.CheckSignalNotReceived();
4637   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
4638
4639   application.SendNotification();
4640   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4641
4642   // We did expect the animation to finish
4643   application.SendNotification();
4644   finishCheck.CheckSignalReceived();
4645   DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
4646   END_TEST;
4647 }
4648
4649 int UtcDaliAnimationAnimateToIntegerP(void)
4650 {
4651   TestApplication application;
4652
4653   Actor actor = Actor::New();
4654
4655   // Register an integer property
4656   int startValue(10);
4657   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4658   Stage::GetCurrent().Add(actor);
4659   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
4660
4661   // Build the animation
4662   float durationSeconds(2.0f);
4663   Animation animation = Animation::New(durationSeconds);
4664   int targetValue(50);
4665   int relativeValue(targetValue - startValue);
4666   animation.AnimateTo(Property(actor, "testProperty"), targetValue);
4667
4668   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
4669
4670   // Start the animation
4671   animation.Play();
4672
4673   bool signalReceived(false);
4674   AnimationFinishCheck finishCheck(signalReceived);
4675   animation.FinishedSignal().Connect(&application, finishCheck);
4676
4677   application.SendNotification();
4678   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4679
4680   // We didn't expect the animation to finish yet
4681   application.SendNotification();
4682   finishCheck.CheckSignalNotReceived();
4683   DALI_TEST_EQUALS( actor.GetProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION );
4684
4685   application.SendNotification();
4686   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4687
4688   // We did expect the animation to finish
4689   application.SendNotification();
4690   finishCheck.CheckSignalReceived();
4691   DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
4692   END_TEST;
4693 }
4694
4695 int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void)
4696 {
4697   TestApplication application;
4698
4699   Actor actor = Actor::New();
4700
4701   // Register an integer property
4702   int startValue(10);
4703   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4704   Stage::GetCurrent().Add(actor);
4705   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
4706
4707   // Build the animation
4708   float durationSeconds(1.0f);
4709   Animation animation = Animation::New(durationSeconds);
4710   int targetValue(90);
4711   int relativeValue(targetValue - startValue);
4712   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
4713
4714   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
4715
4716   // Start the animation
4717   animation.Play();
4718
4719   bool signalReceived(false);
4720   AnimationFinishCheck finishCheck(signalReceived);
4721   animation.FinishedSignal().Connect(&application, finishCheck);
4722
4723   application.SendNotification();
4724   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4725
4726   // We didn't expect the animation to finish yet
4727   application.SendNotification();
4728   finishCheck.CheckSignalNotReceived();
4729
4730   // The position should have moved more, than with a linear alpha function
4731   int current(actor.GetProperty<int>(index));
4732   DALI_TEST_CHECK( current > ninetyFivePercentProgress );
4733
4734   application.SendNotification();
4735   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4736
4737   // We did expect the animation to finish
4738   application.SendNotification();
4739   finishCheck.CheckSignalReceived();
4740   DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
4741   END_TEST;
4742 }
4743
4744 int UtcDaliAnimationAnimateToIntegerTimePeriodP(void)
4745 {
4746   TestApplication application;
4747
4748   Actor actor = Actor::New();
4749
4750   // Register an integer property
4751   int startValue(10);
4752   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4753   Stage::GetCurrent().Add(actor);
4754   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
4755
4756   // Build the animation
4757   float durationSeconds(1.0f);
4758   Animation animation = Animation::New(durationSeconds);
4759   int targetValue(30);
4760   int relativeValue(targetValue - startValue);
4761   float delay = 0.5f;
4762   animation.AnimateTo(Property(actor, index),
4763                       targetValue,
4764                       TimePeriod(delay, durationSeconds - delay));
4765
4766   // Start the animation
4767   animation.Play();
4768
4769   bool signalReceived(false);
4770   AnimationFinishCheck finishCheck(signalReceived);
4771   animation.FinishedSignal().Connect(&application, finishCheck);
4772
4773   application.SendNotification();
4774   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4775
4776   // We didn't expect the animation to finish yet
4777   application.SendNotification();
4778   finishCheck.CheckSignalNotReceived();
4779   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
4780
4781   application.SendNotification();
4782   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4783
4784   // We didn't expect the animation to finish yet
4785   application.SendNotification();
4786   finishCheck.CheckSignalNotReceived();
4787   DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
4788
4789   application.SendNotification();
4790   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4791
4792   // We did expect the animation to finish
4793   application.SendNotification();
4794   finishCheck.CheckSignalReceived();
4795   DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
4796   END_TEST;
4797 }
4798
4799 int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void)
4800 {
4801   TestApplication application;
4802
4803   Actor actor = Actor::New();
4804
4805   // Register an integer property
4806   int startValue(10);
4807   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4808   Stage::GetCurrent().Add(actor);
4809   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
4810
4811   // Build the animation
4812   float durationSeconds(1.0f);
4813   Animation animation = Animation::New(durationSeconds);
4814   int targetValue(30);
4815   int relativeValue(targetValue - startValue);
4816   float delay = 0.5f;
4817   animation.AnimateTo(Property(actor, index),
4818                       targetValue,
4819                       AlphaFunction::LINEAR,
4820                       TimePeriod(delay, durationSeconds - delay));
4821
4822   // Start the animation
4823   animation.Play();
4824
4825   bool signalReceived(false);
4826   AnimationFinishCheck finishCheck(signalReceived);
4827   animation.FinishedSignal().Connect(&application, finishCheck);
4828
4829   application.SendNotification();
4830   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4831
4832   // We didn't expect the animation to finish yet
4833   application.SendNotification();
4834   finishCheck.CheckSignalNotReceived();
4835   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
4836
4837   application.SendNotification();
4838   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4839
4840   // We didn't expect the animation to finish yet
4841   application.SendNotification();
4842   finishCheck.CheckSignalNotReceived();
4843   DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
4844
4845   application.SendNotification();
4846   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4847
4848   // We did expect the animation to finish
4849   application.SendNotification();
4850   finishCheck.CheckSignalReceived();
4851   DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
4852   END_TEST;
4853 }
4854
4855 int UtcDaliAnimationAnimateToVector2P(void)
4856 {
4857   TestApplication application;
4858
4859   Actor actor = Actor::New();
4860
4861   // Register a Vector2 property
4862   Vector2 startValue(-50.0f, -50.0f);
4863   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4864   Stage::GetCurrent().Add(actor);
4865   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
4866
4867   // Build the animation
4868   float durationSeconds(2.0f);
4869   Animation animation = Animation::New(durationSeconds);
4870   Vector2 targetValue(50.0f, 50.0f);
4871   Vector2 relativeValue(targetValue - startValue);
4872   animation.AnimateTo(Property(actor, index), targetValue);
4873
4874   Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4875
4876   // Start the animation
4877   animation.Play();
4878
4879   bool signalReceived(false);
4880   AnimationFinishCheck finishCheck(signalReceived);
4881   animation.FinishedSignal().Connect(&application, finishCheck);
4882
4883   application.SendNotification();
4884   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4885
4886   // We didn't expect the animation to finish yet
4887   application.SendNotification();
4888   finishCheck.CheckSignalNotReceived();
4889   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION );
4890
4891   application.SendNotification();
4892   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4893
4894   // We did expect the animation to finish
4895   application.SendNotification();
4896   finishCheck.CheckSignalReceived();
4897   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
4898   END_TEST;
4899 }
4900
4901 int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void)
4902 {
4903   TestApplication application;
4904
4905   Actor actor = Actor::New();
4906
4907   // Register a Vector2 property
4908   Vector2 startValue(1000.0f, 1000.0f);
4909   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4910   Stage::GetCurrent().Add(actor);
4911   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
4912
4913   // Build the animation
4914   float durationSeconds(1.0f);
4915   Animation animation = Animation::New(durationSeconds);
4916   Vector2 targetValue(9000.0f, 9000.0f);
4917   Vector2 relativeValue(targetValue - startValue);
4918   animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
4919
4920   Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4921
4922   // Start the animation
4923   animation.Play();
4924
4925   bool signalReceived(false);
4926   AnimationFinishCheck finishCheck(signalReceived);
4927   animation.FinishedSignal().Connect(&application, finishCheck);
4928
4929   application.SendNotification();
4930   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4931
4932   // We didn't expect the animation to finish yet
4933   application.SendNotification();
4934   finishCheck.CheckSignalNotReceived();
4935
4936   // The position should have moved more, than with a linear alpha function
4937   Vector2 current(actor.GetProperty<Vector2>(index));
4938   DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
4939   DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
4940
4941   application.SendNotification();
4942   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4943
4944   // We did expect the animation to finish
4945   application.SendNotification();
4946   finishCheck.CheckSignalReceived();
4947   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
4948   END_TEST;
4949 }
4950
4951 int UtcDaliAnimationAnimateToVector2TimePeriodP(void)
4952 {
4953   TestApplication application;
4954
4955   Actor actor = Actor::New();
4956
4957   // Register a Vector2 property
4958   Vector2 startValue(10.0f, 10.0f);
4959   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4960   Stage::GetCurrent().Add(actor);
4961   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
4962
4963   // Build the animation
4964   float durationSeconds(1.0f);
4965   Animation animation = Animation::New(durationSeconds);
4966   Vector2 targetValue(-10.0f, 20.0f);
4967   Vector2 relativeValue(targetValue - startValue);
4968   float delay = 0.5f;
4969   animation.AnimateTo(Property(actor, index),
4970                       targetValue,
4971                       TimePeriod(delay, durationSeconds - delay));
4972
4973   // Start the animation
4974   animation.Play();
4975
4976   bool signalReceived(false);
4977   AnimationFinishCheck finishCheck(signalReceived);
4978   animation.FinishedSignal().Connect(&application, finishCheck);
4979
4980   application.SendNotification();
4981   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4982
4983   // We didn't expect the animation to finish yet
4984   application.SendNotification();
4985   finishCheck.CheckSignalNotReceived();
4986   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
4987
4988   application.SendNotification();
4989   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4990
4991   // We didn't expect the animation to finish yet
4992   application.SendNotification();
4993   finishCheck.CheckSignalNotReceived();
4994   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
4995
4996   application.SendNotification();
4997   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4998
4999   // We did expect the animation to finish
5000   application.SendNotification();
5001   finishCheck.CheckSignalReceived();
5002   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
5003   END_TEST;
5004 }
5005
5006 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void)
5007 {
5008   TestApplication application;
5009
5010   Actor actor = Actor::New();
5011
5012   // Register a Vector2 property
5013   Vector2 startValue(10.0f, 10.0f);
5014   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5015   Stage::GetCurrent().Add(actor);
5016   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
5017
5018   // Build the animation
5019   float durationSeconds(1.0f);
5020   Animation animation = Animation::New(durationSeconds);
5021   Vector2 targetValue(30.0f, 30.0f);
5022   Vector2 relativeValue(targetValue - startValue);
5023   float delay = 0.5f;
5024   animation.AnimateTo(Property(actor, index),
5025                       targetValue,
5026                       AlphaFunction::LINEAR,
5027                       TimePeriod(delay, durationSeconds - delay));
5028
5029   // Start the animation
5030   animation.Play();
5031
5032   bool signalReceived(false);
5033   AnimationFinishCheck finishCheck(signalReceived);
5034   animation.FinishedSignal().Connect(&application, finishCheck);
5035
5036   application.SendNotification();
5037   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5038
5039   // We didn't expect the animation to finish yet
5040   application.SendNotification();
5041   finishCheck.CheckSignalNotReceived();
5042   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
5043
5044   application.SendNotification();
5045   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5046
5047   // We didn't expect the animation to finish yet
5048   application.SendNotification();
5049   finishCheck.CheckSignalNotReceived();
5050   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5051
5052   application.SendNotification();
5053   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5054
5055   // We did expect the animation to finish
5056   application.SendNotification();
5057   finishCheck.CheckSignalReceived();
5058   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
5059   END_TEST;
5060 }
5061
5062 int UtcDaliAnimationAnimateToVector3P(void)
5063 {
5064   TestApplication application;
5065
5066   Actor actor = Actor::New();
5067
5068   // Register a Vector3 property
5069   Vector3 startValue(-50.0f, -50.0f, -50.0f);
5070   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5071   Stage::GetCurrent().Add(actor);
5072   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5073
5074   // Build the animation
5075   float durationSeconds(2.0f);
5076   Animation animation = Animation::New(durationSeconds);
5077   Vector3 targetValue(50.0f, 50.0f, 50.0f);
5078   Vector3 relativeValue(targetValue - startValue);
5079   animation.AnimateTo(Property(actor, index), targetValue);
5080
5081   Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5082
5083   // Start the animation
5084   animation.Play();
5085
5086   bool signalReceived(false);
5087   AnimationFinishCheck finishCheck(signalReceived);
5088   animation.FinishedSignal().Connect(&application, finishCheck);
5089
5090   application.SendNotification();
5091   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5092
5093   // We didn't expect the animation to finish yet
5094   application.SendNotification();
5095   finishCheck.CheckSignalNotReceived();
5096   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION );
5097
5098   application.SendNotification();
5099   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5100
5101   // We did expect the animation to finish
5102   application.SendNotification();
5103   finishCheck.CheckSignalReceived();
5104   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
5105   END_TEST;
5106 }
5107
5108 int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void)
5109 {
5110   TestApplication application;
5111
5112   Actor actor = Actor::New();
5113
5114   // Register a Vector3 property
5115   Vector3 startValue(1000.0f, 1000.0f, 1000.0f);
5116   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5117   Stage::GetCurrent().Add(actor);
5118   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5119
5120   // Build the animation
5121   float durationSeconds(1.0f);
5122   Animation animation = Animation::New(durationSeconds);
5123   Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
5124   Vector3 relativeValue(targetValue - startValue);
5125   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5126
5127   Vector3 ninetyFivePercentProgress(startValue + relativeValue*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*950.0f)/* 95% progress */);
5138
5139   // We didn't expect the animation to finish yet
5140   application.SendNotification();
5141   finishCheck.CheckSignalNotReceived();
5142
5143   // The position should have moved more, than with a linear alpha function
5144   Vector3 current(actor.GetProperty<Vector3>(index));
5145   DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
5146   DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
5147   DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
5148
5149   application.SendNotification();
5150   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5151
5152   // We did expect the animation to finish
5153   application.SendNotification();
5154   finishCheck.CheckSignalReceived();
5155   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
5156   END_TEST;
5157 }
5158
5159 int UtcDaliAnimationAnimateToVector3TimePeriodP(void)
5160 {
5161   TestApplication application;
5162
5163   Actor actor = Actor::New();
5164
5165   // Register a Vector3 property
5166   Vector3 startValue(10.0f, 10.0f, 10.0f);
5167   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5168   Stage::GetCurrent().Add(actor);
5169   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5170
5171   // Build the animation
5172   float durationSeconds(1.0f);
5173   Animation animation = Animation::New(durationSeconds);
5174   Vector3 targetValue(-10.0f, 20.0f, 100.0f);
5175   Vector3 relativeValue(targetValue - startValue);
5176   float delay = 0.5f;
5177   animation.AnimateTo(Property(actor, index),
5178                       targetValue,
5179                       TimePeriod(delay, durationSeconds - delay));
5180
5181   // Start the animation
5182   animation.Play();
5183
5184   bool signalReceived(false);
5185   AnimationFinishCheck finishCheck(signalReceived);
5186   animation.FinishedSignal().Connect(&application, finishCheck);
5187
5188   application.SendNotification();
5189   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5190
5191   // We didn't expect the animation to finish yet
5192   application.SendNotification();
5193   finishCheck.CheckSignalNotReceived();
5194   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5195
5196   application.SendNotification();
5197   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5198
5199   // We didn't expect the animation to finish yet
5200   application.SendNotification();
5201   finishCheck.CheckSignalNotReceived();
5202   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5203
5204   application.SendNotification();
5205   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5206
5207   // We did expect the animation to finish
5208   application.SendNotification();
5209   finishCheck.CheckSignalReceived();
5210   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
5211   END_TEST;
5212 }
5213
5214 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void)
5215 {
5216   TestApplication application;
5217
5218   Actor actor = Actor::New();
5219
5220   // Register a Vector3 property
5221   Vector3 startValue(10.0f, 10.0f, 10.0f);
5222   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5223   Stage::GetCurrent().Add(actor);
5224   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5225
5226   // Build the animation
5227   float durationSeconds(1.0f);
5228   Animation animation = Animation::New(durationSeconds);
5229   Vector3 targetValue(30.0f, 30.0f, 30.0f);
5230   Vector3 relativeValue(targetValue - startValue);
5231   float delay = 0.5f;
5232   animation.AnimateTo(Property(actor, "testProperty"),
5233                       targetValue,
5234                       AlphaFunction::LINEAR,
5235                       TimePeriod(delay, durationSeconds - delay));
5236
5237   // Start the animation
5238   animation.Play();
5239
5240   bool signalReceived(false);
5241   AnimationFinishCheck finishCheck(signalReceived);
5242   animation.FinishedSignal().Connect(&application, finishCheck);
5243
5244   application.SendNotification();
5245   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5246
5247   // We didn't expect the animation to finish yet
5248   application.SendNotification();
5249   finishCheck.CheckSignalNotReceived();
5250   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5251
5252   application.SendNotification();
5253   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5254
5255   // We didn't expect the animation to finish yet
5256   application.SendNotification();
5257   finishCheck.CheckSignalNotReceived();
5258   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5259
5260   application.SendNotification();
5261   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5262
5263   // We did expect the animation to finish
5264   application.SendNotification();
5265   finishCheck.CheckSignalReceived();
5266   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
5267   END_TEST;
5268 }
5269
5270 int UtcDaliAnimationAnimateToVector3ComponentP(void)
5271 {
5272   TestApplication application;
5273
5274   Actor actor = Actor::New();
5275
5276   // Register a Vector3 property
5277   Vector3 startValue(10.0f, 10.0f, 10.0f);
5278   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5279   Stage::GetCurrent().Add(actor);
5280   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5281
5282   // Build the animation
5283   float durationSeconds(1.0f);
5284   Animation animation = Animation::New(durationSeconds);
5285   Vector3 targetValue(30.0f, 30.0f, 10.0f);
5286   Vector3 relativeValue(targetValue - startValue);
5287   float delay = 0.5f;
5288   animation.AnimateTo(Property(actor, "testProperty",  0),
5289                       30.0f,
5290                       AlphaFunction::LINEAR,
5291                       TimePeriod(delay, durationSeconds - delay));
5292   animation.AnimateTo(Property(actor, index, 1),
5293                       30.0f,
5294                       AlphaFunction::LINEAR,
5295                       TimePeriod(delay, durationSeconds - delay));
5296
5297   // Start the animation
5298   animation.Play();
5299
5300   bool signalReceived(false);
5301   AnimationFinishCheck finishCheck(signalReceived);
5302   animation.FinishedSignal().Connect(&application, finishCheck);
5303
5304   application.SendNotification();
5305   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5306
5307   // We didn't expect the animation to finish yet
5308   application.SendNotification();
5309   finishCheck.CheckSignalNotReceived();
5310   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5311
5312   application.SendNotification();
5313   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5314
5315   // We didn't expect the animation to finish yet
5316   application.SendNotification();
5317   finishCheck.CheckSignalNotReceived();
5318   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5319
5320   application.SendNotification();
5321   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5322
5323   // We did expect the animation to finish
5324   application.SendNotification();
5325   finishCheck.CheckSignalReceived();
5326   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
5327   END_TEST;
5328 }
5329
5330 int UtcDaliAnimationAnimateToVector4P(void)
5331 {
5332   TestApplication application;
5333
5334   Actor actor = Actor::New();
5335
5336   // Register a Vector4 property
5337   Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f);
5338   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5339   Stage::GetCurrent().Add(actor);
5340   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
5341
5342   // Build the animation
5343   float durationSeconds(2.0f);
5344   Animation animation = Animation::New(durationSeconds);
5345   Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f);
5346   Vector4 relativeValue(targetValue - startValue);
5347   animation.AnimateTo(Property(actor, index), targetValue);
5348
5349   Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5350
5351   // Start the animation
5352   animation.Play();
5353
5354   bool signalReceived(false);
5355   AnimationFinishCheck finishCheck(signalReceived);
5356   animation.FinishedSignal().Connect(&application, finishCheck);
5357
5358   application.SendNotification();
5359   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5360
5361   // We didn't expect the animation to finish yet
5362   application.SendNotification();
5363   finishCheck.CheckSignalNotReceived();
5364   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION );
5365
5366   application.SendNotification();
5367   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5368
5369   // We did expect the animation to finish
5370   application.SendNotification();
5371   finishCheck.CheckSignalReceived();
5372   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
5373   END_TEST;
5374 }
5375
5376 int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void)
5377 {
5378   TestApplication application;
5379
5380   Actor actor = Actor::New();
5381
5382   // Register a Vector4 property
5383   Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
5384   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5385   Stage::GetCurrent().Add(actor);
5386   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
5387
5388   // Build the animation
5389   float durationSeconds(1.0f);
5390   Animation animation = Animation::New(durationSeconds);
5391   Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
5392   Vector4 relativeValue(targetValue - startValue);
5393   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5394
5395   Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5396
5397   // Start the animation
5398   animation.Play();
5399
5400   bool signalReceived(false);
5401   AnimationFinishCheck finishCheck(signalReceived);
5402   animation.FinishedSignal().Connect(&application, finishCheck);
5403
5404   application.SendNotification();
5405   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5406
5407   // We didn't expect the animation to finish yet
5408   application.SendNotification();
5409   finishCheck.CheckSignalNotReceived();
5410
5411   // The position should have moved more, than with a linear alpha function
5412   Vector4 current(actor.GetProperty<Vector4>(index));
5413   DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
5414   DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
5415   DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
5416   DALI_TEST_CHECK( current.w > ninetyFivePercentProgress.w );
5417
5418   application.SendNotification();
5419   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5420
5421   // We did expect the animation to finish
5422   application.SendNotification();
5423   finishCheck.CheckSignalReceived();
5424   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
5425   END_TEST;
5426 }
5427
5428 int UtcDaliAnimationAnimateToVector4TimePeriodP(void)
5429 {
5430   TestApplication application;
5431
5432   Actor actor = Actor::New();
5433
5434   // Register a Vector4 property
5435   Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
5436   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5437   Stage::GetCurrent().Add(actor);
5438   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION );
5439
5440   // Build the animation
5441   float durationSeconds(1.0f);
5442   Animation animation = Animation::New(durationSeconds);
5443   Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
5444   Vector4 relativeValue(targetValue - startValue);
5445   float delay = 0.5f;
5446   animation.AnimateTo(Property(actor, index),
5447                       targetValue,
5448                       TimePeriod(delay, durationSeconds - delay));
5449
5450   // Start the animation
5451   animation.Play();
5452
5453   bool signalReceived(false);
5454   AnimationFinishCheck finishCheck(signalReceived);
5455   animation.FinishedSignal().Connect(&application, finishCheck);
5456
5457   application.SendNotification();
5458   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5459
5460   // We didn't expect the animation to finish yet
5461   application.SendNotification();
5462   finishCheck.CheckSignalNotReceived();
5463   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION );
5464
5465   application.SendNotification();
5466   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5467
5468   // We didn't expect the animation to finish yet
5469   application.SendNotification();
5470   finishCheck.CheckSignalNotReceived();
5471   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), VECTOR4_EPSILON, TEST_LOCATION );
5472
5473   application.SendNotification();
5474   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5475
5476   // We did expect the animation to finish
5477   application.SendNotification();
5478   finishCheck.CheckSignalReceived();
5479   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, VECTOR4_EPSILON, TEST_LOCATION );
5480   END_TEST;
5481 }
5482
5483 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void)
5484 {
5485   TestApplication application;
5486
5487   Actor actor = Actor::New();
5488
5489   // Register a Vector4 property
5490   Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
5491   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5492   Stage::GetCurrent().Add(actor);
5493   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
5494
5495   // Build the animation
5496   float durationSeconds(1.0f);
5497   Animation animation = Animation::New(durationSeconds);
5498   Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
5499   Vector4 relativeValue(targetValue - startValue);
5500   float delay = 0.5f;
5501   animation.AnimateTo(Property(actor, index),
5502                       targetValue,
5503                       AlphaFunction::LINEAR,
5504                       TimePeriod(delay, durationSeconds - delay));
5505
5506   // Start the animation
5507   animation.Play();
5508
5509   bool signalReceived(false);
5510   AnimationFinishCheck finishCheck(signalReceived);
5511   animation.FinishedSignal().Connect(&application, finishCheck);
5512
5513   application.SendNotification();
5514   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5515
5516   // We didn't expect the animation to finish yet
5517   application.SendNotification();
5518   finishCheck.CheckSignalNotReceived();
5519   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
5520
5521   application.SendNotification();
5522   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5523
5524   // We didn't expect the animation to finish yet
5525   application.SendNotification();
5526   finishCheck.CheckSignalNotReceived();
5527   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5528
5529   application.SendNotification();
5530   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5531
5532   // We did expect the animation to finish
5533   application.SendNotification();
5534   finishCheck.CheckSignalReceived();
5535   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
5536   END_TEST;
5537 }
5538
5539 int UtcDaliAnimationAnimateToActorParentOriginP(void)
5540 {
5541   TestApplication application;
5542
5543   Actor actor = Actor::New();
5544   Stage::GetCurrent().Add(actor);
5545   DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_LEFT, TEST_LOCATION );
5546
5547   // Build the animation
5548   float durationSeconds(1.0f);
5549   Animation animation = Animation::New(durationSeconds);
5550   Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
5551
5552   try
5553   {
5554     animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin );
5555   }
5556   catch (Dali::DaliException& e)
5557   {
5558     DALI_TEST_PRINT_ASSERT( e );
5559     DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5560   }
5561   END_TEST;
5562 }
5563
5564 int UtcDaliAnimationAnimateToActorParentOriginXP(void)
5565 {
5566   TestApplication application;
5567
5568   Actor actor = Actor::New();
5569   Stage::GetCurrent().Add(actor);
5570   float startValue(0.0f);
5571   DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().x, startValue, TEST_LOCATION );
5572   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION );
5573
5574   // Build the animation
5575   float durationSeconds(1.0f);
5576   Animation animation = Animation::New(durationSeconds);
5577   float targetX(1.0f);
5578
5579   try
5580   {
5581     animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX );
5582   }
5583   catch (Dali::DaliException& e)
5584   {
5585     DALI_TEST_PRINT_ASSERT( e );
5586     DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5587   }
5588   END_TEST;
5589 }
5590
5591 int UtcDaliAnimationAnimateToActorParentOriginYP(void)
5592 {
5593   TestApplication application;
5594
5595   Actor actor = Actor::New();
5596   Stage::GetCurrent().Add(actor);
5597   float startValue(0.0f);
5598   DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().y, startValue, TEST_LOCATION );
5599   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION );
5600
5601   // Build the animation
5602   float durationSeconds(1.0f);
5603   Animation animation = Animation::New(durationSeconds);
5604   float targetY(1.0f);
5605
5606   try
5607   {
5608     animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY );
5609   }
5610   catch (Dali::DaliException& e)
5611   {
5612     DALI_TEST_PRINT_ASSERT( e );
5613     DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5614   }
5615   END_TEST;
5616 }
5617
5618 int UtcDaliAnimationAnimateToActorParentOriginZP(void)
5619 {
5620   TestApplication application;
5621
5622   Actor actor = Actor::New();
5623   Stage::GetCurrent().Add(actor);
5624   float startValue(0.5f);
5625   DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().z, startValue, TEST_LOCATION );
5626   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION );
5627
5628   // Build the animation
5629   float durationSeconds(1.0f);
5630   Animation animation = Animation::New(durationSeconds);
5631   float targetZ(1.0f);
5632
5633   try
5634   {
5635     animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ );
5636   }
5637   catch (Dali::DaliException& e)
5638   {
5639     DALI_TEST_PRINT_ASSERT( e );
5640     DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5641   }
5642   END_TEST;
5643 }
5644
5645 int UtcDaliAnimationAnimateToActorAnchorPointP(void)
5646 {
5647   TestApplication application;
5648
5649   Actor actor = Actor::New();
5650   Stage::GetCurrent().Add(actor);
5651   DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), AnchorPoint::CENTER, TEST_LOCATION );
5652
5653   // Build the animation
5654   float durationSeconds(1.0f);
5655   Animation animation = Animation::New(durationSeconds);
5656   Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT);
5657
5658   try
5659   {
5660     animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
5661   }
5662   catch (Dali::DaliException& e)
5663   {
5664     DALI_TEST_PRINT_ASSERT( e );
5665     DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5666   }
5667   END_TEST;
5668 }
5669
5670 int UtcDaliAnimationAnimateToActorAnchorPointXP(void)
5671 {
5672   TestApplication application;
5673
5674   Actor actor = Actor::New();
5675   Stage::GetCurrent().Add(actor);
5676   float startValue(0.5f);
5677   DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().x, startValue, TEST_LOCATION );
5678   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION );
5679
5680   // Build the animation
5681   float durationSeconds(1.0f);
5682   Animation animation = Animation::New(durationSeconds);
5683   float targetX(1.0f);
5684
5685   try
5686   {
5687     animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_X), targetX );
5688   }
5689   catch (Dali::DaliException& e)
5690   {
5691     DALI_TEST_PRINT_ASSERT( e );
5692     DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5693   }
5694   END_TEST;
5695 }
5696
5697 int UtcDaliAnimationAnimateToActorAnchorPointYP(void)
5698 {
5699   TestApplication application;
5700
5701   Actor actor = Actor::New();
5702   Stage::GetCurrent().Add(actor);
5703   float startValue(0.5f);
5704   DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().y, startValue, TEST_LOCATION );
5705   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION );
5706
5707   // Build the animation
5708   float durationSeconds(1.0f);
5709   Animation animation = Animation::New(durationSeconds);
5710   float targetY(0.0f);
5711
5712   try
5713   {
5714     animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY );
5715   }
5716   catch (Dali::DaliException& e)
5717   {
5718     DALI_TEST_PRINT_ASSERT( e );
5719     DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5720   }
5721   END_TEST;
5722 }
5723
5724 int UtcDaliAnimationAnimateToActorAnchorPointZP(void)
5725 {
5726   TestApplication application;
5727
5728   Actor actor = Actor::New();
5729   Stage::GetCurrent().Add(actor);
5730   float startValue(0.5f);
5731   DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().z, startValue, TEST_LOCATION );
5732   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION );
5733
5734   // Build the animation
5735   float durationSeconds(1.0f);
5736   Animation animation = Animation::New(durationSeconds);
5737   float targetZ(100.0f);
5738
5739   try
5740   {
5741     animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ );
5742   }
5743   catch (Dali::DaliException& e)
5744   {
5745     DALI_TEST_PRINT_ASSERT( e );
5746     DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
5747   }
5748   END_TEST;
5749 }
5750
5751 int UtcDaliAnimationAnimateToActorSizeP(void)
5752 {
5753   TestApplication application;
5754
5755   Actor actor = Actor::New();
5756   Stage::GetCurrent().Add(actor);
5757   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5758
5759   // Build the animation
5760   float durationSeconds(1.0f);
5761   Animation animation = Animation::New(durationSeconds);
5762   Vector3 targetSize(100.0f, 100.0f, 100.0f);
5763   animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize );
5764
5765   Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
5766
5767   // Start the animation
5768   animation.Play();
5769
5770   bool signalReceived(false);
5771   AnimationFinishCheck finishCheck(signalReceived);
5772   animation.FinishedSignal().Connect(&application, finishCheck);
5773
5774   application.SendNotification();
5775   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
5776
5777   // We didn't expect the animation to finish yet
5778   application.SendNotification();
5779   finishCheck.CheckSignalNotReceived();
5780   DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
5781
5782   application.SendNotification();
5783   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
5784
5785   // We did expect the animation to finish
5786   application.SendNotification();
5787   finishCheck.CheckSignalReceived();
5788   DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
5789
5790   // Reset everything
5791   finishCheck.Reset();
5792   actor.SetSize(Vector3::ZERO);
5793   application.SendNotification();
5794   application.Render(0);
5795   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5796
5797   // Repeat with a different (ease-in) alpha function
5798   animation = Animation::New(durationSeconds);
5799   animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
5800   animation.FinishedSignal().Connect(&application, finishCheck);
5801   animation.Play();
5802
5803   application.SendNotification();
5804   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
5805
5806   // We didn't expect the animation to finish yet
5807   application.SendNotification();
5808   finishCheck.CheckSignalNotReceived();
5809
5810   // The size should have travelled less, than with a linear alpha function
5811   Vector3 current(actor.GetCurrentSize());
5812   DALI_TEST_CHECK( current.x > 0.0f );
5813   DALI_TEST_CHECK( current.y > 0.0f );
5814   DALI_TEST_CHECK( current.z > 0.0f );
5815   DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
5816   DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
5817   DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
5818
5819   application.SendNotification();
5820   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
5821
5822   // We did expect the animation to finish
5823   application.SendNotification();
5824   finishCheck.CheckSignalReceived();
5825   DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
5826
5827   // Reset everything
5828   finishCheck.Reset();
5829   actor.SetSize(Vector3::ZERO);
5830   application.SendNotification();
5831   application.Render(0);
5832   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5833
5834   // Repeat with a delay
5835   float delay = 0.5f;
5836   animation = Animation::New(durationSeconds);
5837   animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
5838   animation.FinishedSignal().Connect(&application, finishCheck);
5839   animation.Play();
5840
5841   application.SendNotification();
5842   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5843
5844   // We didn't expect the animation to finish yet
5845   application.SendNotification();
5846   finishCheck.CheckSignalNotReceived();
5847   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5848
5849   application.SendNotification();
5850   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5851
5852   // We did expect the animation to finish
5853   application.SendNotification();
5854   finishCheck.CheckSignalReceived();
5855   DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
5856   END_TEST;
5857 }
5858
5859 int UtcDaliAnimationAnimateToActorSizeWidthP(void)
5860 {
5861   TestApplication application;
5862
5863   Actor actor = Actor::New();
5864   Stage::GetCurrent().Add(actor);
5865   float startValue(0.0f);
5866   DALI_TEST_EQUALS( actor.GetCurrentSize().width, startValue, TEST_LOCATION );
5867   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION );
5868
5869   // Build the animation
5870   float durationSeconds(1.0f);
5871   Animation animation = Animation::New(durationSeconds);
5872   float targetWidth(10.0f);
5873   animation.AnimateTo( Property(actor, Actor::Property::SIZE_WIDTH), targetWidth );
5874
5875   float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f);
5876
5877   // Start the animation
5878   animation.Play();
5879
5880   bool signalReceived(false);
5881   AnimationFinishCheck finishCheck(signalReceived);
5882   animation.FinishedSignal().Connect(&application, finishCheck);
5883
5884   application.SendNotification();
5885   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5886
5887   // We didn't expect the animation to finish yet
5888   application.SendNotification();
5889   finishCheck.CheckSignalNotReceived();
5890   DALI_TEST_EQUALS( actor.GetCurrentSize().width, fiftyPercentProgress, TEST_LOCATION );
5891
5892   application.SendNotification();
5893   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5894
5895   // We did expect the animation to finish
5896   application.SendNotification();
5897   finishCheck.CheckSignalReceived();
5898   DALI_TEST_EQUALS( actor.GetCurrentSize().width, targetWidth, TEST_LOCATION );
5899   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION );
5900   END_TEST;
5901 }
5902
5903 int UtcDaliAnimationAnimateToActorSizeHeightP(void)
5904 {
5905   TestApplication application;
5906
5907   Actor actor = Actor::New();
5908   Stage::GetCurrent().Add(actor);
5909   float startValue(0.0f);
5910   DALI_TEST_EQUALS( actor.GetCurrentSize().height, startValue, TEST_LOCATION );
5911   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION );
5912
5913   // Build the animation
5914   float durationSeconds(1.0f);
5915   Animation animation = Animation::New(durationSeconds);
5916   float targetHeight(-10.0f);
5917   animation.AnimateTo( Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight );
5918
5919   float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f);
5920
5921   // Start the animation
5922   animation.Play();
5923
5924   bool signalReceived(false);
5925   AnimationFinishCheck finishCheck(signalReceived);
5926   animation.FinishedSignal().Connect(&application, finishCheck);
5927
5928   application.SendNotification();
5929   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5930
5931   // We didn't expect the animation to finish yet
5932   application.SendNotification();
5933   finishCheck.CheckSignalNotReceived();
5934   DALI_TEST_EQUALS( actor.GetCurrentSize().height, fiftyPercentProgress, TEST_LOCATION );
5935
5936   application.SendNotification();
5937   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5938
5939   // We did expect the animation to finish
5940   application.SendNotification();
5941   finishCheck.CheckSignalReceived();
5942   DALI_TEST_EQUALS( actor.GetCurrentSize().height, targetHeight, TEST_LOCATION );
5943   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION );
5944   END_TEST;
5945 }
5946
5947 int UtcDaliAnimationAnimateToActorSizeDepthP(void)
5948 {
5949   TestApplication application;
5950
5951   Actor actor = Actor::New();
5952   Stage::GetCurrent().Add(actor);
5953   float startValue(0.0f);
5954   DALI_TEST_EQUALS( actor.GetCurrentSize().depth, startValue, TEST_LOCATION );
5955   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION );
5956
5957   // Build the animation
5958   float durationSeconds(1.0f);
5959   Animation animation = Animation::New(durationSeconds);
5960   float targetDepth(-10.0f);
5961   animation.AnimateTo( Property(actor, Actor::Property::SIZE_DEPTH), targetDepth );
5962
5963   float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f);
5964
5965   // Start the animation
5966   animation.Play();
5967
5968   bool signalReceived(false);
5969   AnimationFinishCheck finishCheck(signalReceived);
5970   animation.FinishedSignal().Connect(&application, finishCheck);
5971
5972   application.SendNotification();
5973   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5974
5975   // We didn't expect the animation to finish yet
5976   application.SendNotification();
5977   finishCheck.CheckSignalNotReceived();
5978   DALI_TEST_EQUALS( actor.GetCurrentSize().depth, fiftyPercentProgress, TEST_LOCATION );
5979
5980   application.SendNotification();
5981   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5982
5983   // We did expect the animation to finish
5984   application.SendNotification();
5985   finishCheck.CheckSignalReceived();
5986   DALI_TEST_EQUALS( actor.GetCurrentSize().depth, targetDepth, TEST_LOCATION );
5987   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION );
5988   END_TEST;
5989 }
5990
5991 int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void)
5992 {
5993   TestApplication application;
5994
5995   Actor actor = Actor::New();
5996   Stage::GetCurrent().Add(actor);
5997   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5998
5999   // Build the animation
6000   float durationSeconds(1.0f);
6001   Animation animation = Animation::New(durationSeconds);
6002   Vector3 targetSize(100.0f, 100.0f, 100.0f);
6003   animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetSize );
6004
6005   Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
6006
6007   // Start the animation
6008   animation.Play();
6009
6010   bool signalReceived(false);
6011   AnimationFinishCheck finishCheck(signalReceived);
6012   animation.FinishedSignal().Connect(&application, finishCheck);
6013
6014   application.SendNotification();
6015   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6016
6017   // We didn't expect the animation to finish yet
6018   application.SendNotification();
6019   finishCheck.CheckSignalNotReceived();
6020   DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
6021
6022   application.SendNotification();
6023   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6024
6025   // We did expect the animation to finish
6026   application.SendNotification();
6027   finishCheck.CheckSignalReceived();
6028   DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6029
6030   // Reset everything
6031   finishCheck.Reset();
6032   actor.SetSize(Vector3::ZERO);
6033   application.SendNotification();
6034   application.Render(0);
6035   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6036
6037   // Repeat with a different (ease-in) alpha function
6038   animation = Animation::New(durationSeconds);
6039   animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::EASE_IN );
6040   animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::EASE_IN );
6041   animation.FinishedSignal().Connect(&application, finishCheck);
6042   animation.Play();
6043
6044   application.SendNotification();
6045   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6046
6047   // We didn't expect the animation to finish yet
6048   application.SendNotification();
6049   finishCheck.CheckSignalNotReceived();
6050
6051   // The size should have travelled less, than with a linear alpha function
6052   Vector3 current(actor.GetCurrentSize());
6053   DALI_TEST_CHECK( current.x > 0.0f );
6054   DALI_TEST_CHECK( current.y > 0.0f );
6055   DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
6056   DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
6057
6058   application.SendNotification();
6059   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6060
6061   // We did expect the animation to finish
6062   application.SendNotification();
6063   finishCheck.CheckSignalReceived();
6064   DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
6065   DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
6066
6067   // Reset everything
6068   finishCheck.Reset();
6069   actor.SetSize(Vector3::ZERO);
6070   application.SendNotification();
6071   application.Render(0);
6072   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6073
6074   // Repeat with a delay
6075   float delay = 0.5f;
6076   animation = Animation::New(durationSeconds);
6077   animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
6078   animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
6079   animation.FinishedSignal().Connect(&application, finishCheck);
6080   animation.Play();
6081
6082   application.SendNotification();
6083   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6084
6085   // We didn't expect the animation to finish yet
6086   application.SendNotification();
6087   finishCheck.CheckSignalNotReceived();
6088   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6089
6090   application.SendNotification();
6091   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6092
6093   // We did expect the animation to finish
6094   application.SendNotification();
6095   finishCheck.CheckSignalReceived();
6096   DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
6097   DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
6098   END_TEST;
6099 }
6100
6101 int UtcDaliAnimationAnimateToActorPositionP(void)
6102 {
6103   TestApplication application;
6104
6105   Actor actor = Actor::New();
6106   Stage::GetCurrent().Add(actor);
6107   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6108
6109   // Build the animation
6110   float durationSeconds(1.0f);
6111   Animation animation = Animation::New(durationSeconds);
6112   Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6113   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
6114
6115   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6116
6117   // Start the animation
6118   animation.Play();
6119
6120   bool signalReceived(false);
6121   AnimationFinishCheck finishCheck(signalReceived);
6122   animation.FinishedSignal().Connect(&application, finishCheck);
6123
6124   application.SendNotification();
6125   application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
6126
6127   // We didn't expect the animation to finish yet
6128   application.SendNotification();
6129   finishCheck.CheckSignalNotReceived();
6130   DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
6131
6132   application.SendNotification();
6133   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6134
6135   // We did expect the animation to finish
6136   application.SendNotification();
6137   finishCheck.CheckSignalReceived();
6138   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6139   END_TEST;
6140 }
6141
6142 int UtcDaliAnimationAnimateToActorPositionXP(void)
6143 {
6144   TestApplication application;
6145
6146   Actor actor = Actor::New();
6147   Stage::GetCurrent().Add(actor);
6148   float startValue(0.0f);
6149   DALI_TEST_EQUALS( actor.GetCurrentPosition().x, startValue, TEST_LOCATION );
6150   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6151   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6152   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6153
6154   // Build the animation
6155   float durationSeconds(1.0f);
6156   Animation animation = Animation::New(durationSeconds);
6157   float targetX(1.0f);
6158   animation.AnimateTo( Property(actor, Actor::Property::POSITION_X), targetX );
6159
6160   float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
6161
6162   // Start the animation
6163   animation.Play();
6164
6165   bool signalReceived(false);
6166   AnimationFinishCheck finishCheck(signalReceived);
6167   animation.FinishedSignal().Connect(&application, finishCheck);
6168
6169   application.SendNotification();
6170   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6171
6172   // We didn't expect the animation to finish yet
6173   application.SendNotification();
6174   finishCheck.CheckSignalNotReceived();
6175   DALI_TEST_EQUALS( actor.GetCurrentPosition().x, fiftyPercentProgress, TEST_LOCATION );
6176
6177   application.SendNotification();
6178   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6179
6180   // We did expect the animation to finish
6181   application.SendNotification();
6182   finishCheck.CheckSignalReceived();
6183   DALI_TEST_EQUALS( actor.GetCurrentPosition().x, targetX, TEST_LOCATION );
6184   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION );
6185   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6186   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6187   END_TEST;
6188 }
6189
6190 int UtcDaliAnimationAnimateToActorPositionYP(void)
6191 {
6192   TestApplication application;
6193
6194   Actor actor = Actor::New();
6195   Stage::GetCurrent().Add(actor);
6196   float startValue(0.0f);
6197   DALI_TEST_EQUALS( actor.GetCurrentPosition().y, startValue, TEST_LOCATION );
6198   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6199   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6200   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6201
6202   // Build the animation
6203   float durationSeconds(1.0f);
6204   Animation animation = Animation::New(durationSeconds);
6205   float targetY(10.0f);
6206   animation.AnimateTo( Property(actor, Actor::Property::POSITION_Y), targetY );
6207
6208   float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
6209
6210   // Start the animation
6211   animation.Play();
6212
6213   bool signalReceived(false);
6214   AnimationFinishCheck finishCheck(signalReceived);
6215   animation.FinishedSignal().Connect(&application, finishCheck);
6216
6217   application.SendNotification();
6218   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6219
6220   // We didn't expect the animation to finish yet
6221   application.SendNotification();
6222   finishCheck.CheckSignalNotReceived();
6223   DALI_TEST_EQUALS( actor.GetCurrentPosition().y, fiftyPercentProgress, TEST_LOCATION );
6224
6225   application.SendNotification();
6226   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6227
6228   // We did expect the animation to finish
6229   application.SendNotification();
6230   finishCheck.CheckSignalReceived();
6231   DALI_TEST_EQUALS( actor.GetCurrentPosition().y, targetY, TEST_LOCATION );
6232   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6233   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION );
6234   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6235   END_TEST;
6236 }
6237
6238 int UtcDaliAnimationAnimateToActorPositionZP(void)
6239 {
6240   TestApplication application;
6241
6242   Actor actor = Actor::New();
6243   Stage::GetCurrent().Add(actor);
6244   float startValue(0.0f);
6245   DALI_TEST_EQUALS( actor.GetCurrentPosition().z, startValue, TEST_LOCATION );
6246   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6247   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6248   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6249
6250   // Build the animation
6251   float durationSeconds(1.0f);
6252   Animation animation = Animation::New(durationSeconds);
6253   float targetZ(-5.0f);
6254   animation.AnimateTo( Property(actor, Actor::Property::POSITION_Z), targetZ );
6255
6256   float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
6257
6258   // Start the animation
6259   animation.Play();
6260
6261   bool signalReceived(false);
6262   AnimationFinishCheck finishCheck(signalReceived);
6263   animation.FinishedSignal().Connect(&application, finishCheck);
6264
6265   application.SendNotification();
6266   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6267
6268   // We didn't expect the animation to finish yet
6269   application.SendNotification();
6270   finishCheck.CheckSignalNotReceived();
6271   DALI_TEST_EQUALS( actor.GetCurrentPosition().z, fiftyPercentProgress, TEST_LOCATION );
6272
6273   application.SendNotification();
6274   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6275
6276   // We did expect the animation to finish
6277   application.SendNotification();
6278   finishCheck.CheckSignalReceived();
6279   DALI_TEST_EQUALS( actor.GetCurrentPosition().z, targetZ, TEST_LOCATION );
6280   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6281   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6282   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION );
6283   END_TEST;
6284 }
6285
6286 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void)
6287 {
6288   TestApplication application;
6289
6290   Actor actor = Actor::New();
6291   Stage::GetCurrent().Add(actor);
6292   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6293
6294   // Build the animation
6295   float durationSeconds(1.0f);
6296   Animation animation = Animation::New(durationSeconds);
6297   Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6298   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
6299
6300   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6301
6302   // Start the animation
6303   animation.Play();
6304
6305   bool signalReceived(false);
6306   AnimationFinishCheck finishCheck(signalReceived);
6307   animation.FinishedSignal().Connect(&application, finishCheck);
6308
6309   application.SendNotification();
6310   application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
6311
6312   // We didn't expect the animation to finish yet
6313   application.SendNotification();
6314   finishCheck.CheckSignalNotReceived();
6315
6316   // The position should have moved less, than with a linear alpha function
6317   Vector3 current(actor.GetCurrentPosition());
6318   DALI_TEST_CHECK( current.x > Vector3::ZERO.x );
6319   DALI_TEST_CHECK( current.y > Vector3::ZERO.y );
6320   DALI_TEST_CHECK( current.z > Vector3::ZERO.z );
6321   DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x );
6322   DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y );
6323   DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z );
6324
6325   application.SendNotification();
6326   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6327
6328   // We did expect the animation to finish
6329   application.SendNotification();
6330   finishCheck.CheckSignalReceived();
6331   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6332   END_TEST;
6333 }
6334
6335 int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void)
6336 {
6337   TestApplication application;
6338
6339   Actor actor = Actor::New();
6340   Stage::GetCurrent().Add(actor);
6341   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6342
6343   // Build the animation
6344   float durationSeconds(1.0f);
6345   Animation animation = Animation::New(durationSeconds);
6346   Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6347   float delay = 0.5f;
6348   animation.AnimateTo( Property(actor, Actor::Property::POSITION),
6349                        targetPosition,
6350                        TimePeriod( delay, durationSeconds - delay ) );
6351
6352   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6353
6354   // Start the animation
6355   animation.Play();
6356
6357   bool signalReceived(false);
6358   AnimationFinishCheck finishCheck(signalReceived);
6359   animation.FinishedSignal().Connect(&application, finishCheck);
6360
6361   application.SendNotification();
6362   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6363
6364   // We didn't expect the animation to finish yet
6365   application.SendNotification();
6366   finishCheck.CheckSignalNotReceived();
6367   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6368
6369   application.SendNotification();
6370   application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
6371
6372   // We didn't expect the animation to finish yet
6373   application.SendNotification();
6374   finishCheck.CheckSignalNotReceived();
6375   DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
6376
6377   application.SendNotification();
6378   application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
6379
6380   // We did expect the animation to finish
6381   application.SendNotification();
6382   finishCheck.CheckSignalReceived();
6383   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6384   END_TEST;
6385 }
6386
6387 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void)
6388 {
6389   TestApplication application;
6390
6391   Actor actor = Actor::New();
6392   Stage::GetCurrent().Add(actor);
6393   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6394
6395   // Build the animation
6396   float durationSeconds(1.0f);
6397   Animation animation = Animation::New(durationSeconds);
6398   Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6399   float delay = 0.5f;
6400   animation.AnimateTo( Property(actor, Actor::Property::POSITION),
6401                        targetPosition,
6402                        AlphaFunction::LINEAR,
6403                        TimePeriod( delay, durationSeconds - delay ) );
6404
6405   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6406
6407   // Start the animation
6408   animation.Play();
6409
6410   bool signalReceived(false);
6411   AnimationFinishCheck finishCheck(signalReceived);
6412   animation.FinishedSignal().Connect(&application, finishCheck);
6413
6414   application.SendNotification();
6415   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6416
6417   // We didn't expect the animation to finish yet
6418   application.SendNotification();
6419   finishCheck.CheckSignalNotReceived();
6420   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6421
6422   application.SendNotification();
6423   application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
6424
6425   // We didn't expect the animation to finish yet
6426   application.SendNotification();
6427   finishCheck.CheckSignalNotReceived();
6428   DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
6429
6430   application.SendNotification();
6431   application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
6432
6433   // We did expect the animation to finish
6434   application.SendNotification();
6435   finishCheck.CheckSignalReceived();
6436   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6437   END_TEST;
6438 }
6439
6440 int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void)
6441 {
6442   TestApplication application;
6443
6444   Actor actor = Actor::New();
6445   actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
6446   Stage::GetCurrent().Add(actor);
6447   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
6448
6449   // Build the animation
6450   float durationSeconds(1.0f);
6451   Animation animation = Animation::New(durationSeconds);
6452   Degree targetRotationDegrees(90.0f);
6453   Radian targetRotationRadians(targetRotationDegrees);
6454   animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS) );
6455
6456   // Start the animation
6457   animation.Play();
6458
6459   bool signalReceived(false);
6460   AnimationFinishCheck finishCheck(signalReceived);
6461   animation.FinishedSignal().Connect(&application, finishCheck);
6462
6463   application.SendNotification();
6464   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6465
6466   // We didn't expect the animation to finish yet
6467   application.SendNotification();
6468   finishCheck.CheckSignalNotReceived();
6469   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6470
6471   application.SendNotification();
6472   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6473
6474   // We didn't expect the animation to finish yet
6475   application.SendNotification();
6476   finishCheck.CheckSignalNotReceived();
6477   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6478
6479   application.SendNotification();
6480   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6481
6482   // We didn't expect the animation to finish yet
6483   application.SendNotification();
6484   finishCheck.CheckSignalNotReceived();
6485   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6486
6487   application.SendNotification();
6488   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6489
6490   // We did expect the animation to finish
6491   application.SendNotification();
6492   finishCheck.CheckSignalReceived();
6493   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6494   END_TEST;
6495 }
6496
6497 int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void)
6498 {
6499   TestApplication application;
6500
6501   Actor actor = Actor::New();
6502   actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
6503   Stage::GetCurrent().Add(actor);
6504   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
6505
6506   // Build the animation
6507   float durationSeconds(1.0f);
6508   Animation animation = Animation::New(durationSeconds);
6509   Degree targetRotationDegrees(90.0f);
6510   Radian targetRotationRadians(targetRotationDegrees);
6511   Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
6512   animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), targetRotation );
6513
6514   // Start the animation
6515   animation.Play();
6516
6517   bool signalReceived(false);
6518   AnimationFinishCheck finishCheck(signalReceived);
6519   animation.FinishedSignal().Connect(&application, finishCheck);
6520
6521   application.SendNotification();
6522   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6523
6524   // We didn't expect the animation to finish yet
6525   application.SendNotification();
6526   finishCheck.CheckSignalNotReceived();
6527   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6528
6529   application.SendNotification();
6530   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6531
6532   // We didn't expect the animation to finish yet
6533   application.SendNotification();
6534   finishCheck.CheckSignalNotReceived();
6535   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6536
6537   application.SendNotification();
6538   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6539
6540   // We didn't expect the animation to finish yet
6541   application.SendNotification();
6542   finishCheck.CheckSignalNotReceived();
6543   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6544
6545   application.SendNotification();
6546   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6547
6548   // We did expect the animation to finish
6549   application.SendNotification();
6550   finishCheck.CheckSignalReceived();
6551   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6552   END_TEST;
6553 }
6554
6555 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void)
6556 {
6557   TestApplication application;
6558
6559   Actor actor = Actor::New();
6560   actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
6561   Stage::GetCurrent().Add(actor);
6562   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6563
6564   // Build the animation
6565   float durationSeconds(1.0f);
6566   Animation animation = Animation::New(durationSeconds);
6567   Degree targetRotationDegrees(90.0f);
6568   Radian targetRotationRadians(targetRotationDegrees);
6569   animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
6570
6571   // Start the animation
6572   animation.Play();
6573
6574   bool signalReceived(false);
6575   AnimationFinishCheck finishCheck(signalReceived);
6576   animation.FinishedSignal().Connect(&application, finishCheck);
6577
6578   application.SendNotification();
6579   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6580
6581   // We didn't expect the animation to finish yet
6582   application.SendNotification();
6583   finishCheck.CheckSignalNotReceived();
6584   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6585
6586   application.SendNotification();
6587   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6588
6589   // We didn't expect the animation to finish yet
6590   application.SendNotification();
6591   finishCheck.CheckSignalNotReceived();
6592   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6593
6594   application.SendNotification();
6595   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6596
6597   // We didn't expect the animation to finish yet
6598   application.SendNotification();
6599   finishCheck.CheckSignalNotReceived();
6600   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6601
6602   application.SendNotification();
6603   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6604
6605   // We did expect the animation to finish
6606   application.SendNotification();
6607   finishCheck.CheckSignalReceived();
6608   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6609   END_TEST;
6610 }
6611
6612 int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void)
6613 {
6614   TestApplication application;
6615
6616   Actor actor = Actor::New();
6617   actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
6618   Stage::GetCurrent().Add(actor);
6619   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
6620
6621   // Build the animation
6622   float durationSeconds(1.0f);
6623   Animation animation = Animation::New(durationSeconds);
6624   Degree targetRotationDegrees(90.0f);
6625   Radian targetRotationRadians(targetRotationDegrees);
6626   float delay(0.1f);
6627   animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
6628
6629   // Start the animation
6630   animation.Play();
6631
6632   bool signalReceived(false);
6633   AnimationFinishCheck finishCheck(signalReceived);
6634   animation.FinishedSignal().Connect(&application, finishCheck);
6635
6636   application.SendNotification();
6637   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6638
6639   // We didn't expect the animation to finish yet
6640   application.SendNotification();
6641   finishCheck.CheckSignalNotReceived();
6642   float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
6643   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6644
6645   application.SendNotification();
6646   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6647
6648   // We didn't expect the animation to finish yet
6649   application.SendNotification();
6650   finishCheck.CheckSignalNotReceived();
6651   progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
6652   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6653
6654   application.SendNotification();
6655   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6656
6657   // We didn't expect the animation to finish yet
6658   application.SendNotification();
6659   finishCheck.CheckSignalNotReceived();
6660   progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
6661   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6662
6663   application.SendNotification();
6664   application.Render(static_cast<unsigned int>(durationSeconds*250.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.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6670   END_TEST;
6671 }
6672
6673 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void)
6674 {
6675   TestApplication application;
6676
6677   Actor actor = Actor::New();
6678   actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
6679   Stage::GetCurrent().Add(actor);
6680   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
6681
6682   // Build the animation
6683   float durationSeconds(1.0f);
6684   Animation animation = Animation::New(durationSeconds);
6685   Degree targetRotationDegrees(90.0f);
6686   Radian targetRotationRadians(targetRotationDegrees);
6687   float delay(0.1f);
6688   animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
6689
6690   // Start the animation
6691   animation.Play();
6692
6693   bool signalReceived(false);
6694   AnimationFinishCheck finishCheck(signalReceived);
6695   animation.FinishedSignal().Connect(&application, finishCheck);
6696
6697   application.SendNotification();
6698   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6699
6700   // We didn't expect the animation to finish yet
6701   application.SendNotification();
6702   finishCheck.CheckSignalNotReceived();
6703   float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
6704   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6705
6706   application.SendNotification();
6707   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6708
6709   // We didn't expect the animation to finish yet
6710   application.SendNotification();
6711   finishCheck.CheckSignalNotReceived();
6712   progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
6713   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6714
6715   application.SendNotification();
6716   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6717
6718   // We didn't expect the animation to finish yet
6719   application.SendNotification();
6720   finishCheck.CheckSignalNotReceived();
6721   progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
6722   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6723
6724   application.SendNotification();
6725   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6726
6727   // We did expect the animation to finish
6728   application.SendNotification();
6729   finishCheck.CheckSignalReceived();
6730   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6731   END_TEST;
6732 }
6733
6734 int UtcDaliAnimationAnimateToActorScaleP(void)
6735 {
6736   TestApplication application;
6737
6738   Actor actor = Actor::New();
6739   Stage::GetCurrent().Add(actor);
6740   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
6741
6742   // Build the animation
6743   float durationSeconds(1.0f);
6744   Animation animation = Animation::New(durationSeconds);
6745   Vector3 targetScale(2.0f, 2.0f, 2.0f);
6746   animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale );
6747
6748   Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f);
6749
6750   // Start the animation
6751   animation.Play();
6752
6753   bool signalReceived(false);
6754   AnimationFinishCheck finishCheck(signalReceived);
6755   animation.FinishedSignal().Connect(&application, finishCheck);
6756
6757   application.SendNotification();
6758   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6759
6760   // We didn't expect the animation to finish yet
6761   application.SendNotification();
6762   finishCheck.CheckSignalNotReceived();
6763   DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
6764
6765   application.SendNotification();
6766   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6767
6768   // We did expect the animation to finish
6769   application.SendNotification();
6770   finishCheck.CheckSignalReceived();
6771   DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
6772
6773   // Reset everything
6774   finishCheck.Reset();
6775   actor.SetScale(Vector3::ONE);
6776   application.SendNotification();
6777   application.Render(0);
6778   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
6779
6780   // Repeat with a different (ease-in) alpha function
6781   animation = Animation::New(durationSeconds);
6782   animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
6783   animation.FinishedSignal().Connect(&application, finishCheck);
6784   animation.Play();
6785
6786   application.SendNotification();
6787   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6788
6789   // We didn't expect the animation to finish yet
6790   application.SendNotification();
6791   finishCheck.CheckSignalNotReceived();
6792
6793   // The scale should have grown less, than with a linear alpha function
6794   Vector3 current(actor.GetCurrentScale());
6795   DALI_TEST_CHECK( current.x > 1.0f );
6796   DALI_TEST_CHECK( current.y > 1.0f );
6797   DALI_TEST_CHECK( current.z > 1.0f );
6798   DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
6799   DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
6800   DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
6801
6802   application.SendNotification();
6803   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6804
6805   // We did expect the animation to finish
6806   application.SendNotification();
6807   finishCheck.CheckSignalReceived();
6808   DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
6809
6810   // Reset everything
6811   finishCheck.Reset();
6812   actor.SetScale(Vector3::ONE);
6813   application.SendNotification();
6814   application.Render(0);
6815   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
6816
6817   // Repeat with a delay
6818   float delay = 0.5f;
6819   animation = Animation::New(durationSeconds);
6820   animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
6821   animation.FinishedSignal().Connect(&application, finishCheck);
6822   animation.Play();
6823
6824   application.SendNotification();
6825   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6826
6827   // We didn't expect the animation to finish yet
6828   application.SendNotification();
6829   finishCheck.CheckSignalNotReceived();
6830   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
6831
6832   application.SendNotification();
6833   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6834
6835   // We did expect the animation to finish
6836   application.SendNotification();
6837   finishCheck.CheckSignalReceived();
6838   DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
6839   END_TEST;
6840 }
6841
6842 int UtcDaliAnimationAnimateToActorScaleXP(void)
6843 {
6844   TestApplication application;
6845
6846   Actor actor = Actor::New();
6847   Stage::GetCurrent().Add(actor);
6848   float startValue(1.0f);
6849   DALI_TEST_EQUALS( actor.GetCurrentScale().x, startValue, TEST_LOCATION );
6850   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
6851   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
6852   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
6853
6854   // Build the animation
6855   float durationSeconds(1.0f);
6856   Animation animation = Animation::New(durationSeconds);
6857   float targetX(10.0f);
6858   animation.AnimateTo( Property(actor, Actor::Property::SCALE_X), targetX );
6859
6860   float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
6861
6862   // Start the animation
6863   animation.Play();
6864
6865   bool signalReceived(false);
6866   AnimationFinishCheck finishCheck(signalReceived);
6867   animation.FinishedSignal().Connect(&application, finishCheck);
6868
6869   application.SendNotification();
6870   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6871
6872   // We didn't expect the animation to finish yet
6873   application.SendNotification();
6874   finishCheck.CheckSignalNotReceived();
6875   DALI_TEST_EQUALS( actor.GetCurrentScale().x, fiftyPercentProgress, TEST_LOCATION );
6876   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), fiftyPercentProgress, TEST_LOCATION );
6877   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
6878   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
6879
6880   application.SendNotification();
6881   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6882
6883   // We did expect the animation to finish
6884   application.SendNotification();
6885   finishCheck.CheckSignalReceived();
6886   DALI_TEST_EQUALS( actor.GetCurrentScale().x, targetX, TEST_LOCATION );
6887   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), targetX, TEST_LOCATION );
6888   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
6889   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
6890   END_TEST;
6891 }
6892
6893 int UtcDaliAnimationAnimateToActorScaleYP(void)
6894 {
6895   TestApplication application;
6896
6897   Actor actor = Actor::New();
6898   Stage::GetCurrent().Add(actor);
6899   float startValue(1.0f);
6900   DALI_TEST_EQUALS( actor.GetCurrentScale().y, startValue, TEST_LOCATION );
6901   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
6902   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
6903   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
6904
6905   // Build the animation
6906   float durationSeconds(1.0f);
6907   Animation animation = Animation::New(durationSeconds);
6908   float targetY(1000.0f);
6909   animation.AnimateTo( Property(actor, Actor::Property::SCALE_Y), targetY );
6910
6911   float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
6912
6913   // Start the animation
6914   animation.Play();
6915
6916   bool signalReceived(false);
6917   AnimationFinishCheck finishCheck(signalReceived);
6918   animation.FinishedSignal().Connect(&application, finishCheck);
6919
6920   application.SendNotification();
6921   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6922
6923   // We didn't expect the animation to finish yet
6924   application.SendNotification();
6925   finishCheck.CheckSignalNotReceived();
6926   DALI_TEST_EQUALS( actor.GetCurrentScale().y, fiftyPercentProgress, TEST_LOCATION );
6927   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
6928   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), fiftyPercentProgress, TEST_LOCATION );
6929   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
6930
6931   application.SendNotification();
6932   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6933
6934   // We did expect the animation to finish
6935   application.SendNotification();
6936   finishCheck.CheckSignalReceived();
6937   DALI_TEST_EQUALS( actor.GetCurrentScale().y, targetY, TEST_LOCATION );
6938   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
6939   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), targetY, TEST_LOCATION );
6940   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
6941   END_TEST;
6942 }
6943
6944 int UtcDaliAnimationAnimateToActorScaleZP(void)
6945 {
6946   TestApplication application;
6947
6948   Actor actor = Actor::New();
6949   Stage::GetCurrent().Add(actor);
6950   float startValue(1.0f);
6951   DALI_TEST_EQUALS( actor.GetCurrentScale().z, startValue, TEST_LOCATION );
6952   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
6953   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
6954   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
6955
6956   // Build the animation
6957   float durationSeconds(1.0f);
6958   Animation animation = Animation::New(durationSeconds);
6959   float targetZ(-1000.0f);
6960   animation.AnimateTo( Property(actor, Actor::Property::SCALE_Z), targetZ );
6961
6962   float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
6963
6964   // Start the animation
6965   animation.Play();
6966
6967   bool signalReceived(false);
6968   AnimationFinishCheck finishCheck(signalReceived);
6969   animation.FinishedSignal().Connect(&application, finishCheck);
6970
6971   application.SendNotification();
6972   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6973
6974   // We didn't expect the animation to finish yet
6975   application.SendNotification();
6976   finishCheck.CheckSignalNotReceived();
6977   DALI_TEST_EQUALS( actor.GetCurrentScale().z, fiftyPercentProgress, TEST_LOCATION );
6978   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
6979   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
6980   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), fiftyPercentProgress, TEST_LOCATION );
6981
6982   application.SendNotification();
6983   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6984
6985   // We did expect the animation to finish
6986   application.SendNotification();
6987   finishCheck.CheckSignalReceived();
6988   DALI_TEST_EQUALS( actor.GetCurrentScale().z, targetZ, TEST_LOCATION );
6989   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
6990   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
6991   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), targetZ, TEST_LOCATION );
6992   END_TEST;
6993 }
6994
6995 int UtcDaliAnimationAnimateToActorColorP(void)
6996 {
6997   TestApplication application;
6998
6999   Actor actor = Actor::New();
7000   Stage::GetCurrent().Add(actor);
7001   DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7002
7003   // Build the animation
7004   float durationSeconds(1.0f);
7005   Animation animation = Animation::New(durationSeconds);
7006   Vector4 targetColor(Color::RED);
7007   animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor );
7008
7009   Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
7010   Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
7011
7012   // Start the animation
7013   animation.Play();
7014
7015   bool signalReceived(false);
7016   AnimationFinishCheck finishCheck(signalReceived);
7017   animation.FinishedSignal().Connect(&application, finishCheck);
7018
7019   application.SendNotification();
7020   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7021
7022   // We didn't expect the animation to finish yet
7023   application.SendNotification();
7024   finishCheck.CheckSignalNotReceived();
7025   DALI_TEST_EQUALS( actor.GetCurrentColor(), tenPercentProgress, TEST_LOCATION );
7026
7027   application.SendNotification();
7028   application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7029
7030   // We did expect the animation to finish
7031   application.SendNotification();
7032   finishCheck.CheckSignalReceived();
7033   DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7034
7035   // Reset everything
7036   finishCheck.Reset();
7037   actor.SetColor(Color::WHITE);
7038   application.SendNotification();
7039   application.Render(0);
7040   DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7041
7042   // Repeat with a different (ease-in) alpha function
7043   animation = Animation::New(durationSeconds);
7044   animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
7045   animation.FinishedSignal().Connect(&application, finishCheck);
7046   animation.Play();
7047
7048   application.SendNotification();
7049   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7050
7051   // We didn't expect the animation to finish yet
7052   application.SendNotification();
7053   finishCheck.CheckSignalNotReceived();
7054
7055   // The color should have changed less, than with a linear alpha function
7056   Vector4 current(actor.GetCurrentColor());
7057   DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change
7058   DALI_TEST_CHECK( current.y < 1.0f );
7059   DALI_TEST_CHECK( current.y > tenPercentProgress.y );
7060   DALI_TEST_CHECK( current.z  < 1.0f );
7061   DALI_TEST_CHECK( current.z  > tenPercentProgress.z );
7062   DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
7063
7064   application.SendNotification();
7065   application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7066
7067   // We did expect the animation to finish
7068   application.SendNotification();
7069   finishCheck.CheckSignalReceived();
7070   DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7071
7072   // Reset everything
7073   finishCheck.Reset();
7074   actor.SetColor(Color::WHITE);
7075   application.SendNotification();
7076   application.Render(0);
7077   DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7078
7079   // Repeat with a shorter animator duration
7080   float animatorDuration = 0.5f;
7081   animation = Animation::New(durationSeconds);
7082   animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
7083   animation.FinishedSignal().Connect(&application, finishCheck);
7084   animation.Play();
7085
7086   application.SendNotification();
7087   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
7088
7089   // We didn't expect the animation to finish yet
7090   application.SendNotification();
7091   finishCheck.CheckSignalNotReceived();
7092   DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION );
7093
7094   application.SendNotification();
7095   application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
7096
7097   // We didn't expect the animation to finish yet
7098   application.SendNotification();
7099   finishCheck.CheckSignalNotReceived();
7100   DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7101
7102   application.SendNotification();
7103   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7104
7105   // We did expect the animation to finish
7106   application.SendNotification();
7107   finishCheck.CheckSignalReceived();
7108   DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7109   END_TEST;
7110 }
7111
7112 int UtcDaliAnimationAnimateToActorColorRedP(void)
7113 {
7114   TestApplication application;
7115
7116   Actor actor = Actor::New();
7117   Stage::GetCurrent().Add(actor);
7118   float startValue(1.0f);
7119   DALI_TEST_EQUALS( actor.GetCurrentColor().r, startValue, TEST_LOCATION );
7120   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
7121   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7122   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
7123   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7124
7125   // Build the animation
7126   float durationSeconds(1.0f);
7127   Animation animation = Animation::New(durationSeconds);
7128   float targetRed(0.5f);
7129   animation.AnimateTo( Property(actor, Actor::Property::COLOR_RED), targetRed );
7130
7131   float fiftyPercentProgress(startValue + (targetRed - startValue)*0.5f);
7132
7133   // Start the animation
7134   animation.Play();
7135
7136   bool signalReceived(false);
7137   AnimationFinishCheck finishCheck(signalReceived);
7138   animation.FinishedSignal().Connect(&application, finishCheck);
7139
7140   application.SendNotification();
7141   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7142
7143   // We didn't expect the animation to finish yet
7144   application.SendNotification();
7145   finishCheck.CheckSignalNotReceived();
7146   DALI_TEST_EQUALS( actor.GetCurrentColor().r, fiftyPercentProgress, TEST_LOCATION );
7147   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   fiftyPercentProgress, TEST_LOCATION );
7148   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue,           TEST_LOCATION );
7149   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue,           TEST_LOCATION );
7150   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue,           TEST_LOCATION );
7151
7152   application.SendNotification();
7153   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7154
7155   // We did expect the animation to finish
7156   application.SendNotification();
7157   finishCheck.CheckSignalReceived();
7158   DALI_TEST_EQUALS( actor.GetCurrentColor().r, targetRed, TEST_LOCATION );
7159   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   targetRed,  TEST_LOCATION );
7160   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7161   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
7162   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7163   END_TEST;
7164 }
7165
7166 int UtcDaliAnimationAnimateToActorColorGreenP(void)
7167 {
7168   TestApplication application;
7169
7170   Actor actor = Actor::New();
7171   Stage::GetCurrent().Add(actor);
7172   float startValue(1.0f);
7173   DALI_TEST_EQUALS( actor.GetCurrentColor().g, startValue, TEST_LOCATION );
7174   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
7175   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7176   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
7177   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7178
7179   // Build the animation
7180   float durationSeconds(1.0f);
7181   Animation animation = Animation::New(durationSeconds);
7182   float targetGreen(0.5f);
7183   animation.AnimateTo( Property(actor, Actor::Property::COLOR_GREEN), targetGreen );
7184
7185   float fiftyPercentProgress(startValue + (targetGreen - startValue)*0.5f);
7186
7187   // Start the animation
7188   animation.Play();
7189
7190   bool signalReceived(false);
7191   AnimationFinishCheck finishCheck(signalReceived);
7192   animation.FinishedSignal().Connect(&application, finishCheck);
7193
7194   application.SendNotification();
7195   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7196
7197   // We didn't expect the animation to finish yet
7198   application.SendNotification();
7199   finishCheck.CheckSignalNotReceived();
7200   DALI_TEST_EQUALS( actor.GetCurrentColor().g, fiftyPercentProgress, TEST_LOCATION );
7201   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue,           TEST_LOCATION );
7202   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION );
7203   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue,           TEST_LOCATION );
7204   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue,           TEST_LOCATION );
7205
7206   application.SendNotification();
7207   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7208
7209   // We did expect the animation to finish
7210   application.SendNotification();
7211   finishCheck.CheckSignalReceived();
7212   DALI_TEST_EQUALS( actor.GetCurrentColor().g, targetGreen, TEST_LOCATION );
7213   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue,  TEST_LOCATION );
7214   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION );
7215   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue,  TEST_LOCATION );
7216   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue,  TEST_LOCATION );
7217   END_TEST;
7218 }
7219
7220 int UtcDaliAnimationAnimateToActorColorBlueP(void)
7221 {
7222   TestApplication application;
7223
7224   Actor actor = Actor::New();
7225   Stage::GetCurrent().Add(actor);
7226   float startValue(1.0f);
7227   DALI_TEST_EQUALS( actor.GetCurrentColor().b, startValue, TEST_LOCATION );
7228   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
7229   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7230   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
7231   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7232
7233   // Build the animation
7234   float durationSeconds(1.0f);
7235   Animation animation = Animation::New(durationSeconds);
7236   float targetBlue(0.5f);
7237   animation.AnimateTo( Property(actor, Actor::Property::COLOR_BLUE), targetBlue );
7238
7239   float fiftyPercentProgress(startValue + (targetBlue - startValue)*0.5f);
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% progress */);
7250
7251   // We didn't expect the animation to finish yet
7252   application.SendNotification();
7253   finishCheck.CheckSignalNotReceived();
7254   DALI_TEST_EQUALS( actor.GetCurrentColor().b, fiftyPercentProgress, TEST_LOCATION );
7255   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue,           TEST_LOCATION );
7256   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue,           TEST_LOCATION );
7257   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  fiftyPercentProgress, TEST_LOCATION );
7258   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue,           TEST_LOCATION );
7259
7260   application.SendNotification();
7261   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7262
7263   // We did expect the animation to finish
7264   application.SendNotification();
7265   finishCheck.CheckSignalReceived();
7266   DALI_TEST_EQUALS( actor.GetCurrentColor().b, targetBlue, TEST_LOCATION );
7267   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
7268   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7269   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  targetBlue, TEST_LOCATION );
7270   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7271   END_TEST;
7272 }
7273
7274 int UtcDaliAnimationAnimateToActorColorAlphaP(void)
7275 {
7276   TestApplication application;
7277
7278   Actor actor = Actor::New();
7279   Stage::GetCurrent().Add(actor);
7280   float startValue(1.0f);
7281   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7282   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
7283   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7284   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
7285   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7286
7287   // Build the animation
7288   float durationSeconds(1.0f);
7289   Animation animation = Animation::New(durationSeconds);
7290   float targetAlpha(0.5f);
7291   animation.AnimateTo( Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha );
7292
7293   float fiftyPercentProgress(startValue + (targetAlpha - startValue)*0.5f);
7294
7295   // Start the animation
7296   animation.Play();
7297
7298   bool signalReceived(false);
7299   AnimationFinishCheck finishCheck(signalReceived);
7300   animation.FinishedSignal().Connect(&application, finishCheck);
7301
7302   application.SendNotification();
7303   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7304
7305   // We didn't expect the animation to finish yet
7306   application.SendNotification();
7307   finishCheck.CheckSignalNotReceived();
7308   DALI_TEST_EQUALS( actor.GetCurrentColor().a, fiftyPercentProgress, TEST_LOCATION );
7309   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue,           TEST_LOCATION );
7310   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue,           TEST_LOCATION );
7311   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue,           TEST_LOCATION );
7312   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), fiftyPercentProgress, TEST_LOCATION );
7313
7314   application.SendNotification();
7315   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7316
7317   // We did expect the animation to finish
7318   application.SendNotification();
7319   finishCheck.CheckSignalReceived();
7320   DALI_TEST_EQUALS( actor.GetCurrentColor().a, targetAlpha, TEST_LOCATION );
7321   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue,  TEST_LOCATION );
7322   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue,  TEST_LOCATION );
7323   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue,  TEST_LOCATION );
7324   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetAlpha, TEST_LOCATION );
7325   END_TEST;
7326 }
7327
7328 int UtcDaliAnimationKeyFrames01P(void)
7329 {
7330   TestApplication application;
7331
7332   KeyFrames keyFrames = KeyFrames::New();
7333   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7334
7335   keyFrames.Add(0.0f, 0.1f);
7336
7337   DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
7338
7339   KeyFrames keyFrames2( keyFrames);
7340   DALI_TEST_CHECK( keyFrames2 );
7341   DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
7342
7343   KeyFrames keyFrames3 = KeyFrames::New();
7344   keyFrames3.Add(0.6f, true);
7345   DALI_TEST_CHECK( keyFrames3 );
7346   DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
7347
7348   keyFrames3 = keyFrames;
7349   DALI_TEST_CHECK( keyFrames3 );
7350   DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
7351
7352   END_TEST;
7353 }
7354
7355 int UtcDaliAnimationKeyFrames02P(void)
7356 {
7357   TestApplication application;
7358
7359   KeyFrames keyFrames = KeyFrames::New();
7360   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7361
7362   keyFrames.Add(0.0f, 0.1f);
7363   keyFrames.Add(0.2f, 0.5f);
7364   keyFrames.Add(0.4f, 0.0f);
7365   keyFrames.Add(0.6f, 1.0f);
7366   keyFrames.Add(0.8f, 0.7f);
7367   keyFrames.Add(1.0f, 0.9f);
7368
7369   DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
7370
7371   try
7372   {
7373     keyFrames.Add(1.9f, false);
7374   }
7375   catch (Dali::DaliException& e)
7376   {
7377     DALI_TEST_PRINT_ASSERT( e );
7378     DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
7379   }
7380   END_TEST;
7381 }
7382
7383 int UtcDaliAnimationKeyFrames03P(void)
7384 {
7385   TestApplication application;
7386
7387   KeyFrames keyFrames = KeyFrames::New();
7388   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7389
7390   keyFrames.Add(0.0f, true);
7391   keyFrames.Add(0.2f, false);
7392   keyFrames.Add(0.4f, false);
7393   keyFrames.Add(0.6f, true);
7394   keyFrames.Add(0.8f, true);
7395   keyFrames.Add(1.0f, false);
7396
7397   DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
7398
7399   try
7400   {
7401     keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
7402   }
7403   catch (Dali::DaliException& e)
7404   {
7405     DALI_TEST_PRINT_ASSERT( e );
7406     DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
7407   }
7408   END_TEST;
7409 }
7410
7411 int UtcDaliAnimationKeyFrames04P(void)
7412 {
7413   TestApplication application;
7414
7415   KeyFrames keyFrames = KeyFrames::New();
7416   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7417
7418   keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
7419   keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
7420   keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
7421   keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
7422   keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
7423   keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
7424
7425   DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
7426
7427   try
7428   {
7429     keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
7430   }
7431   catch (Dali::DaliException& e)
7432   {
7433     DALI_TEST_PRINT_ASSERT( e );
7434     DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
7435   }
7436   END_TEST;
7437 }
7438
7439 int UtcDaliAnimationKeyFrames05P(void)
7440 {
7441   TestApplication application;
7442
7443   KeyFrames keyFrames = KeyFrames::New();
7444   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7445
7446   keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
7447   keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
7448   keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
7449   keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
7450   keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
7451   keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
7452
7453   DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
7454
7455   try
7456   {
7457     keyFrames.Add(0.7f, 1.0f);
7458   }
7459   catch (Dali::DaliException& e)
7460   {
7461     DALI_TEST_PRINT_ASSERT( e );
7462     DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
7463   }
7464   END_TEST;
7465 }
7466
7467 int UtcDaliAnimationKeyFrames06P(void)
7468 {
7469   TestApplication application;
7470
7471   KeyFrames keyFrames = KeyFrames::New();
7472   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7473
7474   keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
7475   keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
7476   keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
7477   keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
7478   keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
7479   keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
7480
7481   DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
7482
7483   try
7484   {
7485     keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
7486   }
7487   catch (Dali::DaliException& e)
7488   {
7489     DALI_TEST_PRINT_ASSERT( e );
7490     DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
7491   }
7492   END_TEST;
7493 }
7494
7495 int UtcDaliAnimationKeyFrames07P(void)
7496 {
7497   TestApplication application;
7498
7499   KeyFrames keyFrames = KeyFrames::New();
7500   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7501
7502   keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
7503   keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
7504   keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
7505   keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
7506   keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
7507   keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
7508
7509   DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
7510
7511   try
7512   {
7513     keyFrames.Add(0.7f, 1.1f);
7514   }
7515   catch (Dali::DaliException& e)
7516   {
7517     DALI_TEST_PRINT_ASSERT( e );
7518     DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
7519   }
7520   END_TEST;
7521 }
7522
7523 int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
7524 {
7525   TestApplication application;
7526
7527   float startValue(1.0f);
7528   Actor actor = Actor::New();
7529   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
7530   Stage::GetCurrent().Add(actor);
7531
7532   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7533   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
7534   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7535   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
7536   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7537
7538   // Build the animation
7539   float durationSeconds(1.0f);
7540   Animation animation = Animation::New(durationSeconds);
7541
7542   KeyFrames keyFrames = KeyFrames::New();
7543   keyFrames.Add(0.0f, 0.1f);
7544   keyFrames.Add(0.2f, 0.5f);
7545   keyFrames.Add(0.4f, 0.0f);
7546   keyFrames.Add(0.6f, 1.0f);
7547   keyFrames.Add(0.8f, 0.7f);
7548   keyFrames.Add(1.0f, 0.9f);
7549
7550   animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames );
7551
7552   // Start the animation
7553   animation.Play();
7554
7555   bool signalReceived(false);
7556   AnimationFinishCheck finishCheck(signalReceived);
7557   animation.FinishedSignal().Connect(&application, finishCheck);
7558   application.SendNotification();
7559   application.Render(0);
7560   application.SendNotification();
7561   finishCheck.CheckSignalNotReceived();
7562   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
7563
7564   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7565   application.SendNotification();
7566   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
7567   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7568   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
7569   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION );
7570   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.3f, 0.01f, TEST_LOCATION );
7571
7572   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
7573   application.SendNotification();
7574   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
7575   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7576   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
7577   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION );
7578   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.25f, 0.01f, TEST_LOCATION );
7579
7580   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
7581   application.SendNotification();
7582   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
7583   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7584   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
7585   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
7586   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
7587
7588   application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
7589   application.SendNotification();
7590   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
7591   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7592   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
7593   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
7594   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
7595
7596   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
7597   application.SendNotification();
7598   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
7599   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7600   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
7601   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION );
7602   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.8f, 0.01f, TEST_LOCATION );
7603
7604   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
7605   application.SendNotification();
7606   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
7607   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7608   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
7609   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
7610   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
7611
7612   // We did expect the animation to finish
7613
7614   finishCheck.CheckSignalReceived();
7615   END_TEST;
7616 }
7617
7618 int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
7619 {
7620   TestApplication application;
7621
7622   float startValue(1.0f);
7623   Actor actor = Actor::New();
7624   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
7625   Stage::GetCurrent().Add(actor);
7626
7627   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7628   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
7629   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7630   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
7631   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7632
7633   // Build the animation
7634   float durationSeconds(1.0f);
7635   Animation animation = Animation::New(durationSeconds);
7636
7637   KeyFrames keyFrames = KeyFrames::New();
7638   keyFrames.Add(0.0f, 0.1f);
7639   keyFrames.Add(0.2f, 0.5f);
7640   keyFrames.Add(0.4f, 0.0f);
7641   keyFrames.Add(0.6f, 1.0f);
7642   keyFrames.Add(0.8f, 0.7f);
7643   keyFrames.Add(1.0f, 0.9f);
7644
7645   animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::Cubic );
7646
7647   // Start the animation
7648   animation.Play();
7649
7650   bool signalReceived(false);
7651   AnimationFinishCheck finishCheck(signalReceived);
7652   animation.FinishedSignal().Connect(&application, finishCheck);
7653   application.SendNotification();
7654   application.Render(0);
7655   application.SendNotification();
7656   finishCheck.CheckSignalNotReceived();
7657   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
7658
7659   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7660   application.SendNotification();
7661   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
7662   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7663   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
7664   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.36f, 0.01f, TEST_LOCATION );
7665   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.36f, 0.01f, TEST_LOCATION );
7666
7667   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
7668   application.SendNotification();
7669   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
7670   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7671   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
7672   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.21f, 0.01f, TEST_LOCATION );
7673   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.21f, 0.01f, TEST_LOCATION );
7674
7675   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
7676   application.SendNotification();
7677   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
7678   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7679   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
7680   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
7681   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
7682
7683   application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
7684   application.SendNotification();
7685   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
7686   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7687   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
7688   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
7689   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
7690
7691   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
7692   application.SendNotification();
7693   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
7694   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7695   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
7696   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.76f, 0.01f, TEST_LOCATION );
7697   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.76f, 0.01f, TEST_LOCATION );
7698
7699   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
7700   application.SendNotification();
7701   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
7702   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7703   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
7704   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
7705   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
7706
7707   // We did expect the animation to finish
7708
7709   finishCheck.CheckSignalReceived();
7710   END_TEST;
7711 }
7712
7713 int UtcDaliAnimationAnimateBetweenActorColorP(void)
7714 {
7715   TestApplication application;
7716
7717   float startValue(1.0f);
7718   Actor actor = Actor::New();
7719   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
7720   Stage::GetCurrent().Add(actor);
7721
7722   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7723   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
7724   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7725   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
7726   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7727
7728   // Build the animation
7729   float durationSeconds(1.0f);
7730   Animation animation = Animation::New(durationSeconds);
7731
7732   KeyFrames keyFrames = KeyFrames::New();
7733   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
7734   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
7735   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
7736
7737   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames );
7738
7739   // Start the animation
7740   animation.Play();
7741
7742   bool signalReceived(false);
7743   AnimationFinishCheck finishCheck(signalReceived);
7744   animation.FinishedSignal().Connect(&application, finishCheck);
7745   application.SendNotification();
7746   application.Render(0);
7747   application.SendNotification();
7748   finishCheck.CheckSignalNotReceived();
7749   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.1f, 0.01f, TEST_LOCATION );
7750   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
7751   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.3f, 0.01f, TEST_LOCATION );
7752   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
7753
7754   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7755   application.SendNotification();
7756   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.5f, 0.01f, TEST_LOCATION );
7757   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
7758   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.5f, 0.01f, TEST_LOCATION );
7759   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
7760
7761   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7762   application.SendNotification();
7763   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.9f, 0.01f, TEST_LOCATION );
7764   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
7765   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.7f, 0.01f, TEST_LOCATION );
7766   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
7767
7768   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7769   application.SendNotification();
7770   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.95f, 0.01f, TEST_LOCATION );
7771   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
7772   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.85f, 0.01f, TEST_LOCATION );
7773   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
7774
7775   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
7776   application.SendNotification();
7777   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   1.0f, 0.01f, TEST_LOCATION );
7778   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
7779   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  1.0f, 0.01f, TEST_LOCATION );
7780   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
7781
7782   // We did expect the animation to finish
7783
7784   finishCheck.CheckSignalReceived();
7785   END_TEST;
7786 }
7787
7788 int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
7789 {
7790   TestApplication application;
7791
7792   float startValue(1.0f);
7793   Actor actor = Actor::New();
7794   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
7795   Stage::GetCurrent().Add(actor);
7796
7797   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7798   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
7799   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7800   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
7801   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7802
7803   // Build the animation
7804   float durationSeconds(1.0f);
7805   Animation animation = Animation::New(durationSeconds);
7806
7807   KeyFrames keyFrames = KeyFrames::New();
7808   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
7809   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
7810   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
7811
7812   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, Animation::Cubic );
7813
7814   // Start the animation
7815   animation.Play();
7816
7817   bool signalReceived(false);
7818   AnimationFinishCheck finishCheck(signalReceived);
7819   animation.FinishedSignal().Connect(&application, finishCheck);
7820   application.SendNotification();
7821   application.Render(0);
7822   application.SendNotification();
7823   finishCheck.CheckSignalNotReceived();
7824   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.1f, 0.01f, TEST_LOCATION );
7825   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
7826   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.3f, 0.01f, TEST_LOCATION );
7827   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
7828
7829   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7830   application.SendNotification();
7831   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.55f, 0.01f, TEST_LOCATION );
7832   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
7833   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.506f, 0.01f, TEST_LOCATION );
7834   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
7835
7836   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7837   application.SendNotification();
7838   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.9f, 0.01f, TEST_LOCATION );
7839   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
7840   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.7f, 0.01f, TEST_LOCATION );
7841   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
7842
7843   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7844   application.SendNotification();
7845   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.99375f, 0.01f, TEST_LOCATION );
7846   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
7847   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.85625f, 0.01f, TEST_LOCATION );
7848   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
7849
7850   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
7851   application.SendNotification();
7852   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   1.0f, 0.01f, TEST_LOCATION );
7853   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
7854   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  1.0f, 0.01f, TEST_LOCATION );
7855   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
7856
7857   // We did expect the animation to finish
7858
7859   finishCheck.CheckSignalReceived();
7860   END_TEST;
7861 }
7862
7863 int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
7864 {
7865   TestApplication application;
7866
7867   Actor actor = Actor::New();
7868   AngleAxis aa(Degree(90), Vector3::XAXIS);
7869   actor.SetOrientation(aa.angle, aa.axis);
7870   Stage::GetCurrent().Add(actor);
7871
7872   application.SendNotification();
7873   application.Render(0);
7874
7875   DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
7876
7877   // Build the animation
7878   float durationSeconds(1.0f);
7879   Animation animation = Animation::New(durationSeconds);
7880
7881   KeyFrames keyFrames = KeyFrames::New();
7882   keyFrames.Add(0.0f, false);
7883   keyFrames.Add(0.2f, true);
7884   keyFrames.Add(0.4f, true);
7885   keyFrames.Add(0.8f, false);
7886   keyFrames.Add(1.0f, true);
7887
7888   animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames );
7889
7890   // Start the animation
7891   animation.Play();
7892
7893   bool signalReceived(false);
7894   AnimationFinishCheck finishCheck(signalReceived);
7895   animation.FinishedSignal().Connect(&application, finishCheck);
7896   application.SendNotification();
7897   application.SendNotification();
7898   application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
7899   application.SendNotification();
7900   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
7901   application.SendNotification();
7902
7903   DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
7904   finishCheck.CheckSignalReceived();
7905   END_TEST;
7906 }
7907
7908 int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
7909 {
7910   TestApplication application;
7911
7912   Actor actor = Actor::New();
7913   AngleAxis aa(Degree(90), Vector3::XAXIS);
7914   actor.SetOrientation(aa.angle, aa.axis);
7915   Stage::GetCurrent().Add(actor);
7916
7917   application.SendNotification();
7918   application.Render(0);
7919
7920   DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
7921
7922   // Build the animation
7923   float durationSeconds(1.0f);
7924   Animation animation = Animation::New(durationSeconds);
7925
7926   KeyFrames keyFrames = KeyFrames::New();
7927   keyFrames.Add(0.0f, false);
7928   keyFrames.Add(0.2f, true);
7929   keyFrames.Add(0.4f, true);
7930   keyFrames.Add(0.8f, false);
7931   keyFrames.Add(1.0f, true);
7932
7933   //Cubic interpolation for boolean values should be ignored
7934   animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::Cubic );
7935
7936   // Start the animation
7937   animation.Play();
7938
7939   bool signalReceived(false);
7940   AnimationFinishCheck finishCheck(signalReceived);
7941   animation.FinishedSignal().Connect(&application, finishCheck);
7942   application.SendNotification();
7943   application.SendNotification();
7944   application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
7945   application.SendNotification();
7946   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
7947   application.SendNotification();
7948
7949   DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
7950   finishCheck.CheckSignalReceived();
7951   END_TEST;
7952 }
7953
7954 int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
7955 {
7956   TestApplication application;
7957
7958   Actor actor = Actor::New();
7959   AngleAxis aa(Degree(90), Vector3::XAXIS);
7960   actor.SetOrientation(aa.angle, aa.axis);
7961   Stage::GetCurrent().Add(actor);
7962
7963   application.SendNotification();
7964   application.Render(0);
7965   Quaternion start(Radian(aa.angle), aa.axis);
7966   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
7967
7968   // Build the animation
7969   float durationSeconds(1.0f);
7970   Animation animation = Animation::New(durationSeconds);
7971
7972   KeyFrames keyFrames = KeyFrames::New();
7973   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
7974
7975   animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
7976
7977   // Start the animation
7978   animation.Play();
7979
7980   bool signalReceived(false);
7981   AnimationFinishCheck finishCheck(signalReceived);
7982   animation.FinishedSignal().Connect(&application, finishCheck);
7983   application.SendNotification();
7984   application.SendNotification();
7985   application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
7986   application.SendNotification();
7987   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
7988   application.SendNotification();
7989
7990   Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
7991
7992   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
7993   finishCheck.CheckSignalReceived();
7994   END_TEST;
7995 }
7996
7997 int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
7998 {
7999   TestApplication application;
8000
8001   Actor actor = Actor::New();
8002   AngleAxis aa(Degree(90), Vector3::XAXIS);
8003   actor.SetOrientation(aa.angle, aa.axis);
8004   application.SendNotification();
8005   application.Render(0);
8006   Stage::GetCurrent().Add(actor);
8007
8008   Quaternion start(Radian(aa.angle), aa.axis);
8009   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8010
8011   // Build the animation
8012   float durationSeconds(1.0f);
8013   Animation animation = Animation::New(durationSeconds);
8014
8015   KeyFrames keyFrames = KeyFrames::New();
8016   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
8017   keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
8018   keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
8019
8020   animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
8021
8022   // Start the animation
8023   animation.Play();
8024
8025   bool signalReceived(false);
8026   AnimationFinishCheck finishCheck(signalReceived);
8027   animation.FinishedSignal().Connect(&application, finishCheck);
8028   application.SendNotification();
8029   application.Render(0);
8030   application.SendNotification();
8031   finishCheck.CheckSignalNotReceived();
8032
8033   Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
8034   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8035
8036   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8037   application.SendNotification();
8038   check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
8039   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8040
8041   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8042   application.SendNotification();
8043   check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
8044   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8045
8046   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8047   application.SendNotification();
8048   check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f) );
8049   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8050
8051   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8052   application.SendNotification();
8053   check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
8054   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8055
8056   // We did expect the animation to finish
8057
8058   finishCheck.CheckSignalReceived();
8059   END_TEST;
8060 }
8061
8062 int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
8063 {
8064   TestApplication application;
8065
8066   Actor actor = Actor::New();
8067   AngleAxis aa(Degree(90), Vector3::XAXIS);
8068   actor.SetOrientation(aa.angle, aa.axis);
8069   Stage::GetCurrent().Add(actor);
8070
8071   application.SendNotification();
8072   application.Render(0);
8073   Quaternion start(Radian(aa.angle), aa.axis);
8074   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8075
8076   // Build the animation
8077   float durationSeconds(1.0f);
8078   Animation animation = Animation::New(durationSeconds);
8079
8080   KeyFrames keyFrames = KeyFrames::New();
8081   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
8082
8083   //Cubic interpolation should be ignored for quaternions
8084   animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
8085
8086   // Start the animation
8087   animation.Play();
8088
8089   bool signalReceived(false);
8090   AnimationFinishCheck finishCheck(signalReceived);
8091   animation.FinishedSignal().Connect(&application, finishCheck);
8092   application.SendNotification();
8093   application.SendNotification();
8094   application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8095   application.SendNotification();
8096   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8097   application.SendNotification();
8098
8099   Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
8100
8101   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8102   finishCheck.CheckSignalReceived();
8103   END_TEST;
8104 }
8105
8106 int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
8107 {
8108   TestApplication application;
8109
8110   Actor actor = Actor::New();
8111   AngleAxis aa(Degree(90), Vector3::XAXIS);
8112   actor.SetOrientation(aa.angle, aa.axis);
8113   application.SendNotification();
8114   application.Render(0);
8115   Stage::GetCurrent().Add(actor);
8116
8117   Quaternion start(Radian(aa.angle), aa.axis);
8118   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8119
8120   // Build the animation
8121   float durationSeconds(1.0f);
8122   Animation animation = Animation::New(durationSeconds);
8123
8124   KeyFrames keyFrames = KeyFrames::New();
8125   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
8126   keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
8127   keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
8128
8129   //Cubic interpolation should be ignored for quaternions
8130   animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
8131
8132   // Start the animation
8133   animation.Play();
8134
8135   bool signalReceived(false);
8136   AnimationFinishCheck finishCheck(signalReceived);
8137   animation.FinishedSignal().Connect(&application, finishCheck);
8138   application.SendNotification();
8139   application.Render(0);
8140   application.SendNotification();
8141   finishCheck.CheckSignalNotReceived();
8142
8143   Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
8144   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8145
8146   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8147   application.SendNotification();
8148   check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
8149   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8150
8151   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8152   application.SendNotification();
8153   check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
8154   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8155
8156   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8157   application.SendNotification();
8158   check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f ) );
8159   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8160
8161   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8162   application.SendNotification();
8163   check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
8164   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8165
8166   // We did expect the animation to finish
8167
8168   finishCheck.CheckSignalReceived();
8169   END_TEST;
8170 }
8171
8172 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
8173 {
8174   TestApplication application;
8175
8176   float startValue(1.0f);
8177   Actor actor = Actor::New();
8178   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8179   Stage::GetCurrent().Add(actor);
8180
8181   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8182   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8183   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8184   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8185   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8186
8187   // Build the animation
8188   float durationSeconds(1.0f);
8189   Animation animation = Animation::New(durationSeconds);
8190
8191   KeyFrames keyFrames = KeyFrames::New();
8192   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8193   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8194   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8195
8196   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR );
8197
8198   // Start the animation
8199   animation.Play();
8200
8201   bool signalReceived(false);
8202   AnimationFinishCheck finishCheck(signalReceived);
8203   animation.FinishedSignal().Connect(&application, finishCheck);
8204   application.SendNotification();
8205   application.Render(0);
8206   application.SendNotification();
8207   finishCheck.CheckSignalNotReceived();
8208   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.1f, 0.01f, TEST_LOCATION );
8209   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8210   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.3f, 0.01f, TEST_LOCATION );
8211   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8212
8213   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8214   application.SendNotification();
8215   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.5f, 0.01f, TEST_LOCATION );
8216   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
8217   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.5f, 0.01f, TEST_LOCATION );
8218   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
8219
8220   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8221   application.SendNotification();
8222   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.9f, 0.01f, TEST_LOCATION );
8223   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8224   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.7f, 0.01f, TEST_LOCATION );
8225   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8226
8227   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8228   application.SendNotification();
8229   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.95f, 0.01f, TEST_LOCATION );
8230   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
8231   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.85f, 0.01f, TEST_LOCATION );
8232   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
8233
8234   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8235   application.SendNotification();
8236   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   1.0f, 0.01f, TEST_LOCATION );
8237   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8238   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  1.0f, 0.01f, TEST_LOCATION );
8239   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8240
8241   // We did expect the animation to finish
8242
8243   finishCheck.CheckSignalReceived();
8244   END_TEST;
8245 }
8246
8247 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
8248 {
8249   TestApplication application;
8250
8251   float startValue(1.0f);
8252   Actor actor = Actor::New();
8253   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8254   Stage::GetCurrent().Add(actor);
8255
8256   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8257   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8258   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8259   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8260   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8261
8262   // Build the animation
8263   float durationSeconds(1.0f);
8264   Animation animation = Animation::New(durationSeconds);
8265
8266   KeyFrames keyFrames = KeyFrames::New();
8267   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8268   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8269   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8270
8271   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::Cubic );
8272
8273   // Start the animation
8274   animation.Play();
8275
8276   bool signalReceived(false);
8277   AnimationFinishCheck finishCheck(signalReceived);
8278   animation.FinishedSignal().Connect(&application, finishCheck);
8279   application.SendNotification();
8280   application.Render(0);
8281   application.SendNotification();
8282   finishCheck.CheckSignalNotReceived();
8283   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.1f, 0.01f, TEST_LOCATION );
8284   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8285   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.3f, 0.01f, TEST_LOCATION );
8286   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8287
8288   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8289   application.SendNotification();
8290   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.55f, 0.01f, TEST_LOCATION );
8291   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
8292   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.506f, 0.01f, TEST_LOCATION );
8293   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
8294
8295   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8296   application.SendNotification();
8297   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.9f, 0.01f, TEST_LOCATION );
8298   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8299   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.7f, 0.01f, TEST_LOCATION );
8300   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8301
8302   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8303   application.SendNotification();
8304   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.99375f, 0.01f, TEST_LOCATION );
8305   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
8306   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.85625f, 0.01f, TEST_LOCATION );
8307   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
8308
8309   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8310   application.SendNotification();
8311   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   1.0f, 0.01f, TEST_LOCATION );
8312   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8313   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  1.0f, 0.01f, TEST_LOCATION );
8314   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8315
8316   // We did expect the animation to finish
8317
8318   finishCheck.CheckSignalReceived();
8319   END_TEST;
8320 }
8321
8322 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void)
8323 {
8324   TestApplication application;
8325
8326   float startValue(1.0f);
8327   Actor actor = Actor::New();
8328   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8329   Stage::GetCurrent().Add(actor);
8330
8331   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8332   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8333   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8334   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8335   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8336
8337   // Build the animation
8338   float durationSeconds(1.0f);
8339   float delay = 0.5f;
8340   Animation animation = Animation::New(durationSeconds);
8341
8342   KeyFrames keyFrames = KeyFrames::New();
8343   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8344   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8345   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8346
8347   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ) );
8348
8349   // Start the animation
8350   animation.Play();
8351
8352   bool signalReceived(false);
8353   AnimationFinishCheck finishCheck(signalReceived);
8354   animation.FinishedSignal().Connect(&application, finishCheck);
8355   application.SendNotification();
8356
8357   application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
8358   application.SendNotification();
8359   finishCheck.CheckSignalNotReceived();
8360   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.1f, 0.01f, TEST_LOCATION );
8361   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8362   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.3f, 0.01f, TEST_LOCATION );
8363   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8364
8365   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
8366   application.SendNotification();
8367   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.5f, 0.01f, TEST_LOCATION );
8368   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
8369   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.5f, 0.01f, TEST_LOCATION );
8370   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
8371
8372   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
8373   application.SendNotification();
8374   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.9f, 0.01f, TEST_LOCATION );
8375   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8376   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.7f, 0.01f, TEST_LOCATION );
8377   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8378
8379   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
8380   application.SendNotification();
8381   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.95f, 0.01f, TEST_LOCATION );
8382   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
8383   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.85f, 0.01f, TEST_LOCATION );
8384   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
8385
8386   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
8387   application.SendNotification();
8388   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   1.0f, 0.01f, TEST_LOCATION );
8389   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8390   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  1.0f, 0.01f, TEST_LOCATION );
8391   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8392
8393   // We did expect the animation to finish
8394
8395   finishCheck.CheckSignalReceived();
8396   END_TEST;
8397 }
8398
8399 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
8400 {
8401   TestApplication application;
8402
8403   float startValue(1.0f);
8404   Actor actor = Actor::New();
8405   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8406   Stage::GetCurrent().Add(actor);
8407
8408   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8409   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8410   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8411   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8412   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8413
8414   // Build the animation
8415   float durationSeconds(1.0f);
8416   float delay = 0.5f;
8417   Animation animation = Animation::New(durationSeconds);
8418
8419   KeyFrames keyFrames = KeyFrames::New();
8420   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8421   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8422   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8423
8424   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
8425
8426   // Start the animation
8427   animation.Play();
8428
8429   bool signalReceived(false);
8430   AnimationFinishCheck finishCheck(signalReceived);
8431   animation.FinishedSignal().Connect(&application, finishCheck);
8432   application.SendNotification();
8433
8434   application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
8435   application.SendNotification();
8436   finishCheck.CheckSignalNotReceived();
8437   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.1f, 0.01f, TEST_LOCATION );
8438   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8439   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.3f, 0.01f, TEST_LOCATION );
8440   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8441
8442   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
8443   application.SendNotification();
8444   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.55f, 0.01f, TEST_LOCATION );
8445   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
8446   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.506f, 0.01f, TEST_LOCATION );
8447   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
8448
8449   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
8450   application.SendNotification();
8451   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.9f, 0.01f, TEST_LOCATION );
8452   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8453   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.7f, 0.01f, TEST_LOCATION );
8454   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8455
8456   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
8457   application.SendNotification();
8458   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.99375f, 0.01f, TEST_LOCATION );
8459   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
8460   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.85625f, 0.01f, TEST_LOCATION );
8461   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
8462
8463   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
8464   application.SendNotification();
8465   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   1.0f, 0.01f, TEST_LOCATION );
8466   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8467   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  1.0f, 0.01f, TEST_LOCATION );
8468   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8469
8470   // We did expect the animation to finish
8471
8472   finishCheck.CheckSignalReceived();
8473   END_TEST;
8474 }
8475
8476 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
8477 {
8478   TestApplication application;
8479
8480   float startValue(1.0f);
8481   float delay = 0.5f;
8482   Actor actor = Actor::New();
8483   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8484   Stage::GetCurrent().Add(actor);
8485
8486   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8487   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8488   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8489   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8490   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8491
8492   // Build the animation
8493   float durationSeconds(1.0f);
8494   Animation animation = Animation::New(durationSeconds);
8495
8496   KeyFrames keyFrames = KeyFrames::New();
8497   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8498   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8499   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8500
8501   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
8502
8503   // Start the animation
8504   animation.Play();
8505
8506   bool signalReceived(false);
8507   AnimationFinishCheck finishCheck(signalReceived);
8508   animation.FinishedSignal().Connect(&application, finishCheck);
8509   application.SendNotification();
8510
8511   application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
8512   application.SendNotification();
8513   finishCheck.CheckSignalNotReceived();
8514   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.1f, 0.01f, TEST_LOCATION );
8515   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8516   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.3f, 0.01f, TEST_LOCATION );
8517   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8518
8519   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
8520   application.SendNotification();
8521   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.5f, 0.01f, TEST_LOCATION );
8522   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
8523   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.5f, 0.01f, TEST_LOCATION );
8524   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
8525
8526   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
8527   application.SendNotification();
8528   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.9f, 0.01f, TEST_LOCATION );
8529   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8530   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.7f, 0.01f, TEST_LOCATION );
8531   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8532
8533   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
8534   application.SendNotification();
8535   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.95f, 0.01f, TEST_LOCATION );
8536   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
8537   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.85f, 0.01f, TEST_LOCATION );
8538   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
8539
8540   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
8541   application.SendNotification();
8542   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   1.0f, 0.01f, TEST_LOCATION );
8543   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8544   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  1.0f, 0.01f, TEST_LOCATION );
8545   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8546
8547   // We did expect the animation to finish
8548
8549   finishCheck.CheckSignalReceived();
8550   END_TEST;
8551 }
8552
8553 int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void)
8554 {
8555   TestApplication application;
8556
8557   float startValue(1.0f);
8558   Actor actor = Actor::New();
8559   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8560   Stage::GetCurrent().Add(actor);
8561
8562   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8563   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8564   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8565   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8566   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8567
8568   // Build the animation
8569   float durationSeconds(1.0f);
8570   float delay = 0.5f;
8571   Animation animation = Animation::New(durationSeconds);
8572
8573   KeyFrames keyFrames = KeyFrames::New();
8574   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8575   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8576   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8577
8578   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
8579
8580   // Start the animation
8581   animation.Play();
8582
8583   bool signalReceived(false);
8584   AnimationFinishCheck finishCheck(signalReceived);
8585   animation.FinishedSignal().Connect(&application, finishCheck);
8586   application.SendNotification();
8587
8588   application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
8589   application.SendNotification();
8590   finishCheck.CheckSignalNotReceived();
8591   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.1f, 0.01f, TEST_LOCATION );
8592   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8593   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.3f, 0.01f, TEST_LOCATION );
8594   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8595
8596   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
8597   application.SendNotification();
8598   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.55f, 0.01f, TEST_LOCATION );
8599   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
8600   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.506f, 0.01f, TEST_LOCATION );
8601   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
8602
8603   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
8604   application.SendNotification();
8605   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.9f, 0.01f, TEST_LOCATION );
8606   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8607   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.7f, 0.01f, TEST_LOCATION );
8608   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8609
8610   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
8611   application.SendNotification();
8612   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   0.99375f, 0.01f, TEST_LOCATION );
8613   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
8614   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  0.85625f, 0.01f, TEST_LOCATION );
8615   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
8616
8617   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
8618   application.SendNotification();
8619   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   1.0f, 0.01f, TEST_LOCATION );
8620   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8621   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  1.0f, 0.01f, TEST_LOCATION );
8622   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8623
8624   // We did expect the animation to finish
8625
8626   finishCheck.CheckSignalReceived();
8627   END_TEST;
8628 }
8629
8630 int UtcDaliAnimationAnimateP(void)
8631 {
8632   TestApplication application;
8633
8634   Actor actor = Actor::New();
8635   Stage::GetCurrent().Add(actor);
8636
8637   //Build the path
8638   Vector3 position0( 30.0,  80.0,  0.0);
8639   Vector3 position1( 70.0,  120.0, 0.0);
8640   Vector3 position2( 100.0, 100.0, 0.0);
8641
8642   Dali::Path path = Dali::Path::New();
8643   path.AddPoint(position0);
8644   path.AddPoint(position1);
8645   path.AddPoint(position2);
8646
8647   //Control points for first segment
8648   path.AddControlPoint( Vector3( 39.0,  90.0, 0.0) );
8649   path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
8650
8651   //Control points for second segment
8652   path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
8653   path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
8654
8655   // Build the animation
8656   float durationSeconds( 1.0f );
8657   Animation animation = Animation::New(durationSeconds);
8658   animation.Animate(actor, path, Vector3::XAXIS);
8659
8660   // Start the animation
8661   animation.Play();
8662
8663   bool signalReceived(false);
8664   AnimationFinishCheck finishCheck(signalReceived);
8665   animation.FinishedSignal().Connect(&application, finishCheck);
8666   application.SendNotification();
8667   application.Render(0);
8668   application.SendNotification();
8669   finishCheck.CheckSignalNotReceived();
8670   Vector3 position, tangent;
8671   Quaternion rotation;
8672   path.Sample( 0.0f, position, tangent );
8673   rotation = Quaternion( Vector3::XAXIS, tangent );
8674   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8675   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8676
8677   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8678   application.SendNotification();
8679   path.Sample( 0.25f, position, tangent );
8680   rotation = Quaternion( Vector3::XAXIS, tangent );
8681   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8682   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8683
8684   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8685   application.SendNotification();
8686   path.Sample( 0.5f, position, tangent );
8687   rotation = Quaternion( Vector3::XAXIS, tangent );
8688   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8689   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8690
8691   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8692   application.SendNotification();
8693   path.Sample( 0.75f, position, tangent );
8694   rotation = Quaternion( Vector3::XAXIS, tangent );
8695   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8696   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8697
8698   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8699   application.SendNotification();
8700   path.Sample( 1.0f, position, tangent );
8701   rotation = Quaternion( Vector3::XAXIS, tangent );
8702   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8703   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8704
8705   finishCheck.CheckSignalReceived();
8706   END_TEST;
8707 }
8708
8709 int UtcDaliAnimationAnimateAlphaFunctionP(void)
8710 {
8711   TestApplication application;
8712
8713   Actor actor = Actor::New();
8714   Stage::GetCurrent().Add(actor);
8715
8716   //Build the path
8717   Vector3 position0( 30.0,  80.0,  0.0);
8718   Vector3 position1( 70.0,  120.0, 0.0);
8719   Vector3 position2( 100.0, 100.0, 0.0);
8720
8721   Dali::Path path = Dali::Path::New();
8722   path.AddPoint(position0);
8723   path.AddPoint(position1);
8724   path.AddPoint(position2);
8725
8726   //Control points for first segment
8727   path.AddControlPoint( Vector3( 39.0,  90.0, 0.0) );
8728   path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
8729
8730   //Control points for second segment
8731   path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
8732   path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
8733
8734   // Build the animation
8735   float durationSeconds( 1.0f );
8736   Animation animation = Animation::New(durationSeconds);
8737   animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
8738
8739   // Start the animation
8740   animation.Play();
8741
8742   bool signalReceived(false);
8743   AnimationFinishCheck finishCheck(signalReceived);
8744   animation.FinishedSignal().Connect(&application, finishCheck);
8745   application.SendNotification();
8746   application.Render(0);
8747   application.SendNotification();
8748   finishCheck.CheckSignalNotReceived();
8749   Vector3 position, tangent;
8750   Quaternion rotation;
8751   path.Sample( 0.0f, position, tangent );
8752   rotation = Quaternion( Vector3::XAXIS, tangent );
8753   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8754   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8755
8756   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8757   application.SendNotification();
8758   path.Sample( 0.25f, position, tangent );
8759   rotation = Quaternion( Vector3::XAXIS, tangent );
8760   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8761   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8762
8763   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8764   application.SendNotification();
8765   path.Sample( 0.5f, position, tangent );
8766   rotation = Quaternion( Vector3::XAXIS, tangent );
8767   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8768   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8769
8770   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8771   application.SendNotification();
8772   path.Sample( 0.75f, position, tangent );
8773   rotation = Quaternion( Vector3::XAXIS, tangent );
8774   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8775   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8776
8777   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8778   application.SendNotification();
8779   path.Sample( 1.0f, position, tangent );
8780   rotation = Quaternion( Vector3::XAXIS, tangent );
8781   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8782   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8783
8784   finishCheck.CheckSignalReceived();
8785   END_TEST;
8786 }
8787
8788 int UtcDaliAnimationAnimateTimePeriodP(void)
8789 {
8790   TestApplication application;
8791
8792   Actor actor = Actor::New();
8793   Stage::GetCurrent().Add(actor);
8794
8795   //Build the path
8796   Vector3 position0( 30.0,  80.0,  0.0);
8797   Vector3 position1( 70.0,  120.0, 0.0);
8798   Vector3 position2( 100.0, 100.0, 0.0);
8799
8800   Dali::Path path = Dali::Path::New();
8801   path.AddPoint(position0);
8802   path.AddPoint(position1);
8803   path.AddPoint(position2);
8804
8805   //Control points for first segment
8806   path.AddControlPoint( Vector3( 39.0,  90.0, 0.0) );
8807   path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
8808
8809   //Control points for second segment
8810   path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
8811   path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
8812
8813   // Build the animation
8814   float durationSeconds( 1.0f );
8815   Animation animation = Animation::New(durationSeconds);
8816   animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
8817
8818   // Start the animation
8819   animation.Play();
8820
8821   bool signalReceived(false);
8822   AnimationFinishCheck finishCheck(signalReceived);
8823   animation.FinishedSignal().Connect(&application, finishCheck);
8824   application.SendNotification();
8825   application.Render(0);
8826   application.SendNotification();
8827   finishCheck.CheckSignalNotReceived();
8828   Vector3 position, tangent;
8829   Quaternion rotation;
8830   path.Sample( 0.0f, position, tangent );
8831   rotation = Quaternion( Vector3::XAXIS, tangent );
8832   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8833   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8834
8835   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8836   application.SendNotification();
8837   path.Sample( 0.25f, position, tangent );
8838   rotation = Quaternion( Vector3::XAXIS, tangent );
8839   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8840   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8841
8842   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8843   application.SendNotification();
8844   path.Sample( 0.5f, position, tangent );
8845   rotation = Quaternion( Vector3::XAXIS, tangent );
8846   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8847   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8848
8849   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8850   application.SendNotification();
8851   path.Sample( 0.75f, position, tangent );
8852   rotation = Quaternion( Vector3::XAXIS, tangent );
8853   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8854   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8855
8856   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8857   application.SendNotification();
8858   path.Sample( 1.0f, position, tangent );
8859   rotation = Quaternion( Vector3::XAXIS, tangent );
8860   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8861   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8862
8863   finishCheck.CheckSignalReceived();
8864   END_TEST;
8865 }
8866
8867 int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
8868 {
8869   TestApplication application;
8870
8871   Actor actor = Actor::New();
8872   Stage::GetCurrent().Add(actor);
8873
8874   //Build the path
8875   Vector3 position0( 30.0,  80.0,  0.0);
8876   Vector3 position1( 70.0,  120.0, 0.0);
8877   Vector3 position2( 100.0, 100.0, 0.0);
8878
8879   Dali::Path path = Dali::Path::New();
8880   path.AddPoint(position0);
8881   path.AddPoint(position1);
8882   path.AddPoint(position2);
8883
8884   //Control points for first segment
8885   path.AddControlPoint( Vector3( 39.0,  90.0, 0.0) );
8886   path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
8887
8888   //Control points for second segment
8889   path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
8890   path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
8891
8892   // Build the animation
8893   float durationSeconds( 1.0f );
8894   Animation animation = Animation::New(durationSeconds);
8895   animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
8896
8897   // Start the animation
8898   animation.Play();
8899
8900   bool signalReceived(false);
8901   AnimationFinishCheck finishCheck(signalReceived);
8902   animation.FinishedSignal().Connect(&application, finishCheck);
8903   application.SendNotification();
8904   application.Render(0);
8905   application.SendNotification();
8906   finishCheck.CheckSignalNotReceived();
8907   Vector3 position, tangent;
8908   Quaternion rotation;
8909   path.Sample( 0.0f, position, tangent );
8910   rotation = Quaternion( Vector3::XAXIS, tangent );
8911   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8912   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8913
8914   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8915   application.SendNotification();
8916   path.Sample( 0.25f, position, tangent );
8917   rotation = Quaternion( Vector3::XAXIS, tangent );
8918   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8919   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8920
8921   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8922   application.SendNotification();
8923   path.Sample( 0.5f, position, tangent );
8924   rotation = Quaternion( Vector3::XAXIS, tangent );
8925   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8926   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8927
8928   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8929   application.SendNotification();
8930   path.Sample( 0.75f, position, tangent );
8931   rotation = Quaternion( Vector3::XAXIS, tangent );
8932   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8933   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8934
8935   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8936   application.SendNotification();
8937   path.Sample( 1.0f, position, tangent );
8938   rotation = Quaternion( Vector3::XAXIS, tangent );
8939   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
8940   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
8941
8942   finishCheck.CheckSignalReceived();
8943   END_TEST;
8944 }
8945
8946 int UtcDaliAnimationShowP(void)
8947 {
8948   TestApplication application;
8949
8950   Actor actor = Actor::New();
8951   actor.SetVisible(false);
8952   application.SendNotification();
8953   application.Render(0);
8954   DALI_TEST_CHECK( !actor.IsVisible() );
8955   Stage::GetCurrent().Add(actor);
8956
8957   // Start the animation
8958   float durationSeconds(10.0f);
8959   Animation animation = Animation::New(durationSeconds);
8960   animation.Show(actor, durationSeconds*0.5f);
8961   animation.Play();
8962
8963   bool signalReceived(false);
8964   AnimationFinishCheck finishCheck(signalReceived);
8965   animation.FinishedSignal().Connect(&application, finishCheck);
8966
8967   application.SendNotification();
8968   application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
8969
8970   // We didn't expect the animation to finish yet
8971   application.SendNotification();
8972   finishCheck.CheckSignalNotReceived();
8973   DALI_TEST_CHECK( !actor.IsVisible() );
8974
8975   application.SendNotification();
8976   application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be shown now*/);
8977
8978   // We didn't expect the animation to finish yet
8979   application.SendNotification();
8980   finishCheck.CheckSignalNotReceived();
8981   DALI_TEST_CHECK( actor.IsVisible() );
8982
8983   application.SendNotification();
8984   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8985
8986   // We did expect the animation to finish
8987   application.SendNotification();
8988   finishCheck.CheckSignalReceived();
8989   DALI_TEST_CHECK( actor.IsVisible() );
8990   END_TEST;
8991 }
8992
8993 int UtcDaliAnimationHideP(void)
8994 {
8995   TestApplication application;
8996
8997   Actor actor = Actor::New();
8998   DALI_TEST_CHECK( actor.IsVisible() );
8999   Stage::GetCurrent().Add(actor);
9000
9001   // Start the animation
9002   float durationSeconds(10.0f);
9003   Animation animation = Animation::New(durationSeconds);
9004   animation.Hide(actor, durationSeconds*0.5f);
9005   animation.Play();
9006
9007   bool signalReceived(false);
9008   AnimationFinishCheck finishCheck(signalReceived);
9009   animation.FinishedSignal().Connect(&application, finishCheck);
9010
9011   application.SendNotification();
9012   application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
9013
9014   // We didn't expect the animation to finish yet
9015   application.SendNotification();
9016   finishCheck.CheckSignalNotReceived();
9017   DALI_TEST_CHECK( actor.IsVisible() );
9018
9019   application.SendNotification();
9020   application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be hidden now*/);
9021
9022   // We didn't expect the animation to finish yet
9023   application.SendNotification();
9024   finishCheck.CheckSignalNotReceived();
9025   DALI_TEST_CHECK( !actor.IsVisible() );
9026
9027   application.SendNotification();
9028   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
9029
9030   // We did expect the animation to finish
9031   application.SendNotification();
9032   finishCheck.CheckSignalReceived();
9033   DALI_TEST_CHECK( !actor.IsVisible() );
9034   END_TEST;
9035 }
9036
9037 int UtcDaliAnimationShowHideAtEndP(void)
9038 {
9039   // Test that show/hide delay can be the same as animation duration
9040   // i.e. to show/hide at the end of the animation
9041
9042   TestApplication application;
9043
9044   Actor actor = Actor::New();
9045   DALI_TEST_CHECK( actor.IsVisible() );
9046   Stage::GetCurrent().Add(actor);
9047
9048   // Start Hide animation
9049   float durationSeconds(10.0f);
9050   Animation animation = Animation::New(durationSeconds);
9051   animation.Hide(actor, durationSeconds/*Hide at end*/);
9052   animation.Play();
9053
9054   bool signalReceived(false);
9055   AnimationFinishCheck finishCheck(signalReceived);
9056   animation.FinishedSignal().Connect(&application, finishCheck);
9057
9058   application.SendNotification();
9059   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
9060
9061   // We did expect the animation to finish
9062   application.SendNotification();
9063   finishCheck.CheckSignalReceived();
9064   DALI_TEST_CHECK( !actor.IsVisible() );
9065
9066   // Start Show animation
9067   animation = Animation::New(durationSeconds);
9068   animation.Show(actor, durationSeconds/*Show at end*/);
9069   animation.FinishedSignal().Connect(&application, finishCheck);
9070   animation.Play();
9071
9072   application.SendNotification();
9073   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
9074
9075   // We did expect the animation to finish
9076   application.SendNotification();
9077   finishCheck.CheckSignalReceived();
9078   DALI_TEST_CHECK( actor.IsVisible() );
9079   END_TEST;
9080 }
9081
9082 int UtcDaliKeyFramesCreateDestroyP(void)
9083 {
9084   tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
9085
9086   KeyFrames* keyFrames = new KeyFrames;
9087   delete keyFrames;
9088   DALI_TEST_CHECK( true );
9089   END_TEST;
9090 }
9091
9092 int UtcDaliKeyFramesDownCastP(void)
9093 {
9094   TestApplication application;
9095   tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
9096
9097   KeyFrames keyFrames = KeyFrames::New();
9098   BaseHandle object(keyFrames);
9099
9100   KeyFrames keyFrames2 = KeyFrames::DownCast(object);
9101   DALI_TEST_CHECK(keyFrames2);
9102
9103   KeyFrames keyFrames3 = DownCast< KeyFrames >(object);
9104   DALI_TEST_CHECK(keyFrames3);
9105
9106   BaseHandle unInitializedObject;
9107   KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
9108   DALI_TEST_CHECK(!keyFrames4);
9109
9110   KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject);
9111   DALI_TEST_CHECK(!keyFrames5);
9112   END_TEST;
9113 }
9114
9115 int UtcDaliAnimationCreateDestroyP(void)
9116 {
9117   TestApplication application;
9118   Animation* animation = new Animation;
9119   DALI_TEST_CHECK( animation );
9120   delete animation;
9121   END_TEST;
9122 }
9123
9124 struct UpdateManagerTestConstraint
9125 {
9126   UpdateManagerTestConstraint(TestApplication& application)
9127   : mApplication(application)
9128   {
9129   }
9130
9131   void operator()( Vector3& current, const PropertyInputContainer& /* inputs */)
9132   {
9133     mApplication.SendNotification();  // Process events
9134   }
9135
9136   TestApplication& mApplication;
9137 };
9138
9139 int UtcDaliAnimationUpdateManagerP(void)
9140 {
9141   TestApplication application;
9142
9143   Actor actor = Actor::New();
9144   Stage::GetCurrent().Add( actor );
9145
9146   // Build the animation
9147   Animation animation = Animation::New( 0.0f );
9148
9149   bool signalReceived = false;
9150   AnimationFinishCheck finishCheck( signalReceived );
9151   animation.FinishedSignal().Connect( &application, finishCheck );
9152
9153   Vector3 startValue(1.0f, 1.0f, 1.0f);
9154   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
9155   Constraint constraint = Constraint::New<Vector3>( actor, index, UpdateManagerTestConstraint( application ) );
9156   constraint.Apply();
9157
9158   // Apply animation to actor
9159   animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunction::LINEAR );
9160
9161   animation.Play();
9162
9163   application.SendNotification();
9164   application.UpdateOnly( 16 );
9165
9166   finishCheck.CheckSignalNotReceived();
9167
9168   application.SendNotification();   // Process events
9169
9170   finishCheck.CheckSignalReceived();
9171
9172   END_TEST;
9173 }
9174
9175 int UtcDaliAnimationSignalOrderP(void)
9176 {
9177   TestApplication application;
9178
9179   Actor actor = Actor::New();
9180   Stage::GetCurrent().Add( actor );
9181
9182   // Build the animations
9183   Animation animation1 = Animation::New( 0.0f ); // finishes first frame
9184   Animation animation2 = Animation::New( 0.02f ); // finishes in 20 ms
9185
9186   bool signal1Received = false;
9187   animation1.FinishedSignal().Connect( &application, AnimationFinishCheck( signal1Received ) );
9188
9189   bool signal2Received = false;
9190   animation2.FinishedSignal().Connect( &application, AnimationFinishCheck( signal2Received ) );
9191
9192   // Apply animations to actor
9193   animation1.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 3.0f, 2.0f, 1.0f ), AlphaFunction::LINEAR );
9194   animation1.Play();
9195   animation2.AnimateTo( Property(actor, Actor::Property::SIZE ), Vector3( 10.0f, 20.0f, 30.0f ), AlphaFunction::LINEAR );
9196   animation2.Play();
9197
9198   DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
9199   DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
9200
9201   application.SendNotification();
9202   application.UpdateOnly( 10 ); // 10ms progress
9203
9204   // no notifications yet
9205   DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
9206   DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
9207
9208   application.SendNotification();
9209
9210   // first completed
9211   DALI_TEST_EQUALS( signal1Received, true, TEST_LOCATION );
9212   DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
9213   signal1Received = false;
9214
9215   // 1st animation is complete now, do another update with no ProcessEvents in between
9216   application.UpdateOnly( 20 ); // 20ms progress
9217
9218   // ProcessEvents
9219   application.SendNotification();
9220
9221   // 2nd should complete now
9222   DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
9223   DALI_TEST_EQUALS( signal2Received, true, TEST_LOCATION );
9224
9225   END_TEST;
9226 }
9227
9228 int UtcDaliAnimationExtendDurationP(void)
9229 {
9230   TestApplication application;
9231
9232   Actor actor = Actor::New();
9233
9234   // Register a float property
9235   float startValue(10.0f);
9236   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
9237   Stage::GetCurrent().Add(actor);
9238   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
9239
9240   // Build the animation
9241   float initialDurationSeconds(1.0f);
9242   float animatorDelay = 5.0f;
9243   float animatorDurationSeconds(5.0f);
9244   float extendedDurationSeconds(animatorDelay+animatorDurationSeconds);
9245   Animation animation = Animation::New(initialDurationSeconds);
9246   float targetValue(30.0f);
9247   float relativeValue(targetValue - startValue);
9248
9249   animation.AnimateTo(Property(actor, index),
9250                       targetValue,
9251                       TimePeriod(animatorDelay, animatorDurationSeconds));
9252
9253   // The duration should have been extended
9254   DALI_TEST_EQUALS( animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION );
9255
9256   // Start the animation
9257   animation.Play();
9258
9259   bool signalReceived(false);
9260   AnimationFinishCheck finishCheck(signalReceived);
9261   animation.FinishedSignal().Connect(&application, finishCheck);
9262
9263   application.SendNotification();
9264   application.Render(static_cast<unsigned int>(extendedDurationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
9265
9266   // We didn't expect the animation to finish yet
9267   application.SendNotification();
9268   finishCheck.CheckSignalNotReceived();
9269   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
9270
9271   application.SendNotification();
9272   application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
9273
9274   // We didn't expect the animation to finish yet
9275   application.SendNotification();
9276   finishCheck.CheckSignalNotReceived();
9277   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
9278
9279   application.SendNotification();
9280   application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
9281
9282   // We did expect the animation to finish
9283   application.SendNotification();
9284   finishCheck.CheckSignalReceived();
9285   DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
9286   END_TEST;
9287 }
9288
9289 int UtcDaliAnimationCustomIntProperty(void)
9290 {
9291   TestApplication application;
9292
9293   Actor actor = Actor::New();
9294   Stage::GetCurrent().Add(actor);
9295   int startValue(0u);
9296
9297   Property::Index index = actor.RegisterProperty("anIndex",  startValue);
9298   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
9299
9300   // Build the animation
9301   float durationSeconds(1.0f);
9302   Animation animation = Animation::New(durationSeconds);
9303   animation.AnimateTo( Property(actor, index), 20 );
9304
9305   // Start the animation
9306   animation.Play();
9307
9308   bool signalReceived(false);
9309   AnimationFinishCheck finishCheck(signalReceived);
9310   animation.FinishedSignal().Connect(&application, finishCheck);
9311
9312   application.SendNotification();
9313   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
9314
9315   // We didn't expect the animation to finish yet
9316   application.SendNotification();
9317   finishCheck.CheckSignalNotReceived();
9318   DALI_TEST_EQUALS( actor.GetProperty<int>(index), 10, TEST_LOCATION );
9319
9320   application.SendNotification();
9321   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
9322
9323   // We did expect the animation to finish
9324   application.SendNotification();
9325   finishCheck.CheckSignalReceived();
9326   DALI_TEST_EQUALS( actor.GetProperty<int>(index), 20, TEST_LOCATION );
9327   END_TEST;
9328 }