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