Revert "[Tizen] Move DevelHandle::GetCurrentProperty to public"
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-Animation.cpp
1 /*
2  * Copyright (c) 2017 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/devel-api/actors/actor-devel.h>
24 #include <dali/devel-api/object/handle-devel.h>
25 #include <dali-test-suite-utils.h>
26
27 using std::max;
28 using namespace Dali;
29
30 void utc_dali_animation_startuP(void)
31 {
32   test_return_value = TET_UNDEF;
33 }
34
35 void utc_dali_animation_cleanuP(void)
36 {
37   test_return_value = TET_PASS;
38 }
39
40 namespace
41 {
42
43 static const float ROTATION_EPSILON = 0.0001f;
44 static const float VECTOR4_EPSILON = 0.0001f;
45
46 // Functor to test whether a Finish signal is emitted
47 struct AnimationFinishCheck
48 {
49   AnimationFinishCheck(bool& signalReceived)
50   : mSignalReceived(signalReceived)
51   {
52   }
53
54   void operator()(Animation& animation)
55   {
56     mSignalReceived = true;
57   }
58
59   void Reset()
60   {
61     mSignalReceived = false;
62   }
63
64   void CheckSignalReceived()
65   {
66     if (!mSignalReceived)
67     {
68       tet_printf("Expected Finish signal was not received\n");
69       tet_result(TET_FAIL);
70     }
71     else
72     {
73       tet_result(TET_PASS);
74     }
75   }
76
77   void CheckSignalNotReceived()
78   {
79     if (mSignalReceived)
80     {
81       tet_printf("Unexpected Finish signal was received\n");
82       tet_result(TET_FAIL);
83     }
84     else
85     {
86       tet_result(TET_PASS);
87     }
88   }
89
90   bool& mSignalReceived; // owned by individual tests
91 };
92
93 } // anon namespace
94
95 int UtcDaliAnimationConstructorP(void)
96 {
97   TestApplication application;
98
99   Animation animation;
100
101   DALI_TEST_CHECK( !animation );
102   END_TEST;
103 }
104
105 int UtcDaliAnimationNewP(void)
106 {
107   TestApplication application;
108
109   Animation animation = Animation::New( 1.0f );
110
111   DALI_TEST_CHECK(animation);
112   END_TEST;
113 }
114
115 int UtcDaliAnimationNewN(void)
116 {
117   TestApplication application;
118
119   Animation animation = Animation::New( -1.0f );
120
121   DALI_TEST_CHECK(animation);
122   DALI_TEST_EQUALS(animation.GetDuration(), 0.0f, TEST_LOCATION);
123   END_TEST;
124 }
125
126 int UtcDaliAnimationDownCastP(void)
127 {
128   TestApplication application;
129
130   tet_infoline("Testing Dali::Animation::DownCast()");
131
132   float durationSeconds(1.0f);
133   Animation animation = Animation::New(durationSeconds);
134
135   BaseHandle object(animation);
136
137   Animation animation2 = Animation::DownCast(object);
138   DALI_TEST_CHECK(animation2);
139
140   Animation animation3 = DownCast< Animation >(object);
141   DALI_TEST_CHECK(animation3);
142   END_TEST;
143 }
144
145 int UtcDaliAnimationDownCastN(void)
146 {
147   TestApplication application;
148
149   BaseHandle unInitializedObject;
150
151   Animation animation1 = Animation::DownCast( unInitializedObject );
152   DALI_TEST_CHECK( !animation1 );
153
154   Animation animation2 = DownCast< Animation >( unInitializedObject );
155   DALI_TEST_CHECK( !animation2 );
156   END_TEST;
157 }
158
159 int UtcDaliAnimationCopyConstructorP(void)
160 {
161   TestApplication application;
162
163   // Initialize an object, ref count == 1
164   Animation animation = Animation::New( 1.0f );
165
166   Animation copy( animation );
167   DALI_TEST_CHECK( copy );
168
169   DALI_TEST_CHECK( copy.GetDuration() == animation.GetDuration() );
170   END_TEST;
171 }
172
173 int UtcDaliAnimationAssignmentOperatorP(void)
174 {
175   TestApplication application;
176
177   Animation animation = Animation::New( 1.0f );
178
179   Animation copy = animation;
180   DALI_TEST_CHECK( copy );
181
182   DALI_TEST_CHECK( animation == copy );
183
184   DALI_TEST_CHECK( copy.GetDuration() == animation.GetDuration() );
185   END_TEST;
186 }
187
188 int UtcDaliAnimationSetDurationP(void)
189 {
190   TestApplication application;
191
192   Actor actor = Actor::New();
193   Stage::GetCurrent().Add(actor);
194
195   // Build the animation
196   float durationSeconds(1.0f);
197   Animation animation = Animation::New(durationSeconds);
198   DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
199
200   // Start the animation
201   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
202   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
203   animation.Play();
204
205   bool signalReceived(false);
206   AnimationFinishCheck finishCheck(signalReceived);
207   animation.FinishedSignal().Connect(&application, finishCheck);
208
209   application.SendNotification();
210   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
211
212   // We didn't expect the animation to finish yet
213   application.SendNotification();
214   finishCheck.CheckSignalNotReceived();
215
216   application.Render(2u/*just beyond the animation duration*/);
217
218   // We did expect the animation to finish
219   application.SendNotification();
220   finishCheck.CheckSignalReceived();
221   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
222
223   // Restart the animation, with a different duration
224   finishCheck.Reset();
225   actor.SetPosition(Vector3::ZERO);
226   durationSeconds = 3.5f;
227   animation.SetDuration(durationSeconds);
228   DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
229   animation.Play();
230
231   application.SendNotification();
232   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
233
234   // We didn't expect the animation to finish yet
235   application.SendNotification();
236   finishCheck.CheckSignalNotReceived();
237
238   application.Render(2u/*just beyond the animation duration*/);
239
240   // We did expect the animation to finish
241   application.SendNotification();
242   finishCheck.CheckSignalReceived();
243   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
244
245   // Check that nothing has changed after a couple of buffer swaps
246   application.Render(0);
247   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
248   application.Render(0);
249   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
250   END_TEST;
251 }
252
253 int UtcDaliAnimationSetDurationN(void)
254 {
255   TestApplication application;
256
257   Animation animation = Animation::New( 1.0f );
258   DALI_TEST_EQUALS( animation.GetDuration(), 1.0f, TEST_LOCATION );
259
260   animation.SetDuration( -1.0f );
261   DALI_TEST_EQUALS( animation.GetDuration(), 0.0f, TEST_LOCATION );
262   END_TEST;
263 }
264
265 int UtcDaliAnimationGetDurationP(void)
266 {
267   TestApplication application;
268
269   Animation animation = Animation::New(1.0f);
270   DALI_TEST_EQUALS(animation.GetDuration(), 1.0f, TEST_LOCATION);
271
272   animation.SetDuration(2.0f);
273   DALI_TEST_EQUALS(animation.GetDuration(), 2.0f, TEST_LOCATION);
274   END_TEST;
275 }
276
277 int UtcDaliAnimationSetLoopingP(void)
278 {
279   TestApplication application;
280
281   Actor actor = Actor::New();
282   Stage::GetCurrent().Add(actor);
283
284   // Build the animation
285   float durationSeconds(1.0f);
286   Animation animation = Animation::New(durationSeconds);
287   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
288   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
289
290   // Start the animation
291   animation.SetLooping(true);
292   DALI_TEST_CHECK(animation.IsLooping());
293   animation.Play();
294
295   bool signalReceived(false);
296   AnimationFinishCheck finishCheck(signalReceived);
297   animation.FinishedSignal().Connect(&application, finishCheck);
298
299   application.SendNotification();
300
301   // Loop 5 times
302   float intervalSeconds = 0.25f;
303   float progress = 0.0f;
304   for (int iterations = 0; iterations < 5;)
305   {
306     application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
307
308     progress += intervalSeconds;
309     DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
310
311     if (progress >= 1.0f)
312     {
313       progress = progress - 1.0f;
314       ++iterations;
315     }
316   }
317
318   // We didn't expect the animation to finish yet
319   application.SendNotification();
320   finishCheck.CheckSignalNotReceived();
321
322   animation.SetLooping(false);
323   DALI_TEST_CHECK(!animation.IsLooping());
324
325   application.SendNotification();
326   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
327
328   // We did expect the animation to finish
329   application.SendNotification();
330   finishCheck.CheckSignalReceived();
331   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
332
333   // Check that nothing has changed after a couple of buffer swaps
334   application.Render(0);
335   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
336   application.Render(0);
337   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
338   END_TEST;
339 }
340
341 int UtcDaliAnimationSetLoopCountP(void)
342 {
343   TestApplication application;
344
345   Actor actor = Actor::New();
346   Stage::GetCurrent().Add(actor);
347
348   // Build the animation
349   float durationSeconds(1.0f);
350   Animation animation = Animation::New(durationSeconds);
351   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
352   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
353
354   // Start the animation
355   animation.SetLoopCount(3);
356   DALI_TEST_CHECK(animation.IsLooping());
357   animation.Play();
358
359   bool signalReceived(false);
360   AnimationFinishCheck finishCheck(signalReceived);
361   animation.FinishedSignal().Connect(&application, finishCheck);
362
363   application.Render(0);
364   application.SendNotification();
365   application.Render(0);
366   application.SendNotification();
367   application.Render(0);
368   application.SendNotification();
369   application.Render(0);
370   application.SendNotification();
371
372   // Loop
373   float intervalSeconds = 3.0f;
374
375   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
376   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
377
378   application.Render(0);
379   application.SendNotification();
380   application.Render(0);
381   application.SendNotification();
382   application.Render(0);
383   application.SendNotification();
384   application.Render(0);
385   application.SendNotification();
386   finishCheck.CheckSignalNotReceived();
387
388   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
389
390   application.SendNotification();
391   finishCheck.CheckSignalReceived();
392   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
393
394   finishCheck.Reset();
395
396   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
397   application.SendNotification();
398   finishCheck.CheckSignalNotReceived();
399
400   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
401   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
402   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
403   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
404   application.SendNotification();
405   finishCheck.CheckSignalNotReceived();
406
407   END_TEST;
408 }
409
410 int UtcDaliAnimationSetLoopCountP2(void)
411 {
412   TestApplication application;
413
414   //
415   // switching between forever and loop count
416   //
417
418   Actor actor = Actor::New();
419   Stage::GetCurrent().Add(actor);
420
421   // Build the animation
422   float durationSeconds(1.0f);
423   Animation animation = Animation::New(durationSeconds);
424   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
425   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
426   animation.SetEndAction(Animation::Discard);
427
428   // Start the animation
429   animation.SetLoopCount(3);
430   DALI_TEST_CHECK(animation.IsLooping());
431   animation.Play();
432
433   bool signalReceived(false);
434   AnimationFinishCheck finishCheck(signalReceived);
435   animation.FinishedSignal().Connect(&application, finishCheck);
436
437   float intervalSeconds = 3.0f;
438
439   application.SendNotification();
440   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
441   application.SendNotification();
442   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
443   application.SendNotification();
444   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
445   application.SendNotification();
446
447   application.SendNotification();
448   finishCheck.CheckSignalReceived();
449
450   finishCheck.Reset();
451
452   // Loop forever
453   animation.SetLooping(true);
454   DALI_TEST_CHECK(animation.IsLooping());
455
456   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
457   application.SendNotification();
458   finishCheck.CheckSignalNotReceived();
459
460   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
461   application.SendNotification();
462   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
463   application.SendNotification();
464   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
465   application.SendNotification();
466   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
467   application.SendNotification();
468   application.SendNotification();
469   finishCheck.CheckSignalNotReceived();
470
471   finishCheck.Reset();
472
473   // Loop N again
474   animation.SetLoopCount(3);
475   DALI_TEST_CHECK(animation.IsLooping());
476   animation.Play();
477
478   application.SendNotification();
479   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
480   application.SendNotification();
481   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
482   application.SendNotification();
483   finishCheck.CheckSignalNotReceived();
484
485   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
486   application.SendNotification();
487   finishCheck.CheckSignalReceived();
488
489   finishCheck.Reset();
490
491   // loop forever
492   animation.SetLooping(true);
493   DALI_TEST_CHECK(animation.IsLooping());
494
495   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
496   application.SendNotification();
497   finishCheck.CheckSignalNotReceived();
498
499   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
500   application.SendNotification();
501   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
502   application.SendNotification();
503   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
504   application.SendNotification();
505   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
506   application.SendNotification();
507   finishCheck.CheckSignalNotReceived();
508
509   finishCheck.Reset();
510
511   // Loop N again
512   animation.SetLoopCount(3);
513   DALI_TEST_CHECK(animation.IsLooping());
514
515   application.SendNotification();
516   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
517   application.SendNotification();
518   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
519   application.SendNotification();
520   finishCheck.CheckSignalNotReceived();
521
522   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
523   application.SendNotification();
524   finishCheck.CheckSignalNotReceived(); // we never hit play
525
526   finishCheck.Reset();
527
528
529   END_TEST;
530 }
531
532 int UtcDaliAnimationSetLoopCountP3(void)
533 {
534   TestApplication application;
535
536   //
537   // switching between forever and loop count
538   //
539   Actor actor = Actor::New();
540   Stage::GetCurrent().Add(actor);
541
542   // Build the animation
543   float durationSeconds(1.0f);
544   Animation animation = Animation::New(durationSeconds);
545   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
546   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
547   animation.SetEndAction(Animation::Discard);
548
549   float intervalSeconds = 3.0f;
550
551   bool signalReceived(false);
552   AnimationFinishCheck finishCheck(signalReceived);
553   animation.FinishedSignal().Connect(&application, finishCheck);
554
555   // loop forever
556   animation.SetLooping(true);
557   DALI_TEST_CHECK(animation.IsLooping());
558
559   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
560   application.SendNotification();
561   finishCheck.CheckSignalNotReceived();
562
563   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
564   application.SendNotification();
565   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
566   application.SendNotification();
567   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
568   application.SendNotification();
569   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
570   application.SendNotification();
571   finishCheck.CheckSignalNotReceived();
572
573   finishCheck.Reset();
574
575   // Loop N again
576   animation.SetLoopCount(3);
577   DALI_TEST_CHECK(animation.IsLooping());
578
579   application.SendNotification();
580   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
581   application.SendNotification();
582   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
583   application.SendNotification();
584   finishCheck.CheckSignalNotReceived();
585
586   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
587   application.SendNotification();
588   finishCheck.CheckSignalNotReceived(); // we never hit play
589
590   finishCheck.Reset();
591
592
593   END_TEST;
594 }
595
596 int UtcDaliAnimationSetLoopCountP4(void)
597 {
598   TestApplication application;
599
600   //
601   // ..and play again
602   //
603   Actor actor = Actor::New();
604   Stage::GetCurrent().Add(actor);
605
606   // Build the animation
607   float durationSeconds(1.0f);
608   Animation animation = Animation::New(durationSeconds);
609   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
610   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
611   animation.SetEndAction(Animation::Bake);
612
613   float intervalSeconds = 3.0f;
614
615   bool signalReceived(false);
616   AnimationFinishCheck finishCheck(signalReceived);
617   animation.FinishedSignal().Connect(&application, finishCheck);
618
619   animation.SetLoopCount(1);
620   animation.Play();
621   DALI_TEST_CHECK(!animation.IsLooping());
622
623   application.SendNotification();
624   finishCheck.CheckSignalNotReceived();
625   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
626   application.SendNotification();
627   finishCheck.CheckSignalReceived();
628
629   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
630   actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f) );
631
632   finishCheck.Reset();
633
634   animation.Play(); // again
635   DALI_TEST_CHECK(!animation.IsLooping());
636
637   application.SendNotification();
638   finishCheck.CheckSignalNotReceived();
639   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
640   application.SendNotification();
641   finishCheck.CheckSignalReceived();
642
643   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
644
645   END_TEST;
646 }
647
648 int UtcDaliAnimationGetLoopCountP(void)
649 {
650   TestApplication application;
651
652   Actor actor = Actor::New();
653   Stage::GetCurrent().Add(actor);
654
655   // Build the animation
656   float durationSeconds(1.0f);
657   Animation animation = Animation::New(durationSeconds);
658   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
659   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
660
661   DALI_TEST_CHECK(1 == animation.GetLoopCount());
662
663   // Start the animation
664   animation.SetLoopCount(3);
665   DALI_TEST_CHECK(animation.IsLooping());
666   DALI_TEST_CHECK(3 == animation.GetLoopCount());
667
668   animation.Play();
669
670   application.Render(0);
671   application.SendNotification();
672
673   // Loop
674   float intervalSeconds = 3.0f;
675
676   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
677   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
678
679   application.Render(0);
680   application.SendNotification();
681
682   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
683   application.SendNotification();
684
685   animation.SetLoopCount(0);
686   DALI_TEST_CHECK(animation.IsLooping());
687   DALI_TEST_CHECK(0 == animation.GetLoopCount());
688
689   animation.SetLoopCount(1);
690   DALI_TEST_CHECK(!animation.IsLooping());
691   DALI_TEST_CHECK(1 == animation.GetLoopCount());
692
693   END_TEST;
694 }
695
696
697 int UtcDaliAnimationGetCurrentLoopP(void)
698 {
699   TestApplication application;
700
701   Actor actor = Actor::New();
702   Stage::GetCurrent().Add(actor);
703
704   // Build the animation
705   float durationSeconds(1.0f);
706   Animation animation = Animation::New(durationSeconds);
707   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
708   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
709
710   // Start the animation
711   animation.SetLoopCount(3);
712   DALI_TEST_CHECK(animation.IsLooping());
713   DALI_TEST_CHECK(0 == animation.GetCurrentLoop());
714   animation.Play();
715
716   bool signalReceived(false);
717   AnimationFinishCheck finishCheck(signalReceived);
718   animation.FinishedSignal().Connect(&application, finishCheck);
719
720   application.SendNotification();
721
722   // Loop
723   float intervalSeconds = 3.0f;
724
725   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
726   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
727
728   application.SendNotification();
729   finishCheck.CheckSignalNotReceived();
730   DALI_TEST_CHECK(2 == animation.GetCurrentLoop());
731
732   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
733
734   application.SendNotification();
735   finishCheck.CheckSignalReceived();
736   DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
737   DALI_TEST_CHECK(animation.GetLoopCount() == animation.GetCurrentLoop());
738
739   finishCheck.Reset();
740
741   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
742   application.SendNotification();
743   finishCheck.CheckSignalNotReceived();
744   DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
745
746   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
747   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
748   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
749   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
750   application.SendNotification();
751   finishCheck.CheckSignalNotReceived();
752   DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
753
754   END_TEST;
755 }
756
757 int UtcDaliAnimationIsLoopingP(void)
758 {
759   TestApplication application;
760
761   Animation animation = Animation::New(1.0f);
762   DALI_TEST_CHECK(!animation.IsLooping());
763
764   animation.SetLooping(true);
765   DALI_TEST_CHECK(animation.IsLooping());
766   END_TEST;
767 }
768
769 int UtcDaliAnimationSetEndActioN(void)
770 {
771   TestApplication application;
772
773   Actor actor = Actor::New();
774   Stage::GetCurrent().Add(actor);
775
776   // Build the animation
777   float durationSeconds(1.0f);
778   Animation animation = Animation::New(durationSeconds);
779   DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
780
781   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
782   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
783
784   // Start the animation
785   animation.Play();
786
787   bool signalReceived(false);
788   AnimationFinishCheck finishCheck(signalReceived);
789   animation.FinishedSignal().Connect(&application, finishCheck);
790
791   application.SendNotification();
792   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
793
794   // We did expect the animation to finish
795   application.SendNotification();
796   finishCheck.CheckSignalReceived();
797   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
798
799   // Go back to the start
800   actor.SetPosition(Vector3::ZERO);
801   application.SendNotification();
802   application.Render(0);
803   DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
804
805   // Test BakeFinal, animate again, for half the duration
806   finishCheck.Reset();
807   animation.SetEndAction(Animation::BakeFinal);
808   DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
809   animation.Play();
810
811   application.SendNotification();
812   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f*0.5f) /*half of the animation duration*/);
813
814   // Stop the animation early
815   animation.Stop();
816
817   // We did NOT expect the animation to finish
818   application.SendNotification();
819   finishCheck.CheckSignalNotReceived();
820   DALI_TEST_EQUALS( targetPosition * 0.5f, actor.GetCurrentPosition(), VECTOR4_EPSILON, TEST_LOCATION );
821
822   // The position should be same with target position in the next frame
823   application.Render(0);
824   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
825
826   // Go back to the start
827   actor.SetPosition(Vector3::ZERO);
828   application.SendNotification();
829   application.Render(0);
830   DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
831
832   // Test EndAction::Discard, animate again, but don't bake this time
833   finishCheck.Reset();
834   animation.SetEndAction(Animation::Discard);
835   DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
836   animation.Play();
837
838   application.SendNotification();
839   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
840
841   // We did expect the animation to finish
842   application.SendNotification();
843   finishCheck.CheckSignalReceived();
844   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
845
846   // The position should be discarded in the next frame
847   application.Render(0);
848   DALI_TEST_EQUALS( Vector3::ZERO/*discarded*/, actor.GetCurrentPosition(), TEST_LOCATION );
849
850   // Check that nothing has changed after a couple of buffer swaps
851   application.Render(0);
852   DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
853   application.Render(0);
854   DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
855   END_TEST;
856 }
857
858 int UtcDaliAnimationGetEndActionP(void)
859 {
860   TestApplication application;
861
862   Animation animation = Animation::New(1.0f);
863   DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
864
865   animation.SetEndAction(Animation::Discard);
866   DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
867
868   animation.SetEndAction(Animation::BakeFinal);
869   DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
870
871   END_TEST;
872 }
873
874 int UtcDaliAnimationSetDisconnectActionP(void)
875 {
876   TestApplication application;
877   Stage stage( Stage::GetCurrent() );
878
879   // Default: BakeFinal
880   {
881     Actor actor = Actor::New();
882     stage.Add(actor);
883
884     // Build the animation
885     float durationSeconds(1.0f);
886     Animation animation = Animation::New(durationSeconds);
887     DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal);
888
889     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
890     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
891
892     // Start the animation
893     animation.Play();
894
895     application.SendNotification();
896     application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
897
898     actor.Unparent();
899
900     application.SendNotification();
901     application.Render();
902
903     DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
904   }
905
906   // Bake
907   {
908     Actor actor = Actor::New();
909     stage.Add(actor);
910
911     // Build the animation
912     float durationSeconds(1.0f);
913     Animation animation = Animation::New(durationSeconds);
914     animation.SetDisconnectAction( Animation::Bake );
915
916     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
917     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
918
919     // Start the animation
920     animation.Play();
921
922     application.SendNotification();
923     application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
924
925     actor.Unparent();
926
927     application.SendNotification();
928     application.Render();
929
930     DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition*0.5f, TEST_LOCATION );
931   }
932
933   // Discard
934   {
935     Actor actor = Actor::New();
936     stage.Add(actor);
937
938     // Build the animation
939     float durationSeconds(1.0f);
940     Animation animation = Animation::New(durationSeconds);
941     animation.SetDisconnectAction( Animation::Discard );
942
943     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
944     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
945
946     // Start the animation
947     animation.Play();
948
949     application.SendNotification();
950     application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
951
952     actor.Unparent();
953
954     application.SendNotification();
955     application.Render();
956
957     DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
958   }
959
960   // Don't play the animation: disconnect action should not be applied
961   {
962     Actor actor = Actor::New();
963     stage.Add(actor);
964
965     // Build the animation
966     float durationSeconds(1.0f);
967     Animation animation = Animation::New(durationSeconds);
968
969     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
970     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
971
972     application.SendNotification();
973     application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
974
975     actor.Unparent();
976
977     application.SendNotification();
978     application.Render();
979
980     DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
981   }
982
983   END_TEST;
984 }
985
986 int UtcDaliAnimationGetDisconnectActionP(void)
987 {
988   TestApplication application;
989   Animation animation = Animation::New(1.0f);
990   DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal); // default!
991
992   animation.SetDisconnectAction(Animation::Discard);
993   DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Discard);
994
995   animation.SetDisconnectAction(Animation::Bake);
996   DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Bake);
997
998   END_TEST;
999 }
1000
1001 int UtcDaliAnimationSetDefaultAlphaFunctionP(void)
1002 {
1003   TestApplication application;
1004
1005   Animation animation = Animation::New(1.0f);
1006   AlphaFunction func = animation.GetDefaultAlphaFunction();
1007   DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1008
1009   animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1010   AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1011   DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1012   END_TEST;
1013 }
1014
1015 int UtcDaliAnimationGetDefaultAlphaFunctionP(void)
1016 {
1017   TestApplication application;
1018
1019   Animation animation = Animation::New(1.0f);
1020   AlphaFunction func = animation.GetDefaultAlphaFunction();
1021
1022   // Test that the default is linear
1023   DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1024
1025   animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1026   AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1027   DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1028
1029   END_TEST;
1030 }
1031
1032 int UtcDaliAnimationSetCurrentProgressP(void)
1033 {
1034   TestApplication application;
1035
1036   Actor actor = Actor::New();
1037   Stage::GetCurrent().Add(actor);
1038
1039   // Build the animation
1040   Animation animation = Animation::New(0.0f);
1041
1042   //Set duration
1043   float durationSeconds(1.0f);
1044   animation.SetDuration(durationSeconds);
1045
1046   bool signalReceived(false);
1047   AnimationFinishCheck finishCheck(signalReceived);
1048   animation.FinishedSignal().Connect(&application, finishCheck);
1049   application.SendNotification();
1050
1051   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1052   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1053
1054   // Start the animation from 40% progress
1055   animation.SetCurrentProgress( 0.4f );
1056   animation.Play();
1057
1058   application.SendNotification();
1059   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1060
1061   // We didn't expect the animation to finish yet
1062   application.SendNotification();
1063   finishCheck.CheckSignalNotReceived();
1064   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1065   DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
1066
1067   animation.Play(); // Test that calling play has no effect, when animation is already playing
1068   application.SendNotification();
1069
1070   //Set the progress to 70%
1071   animation.SetCurrentProgress( 0.7f );
1072   application.SendNotification();
1073   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 80% progress */);
1074   DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1075
1076   application.SendNotification();
1077   finishCheck.CheckSignalNotReceived();
1078   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1079   DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1080
1081   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1082   // We did expect the animation to finish
1083   application.SendNotification();
1084   finishCheck.CheckSignalReceived();
1085   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1086
1087   // Check that nothing has changed after a couple of buffer swaps
1088   application.Render(0);
1089   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1090   application.Render(0);
1091   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1092   END_TEST;
1093 }
1094
1095 int UtcDaliAnimationSetCurrentProgressN(void)
1096 {
1097   TestApplication application;
1098
1099   Actor actor = Actor::New();
1100   Stage::GetCurrent().Add(actor);
1101
1102   // Build the animation
1103   Animation animation = Animation::New(0.0f);
1104
1105   //Set duration
1106   float durationSeconds(1.0f);
1107   animation.SetDuration(durationSeconds);
1108
1109   bool signalReceived(false);
1110   AnimationFinishCheck finishCheck(signalReceived);
1111   animation.FinishedSignal().Connect(&application, finishCheck);
1112   application.SendNotification();
1113
1114   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1115   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1116
1117   //Trying to set the current cursor outside the range [0..1] is ignored
1118   animation.SetCurrentProgress( -1.0f);
1119   application.SendNotification();
1120   DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1121
1122   animation.SetCurrentProgress( 100.0f);
1123   application.SendNotification();
1124   DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1125   END_TEST;
1126 }
1127
1128 int UtcDaliAnimationGetCurrentProgressP(void)
1129 {
1130   TestApplication application;
1131
1132   Actor actor = Actor::New();
1133   Stage::GetCurrent().Add(actor);
1134
1135   // Build the animation
1136   Animation animation = Animation::New(0.0f);
1137   animation.Play();
1138
1139   //Test GetCurrentProgress return 0.0 as the duration is 0.0
1140   DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1141
1142   animation.SetCurrentProgress( 0.5f );
1143   application.SendNotification();
1144   application.Render(static_cast<unsigned int>(100.0f));
1145
1146   //Progress should still be 0.0
1147   DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1148
1149   //Set duration
1150   float durationSeconds(1.0f);
1151   animation.SetDuration(durationSeconds);
1152   application.SendNotification();
1153
1154   bool signalReceived(false);
1155   AnimationFinishCheck finishCheck(signalReceived);
1156   animation.FinishedSignal().Connect(&application, finishCheck);
1157   application.SendNotification();
1158
1159   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1160   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1161
1162   // Start the animation from 40% progress
1163   animation.SetCurrentProgress( 0.4f );
1164   animation.Play();
1165
1166   application.SendNotification();
1167   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1168
1169   // We didn't expect the animation to finish yet
1170   application.SendNotification();
1171   finishCheck.CheckSignalNotReceived();
1172   DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
1173
1174   animation.Play(); // Test that calling play has no effect, when animation is already playing
1175   application.SendNotification();
1176
1177   //Set the progress to 70%
1178   animation.SetCurrentProgress( 0.7f );
1179   application.SendNotification();
1180   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 80% progress */);
1181   DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1182
1183   application.SendNotification();
1184   finishCheck.CheckSignalNotReceived();
1185   DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1186
1187   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1188   // We did expect the animation to finish
1189   application.SendNotification();
1190   finishCheck.CheckSignalReceived();
1191   END_TEST;
1192 }
1193
1194 int UtcDaliAnimationSetSpeedFactorP1(void)
1195 {
1196   TestApplication application;
1197
1198   tet_printf("Testing that setting a speed factor of 2 takes half the time\n");
1199
1200   Actor actor = Actor::New();
1201   Stage::GetCurrent().Add(actor);
1202
1203   // Build the animation
1204   float durationSeconds(1.0f);
1205   Animation animation = Animation::New(durationSeconds);
1206
1207   const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1208   const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1209
1210   KeyFrames keyframes = KeyFrames::New();
1211   keyframes.Add( 0.0f, initialPosition);
1212   keyframes.Add( 1.0f, targetPosition );
1213   animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1214
1215   //Set speed to be x2
1216   animation.SetSpeedFactor(2.0f);
1217
1218   // Start the animation
1219   animation.Play();
1220
1221   bool signalReceived(false);
1222   AnimationFinishCheck finishCheck(signalReceived);
1223   animation.FinishedSignal().Connect(&application, finishCheck);
1224
1225   application.SendNotification();
1226   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1227
1228   // We didn't expect the animation to finish yet
1229   application.SendNotification();
1230   finishCheck.CheckSignalNotReceived();
1231   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1232
1233   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1234
1235   // We didn't expect the animation to finish yet
1236   application.SendNotification();
1237   finishCheck.CheckSignalNotReceived();
1238   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1239
1240   application.Render(static_cast<unsigned int>(durationSeconds*100.0f) + 1u/*just beyond half the duration*/);
1241
1242   // We did expect the animation to finish
1243   application.SendNotification();
1244   finishCheck.CheckSignalReceived();
1245   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1246
1247   // Check that nothing has changed after a couple of buffer swaps
1248   application.Render(0);
1249   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1250   application.Render(0);
1251   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1252
1253   END_TEST;
1254 }
1255
1256 int UtcDaliAnimationSetSpeedFactorP2(void)
1257 {
1258   TestApplication application;
1259
1260   Actor actor = Actor::New();
1261   Stage::GetCurrent().Add(actor);
1262
1263   // Build the animation
1264   float durationSeconds(1.0f);
1265   Animation animation = Animation::New(durationSeconds);
1266
1267   const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1268   const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1269
1270   KeyFrames keyframes = KeyFrames::New();
1271   keyframes.Add( 0.0f, initialPosition);
1272   keyframes.Add( 1.0f, targetPosition );
1273   animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1274
1275   tet_printf("Test -1 speed factor. Animation will play in reverse at normal speed\n");
1276   animation.SetSpeedFactor( -1.0f );
1277
1278   // Start the animation
1279   animation.Play();
1280
1281   bool signalReceived(false);
1282   AnimationFinishCheck finishCheck(signalReceived);
1283   animation.FinishedSignal().Connect(&application, finishCheck);
1284
1285   application.SendNotification();
1286   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1287
1288   // We didn't expect the animation to finish yet
1289   application.SendNotification();
1290   finishCheck.CheckSignalNotReceived();
1291   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1292
1293   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1294
1295   // We didn't expect the animation to finish yet
1296   application.SendNotification();
1297   finishCheck.CheckSignalNotReceived();
1298   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1299
1300   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1301
1302   // We didn't expect the animation to finish yet
1303   application.SendNotification();
1304   finishCheck.CheckSignalNotReceived();
1305   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1306
1307   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1308
1309   // We didn't expect the animation to finish yet
1310   application.SendNotification();
1311   finishCheck.CheckSignalNotReceived();
1312   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1313
1314   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1315
1316   // We did expect the animation to finish
1317   application.SendNotification();
1318   finishCheck.CheckSignalReceived();
1319   DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
1320
1321   // Check that nothing has changed after a couple of buffer swaps
1322   application.Render(0);
1323   DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1324   application.Render(0);
1325   DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1326
1327   END_TEST;
1328 }
1329
1330 int UtcDaliAnimationSetSpeedFactorP3(void)
1331 {
1332   TestApplication application;
1333
1334   Actor actor = Actor::New();
1335   Stage::GetCurrent().Add(actor);
1336
1337   // Build the animation
1338   float durationSeconds(1.0f);
1339   Animation animation = Animation::New(durationSeconds);
1340
1341   const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1342   const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1343
1344   KeyFrames keyframes = KeyFrames::New();
1345   keyframes.Add( 0.0f, initialPosition);
1346   keyframes.Add( 1.0f, targetPosition );
1347   animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1348
1349   bool signalReceived(false);
1350   AnimationFinishCheck finishCheck(signalReceived);
1351   animation.FinishedSignal().Connect(&application, finishCheck);
1352
1353   tet_printf("Test half speed factor. Animation will take twice the duration\n");
1354
1355   //Set speed to be half of normal speed
1356   animation.SetSpeedFactor( 0.5f );
1357
1358   // Start the animation
1359   animation.Play();
1360
1361   application.SendNotification();
1362   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1363
1364   // We didn't expect the animation to finish yet
1365   application.SendNotification();
1366   finishCheck.CheckSignalNotReceived();
1367   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), TEST_LOCATION );
1368
1369   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1370
1371   // We didn't expect the animation to finish yet
1372   application.SendNotification();
1373   finishCheck.CheckSignalNotReceived();
1374   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1375
1376   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
1377
1378   // We didn't expect the animation to finish yet
1379   application.SendNotification();
1380   finishCheck.CheckSignalNotReceived();
1381   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.3f), TEST_LOCATION );
1382
1383   application.SendNotification();
1384   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1385
1386   // We didn't expect the animation to finish yet
1387   application.SendNotification();
1388   finishCheck.CheckSignalNotReceived();
1389   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1390
1391   application.Render(static_cast<unsigned int>(durationSeconds*1200.0f) + 1u/*just beyond the animation duration*/);
1392
1393   // We did expect the animation to finish
1394   application.SendNotification();
1395   finishCheck.CheckSignalReceived();
1396   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1397
1398   // Check that nothing has changed after a couple of buffer swaps
1399   application.Render(0);
1400   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1401   application.Render(0);
1402   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1403   END_TEST;
1404 }
1405
1406
1407 int UtcDaliAnimationSetSpeedFactorP4(void)
1408 {
1409   TestApplication application;
1410
1411   Actor actor = Actor::New();
1412   Stage::GetCurrent().Add(actor);
1413
1414   // Build the animation
1415   float durationSeconds(1.0f);
1416   Animation animation = Animation::New(durationSeconds);
1417
1418   const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1419   const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1420
1421   KeyFrames keyframes = KeyFrames::New();
1422   keyframes.Add( 0.0f, initialPosition);
1423   keyframes.Add( 1.0f, targetPosition );
1424   animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1425
1426   bool signalReceived(false);
1427   AnimationFinishCheck finishCheck(signalReceived);
1428   animation.FinishedSignal().Connect(&application, finishCheck);
1429
1430   tet_printf("Test half speed factor. Animation will take twice the duration\n");
1431
1432   tet_printf("Set speed to be half of normal speed\n");
1433   tet_printf("SetSpeedFactor(0.5f)\n");
1434   animation.SetSpeedFactor( 0.5f );
1435
1436   // Start the animation
1437   animation.Play();
1438
1439   application.SendNotification();
1440   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1441
1442   // We didn't expect the animation to finish yet
1443   application.SendNotification();
1444   finishCheck.CheckSignalNotReceived();
1445   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), TEST_LOCATION );
1446
1447   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1448
1449   // We didn't expect the animation to finish yet
1450   application.SendNotification();
1451   finishCheck.CheckSignalNotReceived();
1452   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1453
1454   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
1455
1456   // We didn't expect the animation to finish yet
1457   application.SendNotification();
1458   finishCheck.CheckSignalNotReceived();
1459   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.3f), TEST_LOCATION );
1460
1461   tet_printf("Reverse direction of animation whilst playing\n");
1462   tet_printf("SetSpeedFactor(-0.5f)\n");
1463   animation.SetSpeedFactor(-0.5f);
1464
1465   application.SendNotification();
1466   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1467
1468   // We didn't expect the animation to finish yet
1469   application.SendNotification();
1470   finishCheck.CheckSignalNotReceived();
1471   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1472
1473   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1474
1475   // We didn't expect the animation to finish yet
1476   application.SendNotification();
1477   finishCheck.CheckSignalNotReceived();
1478   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), 0.0001, TEST_LOCATION );
1479
1480   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1481
1482   // We did expect the animation to finish
1483   application.SendNotification();
1484   finishCheck.CheckSignalReceived();
1485   DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
1486
1487   // Check that nothing has changed after a couple of buffer swaps
1488   application.Render(0);
1489   DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1490   application.Render(0);
1491   DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1492   END_TEST;
1493 }
1494
1495 int UtcDaliAnimationSetSpeedFactorAndRange(void)
1496 {
1497   TestApplication application;
1498
1499   const unsigned int NUM_FRAMES(15);
1500
1501   struct TestData
1502   {
1503     float startTime;
1504     float endTime;
1505     float startX;
1506     float endX;
1507     float expected[NUM_FRAMES];
1508   };
1509
1510   TestData testData[] = {
1511     // ACTOR 0
1512     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1513     /*                       |----------PlayRange---------------|                 */
1514     /*                                            | reverse                       */
1515     { 0.0f,                                                                  1.0f, // TimePeriod
1516       0.0f,                                                                100.0f, // POS
1517       {/**/                 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,  /* Loop */
1518        /**/                 30.0f, 40.0f, 50.0f, 60.0f, /* Reverse direction */
1519        /**/                               50.0f,
1520        /**/                        40.0f,
1521        /**/                 30.0f,
1522        /**/                                             70.0f,
1523        /**/                                      60.0f,
1524        /**/                               50.0f,
1525        /**/
1526       }
1527     },
1528
1529     // ACTOR 1 - Across start of range
1530     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1531     /*                       |----------PlayRange---------------|                 */
1532     /*                                            | reverse                       */
1533     {                0.2f,                0.5f,                               // TimePeriod
1534                      20.0f,               50.0f,                // POS
1535       {/**/                 30.0f, 40.0f, 50.0f, 50.0f, 50.0f,  /* Loop */
1536        /**/                 30.0f, 40.0f, 50.0f, 50.0f, /* Reverse direction @ frame #9 */
1537        /**/                               50.0f,
1538        /**/                        40.0f,
1539        /**/                 30.0f,
1540        /**/                                             50.0f,
1541        /**/                                      50.0f,
1542        /**/                               50.0f
1543       }
1544     },
1545
1546     // ACTOR 2 - Across end of range
1547     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1548     /*                       |----------PlayRange---------------|                 */
1549     /*                                            | reverse                       */
1550     {/**/                                  0.5f,                      0.9f,   // TimePeriod
1551      /**/                                 50.0f,                      90.0f,  // POS
1552      { /**/                 50.0f, 50.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1553        /**/                 50.0f, 50.0f, 50.0f, 60.0f,/* Reverse direction @ frame #9 */
1554        /**/                               50.0f,
1555        /**/                        50.0f,
1556        /**/                 50.0f,                      70.0f,
1557        /**/                                      60.0f,
1558        /**/                               50.0f,
1559       }
1560     },
1561
1562     // ACTOR 3 - Before beginning of range
1563     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1564     /*                       |----------PlayRange---------------|                 */
1565     /*                                            | reverse                       */
1566     {/**/     0.1f,      0.25f, // TimePeriod
1567      /**/     10.0f,     25.0f, // POS
1568      { /**/
1569        /**/ 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f
1570        /**/
1571       }
1572     },
1573
1574     // ACTOR 4 - After end of range
1575     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1576     /*                       |----------PlayRange---------------|                 */
1577     /*                                            | reverse                       */
1578     {/**/                                                           0.85f,   1.0f, // TimePeriod
1579      /**/                                                           85.0f,  100.0f, // POS
1580      { /**/
1581        /**/ 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f
1582        /**/
1583      }
1584     },
1585     // Actor 5 - Middle of range
1586     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1587     /*                       |----------PlayRange---------------|                 */
1588     /*                                            | reverse                       */
1589     {/**/                          0.4f,            0.65f, // Time Period
1590      /**/                         40.0f,            65.0f, // Position
1591      { /**/                40.0f, 40.0f, 50.0f, 60.0f, 65.0f,
1592        /**/                40.0f, 40.0f, 50.0f, 60.0f, // Reverse
1593        /**/                              50.0f,
1594        /**/                       40.0f,
1595        /**/                40.0f,
1596        /**/                                            65.0f,
1597        /**/                                      60.0f,
1598        /**/                              50.0f,
1599      }
1600     }
1601   };
1602
1603   const size_t NUM_ENTRIES(sizeof(testData)/sizeof(TestData));
1604
1605   // Build the animation
1606   float durationSeconds(1.0f);
1607   Animation animation = Animation::New(durationSeconds);
1608   bool signalReceived(false);
1609   AnimationFinishCheck finishCheck(signalReceived);
1610   animation.FinishedSignal().Connect(&application, finishCheck);
1611
1612   std::vector<Dali::Actor> actors;
1613
1614   for( unsigned int actorIndex = 0; actorIndex < NUM_ENTRIES; ++actorIndex )
1615   {
1616     Actor actor = Actor::New();
1617     actor.SetPosition( Vector3( testData[actorIndex].startX, 0, 0 ) );
1618     actors.push_back(actor);
1619     Stage::GetCurrent().Add(actor);
1620
1621     if( actorIndex == 0 || actorIndex == NUM_ENTRIES-1 )
1622     {
1623       KeyFrames keyframes = KeyFrames::New();
1624       keyframes.Add( testData[actorIndex].startTime, Vector3(testData[actorIndex].startX, 0, 0));
1625       keyframes.Add( testData[actorIndex].endTime, Vector3(testData[actorIndex].endX, 0, 0));
1626       animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1627     }
1628     else
1629     {
1630       animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( testData[actorIndex].endX, 0, 0 ), TimePeriod( testData[actorIndex].startTime, testData[actorIndex].endTime - testData[actorIndex].startTime) );
1631     }
1632   }
1633
1634   tet_printf("Test half speed factor. Animation will take twice the duration\n");
1635   tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1636   tet_printf("SetSpeedFactor(0.5f)\n");
1637   animation.SetSpeedFactor( 0.5f );
1638   animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1639   animation.SetLooping(true);
1640
1641   // Start the animation
1642   animation.Play();
1643   application.SendNotification();
1644   application.Render(0);   // Frame 0 tests initial values
1645
1646   for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1647   {
1648     unsigned int actorIndex = 0u;
1649     for( actorIndex = 0u; actorIndex < NUM_ENTRIES; ++actorIndex )
1650     {
1651       DALI_TEST_EQUALS( actors[actorIndex].GetCurrentPosition().x, testData[actorIndex].expected[frame], 0.001, TEST_LOCATION );
1652       if( ! Equals(actors[actorIndex].GetCurrentPosition().x, testData[actorIndex].expected[frame]) )
1653       {
1654         tet_printf("Failed at frame %u, actorIndex %u\n", frame, actorIndex );
1655       }
1656     }
1657
1658     if( frame == 8 )
1659     {
1660       tet_printf("Reverse direction of animation whilst playing after frame 8\n");
1661       tet_printf("SetSpeedFactor(-0.5f)\n");
1662       animation.SetSpeedFactor(-0.5f);
1663       application.SendNotification();
1664     }
1665     application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1666
1667     // We didn't expect the animation to finish yet
1668     application.SendNotification();
1669     finishCheck.CheckSignalNotReceived();
1670   }
1671
1672   END_TEST;
1673 }
1674
1675 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount01(void)
1676 {
1677   TestApplication application;
1678
1679   const unsigned int NUM_FRAMES(15);
1680
1681   struct TestData
1682   {
1683     float startTime;
1684     float endTime;
1685     float startX;
1686     float endX;
1687     float expected[NUM_FRAMES];
1688   };
1689
1690   TestData testData =
1691     // ACTOR 0
1692     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1693     /*                       |----------PlayRange---------------|                 */
1694     { 0.0f,                                                                  1.0f, // TimePeriod
1695       0.0f,                                                                100.0f, // POS
1696       {/**/                 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,  /* Loop */
1697        /**/                 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,
1698        /**/                 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,
1699        /**/
1700       }
1701     };
1702
1703
1704   // Build the animation
1705   float durationSeconds(1.0f);
1706   Animation animation = Animation::New(durationSeconds);
1707   bool signalReceived(false);
1708   AnimationFinishCheck finishCheck(signalReceived);
1709   animation.FinishedSignal().Connect(&application, finishCheck);
1710
1711   std::vector<Dali::Actor> actors;
1712
1713   Actor actor = Actor::New();
1714   actor.SetPosition( Vector3( testData.startX, 0, 0 ) );
1715   actors.push_back(actor);
1716   Stage::GetCurrent().Add(actor);
1717
1718   KeyFrames keyframes = KeyFrames::New();
1719   keyframes.Add( testData.startTime, Vector3(testData.startX, 0, 0));
1720   keyframes.Add( testData.endTime, Vector3(testData.endX, 0, 0));
1721   animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1722
1723   tet_printf("Test half speed factor. Animation will take twice the duration\n");
1724   tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1725   tet_printf("SetSpeedFactor(0.5f)\n");
1726   tet_printf("SetLoopCount(3)\n");
1727   animation.SetSpeedFactor( 0.5f );
1728   animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1729   animation.SetLoopCount(3);
1730
1731   // Start the animation
1732   animation.Play();
1733   application.SendNotification();
1734   application.Render(0);   // Frame 0 tests initial values
1735
1736   for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1737   {
1738     DALI_TEST_EQUALS( actor.GetCurrentPosition().x, testData.expected[frame], 0.001, TEST_LOCATION );
1739
1740     application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1741
1742     if( frame < NUM_FRAMES-1 )
1743     {
1744       // We didn't expect the animation to finish yet
1745       application.SendNotification();
1746       finishCheck.CheckSignalNotReceived();
1747     }
1748   }
1749
1750   // We did expect the animation to finish
1751   application.SendNotification();
1752   finishCheck.CheckSignalReceived();
1753   DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 80.0f, 0.001, TEST_LOCATION );
1754
1755   END_TEST;
1756 }
1757
1758 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount02(void)
1759 {
1760   TestApplication application;
1761
1762   const unsigned int NUM_FRAMES(15);
1763
1764   struct TestData
1765   {
1766     float startTime;
1767     float endTime;
1768     float startX;
1769     float endX;
1770     float expected[NUM_FRAMES];
1771   };
1772
1773   TestData testData =
1774     // ACTOR 0
1775     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1776     /*                       |----------PlayRange---------------|                 */
1777     { 0.0f,                                                                  1.0f, // TimePeriod
1778       0.0f,                                                                100.0f, // POS
1779       {/**/                 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1780        /**/                 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1781        /**/                 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1782       }
1783     };
1784
1785
1786   // Build the animation
1787   float durationSeconds(1.0f);
1788   Animation animation = Animation::New(durationSeconds);
1789   bool signalReceived(false);
1790   AnimationFinishCheck finishCheck(signalReceived);
1791   animation.FinishedSignal().Connect(&application, finishCheck);
1792
1793   std::vector<Dali::Actor> actors;
1794
1795   Actor actor = Actor::New();
1796   actor.SetPosition( Vector3( testData.startX, 0, 0 ) );
1797   actors.push_back(actor);
1798   Stage::GetCurrent().Add(actor);
1799
1800   KeyFrames keyframes = KeyFrames::New();
1801   keyframes.Add( testData.startTime, Vector3(testData.startX, 0, 0));
1802   keyframes.Add( testData.endTime, Vector3(testData.endX, 0, 0));
1803   animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1804
1805   tet_printf("Test reverse half speed factor. Animation will take twice the duration\n");
1806   tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1807   tet_printf("SetSpeedFactor(-0.5f)\n");
1808   tet_printf("SetLoopCount(3)\n");
1809   animation.SetSpeedFactor( -0.5f );
1810   animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1811   animation.SetLoopCount(3);
1812
1813   // Start the animation
1814   animation.Play();
1815   application.SendNotification();
1816   application.Render(0);   // Frame 0 tests initial values
1817
1818   for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1819   {
1820     DALI_TEST_EQUALS( actor.GetCurrentPosition().x, testData.expected[frame], 0.001, TEST_LOCATION );
1821
1822     application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1823
1824     if( frame < NUM_FRAMES-1 )
1825     {
1826       // We didn't expect the animation to finish yet
1827       application.SendNotification();
1828       finishCheck.CheckSignalNotReceived();
1829     }
1830   }
1831
1832   // We did expect the animation to finish
1833   application.SendNotification();
1834   finishCheck.CheckSignalReceived();
1835   DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 30.0f, 0.001, TEST_LOCATION );
1836
1837   END_TEST;
1838 }
1839
1840
1841 int UtcDaliAnimationGetSpeedFactorP(void)
1842 {
1843   TestApplication application;
1844
1845   Animation animation = Animation::New(1.0f);
1846   animation.SetSpeedFactor(0.5f);
1847   DALI_TEST_EQUALS(animation.GetSpeedFactor(), 0.5f, TEST_LOCATION);
1848
1849   animation.SetSpeedFactor(-2.5f);
1850   DALI_TEST_EQUALS(animation.GetSpeedFactor(), -2.5f, TEST_LOCATION);
1851   END_TEST;
1852 }
1853
1854 int UtcDaliAnimationSetPlayRangeP(void)
1855 {
1856   TestApplication application;
1857
1858   Actor actor = Actor::New();
1859   Stage::GetCurrent().Add( actor );
1860
1861   // Build the animation
1862   float durationSeconds( 1.0f );
1863   Animation animation = Animation::New( durationSeconds );
1864
1865   bool signalReceived( false );
1866   AnimationFinishCheck finishCheck( signalReceived );
1867   animation.FinishedSignal().Connect( &application, finishCheck );
1868   application.SendNotification();
1869
1870   // Set range between 0.4 and 0.8
1871   animation.SetPlayRange( Vector2( 0.4f, 0.9f ) );
1872   application.SendNotification();
1873   DALI_TEST_EQUALS( Vector2( 0.4f, 0.9f ), animation.GetPlayRange(), TEST_LOCATION );
1874
1875   Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
1876   animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR );
1877
1878   // Start the animation from 40% progress
1879   animation.Play();
1880
1881   application.SendNotification();
1882   application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 60% progress */ );
1883
1884   // We didn't expect the animation to finish yet
1885   application.SendNotification();
1886   finishCheck.CheckSignalNotReceived();
1887   DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.6f ), TEST_LOCATION );
1888
1889   application.SendNotification();
1890   application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 80% progress */ );
1891
1892   application.SendNotification();
1893   finishCheck.CheckSignalNotReceived();
1894   DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.8f ), TEST_LOCATION );
1895
1896   application.SendNotification();
1897   application.Render( static_cast< unsigned int >( durationSeconds*100.0f ) + 1u/*just beyond the animation duration*/ );
1898
1899   // We did expect the animation to finish
1900   application.SendNotification();
1901   finishCheck.CheckSignalReceived();
1902   DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.9f ), TEST_LOCATION );
1903   END_TEST;
1904 }
1905
1906 int UtcDaliAnimationSetPlayRangeN(void)
1907 {
1908   TestApplication application;
1909
1910   Actor actor = Actor::New();
1911   Stage::GetCurrent().Add(actor);
1912
1913   // Build the animation
1914   Animation animation = Animation::New(0);
1915   application.SendNotification();
1916
1917   //PlayRange out of bounds
1918   animation.SetPlayRange( Vector2(-1.0f,1.0f) );
1919   application.SendNotification();
1920   DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
1921   animation.SetPlayRange( Vector2(0.0f,2.0f) );
1922   application.SendNotification();
1923   DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
1924
1925   //If playRange is not in the correct order it has to be ordered
1926   animation.SetPlayRange( Vector2(0.8f,0.2f) );
1927   application.SendNotification();
1928   DALI_TEST_EQUALS( Vector2(0.2f,0.8f), animation.GetPlayRange(), TEST_LOCATION );
1929
1930   END_TEST;
1931 }
1932
1933 int UtcDaliAnimationGetPlayRangeP(void)
1934 {
1935   TestApplication application;
1936
1937   Actor actor = Actor::New();
1938   Stage::GetCurrent().Add( actor );
1939
1940   // Build the animation
1941   Animation animation = Animation::New( 1.0f );
1942   application.SendNotification();
1943
1944   //If PlayRange not specified it should be 0.0-1.0 by default
1945   DALI_TEST_EQUALS( Vector2( 0.0f,1.0f ), animation.GetPlayRange(), TEST_LOCATION );
1946
1947   // Set range between 0.4 and 0.8
1948   animation.SetPlayRange( Vector2( 0.4f, 0.8f ) );
1949   application.SendNotification();
1950   DALI_TEST_EQUALS( Vector2( 0.4f, 0.8f ), animation.GetPlayRange(), TEST_LOCATION );
1951
1952   END_TEST;
1953 }
1954
1955 int UtcDaliAnimationPlayP(void)
1956 {
1957   TestApplication application;
1958
1959   Actor actor = Actor::New();
1960   Stage::GetCurrent().Add(actor);
1961
1962   // Build the animation
1963   float durationSeconds(1.0f);
1964   Animation animation = Animation::New(durationSeconds);
1965   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1966   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1967
1968   // Start the animation
1969   animation.Play();
1970
1971   bool signalReceived(false);
1972   AnimationFinishCheck finishCheck(signalReceived);
1973   animation.FinishedSignal().Connect(&application, finishCheck);
1974
1975   application.SendNotification();
1976   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1977
1978   // We didn't expect the animation to finish yet
1979   application.SendNotification();
1980   finishCheck.CheckSignalNotReceived();
1981   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1982
1983   animation.Play(); // Test that calling play has no effect, when animation is already playing
1984   application.SendNotification();
1985   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1986
1987   // We didn't expect the animation to finish yet
1988   application.SendNotification();
1989   finishCheck.CheckSignalNotReceived();
1990   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1991
1992   animation.Play(); // Test that calling play has no effect, when animation is already playing
1993   application.SendNotification();
1994   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1995
1996   // We didn't expect the animation to finish yet
1997   application.SendNotification();
1998   finishCheck.CheckSignalNotReceived();
1999   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2000
2001   animation.Play(); // Test that calling play has no effect, when animation is already playing
2002   application.SendNotification();
2003   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2004
2005   // We didn't expect the animation to finish yet
2006   application.SendNotification();
2007   finishCheck.CheckSignalNotReceived();
2008   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2009
2010   animation.Play(); // Test that calling play has no effect, when animation is already playing
2011   application.SendNotification();
2012   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2013
2014   // We did expect the animation to finish
2015   application.SendNotification();
2016   finishCheck.CheckSignalReceived();
2017   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2018
2019   // Check that nothing has changed after a couple of buffer swaps
2020   application.Render(0);
2021   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2022   application.Render(0);
2023   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2024   END_TEST;
2025 }
2026
2027 int UtcDaliAnimationPlayOffStageP(void)
2028 {
2029   // Test that an animation can be played, when the actor is off-stage.
2030   // When the actor is added to the stage, it should appear at the current position
2031   // i.e. where it would have been anyway, if on-stage from the beginning.
2032
2033   TestApplication application;
2034
2035   Actor actor = Actor::New();
2036   Vector3 basePosition(Vector3::ZERO);
2037   DALI_TEST_EQUALS( actor.GetCurrentPosition(), basePosition, TEST_LOCATION );
2038   // Not added to the stage!
2039
2040   // Build the animation
2041   float durationSeconds(1.0f);
2042   Animation animation = Animation::New(durationSeconds);
2043   animation.SetDisconnectAction( Animation::Discard );
2044   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2045   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2046
2047   // Start the animation
2048   animation.Play();
2049
2050   bool signalReceived(false);
2051   AnimationFinishCheck finishCheck(signalReceived);
2052   animation.FinishedSignal().Connect(&application, finishCheck);
2053
2054   application.SendNotification();
2055   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2056
2057   // We didn't expect the animation to finish yet
2058   application.SendNotification();
2059   finishCheck.CheckSignalNotReceived();
2060   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*off-stage*/, TEST_LOCATION );
2061
2062   // Add to the stage
2063   Stage::GetCurrent().Add(actor);
2064
2065   application.SendNotification();
2066   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2067
2068   // We didn't expect the animation to finish yet
2069   application.SendNotification();
2070   finishCheck.CheckSignalNotReceived();
2071   Vector3 expectedPosition(basePosition + (targetPosition - basePosition)*0.4f);
2072   DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition/*on-stage*/, TEST_LOCATION );
2073
2074   // Remove from the stage
2075   Stage::GetCurrent().Remove(actor);
2076
2077   application.SendNotification();
2078   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2079
2080   // We didn't expect the animation to finish yet
2081   application.SendNotification();
2082   finishCheck.CheckSignalNotReceived();
2083   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*back to start position*/, TEST_LOCATION );
2084
2085   // Add to the stage
2086   Stage::GetCurrent().Add(actor);
2087
2088   application.SendNotification();
2089   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2090
2091   // We didn't expect the animation to finish yet
2092   application.SendNotification();
2093   finishCheck.CheckSignalNotReceived();
2094   expectedPosition = Vector3(basePosition + (targetPosition - basePosition)*0.8f);
2095   DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition, TEST_LOCATION );
2096
2097   application.SendNotification();
2098   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2099
2100   // We did expect the animation to finish
2101   application.SendNotification();
2102   finishCheck.CheckSignalReceived();
2103   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2104
2105   // Check that nothing has changed after a couple of buffer swaps
2106   application.Render(0);
2107   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2108   application.Render(0);
2109   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2110   END_TEST;
2111 }
2112
2113 int UtcDaliAnimationPlayDiscardHandleP(void)
2114 {
2115   TestApplication application;
2116
2117   Actor actor = Actor::New();
2118   Stage::GetCurrent().Add(actor);
2119
2120   // Build the animation
2121   float durationSeconds(1.0f);
2122   Animation animation = Animation::New(durationSeconds);
2123   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2124   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2125
2126   bool signalReceived(false);
2127   AnimationFinishCheck finishCheck(signalReceived);
2128   animation.FinishedSignal().Connect(&application, finishCheck);
2129
2130   // Start the animation
2131   animation.Play();
2132
2133   // This is a test of the "Fire and Forget" behaviour
2134   // Discard the animation handle!
2135   animation.Reset();
2136   DALI_TEST_CHECK( !animation );
2137
2138   application.SendNotification();
2139   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2140
2141   // We didn't expect the animation to finish yet
2142   application.SendNotification();
2143   finishCheck.CheckSignalNotReceived();
2144   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2145
2146   application.SendNotification();
2147   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2148
2149   // We didn't expect the animation to finish yet
2150   application.SendNotification();
2151   finishCheck.CheckSignalNotReceived();
2152   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
2153
2154   application.SendNotification();
2155   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2156
2157   // We didn't expect the animation to finish yet
2158   application.SendNotification();
2159   finishCheck.CheckSignalNotReceived();
2160   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2161
2162   application.SendNotification();
2163   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2164
2165   // We didn't expect the animation to finish yet
2166   application.SendNotification();
2167   finishCheck.CheckSignalNotReceived();
2168   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2169
2170   application.SendNotification();
2171   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2172
2173   // We did expect the animation to finish
2174   application.SendNotification();
2175   finishCheck.CheckSignalReceived();
2176   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2177
2178   // Check that nothing has changed after a couple of buffer swaps
2179   application.Render(0);
2180   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2181   application.Render(0);
2182   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2183   END_TEST;
2184 }
2185
2186 int UtcDaliAnimationPlayStopDiscardHandleP(void)
2187 {
2188   TestApplication application;
2189
2190   Actor actor = Actor::New();
2191   Stage::GetCurrent().Add(actor);
2192
2193   // Build the animation
2194   float durationSeconds(1.0f);
2195   Animation animation = Animation::New(durationSeconds);
2196   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2197   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2198
2199   // Start the animation
2200   animation.Play();
2201
2202   bool signalReceived(false);
2203   AnimationFinishCheck finishCheck(signalReceived);
2204   animation.FinishedSignal().Connect(&application, finishCheck);
2205
2206   application.SendNotification();
2207   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2208
2209   // We didn't expect the animation to finish yet
2210   application.SendNotification();
2211   finishCheck.CheckSignalNotReceived();
2212   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2213
2214   // This is a test of the "Fire and Forget" behaviour
2215   // Stop the animation, and Discard the animation handle!
2216   animation.Stop();
2217   animation.Reset();
2218   DALI_TEST_CHECK( !animation );
2219
2220   application.SendNotification();
2221   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2222
2223   // We expect the animation to finish at 20% progress
2224   application.SendNotification();
2225   finishCheck.CheckSignalReceived();
2226   finishCheck.Reset();
2227   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2228
2229   application.SendNotification();
2230   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2231
2232   // Check that nothing has changed
2233   application.SendNotification();
2234   finishCheck.CheckSignalNotReceived();
2235   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2236
2237   application.SendNotification();
2238   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2239
2240   // Check that nothing has changed
2241   application.SendNotification();
2242   finishCheck.CheckSignalNotReceived();
2243   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2244
2245   application.SendNotification();
2246   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 100% progress */);
2247
2248   // Check that nothing has changed
2249   application.SendNotification();
2250   finishCheck.CheckSignalNotReceived();
2251   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2252   END_TEST;
2253 }
2254
2255 int UtcDaliAnimationPlayRangeP(void)
2256 {
2257   TestApplication application;
2258
2259   Actor actor = Actor::New();
2260   Stage::GetCurrent().Add(actor);
2261
2262   // Build the animation
2263   float durationSeconds(1.0f);
2264   Animation animation = Animation::New(durationSeconds);
2265   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2266   KeyFrames keyframes = KeyFrames::New();
2267   keyframes.Add( 0.0f , Vector3(0.0f,0.0f,0.0f ) );
2268   keyframes.Add( 1.0f , Vector3(100.0f,100.0f,100.0f ) );
2269
2270   animation.AnimateBetween( Property( actor, Actor::Property::POSITION), keyframes );
2271
2272   // Set range between 0.4 and 0.8
2273   animation.SetPlayRange( Vector2(0.4f,0.8f) );
2274   animation.Play();
2275
2276   bool signalReceived(false);
2277   AnimationFinishCheck finishCheck(signalReceived);
2278   animation.FinishedSignal().Connect(&application, finishCheck);
2279
2280   //Test that setting progress outside the range doesn't work
2281   animation.SetCurrentProgress( 0.9f );
2282   application.SendNotification();
2283   application.Render(0);
2284   DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
2285   animation.SetCurrentProgress( 0.2f );
2286   application.SendNotification();
2287   application.Render(0);
2288   DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
2289
2290   application.SendNotification();
2291   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2292
2293   // We didn't expect the animation to finish yet
2294   application.SendNotification();
2295   finishCheck.CheckSignalNotReceived();
2296   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2297
2298   animation.Play(); // Test that calling play has no effect, when animation is already playing
2299   application.SendNotification();
2300   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/* 80% progress */);
2301
2302   // We did expect the animation to finish
2303   application.SendNotification();
2304   finishCheck.CheckSignalReceived();
2305   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2306
2307   // Check that nothing has changed after a couple of buffer swaps
2308   application.Render(0);
2309   DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentPosition(), TEST_LOCATION );
2310   application.Render(0);
2311   DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentPosition(), TEST_LOCATION );
2312
2313
2314   //Loop inside the range
2315   finishCheck.Reset();
2316   animation.SetLooping( true );
2317   animation.Play();
2318   application.SendNotification();
2319   float intervalSeconds = 0.1f;
2320   float progress = 0.4f;
2321   for (int iterations = 0; iterations < 10; ++iterations )
2322   {
2323     application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
2324
2325     progress += intervalSeconds;
2326     if (progress > 0.8f)
2327     {
2328       progress = progress - 0.4f;
2329     }
2330
2331     DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
2332   }
2333
2334   // We didn't expect the animation to finish yet
2335   application.SendNotification();
2336   finishCheck.CheckSignalNotReceived();
2337
2338
2339   //Test change range on the fly
2340   animation.SetPlayRange( Vector2( 0.2f, 0.9f ) );
2341   application.SendNotification();
2342
2343   for (int iterations = 0; iterations < 10; ++iterations )
2344   {
2345     application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
2346
2347     progress += intervalSeconds;
2348     if (progress > 0.9f)
2349     {
2350       progress = progress - 0.7f;
2351     }
2352
2353     DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
2354   }
2355
2356   END_TEST;
2357 }
2358
2359 int UtcDaliAnimationPlayFromP(void)
2360 {
2361   TestApplication application;
2362
2363   Actor actor = Actor::New();
2364   Stage::GetCurrent().Add(actor);
2365
2366   // Build the animation
2367   float durationSeconds(1.0f);
2368   Animation animation = Animation::New(durationSeconds);
2369   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2370   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2371
2372   // Start the animation from 40% progress
2373   animation.PlayFrom( 0.4f );
2374
2375   bool signalReceived(false);
2376   AnimationFinishCheck finishCheck(signalReceived);
2377   animation.FinishedSignal().Connect(&application, finishCheck);
2378
2379   application.SendNotification();
2380   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2381
2382   // We didn't expect the animation to finish yet
2383   application.SendNotification();
2384   finishCheck.CheckSignalNotReceived();
2385   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2386
2387   animation.Play(); // Test that calling play has no effect, when animation is already playing
2388   application.SendNotification();
2389   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2390
2391   // We didn't expect the animation to finish yet
2392   application.SendNotification();
2393   finishCheck.CheckSignalNotReceived();
2394   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2395
2396   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2397   // We did expect the animation to finish
2398   application.SendNotification();
2399   finishCheck.CheckSignalReceived();
2400   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2401
2402   // Check that nothing has changed after a couple of buffer swaps
2403   application.Render(0);
2404   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2405   application.Render(0);
2406   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2407   END_TEST;
2408 }
2409
2410 int UtcDaliAnimationPlayFromN(void)
2411 {
2412   TestApplication application;
2413
2414   Actor actor = Actor::New();
2415   Stage::GetCurrent().Add(actor);
2416
2417   // Build the animation
2418   float durationSeconds(1.0f);
2419   Animation animation = Animation::New(durationSeconds);
2420   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2421   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2422
2423   //PlayFrom with an argument outside the range [0..1] will be ignored
2424   animation.PlayFrom(-1.0f);
2425   application.SendNotification();
2426   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
2427
2428   animation.PlayFrom(100.0f);
2429   application.SendNotification();
2430   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
2431   END_TEST;
2432 }
2433
2434 int UtcDaliAnimationPauseP(void)
2435 {
2436   TestApplication application;
2437
2438   Actor actor = Actor::New();
2439   Stage::GetCurrent().Add(actor);
2440
2441   // Build the animation
2442   float durationSeconds(1.0f);
2443   Animation animation = Animation::New(durationSeconds);
2444   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2445   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2446
2447   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2448
2449   // Start the animation
2450   animation.Play();
2451
2452   bool signalReceived(false);
2453   AnimationFinishCheck finishCheck(signalReceived);
2454   animation.FinishedSignal().Connect(&application, finishCheck);
2455
2456   application.SendNotification();
2457   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2458
2459   // We didn't expect the animation to finish yet
2460   application.SendNotification();
2461   finishCheck.CheckSignalNotReceived();
2462   DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2463
2464   // Pause the animation
2465   animation.Pause();
2466   application.SendNotification();
2467
2468   // Loop 5 times
2469   for (int i=0; i<5; ++i)
2470   {
2471     application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2472
2473     // We didn't expect the animation to finish yet
2474     application.SendNotification();
2475     finishCheck.CheckSignalNotReceived();
2476     DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
2477   }
2478
2479   // Keep going
2480   animation.Play();
2481   application.SendNotification();
2482   application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2483
2484   // We didn't expect the animation to finish yet
2485   application.SendNotification();
2486   finishCheck.CheckSignalNotReceived();
2487
2488   application.SendNotification();
2489   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2490
2491   // We did expect the animation to finish
2492   application.SendNotification();
2493   finishCheck.CheckSignalReceived();
2494   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2495
2496   // Check that nothing has changed after a couple of buffer swaps
2497   application.Render(0);
2498   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2499   application.Render(0);
2500   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2501   END_TEST;
2502 }
2503
2504
2505 int UtcDaliAnimationGetStateP(void)
2506 {
2507   TestApplication application;
2508
2509   Actor actor = Actor::New();
2510   Stage::GetCurrent().Add(actor);
2511
2512   // Build the animation
2513   float durationSeconds(1.0f);
2514   Animation animation = Animation::New(durationSeconds);
2515   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2516   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2517   DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2518
2519   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2520
2521   // Start the animation
2522   animation.Play();
2523
2524   DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2525
2526   bool signalReceived(false);
2527   AnimationFinishCheck finishCheck(signalReceived);
2528   animation.FinishedSignal().Connect(&application, finishCheck);
2529
2530   application.SendNotification();
2531   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2532
2533   // We didn't expect the animation to finish yet
2534   application.SendNotification();
2535   finishCheck.CheckSignalNotReceived();
2536   DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2537   DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2538
2539   // Pause the animation
2540   animation.Pause();
2541   DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
2542   application.SendNotification();
2543   application.Render(0.f);
2544
2545   // Loop 5 times
2546   for (int i=0; i<5; ++i)
2547   {
2548     application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2549
2550     // We didn't expect the animation to finish yet
2551     application.SendNotification();
2552     finishCheck.CheckSignalNotReceived();
2553     DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
2554     DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
2555   }
2556
2557   // Keep going
2558   finishCheck.Reset();
2559   animation.Play();
2560   DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2561   application.SendNotification();
2562   application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2563   // We didn't expect the animation to finish yet
2564   application.SendNotification();
2565   finishCheck.CheckSignalNotReceived();
2566   DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2567
2568   application.SendNotification();
2569   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2570
2571   // We did expect the animation to finish
2572   application.SendNotification();
2573   finishCheck.CheckSignalReceived();
2574   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2575   DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2576
2577   // Check that nothing has changed after a couple of buffer swaps
2578   application.Render(0);
2579   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2580   application.Render(0);
2581   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2582   DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2583
2584   // re-play
2585   finishCheck.Reset();
2586   animation.Play();
2587   DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2588   application.SendNotification();
2589   application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2590   application.SendNotification();
2591   finishCheck.CheckSignalNotReceived();
2592   DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2593
2594
2595   END_TEST;
2596 }
2597
2598 int UtcDaliAnimationStopP(void)
2599 {
2600   TestApplication application;
2601
2602   Actor actor = Actor::New();
2603   Stage::GetCurrent().Add(actor);
2604
2605   // Build the animation
2606   float durationSeconds(1.0f);
2607   Animation animation = Animation::New(durationSeconds);
2608   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2609   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2610
2611   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2612
2613   // Start the animation
2614   animation.Play();
2615
2616   bool signalReceived(false);
2617   AnimationFinishCheck finishCheck(signalReceived);
2618   animation.FinishedSignal().Connect(&application, finishCheck);
2619
2620   application.SendNotification();
2621   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2622
2623   // We didn't expect the animation to finish yet
2624   application.SendNotification();
2625   finishCheck.CheckSignalNotReceived();
2626   DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2627
2628   // Stop the animation
2629   animation.Stop();
2630   application.SendNotification();
2631
2632   // Loop 5 times
2633   for (int i=0; i<5; ++i)
2634   {
2635     application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2636
2637     // We did expect the animation to finish
2638     application.SendNotification();
2639     finishCheck.CheckSignalReceived();
2640     DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when stopped */, TEST_LOCATION );
2641   }
2642   END_TEST;
2643 }
2644
2645 int UtcDaliAnimationStopSetPositionP(void)
2646 {
2647   // Test that Animation::Stop & Actor::SetPosition can be used in conjunction
2648   // i.e. to check that the animation does not interfere with the position set.
2649
2650   TestApplication application;
2651
2652   Actor actor = Actor::New();
2653   Stage::GetCurrent().Add(actor);
2654
2655   // Build the animation
2656   float durationSeconds(1.0f);
2657   Animation animation = Animation::New(durationSeconds);
2658   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2659   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2660
2661   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2662
2663   // Start the animation
2664   animation.Play();
2665
2666   bool signalReceived(false);
2667   AnimationFinishCheck finishCheck(signalReceived);
2668   animation.FinishedSignal().Connect(&application, finishCheck);
2669
2670   application.SendNotification();
2671   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2672
2673   // We didn't expect the animation to finish yet
2674   application.SendNotification();
2675   finishCheck.CheckSignalNotReceived();
2676   DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2677
2678   // Stop the animation
2679   animation.Stop();
2680   Vector3 positionSet(2.0f, 3.0f, 4.0f);
2681   actor.SetPosition(positionSet);
2682   application.SendNotification();
2683
2684   // Loop 5 times
2685   for (int i=0; i<5; ++i)
2686   {
2687     application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2688
2689     // We did expect the animation to finish
2690     application.SendNotification();
2691     finishCheck.CheckSignalReceived();
2692     DALI_TEST_EQUALS( actor.GetCurrentPosition(), positionSet/*Animation should not interfere with this*/, TEST_LOCATION );
2693   }
2694   END_TEST;
2695 }
2696
2697 int UtcDaliAnimationClearP(void)
2698 {
2699   TestApplication application;
2700
2701   Actor actor = Actor::New();
2702   Stage::GetCurrent().Add(actor);
2703
2704   // Build the animation
2705   float durationSeconds(1.0f);
2706   Animation animation = Animation::New(durationSeconds);
2707   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2708   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2709
2710   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2711
2712   // Start the animation
2713   animation.Play();
2714
2715   bool signalReceived(false);
2716   AnimationFinishCheck finishCheck(signalReceived);
2717   animation.FinishedSignal().Connect(&application, finishCheck);
2718
2719   application.SendNotification();
2720   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2721
2722   // We didn't expect the animation to finish yet
2723   application.SendNotification();
2724   finishCheck.CheckSignalNotReceived();
2725   DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2726
2727   // Clear the animation
2728   animation.Clear();
2729   application.SendNotification();
2730
2731   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2732
2733   // We don't expect the animation to finish now
2734   application.SendNotification();
2735   finishCheck.CheckSignalNotReceived();
2736   DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress since the animator was destroyed */, TEST_LOCATION );
2737
2738   // Restart as a scale animation; this should not move the actor's position
2739   finishCheck.Reset();
2740   actor.SetPosition(Vector3::ZERO);
2741   Vector3 targetScale(3.0f, 3.0f, 3.0f);
2742   animation.AnimateTo( Property( actor, Actor::Property::SCALE ), targetScale, AlphaFunction::LINEAR );
2743   animation.Play();
2744
2745   application.SendNotification();
2746   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2747
2748   // We didn't expect the animation to finish yet
2749   application.SendNotification();
2750   finishCheck.CheckSignalNotReceived();
2751   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
2752   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION );
2753
2754   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2755
2756   // We did expect the animation to finish
2757   application.SendNotification();
2758   finishCheck.CheckSignalReceived();
2759   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
2760   DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
2761   END_TEST;
2762 }
2763
2764 int UtcDaliAnimationFinishedSignalP(void)
2765 {
2766   TestApplication application;
2767
2768   // Start the empty animation
2769   float durationSeconds(1.0f);
2770   Animation animation = Animation::New(durationSeconds);
2771   animation.Play();
2772
2773   bool signalReceived(false);
2774   AnimationFinishCheck finishCheck(signalReceived);
2775   animation.FinishedSignal().Connect(&application, finishCheck);
2776
2777   application.SendNotification();
2778   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*beyond the animation duration*/);
2779
2780   // We did expect the animation to finish
2781   application.SendNotification();
2782   finishCheck.CheckSignalReceived();
2783   END_TEST;
2784 }
2785
2786 int UtcDaliAnimationAnimateByBooleanP(void)
2787 {
2788   TestApplication application;
2789
2790   Actor actor = Actor::New();
2791
2792   // Register a boolean property
2793   bool startValue(false);
2794   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
2795   Stage::GetCurrent().Add(actor);
2796   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2797   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
2798
2799   // Build the animation
2800   float durationSeconds(2.0f);
2801   Animation animation = Animation::New(durationSeconds);
2802   const bool relativeValue(true);
2803   const bool finalValue( false || relativeValue );
2804   animation.AnimateBy(Property(actor, index), relativeValue);
2805
2806   // Start the animation
2807   animation.Play();
2808
2809   // Target value should be retrievable straight away
2810   DALI_TEST_EQUALS( actor.GetProperty< bool >( index ), finalValue, TEST_LOCATION );
2811
2812   bool signalReceived(false);
2813   AnimationFinishCheck finishCheck(signalReceived);
2814   animation.FinishedSignal().Connect(&application, finishCheck);
2815
2816   application.SendNotification();
2817   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2818
2819   // We didn't expect the animation to finish yet
2820   application.SendNotification();
2821   finishCheck.CheckSignalNotReceived();
2822   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
2823
2824   application.SendNotification();
2825   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2826
2827   // We did expect the animation to finish
2828   application.SendNotification();
2829   finishCheck.CheckSignalReceived();
2830   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2831
2832   // Check that nothing has changed after a couple of buffer swaps
2833   application.Render(0);
2834   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2835   application.Render(0);
2836   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2837
2838   // Repeat with relative value "false" - this should be an NOOP
2839   animation = Animation::New(durationSeconds);
2840   bool noOpValue(false);
2841   animation.AnimateBy(Property(actor, index), noOpValue);
2842
2843   // Start the animation
2844   animation.Play();
2845
2846   finishCheck.Reset();
2847   animation.FinishedSignal().Connect(&application, finishCheck);
2848
2849   application.SendNotification();
2850   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2851
2852   // We didn't expect the animation to finish yet
2853   application.SendNotification();
2854   finishCheck.CheckSignalNotReceived();
2855   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2856
2857   application.SendNotification();
2858   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2859
2860   // We did expect the animation to finish
2861   application.SendNotification();
2862   finishCheck.CheckSignalReceived();
2863   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2864
2865   // Check that nothing has changed after a couple of buffer swaps
2866   application.Render(0);
2867   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2868   application.Render(0);
2869   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2870   END_TEST;
2871 }
2872
2873 int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void)
2874 {
2875   TestApplication application;
2876
2877   Actor actor = Actor::New();
2878
2879   // Register a boolean property
2880   bool startValue(false);
2881   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
2882   Stage::GetCurrent().Add(actor);
2883   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2884   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
2885
2886   // Build the animation
2887   float durationSeconds(2.0f);
2888   Animation animation = Animation::New(durationSeconds);
2889   bool relativeValue(true);
2890   bool finalValue( false || relativeValue );
2891   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN);
2892
2893   // Start the animation
2894   animation.Play();
2895
2896   bool signalReceived(false);
2897   AnimationFinishCheck finishCheck(signalReceived);
2898   animation.FinishedSignal().Connect(&application, finishCheck);
2899
2900   application.SendNotification();
2901   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2902
2903   // We didn't expect the animation to finish yet
2904   application.SendNotification();
2905   finishCheck.CheckSignalNotReceived();
2906   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
2907
2908   application.SendNotification();
2909   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2910
2911   // We did expect the animation to finish
2912   application.SendNotification();
2913   finishCheck.CheckSignalReceived();
2914   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2915
2916   // Check that nothing has changed after a couple of buffer swaps
2917   application.Render(0);
2918   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2919   application.Render(0);
2920   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2921
2922   // Repeat with relative value "false" - this should be an NOOP
2923   animation = Animation::New(durationSeconds);
2924   bool noOpValue(false);
2925   animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunction::EASE_IN);
2926
2927   // Start the animation
2928   animation.Play();
2929
2930   finishCheck.Reset();
2931   animation.FinishedSignal().Connect(&application, finishCheck);
2932
2933   application.SendNotification();
2934   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2935
2936   // We didn't expect the animation to finish yet
2937   application.SendNotification();
2938   finishCheck.CheckSignalNotReceived();
2939   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2940
2941   application.SendNotification();
2942   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2943
2944   // We did expect the animation to finish
2945   application.SendNotification();
2946   finishCheck.CheckSignalReceived();
2947   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2948   END_TEST;
2949 }
2950
2951 int UtcDaliAnimationAnimateByBooleanTimePeriodP(void)
2952 {
2953   TestApplication application;
2954
2955   Actor actor = Actor::New();
2956
2957   // Register a boolean property
2958   bool startValue(false);
2959   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
2960   Stage::GetCurrent().Add(actor);
2961   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2962   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
2963
2964   // Build the animation
2965   float durationSeconds(2.0f);
2966   Animation animation = Animation::New(durationSeconds);
2967   bool relativeValue(true);
2968   bool finalValue( false || relativeValue );
2969   float animatorDurationSeconds(durationSeconds * 0.5f);
2970   animation.AnimateBy( Property(actor, index),
2971                        relativeValue,
2972                        TimePeriod( animatorDurationSeconds ) );
2973
2974   // Start the animation
2975   animation.Play();
2976
2977   bool signalReceived(false);
2978   AnimationFinishCheck finishCheck(signalReceived);
2979   animation.FinishedSignal().Connect(&application, finishCheck);
2980
2981   application.SendNotification();
2982   application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
2983
2984   // We didn't expect the animation to finish yet
2985   application.SendNotification();
2986   finishCheck.CheckSignalNotReceived();
2987   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
2988
2989   application.SendNotification();
2990   application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
2991
2992   // We didn't expect the animation to finish yet...
2993   application.SendNotification();
2994   finishCheck.CheckSignalNotReceived();
2995
2996   // ...however we should have reached the final value
2997   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2998
2999   application.SendNotification();
3000   application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
3001
3002   // We did expect the animation to finish
3003   application.SendNotification();
3004   finishCheck.CheckSignalReceived();
3005   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
3006
3007   // Check that nothing has changed after a couple of buffer swaps
3008   application.Render(0);
3009   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
3010   application.Render(0);
3011   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
3012   END_TEST;
3013 }
3014
3015 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void)
3016 {
3017   TestApplication application;
3018
3019   Actor actor = Actor::New();
3020
3021   // Register a boolean property
3022   bool startValue(false);
3023   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3024   Stage::GetCurrent().Add(actor);
3025   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3026   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
3027
3028   // Build the animation
3029   float durationSeconds(2.0f);
3030   Animation animation = Animation::New(durationSeconds);
3031   bool relativeValue(true);
3032   bool finalValue( false || relativeValue );
3033   float animatorDurationSeconds(durationSeconds * 0.5f);
3034   animation.AnimateBy( Property(actor, index),
3035                        relativeValue,
3036                        AlphaFunction::EASE_IN_OUT,
3037                        TimePeriod( animatorDurationSeconds ) );
3038
3039   // Start the animation
3040   animation.Play();
3041
3042   bool signalReceived(false);
3043   AnimationFinishCheck finishCheck(signalReceived);
3044   animation.FinishedSignal().Connect(&application, finishCheck);
3045
3046   application.SendNotification();
3047   application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
3048
3049   // We didn't expect the animation to finish yet
3050   application.SendNotification();
3051   finishCheck.CheckSignalNotReceived();
3052   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
3053
3054   application.SendNotification();
3055   application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
3056
3057   // We didn't expect the animation to finish yet...
3058   application.SendNotification();
3059   finishCheck.CheckSignalNotReceived();
3060
3061   // ...however we should have reached the final value
3062   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
3063
3064   application.SendNotification();
3065   application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
3066
3067   // We did expect the animation to finish
3068   application.SendNotification();
3069   finishCheck.CheckSignalReceived();
3070   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
3071
3072   // Check that nothing has changed after a couple of buffer swaps
3073   application.Render(0);
3074   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
3075   application.Render(0);
3076   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
3077   END_TEST;
3078 }
3079
3080 int UtcDaliAnimationAnimateByFloatP(void)
3081 {
3082   TestApplication application;
3083
3084   Actor actor = Actor::New();
3085
3086   // Register a float property
3087   float startValue(10.0f);
3088   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3089   Stage::GetCurrent().Add(actor);
3090   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3091   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
3092
3093   // Build the animation
3094   float durationSeconds(2.0f);
3095   Animation animation = Animation::New(durationSeconds);
3096   float targetValue(50.0f);
3097   float relativeValue(targetValue - startValue);
3098   animation.AnimateBy(Property(actor, index), relativeValue);
3099
3100   float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3101
3102   // Start the animation
3103   animation.Play();
3104
3105   // Target value should be retrievable straight away
3106   DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
3107
3108   bool signalReceived(false);
3109   AnimationFinishCheck finishCheck(signalReceived);
3110   animation.FinishedSignal().Connect(&application, finishCheck);
3111
3112   application.SendNotification();
3113   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3114
3115   // We didn't expect the animation to finish yet
3116   application.SendNotification();
3117   finishCheck.CheckSignalNotReceived();
3118   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
3119
3120   application.SendNotification();
3121   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3122
3123   // We did expect the animation to finish
3124   application.SendNotification();
3125   finishCheck.CheckSignalReceived();
3126   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3127
3128   // Check that nothing has changed after a couple of buffer swaps
3129   application.Render(0);
3130   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3131   application.Render(0);
3132   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3133   END_TEST;
3134 }
3135
3136 int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void)
3137 {
3138   TestApplication application;
3139
3140   Actor actor = Actor::New();
3141
3142   // Register a float property
3143   float startValue(10.0f);
3144   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3145   Stage::GetCurrent().Add(actor);
3146   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3147   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
3148
3149   // Build the animation
3150   float durationSeconds(1.0f);
3151   Animation animation = Animation::New(durationSeconds);
3152   float targetValue(90.0f);
3153   float relativeValue(targetValue - startValue);
3154   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3155
3156   float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3157
3158   // Start the animation
3159   animation.Play();
3160
3161   bool signalReceived(false);
3162   AnimationFinishCheck finishCheck(signalReceived);
3163   animation.FinishedSignal().Connect(&application, finishCheck);
3164
3165   application.SendNotification();
3166   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3167
3168   // We didn't expect the animation to finish yet
3169   application.SendNotification();
3170   finishCheck.CheckSignalNotReceived();
3171
3172   // The position should have moved more, than with a linear alpha function
3173   float current( DevelHandle::GetCurrentProperty< float >( actor, index ) );
3174   DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3175
3176   application.SendNotification();
3177   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3178
3179   // We did expect the animation to finish
3180   application.SendNotification();
3181   finishCheck.CheckSignalReceived();
3182   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3183
3184   // Check that nothing has changed after a couple of buffer swaps
3185   application.Render(0);
3186   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3187   application.Render(0);
3188   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3189   END_TEST;
3190 }
3191
3192 int UtcDaliAnimationAnimateByFloatTimePeriodP(void)
3193 {
3194   TestApplication application;
3195
3196   Actor actor = Actor::New();
3197
3198   // Register a float property
3199   float startValue(10.0f);
3200   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3201   Stage::GetCurrent().Add(actor);
3202   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3203   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
3204
3205   // Build the animation
3206   float durationSeconds(1.0f);
3207   Animation animation = Animation::New(durationSeconds);
3208   float targetValue(30.0f);
3209   float relativeValue(targetValue - startValue);
3210   float delay = 0.5f;
3211   animation.AnimateBy(Property(actor, index),
3212                       relativeValue,
3213                       TimePeriod(delay, durationSeconds - delay));
3214
3215   // Start the animation
3216   animation.Play();
3217
3218   bool signalReceived(false);
3219   AnimationFinishCheck finishCheck(signalReceived);
3220   animation.FinishedSignal().Connect(&application, finishCheck);
3221
3222   application.SendNotification();
3223   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3224
3225   // We didn't expect the animation to finish yet
3226   application.SendNotification();
3227   finishCheck.CheckSignalNotReceived();
3228   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
3229
3230   application.SendNotification();
3231   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3232
3233   // We didn't expect the animation to finish yet
3234   application.SendNotification();
3235   finishCheck.CheckSignalNotReceived();
3236   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3237
3238   application.SendNotification();
3239   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3240
3241   // We did expect the animation to finish
3242   application.SendNotification();
3243   finishCheck.CheckSignalReceived();
3244   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3245
3246   // Check that nothing has changed after a couple of buffer swaps
3247   application.Render(0);
3248   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3249   application.Render(0);
3250   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3251   END_TEST;
3252 }
3253
3254 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void)
3255 {
3256   TestApplication application;
3257
3258   Actor actor = Actor::New();
3259
3260   // Register a float property
3261   float startValue(10.0f);
3262   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3263   Stage::GetCurrent().Add(actor);
3264   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3265   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
3266
3267   // Build the animation
3268   float durationSeconds(1.0f);
3269   Animation animation = Animation::New(durationSeconds);
3270   float targetValue(30.0f);
3271   float relativeValue(targetValue - startValue);
3272   float delay = 0.5f;
3273   animation.AnimateBy(Property(actor, index),
3274                       relativeValue,
3275                       AlphaFunction::LINEAR,
3276                       TimePeriod(delay, durationSeconds - delay));
3277
3278   // Start the animation
3279   animation.Play();
3280
3281   bool signalReceived(false);
3282   AnimationFinishCheck finishCheck(signalReceived);
3283   animation.FinishedSignal().Connect(&application, finishCheck);
3284
3285   application.SendNotification();
3286   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3287
3288   // We didn't expect the animation to finish yet
3289   application.SendNotification();
3290   finishCheck.CheckSignalNotReceived();
3291   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
3292
3293   application.SendNotification();
3294   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3295
3296   // We didn't expect the animation to finish yet
3297   application.SendNotification();
3298   finishCheck.CheckSignalNotReceived();
3299   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3300
3301   application.SendNotification();
3302   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3303
3304   // We did expect the animation to finish
3305   application.SendNotification();
3306   finishCheck.CheckSignalReceived();
3307   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3308
3309   // Check that nothing has changed after a couple of buffer swaps
3310   application.Render(0);
3311   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3312   application.Render(0);
3313   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3314   END_TEST;
3315 }
3316
3317 int UtcDaliAnimationAnimateByIntegerP(void)
3318 {
3319   TestApplication application;
3320
3321   Actor actor = Actor::New();
3322
3323   // Register an integer property
3324   int startValue(1);
3325   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3326   Stage::GetCurrent().Add(actor);
3327   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3328   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
3329
3330   // Build the animation
3331   float durationSeconds(2.0f);
3332   Animation animation = Animation::New(durationSeconds);
3333   int targetValue(50);
3334   int relativeValue(targetValue - startValue);
3335   animation.AnimateBy(Property(actor, index), relativeValue);
3336
3337   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3338
3339   // Start the animation
3340   animation.Play();
3341
3342   // Target value should be retrievable straight away
3343   DALI_TEST_EQUALS( actor.GetProperty< int >( index ), targetValue, TEST_LOCATION );
3344
3345   bool signalReceived(false);
3346   AnimationFinishCheck finishCheck(signalReceived);
3347   animation.FinishedSignal().Connect(&application, finishCheck);
3348
3349   application.SendNotification();
3350   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3351
3352   // We didn't expect the animation to finish yet
3353   application.SendNotification();
3354   finishCheck.CheckSignalNotReceived();
3355   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
3356
3357   application.SendNotification();
3358   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3359
3360   // We did expect the animation to finish
3361   application.SendNotification();
3362   finishCheck.CheckSignalReceived();
3363   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3364
3365   // Check that nothing has changed after a couple of buffer swaps
3366   application.Render(0);
3367   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3368   application.Render(0);
3369   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3370   END_TEST;
3371 }
3372
3373 int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void)
3374 {
3375   TestApplication application;
3376
3377   Actor actor = Actor::New();
3378
3379   // Register an integer property
3380   int startValue(1);
3381   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3382   Stage::GetCurrent().Add(actor);
3383   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3384   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
3385
3386   // Build the animation
3387   float durationSeconds(1.0f);
3388   Animation animation = Animation::New(durationSeconds);
3389   int targetValue(90);
3390   int relativeValue(targetValue - startValue);
3391   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3392
3393   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3394
3395   // Start the animation
3396   animation.Play();
3397
3398   bool signalReceived(false);
3399   AnimationFinishCheck finishCheck(signalReceived);
3400   animation.FinishedSignal().Connect(&application, finishCheck);
3401
3402   application.SendNotification();
3403   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3404
3405   // We didn't expect the animation to finish yet
3406   application.SendNotification();
3407   finishCheck.CheckSignalNotReceived();
3408
3409   // The position should have moved more, than with a linear alpha function
3410   int current( DevelHandle::GetCurrentProperty< int >( actor, index ) );
3411   DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3412
3413   application.SendNotification();
3414   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3415
3416   // We did expect the animation to finish
3417   application.SendNotification();
3418   finishCheck.CheckSignalReceived();
3419   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3420
3421   // Check that nothing has changed after a couple of buffer swaps
3422   application.Render(0);
3423   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3424   application.Render(0);
3425   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3426   END_TEST;
3427 }
3428
3429 int UtcDaliAnimationAnimateByIntegerTimePeriodP(void)
3430 {
3431   TestApplication application;
3432
3433   Actor actor = Actor::New();
3434
3435   // Register an integer property
3436   int startValue(10);
3437   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3438   Stage::GetCurrent().Add(actor);
3439   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3440   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
3441
3442   // Build the animation
3443   float durationSeconds(1.0f);
3444   Animation animation = Animation::New(durationSeconds);
3445   int targetValue(30);
3446   int relativeValue(targetValue - startValue);
3447   float delay = 0.5f;
3448   animation.AnimateBy(Property(actor, index),
3449                       relativeValue,
3450                       TimePeriod(delay, durationSeconds - delay));
3451
3452   // Start the animation
3453   animation.Play();
3454
3455   bool signalReceived(false);
3456   AnimationFinishCheck finishCheck(signalReceived);
3457   animation.FinishedSignal().Connect(&application, finishCheck);
3458
3459   application.SendNotification();
3460   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3461
3462   // We didn't expect the animation to finish yet
3463   application.SendNotification();
3464   finishCheck.CheckSignalNotReceived();
3465   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
3466
3467   application.SendNotification();
3468   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3469
3470   // We didn't expect the animation to finish yet
3471   application.SendNotification();
3472   finishCheck.CheckSignalNotReceived();
3473   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3474
3475   application.SendNotification();
3476   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3477
3478   // We did expect the animation to finish
3479   application.SendNotification();
3480   finishCheck.CheckSignalReceived();
3481   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3482
3483   // Check that nothing has changed after a couple of buffer swaps
3484   application.Render(0);
3485   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3486   application.Render(0);
3487   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3488   END_TEST;
3489 }
3490
3491 int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void)
3492 {
3493   TestApplication application;
3494
3495   Actor actor = Actor::New();
3496
3497   // Register an integer property
3498   int startValue(10);
3499   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3500   Stage::GetCurrent().Add(actor);
3501   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3502   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
3503
3504   // Build the animation
3505   float durationSeconds(1.0f);
3506   Animation animation = Animation::New(durationSeconds);
3507   int targetValue(30);
3508   int relativeValue(targetValue - startValue);
3509   float delay = 0.5f;
3510   animation.AnimateBy(Property(actor, index),
3511                       relativeValue,
3512                       AlphaFunction::LINEAR,
3513                       TimePeriod(delay, durationSeconds - delay));
3514
3515   // Start the animation
3516   animation.Play();
3517
3518   bool signalReceived(false);
3519   AnimationFinishCheck finishCheck(signalReceived);
3520   animation.FinishedSignal().Connect(&application, finishCheck);
3521
3522   application.SendNotification();
3523   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3524
3525   // We didn't expect the animation to finish yet
3526   application.SendNotification();
3527   finishCheck.CheckSignalNotReceived();
3528   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
3529
3530   application.SendNotification();
3531   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3532
3533   // We didn't expect the animation to finish yet
3534   application.SendNotification();
3535   finishCheck.CheckSignalNotReceived();
3536   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3537
3538   application.SendNotification();
3539   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3540
3541   // We did expect the animation to finish
3542   application.SendNotification();
3543   finishCheck.CheckSignalReceived();
3544   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3545
3546   // Check that nothing has changed after a couple of buffer swaps
3547   application.Render(0);
3548   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3549   application.Render(0);
3550   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3551   END_TEST;
3552 }
3553
3554 int UtcDaliAnimationAnimateByVector2P(void)
3555 {
3556   TestApplication application;
3557
3558   Actor actor = Actor::New();
3559
3560   // Register a Vector2 property
3561   Vector2 startValue(10.0f, 10.0f);
3562   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3563   Stage::GetCurrent().Add(actor);
3564   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3565   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
3566
3567   // Build the animation
3568   float durationSeconds(2.0f);
3569   Animation animation = Animation::New(durationSeconds);
3570   Vector2 targetValue(60.0f, 60.0f);
3571   Vector2 relativeValue(targetValue - startValue);
3572   animation.AnimateBy(Property(actor, index), relativeValue);
3573
3574   Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3575
3576   // Start the animation
3577   animation.Play();
3578
3579   // Target value should be retrievable straight away
3580   DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3581
3582   bool signalReceived(false);
3583   AnimationFinishCheck finishCheck(signalReceived);
3584   animation.FinishedSignal().Connect(&application, finishCheck);
3585
3586   application.SendNotification();
3587   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3588
3589   // We didn't expect the animation to finish yet
3590   application.SendNotification();
3591   finishCheck.CheckSignalNotReceived();
3592   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
3593
3594   application.SendNotification();
3595   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3596
3597   // We did expect the animation to finish
3598   application.SendNotification();
3599   finishCheck.CheckSignalReceived();
3600   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3601
3602   // Check that nothing has changed after a couple of buffer swaps
3603   application.Render(0);
3604   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3605   application.Render(0);
3606   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3607   END_TEST;
3608 }
3609
3610 int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void)
3611 {
3612   TestApplication application;
3613
3614   Actor actor = Actor::New();
3615
3616   // Register a Vector2 property
3617   Vector2 startValue(100.0f, 100.0f);
3618   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3619   Stage::GetCurrent().Add(actor);
3620   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3621   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
3622
3623   // Build the animation
3624   float durationSeconds(1.0f);
3625   Animation animation = Animation::New(durationSeconds);
3626   Vector2 targetValue(20.0f, 20.0f);
3627   Vector2 relativeValue(targetValue - startValue);
3628   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3629
3630   Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3631
3632   // Start the animation
3633   animation.Play();
3634
3635   bool signalReceived(false);
3636   AnimationFinishCheck finishCheck(signalReceived);
3637   animation.FinishedSignal().Connect(&application, finishCheck);
3638
3639   application.SendNotification();
3640   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3641
3642   // We didn't expect the animation to finish yet
3643   application.SendNotification();
3644   finishCheck.CheckSignalNotReceived();
3645
3646   // The position should have moved more, than with a linear alpha function
3647   Vector2 current( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ) );
3648   DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3649   DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3650
3651   application.SendNotification();
3652   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3653
3654   // We did expect the animation to finish
3655   application.SendNotification();
3656   finishCheck.CheckSignalReceived();
3657   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3658
3659   // Check that nothing has changed after a couple of buffer swaps
3660   application.Render(0);
3661   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3662   application.Render(0);
3663   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3664   END_TEST;
3665 }
3666
3667 int UtcDaliAnimationAnimateByVector2TimePeriodP(void)
3668 {
3669   TestApplication application;
3670
3671   Actor actor = Actor::New();
3672
3673   // Register a Vector2 property
3674   Vector2 startValue(10.0f, 10.0f);
3675   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3676   Stage::GetCurrent().Add(actor);
3677   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3678   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
3679
3680   // Build the animation
3681   float durationSeconds(1.0f);
3682   Animation animation = Animation::New(durationSeconds);
3683   Vector2 targetValue(30.0f, 30.0f);
3684   Vector2 relativeValue(targetValue - startValue);
3685   float delay = 0.5f;
3686   animation.AnimateBy(Property(actor, index),
3687                       relativeValue,
3688                       TimePeriod(delay, durationSeconds - delay));
3689
3690   // Start the animation
3691   animation.Play();
3692
3693   bool signalReceived(false);
3694   AnimationFinishCheck finishCheck(signalReceived);
3695   animation.FinishedSignal().Connect(&application, finishCheck);
3696
3697   application.SendNotification();
3698   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3699
3700   // We didn't expect the animation to finish yet
3701   application.SendNotification();
3702   finishCheck.CheckSignalNotReceived();
3703   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
3704
3705   application.SendNotification();
3706   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3707
3708   // We didn't expect the animation to finish yet
3709   application.SendNotification();
3710   finishCheck.CheckSignalNotReceived();
3711   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3712
3713   application.SendNotification();
3714   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3715
3716   // We did expect the animation to finish
3717   application.SendNotification();
3718   finishCheck.CheckSignalReceived();
3719   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3720
3721   // Check that nothing has changed after a couple of buffer swaps
3722   application.Render(0);
3723   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3724   application.Render(0);
3725   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3726   END_TEST;
3727 }
3728
3729 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void)
3730 {
3731   TestApplication application;
3732
3733   Actor actor = Actor::New();
3734
3735   // Register a Vector2 property
3736   Vector2 startValue(5.0f, 5.0f);
3737   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3738   Stage::GetCurrent().Add(actor);
3739   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3740   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
3741
3742   // Build the animation
3743   float durationSeconds(1.0f);
3744   Animation animation = Animation::New(durationSeconds);
3745   Vector2 targetValue(10.0f, 10.0f);
3746   Vector2 relativeValue(targetValue - startValue);
3747   float delay = 0.5f;
3748   animation.AnimateBy(Property(actor, index),
3749                       relativeValue,
3750                       AlphaFunction::LINEAR,
3751                       TimePeriod(delay, durationSeconds - delay));
3752
3753   // Start the animation
3754   animation.Play();
3755
3756   bool signalReceived(false);
3757   AnimationFinishCheck finishCheck(signalReceived);
3758   animation.FinishedSignal().Connect(&application, finishCheck);
3759
3760   application.SendNotification();
3761   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3762
3763   // We didn't expect the animation to finish yet
3764   application.SendNotification();
3765   finishCheck.CheckSignalNotReceived();
3766   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
3767
3768   application.SendNotification();
3769   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3770
3771   // We didn't expect the animation to finish yet
3772   application.SendNotification();
3773   finishCheck.CheckSignalNotReceived();
3774   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3775
3776   application.SendNotification();
3777   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3778
3779   // We did expect the animation to finish
3780   application.SendNotification();
3781   finishCheck.CheckSignalReceived();
3782   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3783
3784   // Check that nothing has changed after a couple of buffer swaps
3785   application.Render(0);
3786   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3787   application.Render(0);
3788   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3789   END_TEST;
3790 }
3791
3792 int UtcDaliAnimationAnimateByVector3P(void)
3793 {
3794   TestApplication application;
3795
3796   Actor actor = Actor::New();
3797
3798   // Register a Vector3 property
3799   Vector3 startValue(10.0f, 10.0f, 10.0f);
3800   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3801   Stage::GetCurrent().Add(actor);
3802   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3803   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
3804
3805   // Build the animation
3806   float durationSeconds(2.0f);
3807   Animation animation = Animation::New(durationSeconds);
3808   Vector3 targetValue(60.0f, 60.0f, 60.0f);
3809   Vector3 relativeValue(targetValue - startValue);
3810   animation.AnimateBy(Property(actor, index), relativeValue);
3811
3812   Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3813
3814   // Start the animation
3815   animation.Play();
3816
3817   // Target value should be retrievable straight away
3818   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3819
3820   bool signalReceived(false);
3821   AnimationFinishCheck finishCheck(signalReceived);
3822   animation.FinishedSignal().Connect(&application, finishCheck);
3823
3824   application.SendNotification();
3825   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3826
3827   // We didn't expect the animation to finish yet
3828   application.SendNotification();
3829   finishCheck.CheckSignalNotReceived();
3830   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
3831
3832   application.SendNotification();
3833   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3834
3835   // We did expect the animation to finish
3836   application.SendNotification();
3837   finishCheck.CheckSignalReceived();
3838   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3839
3840   // Check that nothing has changed after a couple of buffer swaps
3841   application.Render(0);
3842   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3843   application.Render(0);
3844   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3845   END_TEST;
3846 }
3847
3848 int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void)
3849 {
3850   TestApplication application;
3851
3852   Actor actor = Actor::New();
3853
3854   // Register a Vector3 property
3855   Vector3 startValue(100.0f, 100.0f, 100.0f);
3856   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3857   Stage::GetCurrent().Add(actor);
3858   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3859   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
3860
3861   // Build the animation
3862   float durationSeconds(1.0f);
3863   Animation animation = Animation::New(durationSeconds);
3864   Vector3 targetValue(20.0f, 20.0f, 20.0f);
3865   Vector3 relativeValue(targetValue - startValue);
3866   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3867
3868   Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3869
3870   // Start the animation
3871   animation.Play();
3872
3873   bool signalReceived(false);
3874   AnimationFinishCheck finishCheck(signalReceived);
3875   animation.FinishedSignal().Connect(&application, finishCheck);
3876
3877   application.SendNotification();
3878   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3879
3880   // We didn't expect the animation to finish yet
3881   application.SendNotification();
3882   finishCheck.CheckSignalNotReceived();
3883
3884   // The position should have moved more, than with a linear alpha function
3885   Vector3 current(DevelHandle::GetCurrentProperty< Vector3 >( actor, index ));
3886   DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3887   DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3888   DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
3889
3890   application.SendNotification();
3891   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3892
3893   // We did expect the animation to finish
3894   application.SendNotification();
3895   finishCheck.CheckSignalReceived();
3896   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3897
3898   // Check that nothing has changed after a couple of buffer swaps
3899   application.Render(0);
3900   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3901   application.Render(0);
3902   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3903   END_TEST;
3904 }
3905
3906 int UtcDaliAnimationAnimateByVector3TimePeriodP(void)
3907 {
3908   TestApplication application;
3909
3910   Actor actor = Actor::New();
3911
3912   // Register a Vector3 property
3913   Vector3 startValue(10.0f, 10.0f, 10.0f);
3914   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3915   Stage::GetCurrent().Add(actor);
3916   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3917   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
3918
3919   // Build the animation
3920   float durationSeconds(1.0f);
3921   Animation animation = Animation::New(durationSeconds);
3922   Vector3 targetValue(30.0f, 30.0f, 30.0f);
3923   Vector3 relativeValue(targetValue - startValue);
3924   float delay = 0.5f;
3925   animation.AnimateBy(Property(actor, index),
3926                       relativeValue,
3927                       TimePeriod(delay, durationSeconds - delay));
3928
3929   // Start the animation
3930   animation.Play();
3931
3932   bool signalReceived(false);
3933   AnimationFinishCheck finishCheck(signalReceived);
3934   animation.FinishedSignal().Connect(&application, finishCheck);
3935
3936   application.SendNotification();
3937   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3938
3939   // We didn't expect the animation to finish yet
3940   application.SendNotification();
3941   finishCheck.CheckSignalNotReceived();
3942   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
3943
3944   application.SendNotification();
3945   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3946
3947   // We didn't expect the animation to finish yet
3948   application.SendNotification();
3949   finishCheck.CheckSignalNotReceived();
3950   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3951
3952   application.SendNotification();
3953   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3954
3955   // We did expect the animation to finish
3956   application.SendNotification();
3957   finishCheck.CheckSignalReceived();
3958   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3959
3960   // Check that nothing has changed after a couple of buffer swaps
3961   application.Render(0);
3962   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3963   application.Render(0);
3964   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3965   END_TEST;
3966 }
3967
3968 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void)
3969 {
3970   TestApplication application;
3971
3972   Actor actor = Actor::New();
3973
3974   // Register a Vector3 property
3975   Vector3 startValue(5.0f, 5.0f, 5.0f);
3976   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3977   Stage::GetCurrent().Add(actor);
3978   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3979   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
3980
3981   // Build the animation
3982   float durationSeconds(1.0f);
3983   Animation animation = Animation::New(durationSeconds);
3984   Vector3 targetValue(10.0f, 10.0f, 10.0f);
3985   Vector3 relativeValue(targetValue - startValue);
3986   float delay = 0.5f;
3987   animation.AnimateBy(Property(actor, index),
3988                       relativeValue,
3989                       AlphaFunction::LINEAR,
3990                       TimePeriod(delay, durationSeconds - delay));
3991
3992   // Start the animation
3993   animation.Play();
3994
3995   bool signalReceived(false);
3996   AnimationFinishCheck finishCheck(signalReceived);
3997   animation.FinishedSignal().Connect(&application, finishCheck);
3998
3999   application.SendNotification();
4000   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4001
4002   // We didn't expect the animation to finish yet
4003   application.SendNotification();
4004   finishCheck.CheckSignalNotReceived();
4005   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
4006
4007   application.SendNotification();
4008   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4009
4010   // We didn't expect the animation to finish yet
4011   application.SendNotification();
4012   finishCheck.CheckSignalNotReceived();
4013   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4014
4015   application.SendNotification();
4016   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4017
4018   // We did expect the animation to finish
4019   application.SendNotification();
4020   finishCheck.CheckSignalReceived();
4021   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
4022
4023   // Check that nothing has changed after a couple of buffer swaps
4024   application.Render(0);
4025   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
4026   application.Render(0);
4027   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
4028   END_TEST;
4029 }
4030
4031 int UtcDaliAnimationAnimateByVector4P(void)
4032 {
4033   TestApplication application;
4034
4035   Actor actor = Actor::New();
4036
4037   // Register a Vector4 property
4038   Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4039   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4040   Stage::GetCurrent().Add(actor);
4041   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4042   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
4043
4044   // Build the animation
4045   float durationSeconds(2.0f);
4046   Animation animation = Animation::New(durationSeconds);
4047   Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f);
4048   Vector4 relativeValue(targetValue - startValue);
4049   animation.AnimateBy(Property(actor, index), relativeValue);
4050
4051   Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4052
4053   // Start the animation
4054   animation.Play();
4055
4056   // Target value should be retrievable straight away
4057   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4058
4059   bool signalReceived(false);
4060   AnimationFinishCheck finishCheck(signalReceived);
4061   animation.FinishedSignal().Connect(&application, finishCheck);
4062
4063   application.SendNotification();
4064   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4065
4066   // We didn't expect the animation to finish yet
4067   application.SendNotification();
4068   finishCheck.CheckSignalNotReceived();
4069   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
4070
4071   application.SendNotification();
4072   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4073
4074   // We did expect the animation to finish
4075   application.SendNotification();
4076   finishCheck.CheckSignalReceived();
4077   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4078
4079   // Check that nothing has changed after a couple of buffer swaps
4080   application.Render(0);
4081   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4082   application.Render(0);
4083   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4084   END_TEST;
4085 }
4086
4087 int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void)
4088 {
4089   TestApplication application;
4090
4091   Actor actor = Actor::New();
4092
4093   // Register a Vector4 property
4094   Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f);
4095   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4096   Stage::GetCurrent().Add(actor);
4097   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4098   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
4099
4100   // Build the animation
4101   float durationSeconds(1.0f);
4102   Animation animation = Animation::New(durationSeconds);
4103   Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
4104   Vector4 relativeValue(targetValue - startValue);
4105   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4106
4107   Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4108
4109   // Start the animation
4110   animation.Play();
4111
4112   bool signalReceived(false);
4113   AnimationFinishCheck finishCheck(signalReceived);
4114   animation.FinishedSignal().Connect(&application, finishCheck);
4115
4116   application.SendNotification();
4117   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4118
4119   // We didn't expect the animation to finish yet
4120   application.SendNotification();
4121   finishCheck.CheckSignalNotReceived();
4122
4123   // The position should have moved more, than with a linear alpha function
4124   Vector4 current( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ) );
4125   DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
4126   DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
4127   DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
4128   DALI_TEST_CHECK( current.w < ninetyFivePercentProgress.w );
4129
4130   application.SendNotification();
4131   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4132
4133   // We did expect the animation to finish
4134   application.SendNotification();
4135   finishCheck.CheckSignalReceived();
4136   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4137
4138   // Check that nothing has changed after a couple of buffer swaps
4139   application.Render(0);
4140   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4141   application.Render(0);
4142   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4143   END_TEST;
4144 }
4145
4146 int UtcDaliAnimationAnimateByVector4TimePeriodP(void)
4147 {
4148   TestApplication application;
4149
4150   Actor actor = Actor::New();
4151
4152   // Register a Vector4 property
4153   Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4154   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4155   Stage::GetCurrent().Add(actor);
4156   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4157   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
4158
4159   // Build the animation
4160   float durationSeconds(1.0f);
4161   Animation animation = Animation::New(durationSeconds);
4162   Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
4163   Vector4 relativeValue(targetValue - startValue);
4164   float delay = 0.5f;
4165   animation.AnimateBy(Property(actor, index),
4166                       relativeValue,
4167                       TimePeriod(delay, durationSeconds - delay));
4168
4169   // Start the animation
4170   animation.Play();
4171
4172   bool signalReceived(false);
4173   AnimationFinishCheck finishCheck(signalReceived);
4174   animation.FinishedSignal().Connect(&application, finishCheck);
4175
4176   application.SendNotification();
4177   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4178
4179   // We didn't expect the animation to finish yet
4180   application.SendNotification();
4181   finishCheck.CheckSignalNotReceived();
4182   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
4183
4184   application.SendNotification();
4185   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4186
4187   // We didn't expect the animation to finish yet
4188   application.SendNotification();
4189   finishCheck.CheckSignalNotReceived();
4190   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4191
4192   application.SendNotification();
4193   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4194
4195   // We did expect the animation to finish
4196   application.SendNotification();
4197   finishCheck.CheckSignalReceived();
4198   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4199
4200   // Check that nothing has changed after a couple of buffer swaps
4201   application.Render(0);
4202   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4203   application.Render(0);
4204   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4205   END_TEST;
4206 }
4207
4208 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void)
4209 {
4210   TestApplication application;
4211
4212   Actor actor = Actor::New();
4213
4214   // Register a Vector4 property
4215   Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f);
4216   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4217   Stage::GetCurrent().Add(actor);
4218   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4219   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
4220
4221   // Build the animation
4222   float durationSeconds(1.0f);
4223   Animation animation = Animation::New(durationSeconds);
4224   Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f);
4225   Vector4 relativeValue(targetValue - startValue);
4226   float delay = 0.5f;
4227   animation.AnimateBy(Property(actor, index),
4228                       relativeValue,
4229                       AlphaFunction::LINEAR,
4230                       TimePeriod(delay, durationSeconds - delay));
4231
4232   // Start the animation
4233   animation.Play();
4234
4235   bool signalReceived(false);
4236   AnimationFinishCheck finishCheck(signalReceived);
4237   animation.FinishedSignal().Connect(&application, finishCheck);
4238
4239   application.SendNotification();
4240   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4241
4242   // We didn't expect the animation to finish yet
4243   application.SendNotification();
4244   finishCheck.CheckSignalNotReceived();
4245   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
4246
4247   application.SendNotification();
4248   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4249
4250   // We didn't expect the animation to finish yet
4251   application.SendNotification();
4252   finishCheck.CheckSignalNotReceived();
4253   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4254
4255   application.SendNotification();
4256   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4257
4258   // We did expect the animation to finish
4259   application.SendNotification();
4260   finishCheck.CheckSignalReceived();
4261   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4262
4263   // Check that nothing has changed after a couple of buffer swaps
4264   application.Render(0);
4265   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4266   application.Render(0);
4267   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4268   END_TEST;
4269 }
4270
4271 int UtcDaliAnimationAnimateByActorPositionP(void)
4272 {
4273   TestApplication application;
4274
4275   Actor actor = Actor::New();
4276   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4277   actor.SetPosition(startPosition);
4278   Stage::GetCurrent().Add(actor);
4279   application.SendNotification();
4280   application.Render(0);
4281   DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4282
4283   // Build the animation
4284   float durationSeconds(1.0f);
4285   Animation animation = Animation::New(durationSeconds);
4286   Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4287   Vector3 relativePosition(targetPosition - startPosition);
4288   animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition);
4289
4290   Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4291
4292   // Start the animation
4293   animation.Play();
4294
4295   // Target value should be retrievable straight away
4296   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4297
4298   bool signalReceived(false);
4299   AnimationFinishCheck finishCheck(signalReceived);
4300   animation.FinishedSignal().Connect(&application, finishCheck);
4301
4302   application.SendNotification();
4303   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4304
4305   // We didn't expect the animation to finish yet
4306   application.SendNotification();
4307   finishCheck.CheckSignalNotReceived();
4308   DALI_TEST_EQUALS( actor.GetCurrentPosition(), ninetyFivePercentProgress, TEST_LOCATION );
4309
4310   application.SendNotification();
4311   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4312
4313   // We did expect the animation to finish
4314   application.SendNotification();
4315   finishCheck.CheckSignalReceived();
4316   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4317
4318   // Check that nothing has changed after a couple of buffer swaps
4319   application.Render(0);
4320   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4321   application.Render(0);
4322   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4323   END_TEST;
4324 }
4325
4326 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
4327 {
4328   TestApplication application;
4329
4330   Actor actor = Actor::New();
4331   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4332   actor.SetPosition(startPosition);
4333   Stage::GetCurrent().Add(actor);
4334   application.SendNotification();
4335   application.Render(0);
4336   DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4337
4338   // Build the animation
4339   float durationSeconds(1.0f);
4340   Animation animation = Animation::New(durationSeconds);
4341   Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4342   Vector3 relativePosition(targetPosition - startPosition);
4343   animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
4344
4345   Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4346
4347   // Start the animation
4348   animation.Play();
4349
4350   bool signalReceived(false);
4351   AnimationFinishCheck finishCheck(signalReceived);
4352   animation.FinishedSignal().Connect(&application, finishCheck);
4353
4354   application.SendNotification();
4355   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4356
4357   // We didn't expect the animation to finish yet
4358   application.SendNotification();
4359   finishCheck.CheckSignalNotReceived();
4360
4361   // The position should have moved more, than with a linear alpha function
4362   Vector3 current(actor.GetCurrentPosition());
4363   DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
4364   DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
4365   DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
4366
4367   application.SendNotification();
4368   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4369
4370   // We did expect the animation to finish
4371   application.SendNotification();
4372   finishCheck.CheckSignalReceived();
4373   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4374
4375   // Check that nothing has changed after a couple of buffer swaps
4376   application.Render(0);
4377   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4378   application.Render(0);
4379   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4380   END_TEST;
4381 }
4382
4383 int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void)
4384 {
4385   TestApplication application;
4386
4387   Actor actor = Actor::New();
4388   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4389   actor.SetPosition(startPosition);
4390   Stage::GetCurrent().Add(actor);
4391   application.SendNotification();
4392   application.Render(0);
4393   DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4394
4395   // Build the animation
4396   float durationSeconds(1.0f);
4397   Animation animation = Animation::New(durationSeconds);
4398   Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4399   Vector3 relativePosition(targetPosition - startPosition);
4400   float delay = 0.5f;
4401   animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4402                       relativePosition,
4403                       TimePeriod(delay, durationSeconds - delay));
4404
4405   Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4406
4407   // Start the animation
4408   animation.Play();
4409
4410   bool signalReceived(false);
4411   AnimationFinishCheck finishCheck(signalReceived);
4412   animation.FinishedSignal().Connect(&application, finishCheck);
4413
4414   application.SendNotification();
4415   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4416
4417   // We didn't expect the animation to finish yet
4418   application.SendNotification();
4419   finishCheck.CheckSignalNotReceived();
4420   DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4421
4422   application.SendNotification();
4423   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4424
4425   // We did expect the animation to finish
4426   application.SendNotification();
4427   finishCheck.CheckSignalReceived();
4428   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4429
4430   // Check that nothing has changed after a couple of buffer swaps
4431   application.Render(0);
4432   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4433   application.Render(0);
4434   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4435   END_TEST;
4436 }
4437
4438 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void)
4439 {
4440   TestApplication application;
4441
4442   Actor actor = Actor::New();
4443   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4444   actor.SetPosition(startPosition);
4445   Stage::GetCurrent().Add(actor);
4446   application.SendNotification();
4447   application.Render(0);
4448   DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4449
4450   // Build the animation
4451   float durationSeconds(1.0f);
4452   Animation animation = Animation::New(durationSeconds);
4453   Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4454   Vector3 relativePosition(targetPosition - startPosition);
4455   float delay = 0.5f;
4456   animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4457                       relativePosition,
4458                       AlphaFunction::LINEAR,
4459                       TimePeriod(delay, durationSeconds - delay));
4460
4461   Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4462
4463   // Start the animation
4464   animation.Play();
4465
4466   bool signalReceived(false);
4467   AnimationFinishCheck finishCheck(signalReceived);
4468   animation.FinishedSignal().Connect(&application, finishCheck);
4469
4470   application.SendNotification();
4471   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4472
4473   // We didn't expect the animation to finish yet
4474   application.SendNotification();
4475   finishCheck.CheckSignalNotReceived();
4476   DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4477
4478   application.SendNotification();
4479   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4480
4481   // We did expect the animation to finish
4482   application.SendNotification();
4483   finishCheck.CheckSignalReceived();
4484   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4485
4486   // Check that nothing has changed after a couple of buffer swaps
4487   application.Render(0);
4488   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4489   application.Render(0);
4490   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4491   END_TEST;
4492 }
4493
4494 int UtcDaliAnimationAnimateByActorOrientationP1(void)
4495 {
4496   TestApplication application;
4497
4498   Actor actor = Actor::New();
4499   actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4500   Stage::GetCurrent().Add(actor);
4501   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4502
4503   // Build the animation
4504   float durationSeconds(1.0f);
4505   Animation animation = Animation::New(durationSeconds);
4506   Degree relativeRotationDegrees(360.0f);
4507   Radian relativeRotationRadians(relativeRotationDegrees);
4508   animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ) );
4509
4510   // Start the animation
4511   animation.Play();
4512
4513   // Target value should be retrievable straight away
4514   DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::YAXIS), TEST_LOCATION );
4515
4516   bool signalReceived(false);
4517   AnimationFinishCheck finishCheck(signalReceived);
4518   animation.FinishedSignal().Connect(&application, finishCheck);
4519
4520   application.SendNotification();
4521   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4522
4523   // We didn't expect the animation to finish yet
4524   application.SendNotification();
4525   finishCheck.CheckSignalNotReceived();
4526   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4527
4528   application.SendNotification();
4529   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4530
4531   // We didn't expect the animation to finish yet
4532   application.SendNotification();
4533   finishCheck.CheckSignalNotReceived();
4534   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4535
4536   application.SendNotification();
4537   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4538
4539   // We didn't expect the animation to finish yet
4540   application.SendNotification();
4541   finishCheck.CheckSignalNotReceived();
4542   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4543
4544   application.SendNotification();
4545   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4546
4547   // We did expect the animation to finish
4548   application.SendNotification();
4549   finishCheck.CheckSignalReceived();
4550   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4551   END_TEST;
4552 }
4553
4554 int UtcDaliAnimationAnimateByActorOrientationP2(void)
4555 {
4556   TestApplication application;
4557
4558   tet_printf("Testing that rotation angle > 360 performs full rotations\n");
4559
4560   Actor actor = Actor::New();
4561   actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
4562   Stage::GetCurrent().Add(actor);
4563   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4564
4565   // Build the animation
4566   float durationSeconds(1.0f);
4567   Animation animation = Animation::New(durationSeconds);
4568   Degree relativeRotationDegrees(710.0f);
4569   Radian relativeRotationRadians(relativeRotationDegrees);
4570
4571   animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), AngleAxis( relativeRotationRadians, Vector3::ZAXIS ) );
4572
4573   // Start the animation
4574   animation.Play();
4575
4576   bool signalReceived(false);
4577   AnimationFinishCheck finishCheck(signalReceived);
4578   animation.FinishedSignal().Connect(&application, finishCheck);
4579
4580   application.SendNotification();
4581   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4582
4583   // We didn't expect the animation to finish yet
4584   application.SendNotification();
4585   finishCheck.CheckSignalNotReceived();
4586   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4587
4588   application.SendNotification();
4589   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4590
4591   // We didn't expect the animation to finish yet
4592   application.SendNotification();
4593   finishCheck.CheckSignalNotReceived();
4594   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4595
4596   application.SendNotification();
4597   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4598
4599   // We didn't expect the animation to finish yet
4600   application.SendNotification();
4601   finishCheck.CheckSignalNotReceived();
4602   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4603
4604   application.SendNotification();
4605   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4606
4607   // We did expect the animation to finish
4608   application.SendNotification();
4609   finishCheck.CheckSignalReceived();
4610   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4611   END_TEST;
4612 }
4613
4614
4615 int UtcDaliAnimationAnimateByActorOrientationP3(void)
4616 {
4617   TestApplication application;
4618
4619   tet_printf("Testing that rotation angle > 360 performs partial rotations when cast to Quaternion\n");
4620
4621   Actor actor = Actor::New();
4622   actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
4623   Stage::GetCurrent().Add(actor);
4624   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4625
4626   // Build the animation
4627   float durationSeconds(1.0f);
4628   Animation animation = Animation::New(durationSeconds);
4629   Degree relativeRotationDegrees(730.0f);
4630   Radian relativeRotationRadians(relativeRotationDegrees);
4631
4632   Radian actualRotationRadians( Degree(10.0f) );
4633
4634   animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::ZAXIS ) );
4635
4636   // Start the animation
4637   animation.Play();
4638
4639   bool signalReceived(false);
4640   AnimationFinishCheck finishCheck(signalReceived);
4641   animation.FinishedSignal().Connect(&application, finishCheck);
4642
4643   application.SendNotification();
4644   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4645
4646   // We didn't expect the animation to finish yet
4647   application.SendNotification();
4648   finishCheck.CheckSignalNotReceived();
4649   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4650
4651   application.SendNotification();
4652   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4653
4654   // We didn't expect the animation to finish yet
4655   application.SendNotification();
4656   finishCheck.CheckSignalNotReceived();
4657   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4658
4659   application.SendNotification();
4660   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4661
4662   // We didn't expect the animation to finish yet
4663   application.SendNotification();
4664   finishCheck.CheckSignalNotReceived();
4665   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4666
4667   application.SendNotification();
4668   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4669
4670   // We did expect the animation to finish
4671   application.SendNotification();
4672   finishCheck.CheckSignalReceived();
4673   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4674   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4675   END_TEST;
4676 }
4677
4678
4679 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
4680 {
4681   TestApplication application;
4682
4683   Actor actor = Actor::New();
4684   actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4685   Stage::GetCurrent().Add(actor);
4686   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4687
4688   // Build the animation
4689   float durationSeconds(1.0f);
4690   Animation animation = Animation::New(durationSeconds);
4691   Degree relativeRotationDegrees(360.0f);
4692   Radian relativeRotationRadians(relativeRotationDegrees);
4693   animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ), AlphaFunction::EASE_IN );
4694
4695   // Start the animation
4696   animation.Play();
4697
4698   bool signalReceived(false);
4699   AnimationFinishCheck finishCheck(signalReceived);
4700   animation.FinishedSignal().Connect(&application, finishCheck);
4701
4702   application.SendNotification();
4703   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4704
4705   // We didn't expect the animation to finish yet
4706   application.SendNotification();
4707   finishCheck.CheckSignalNotReceived();
4708   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4709
4710   application.SendNotification();
4711   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4712
4713   // We didn't expect the animation to finish yet
4714   application.SendNotification();
4715   finishCheck.CheckSignalNotReceived();
4716   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4717
4718   application.SendNotification();
4719   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4720
4721   // We didn't expect the animation to finish yet
4722   application.SendNotification();
4723   finishCheck.CheckSignalNotReceived();
4724   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4725
4726   application.SendNotification();
4727   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4728
4729   // We did expect the animation to finish
4730   application.SendNotification();
4731   finishCheck.CheckSignalReceived();
4732   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4733   END_TEST;
4734 }
4735
4736 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void)
4737 {
4738   TestApplication application;
4739
4740   Actor actor = Actor::New();
4741   actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4742   Stage::GetCurrent().Add(actor);
4743   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4744
4745   // Build the animation
4746   float durationSeconds(1.0f);
4747   Animation animation = Animation::New(durationSeconds);
4748   Degree relativeRotationDegrees(360.0f);
4749   Radian relativeRotationRadians(relativeRotationDegrees);
4750   float delay = 0.3f;
4751   animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ),
4752                        AlphaFunction::EASE_IN, TimePeriod( delay, durationSeconds - delay ) );
4753
4754   // Start the animation
4755   animation.Play();
4756
4757   bool signalReceived(false);
4758   AnimationFinishCheck finishCheck(signalReceived);
4759   animation.FinishedSignal().Connect(&application, finishCheck);
4760
4761   application.SendNotification();
4762   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4763
4764   // We didn't expect the animation to finish yet
4765   application.SendNotification();
4766   finishCheck.CheckSignalNotReceived();
4767   float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
4768   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4769
4770   application.SendNotification();
4771   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4772
4773   // We didn't expect the animation to finish yet
4774   application.SendNotification();
4775   finishCheck.CheckSignalNotReceived();
4776   progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
4777   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4778
4779   application.SendNotification();
4780   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4781
4782   // We didn't expect the animation to finish yet
4783   application.SendNotification();
4784   finishCheck.CheckSignalNotReceived();
4785   progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
4786   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4787
4788   application.SendNotification();
4789   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4790
4791   // We did expect the animation to finish
4792   application.SendNotification();
4793   finishCheck.CheckSignalReceived();
4794   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4795   END_TEST;
4796 }
4797
4798 int UtcDaliAnimationAnimateByActorScaleP(void)
4799 {
4800   TestApplication application;
4801
4802   Actor actor = Actor::New();
4803   Stage::GetCurrent().Add(actor);
4804   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4805
4806   // Build the animation
4807   float durationSeconds(1.0f);
4808   Animation animation = Animation::New(durationSeconds);
4809   Vector3 targetScale(2.0f, 2.0f, 2.0f);
4810   Vector3 relativeScale(targetScale - Vector3::ONE);
4811   animation.AnimateBy( Property( actor, Actor::Property::SCALE ), Vector3( relativeScale.x, relativeScale.y, relativeScale.z ) );
4812
4813   Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale*0.99f);
4814
4815   // Start the animation
4816   animation.Play();
4817
4818   // Target value should be retrievable straight away
4819   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
4820
4821   bool signalReceived(false);
4822   AnimationFinishCheck finishCheck(signalReceived);
4823   animation.FinishedSignal().Connect(&application, finishCheck);
4824
4825   application.SendNotification();
4826   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4827
4828   // We didn't expect the animation to finish yet
4829   application.SendNotification();
4830   finishCheck.CheckSignalNotReceived();
4831   DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
4832
4833   application.SendNotification();
4834   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4835
4836   // We did expect the animation to finish
4837   application.SendNotification();
4838   finishCheck.CheckSignalReceived();
4839   DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4840
4841   // Reset everything
4842   finishCheck.Reset();
4843   actor.SetScale(Vector3::ONE);
4844   application.SendNotification();
4845   application.Render(0);
4846   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4847
4848   // Repeat with a different (ease-in) alpha function
4849   animation = Animation::New(durationSeconds);
4850   animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::EASE_IN );
4851   animation.FinishedSignal().Connect(&application, finishCheck);
4852   animation.Play();
4853
4854   application.SendNotification();
4855   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4856
4857   // We didn't expect the animation to finish yet
4858   application.SendNotification();
4859   finishCheck.CheckSignalNotReceived();
4860
4861   // The scale should have grown less, than with a linear alpha function
4862   Vector3 current(actor.GetCurrentScale());
4863   DALI_TEST_CHECK( current.x > 1.0f );
4864   DALI_TEST_CHECK( current.y > 1.0f );
4865   DALI_TEST_CHECK( current.z > 1.0f );
4866   DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
4867   DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
4868   DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
4869
4870   application.SendNotification();
4871   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4872
4873   // We did expect the animation to finish
4874   application.SendNotification();
4875   finishCheck.CheckSignalReceived();
4876   DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4877
4878   // Reset everything
4879   finishCheck.Reset();
4880   actor.SetScale(Vector3::ONE);
4881   application.SendNotification();
4882   application.Render(0);
4883   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4884
4885   // Repeat with a delay
4886   float delay = 0.5f;
4887   animation = Animation::New(durationSeconds);
4888   animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
4889   animation.FinishedSignal().Connect(&application, finishCheck);
4890   animation.Play();
4891
4892   application.SendNotification();
4893   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4894
4895   // We didn't expect the animation to finish yet
4896   application.SendNotification();
4897   finishCheck.CheckSignalNotReceived();
4898   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4899
4900   application.SendNotification();
4901   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4902
4903   // We did expect the animation to finish
4904   application.SendNotification();
4905   finishCheck.CheckSignalReceived();
4906   DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4907   END_TEST;
4908 }
4909
4910 int UtcDaliAnimationAnimateToBooleanP(void)
4911 {
4912   TestApplication application;
4913
4914   Actor actor = Actor::New();
4915
4916   // Register a boolean property
4917   const bool startValue(false);
4918   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4919   Stage::GetCurrent().Add(actor);
4920   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4921   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
4922
4923   // Build the animation
4924   float durationSeconds(2.0f);
4925   Animation animation = Animation::New(durationSeconds);
4926   const bool targetValue( !startValue );
4927   animation.AnimateTo(Property(actor, index), targetValue);
4928
4929   // Start the animation
4930   animation.Play();
4931
4932   bool signalReceived(false);
4933   AnimationFinishCheck finishCheck(signalReceived);
4934   animation.FinishedSignal().Connect(&application, finishCheck);
4935
4936   application.SendNotification();
4937   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4938
4939   // We didn't expect the animation to finish yet
4940   application.SendNotification();
4941   finishCheck.CheckSignalNotReceived();
4942   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
4943
4944   application.SendNotification();
4945   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4946
4947   // We did expect the animation to finish
4948   application.SendNotification();
4949   finishCheck.CheckSignalReceived();
4950   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
4951
4952   // Check that nothing has changed after a couple of buffer swaps
4953   application.Render(0);
4954   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
4955   application.Render(0);
4956   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
4957
4958   // Repeat with target value "false"
4959   animation = Animation::New(durationSeconds);
4960   const bool finalValue( !targetValue );
4961   animation.AnimateTo(Property(actor, index), finalValue);
4962
4963   // Start the animation
4964   animation.Play();
4965
4966   finishCheck.Reset();
4967   animation.FinishedSignal().Connect(&application, finishCheck);
4968
4969   application.SendNotification();
4970   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4971
4972   // We didn't expect the animation to finish yet
4973   application.SendNotification();
4974   finishCheck.CheckSignalNotReceived();
4975   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
4976
4977   application.SendNotification();
4978   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4979
4980   // We did expect the animation to finish
4981   application.SendNotification();
4982   finishCheck.CheckSignalReceived();
4983   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
4984
4985   // Check that nothing has changed after a couple of buffer swaps
4986   application.Render(0);
4987   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
4988   application.Render(0);
4989   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
4990   END_TEST;
4991 }
4992
4993 int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void)
4994 {
4995   TestApplication application;
4996
4997   Actor actor = Actor::New();
4998
4999   // Register a boolean property
5000   const bool startValue(false);
5001   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5002   Stage::GetCurrent().Add(actor);
5003   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5004   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
5005
5006   // Build the animation
5007   float durationSeconds(2.0f);
5008   Animation animation = Animation::New(durationSeconds);
5009   const bool targetValue( !startValue );
5010   animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
5011
5012   // Start the animation
5013   animation.Play();
5014
5015   bool signalReceived(false);
5016   AnimationFinishCheck finishCheck(signalReceived);
5017   animation.FinishedSignal().Connect(&application, finishCheck);
5018
5019   application.SendNotification();
5020   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5021
5022   // We didn't expect the animation to finish yet
5023   application.SendNotification();
5024   finishCheck.CheckSignalNotReceived();
5025   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
5026
5027   application.SendNotification();
5028   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5029
5030   // We did expect the animation to finish
5031   application.SendNotification();
5032   finishCheck.CheckSignalReceived();
5033   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
5034
5035   // Check that nothing has changed after a couple of buffer swaps
5036   application.Render(0);
5037   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
5038   application.Render(0);
5039   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
5040
5041   // Repeat with target value "false"
5042   animation = Animation::New(durationSeconds);
5043   const bool finalValue( !targetValue );
5044   animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
5045
5046   // Start the animation
5047   animation.Play();
5048
5049   finishCheck.Reset();
5050   animation.FinishedSignal().Connect(&application, finishCheck);
5051
5052   application.SendNotification();
5053   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5054
5055   // We didn't expect the animation to finish yet
5056   application.SendNotification();
5057   finishCheck.CheckSignalNotReceived();
5058   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
5059
5060   application.SendNotification();
5061   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5062
5063   // We did expect the animation to finish
5064   application.SendNotification();
5065   finishCheck.CheckSignalReceived();
5066   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5067
5068   // Check that nothing has changed after a couple of buffer swaps
5069   application.Render(0);
5070   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5071   application.Render(0);
5072   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5073   END_TEST;
5074 }
5075
5076 int UtcDaliAnimationAnimateToBooleanTimePeriodP(void)
5077 {
5078   TestApplication application;
5079
5080   Actor actor = Actor::New();
5081
5082   // Register a boolean property
5083   bool startValue(false);
5084   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5085   Stage::GetCurrent().Add(actor);
5086   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5087   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
5088
5089   // Build the animation
5090   float durationSeconds(2.0f);
5091   Animation animation = Animation::New(durationSeconds);
5092   bool finalValue( !startValue );
5093   float animatorDurationSeconds(durationSeconds * 0.5f);
5094   animation.AnimateTo( Property(actor, index),
5095                        finalValue,
5096                        TimePeriod( animatorDurationSeconds ) );
5097
5098   // Start the animation
5099   animation.Play();
5100
5101   bool signalReceived(false);
5102   AnimationFinishCheck finishCheck(signalReceived);
5103   animation.FinishedSignal().Connect(&application, finishCheck);
5104
5105   application.SendNotification();
5106   application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5107
5108   // We didn't expect the animation to finish yet
5109   application.SendNotification();
5110   finishCheck.CheckSignalNotReceived();
5111   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
5112
5113   application.SendNotification();
5114   application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5115
5116   // We didn't expect the animation to finish yet...
5117   application.SendNotification();
5118   finishCheck.CheckSignalNotReceived();
5119
5120   // ...however we should have reached the final value
5121   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5122
5123   application.SendNotification();
5124   application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5125
5126   // We did expect the animation to finish
5127   application.SendNotification();
5128   finishCheck.CheckSignalReceived();
5129   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5130
5131   // Check that nothing has changed after a couple of buffer swaps
5132   application.Render(0);
5133   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5134   application.Render(0);
5135   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5136   END_TEST;
5137 }
5138
5139 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void)
5140 {
5141   TestApplication application;
5142
5143   Actor actor = Actor::New();
5144
5145   // Register a boolean property
5146   bool startValue(false);
5147   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5148   Stage::GetCurrent().Add(actor);
5149   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5150   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
5151
5152   // Build the animation
5153   float durationSeconds(2.0f);
5154   Animation animation = Animation::New(durationSeconds);
5155   bool finalValue( !startValue );
5156   float animatorDurationSeconds(durationSeconds * 0.5f);
5157   animation.AnimateTo( Property(actor, index),
5158                        finalValue,
5159                        AlphaFunction::LINEAR,
5160                        TimePeriod( animatorDurationSeconds ) );
5161
5162   // Start the animation
5163   animation.Play();
5164
5165   bool signalReceived(false);
5166   AnimationFinishCheck finishCheck(signalReceived);
5167   animation.FinishedSignal().Connect(&application, finishCheck);
5168
5169   application.SendNotification();
5170   application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5171
5172   // We didn't expect the animation to finish yet
5173   application.SendNotification();
5174   finishCheck.CheckSignalNotReceived();
5175   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
5176
5177   application.SendNotification();
5178   application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5179
5180   // We didn't expect the animation to finish yet...
5181   application.SendNotification();
5182   finishCheck.CheckSignalNotReceived();
5183
5184   // ...however we should have reached the final value
5185   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5186
5187   application.SendNotification();
5188   application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5189
5190   // We did expect the animation to finish
5191   application.SendNotification();
5192   finishCheck.CheckSignalReceived();
5193   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5194
5195   // Check that nothing has changed after a couple of buffer swaps
5196   application.Render(0);
5197   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5198   application.Render(0);
5199   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5200   END_TEST;
5201 }
5202
5203 int UtcDaliAnimationAnimateToFloatP(void)
5204 {
5205   TestApplication application;
5206
5207   Actor actor = Actor::New();
5208
5209   // Register a float property
5210   float startValue(10.0f);
5211   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5212   Stage::GetCurrent().Add(actor);
5213   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5214   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
5215
5216   // Build the animation
5217   float durationSeconds(2.0f);
5218   Animation animation = Animation::New(durationSeconds);
5219   float targetValue(50.0f);
5220   float relativeValue(targetValue - startValue);
5221   animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5222
5223   float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5224
5225   // Start the animation
5226   animation.Play();
5227
5228   bool signalReceived(false);
5229   AnimationFinishCheck finishCheck(signalReceived);
5230   animation.FinishedSignal().Connect(&application, finishCheck);
5231
5232   application.SendNotification();
5233   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5234
5235   // We didn't expect the animation to finish yet
5236   application.SendNotification();
5237   finishCheck.CheckSignalNotReceived();
5238   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
5239
5240   application.SendNotification();
5241   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5242
5243   // We did expect the animation to finish
5244   application.SendNotification();
5245   finishCheck.CheckSignalReceived();
5246   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
5247   END_TEST;
5248 }
5249
5250 int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void)
5251 {
5252   TestApplication application;
5253
5254   Actor actor = Actor::New();
5255
5256   // Register a float property
5257   float startValue(10.0f);
5258   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5259   Stage::GetCurrent().Add(actor);
5260   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5261   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
5262
5263   // Build the animation
5264   float durationSeconds(1.0f);
5265   Animation animation = Animation::New(durationSeconds);
5266   float targetValue(90.0f);
5267   float relativeValue(targetValue - startValue);
5268   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5269
5270   float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5271
5272   // Start the animation
5273   animation.Play();
5274
5275   bool signalReceived(false);
5276   AnimationFinishCheck finishCheck(signalReceived);
5277   animation.FinishedSignal().Connect(&application, finishCheck);
5278
5279   application.SendNotification();
5280   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5281
5282   // We didn't expect the animation to finish yet
5283   application.SendNotification();
5284   finishCheck.CheckSignalNotReceived();
5285
5286   // The position should have moved more, than with a linear alpha function
5287   float current( DevelHandle::GetCurrentProperty< float >( actor, index ) );
5288   DALI_TEST_CHECK( current > ninetyFivePercentProgress );
5289
5290   application.SendNotification();
5291   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5292
5293   // We did expect the animation to finish
5294   application.SendNotification();
5295   finishCheck.CheckSignalReceived();
5296   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
5297   END_TEST;
5298 }
5299
5300 int UtcDaliAnimationAnimateToFloatTimePeriodP(void)
5301 {
5302   TestApplication application;
5303
5304   Actor actor = Actor::New();
5305
5306   // Register a float property
5307   float startValue(10.0f);
5308   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5309   Stage::GetCurrent().Add(actor);
5310   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5311   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
5312
5313   // Build the animation
5314   float durationSeconds(1.0f);
5315   Animation animation = Animation::New(durationSeconds);
5316   float targetValue(30.0f);
5317   float relativeValue(targetValue - startValue);
5318   float delay = 0.5f;
5319   animation.AnimateTo(Property(actor, index),
5320                       targetValue,
5321                       TimePeriod(delay, durationSeconds - delay));
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*500.0f)/* 50% animation progress, 0% animator progress */);
5332
5333   // We didn't expect the animation to finish yet
5334   application.SendNotification();
5335   finishCheck.CheckSignalNotReceived();
5336   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
5337
5338   application.SendNotification();
5339   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5340
5341   // We didn't expect the animation to finish yet
5342   application.SendNotification();
5343   finishCheck.CheckSignalNotReceived();
5344   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5345
5346   application.SendNotification();
5347   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5348
5349   // We did expect the animation to finish
5350   application.SendNotification();
5351   finishCheck.CheckSignalReceived();
5352   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
5353   END_TEST;
5354 }
5355
5356 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void)
5357 {
5358   TestApplication application;
5359
5360   Actor actor = Actor::New();
5361
5362   // Register a float property
5363   float startValue(10.0f);
5364   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5365   Stage::GetCurrent().Add(actor);
5366   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5367   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
5368
5369   // Build the animation
5370   float durationSeconds(1.0f);
5371   Animation animation = Animation::New(durationSeconds);
5372   float targetValue(30.0f);
5373   float relativeValue(targetValue - startValue);
5374   float delay = 0.5f;
5375   animation.AnimateTo(Property(actor, index),
5376                       targetValue,
5377                       AlphaFunction::LINEAR,
5378                       TimePeriod(delay, durationSeconds - delay));
5379
5380   // Start the animation
5381   animation.Play();
5382
5383   bool signalReceived(false);
5384   AnimationFinishCheck finishCheck(signalReceived);
5385   animation.FinishedSignal().Connect(&application, finishCheck);
5386
5387   application.SendNotification();
5388   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5389
5390   // We didn't expect the animation to finish yet
5391   application.SendNotification();
5392   finishCheck.CheckSignalNotReceived();
5393   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
5394
5395   application.SendNotification();
5396   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5397
5398   // We didn't expect the animation to finish yet
5399   application.SendNotification();
5400   finishCheck.CheckSignalNotReceived();
5401   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5402
5403   application.SendNotification();
5404   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5405
5406   // We did expect the animation to finish
5407   application.SendNotification();
5408   finishCheck.CheckSignalReceived();
5409   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
5410   END_TEST;
5411 }
5412
5413 int UtcDaliAnimationAnimateToIntegerP(void)
5414 {
5415   TestApplication application;
5416
5417   Actor actor = Actor::New();
5418
5419   // Register an integer property
5420   int startValue(10);
5421   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5422   Stage::GetCurrent().Add(actor);
5423   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5424   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
5425
5426   // Build the animation
5427   float durationSeconds(2.0f);
5428   Animation animation = Animation::New(durationSeconds);
5429   int targetValue(50);
5430   int relativeValue(targetValue - startValue);
5431   animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5432
5433   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
5434
5435   // Start the animation
5436   animation.Play();
5437
5438   bool signalReceived(false);
5439   AnimationFinishCheck finishCheck(signalReceived);
5440   animation.FinishedSignal().Connect(&application, finishCheck);
5441
5442   application.SendNotification();
5443   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5444
5445   // We didn't expect the animation to finish yet
5446   application.SendNotification();
5447   finishCheck.CheckSignalNotReceived();
5448   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
5449
5450   application.SendNotification();
5451   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5452
5453   // We did expect the animation to finish
5454   application.SendNotification();
5455   finishCheck.CheckSignalReceived();
5456   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
5457   END_TEST;
5458 }
5459
5460 int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void)
5461 {
5462   TestApplication application;
5463
5464   Actor actor = Actor::New();
5465
5466   // Register an integer property
5467   int startValue(10);
5468   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5469   Stage::GetCurrent().Add(actor);
5470   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5471   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
5472
5473   // Build the animation
5474   float durationSeconds(1.0f);
5475   Animation animation = Animation::New(durationSeconds);
5476   int targetValue(90);
5477   int relativeValue(targetValue - startValue);
5478   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5479
5480   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
5481
5482   // Start the animation
5483   animation.Play();
5484
5485   bool signalReceived(false);
5486   AnimationFinishCheck finishCheck(signalReceived);
5487   animation.FinishedSignal().Connect(&application, finishCheck);
5488
5489   application.SendNotification();
5490   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5491
5492   // We didn't expect the animation to finish yet
5493   application.SendNotification();
5494   finishCheck.CheckSignalNotReceived();
5495
5496   // The position should have moved more, than with a linear alpha function
5497   int current( DevelHandle::GetCurrentProperty< int >( actor, index ) );
5498   DALI_TEST_CHECK( current > ninetyFivePercentProgress );
5499
5500   application.SendNotification();
5501   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5502
5503   // We did expect the animation to finish
5504   application.SendNotification();
5505   finishCheck.CheckSignalReceived();
5506   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
5507   END_TEST;
5508 }
5509
5510 int UtcDaliAnimationAnimateToIntegerTimePeriodP(void)
5511 {
5512   TestApplication application;
5513
5514   Actor actor = Actor::New();
5515
5516   // Register an integer property
5517   int startValue(10);
5518   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5519   Stage::GetCurrent().Add(actor);
5520   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5521   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
5522
5523   // Build the animation
5524   float durationSeconds(1.0f);
5525   Animation animation = Animation::New(durationSeconds);
5526   int targetValue(30);
5527   int relativeValue(targetValue - startValue);
5528   float delay = 0.5f;
5529   animation.AnimateTo(Property(actor, index),
5530                       targetValue,
5531                       TimePeriod(delay, durationSeconds - delay));
5532
5533   // Start the animation
5534   animation.Play();
5535
5536   bool signalReceived(false);
5537   AnimationFinishCheck finishCheck(signalReceived);
5538   animation.FinishedSignal().Connect(&application, finishCheck);
5539
5540   application.SendNotification();
5541   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5542
5543   // We didn't expect the animation to finish yet
5544   application.SendNotification();
5545   finishCheck.CheckSignalNotReceived();
5546   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
5547
5548   application.SendNotification();
5549   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5550
5551   // We didn't expect the animation to finish yet
5552   application.SendNotification();
5553   finishCheck.CheckSignalNotReceived();
5554   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
5555
5556   application.SendNotification();
5557   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5558
5559   // We did expect the animation to finish
5560   application.SendNotification();
5561   finishCheck.CheckSignalReceived();
5562   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
5563   END_TEST;
5564 }
5565
5566 int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void)
5567 {
5568   TestApplication application;
5569
5570   Actor actor = Actor::New();
5571
5572   // Register an integer property
5573   int startValue(10);
5574   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5575   Stage::GetCurrent().Add(actor);
5576   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5577   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
5578
5579   // Build the animation
5580   float durationSeconds(1.0f);
5581   Animation animation = Animation::New(durationSeconds);
5582   int targetValue(30);
5583   int relativeValue(targetValue - startValue);
5584   float delay = 0.5f;
5585   animation.AnimateTo(Property(actor, index),
5586                       targetValue,
5587                       AlphaFunction::LINEAR,
5588                       TimePeriod(delay, durationSeconds - delay));
5589
5590   // Start the animation
5591   animation.Play();
5592
5593   bool signalReceived(false);
5594   AnimationFinishCheck finishCheck(signalReceived);
5595   animation.FinishedSignal().Connect(&application, finishCheck);
5596
5597   application.SendNotification();
5598   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5599
5600   // We didn't expect the animation to finish yet
5601   application.SendNotification();
5602   finishCheck.CheckSignalNotReceived();
5603   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
5604
5605   application.SendNotification();
5606   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5607
5608   // We didn't expect the animation to finish yet
5609   application.SendNotification();
5610   finishCheck.CheckSignalNotReceived();
5611   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
5612
5613   application.SendNotification();
5614   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5615
5616   // We did expect the animation to finish
5617   application.SendNotification();
5618   finishCheck.CheckSignalReceived();
5619   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
5620   END_TEST;
5621 }
5622
5623 int UtcDaliAnimationAnimateToVector2P(void)
5624 {
5625   TestApplication application;
5626
5627   Actor actor = Actor::New();
5628
5629   // Register a Vector2 property
5630   Vector2 startValue(-50.0f, -50.0f);
5631   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5632   Stage::GetCurrent().Add(actor);
5633   DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5634   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
5635
5636   // Build the animation
5637   float durationSeconds(2.0f);
5638   Animation animation = Animation::New(durationSeconds);
5639   Vector2 targetValue(50.0f, 50.0f);
5640   Vector2 relativeValue(targetValue - startValue);
5641   animation.AnimateTo(Property(actor, index), targetValue);
5642
5643   Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5644
5645   // Start the animation
5646   animation.Play();
5647
5648   bool signalReceived(false);
5649   AnimationFinishCheck finishCheck(signalReceived);
5650   animation.FinishedSignal().Connect(&application, finishCheck);
5651
5652   application.SendNotification();
5653   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5654
5655   // We didn't expect the animation to finish yet
5656   application.SendNotification();
5657   finishCheck.CheckSignalNotReceived();
5658   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
5659
5660   application.SendNotification();
5661   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5662
5663   // We did expect the animation to finish
5664   application.SendNotification();
5665   finishCheck.CheckSignalReceived();
5666   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
5667   END_TEST;
5668 }
5669
5670 int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void)
5671 {
5672   TestApplication application;
5673
5674   Actor actor = Actor::New();
5675
5676   // Register a Vector2 property
5677   Vector2 startValue(1000.0f, 1000.0f);
5678   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5679   Stage::GetCurrent().Add(actor);
5680   DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5681   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
5682
5683   // Build the animation
5684   float durationSeconds(1.0f);
5685   Animation animation = Animation::New(durationSeconds);
5686   Vector2 targetValue(9000.0f, 9000.0f);
5687   Vector2 relativeValue(targetValue - startValue);
5688   animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
5689
5690   Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5691
5692   // Start the animation
5693   animation.Play();
5694
5695   bool signalReceived(false);
5696   AnimationFinishCheck finishCheck(signalReceived);
5697   animation.FinishedSignal().Connect(&application, finishCheck);
5698
5699   application.SendNotification();
5700   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5701
5702   // We didn't expect the animation to finish yet
5703   application.SendNotification();
5704   finishCheck.CheckSignalNotReceived();
5705
5706   // The position should have moved more, than with a linear alpha function
5707   Vector2 current( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ) );
5708   DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
5709   DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
5710
5711   application.SendNotification();
5712   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5713
5714   // We did expect the animation to finish
5715   application.SendNotification();
5716   finishCheck.CheckSignalReceived();
5717   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
5718   END_TEST;
5719 }
5720
5721 int UtcDaliAnimationAnimateToVector2TimePeriodP(void)
5722 {
5723   TestApplication application;
5724
5725   Actor actor = Actor::New();
5726
5727   // Register a Vector2 property
5728   Vector2 startValue(10.0f, 10.0f);
5729   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5730   Stage::GetCurrent().Add(actor);
5731   DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5732   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
5733
5734   // Build the animation
5735   float durationSeconds(1.0f);
5736   Animation animation = Animation::New(durationSeconds);
5737   Vector2 targetValue(-10.0f, 20.0f);
5738   Vector2 relativeValue(targetValue - startValue);
5739   float delay = 0.5f;
5740   animation.AnimateTo(Property(actor, index),
5741                       targetValue,
5742                       TimePeriod(delay, durationSeconds - delay));
5743
5744   // Start the animation
5745   animation.Play();
5746
5747   bool signalReceived(false);
5748   AnimationFinishCheck finishCheck(signalReceived);
5749   animation.FinishedSignal().Connect(&application, finishCheck);
5750
5751   application.SendNotification();
5752   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5753
5754   // We didn't expect the animation to finish yet
5755   application.SendNotification();
5756   finishCheck.CheckSignalNotReceived();
5757   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
5758
5759   application.SendNotification();
5760   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5761
5762   // We didn't expect the animation to finish yet
5763   application.SendNotification();
5764   finishCheck.CheckSignalNotReceived();
5765   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5766
5767   application.SendNotification();
5768   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5769
5770   // We did expect the animation to finish
5771   application.SendNotification();
5772   finishCheck.CheckSignalReceived();
5773   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
5774   END_TEST;
5775 }
5776
5777 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void)
5778 {
5779   TestApplication application;
5780
5781   Actor actor = Actor::New();
5782
5783   // Register a Vector2 property
5784   Vector2 startValue(10.0f, 10.0f);
5785   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5786   Stage::GetCurrent().Add(actor);
5787   DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5788   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
5789
5790   // Build the animation
5791   float durationSeconds(1.0f);
5792   Animation animation = Animation::New(durationSeconds);
5793   Vector2 targetValue(30.0f, 30.0f);
5794   Vector2 relativeValue(targetValue - startValue);
5795   float delay = 0.5f;
5796   animation.AnimateTo(Property(actor, index),
5797                       targetValue,
5798                       AlphaFunction::LINEAR,
5799                       TimePeriod(delay, durationSeconds - delay));
5800
5801   // Start the animation
5802   animation.Play();
5803
5804   bool signalReceived(false);
5805   AnimationFinishCheck finishCheck(signalReceived);
5806   animation.FinishedSignal().Connect(&application, finishCheck);
5807
5808   application.SendNotification();
5809   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5810
5811   // We didn't expect the animation to finish yet, but cached value should be the final one
5812   application.SendNotification();
5813   finishCheck.CheckSignalNotReceived();
5814   DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
5815   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty<Vector2>( actor, index ), startValue, TEST_LOCATION );
5816
5817   application.SendNotification();
5818   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5819
5820   // We didn't expect the animation to finish yet
5821   application.SendNotification();
5822   finishCheck.CheckSignalNotReceived();
5823   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5824
5825   application.SendNotification();
5826   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5827
5828   // We did expect the animation to finish
5829   application.SendNotification();
5830   finishCheck.CheckSignalReceived();
5831   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
5832   DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
5833   END_TEST;
5834 }
5835
5836 int UtcDaliAnimationAnimateToVector3P(void)
5837 {
5838   TestApplication application;
5839
5840   Actor actor = Actor::New();
5841
5842   // Register a Vector3 property
5843   Vector3 startValue(-50.0f, -50.0f, -50.0f);
5844   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5845   Stage::GetCurrent().Add(actor);
5846   DALI_TEST_EQUALS( actor.GetProperty<Vector3>( index ), startValue, TEST_LOCATION );
5847   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
5848
5849   // Build the animation
5850   float durationSeconds(2.0f);
5851   Animation animation = Animation::New(durationSeconds);
5852   Vector3 targetValue(50.0f, 50.0f, 50.0f);
5853   Vector3 relativeValue(targetValue - startValue);
5854   animation.AnimateTo(Property(actor, index), targetValue);
5855
5856   Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5857
5858   // Start the animation
5859   animation.Play();
5860
5861   bool signalReceived(false);
5862   AnimationFinishCheck finishCheck(signalReceived);
5863   animation.FinishedSignal().Connect(&application, finishCheck);
5864
5865   application.SendNotification();
5866   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5867
5868   // We didn't expect the animation to finish yet
5869   application.SendNotification();
5870   finishCheck.CheckSignalNotReceived();
5871   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
5872
5873   application.SendNotification();
5874   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5875
5876   // We did expect the animation to finish
5877   application.SendNotification();
5878   finishCheck.CheckSignalReceived();
5879   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
5880   END_TEST;
5881 }
5882
5883 int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void)
5884 {
5885   TestApplication application;
5886
5887   Actor actor = Actor::New();
5888
5889   // Register a Vector3 property
5890   Vector3 startValue(1000.0f, 1000.0f, 1000.0f);
5891   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5892   Stage::GetCurrent().Add(actor);
5893   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5894   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
5895
5896   // Build the animation
5897   float durationSeconds(1.0f);
5898   Animation animation = Animation::New(durationSeconds);
5899   Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
5900   Vector3 relativeValue(targetValue - startValue);
5901   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5902
5903   Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5904
5905   // Start the animation
5906   animation.Play();
5907
5908   bool signalReceived(false);
5909   AnimationFinishCheck finishCheck(signalReceived);
5910   animation.FinishedSignal().Connect(&application, finishCheck);
5911
5912   application.SendNotification();
5913   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5914
5915   // We didn't expect the animation to finish yet
5916   application.SendNotification();
5917   finishCheck.CheckSignalNotReceived();
5918
5919   // The position should have moved more, than with a linear alpha function
5920   Vector3 current( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ) );
5921   DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
5922   DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
5923   DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
5924
5925   application.SendNotification();
5926   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5927
5928   // We did expect the animation to finish
5929   application.SendNotification();
5930   finishCheck.CheckSignalReceived();
5931   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
5932   END_TEST;
5933 }
5934
5935 int UtcDaliAnimationAnimateToVector3TimePeriodP(void)
5936 {
5937   TestApplication application;
5938
5939   Actor actor = Actor::New();
5940
5941   // Register a Vector3 property
5942   Vector3 startValue(10.0f, 10.0f, 10.0f);
5943   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5944   Stage::GetCurrent().Add(actor);
5945   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5946   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
5947
5948   // Build the animation
5949   float durationSeconds(1.0f);
5950   Animation animation = Animation::New(durationSeconds);
5951   Vector3 targetValue(-10.0f, 20.0f, 100.0f);
5952   Vector3 relativeValue(targetValue - startValue);
5953   float delay = 0.5f;
5954   animation.AnimateTo(Property(actor, index),
5955                       targetValue,
5956                       TimePeriod(delay, durationSeconds - delay));
5957
5958   // Start the animation
5959   animation.Play();
5960
5961   bool signalReceived(false);
5962   AnimationFinishCheck finishCheck(signalReceived);
5963   animation.FinishedSignal().Connect(&application, finishCheck);
5964
5965   application.SendNotification();
5966   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5967
5968   // We didn't expect the animation to finish yet
5969   application.SendNotification();
5970   finishCheck.CheckSignalNotReceived();
5971   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
5972
5973   application.SendNotification();
5974   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5975
5976   // We didn't expect the animation to finish yet
5977   application.SendNotification();
5978   finishCheck.CheckSignalNotReceived();
5979   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5980
5981   application.SendNotification();
5982   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5983
5984   // We did expect the animation to finish
5985   application.SendNotification();
5986   finishCheck.CheckSignalReceived();
5987   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
5988   END_TEST;
5989 }
5990
5991 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void)
5992 {
5993   TestApplication application;
5994
5995   Actor actor = Actor::New();
5996
5997   // Register a Vector3 property
5998   Vector3 startValue(10.0f, 10.0f, 10.0f);
5999   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6000   Stage::GetCurrent().Add(actor);
6001   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6002   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
6003
6004   // Build the animation
6005   float durationSeconds(1.0f);
6006   Animation animation = Animation::New(durationSeconds);
6007   Vector3 targetValue(30.0f, 30.0f, 30.0f);
6008   Vector3 relativeValue(targetValue - startValue);
6009   float delay = 0.5f;
6010   animation.AnimateTo(Property(actor, "testProperty"),
6011                       targetValue,
6012                       AlphaFunction::LINEAR,
6013                       TimePeriod(delay, durationSeconds - delay));
6014
6015   // Start the animation
6016   animation.Play();
6017
6018   bool signalReceived(false);
6019   AnimationFinishCheck finishCheck(signalReceived);
6020   animation.FinishedSignal().Connect(&application, finishCheck);
6021
6022   application.SendNotification();
6023   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6024
6025   // We didn't expect the animation to finish yet
6026   application.SendNotification();
6027   finishCheck.CheckSignalNotReceived();
6028   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
6029
6030   application.SendNotification();
6031   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6032
6033   // We didn't expect the animation to finish yet
6034   application.SendNotification();
6035   finishCheck.CheckSignalNotReceived();
6036   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6037
6038   application.SendNotification();
6039   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6040
6041   // We did expect the animation to finish
6042   application.SendNotification();
6043   finishCheck.CheckSignalReceived();
6044   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
6045   END_TEST;
6046 }
6047
6048 int UtcDaliAnimationAnimateToVector3ComponentP(void)
6049 {
6050   TestApplication application;
6051
6052   Actor actor = Actor::New();
6053
6054   // Register a Vector3 property
6055   Vector3 startValue(10.0f, 10.0f, 10.0f);
6056   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6057   Stage::GetCurrent().Add(actor);
6058   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6059   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
6060
6061   // Build the animation
6062   float durationSeconds(1.0f);
6063   Animation animation = Animation::New(durationSeconds);
6064   Vector3 targetValue(30.0f, 30.0f, 10.0f);
6065   Vector3 relativeValue(targetValue - startValue);
6066   float delay = 0.5f;
6067   animation.AnimateTo(Property(actor, "testProperty",  0),
6068                       30.0f,
6069                       AlphaFunction::LINEAR,
6070                       TimePeriod(delay, durationSeconds - delay));
6071   animation.AnimateTo(Property(actor, index, 1),
6072                       30.0f,
6073                       AlphaFunction::LINEAR,
6074                       TimePeriod(delay, durationSeconds - delay));
6075
6076   // Start the animation
6077   animation.Play();
6078
6079   bool signalReceived(false);
6080   AnimationFinishCheck finishCheck(signalReceived);
6081   animation.FinishedSignal().Connect(&application, finishCheck);
6082
6083   application.SendNotification();
6084   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6085
6086   // We didn't expect the animation to finish yet
6087   application.SendNotification();
6088   finishCheck.CheckSignalNotReceived();
6089   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
6090
6091   application.SendNotification();
6092   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6093
6094   // We didn't expect the animation to finish yet
6095   application.SendNotification();
6096   finishCheck.CheckSignalNotReceived();
6097   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6098
6099   application.SendNotification();
6100   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6101
6102   // We did expect the animation to finish
6103   application.SendNotification();
6104   finishCheck.CheckSignalReceived();
6105   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
6106   END_TEST;
6107 }
6108
6109 int UtcDaliAnimationAnimateToVector4P(void)
6110 {
6111   TestApplication application;
6112
6113   Actor actor = Actor::New();
6114
6115   // Register a Vector4 property
6116   Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f);
6117   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6118   Stage::GetCurrent().Add(actor);
6119   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6120   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
6121
6122   // Build the animation
6123   float durationSeconds(2.0f);
6124   Animation animation = Animation::New(durationSeconds);
6125   Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f);
6126   Vector4 relativeValue(targetValue - startValue);
6127   animation.AnimateTo(Property(actor, index), targetValue);
6128
6129   Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6130
6131   // Start the animation
6132   animation.Play();
6133
6134   bool signalReceived(false);
6135   AnimationFinishCheck finishCheck(signalReceived);
6136   animation.FinishedSignal().Connect(&application, finishCheck);
6137
6138   application.SendNotification();
6139   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6140
6141   // We didn't expect the animation to finish yet
6142   application.SendNotification();
6143   finishCheck.CheckSignalNotReceived();
6144   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
6145
6146   application.SendNotification();
6147   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6148
6149   // We did expect the animation to finish
6150   application.SendNotification();
6151   finishCheck.CheckSignalReceived();
6152   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
6153   END_TEST;
6154 }
6155
6156 int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void)
6157 {
6158   TestApplication application;
6159
6160   Actor actor = Actor::New();
6161
6162   // Register a Vector4 property
6163   Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
6164   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6165   Stage::GetCurrent().Add(actor);
6166   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6167   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
6168
6169   // Build the animation
6170   float durationSeconds(1.0f);
6171   Animation animation = Animation::New(durationSeconds);
6172   Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
6173   Vector4 relativeValue(targetValue - startValue);
6174   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6175
6176   Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6177
6178   // Start the animation
6179   animation.Play();
6180
6181   bool signalReceived(false);
6182   AnimationFinishCheck finishCheck(signalReceived);
6183   animation.FinishedSignal().Connect(&application, finishCheck);
6184
6185   application.SendNotification();
6186   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6187
6188   // We didn't expect the animation to finish yet
6189   application.SendNotification();
6190   finishCheck.CheckSignalNotReceived();
6191
6192   // The position should have moved more, than with a linear alpha function
6193   Vector4 current( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ) );
6194   DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6195   DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6196   DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
6197   DALI_TEST_CHECK( current.w > ninetyFivePercentProgress.w );
6198
6199   application.SendNotification();
6200   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6201
6202   // We did expect the animation to finish
6203   application.SendNotification();
6204   finishCheck.CheckSignalReceived();
6205   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
6206   END_TEST;
6207 }
6208
6209 int UtcDaliAnimationAnimateToVector4TimePeriodP(void)
6210 {
6211   TestApplication application;
6212
6213   Actor actor = Actor::New();
6214
6215   // Register a Vector4 property
6216   Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6217   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6218   Stage::GetCurrent().Add(actor);
6219   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6220   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6221
6222   // Build the animation
6223   float durationSeconds(1.0f);
6224   Animation animation = Animation::New(durationSeconds);
6225   Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
6226   Vector4 relativeValue(targetValue - startValue);
6227   float delay = 0.5f;
6228   animation.AnimateTo(Property(actor, index),
6229                       targetValue,
6230                       TimePeriod(delay, durationSeconds - delay));
6231
6232   // Start the animation
6233   animation.Play();
6234
6235   bool signalReceived(false);
6236   AnimationFinishCheck finishCheck(signalReceived);
6237   animation.FinishedSignal().Connect(&application, finishCheck);
6238
6239   application.SendNotification();
6240   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6241
6242   // We didn't expect the animation to finish yet
6243   application.SendNotification();
6244   finishCheck.CheckSignalNotReceived();
6245   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6246
6247   application.SendNotification();
6248   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6249
6250   // We didn't expect the animation to finish yet
6251   application.SendNotification();
6252   finishCheck.CheckSignalNotReceived();
6253   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue+(relativeValue*0.5f), VECTOR4_EPSILON, TEST_LOCATION );
6254
6255   application.SendNotification();
6256   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6257
6258   // We did expect the animation to finish
6259   application.SendNotification();
6260   finishCheck.CheckSignalReceived();
6261   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, VECTOR4_EPSILON, TEST_LOCATION );
6262   END_TEST;
6263 }
6264
6265 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void)
6266 {
6267   TestApplication application;
6268
6269   Actor actor = Actor::New();
6270
6271   // Register a Vector4 property
6272   Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6273   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6274   Stage::GetCurrent().Add(actor);
6275   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6276   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
6277
6278   // Build the animation
6279   float durationSeconds(1.0f);
6280   Animation animation = Animation::New(durationSeconds);
6281   Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
6282   Vector4 relativeValue(targetValue - startValue);
6283   float delay = 0.5f;
6284   animation.AnimateTo(Property(actor, index),
6285                       targetValue,
6286                       AlphaFunction::LINEAR,
6287                       TimePeriod(delay, durationSeconds - delay));
6288
6289   // Start the animation
6290   animation.Play();
6291
6292   bool signalReceived(false);
6293   AnimationFinishCheck finishCheck(signalReceived);
6294   animation.FinishedSignal().Connect(&application, finishCheck);
6295
6296   application.SendNotification();
6297   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6298
6299   // We didn't expect the animation to finish yet
6300   application.SendNotification();
6301   finishCheck.CheckSignalNotReceived();
6302   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
6303
6304   application.SendNotification();
6305   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6306
6307   // We didn't expect the animation to finish yet
6308   application.SendNotification();
6309   finishCheck.CheckSignalNotReceived();
6310   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6311
6312   application.SendNotification();
6313   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6314
6315   // We did expect the animation to finish
6316   application.SendNotification();
6317   finishCheck.CheckSignalReceived();
6318   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
6319   END_TEST;
6320 }
6321
6322 int UtcDaliAnimationAnimateToActorParentOriginP(void)
6323 {
6324   TestApplication application;
6325
6326   Actor actor = Actor::New();
6327   Stage::GetCurrent().Add(actor);
6328   DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_LEFT, TEST_LOCATION );
6329
6330   // Build the animation
6331   float durationSeconds(1.0f);
6332   Animation animation = Animation::New(durationSeconds);
6333   Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
6334
6335   try
6336   {
6337     animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin );
6338   }
6339   catch (Dali::DaliException& e)
6340   {
6341     DALI_TEST_PRINT_ASSERT( e );
6342     DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6343   }
6344   END_TEST;
6345 }
6346
6347 int UtcDaliAnimationAnimateToActorParentOriginXP(void)
6348 {
6349   TestApplication application;
6350
6351   Actor actor = Actor::New();
6352   Stage::GetCurrent().Add(actor);
6353   float startValue(0.0f);
6354   DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().x, startValue, TEST_LOCATION );
6355   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION );
6356
6357   // Build the animation
6358   float durationSeconds(1.0f);
6359   Animation animation = Animation::New(durationSeconds);
6360   float targetX(1.0f);
6361
6362   try
6363   {
6364     animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX );
6365   }
6366   catch (Dali::DaliException& e)
6367   {
6368     DALI_TEST_PRINT_ASSERT( e );
6369     DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6370   }
6371   END_TEST;
6372 }
6373
6374 int UtcDaliAnimationAnimateToActorParentOriginYP(void)
6375 {
6376   TestApplication application;
6377
6378   Actor actor = Actor::New();
6379   Stage::GetCurrent().Add(actor);
6380   float startValue(0.0f);
6381   DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().y, startValue, TEST_LOCATION );
6382   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION );
6383
6384   // Build the animation
6385   float durationSeconds(1.0f);
6386   Animation animation = Animation::New(durationSeconds);
6387   float targetY(1.0f);
6388
6389   try
6390   {
6391     animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY );
6392   }
6393   catch (Dali::DaliException& e)
6394   {
6395     DALI_TEST_PRINT_ASSERT( e );
6396     DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6397   }
6398   END_TEST;
6399 }
6400
6401 int UtcDaliAnimationAnimateToActorParentOriginZP(void)
6402 {
6403   TestApplication application;
6404
6405   Actor actor = Actor::New();
6406   Stage::GetCurrent().Add(actor);
6407   float startValue(0.5f);
6408   DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().z, startValue, TEST_LOCATION );
6409   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION );
6410
6411   // Build the animation
6412   float durationSeconds(1.0f);
6413   Animation animation = Animation::New(durationSeconds);
6414   float targetZ(1.0f);
6415
6416   try
6417   {
6418     animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ );
6419   }
6420   catch (Dali::DaliException& e)
6421   {
6422     DALI_TEST_PRINT_ASSERT( e );
6423     DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6424   }
6425   END_TEST;
6426 }
6427
6428 int UtcDaliAnimationAnimateToActorAnchorPointP(void)
6429 {
6430   TestApplication application;
6431
6432   Actor actor = Actor::New();
6433   Stage::GetCurrent().Add(actor);
6434   DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), AnchorPoint::CENTER, TEST_LOCATION );
6435
6436   // Build the animation
6437   float durationSeconds(1.0f);
6438   Animation animation = Animation::New(durationSeconds);
6439   Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT);
6440
6441   try
6442   {
6443     animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
6444   }
6445   catch (Dali::DaliException& e)
6446   {
6447     DALI_TEST_PRINT_ASSERT( e );
6448     DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6449   }
6450   END_TEST;
6451 }
6452
6453 int UtcDaliAnimationAnimateToActorAnchorPointXP(void)
6454 {
6455   TestApplication application;
6456
6457   Actor actor = Actor::New();
6458   Stage::GetCurrent().Add(actor);
6459   float startValue(0.5f);
6460   DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().x, startValue, TEST_LOCATION );
6461   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION );
6462
6463   // Build the animation
6464   float durationSeconds(1.0f);
6465   Animation animation = Animation::New(durationSeconds);
6466   float targetX(1.0f);
6467
6468   try
6469   {
6470     animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_X), targetX );
6471   }
6472   catch (Dali::DaliException& e)
6473   {
6474     DALI_TEST_PRINT_ASSERT( e );
6475     DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6476   }
6477   END_TEST;
6478 }
6479
6480 int UtcDaliAnimationAnimateToActorAnchorPointYP(void)
6481 {
6482   TestApplication application;
6483
6484   Actor actor = Actor::New();
6485   Stage::GetCurrent().Add(actor);
6486   float startValue(0.5f);
6487   DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().y, startValue, TEST_LOCATION );
6488   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION );
6489
6490   // Build the animation
6491   float durationSeconds(1.0f);
6492   Animation animation = Animation::New(durationSeconds);
6493   float targetY(0.0f);
6494
6495   try
6496   {
6497     animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY );
6498   }
6499   catch (Dali::DaliException& e)
6500   {
6501     DALI_TEST_PRINT_ASSERT( e );
6502     DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6503   }
6504   END_TEST;
6505 }
6506
6507 int UtcDaliAnimationAnimateToActorAnchorPointZP(void)
6508 {
6509   TestApplication application;
6510
6511   Actor actor = Actor::New();
6512   Stage::GetCurrent().Add(actor);
6513   float startValue(0.5f);
6514   DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().z, startValue, TEST_LOCATION );
6515   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION );
6516
6517   // Build the animation
6518   float durationSeconds(1.0f);
6519   Animation animation = Animation::New(durationSeconds);
6520   float targetZ(100.0f);
6521
6522   try
6523   {
6524     animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ );
6525   }
6526   catch (Dali::DaliException& e)
6527   {
6528     DALI_TEST_PRINT_ASSERT( e );
6529     DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6530   }
6531   END_TEST;
6532 }
6533
6534 int UtcDaliAnimationAnimateToActorSizeP(void)
6535 {
6536   TestApplication application;
6537
6538   Actor actor = Actor::New();
6539   Stage::GetCurrent().Add(actor);
6540   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6541
6542   // Build the animation
6543   float durationSeconds(1.0f);
6544   Animation animation = Animation::New(durationSeconds);
6545   Vector3 targetSize(100.0f, 100.0f, 100.0f);
6546   animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize );
6547
6548   Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
6549
6550   // Should return the initial properties before play
6551   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
6552   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), 0.0f, TEST_LOCATION );
6553   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), 0.0f, TEST_LOCATION );
6554   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), 0.0f, TEST_LOCATION );
6555
6556   // Start the animation
6557   animation.Play();
6558
6559   // Should return the target property after play
6560   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
6561   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
6562   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
6563   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
6564
6565   bool signalReceived(false);
6566   AnimationFinishCheck finishCheck(signalReceived);
6567   animation.FinishedSignal().Connect(&application, finishCheck);
6568
6569   application.SendNotification();
6570   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6571
6572   // We didn't expect the animation to finish yet
6573   application.SendNotification();
6574   finishCheck.CheckSignalNotReceived();
6575   DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
6576
6577   application.SendNotification();
6578   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6579
6580   // We did expect the animation to finish
6581   application.SendNotification();
6582   finishCheck.CheckSignalReceived();
6583   DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6584
6585   // Reset everything
6586   finishCheck.Reset();
6587   actor.SetSize(Vector3::ZERO);
6588   application.SendNotification();
6589   application.Render(0);
6590   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6591
6592   // Repeat with a different (ease-in) alpha function
6593   animation = Animation::New(durationSeconds);
6594   animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
6595   animation.FinishedSignal().Connect(&application, finishCheck);
6596   animation.Play();
6597
6598   application.SendNotification();
6599   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6600
6601   // We didn't expect the animation to finish yet
6602   application.SendNotification();
6603   finishCheck.CheckSignalNotReceived();
6604
6605   // The size should have travelled less, than with a linear alpha function
6606   Vector3 current(actor.GetCurrentSize());
6607   DALI_TEST_CHECK( current.x > 0.0f );
6608   DALI_TEST_CHECK( current.y > 0.0f );
6609   DALI_TEST_CHECK( current.z > 0.0f );
6610   DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
6611   DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
6612   DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
6613
6614   application.SendNotification();
6615   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6616
6617   // We did expect the animation to finish
6618   application.SendNotification();
6619   finishCheck.CheckSignalReceived();
6620   DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6621
6622   // Reset everything
6623   finishCheck.Reset();
6624   actor.SetSize(Vector3::ZERO);
6625   application.SendNotification();
6626   application.Render(0);
6627   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6628
6629   // Repeat with a delay
6630   float delay = 0.5f;
6631   animation = Animation::New(durationSeconds);
6632   animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
6633   animation.FinishedSignal().Connect(&application, finishCheck);
6634   animation.Play();
6635
6636   application.SendNotification();
6637   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6638
6639   // We didn't expect the animation to finish yet
6640   application.SendNotification();
6641   finishCheck.CheckSignalNotReceived();
6642   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6643
6644   application.SendNotification();
6645   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6646
6647   // We did expect the animation to finish
6648   application.SendNotification();
6649   finishCheck.CheckSignalReceived();
6650   DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6651   END_TEST;
6652 }
6653
6654 int UtcDaliAnimationAnimateToActorSizeWidthP(void)
6655 {
6656   TestApplication application;
6657
6658   Actor actor = Actor::New();
6659   Stage::GetCurrent().Add(actor);
6660   float startValue(0.0f);
6661   DALI_TEST_EQUALS( actor.GetCurrentSize().width, startValue, TEST_LOCATION );
6662   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION );
6663
6664   // Build the animation
6665   float durationSeconds(1.0f);
6666   Animation animation = Animation::New(durationSeconds);
6667   float targetWidth(10.0f);
6668   animation.AnimateTo( Property(actor, Actor::Property::SIZE_WIDTH), targetWidth );
6669
6670   float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f);
6671
6672   // Should return the initial properties before play
6673   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
6674   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), startValue, TEST_LOCATION );
6675
6676   // Start the animation
6677   animation.Play();
6678
6679   // Should return the target property after play
6680   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( targetWidth, 0.0f, 0.0f ), TEST_LOCATION );
6681   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetWidth, TEST_LOCATION );
6682
6683   bool signalReceived(false);
6684   AnimationFinishCheck finishCheck(signalReceived);
6685   animation.FinishedSignal().Connect(&application, finishCheck);
6686
6687   application.SendNotification();
6688   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6689
6690   // We didn't expect the animation to finish yet
6691   application.SendNotification();
6692   finishCheck.CheckSignalNotReceived();
6693   DALI_TEST_EQUALS( actor.GetCurrentSize().width, fiftyPercentProgress, TEST_LOCATION );
6694
6695   application.SendNotification();
6696   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6697
6698   // We did expect the animation to finish
6699   application.SendNotification();
6700   finishCheck.CheckSignalReceived();
6701   DALI_TEST_EQUALS( actor.GetCurrentSize().width, targetWidth, TEST_LOCATION );
6702   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION );
6703   END_TEST;
6704 }
6705
6706 int UtcDaliAnimationAnimateToActorSizeHeightP(void)
6707 {
6708   TestApplication application;
6709
6710   Actor actor = Actor::New();
6711   Stage::GetCurrent().Add(actor);
6712   float startValue(0.0f);
6713   DALI_TEST_EQUALS( actor.GetCurrentSize().height, startValue, TEST_LOCATION );
6714   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION );
6715
6716   // Build the animation
6717   float durationSeconds(1.0f);
6718   Animation animation = Animation::New(durationSeconds);
6719   float targetHeight(-10.0f);
6720   animation.AnimateTo( Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight );
6721
6722   float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f);
6723
6724   // Should return the initial properties before play
6725   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
6726   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), startValue, TEST_LOCATION );
6727
6728   // Start the animation
6729   animation.Play();
6730
6731   // Should return the target property after play
6732   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, targetHeight, 0.0f ), TEST_LOCATION );
6733   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetHeight, TEST_LOCATION );
6734
6735   bool signalReceived(false);
6736   AnimationFinishCheck finishCheck(signalReceived);
6737   animation.FinishedSignal().Connect(&application, finishCheck);
6738
6739   application.SendNotification();
6740   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6741
6742   // We didn't expect the animation to finish yet
6743   application.SendNotification();
6744   finishCheck.CheckSignalNotReceived();
6745   DALI_TEST_EQUALS( actor.GetCurrentSize().height, fiftyPercentProgress, TEST_LOCATION );
6746
6747   application.SendNotification();
6748   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6749
6750   // We did expect the animation to finish
6751   application.SendNotification();
6752   finishCheck.CheckSignalReceived();
6753   DALI_TEST_EQUALS( actor.GetCurrentSize().height, targetHeight, TEST_LOCATION );
6754   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION );
6755   END_TEST;
6756 }
6757
6758 int UtcDaliAnimationAnimateToActorSizeDepthP(void)
6759 {
6760   TestApplication application;
6761
6762   Actor actor = Actor::New();
6763   Stage::GetCurrent().Add(actor);
6764   float startValue(0.0f);
6765   DALI_TEST_EQUALS( actor.GetCurrentSize().depth, startValue, TEST_LOCATION );
6766   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION );
6767
6768   // Build the animation
6769   float durationSeconds(1.0f);
6770   Animation animation = Animation::New(durationSeconds);
6771   float targetDepth(-10.0f);
6772   animation.AnimateTo( Property(actor, Actor::Property::SIZE_DEPTH), targetDepth );
6773
6774   float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f);
6775
6776   // Should return the initial properties before play
6777   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
6778   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), startValue, TEST_LOCATION );
6779
6780   // Start the animation
6781   animation.Play();
6782
6783   // Should return the target property after play
6784   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, 0.0f, targetDepth ), TEST_LOCATION );
6785   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetDepth, TEST_LOCATION );
6786
6787   bool signalReceived(false);
6788   AnimationFinishCheck finishCheck(signalReceived);
6789   animation.FinishedSignal().Connect(&application, finishCheck);
6790
6791   application.SendNotification();
6792   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6793
6794   // We didn't expect the animation to finish yet
6795   application.SendNotification();
6796   finishCheck.CheckSignalNotReceived();
6797   DALI_TEST_EQUALS( actor.GetCurrentSize().depth, fiftyPercentProgress, TEST_LOCATION );
6798
6799   application.SendNotification();
6800   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6801
6802   // We did expect the animation to finish
6803   application.SendNotification();
6804   finishCheck.CheckSignalReceived();
6805   DALI_TEST_EQUALS( actor.GetCurrentSize().depth, targetDepth, TEST_LOCATION );
6806   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION );
6807   END_TEST;
6808 }
6809
6810 int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void)
6811 {
6812   TestApplication application;
6813
6814   Actor actor = Actor::New();
6815   Stage::GetCurrent().Add(actor);
6816   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6817
6818   // Build the animation
6819   float durationSeconds(1.0f);
6820   Animation animation = Animation::New(durationSeconds);
6821   Vector3 targetSize(100.0f, 100.0f, 100.0f);
6822   animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetSize );
6823
6824   Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
6825
6826   // Start the animation
6827   animation.Play();
6828
6829   bool signalReceived(false);
6830   AnimationFinishCheck finishCheck(signalReceived);
6831   animation.FinishedSignal().Connect(&application, finishCheck);
6832
6833   application.SendNotification();
6834   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6835
6836   // We didn't expect the animation to finish yet
6837   application.SendNotification();
6838   finishCheck.CheckSignalNotReceived();
6839   DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
6840
6841   application.SendNotification();
6842   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6843
6844   // We did expect the animation to finish
6845   application.SendNotification();
6846   finishCheck.CheckSignalReceived();
6847   DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6848
6849   // Reset everything
6850   finishCheck.Reset();
6851   actor.SetSize(Vector3::ZERO);
6852   application.SendNotification();
6853   application.Render(0);
6854   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6855
6856   // Repeat with a different (ease-in) alpha function
6857   animation = Animation::New(durationSeconds);
6858   animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::EASE_IN );
6859   animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::EASE_IN );
6860   animation.FinishedSignal().Connect(&application, finishCheck);
6861   animation.Play();
6862
6863   application.SendNotification();
6864   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6865
6866   // We didn't expect the animation to finish yet
6867   application.SendNotification();
6868   finishCheck.CheckSignalNotReceived();
6869
6870   // The size should have travelled less, than with a linear alpha function
6871   Vector3 current(actor.GetCurrentSize());
6872   DALI_TEST_CHECK( current.x > 0.0f );
6873   DALI_TEST_CHECK( current.y > 0.0f );
6874   DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
6875   DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
6876
6877   application.SendNotification();
6878   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6879
6880   // We did expect the animation to finish
6881   application.SendNotification();
6882   finishCheck.CheckSignalReceived();
6883   DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
6884   DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
6885
6886   // Reset everything
6887   finishCheck.Reset();
6888   actor.SetSize(Vector3::ZERO);
6889   application.SendNotification();
6890   application.Render(0);
6891   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6892
6893   // Repeat with a delay
6894   float delay = 0.5f;
6895   animation = Animation::New(durationSeconds);
6896   animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
6897   animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
6898   animation.FinishedSignal().Connect(&application, finishCheck);
6899   animation.Play();
6900
6901   application.SendNotification();
6902   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6903
6904   // We didn't expect the animation to finish yet
6905   application.SendNotification();
6906   finishCheck.CheckSignalNotReceived();
6907   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6908
6909   application.SendNotification();
6910   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6911
6912   // We did expect the animation to finish
6913   application.SendNotification();
6914   finishCheck.CheckSignalReceived();
6915   DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
6916   DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
6917   END_TEST;
6918 }
6919
6920 int UtcDaliAnimationAnimateToActorPositionP(void)
6921 {
6922   TestApplication application;
6923
6924   Actor actor = Actor::New();
6925   Stage::GetCurrent().Add(actor);
6926   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6927
6928   // Build the animation
6929   float durationSeconds(1.0f);
6930   Animation animation = Animation::New(durationSeconds);
6931   Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6932   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
6933
6934   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6935
6936   // Should return the initial properties before play
6937   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
6938   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
6939   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), 0.0f, TEST_LOCATION );
6940   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), 0.0f, TEST_LOCATION );
6941
6942   // Start the animation
6943   animation.Play();
6944
6945   // Should return the target property after play
6946   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
6947   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetPosition.x, TEST_LOCATION );
6948   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetPosition.y, TEST_LOCATION );
6949   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetPosition.z, TEST_LOCATION );
6950
6951   bool signalReceived(false);
6952   AnimationFinishCheck finishCheck(signalReceived);
6953   animation.FinishedSignal().Connect(&application, finishCheck);
6954
6955   application.SendNotification();
6956   application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
6957
6958   // We didn't expect the animation to finish yet
6959   application.SendNotification();
6960   finishCheck.CheckSignalNotReceived();
6961   DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
6962
6963   application.SendNotification();
6964   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6965
6966   // We did expect the animation to finish
6967   application.SendNotification();
6968   finishCheck.CheckSignalReceived();
6969   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6970   END_TEST;
6971 }
6972
6973 int UtcDaliAnimationAnimateToActorPositionXP(void)
6974 {
6975   TestApplication application;
6976
6977   Actor actor = Actor::New();
6978   Stage::GetCurrent().Add(actor);
6979   float startValue(0.0f);
6980   DALI_TEST_EQUALS( actor.GetCurrentPosition().x, startValue, TEST_LOCATION );
6981   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6982   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6983   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6984
6985   // Build the animation
6986   float durationSeconds(1.0f);
6987   Animation animation = Animation::New(durationSeconds);
6988   float targetX(1.0f);
6989   animation.AnimateTo( Property(actor, Actor::Property::POSITION_X), targetX );
6990
6991   float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
6992
6993   // Should return the initial properties before play
6994   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
6995   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), startValue, TEST_LOCATION );
6996
6997   // Start the animation
6998   animation.Play();
6999
7000   // Should return the target property after play
7001   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( targetX, 0.0f, 0.0f ), TEST_LOCATION );
7002   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetX, TEST_LOCATION );
7003
7004   bool signalReceived(false);
7005   AnimationFinishCheck finishCheck(signalReceived);
7006   animation.FinishedSignal().Connect(&application, finishCheck);
7007
7008   application.SendNotification();
7009   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7010
7011   // We didn't expect the animation to finish yet
7012   application.SendNotification();
7013   finishCheck.CheckSignalNotReceived();
7014   DALI_TEST_EQUALS( actor.GetCurrentPosition().x, fiftyPercentProgress, TEST_LOCATION );
7015
7016   application.SendNotification();
7017   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7018
7019   // We did expect the animation to finish
7020   application.SendNotification();
7021   finishCheck.CheckSignalReceived();
7022   DALI_TEST_EQUALS( actor.GetCurrentPosition().x, targetX, TEST_LOCATION );
7023   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION );
7024   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7025   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7026   END_TEST;
7027 }
7028
7029 int UtcDaliAnimationAnimateToActorPositionYP(void)
7030 {
7031   TestApplication application;
7032
7033   Actor actor = Actor::New();
7034   Stage::GetCurrent().Add(actor);
7035   float startValue(0.0f);
7036   DALI_TEST_EQUALS( actor.GetCurrentPosition().y, startValue, TEST_LOCATION );
7037   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7038   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7039   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7040
7041   // Build the animation
7042   float durationSeconds(1.0f);
7043   Animation animation = Animation::New(durationSeconds);
7044   float targetY(10.0f);
7045   animation.AnimateTo( Property(actor, Actor::Property::POSITION_Y), targetY );
7046
7047   float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
7048
7049   // Should return the initial properties before play
7050   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7051   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), startValue, TEST_LOCATION );
7052
7053   // Start the animation
7054   animation.Play();
7055
7056   // Should return the target property after play
7057   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, targetY, 0.0f ), TEST_LOCATION );
7058   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetY, TEST_LOCATION );
7059
7060   bool signalReceived(false);
7061   AnimationFinishCheck finishCheck(signalReceived);
7062   animation.FinishedSignal().Connect(&application, finishCheck);
7063
7064   application.SendNotification();
7065   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7066
7067   // We didn't expect the animation to finish yet
7068   application.SendNotification();
7069   finishCheck.CheckSignalNotReceived();
7070   DALI_TEST_EQUALS( actor.GetCurrentPosition().y, fiftyPercentProgress, TEST_LOCATION );
7071
7072   application.SendNotification();
7073   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7074
7075   // We did expect the animation to finish
7076   application.SendNotification();
7077   finishCheck.CheckSignalReceived();
7078   DALI_TEST_EQUALS( actor.GetCurrentPosition().y, targetY, TEST_LOCATION );
7079   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7080   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION );
7081   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7082   END_TEST;
7083 }
7084
7085 int UtcDaliAnimationAnimateToActorPositionZP(void)
7086 {
7087   TestApplication application;
7088
7089   Actor actor = Actor::New();
7090   Stage::GetCurrent().Add(actor);
7091   float startValue(0.0f);
7092   DALI_TEST_EQUALS( actor.GetCurrentPosition().z, startValue, TEST_LOCATION );
7093   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7094   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7095   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7096
7097   // Build the animation
7098   float durationSeconds(1.0f);
7099   Animation animation = Animation::New(durationSeconds);
7100   float targetZ(-5.0f);
7101   animation.AnimateTo( Property(actor, Actor::Property::POSITION_Z), targetZ );
7102
7103   float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
7104
7105   // Should return the initial properties before play
7106   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7107   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), startValue, TEST_LOCATION );
7108
7109   // Start the animation
7110   animation.Play();
7111
7112   // Should return the target property after play
7113   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, targetZ ), TEST_LOCATION );
7114   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetZ, TEST_LOCATION );
7115
7116   bool signalReceived(false);
7117   AnimationFinishCheck finishCheck(signalReceived);
7118   animation.FinishedSignal().Connect(&application, finishCheck);
7119
7120   application.SendNotification();
7121   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7122
7123   // We didn't expect the animation to finish yet
7124   application.SendNotification();
7125   finishCheck.CheckSignalNotReceived();
7126   DALI_TEST_EQUALS( actor.GetCurrentPosition().z, fiftyPercentProgress, TEST_LOCATION );
7127
7128   application.SendNotification();
7129   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7130
7131   // We did expect the animation to finish
7132   application.SendNotification();
7133   finishCheck.CheckSignalReceived();
7134   DALI_TEST_EQUALS( actor.GetCurrentPosition().z, targetZ, TEST_LOCATION );
7135   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7136   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7137   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION );
7138   END_TEST;
7139 }
7140
7141 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void)
7142 {
7143   TestApplication application;
7144
7145   Actor actor = Actor::New();
7146   Stage::GetCurrent().Add(actor);
7147   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7148
7149   // Build the animation
7150   float durationSeconds(1.0f);
7151   Animation animation = Animation::New(durationSeconds);
7152   Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7153   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
7154
7155   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7156
7157   // Start the animation
7158   animation.Play();
7159
7160   bool signalReceived(false);
7161   AnimationFinishCheck finishCheck(signalReceived);
7162   animation.FinishedSignal().Connect(&application, finishCheck);
7163
7164   application.SendNotification();
7165   application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
7166
7167   // We didn't expect the animation to finish yet
7168   application.SendNotification();
7169   finishCheck.CheckSignalNotReceived();
7170
7171   // The position should have moved less, than with a linear alpha function
7172   Vector3 current(actor.GetCurrentPosition());
7173   DALI_TEST_CHECK( current.x > Vector3::ZERO.x );
7174   DALI_TEST_CHECK( current.y > Vector3::ZERO.y );
7175   DALI_TEST_CHECK( current.z > Vector3::ZERO.z );
7176   DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x );
7177   DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y );
7178   DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z );
7179
7180   application.SendNotification();
7181   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7182
7183   // We did expect the animation to finish
7184   application.SendNotification();
7185   finishCheck.CheckSignalReceived();
7186   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7187   END_TEST;
7188 }
7189
7190 int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void)
7191 {
7192   TestApplication application;
7193
7194   Actor actor = Actor::New();
7195   Stage::GetCurrent().Add(actor);
7196   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7197
7198   // Build the animation
7199   float durationSeconds(1.0f);
7200   Animation animation = Animation::New(durationSeconds);
7201   Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7202   float delay = 0.5f;
7203   animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7204                        targetPosition,
7205                        TimePeriod( delay, durationSeconds - delay ) );
7206
7207   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7208
7209   // Start the animation
7210   animation.Play();
7211
7212   bool signalReceived(false);
7213   AnimationFinishCheck finishCheck(signalReceived);
7214   animation.FinishedSignal().Connect(&application, finishCheck);
7215
7216   application.SendNotification();
7217   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7218
7219   // We didn't expect the animation to finish yet
7220   application.SendNotification();
7221   finishCheck.CheckSignalNotReceived();
7222   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7223
7224   application.SendNotification();
7225   application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7226
7227   // We didn't expect the animation to finish yet
7228   application.SendNotification();
7229   finishCheck.CheckSignalNotReceived();
7230   DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7231
7232   application.SendNotification();
7233   application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7234
7235   // We did expect the animation to finish
7236   application.SendNotification();
7237   finishCheck.CheckSignalReceived();
7238   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7239   END_TEST;
7240 }
7241
7242 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void)
7243 {
7244   TestApplication application;
7245
7246   Actor actor = Actor::New();
7247   Stage::GetCurrent().Add(actor);
7248   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7249
7250   // Build the animation
7251   float durationSeconds(1.0f);
7252   Animation animation = Animation::New(durationSeconds);
7253   Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7254   float delay = 0.5f;
7255   animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7256                        targetPosition,
7257                        AlphaFunction::LINEAR,
7258                        TimePeriod( delay, durationSeconds - delay ) );
7259
7260   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7261
7262   // Start the animation
7263   animation.Play();
7264
7265   bool signalReceived(false);
7266   AnimationFinishCheck finishCheck(signalReceived);
7267   animation.FinishedSignal().Connect(&application, finishCheck);
7268
7269   application.SendNotification();
7270   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7271
7272   // We didn't expect the animation to finish yet
7273   application.SendNotification();
7274   finishCheck.CheckSignalNotReceived();
7275   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7276
7277   application.SendNotification();
7278   application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7279
7280   // We didn't expect the animation to finish yet
7281   application.SendNotification();
7282   finishCheck.CheckSignalNotReceived();
7283   DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7284
7285   application.SendNotification();
7286   application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7287
7288   // We did expect the animation to finish
7289   application.SendNotification();
7290   finishCheck.CheckSignalReceived();
7291   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7292   END_TEST;
7293 }
7294
7295 int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void)
7296 {
7297   TestApplication application;
7298
7299   Actor actor = Actor::New();
7300   actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7301   Stage::GetCurrent().Add(actor);
7302   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7303
7304   // Build the animation
7305   float durationSeconds(1.0f);
7306   Animation animation = Animation::New(durationSeconds);
7307   Degree targetRotationDegrees(90.0f);
7308   Radian targetRotationRadians(targetRotationDegrees);
7309   animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS) );
7310
7311   // Start the animation
7312   animation.Play();
7313
7314   // Target value should be retrievable straight away
7315   DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7316
7317   bool signalReceived(false);
7318   AnimationFinishCheck finishCheck(signalReceived);
7319   animation.FinishedSignal().Connect(&application, finishCheck);
7320
7321   application.SendNotification();
7322   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7323
7324   // We didn't expect the animation to finish yet
7325   application.SendNotification();
7326   finishCheck.CheckSignalNotReceived();
7327   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7328
7329   application.SendNotification();
7330   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7331
7332   // We didn't expect the animation to finish yet
7333   application.SendNotification();
7334   finishCheck.CheckSignalNotReceived();
7335   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7336
7337   application.SendNotification();
7338   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7339
7340   // We didn't expect the animation to finish yet
7341   application.SendNotification();
7342   finishCheck.CheckSignalNotReceived();
7343   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7344
7345   application.SendNotification();
7346   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7347
7348   // We did expect the animation to finish
7349   application.SendNotification();
7350   finishCheck.CheckSignalReceived();
7351   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7352   END_TEST;
7353 }
7354
7355 int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void)
7356 {
7357   TestApplication application;
7358
7359   Actor actor = Actor::New();
7360   actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7361   Stage::GetCurrent().Add(actor);
7362   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7363
7364   // Build the animation
7365   float durationSeconds(1.0f);
7366   Animation animation = Animation::New(durationSeconds);
7367   Degree targetRotationDegrees(90.0f);
7368   Radian targetRotationRadians(targetRotationDegrees);
7369   Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
7370   animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), targetRotation );
7371
7372   // Start the animation
7373   animation.Play();
7374
7375   bool signalReceived(false);
7376   AnimationFinishCheck finishCheck(signalReceived);
7377   animation.FinishedSignal().Connect(&application, finishCheck);
7378
7379   application.SendNotification();
7380   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7381
7382   // We didn't expect the animation to finish yet
7383   application.SendNotification();
7384   finishCheck.CheckSignalNotReceived();
7385   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7386
7387   application.SendNotification();
7388   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7389
7390   // We didn't expect the animation to finish yet
7391   application.SendNotification();
7392   finishCheck.CheckSignalNotReceived();
7393   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7394
7395   application.SendNotification();
7396   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7397
7398   // We didn't expect the animation to finish yet
7399   application.SendNotification();
7400   finishCheck.CheckSignalNotReceived();
7401   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7402
7403   application.SendNotification();
7404   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7405
7406   // We did expect the animation to finish
7407   application.SendNotification();
7408   finishCheck.CheckSignalReceived();
7409   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7410   END_TEST;
7411 }
7412
7413 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void)
7414 {
7415   TestApplication application;
7416
7417   Actor actor = Actor::New();
7418   actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7419   Stage::GetCurrent().Add(actor);
7420   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7421
7422   // Build the animation
7423   float durationSeconds(1.0f);
7424   Animation animation = Animation::New(durationSeconds);
7425   Degree targetRotationDegrees(90.0f);
7426   Radian targetRotationRadians(targetRotationDegrees);
7427   animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
7428
7429   // Start the animation
7430   animation.Play();
7431
7432   bool signalReceived(false);
7433   AnimationFinishCheck finishCheck(signalReceived);
7434   animation.FinishedSignal().Connect(&application, finishCheck);
7435
7436   application.SendNotification();
7437   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7438
7439   // We didn't expect the animation to finish yet
7440   application.SendNotification();
7441   finishCheck.CheckSignalNotReceived();
7442   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7443
7444   application.SendNotification();
7445   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7446
7447   // We didn't expect the animation to finish yet
7448   application.SendNotification();
7449   finishCheck.CheckSignalNotReceived();
7450   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7451
7452   application.SendNotification();
7453   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7454
7455   // We didn't expect the animation to finish yet
7456   application.SendNotification();
7457   finishCheck.CheckSignalNotReceived();
7458   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7459
7460   application.SendNotification();
7461   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7462
7463   // We did expect the animation to finish
7464   application.SendNotification();
7465   finishCheck.CheckSignalReceived();
7466   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7467   END_TEST;
7468 }
7469
7470 int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void)
7471 {
7472   TestApplication application;
7473
7474   Actor actor = Actor::New();
7475   actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7476   Stage::GetCurrent().Add(actor);
7477   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7478
7479   // Build the animation
7480   float durationSeconds(1.0f);
7481   Animation animation = Animation::New(durationSeconds);
7482   Degree targetRotationDegrees(90.0f);
7483   Radian targetRotationRadians(targetRotationDegrees);
7484   float delay(0.1f);
7485   animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
7486
7487   // Start the animation
7488   animation.Play();
7489
7490   bool signalReceived(false);
7491   AnimationFinishCheck finishCheck(signalReceived);
7492   animation.FinishedSignal().Connect(&application, finishCheck);
7493
7494   application.SendNotification();
7495   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7496
7497   // We didn't expect the animation to finish yet
7498   application.SendNotification();
7499   finishCheck.CheckSignalNotReceived();
7500   float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7501   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7502
7503   application.SendNotification();
7504   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7505
7506   // We didn't expect the animation to finish yet
7507   application.SendNotification();
7508   finishCheck.CheckSignalNotReceived();
7509   progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7510   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7511
7512   application.SendNotification();
7513   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7514
7515   // We didn't expect the animation to finish yet
7516   application.SendNotification();
7517   finishCheck.CheckSignalNotReceived();
7518   progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7519   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7520
7521   application.SendNotification();
7522   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7523
7524   // We did expect the animation to finish
7525   application.SendNotification();
7526   finishCheck.CheckSignalReceived();
7527   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7528   END_TEST;
7529 }
7530
7531 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void)
7532 {
7533   TestApplication application;
7534
7535   Actor actor = Actor::New();
7536   actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7537   Stage::GetCurrent().Add(actor);
7538   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7539
7540   // Build the animation
7541   float durationSeconds(1.0f);
7542   Animation animation = Animation::New(durationSeconds);
7543   Degree targetRotationDegrees(90.0f);
7544   Radian targetRotationRadians(targetRotationDegrees);
7545   float delay(0.1f);
7546   animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
7547
7548   // Start the animation
7549   animation.Play();
7550
7551   bool signalReceived(false);
7552   AnimationFinishCheck finishCheck(signalReceived);
7553   animation.FinishedSignal().Connect(&application, finishCheck);
7554
7555   application.SendNotification();
7556   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7557
7558   // We didn't expect the animation to finish yet
7559   application.SendNotification();
7560   finishCheck.CheckSignalNotReceived();
7561   float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7562   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7563
7564   application.SendNotification();
7565   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7566
7567   // We didn't expect the animation to finish yet
7568   application.SendNotification();
7569   finishCheck.CheckSignalNotReceived();
7570   progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7571   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7572
7573   application.SendNotification();
7574   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7575
7576   // We didn't expect the animation to finish yet
7577   application.SendNotification();
7578   finishCheck.CheckSignalNotReceived();
7579   progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7580   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7581
7582   application.SendNotification();
7583   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7584
7585   // We did expect the animation to finish
7586   application.SendNotification();
7587   finishCheck.CheckSignalReceived();
7588   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7589   END_TEST;
7590 }
7591
7592 int UtcDaliAnimationAnimateToActorScaleP(void)
7593 {
7594   TestApplication application;
7595
7596   Actor actor = Actor::New();
7597   Stage::GetCurrent().Add(actor);
7598   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7599
7600   // Build the animation
7601   float durationSeconds(1.0f);
7602   Animation animation = Animation::New(durationSeconds);
7603   Vector3 targetScale(2.0f, 2.0f, 2.0f);
7604   animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale );
7605
7606   Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f);
7607
7608   // Start the animation
7609   animation.Play();
7610
7611   // Target value should be retrievable straight away
7612   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
7613   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetScale.x, TEST_LOCATION );
7614   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetScale.y, TEST_LOCATION );
7615   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetScale.z, TEST_LOCATION );
7616
7617   bool signalReceived(false);
7618   AnimationFinishCheck finishCheck(signalReceived);
7619   animation.FinishedSignal().Connect(&application, finishCheck);
7620
7621   application.SendNotification();
7622   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7623
7624   // We didn't expect the animation to finish yet
7625   application.SendNotification();
7626   finishCheck.CheckSignalNotReceived();
7627   DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
7628
7629   application.SendNotification();
7630   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7631
7632   // We did expect the animation to finish
7633   application.SendNotification();
7634   finishCheck.CheckSignalReceived();
7635   DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7636
7637   // Reset everything
7638   finishCheck.Reset();
7639   actor.SetScale(Vector3::ONE);
7640   application.SendNotification();
7641   application.Render(0);
7642   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7643
7644   // Repeat with a different (ease-in) alpha function
7645   animation = Animation::New(durationSeconds);
7646   animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
7647   animation.FinishedSignal().Connect(&application, finishCheck);
7648   animation.Play();
7649
7650   application.SendNotification();
7651   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7652
7653   // We didn't expect the animation to finish yet
7654   application.SendNotification();
7655   finishCheck.CheckSignalNotReceived();
7656
7657   // The scale should have grown less, than with a linear alpha function
7658   Vector3 current(actor.GetCurrentScale());
7659   DALI_TEST_CHECK( current.x > 1.0f );
7660   DALI_TEST_CHECK( current.y > 1.0f );
7661   DALI_TEST_CHECK( current.z > 1.0f );
7662   DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
7663   DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
7664   DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
7665
7666   application.SendNotification();
7667   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7668
7669   // We did expect the animation to finish
7670   application.SendNotification();
7671   finishCheck.CheckSignalReceived();
7672   DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7673
7674   // Reset everything
7675   finishCheck.Reset();
7676   actor.SetScale(Vector3::ONE);
7677   application.SendNotification();
7678   application.Render(0);
7679   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7680
7681   // Repeat with a delay
7682   float delay = 0.5f;
7683   animation = Animation::New(durationSeconds);
7684   animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7685   animation.FinishedSignal().Connect(&application, finishCheck);
7686   animation.Play();
7687
7688   application.SendNotification();
7689   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7690
7691   // We didn't expect the animation to finish yet
7692   application.SendNotification();
7693   finishCheck.CheckSignalNotReceived();
7694   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7695
7696   application.SendNotification();
7697   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7698
7699   // We did expect the animation to finish
7700   application.SendNotification();
7701   finishCheck.CheckSignalReceived();
7702   DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7703   END_TEST;
7704 }
7705
7706 int UtcDaliAnimationAnimateToActorScaleXP(void)
7707 {
7708   TestApplication application;
7709
7710   Actor actor = Actor::New();
7711   Stage::GetCurrent().Add(actor);
7712   float startValue(1.0f);
7713   DALI_TEST_EQUALS( actor.GetCurrentScale().x, startValue, TEST_LOCATION );
7714   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7715   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7716   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7717   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7718   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7719   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7720
7721   // Build the animation
7722   float durationSeconds(1.0f);
7723   Animation animation = Animation::New(durationSeconds);
7724   float targetX(10.0f);
7725   animation.AnimateTo( Property(actor, Actor::Property::SCALE_X), targetX );
7726
7727   float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
7728
7729   // Start the animation
7730   animation.Play();
7731
7732   // Target value should be retrievable straight away
7733   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( targetX, startValue, startValue ), TEST_LOCATION );
7734   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetX, TEST_LOCATION );
7735
7736   bool signalReceived(false);
7737   AnimationFinishCheck finishCheck(signalReceived);
7738   animation.FinishedSignal().Connect(&application, finishCheck);
7739
7740   application.SendNotification();
7741   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7742
7743   // We didn't expect the animation to finish yet
7744   application.SendNotification();
7745   finishCheck.CheckSignalNotReceived();
7746   DALI_TEST_EQUALS( actor.GetCurrentScale().x, fiftyPercentProgress, TEST_LOCATION );
7747   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), fiftyPercentProgress, TEST_LOCATION );
7748   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7749   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7750
7751   application.SendNotification();
7752   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7753
7754   // We did expect the animation to finish
7755   application.SendNotification();
7756   finishCheck.CheckSignalReceived();
7757   DALI_TEST_EQUALS( actor.GetCurrentScale().x, targetX, TEST_LOCATION );
7758   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), targetX, TEST_LOCATION );
7759   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7760   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7761   END_TEST;
7762 }
7763
7764 int UtcDaliAnimationAnimateToActorScaleYP(void)
7765 {
7766   TestApplication application;
7767
7768   Actor actor = Actor::New();
7769   Stage::GetCurrent().Add(actor);
7770   float startValue(1.0f);
7771   DALI_TEST_EQUALS( actor.GetCurrentScale().y, startValue, TEST_LOCATION );
7772   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7773   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7774   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7775   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7776   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7777   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7778
7779   // Build the animation
7780   float durationSeconds(1.0f);
7781   Animation animation = Animation::New(durationSeconds);
7782   float targetY(1000.0f);
7783   animation.AnimateTo( Property(actor, Actor::Property::SCALE_Y), targetY );
7784
7785   float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
7786
7787   // Start the animation
7788   animation.Play();
7789
7790   // Target value should be retrievable straight away
7791   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, targetY, startValue ), TEST_LOCATION );
7792   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetY, TEST_LOCATION );
7793
7794   bool signalReceived(false);
7795   AnimationFinishCheck finishCheck(signalReceived);
7796   animation.FinishedSignal().Connect(&application, finishCheck);
7797
7798   application.SendNotification();
7799   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7800
7801   // We didn't expect the animation to finish yet
7802   application.SendNotification();
7803   finishCheck.CheckSignalNotReceived();
7804   DALI_TEST_EQUALS( actor.GetCurrentScale().y, fiftyPercentProgress, TEST_LOCATION );
7805   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7806   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), fiftyPercentProgress, TEST_LOCATION );
7807   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7808
7809   application.SendNotification();
7810   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7811
7812   // We did expect the animation to finish
7813   application.SendNotification();
7814   finishCheck.CheckSignalReceived();
7815   DALI_TEST_EQUALS( actor.GetCurrentScale().y, targetY, TEST_LOCATION );
7816   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7817   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), targetY, TEST_LOCATION );
7818   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7819   END_TEST;
7820 }
7821
7822 int UtcDaliAnimationAnimateToActorScaleZP(void)
7823 {
7824   TestApplication application;
7825
7826   Actor actor = Actor::New();
7827   Stage::GetCurrent().Add(actor);
7828   float startValue(1.0f);
7829   DALI_TEST_EQUALS( actor.GetCurrentScale().z, startValue, TEST_LOCATION );
7830   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7831   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7832   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7833   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7834   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7835   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7836
7837   // Build the animation
7838   float durationSeconds(1.0f);
7839   Animation animation = Animation::New(durationSeconds);
7840   float targetZ(-1000.0f);
7841   animation.AnimateTo( Property(actor, Actor::Property::SCALE_Z), targetZ );
7842
7843   float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
7844
7845   // Start the animation
7846   animation.Play();
7847
7848   // Target value should be retrievable straight away
7849   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, startValue, targetZ ), TEST_LOCATION );
7850   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION );
7851
7852   bool signalReceived(false);
7853   AnimationFinishCheck finishCheck(signalReceived);
7854   animation.FinishedSignal().Connect(&application, finishCheck);
7855
7856   application.SendNotification();
7857   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7858
7859   // We didn't expect the animation to finish yet
7860   application.SendNotification();
7861   finishCheck.CheckSignalNotReceived();
7862   DALI_TEST_EQUALS( actor.GetCurrentScale().z, fiftyPercentProgress, TEST_LOCATION );
7863   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7864   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7865   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), fiftyPercentProgress, TEST_LOCATION );
7866
7867   application.SendNotification();
7868   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7869
7870   // We did expect the animation to finish
7871   application.SendNotification();
7872   finishCheck.CheckSignalReceived();
7873   DALI_TEST_EQUALS( actor.GetCurrentScale().z, targetZ, TEST_LOCATION );
7874   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7875   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7876   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION );
7877   END_TEST;
7878 }
7879
7880 int UtcDaliAnimationAnimateToActorColorP(void)
7881 {
7882   TestApplication application;
7883
7884   Actor actor = Actor::New();
7885   Stage::GetCurrent().Add(actor);
7886   DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7887
7888   // Build the animation
7889   float durationSeconds(1.0f);
7890   Animation animation = Animation::New(durationSeconds);
7891   Vector4 targetColor(Color::RED);
7892   animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor );
7893
7894   Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
7895   Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
7896
7897   // Start the animation
7898   animation.Play();
7899
7900   // Target value should be retrievable straight away
7901   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
7902   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
7903   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
7904   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
7905   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
7906   DALI_TEST_EQUALS( actor.GetProperty< float >( DevelActor::Property::OPACITY ), targetColor.a, TEST_LOCATION );
7907
7908   bool signalReceived(false);
7909   AnimationFinishCheck finishCheck(signalReceived);
7910   animation.FinishedSignal().Connect(&application, finishCheck);
7911
7912   application.SendNotification();
7913   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7914
7915   // We didn't expect the animation to finish yet
7916   application.SendNotification();
7917   finishCheck.CheckSignalNotReceived();
7918   DALI_TEST_EQUALS( actor.GetCurrentColor(), tenPercentProgress, TEST_LOCATION );
7919
7920   application.SendNotification();
7921   application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7922
7923   // We did expect the animation to finish
7924   application.SendNotification();
7925   finishCheck.CheckSignalReceived();
7926   DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7927
7928   // Reset everything
7929   finishCheck.Reset();
7930   actor.SetColor(Color::WHITE);
7931   application.SendNotification();
7932   application.Render(0);
7933   DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7934
7935   // Repeat with a different (ease-in) alpha function
7936   animation = Animation::New(durationSeconds);
7937   animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
7938   animation.FinishedSignal().Connect(&application, finishCheck);
7939   animation.Play();
7940
7941   application.SendNotification();
7942   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7943
7944   // We didn't expect the animation to finish yet
7945   application.SendNotification();
7946   finishCheck.CheckSignalNotReceived();
7947
7948   // The color should have changed less, than with a linear alpha function
7949   Vector4 current(actor.GetCurrentColor());
7950   DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change
7951   DALI_TEST_CHECK( current.y < 1.0f );
7952   DALI_TEST_CHECK( current.y > tenPercentProgress.y );
7953   DALI_TEST_CHECK( current.z  < 1.0f );
7954   DALI_TEST_CHECK( current.z  > tenPercentProgress.z );
7955   DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
7956
7957   application.SendNotification();
7958   application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7959
7960   // We did expect the animation to finish
7961   application.SendNotification();
7962   finishCheck.CheckSignalReceived();
7963   DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7964
7965   // Reset everything
7966   finishCheck.Reset();
7967   actor.SetColor(Color::WHITE);
7968   application.SendNotification();
7969   application.Render(0);
7970   DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7971
7972   // Repeat with a shorter animator duration
7973   float animatorDuration = 0.5f;
7974   animation = Animation::New(durationSeconds);
7975   animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
7976   animation.FinishedSignal().Connect(&application, finishCheck);
7977   animation.Play();
7978
7979   application.SendNotification();
7980   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
7981
7982   // We didn't expect the animation to finish yet
7983   application.SendNotification();
7984   finishCheck.CheckSignalNotReceived();
7985   DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION );
7986
7987   application.SendNotification();
7988   application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
7989
7990   // We didn't expect the animation to finish yet
7991   application.SendNotification();
7992   finishCheck.CheckSignalNotReceived();
7993   DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7994
7995   application.SendNotification();
7996   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7997
7998   // We did expect the animation to finish
7999   application.SendNotification();
8000   finishCheck.CheckSignalReceived();
8001   DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8002   END_TEST;
8003 }
8004
8005 int UtcDaliAnimationAnimateToActorColorRedP(void)
8006 {
8007   TestApplication application;
8008
8009   Actor actor = Actor::New();
8010   Stage::GetCurrent().Add(actor);
8011   float startValue(1.0f);
8012   DALI_TEST_EQUALS( actor.GetCurrentColor().r, startValue, TEST_LOCATION );
8013   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8014   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8015   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8016   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8017   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8018   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8019   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8020   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8021
8022   // Build the animation
8023   float durationSeconds(1.0f);
8024   Animation animation = Animation::New(durationSeconds);
8025   float targetRed(0.5f);
8026   animation.AnimateTo( Property(actor, Actor::Property::COLOR_RED), targetRed );
8027
8028   float fiftyPercentProgress(startValue + (targetRed - startValue)*0.5f);
8029
8030   // Start the animation
8031   animation.Play();
8032
8033   // Target value should be retrievable straight away
8034   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( targetRed, startValue, startValue, startValue ), TEST_LOCATION );
8035   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetRed, TEST_LOCATION );
8036
8037   bool signalReceived(false);
8038   AnimationFinishCheck finishCheck(signalReceived);
8039   animation.FinishedSignal().Connect(&application, finishCheck);
8040
8041   application.SendNotification();
8042   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8043
8044   // We didn't expect the animation to finish yet
8045   application.SendNotification();
8046   finishCheck.CheckSignalNotReceived();
8047   DALI_TEST_EQUALS( actor.GetCurrentColor().r, fiftyPercentProgress, TEST_LOCATION );
8048   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED),   fiftyPercentProgress, TEST_LOCATION );
8049   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue,           TEST_LOCATION );
8050   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE),  startValue,           TEST_LOCATION );
8051   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), startValue,           TEST_LOCATION );
8052
8053   application.SendNotification();
8054   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8055
8056   // We did expect the animation to finish
8057   application.SendNotification();
8058   finishCheck.CheckSignalReceived();
8059   DALI_TEST_EQUALS( actor.GetCurrentColor().r, targetRed, TEST_LOCATION );
8060   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED),   targetRed,  TEST_LOCATION );
8061   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8062   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8063   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8064   END_TEST;
8065 }
8066
8067 int UtcDaliAnimationAnimateToActorColorGreenP(void)
8068 {
8069   TestApplication application;
8070
8071   Actor actor = Actor::New();
8072   Stage::GetCurrent().Add(actor);
8073   float startValue(1.0f);
8074   DALI_TEST_EQUALS( actor.GetCurrentColor().g, startValue, TEST_LOCATION );
8075   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8076   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8077   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8078   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8079   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8080   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8081   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8082   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8083
8084   // Build the animation
8085   float durationSeconds(1.0f);
8086   Animation animation = Animation::New(durationSeconds);
8087   float targetGreen(0.5f);
8088   animation.AnimateTo( Property(actor, Actor::Property::COLOR_GREEN), targetGreen );
8089
8090   float fiftyPercentProgress(startValue + (targetGreen - startValue)*0.5f);
8091
8092   // Start the animation
8093   animation.Play();
8094
8095   // Target value should be retrievable straight away
8096   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, targetGreen, startValue, startValue ), TEST_LOCATION );
8097   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetGreen, TEST_LOCATION );
8098
8099   bool signalReceived(false);
8100   AnimationFinishCheck finishCheck(signalReceived);
8101   animation.FinishedSignal().Connect(&application, finishCheck);
8102
8103   application.SendNotification();
8104   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8105
8106   // We didn't expect the animation to finish yet
8107   application.SendNotification();
8108   finishCheck.CheckSignalNotReceived();
8109   DALI_TEST_EQUALS( actor.GetCurrentColor().g, fiftyPercentProgress, TEST_LOCATION );
8110   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED),   startValue,           TEST_LOCATION );
8111   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION );
8112   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE),  startValue,           TEST_LOCATION );
8113   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), startValue,           TEST_LOCATION );
8114
8115   application.SendNotification();
8116   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8117
8118   // We did expect the animation to finish
8119   application.SendNotification();
8120   finishCheck.CheckSignalReceived();
8121   DALI_TEST_EQUALS( actor.GetCurrentColor().g, targetGreen, TEST_LOCATION );
8122   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED),   startValue,  TEST_LOCATION );
8123   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION );
8124   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE),  startValue,  TEST_LOCATION );
8125   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), startValue,  TEST_LOCATION );
8126   END_TEST;
8127 }
8128
8129 int UtcDaliAnimationAnimateToActorColorBlueP(void)
8130 {
8131   TestApplication application;
8132
8133   Actor actor = Actor::New();
8134   Stage::GetCurrent().Add(actor);
8135   float startValue(1.0f);
8136   DALI_TEST_EQUALS( actor.GetCurrentColor().b, startValue, TEST_LOCATION );
8137   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8138   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8139   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8140   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8141   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8142   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8143   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8144   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8145
8146   // Build the animation
8147   float durationSeconds(1.0f);
8148   Animation animation = Animation::New(durationSeconds);
8149   float targetBlue(0.5f);
8150   animation.AnimateTo( Property(actor, Actor::Property::COLOR_BLUE), targetBlue );
8151
8152   float fiftyPercentProgress(startValue + (targetBlue - startValue)*0.5f);
8153
8154   // Start the animation
8155   animation.Play();
8156
8157   // Target value should be retrievable straight away
8158   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, targetBlue, startValue ), TEST_LOCATION );
8159   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetBlue, TEST_LOCATION );
8160
8161   bool signalReceived(false);
8162   AnimationFinishCheck finishCheck(signalReceived);
8163   animation.FinishedSignal().Connect(&application, finishCheck);
8164
8165   application.SendNotification();
8166   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8167
8168   // We didn't expect the animation to finish yet
8169   application.SendNotification();
8170   finishCheck.CheckSignalNotReceived();
8171   DALI_TEST_EQUALS( actor.GetCurrentColor().b, fiftyPercentProgress, TEST_LOCATION );
8172   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue,           TEST_LOCATION );
8173   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue,           TEST_LOCATION );
8174   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  fiftyPercentProgress, TEST_LOCATION );
8175   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue,           TEST_LOCATION );
8176
8177   application.SendNotification();
8178   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8179
8180   // We did expect the animation to finish
8181   application.SendNotification();
8182   finishCheck.CheckSignalReceived();
8183   DALI_TEST_EQUALS( actor.GetCurrentColor().b, targetBlue, TEST_LOCATION );
8184   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8185   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8186   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  targetBlue, TEST_LOCATION );
8187   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8188   END_TEST;
8189 }
8190
8191 int UtcDaliAnimationAnimateToActorColorAlphaP(void)
8192 {
8193   TestApplication application;
8194
8195   Actor actor = Actor::New();
8196   Stage::GetCurrent().Add(actor);
8197   float startValue(1.0f);
8198   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8199   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8200   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8201   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8202   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8203   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8204   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8205   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8206   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8207
8208   // Build the animation
8209   float durationSeconds(1.0f);
8210   Animation animation = Animation::New(durationSeconds);
8211   float targetAlpha(0.5f);
8212   animation.AnimateTo( Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha );
8213
8214   float fiftyPercentProgress(startValue + (targetAlpha - startValue)*0.5f);
8215
8216   // Start the animation
8217   animation.Play();
8218
8219   // Target value should be retrievable straight away
8220   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, startValue, targetAlpha ), TEST_LOCATION );
8221   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
8222   DALI_TEST_EQUALS( actor.GetProperty< float >( DevelActor::Property::OPACITY ), targetAlpha, TEST_LOCATION );
8223
8224   bool signalReceived(false);
8225   AnimationFinishCheck finishCheck(signalReceived);
8226   animation.FinishedSignal().Connect(&application, finishCheck);
8227
8228   application.SendNotification();
8229   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8230
8231   // We didn't expect the animation to finish yet
8232   application.SendNotification();
8233   finishCheck.CheckSignalNotReceived();
8234   DALI_TEST_EQUALS( actor.GetCurrentColor().a, fiftyPercentProgress, TEST_LOCATION );
8235   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue,           TEST_LOCATION );
8236   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue,           TEST_LOCATION );
8237   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue,           TEST_LOCATION );
8238   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), fiftyPercentProgress, TEST_LOCATION );
8239
8240   application.SendNotification();
8241   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8242
8243   // We did expect the animation to finish
8244   application.SendNotification();
8245   finishCheck.CheckSignalReceived();
8246   DALI_TEST_EQUALS( actor.GetCurrentColor().a, targetAlpha, TEST_LOCATION );
8247   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue,  TEST_LOCATION );
8248   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue,  TEST_LOCATION );
8249   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue,  TEST_LOCATION );
8250   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
8251   END_TEST;
8252 }
8253
8254 int UtcDaliAnimationKeyFrames01P(void)
8255 {
8256   TestApplication application;
8257
8258   KeyFrames keyFrames = KeyFrames::New();
8259   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8260
8261   keyFrames.Add(0.0f, 0.1f);
8262
8263   DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8264
8265   KeyFrames keyFrames2( keyFrames);
8266   DALI_TEST_CHECK( keyFrames2 );
8267   DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
8268
8269   KeyFrames keyFrames3 = KeyFrames::New();
8270   keyFrames3.Add(0.6f, true);
8271   DALI_TEST_CHECK( keyFrames3 );
8272   DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
8273
8274   keyFrames3 = keyFrames;
8275   DALI_TEST_CHECK( keyFrames3 );
8276   DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
8277
8278   END_TEST;
8279 }
8280
8281 int UtcDaliAnimationKeyFrames02P(void)
8282 {
8283   TestApplication application;
8284
8285   KeyFrames keyFrames = KeyFrames::New();
8286   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8287
8288   keyFrames.Add(0.0f, 0.1f);
8289   keyFrames.Add(0.2f, 0.5f);
8290   keyFrames.Add(0.4f, 0.0f);
8291   keyFrames.Add(0.6f, 1.0f);
8292   keyFrames.Add(0.8f, 0.7f);
8293   keyFrames.Add(1.0f, 0.9f);
8294
8295   DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8296
8297   try
8298   {
8299     keyFrames.Add(1.9f, false);
8300   }
8301   catch (Dali::DaliException& e)
8302   {
8303     DALI_TEST_PRINT_ASSERT( e );
8304     DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8305   }
8306   END_TEST;
8307 }
8308
8309 int UtcDaliAnimationKeyFrames03P(void)
8310 {
8311   TestApplication application;
8312
8313   KeyFrames keyFrames = KeyFrames::New();
8314   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8315
8316   keyFrames.Add(0.0f, true);
8317   keyFrames.Add(0.2f, false);
8318   keyFrames.Add(0.4f, false);
8319   keyFrames.Add(0.6f, true);
8320   keyFrames.Add(0.8f, true);
8321   keyFrames.Add(1.0f, false);
8322
8323   DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
8324
8325   try
8326   {
8327     keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8328   }
8329   catch (Dali::DaliException& e)
8330   {
8331     DALI_TEST_PRINT_ASSERT( e );
8332     DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8333   }
8334   END_TEST;
8335 }
8336
8337 int UtcDaliAnimationKeyFrames04P(void)
8338 {
8339   TestApplication application;
8340
8341   KeyFrames keyFrames = KeyFrames::New();
8342   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8343
8344   keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
8345   keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
8346   keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
8347   keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
8348   keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
8349   keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
8350
8351   DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
8352
8353   try
8354   {
8355     keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8356   }
8357   catch (Dali::DaliException& e)
8358   {
8359     DALI_TEST_PRINT_ASSERT( e );
8360     DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8361   }
8362   END_TEST;
8363 }
8364
8365 int UtcDaliAnimationKeyFrames05P(void)
8366 {
8367   TestApplication application;
8368
8369   KeyFrames keyFrames = KeyFrames::New();
8370   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8371
8372   keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
8373   keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
8374   keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
8375   keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
8376   keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
8377   keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
8378
8379   DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
8380
8381   try
8382   {
8383     keyFrames.Add(0.7f, 1.0f);
8384   }
8385   catch (Dali::DaliException& e)
8386   {
8387     DALI_TEST_PRINT_ASSERT( e );
8388     DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8389   }
8390   END_TEST;
8391 }
8392
8393 int UtcDaliAnimationKeyFrames06P(void)
8394 {
8395   TestApplication application;
8396
8397   KeyFrames keyFrames = KeyFrames::New();
8398   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8399
8400   keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
8401   keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8402   keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
8403   keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
8404   keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
8405   keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
8406
8407   DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
8408
8409   try
8410   {
8411     keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
8412   }
8413   catch (Dali::DaliException& e)
8414   {
8415     DALI_TEST_PRINT_ASSERT( e );
8416     DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8417   }
8418   END_TEST;
8419 }
8420
8421 int UtcDaliAnimationKeyFrames07P(void)
8422 {
8423   TestApplication application;
8424
8425   KeyFrames keyFrames = KeyFrames::New();
8426   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8427
8428   keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
8429   keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
8430   keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
8431   keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
8432   keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
8433   keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
8434
8435   DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
8436
8437   try
8438   {
8439     keyFrames.Add(0.7f, 1.1f);
8440   }
8441   catch (Dali::DaliException& e)
8442   {
8443     DALI_TEST_PRINT_ASSERT( e );
8444     DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8445   }
8446   END_TEST;
8447 }
8448
8449 int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
8450 {
8451   TestApplication application;
8452
8453   float startValue(1.0f);
8454   Actor actor = Actor::New();
8455   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8456   Stage::GetCurrent().Add(actor);
8457
8458   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8459   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8460   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8461   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8462   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8463   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8464   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8465   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8466   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8467
8468   // Build the animation
8469   float durationSeconds(1.0f);
8470   Animation animation = Animation::New(durationSeconds);
8471
8472   KeyFrames keyFrames = KeyFrames::New();
8473   keyFrames.Add(0.0f, 0.1f);
8474   keyFrames.Add(0.2f, 0.5f);
8475   keyFrames.Add(0.4f, 0.0f);
8476   keyFrames.Add(0.6f, 1.0f);
8477   keyFrames.Add(0.8f, 0.7f);
8478   keyFrames.Add(1.0f, 0.9f);
8479
8480   animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames );
8481
8482   // Start the animation
8483   animation.Play();
8484
8485   // Final key frame value should be retrievable straight away
8486   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), 0.9f, TEST_LOCATION );
8487
8488   bool signalReceived(false);
8489   AnimationFinishCheck finishCheck(signalReceived);
8490   animation.FinishedSignal().Connect(&application, finishCheck);
8491   application.SendNotification();
8492   application.Render(0);
8493   application.SendNotification();
8494   finishCheck.CheckSignalNotReceived();
8495   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
8496
8497   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8498   application.SendNotification();
8499   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8500   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8501   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8502   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION );
8503   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.3f, 0.01f, TEST_LOCATION );
8504
8505   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
8506   application.SendNotification();
8507   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8508   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8509   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8510   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION );
8511   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.25f, 0.01f, TEST_LOCATION );
8512
8513   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
8514   application.SendNotification();
8515   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8516   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8517   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8518   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
8519   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
8520
8521   application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
8522   application.SendNotification();
8523   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8524   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8525   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8526   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
8527   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
8528
8529   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
8530   application.SendNotification();
8531   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8532   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8533   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8534   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION );
8535   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.8f, 0.01f, TEST_LOCATION );
8536
8537   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
8538   application.SendNotification();
8539   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8540   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8541   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8542   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
8543   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
8544
8545   // We did expect the animation to finish
8546
8547   finishCheck.CheckSignalReceived();
8548   END_TEST;
8549 }
8550
8551 int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
8552 {
8553   TestApplication application;
8554
8555   float startValue(1.0f);
8556   Actor actor = Actor::New();
8557   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8558   Stage::GetCurrent().Add(actor);
8559
8560   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8561   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8562   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8563   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8564   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8565   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8566   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8567   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8568   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8569
8570   // Build the animation
8571   float durationSeconds(1.0f);
8572   Animation animation = Animation::New(durationSeconds);
8573
8574   KeyFrames keyFrames = KeyFrames::New();
8575   keyFrames.Add(0.0f, 0.1f);
8576   keyFrames.Add(0.2f, 0.5f);
8577   keyFrames.Add(0.4f, 0.0f);
8578   keyFrames.Add(0.6f, 1.0f);
8579   keyFrames.Add(0.8f, 0.7f);
8580   keyFrames.Add(1.0f, 0.9f);
8581
8582   animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::Cubic );
8583
8584   // Start the animation
8585   animation.Play();
8586
8587   bool signalReceived(false);
8588   AnimationFinishCheck finishCheck(signalReceived);
8589   animation.FinishedSignal().Connect(&application, finishCheck);
8590   application.SendNotification();
8591   application.Render(0);
8592   application.SendNotification();
8593   finishCheck.CheckSignalNotReceived();
8594   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
8595
8596   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8597   application.SendNotification();
8598   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8599   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8600   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8601   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.36f, 0.01f, TEST_LOCATION );
8602   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.36f, 0.01f, TEST_LOCATION );
8603
8604   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
8605   application.SendNotification();
8606   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8607   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8608   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8609   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.21f, 0.01f, TEST_LOCATION );
8610   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.21f, 0.01f, TEST_LOCATION );
8611
8612   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
8613   application.SendNotification();
8614   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8615   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8616   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8617   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.0f, 0.01f, TEST_LOCATION );
8618   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
8619
8620   application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
8621   application.SendNotification();
8622   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8623   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8624   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8625   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.7f, 0.01f, TEST_LOCATION );
8626   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
8627
8628   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
8629   application.SendNotification();
8630   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8631   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8632   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8633   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.76f, 0.01f, TEST_LOCATION );
8634   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.76f, 0.01f, TEST_LOCATION );
8635
8636   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
8637   application.SendNotification();
8638   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8639   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8640   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8641   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.9f, 0.01f, TEST_LOCATION );
8642   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
8643
8644   // We did expect the animation to finish
8645
8646   finishCheck.CheckSignalReceived();
8647   END_TEST;
8648 }
8649
8650 int UtcDaliAnimationAnimateBetweenActorColorP(void)
8651 {
8652   TestApplication application;
8653
8654   float startValue(1.0f);
8655   Actor actor = Actor::New();
8656   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8657   Stage::GetCurrent().Add(actor);
8658
8659   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8660   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8661   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8662   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8663   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8664   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8665   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8666   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8667   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8668
8669   // Build the animation
8670   float durationSeconds(1.0f);
8671   Animation animation = Animation::New(durationSeconds);
8672
8673   KeyFrames keyFrames = KeyFrames::New();
8674   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8675   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8676   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8677
8678   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames );
8679
8680   // Start the animation
8681   animation.Play();
8682
8683   bool signalReceived(false);
8684   AnimationFinishCheck finishCheck(signalReceived);
8685   animation.FinishedSignal().Connect(&application, finishCheck);
8686   application.SendNotification();
8687   application.Render(0);
8688   application.SendNotification();
8689   finishCheck.CheckSignalNotReceived();
8690   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
8691   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
8692   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
8693   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
8694
8695   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8696   application.SendNotification();
8697   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.5f, 0.01f, TEST_LOCATION );
8698   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
8699   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.5f, 0.01f, TEST_LOCATION );
8700   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
8701
8702   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8703   application.SendNotification();
8704   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
8705   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
8706   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
8707   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
8708
8709   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8710   application.SendNotification();
8711   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.95f, 0.01f, TEST_LOCATION );
8712   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
8713   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.85f, 0.01f, TEST_LOCATION );
8714   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
8715
8716   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8717   application.SendNotification();
8718   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
8719   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
8720   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
8721   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
8722
8723   // We did expect the animation to finish
8724
8725   finishCheck.CheckSignalReceived();
8726   END_TEST;
8727 }
8728
8729 int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
8730 {
8731   TestApplication application;
8732
8733   float startValue(1.0f);
8734   Actor actor = Actor::New();
8735   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8736   Stage::GetCurrent().Add(actor);
8737
8738   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8739   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8740   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8741   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8742   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8743   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8744   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8745   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8746   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8747
8748   // Build the animation
8749   float durationSeconds(1.0f);
8750   Animation animation = Animation::New(durationSeconds);
8751
8752   KeyFrames keyFrames = KeyFrames::New();
8753   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8754   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8755   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8756
8757   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, Animation::Cubic );
8758
8759   // Start the animation
8760   animation.Play();
8761
8762   bool signalReceived(false);
8763   AnimationFinishCheck finishCheck(signalReceived);
8764   animation.FinishedSignal().Connect(&application, finishCheck);
8765   application.SendNotification();
8766   application.Render(0);
8767   application.SendNotification();
8768   finishCheck.CheckSignalNotReceived();
8769   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
8770   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
8771   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
8772   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
8773
8774   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8775   application.SendNotification();
8776   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.55f, 0.01f, TEST_LOCATION );
8777   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
8778   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.506f, 0.01f, TEST_LOCATION );
8779   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
8780
8781   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8782   application.SendNotification();
8783   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
8784   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
8785   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
8786   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
8787
8788   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8789   application.SendNotification();
8790   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.99375f, 0.01f, TEST_LOCATION );
8791   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
8792   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.85625f, 0.01f, TEST_LOCATION );
8793   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
8794
8795   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8796   application.SendNotification();
8797   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
8798   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
8799   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
8800   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
8801
8802   // We did expect the animation to finish
8803
8804   finishCheck.CheckSignalReceived();
8805   END_TEST;
8806 }
8807
8808 int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
8809 {
8810   TestApplication application;
8811
8812   Actor actor = Actor::New();
8813   AngleAxis aa(Degree(90), Vector3::XAXIS);
8814   actor.SetOrientation(aa.angle, aa.axis);
8815   Stage::GetCurrent().Add(actor);
8816
8817   application.SendNotification();
8818   application.Render(0);
8819
8820   DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
8821
8822   // Build the animation
8823   float durationSeconds(1.0f);
8824   Animation animation = Animation::New(durationSeconds);
8825
8826   KeyFrames keyFrames = KeyFrames::New();
8827   keyFrames.Add(0.0f, false);
8828   keyFrames.Add(0.2f, true);
8829   keyFrames.Add(0.4f, true);
8830   keyFrames.Add(0.8f, false);
8831   keyFrames.Add(1.0f, true);
8832
8833   animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames );
8834
8835   // Start the animation
8836   animation.Play();
8837
8838   bool signalReceived(false);
8839   AnimationFinishCheck finishCheck(signalReceived);
8840   animation.FinishedSignal().Connect(&application, finishCheck);
8841   application.SendNotification();
8842   application.SendNotification();
8843   application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8844   application.SendNotification();
8845   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8846   application.SendNotification();
8847
8848   DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
8849   finishCheck.CheckSignalReceived();
8850   END_TEST;
8851 }
8852
8853 int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
8854 {
8855   TestApplication application;
8856
8857   Actor actor = Actor::New();
8858   AngleAxis aa(Degree(90), Vector3::XAXIS);
8859   actor.SetOrientation(aa.angle, aa.axis);
8860   Stage::GetCurrent().Add(actor);
8861
8862   application.SendNotification();
8863   application.Render(0);
8864
8865   DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
8866
8867   // Build the animation
8868   float durationSeconds(1.0f);
8869   Animation animation = Animation::New(durationSeconds);
8870
8871   KeyFrames keyFrames = KeyFrames::New();
8872   keyFrames.Add(0.0f, false);
8873   keyFrames.Add(0.2f, true);
8874   keyFrames.Add(0.4f, true);
8875   keyFrames.Add(0.8f, false);
8876   keyFrames.Add(1.0f, true);
8877
8878   //Cubic interpolation for boolean values should be ignored
8879   animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::Cubic );
8880
8881   // Start the animation
8882   animation.Play();
8883
8884   bool signalReceived(false);
8885   AnimationFinishCheck finishCheck(signalReceived);
8886   animation.FinishedSignal().Connect(&application, finishCheck);
8887   application.SendNotification();
8888   application.SendNotification();
8889   application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8890   application.SendNotification();
8891   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8892   application.SendNotification();
8893
8894   DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
8895   finishCheck.CheckSignalReceived();
8896   END_TEST;
8897 }
8898
8899 int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
8900 {
8901   TestApplication application;
8902
8903   Actor actor = Actor::New();
8904   AngleAxis aa(Degree(90), Vector3::XAXIS);
8905   actor.SetOrientation(aa.angle, aa.axis);
8906   Stage::GetCurrent().Add(actor);
8907
8908   application.SendNotification();
8909   application.Render(0);
8910   Quaternion start(Radian(aa.angle), aa.axis);
8911   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8912
8913   // Build the animation
8914   float durationSeconds(1.0f);
8915   Animation animation = Animation::New(durationSeconds);
8916
8917   KeyFrames keyFrames = KeyFrames::New();
8918   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
8919
8920   animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
8921
8922   // Start the animation
8923   animation.Play();
8924
8925   bool signalReceived(false);
8926   AnimationFinishCheck finishCheck(signalReceived);
8927   animation.FinishedSignal().Connect(&application, finishCheck);
8928   application.SendNotification();
8929   application.SendNotification();
8930   application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8931   application.SendNotification();
8932   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8933   application.SendNotification();
8934
8935   Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
8936
8937   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8938   finishCheck.CheckSignalReceived();
8939   END_TEST;
8940 }
8941
8942 int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
8943 {
8944   TestApplication application;
8945
8946   Actor actor = Actor::New();
8947   AngleAxis aa(Degree(90), Vector3::XAXIS);
8948   actor.SetOrientation(aa.angle, aa.axis);
8949   application.SendNotification();
8950   application.Render(0);
8951   Stage::GetCurrent().Add(actor);
8952
8953   Quaternion start(Radian(aa.angle), aa.axis);
8954   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8955
8956   // Build the animation
8957   float durationSeconds(1.0f);
8958   Animation animation = Animation::New(durationSeconds);
8959
8960   KeyFrames keyFrames = KeyFrames::New();
8961   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
8962   keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
8963   keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
8964
8965   animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
8966
8967   // Start the animation
8968   animation.Play();
8969
8970   bool signalReceived(false);
8971   AnimationFinishCheck finishCheck(signalReceived);
8972   animation.FinishedSignal().Connect(&application, finishCheck);
8973   application.SendNotification();
8974   application.Render(0);
8975   application.SendNotification();
8976   finishCheck.CheckSignalNotReceived();
8977
8978   Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
8979   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8980
8981   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8982   application.SendNotification();
8983   check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
8984   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8985
8986   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8987   application.SendNotification();
8988   check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
8989   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8990
8991   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8992   application.SendNotification();
8993   check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f) );
8994   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8995
8996   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8997   application.SendNotification();
8998   check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
8999   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9000
9001   // We did expect the animation to finish
9002
9003   finishCheck.CheckSignalReceived();
9004   END_TEST;
9005 }
9006
9007 int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
9008 {
9009   TestApplication application;
9010
9011   Actor actor = Actor::New();
9012   AngleAxis aa(Degree(90), Vector3::XAXIS);
9013   actor.SetOrientation(aa.angle, aa.axis);
9014   Stage::GetCurrent().Add(actor);
9015
9016   application.SendNotification();
9017   application.Render(0);
9018   Quaternion start(Radian(aa.angle), aa.axis);
9019   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
9020
9021   // Build the animation
9022   float durationSeconds(1.0f);
9023   Animation animation = Animation::New(durationSeconds);
9024
9025   KeyFrames keyFrames = KeyFrames::New();
9026   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9027
9028   //Cubic interpolation should be ignored for quaternions
9029   animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
9030
9031   // Start the animation
9032   animation.Play();
9033
9034   bool signalReceived(false);
9035   AnimationFinishCheck finishCheck(signalReceived);
9036   animation.FinishedSignal().Connect(&application, finishCheck);
9037   application.SendNotification();
9038   application.SendNotification();
9039   application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9040   application.SendNotification();
9041   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9042   application.SendNotification();
9043
9044   Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
9045
9046   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9047   finishCheck.CheckSignalReceived();
9048   END_TEST;
9049 }
9050
9051 int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
9052 {
9053   TestApplication application;
9054
9055   Actor actor = Actor::New();
9056   AngleAxis aa(Degree(90), Vector3::XAXIS);
9057   actor.SetOrientation(aa.angle, aa.axis);
9058   application.SendNotification();
9059   application.Render(0);
9060   Stage::GetCurrent().Add(actor);
9061
9062   Quaternion start(Radian(aa.angle), aa.axis);
9063   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
9064
9065   // Build the animation
9066   float durationSeconds(1.0f);
9067   Animation animation = Animation::New(durationSeconds);
9068
9069   KeyFrames keyFrames = KeyFrames::New();
9070   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9071   keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9072   keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9073
9074   //Cubic interpolation should be ignored for quaternions
9075   animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
9076
9077   // Start the animation
9078   animation.Play();
9079
9080   bool signalReceived(false);
9081   AnimationFinishCheck finishCheck(signalReceived);
9082   animation.FinishedSignal().Connect(&application, finishCheck);
9083   application.SendNotification();
9084   application.Render(0);
9085   application.SendNotification();
9086   finishCheck.CheckSignalNotReceived();
9087
9088   Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9089   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9090
9091   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9092   application.SendNotification();
9093   check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
9094   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9095
9096   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9097   application.SendNotification();
9098   check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
9099   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9100
9101   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9102   application.SendNotification();
9103   check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f ) );
9104   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9105
9106   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9107   application.SendNotification();
9108   check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
9109   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9110
9111   // We did expect the animation to finish
9112
9113   finishCheck.CheckSignalReceived();
9114   END_TEST;
9115 }
9116
9117 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
9118 {
9119   TestApplication application;
9120
9121   float startValue(1.0f);
9122   Actor actor = Actor::New();
9123   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9124   Stage::GetCurrent().Add(actor);
9125
9126   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9127   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9128   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9129   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9130   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9131   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9132   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9133   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9134   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9135
9136   // Build the animation
9137   float durationSeconds(1.0f);
9138   Animation animation = Animation::New(durationSeconds);
9139
9140   KeyFrames keyFrames = KeyFrames::New();
9141   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9142   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9143   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9144
9145   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR );
9146
9147   // Start the animation
9148   animation.Play();
9149
9150   bool signalReceived(false);
9151   AnimationFinishCheck finishCheck(signalReceived);
9152   animation.FinishedSignal().Connect(&application, finishCheck);
9153   application.SendNotification();
9154   application.Render(0);
9155   application.SendNotification();
9156   finishCheck.CheckSignalNotReceived();
9157   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
9158   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9159   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
9160   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9161
9162   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9163   application.SendNotification();
9164   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.5f, 0.01f, TEST_LOCATION );
9165   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9166   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.5f, 0.01f, TEST_LOCATION );
9167   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9168
9169   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9170   application.SendNotification();
9171   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
9172   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9173   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
9174   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9175
9176   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9177   application.SendNotification();
9178   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.95f, 0.01f, TEST_LOCATION );
9179   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9180   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.85f, 0.01f, TEST_LOCATION );
9181   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9182
9183   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9184   application.SendNotification();
9185   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
9186   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9187   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
9188   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9189
9190   // We did expect the animation to finish
9191
9192   finishCheck.CheckSignalReceived();
9193   END_TEST;
9194 }
9195
9196 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
9197 {
9198   TestApplication application;
9199
9200   float startValue(1.0f);
9201   Actor actor = Actor::New();
9202   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9203   Stage::GetCurrent().Add(actor);
9204
9205   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9206   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9207   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9208   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9209   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9210   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9211   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9212   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9213   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9214
9215   // Build the animation
9216   float durationSeconds(1.0f);
9217   Animation animation = Animation::New(durationSeconds);
9218
9219   KeyFrames keyFrames = KeyFrames::New();
9220   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9221   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9222   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9223
9224   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::Cubic );
9225
9226   // Start the animation
9227   animation.Play();
9228
9229   bool signalReceived(false);
9230   AnimationFinishCheck finishCheck(signalReceived);
9231   animation.FinishedSignal().Connect(&application, finishCheck);
9232   application.SendNotification();
9233   application.Render(0);
9234   application.SendNotification();
9235   finishCheck.CheckSignalNotReceived();
9236   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
9237   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9238   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
9239   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9240
9241   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9242   application.SendNotification();
9243   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.55f, 0.01f, TEST_LOCATION );
9244   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9245   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.506f, 0.01f, TEST_LOCATION );
9246   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9247
9248   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9249   application.SendNotification();
9250   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
9251   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9252   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
9253   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9254
9255   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9256   application.SendNotification();
9257   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.99375f, 0.01f, TEST_LOCATION );
9258   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9259   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.85625f, 0.01f, TEST_LOCATION );
9260   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9261
9262   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9263   application.SendNotification();
9264   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
9265   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9266   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
9267   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9268
9269   // We did expect the animation to finish
9270
9271   finishCheck.CheckSignalReceived();
9272   END_TEST;
9273 }
9274
9275 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void)
9276 {
9277   TestApplication application;
9278
9279   float startValue(1.0f);
9280   Actor actor = Actor::New();
9281   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9282   Stage::GetCurrent().Add(actor);
9283
9284   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9285   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9286   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9287   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9288   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9289   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9290   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9291   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9292   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9293
9294   // Build the animation
9295   float durationSeconds(1.0f);
9296   float delay = 0.5f;
9297   Animation animation = Animation::New(durationSeconds);
9298
9299   KeyFrames keyFrames = KeyFrames::New();
9300   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9301   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9302   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9303
9304   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ) );
9305
9306   // Start the animation
9307   animation.Play();
9308
9309   bool signalReceived(false);
9310   AnimationFinishCheck finishCheck(signalReceived);
9311   animation.FinishedSignal().Connect(&application, finishCheck);
9312   application.SendNotification();
9313
9314   application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9315   application.SendNotification();
9316   finishCheck.CheckSignalNotReceived();
9317   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
9318   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9319   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
9320   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9321
9322   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9323   application.SendNotification();
9324   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.5f, 0.01f, TEST_LOCATION );
9325   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9326   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.5f, 0.01f, TEST_LOCATION );
9327   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9328
9329   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9330   application.SendNotification();
9331   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
9332   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9333   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
9334   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9335
9336   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9337   application.SendNotification();
9338   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.95f, 0.01f, TEST_LOCATION );
9339   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9340   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.85f, 0.01f, TEST_LOCATION );
9341   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9342
9343   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9344   application.SendNotification();
9345   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
9346   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9347   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
9348   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9349
9350   // We did expect the animation to finish
9351
9352   finishCheck.CheckSignalReceived();
9353   END_TEST;
9354 }
9355
9356 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
9357 {
9358   TestApplication application;
9359
9360   float startValue(1.0f);
9361   Actor actor = Actor::New();
9362   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9363   Stage::GetCurrent().Add(actor);
9364
9365   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9366   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9367   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9368   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9369   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9370   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9371   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9372   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9373   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9374
9375   // Build the animation
9376   float durationSeconds(1.0f);
9377   float delay = 0.5f;
9378   Animation animation = Animation::New(durationSeconds);
9379
9380   KeyFrames keyFrames = KeyFrames::New();
9381   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9382   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9383   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9384
9385   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
9386
9387   // Start the animation
9388   animation.Play();
9389
9390   bool signalReceived(false);
9391   AnimationFinishCheck finishCheck(signalReceived);
9392   animation.FinishedSignal().Connect(&application, finishCheck);
9393   application.SendNotification();
9394
9395   application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9396   application.SendNotification();
9397   finishCheck.CheckSignalNotReceived();
9398   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
9399   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9400   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
9401   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9402
9403   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9404   application.SendNotification();
9405   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.55f, 0.01f, TEST_LOCATION );
9406   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9407   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.506f, 0.01f, TEST_LOCATION );
9408   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9409
9410   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9411   application.SendNotification();
9412   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
9413   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
9414   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
9415   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9416
9417   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9418   application.SendNotification();
9419   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.99375f, 0.01f, TEST_LOCATION );
9420   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9421   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.85625f, 0.01f, TEST_LOCATION );
9422   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9423
9424   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9425   application.SendNotification();
9426   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
9427   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9428   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
9429   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9430
9431   // We did expect the animation to finish
9432
9433   finishCheck.CheckSignalReceived();
9434   END_TEST;
9435 }
9436
9437 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
9438 {
9439   TestApplication application;
9440
9441   float startValue(1.0f);
9442   float delay = 0.5f;
9443   Actor actor = Actor::New();
9444   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9445   Stage::GetCurrent().Add(actor);
9446
9447   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9448   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9449   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9450   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9451   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9452   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9453   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9454   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9455   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9456
9457   // Build the animation
9458   float durationSeconds(1.0f);
9459   Animation animation = Animation::New(durationSeconds);
9460
9461   KeyFrames keyFrames = KeyFrames::New();
9462   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9463   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9464   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9465
9466   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
9467
9468   // Start the animation
9469   animation.Play();
9470
9471   bool signalReceived(false);
9472   AnimationFinishCheck finishCheck(signalReceived);
9473   animation.FinishedSignal().Connect(&application, finishCheck);
9474   application.SendNotification();
9475
9476   application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9477   application.SendNotification();
9478   finishCheck.CheckSignalNotReceived();
9479   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
9480   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9481   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
9482   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9483
9484   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9485   application.SendNotification();
9486   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.5f, 0.01f, TEST_LOCATION );
9487   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9488   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.5f, 0.01f, TEST_LOCATION );
9489   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9490
9491   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9492   application.SendNotification();
9493   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
9494   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9495   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
9496   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9497
9498   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9499   application.SendNotification();
9500   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.95f, 0.01f, TEST_LOCATION );
9501   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9502   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.85f, 0.01f, TEST_LOCATION );
9503   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9504
9505   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9506   application.SendNotification();
9507   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
9508   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9509   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
9510   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9511
9512   // We did expect the animation to finish
9513
9514   finishCheck.CheckSignalReceived();
9515   END_TEST;
9516 }
9517
9518 int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void)
9519 {
9520   TestApplication application;
9521
9522   float startValue(1.0f);
9523   Actor actor = Actor::New();
9524   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9525   Stage::GetCurrent().Add(actor);
9526
9527   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9528   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9529   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9530   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9531   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9532   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9533   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9534   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9535   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9536
9537
9538   // Build the animation
9539   float durationSeconds(1.0f);
9540   float delay = 0.5f;
9541   Animation animation = Animation::New(durationSeconds);
9542
9543   KeyFrames keyFrames = KeyFrames::New();
9544   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9545   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9546   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9547
9548   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
9549
9550   // Start the animation
9551   animation.Play();
9552
9553   bool signalReceived(false);
9554   AnimationFinishCheck finishCheck(signalReceived);
9555   animation.FinishedSignal().Connect(&application, finishCheck);
9556   application.SendNotification();
9557
9558   application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9559   application.SendNotification();
9560   finishCheck.CheckSignalNotReceived();
9561   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
9562   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9563   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
9564   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9565
9566   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9567   application.SendNotification();
9568   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.55f, 0.01f, TEST_LOCATION );
9569   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9570   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.506f, 0.01f, TEST_LOCATION );
9571   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9572
9573   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9574   application.SendNotification();
9575   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
9576   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9577   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
9578   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9579
9580   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9581   application.SendNotification();
9582   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.99375f, 0.01f, TEST_LOCATION );
9583   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9584   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.85625f, 0.01f, TEST_LOCATION );
9585   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9586
9587   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9588   application.SendNotification();
9589   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
9590   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9591   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
9592   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9593
9594   // We did expect the animation to finish
9595
9596   finishCheck.CheckSignalReceived();
9597   END_TEST;
9598 }
9599
9600 int UtcDaliAnimationAnimateP(void)
9601 {
9602   TestApplication application;
9603
9604   Actor actor = Actor::New();
9605   Stage::GetCurrent().Add(actor);
9606
9607   //Build the path
9608   Vector3 position0( 30.0,  80.0,  0.0);
9609   Vector3 position1( 70.0,  120.0, 0.0);
9610   Vector3 position2( 100.0, 100.0, 0.0);
9611
9612   Dali::Path path = Dali::Path::New();
9613   path.AddPoint(position0);
9614   path.AddPoint(position1);
9615   path.AddPoint(position2);
9616
9617   //Control points for first segment
9618   path.AddControlPoint( Vector3( 39.0,  90.0, 0.0) );
9619   path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9620
9621   //Control points for second segment
9622   path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9623   path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9624
9625   // Build the animation
9626   float durationSeconds( 1.0f );
9627   Animation animation = Animation::New(durationSeconds);
9628   animation.Animate(actor, path, Vector3::XAXIS);
9629
9630   // Start the animation
9631   animation.Play();
9632
9633   bool signalReceived(false);
9634   AnimationFinishCheck finishCheck(signalReceived);
9635   animation.FinishedSignal().Connect(&application, finishCheck);
9636   application.SendNotification();
9637   application.Render(0);
9638   application.SendNotification();
9639   finishCheck.CheckSignalNotReceived();
9640   Vector3 position, tangent;
9641   Quaternion rotation;
9642   path.Sample( 0.0f, position, tangent );
9643   rotation = Quaternion( Vector3::XAXIS, tangent );
9644   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9645   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9646
9647   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9648   application.SendNotification();
9649   path.Sample( 0.25f, position, tangent );
9650   rotation = Quaternion( Vector3::XAXIS, tangent );
9651   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9652   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9653
9654   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9655   application.SendNotification();
9656   path.Sample( 0.5f, position, tangent );
9657   rotation = Quaternion( Vector3::XAXIS, tangent );
9658   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9659   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9660
9661   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9662   application.SendNotification();
9663   path.Sample( 0.75f, position, tangent );
9664   rotation = Quaternion( Vector3::XAXIS, tangent );
9665   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9666   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9667
9668   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9669   application.SendNotification();
9670   path.Sample( 1.0f, position, tangent );
9671   rotation = Quaternion( Vector3::XAXIS, tangent );
9672   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9673   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9674
9675   finishCheck.CheckSignalReceived();
9676   END_TEST;
9677 }
9678
9679 int UtcDaliAnimationAnimateAlphaFunctionP(void)
9680 {
9681   TestApplication application;
9682
9683   Actor actor = Actor::New();
9684   Stage::GetCurrent().Add(actor);
9685
9686   //Build the path
9687   Vector3 position0( 30.0,  80.0,  0.0);
9688   Vector3 position1( 70.0,  120.0, 0.0);
9689   Vector3 position2( 100.0, 100.0, 0.0);
9690
9691   Dali::Path path = Dali::Path::New();
9692   path.AddPoint(position0);
9693   path.AddPoint(position1);
9694   path.AddPoint(position2);
9695
9696   //Control points for first segment
9697   path.AddControlPoint( Vector3( 39.0,  90.0, 0.0) );
9698   path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9699
9700   //Control points for second segment
9701   path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9702   path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9703
9704   // Build the animation
9705   float durationSeconds( 1.0f );
9706   Animation animation = Animation::New(durationSeconds);
9707   animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
9708
9709   // Start the animation
9710   animation.Play();
9711
9712   bool signalReceived(false);
9713   AnimationFinishCheck finishCheck(signalReceived);
9714   animation.FinishedSignal().Connect(&application, finishCheck);
9715   application.SendNotification();
9716   application.Render(0);
9717   application.SendNotification();
9718   finishCheck.CheckSignalNotReceived();
9719   Vector3 position, tangent;
9720   Quaternion rotation;
9721   path.Sample( 0.0f, position, tangent );
9722   rotation = Quaternion( Vector3::XAXIS, tangent );
9723   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9724   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9725
9726   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9727   application.SendNotification();
9728   path.Sample( 0.25f, position, tangent );
9729   rotation = Quaternion( Vector3::XAXIS, tangent );
9730   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9731   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9732
9733   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9734   application.SendNotification();
9735   path.Sample( 0.5f, position, tangent );
9736   rotation = Quaternion( Vector3::XAXIS, tangent );
9737   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9738   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9739
9740   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9741   application.SendNotification();
9742   path.Sample( 0.75f, position, tangent );
9743   rotation = Quaternion( Vector3::XAXIS, tangent );
9744   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9745   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9746
9747   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9748   application.SendNotification();
9749   path.Sample( 1.0f, position, tangent );
9750   rotation = Quaternion( Vector3::XAXIS, tangent );
9751   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9752   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9753
9754   finishCheck.CheckSignalReceived();
9755   END_TEST;
9756 }
9757
9758 int UtcDaliAnimationAnimateTimePeriodP(void)
9759 {
9760   TestApplication application;
9761
9762   Actor actor = Actor::New();
9763   Stage::GetCurrent().Add(actor);
9764
9765   //Build the path
9766   Vector3 position0( 30.0,  80.0,  0.0);
9767   Vector3 position1( 70.0,  120.0, 0.0);
9768   Vector3 position2( 100.0, 100.0, 0.0);
9769
9770   Dali::Path path = Dali::Path::New();
9771   path.AddPoint(position0);
9772   path.AddPoint(position1);
9773   path.AddPoint(position2);
9774
9775   //Control points for first segment
9776   path.AddControlPoint( Vector3( 39.0,  90.0, 0.0) );
9777   path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9778
9779   //Control points for second segment
9780   path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9781   path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9782
9783   // Build the animation
9784   float durationSeconds( 1.0f );
9785   Animation animation = Animation::New(durationSeconds);
9786   animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
9787
9788   // Start the animation
9789   animation.Play();
9790
9791   bool signalReceived(false);
9792   AnimationFinishCheck finishCheck(signalReceived);
9793   animation.FinishedSignal().Connect(&application, finishCheck);
9794   application.SendNotification();
9795   application.Render(0);
9796   application.SendNotification();
9797   finishCheck.CheckSignalNotReceived();
9798   Vector3 position, tangent;
9799   Quaternion rotation;
9800   path.Sample( 0.0f, position, tangent );
9801   rotation = Quaternion( Vector3::XAXIS, tangent );
9802   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9803   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9804
9805   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9806   application.SendNotification();
9807   path.Sample( 0.25f, position, tangent );
9808   rotation = Quaternion( Vector3::XAXIS, tangent );
9809   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9810   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9811
9812   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9813   application.SendNotification();
9814   path.Sample( 0.5f, position, tangent );
9815   rotation = Quaternion( Vector3::XAXIS, tangent );
9816   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9817   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9818
9819   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9820   application.SendNotification();
9821   path.Sample( 0.75f, position, tangent );
9822   rotation = Quaternion( Vector3::XAXIS, tangent );
9823   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9824   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9825
9826   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9827   application.SendNotification();
9828   path.Sample( 1.0f, position, tangent );
9829   rotation = Quaternion( Vector3::XAXIS, tangent );
9830   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9831   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9832
9833   finishCheck.CheckSignalReceived();
9834   END_TEST;
9835 }
9836
9837 int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
9838 {
9839   TestApplication application;
9840
9841   Actor actor = Actor::New();
9842   Stage::GetCurrent().Add(actor);
9843
9844   //Build the path
9845   Vector3 position0( 30.0,  80.0,  0.0);
9846   Vector3 position1( 70.0,  120.0, 0.0);
9847   Vector3 position2( 100.0, 100.0, 0.0);
9848
9849   Dali::Path path = Dali::Path::New();
9850   path.AddPoint(position0);
9851   path.AddPoint(position1);
9852   path.AddPoint(position2);
9853
9854   //Control points for first segment
9855   path.AddControlPoint( Vector3( 39.0,  90.0, 0.0) );
9856   path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9857
9858   //Control points for second segment
9859   path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9860   path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9861
9862   // Build the animation
9863   float durationSeconds( 1.0f );
9864   Animation animation = Animation::New(durationSeconds);
9865   animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
9866
9867   // Start the animation
9868   animation.Play();
9869
9870   bool signalReceived(false);
9871   AnimationFinishCheck finishCheck(signalReceived);
9872   animation.FinishedSignal().Connect(&application, finishCheck);
9873   application.SendNotification();
9874   application.Render(0);
9875   application.SendNotification();
9876   finishCheck.CheckSignalNotReceived();
9877   Vector3 position, tangent;
9878   Quaternion rotation;
9879   path.Sample( 0.0f, position, tangent );
9880   rotation = Quaternion( Vector3::XAXIS, tangent );
9881   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9882   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9883
9884   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9885   application.SendNotification();
9886   path.Sample( 0.25f, position, tangent );
9887   rotation = Quaternion( Vector3::XAXIS, tangent );
9888   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9889   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9890
9891   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9892   application.SendNotification();
9893   path.Sample( 0.5f, position, tangent );
9894   rotation = Quaternion( Vector3::XAXIS, tangent );
9895   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9896   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9897
9898   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9899   application.SendNotification();
9900   path.Sample( 0.75f, position, tangent );
9901   rotation = Quaternion( Vector3::XAXIS, tangent );
9902   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9903   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9904
9905   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9906   application.SendNotification();
9907   path.Sample( 1.0f, position, tangent );
9908   rotation = Quaternion( Vector3::XAXIS, tangent );
9909   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9910   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9911
9912   finishCheck.CheckSignalReceived();
9913   END_TEST;
9914 }
9915
9916 int UtcDaliAnimationShowP(void)
9917 {
9918   TestApplication application;
9919
9920   Actor actor = Actor::New();
9921   actor.SetVisible(false);
9922   application.SendNotification();
9923   application.Render(0);
9924   DALI_TEST_CHECK( !actor.IsVisible() );
9925   Stage::GetCurrent().Add(actor);
9926
9927   // Start the animation
9928   float durationSeconds(10.0f);
9929   Animation animation = Animation::New(durationSeconds);
9930   animation.Show(actor, durationSeconds*0.5f);
9931   animation.Play();
9932
9933   bool signalReceived(false);
9934   AnimationFinishCheck finishCheck(signalReceived);
9935   animation.FinishedSignal().Connect(&application, finishCheck);
9936
9937   application.SendNotification();
9938   application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
9939
9940   // We didn't expect the animation to finish yet
9941   application.SendNotification();
9942   finishCheck.CheckSignalNotReceived();
9943   DALI_TEST_CHECK( !actor.IsVisible() );
9944
9945   application.SendNotification();
9946   application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be shown now*/);
9947
9948   // We didn't expect the animation to finish yet
9949   application.SendNotification();
9950   finishCheck.CheckSignalNotReceived();
9951   DALI_TEST_CHECK( actor.IsVisible() );
9952
9953   application.SendNotification();
9954   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
9955
9956   // We did expect the animation to finish
9957   application.SendNotification();
9958   finishCheck.CheckSignalReceived();
9959   DALI_TEST_CHECK( actor.IsVisible() );
9960   END_TEST;
9961 }
9962
9963 int UtcDaliAnimationHideP(void)
9964 {
9965   TestApplication application;
9966
9967   Actor actor = Actor::New();
9968   DALI_TEST_CHECK( actor.IsVisible() );
9969   Stage::GetCurrent().Add(actor);
9970
9971   // Start the animation
9972   float durationSeconds(10.0f);
9973   Animation animation = Animation::New(durationSeconds);
9974   animation.Hide(actor, durationSeconds*0.5f);
9975   animation.Play();
9976
9977   bool signalReceived(false);
9978   AnimationFinishCheck finishCheck(signalReceived);
9979   animation.FinishedSignal().Connect(&application, finishCheck);
9980
9981   application.SendNotification();
9982   application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
9983
9984   // We didn't expect the animation to finish yet
9985   application.SendNotification();
9986   finishCheck.CheckSignalNotReceived();
9987   DALI_TEST_CHECK( actor.IsVisible() );
9988
9989   application.SendNotification();
9990   application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be hidden now*/);
9991
9992   // We didn't expect the animation to finish yet
9993   application.SendNotification();
9994   finishCheck.CheckSignalNotReceived();
9995   DALI_TEST_CHECK( !actor.IsVisible() );
9996
9997   application.SendNotification();
9998   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
9999
10000   // We did expect the animation to finish
10001   application.SendNotification();
10002   finishCheck.CheckSignalReceived();
10003   DALI_TEST_CHECK( !actor.IsVisible() );
10004   END_TEST;
10005 }
10006
10007 int UtcDaliAnimationShowHideAtEndP(void)
10008 {
10009   // Test that show/hide delay can be the same as animation duration
10010   // i.e. to show/hide at the end of the animation
10011
10012   TestApplication application;
10013
10014   Actor actor = Actor::New();
10015   DALI_TEST_CHECK( actor.IsVisible() );
10016   Stage::GetCurrent().Add(actor);
10017
10018   // Start Hide animation
10019   float durationSeconds(10.0f);
10020   Animation animation = Animation::New(durationSeconds);
10021   animation.Hide(actor, durationSeconds/*Hide at end*/);
10022   animation.Play();
10023
10024   bool signalReceived(false);
10025   AnimationFinishCheck finishCheck(signalReceived);
10026   animation.FinishedSignal().Connect(&application, finishCheck);
10027
10028   application.SendNotification();
10029   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
10030
10031   // We did expect the animation to finish
10032   application.SendNotification();
10033   finishCheck.CheckSignalReceived();
10034   DALI_TEST_CHECK( !actor.IsVisible() );
10035
10036   // Start Show animation
10037   animation = Animation::New(durationSeconds);
10038   animation.Show(actor, durationSeconds/*Show at end*/);
10039   animation.FinishedSignal().Connect(&application, finishCheck);
10040   animation.Play();
10041
10042   application.SendNotification();
10043   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
10044
10045   // We did expect the animation to finish
10046   application.SendNotification();
10047   finishCheck.CheckSignalReceived();
10048   DALI_TEST_CHECK( actor.IsVisible() );
10049   END_TEST;
10050 }
10051
10052 int UtcDaliKeyFramesCreateDestroyP(void)
10053 {
10054   tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
10055
10056   KeyFrames* keyFrames = new KeyFrames;
10057   delete keyFrames;
10058   DALI_TEST_CHECK( true );
10059   END_TEST;
10060 }
10061
10062 int UtcDaliKeyFramesDownCastP(void)
10063 {
10064   TestApplication application;
10065   tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
10066
10067   KeyFrames keyFrames = KeyFrames::New();
10068   BaseHandle object(keyFrames);
10069
10070   KeyFrames keyFrames2 = KeyFrames::DownCast(object);
10071   DALI_TEST_CHECK(keyFrames2);
10072
10073   KeyFrames keyFrames3 = DownCast< KeyFrames >(object);
10074   DALI_TEST_CHECK(keyFrames3);
10075
10076   BaseHandle unInitializedObject;
10077   KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
10078   DALI_TEST_CHECK(!keyFrames4);
10079
10080   KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject);
10081   DALI_TEST_CHECK(!keyFrames5);
10082   END_TEST;
10083 }
10084
10085 int UtcDaliAnimationCreateDestroyP(void)
10086 {
10087   TestApplication application;
10088   Animation* animation = new Animation;
10089   DALI_TEST_CHECK( animation );
10090   delete animation;
10091   END_TEST;
10092 }
10093
10094 struct UpdateManagerTestConstraint
10095 {
10096   UpdateManagerTestConstraint(TestApplication& application)
10097   : mApplication(application)
10098   {
10099   }
10100
10101   void operator()( Vector3& current, const PropertyInputContainer& /* inputs */)
10102   {
10103     mApplication.SendNotification();  // Process events
10104   }
10105
10106   TestApplication& mApplication;
10107 };
10108
10109 int UtcDaliAnimationUpdateManagerP(void)
10110 {
10111   TestApplication application;
10112
10113   Actor actor = Actor::New();
10114   Stage::GetCurrent().Add( actor );
10115
10116   // Build the animation
10117   Animation animation = Animation::New( 0.0f );
10118
10119   bool signalReceived = false;
10120   AnimationFinishCheck finishCheck( signalReceived );
10121   animation.FinishedSignal().Connect( &application, finishCheck );
10122
10123   Vector3 startValue(1.0f, 1.0f, 1.0f);
10124   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
10125   Constraint constraint = Constraint::New<Vector3>( actor, index, UpdateManagerTestConstraint( application ) );
10126   constraint.Apply();
10127
10128   // Apply animation to actor
10129   animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunction::LINEAR );
10130   animation.AnimateTo( Property(actor, DevelActor::Property::OPACITY), 0.3f, AlphaFunction::LINEAR );
10131
10132   animation.Play();
10133
10134   application.SendNotification();
10135   application.UpdateOnly( 16 );
10136
10137   finishCheck.CheckSignalNotReceived();
10138
10139   application.SendNotification();   // Process events
10140
10141   finishCheck.CheckSignalReceived();
10142
10143   END_TEST;
10144 }
10145
10146 int UtcDaliAnimationSignalOrderP(void)
10147 {
10148   TestApplication application;
10149
10150   Actor actor = Actor::New();
10151   Stage::GetCurrent().Add( actor );
10152
10153   // Build the animations
10154   Animation animation1 = Animation::New( 0.0f ); // finishes first frame
10155   Animation animation2 = Animation::New( 0.02f ); // finishes in 20 ms
10156
10157   bool signal1Received = false;
10158   animation1.FinishedSignal().Connect( &application, AnimationFinishCheck( signal1Received ) );
10159
10160   bool signal2Received = false;
10161   animation2.FinishedSignal().Connect( &application, AnimationFinishCheck( signal2Received ) );
10162
10163   // Apply animations to actor
10164   animation1.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 3.0f, 2.0f, 1.0f ), AlphaFunction::LINEAR );
10165   animation1.Play();
10166   animation2.AnimateTo( Property(actor, Actor::Property::SIZE ), Vector3( 10.0f, 20.0f, 30.0f ), AlphaFunction::LINEAR );
10167   animation2.Play();
10168
10169   DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10170   DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10171
10172   application.SendNotification();
10173   application.UpdateOnly( 10 ); // 10ms progress
10174
10175   // no notifications yet
10176   DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10177   DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10178
10179   application.SendNotification();
10180
10181   // first completed
10182   DALI_TEST_EQUALS( signal1Received, true, TEST_LOCATION );
10183   DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10184   signal1Received = false;
10185
10186   // 1st animation is complete now, do another update with no ProcessEvents in between
10187   application.UpdateOnly( 20 ); // 20ms progress
10188
10189   // ProcessEvents
10190   application.SendNotification();
10191
10192   // 2nd should complete now
10193   DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10194   DALI_TEST_EQUALS( signal2Received, true, TEST_LOCATION );
10195
10196   END_TEST;
10197 }
10198
10199 int UtcDaliAnimationExtendDurationP(void)
10200 {
10201   TestApplication application;
10202
10203   Actor actor = Actor::New();
10204
10205   // Register a float property
10206   float startValue(10.0f);
10207   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
10208   Stage::GetCurrent().Add(actor);
10209   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
10210   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
10211
10212   // Build the animation
10213   float initialDurationSeconds(1.0f);
10214   float animatorDelay = 5.0f;
10215   float animatorDurationSeconds(5.0f);
10216   float extendedDurationSeconds(animatorDelay+animatorDurationSeconds);
10217   Animation animation = Animation::New(initialDurationSeconds);
10218   float targetValue(30.0f);
10219   float relativeValue(targetValue - startValue);
10220
10221   animation.AnimateTo(Property(actor, index),
10222                       targetValue,
10223                       TimePeriod(animatorDelay, animatorDurationSeconds));
10224
10225   // The duration should have been extended
10226   DALI_TEST_EQUALS( animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION );
10227
10228   // Start the animation
10229   animation.Play();
10230
10231   bool signalReceived(false);
10232   AnimationFinishCheck finishCheck(signalReceived);
10233   animation.FinishedSignal().Connect(&application, finishCheck);
10234
10235   application.SendNotification();
10236   application.Render(static_cast<unsigned int>(extendedDurationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
10237
10238   // We didn't expect the animation to finish yet, but cached value should be the final one
10239   application.SendNotification();
10240   finishCheck.CheckSignalNotReceived();
10241   DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
10242   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
10243
10244   application.SendNotification();
10245   application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
10246
10247   // We didn't expect the animation to finish yet
10248   application.SendNotification();
10249   finishCheck.CheckSignalNotReceived();
10250   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
10251
10252   application.SendNotification();
10253   application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
10254
10255   // We did expect the animation to finish
10256   application.SendNotification();
10257   finishCheck.CheckSignalReceived();
10258   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
10259   DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
10260   END_TEST;
10261 }
10262
10263 int UtcDaliAnimationCustomIntProperty(void)
10264 {
10265   TestApplication application;
10266
10267   Actor actor = Actor::New();
10268   Stage::GetCurrent().Add(actor);
10269   int startValue(0u);
10270
10271   Property::Index index = actor.RegisterProperty("anIndex",  startValue);
10272   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
10273   DALI_TEST_EQUALS( actor.GetProperty< int >( index ), startValue, TEST_LOCATION );
10274
10275   // Build the animation
10276   float durationSeconds(1.0f);
10277   Animation animation = Animation::New(durationSeconds);
10278   animation.AnimateTo( Property(actor, index), 20 );
10279
10280   // Start the animation
10281   animation.Play();
10282
10283   // Target value should be retrievable straight away
10284   DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION );
10285
10286   bool signalReceived(false);
10287   AnimationFinishCheck finishCheck(signalReceived);
10288   animation.FinishedSignal().Connect(&application, finishCheck);
10289
10290   application.SendNotification();
10291   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
10292
10293   // We didn't expect the animation to finish yet
10294   application.SendNotification();
10295   finishCheck.CheckSignalNotReceived();
10296   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), 10, TEST_LOCATION );
10297
10298   application.SendNotification();
10299   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10300
10301   // We did expect the animation to finish
10302   application.SendNotification();
10303   finishCheck.CheckSignalReceived();
10304   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), 20, TEST_LOCATION );
10305   DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION );
10306   END_TEST;
10307 }
10308
10309 int UtcDaliAnimationDuration(void)
10310 {
10311   TestApplication application;
10312
10313   Actor actor = Actor::New();
10314   Stage::GetCurrent().Add(actor);
10315
10316   Animation animation = Animation::New( 0.0f );
10317   DALI_TEST_EQUALS( 0.0f, animation.GetDuration(), TEST_LOCATION );
10318
10319   // The animation duration should automatically increase depending on the animator time period
10320
10321   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 0.0f, 1.0f ) );
10322   DALI_TEST_EQUALS( 1.0f, animation.GetDuration(), TEST_LOCATION );
10323
10324   animation.AnimateTo( Property( actor, Actor::Property::POSITION_Y ), 200.0f, TimePeriod( 10.0f, 1.0f ) );
10325   DALI_TEST_EQUALS( 11.0f, animation.GetDuration(), TEST_LOCATION );
10326
10327   END_TEST;
10328 }
10329
10330 int UtcDaliAnimationAnimateByNonAnimateableTypeN(void)
10331 {
10332   TestApplication application;
10333
10334   Actor actor = Actor::New();
10335
10336   // Register an integer property
10337   int startValue(1);
10338   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
10339   Stage::GetCurrent().Add(actor);
10340   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10341
10342   try
10343   {
10344     // Build the animation
10345     Animation animation = Animation::New( 2.0f );
10346     std::string relativeValue = "relative string";
10347     animation.AnimateBy( Property(actor, index), relativeValue );
10348     tet_result(TET_FAIL);
10349   }
10350   catch ( Dali::DaliException& e )
10351   {
10352     DALI_TEST_ASSERT( e, "Animated value and Property type don't match", TEST_LOCATION );
10353   }
10354
10355
10356   END_TEST;
10357 }
10358
10359
10360 int UtcDaliAnimationAnimateToNonAnimateableTypeN(void)
10361 {
10362   TestApplication application;
10363
10364   Actor actor = Actor::New();
10365
10366   // Register an integer property
10367   int startValue(1);
10368   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
10369   Stage::GetCurrent().Add(actor);
10370   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10371
10372   try
10373   {
10374     // Build the animation
10375     Animation animation = Animation::New( 2.0f );
10376     std::string relativeValue = "relative string";
10377     animation.AnimateTo( Property(actor, index), relativeValue );
10378
10379     tet_result(TET_FAIL);
10380   }
10381   catch ( Dali::DaliException& e )
10382   {
10383    DALI_TEST_ASSERT( e, "Animated value and Property type don't match", TEST_LOCATION );
10384   }
10385
10386   END_TEST;
10387 }
10388
10389 int UtcDaliAnimationAnimateBetweenNonAnimateableTypeN(void)
10390 {
10391   TestApplication application;
10392
10393   Actor actor = Actor::New();
10394
10395   // Register an integer property
10396   int startValue(1);
10397   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
10398   Stage::GetCurrent().Add(actor);
10399   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10400
10401   try
10402   {
10403     // Build the animation
10404     KeyFrames keyFrames = KeyFrames::New();
10405     keyFrames.Add( 0.0f, std::string("relative string1") );
10406     keyFrames.Add( 1.0f, std::string("relative string2") );
10407     // no need to really create the animation as keyframes do the check
10408
10409     tet_result(TET_FAIL);
10410   }
10411   catch ( Dali::DaliException& e )
10412   {
10413     DALI_TEST_ASSERT( e, "Type not animateable", TEST_LOCATION );
10414   }
10415
10416   END_TEST;
10417 }
10418
10419 int UtcDaliAnimationSetAndGetTargetBeforePlayP(void)
10420 {
10421   tet_infoline("Setting up an animation should not effect it's position property until the animation plays");
10422
10423   TestApplication application;
10424
10425   tet_infoline("Set initial position and set up animation to re-position actor");
10426
10427   Actor actor = Actor::New();
10428   Stage::GetCurrent().Add(actor);
10429   Vector3 initialPosition(0.0f, 0.0f, 0.0f);
10430   actor.SetProperty( Actor::Property::POSITION, initialPosition );
10431
10432   // Build the animation
10433   Animation animation = Animation::New(2.0f);
10434
10435   //Test GetCurrentProgress return 0.0 as the duration is 0.0
10436   DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
10437   DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentPosition(), TEST_LOCATION );
10438
10439   tet_infoline("Set target position in animation without intiating play");
10440
10441   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
10442   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
10443
10444   application.SendNotification();
10445   application.Render();
10446
10447   tet_infoline("Ensure position of actor is still at intial value");
10448
10449   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
10450   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
10451   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
10452
10453   tet_infoline("Play animation and ensure actor position is now target");
10454
10455   animation.Play();
10456   application.SendNotification();
10457   application.Render(1000u);
10458
10459   tet_infoline("Ensure position of actor is at target value when aninmation half way");
10460
10461   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
10462   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
10463   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
10464
10465   tet_printf( "x position at half way point(%f)\n", actor.GetCurrentPosition().x );
10466
10467   application.Render(2000u);
10468
10469   tet_infoline("Ensure position of actor is still at target value when aninmation complete");
10470
10471   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
10472   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
10473   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
10474
10475   END_TEST;
10476 }
10477
10478 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsPositionP(void)
10479 {
10480   tet_infoline("Setting up an animation should not effect it's position property until the animation plays even with mulitple animators");
10481
10482   TestApplication application;
10483
10484   std::vector<Vector3> targetPositions;
10485
10486   targetPositions.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
10487   targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
10488   targetPositions.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
10489
10490   tet_infoline("Set initial position and set up animation to re-position actor");
10491
10492   Actor actor = Actor::New();
10493   Stage::GetCurrent().Add(actor);
10494   Vector3 initialPosition(0.0f, 0.0f, 0.0f);
10495   actor.SetProperty( Actor::Property::POSITION, initialPosition );
10496
10497   // Build the animation
10498   Animation animation = Animation::New(2.0f);
10499
10500   //Test GetCurrentProgress return 0.0 as the duration is 0.0
10501   DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
10502   DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentPosition(), TEST_LOCATION );
10503
10504   tet_infoline("Set target position in animation without intiating play");
10505
10506   for ( unsigned int i = 0; i < targetPositions.size(); i++ )
10507   {
10508     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[i], AlphaFunction::LINEAR);
10509   }
10510
10511   application.SendNotification();
10512   application.Render();
10513
10514   tet_infoline("Ensure position of actor is still at intial value");
10515
10516   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
10517   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
10518   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
10519
10520   tet_infoline("Play animation and ensure actor position is now target");
10521
10522   animation.Play();
10523   application.SendNotification();
10524   application.Render(1000u);
10525
10526   tet_infoline("Ensure position of actor is at target value when aninmation half way");
10527
10528   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
10529   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
10530   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
10531
10532   tet_printf( "x position at half way point(%f)\n", actor.GetCurrentPosition().x );
10533
10534   application.Render(2000u);
10535
10536   tet_infoline("Ensure position of actor is still at target value when aninmation complete");
10537
10538   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
10539   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
10540   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
10541
10542   END_TEST;
10543 }
10544
10545 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionP(void)
10546 {
10547   tet_infoline("Setting up an animation should not effect it's size property until the animation plays even with mulitple animators of different Property Indexes");
10548
10549   TestApplication application;
10550
10551   std::vector<Vector3> targetSizes;
10552   std::vector<Vector3> targetPositions;
10553
10554   targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
10555   targetSizes.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
10556
10557   targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
10558
10559   tet_infoline("Set initial position and set up animation to re-position actor");
10560
10561   Actor actor = Actor::New();
10562   Stage::GetCurrent().Add(actor);
10563   Vector3 initialSize( 10.0f, 10.0f, 10.0f);
10564   Vector3 initialPosition(10.0f, 10.0f, 10.0f);
10565
10566   actor.SetProperty( Actor::Property::SIZE, initialSize );
10567   actor.SetProperty( Actor::Property::POSITION, initialPosition );
10568
10569   // Build the animation
10570   Animation animation = Animation::New(2.0f);
10571
10572   tet_infoline("Set target size in animation without intiating play");
10573   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
10574   tet_infoline("Set target position in animation without intiating play");
10575   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[0], AlphaFunction::LINEAR);
10576   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
10577
10578   application.SendNotification();
10579   application.Render();
10580
10581   tet_infoline("Ensure position of actor is still at intial size and position");
10582
10583   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
10584   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
10585   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
10586
10587   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialPosition.x, TEST_LOCATION );
10588   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialPosition.y, TEST_LOCATION );
10589   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialPosition.z, TEST_LOCATION );
10590
10591   tet_infoline("Play animation and ensure actor position and size is now matches targets");
10592
10593   animation.Play();
10594   application.SendNotification();
10595   application.Render(2000u);
10596
10597   tet_infoline("Ensure position and size of actor is at target value when aninmation playing");
10598
10599   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
10600   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
10601   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
10602
10603   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[0].x, TEST_LOCATION );
10604   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[0].y, TEST_LOCATION );
10605   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[0].z, TEST_LOCATION );
10606
10607   END_TEST;
10608 }
10609
10610 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionColourP(void)
10611 {
10612   tet_infoline("Setting up an animation should not effect it's size property until the animation plays even if other Properties animated");
10613
10614   TestApplication application;
10615
10616   std::vector<Vector3> targetSizes;
10617   std::vector<float> targetColors;
10618
10619   targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
10620   targetSizes.push_back( Vector3( 50.0f, 10.0f, 150.0f ) );
10621
10622   targetColors.push_back( 1.0f );
10623
10624   tet_infoline("Set initial position and set up animation to re-position actor");
10625
10626   Actor actor = Actor::New();
10627   Stage::GetCurrent().Add(actor);
10628   Vector3 initialSize( 10.0f, 5.0f, 10.0f);
10629
10630   actor.SetProperty( Actor::Property::SIZE, initialSize );
10631
10632   // Build the animation
10633   Animation animation = Animation::New(2.0f);
10634
10635   tet_infoline("Set target size in animation without initiating play");
10636   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
10637   tet_infoline("Set target position in animation without intiating play");
10638   animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetColors[0], AlphaFunction::LINEAR);
10639   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
10640
10641   application.SendNotification();
10642   application.Render();
10643
10644   tet_infoline("Ensure position of actor is still at initial size and position");
10645
10646   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
10647   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
10648   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
10649
10650   tet_infoline("Play animation and ensure actor position and size is now matches targets");
10651
10652   animation.Play();
10653   application.SendNotification();
10654   application.Render(2000u);
10655
10656   tet_infoline("Ensure position and size of actor is at target value when animation playing");
10657
10658   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
10659   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
10660   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
10661
10662   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColors[0], TEST_LOCATION );
10663
10664   END_TEST;
10665 }
10666
10667 int UtcDaliAnimationTimePeriodOrder(void)
10668 {
10669   tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place" );
10670
10671   TestApplication application;
10672
10673   Actor actor = Actor::New();
10674   Stage::GetCurrent().Add( actor );
10675
10676   application.SendNotification();
10677   application.Render();
10678
10679   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
10680   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10681   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10682   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10683   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10684
10685   //////////////////////////////////////////////////////////////////////////////////
10686
10687   tet_infoline( "With two AnimateTo calls" );
10688
10689   Animation animation = Animation::New( 0.0f );
10690   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
10691   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
10692   animation.Play();
10693
10694   tet_infoline( "The target position should change instantly" );
10695   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
10696   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
10697
10698   application.SendNotification();
10699   application.Render(5000); // After the animation is complete
10700
10701   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
10702   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
10703   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
10704
10705   //////////////////////////////////////////////////////////////////////////////////
10706
10707   tet_infoline( "Same animation again but in a different order - should yield the same result" );
10708
10709   actor.SetX( 0.0f );
10710   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10711   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10712
10713   application.SendNotification();
10714   application.Render();
10715
10716   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
10717   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10718   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10719
10720   animation = Animation::New( 0.0f );
10721   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
10722   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
10723   animation.Play();
10724
10725   tet_infoline( "The target position should change instantly" );
10726   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
10727   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
10728
10729   application.SendNotification();
10730   application.Render(5000); // After the animation is complete
10731
10732   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
10733   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
10734   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
10735
10736   END_TEST;
10737 }
10738
10739 int UtcDaliAnimationTimePeriodOrderSeveralAnimateToCalls(void)
10740 {
10741   tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place with several AnimateTo calls" );
10742
10743   TestApplication application;
10744
10745   Actor actor = Actor::New();
10746   Stage::GetCurrent().Add( actor );
10747
10748   application.SendNotification();
10749   application.Render();
10750
10751   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
10752   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10753   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10754   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10755   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10756
10757   //////////////////////////////////////////////////////////////////////////////////
10758
10759   tet_infoline( "" );
10760
10761   Animation animation = Animation::New( 0.0f );
10762   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
10763   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
10764   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
10765   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) );
10766   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) );
10767   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
10768   animation.Play();
10769
10770   tet_infoline( "The target position should change instantly" );
10771   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
10772   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
10773
10774   application.SendNotification();
10775   application.Render(14000); // After the animation is complete
10776
10777   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
10778   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
10779   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
10780
10781   //////////////////////////////////////////////////////////////////////////////////
10782
10783   tet_infoline( "Same animation again but in a different order - should end up at the same point" );
10784
10785   actor.SetX( 0.0f );
10786
10787   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10788   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10789
10790   application.SendNotification();
10791   application.Render();
10792
10793   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
10794   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10795   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10796
10797   animation = Animation::New( 0.0f );
10798   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) );
10799   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
10800   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
10801   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
10802   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) );
10803   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
10804   animation.Play();
10805
10806   tet_infoline( "The target position should change instantly" );
10807   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
10808   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
10809
10810   application.SendNotification();
10811   application.Render(14000); // After the animation is complete
10812
10813   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
10814   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
10815   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
10816
10817   END_TEST;
10818 }