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