Remove deprecated APIs in Tizen 3.0
[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-test-suite-utils.h>
25 #include <dali/devel-api/animation/animation-devel.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 // Functor to test whether a Progress signal is emitted
94 struct AnimationProgressCheck
95 {
96   AnimationProgressCheck(bool& signalReceived, std::string name = " ")
97   : mSignalReceived(signalReceived),
98     mName( name )
99   {
100   }
101
102   void operator()(Animation& animation)
103   {
104     mSignalReceived = true;
105   }
106
107   void Reset()
108   {
109     mSignalReceived = false;
110   }
111
112   void CheckSignalReceived()
113   {
114     if (!mSignalReceived)
115     {
116       tet_printf("Expected Progress reached signal was not received %s \n", mName.c_str() );
117       tet_result(TET_FAIL);
118     }
119     else
120     {
121       tet_result(TET_PASS);
122     }
123   }
124
125   void CheckSignalNotReceived()
126   {
127     if (mSignalReceived)
128     {
129       tet_printf("Unexpected Progress reached signal was received %s \n", mName.c_str());
130       tet_result(TET_FAIL);
131     }
132     else
133     {
134       tet_result(TET_PASS);
135     }
136   }
137
138   bool& mSignalReceived; // owned by individual tests
139   std::string mName;
140 };
141
142 } // anon namespace
143
144 int UtcDaliAnimationConstructorP(void)
145 {
146   TestApplication application;
147
148   Animation animation;
149
150   DALI_TEST_CHECK( !animation );
151   END_TEST;
152 }
153
154 int UtcDaliAnimationNewP(void)
155 {
156   TestApplication application;
157
158   Animation animation = Animation::New( 1.0f );
159
160   DALI_TEST_CHECK(animation);
161   END_TEST;
162 }
163
164 int UtcDaliAnimationNewN(void)
165 {
166   TestApplication application;
167
168   Animation animation = Animation::New( -1.0f );
169
170   DALI_TEST_CHECK(animation);
171   DALI_TEST_EQUALS(animation.GetDuration(), 0.0f, TEST_LOCATION);
172   END_TEST;
173 }
174
175 int UtcDaliAnimationDownCastP(void)
176 {
177   TestApplication application;
178
179   tet_infoline("Testing Dali::Animation::DownCast()");
180
181   float durationSeconds(1.0f);
182   Animation animation = Animation::New(durationSeconds);
183
184   BaseHandle object(animation);
185
186   Animation animation2 = Animation::DownCast(object);
187   DALI_TEST_CHECK(animation2);
188
189   Animation animation3 = DownCast< Animation >(object);
190   DALI_TEST_CHECK(animation3);
191   END_TEST;
192 }
193
194 int UtcDaliAnimationDownCastN(void)
195 {
196   TestApplication application;
197
198   BaseHandle unInitializedObject;
199
200   Animation animation1 = Animation::DownCast( unInitializedObject );
201   DALI_TEST_CHECK( !animation1 );
202
203   Animation animation2 = DownCast< Animation >( unInitializedObject );
204   DALI_TEST_CHECK( !animation2 );
205   END_TEST;
206 }
207
208 int UtcDaliAnimationCopyConstructorP(void)
209 {
210   TestApplication application;
211
212   // Initialize an object, ref count == 1
213   Animation animation = Animation::New( 1.0f );
214
215   Animation copy( animation );
216   DALI_TEST_CHECK( copy );
217
218   DALI_TEST_CHECK( copy.GetDuration() == animation.GetDuration() );
219   END_TEST;
220 }
221
222 int UtcDaliAnimationAssignmentOperatorP(void)
223 {
224   TestApplication application;
225
226   Animation animation = Animation::New( 1.0f );
227
228   Animation copy = animation;
229   DALI_TEST_CHECK( copy );
230
231   DALI_TEST_CHECK( animation == copy );
232
233   DALI_TEST_CHECK( copy.GetDuration() == animation.GetDuration() );
234   END_TEST;
235 }
236
237 int UtcDaliAnimationSetDurationP(void)
238 {
239   TestApplication application;
240
241   Actor actor = Actor::New();
242   Stage::GetCurrent().Add(actor);
243
244   // Build the animation
245   float durationSeconds(1.0f);
246   Animation animation = Animation::New(durationSeconds);
247   DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
248
249   // Start the animation
250   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
251   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
252   animation.Play();
253
254   bool signalReceived(false);
255   AnimationFinishCheck finishCheck(signalReceived);
256   animation.FinishedSignal().Connect(&application, finishCheck);
257
258   application.SendNotification();
259   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
260
261   // We didn't expect the animation to finish yet
262   application.SendNotification();
263   finishCheck.CheckSignalNotReceived();
264
265   application.Render(2u/*just beyond the animation duration*/);
266
267   // We did expect the animation to finish
268   application.SendNotification();
269   finishCheck.CheckSignalReceived();
270   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
271
272   // Restart the animation, with a different duration
273   finishCheck.Reset();
274   actor.SetPosition(Vector3::ZERO);
275   durationSeconds = 3.5f;
276   animation.SetDuration(durationSeconds);
277   DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
278   animation.Play();
279
280   application.SendNotification();
281   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
282
283   // We didn't expect the animation to finish yet
284   application.SendNotification();
285   finishCheck.CheckSignalNotReceived();
286
287   application.Render(2u/*just beyond the animation duration*/);
288
289   // We did expect the animation to finish
290   application.SendNotification();
291   finishCheck.CheckSignalReceived();
292   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
293
294   // Check that nothing has changed after a couple of buffer swaps
295   application.Render(0);
296   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
297   application.Render(0);
298   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
299   END_TEST;
300 }
301
302 int UtcDaliAnimationSetDurationN(void)
303 {
304   TestApplication application;
305
306   Animation animation = Animation::New( 1.0f );
307   DALI_TEST_EQUALS( animation.GetDuration(), 1.0f, TEST_LOCATION );
308
309   animation.SetDuration( -1.0f );
310   DALI_TEST_EQUALS( animation.GetDuration(), 0.0f, TEST_LOCATION );
311   END_TEST;
312 }
313
314 int UtcDaliAnimationGetDurationP(void)
315 {
316   TestApplication application;
317
318   Animation animation = Animation::New(1.0f);
319   DALI_TEST_EQUALS(animation.GetDuration(), 1.0f, TEST_LOCATION);
320
321   animation.SetDuration(2.0f);
322   DALI_TEST_EQUALS(animation.GetDuration(), 2.0f, TEST_LOCATION);
323   END_TEST;
324 }
325
326 int UtcDaliAnimationSetLoopingP(void)
327 {
328   TestApplication application;
329
330   Actor actor = Actor::New();
331   Stage::GetCurrent().Add(actor);
332
333   // Build the animation
334   float durationSeconds(1.0f);
335   Animation animation = Animation::New(durationSeconds);
336   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
337   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
338
339   // Start the animation
340   animation.SetLooping(true);
341   DALI_TEST_CHECK(animation.IsLooping());
342   animation.Play();
343
344   bool signalReceived(false);
345   AnimationFinishCheck finishCheck(signalReceived);
346   animation.FinishedSignal().Connect(&application, finishCheck);
347
348   application.SendNotification();
349
350   // Loop 5 times
351   float intervalSeconds = 0.25f;
352   float progress = 0.0f;
353   for (int iterations = 0; iterations < 5;)
354   {
355     application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
356
357     progress += intervalSeconds;
358     DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
359
360     if (progress >= 1.0f)
361     {
362       progress = progress - 1.0f;
363       ++iterations;
364     }
365   }
366
367   // We didn't expect the animation to finish yet
368   application.SendNotification();
369   finishCheck.CheckSignalNotReceived();
370
371   animation.SetLooping(false);
372   DALI_TEST_CHECK(!animation.IsLooping());
373
374   application.SendNotification();
375   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
376
377   // We did expect the animation to finish
378   application.SendNotification();
379   finishCheck.CheckSignalReceived();
380   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
381
382   // Check that nothing has changed after a couple of buffer swaps
383   application.Render(0);
384   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
385   application.Render(0);
386   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
387   END_TEST;
388 }
389
390 int UtcDaliAnimationSetLoopCountP(void)
391 {
392   TestApplication application;
393
394   Actor actor = Actor::New();
395   Stage::GetCurrent().Add(actor);
396
397   // Build the animation
398   float durationSeconds(1.0f);
399   Animation animation = Animation::New(durationSeconds);
400   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
401   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
402
403   // Start the animation
404   animation.SetLoopCount(3);
405   DALI_TEST_CHECK(animation.IsLooping());
406   animation.Play();
407
408   bool signalReceived(false);
409   AnimationFinishCheck finishCheck(signalReceived);
410   animation.FinishedSignal().Connect(&application, finishCheck);
411
412   application.Render(0);
413   application.SendNotification();
414   application.Render(0);
415   application.SendNotification();
416   application.Render(0);
417   application.SendNotification();
418   application.Render(0);
419   application.SendNotification();
420
421   // Loop
422   float intervalSeconds = 3.0f;
423
424   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
425   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
426
427   application.Render(0);
428   application.SendNotification();
429   application.Render(0);
430   application.SendNotification();
431   application.Render(0);
432   application.SendNotification();
433   application.Render(0);
434   application.SendNotification();
435   finishCheck.CheckSignalNotReceived();
436
437   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
438
439   application.SendNotification();
440   finishCheck.CheckSignalReceived();
441   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
442
443   finishCheck.Reset();
444
445   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
446   application.SendNotification();
447   finishCheck.CheckSignalNotReceived();
448
449   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
450   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
451   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
452   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
453   application.SendNotification();
454   finishCheck.CheckSignalNotReceived();
455
456   END_TEST;
457 }
458
459 int UtcDaliAnimationSetLoopCountP2(void)
460 {
461   TestApplication application;
462
463   //
464   // switching between forever and loop count
465   //
466
467   Actor actor = Actor::New();
468   Stage::GetCurrent().Add(actor);
469
470   // Build the animation
471   float durationSeconds(1.0f);
472   Animation animation = Animation::New(durationSeconds);
473   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
474   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
475   animation.SetEndAction(Animation::Discard);
476
477   // Start the animation
478   animation.SetLoopCount(3);
479   DALI_TEST_CHECK(animation.IsLooping());
480   animation.Play();
481
482   bool signalReceived(false);
483   AnimationFinishCheck finishCheck(signalReceived);
484   animation.FinishedSignal().Connect(&application, finishCheck);
485
486   float intervalSeconds = 3.0f;
487
488   application.SendNotification();
489   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
490   application.SendNotification();
491   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
492   application.SendNotification();
493   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
494   application.SendNotification();
495
496   application.SendNotification();
497   finishCheck.CheckSignalReceived();
498
499   finishCheck.Reset();
500
501   // Loop forever
502   animation.SetLooping(true);
503   DALI_TEST_CHECK(animation.IsLooping());
504
505   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
506   application.SendNotification();
507   finishCheck.CheckSignalNotReceived();
508
509   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
510   application.SendNotification();
511   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
512   application.SendNotification();
513   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
514   application.SendNotification();
515   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
516   application.SendNotification();
517   application.SendNotification();
518   finishCheck.CheckSignalNotReceived();
519
520   finishCheck.Reset();
521
522   // Loop N again
523   animation.SetLoopCount(3);
524   DALI_TEST_CHECK(animation.IsLooping());
525   animation.Play();
526
527   application.SendNotification();
528   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
529   application.SendNotification();
530   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
531   application.SendNotification();
532   finishCheck.CheckSignalNotReceived();
533
534   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
535   application.SendNotification();
536   finishCheck.CheckSignalReceived();
537
538   finishCheck.Reset();
539
540   // loop forever
541   animation.SetLooping(true);
542   DALI_TEST_CHECK(animation.IsLooping());
543
544   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
545   application.SendNotification();
546   finishCheck.CheckSignalNotReceived();
547
548   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
549   application.SendNotification();
550   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
551   application.SendNotification();
552   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
553   application.SendNotification();
554   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
555   application.SendNotification();
556   finishCheck.CheckSignalNotReceived();
557
558   finishCheck.Reset();
559
560   // Loop N again
561   animation.SetLoopCount(3);
562   DALI_TEST_CHECK(animation.IsLooping());
563
564   application.SendNotification();
565   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
566   application.SendNotification();
567   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
568   application.SendNotification();
569   finishCheck.CheckSignalNotReceived();
570
571   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
572   application.SendNotification();
573   finishCheck.CheckSignalNotReceived(); // we never hit play
574
575   finishCheck.Reset();
576
577
578   END_TEST;
579 }
580
581 int UtcDaliAnimationSetLoopCountP3(void)
582 {
583   TestApplication application;
584
585   //
586   // switching between forever and loop count
587   //
588   Actor actor = Actor::New();
589   Stage::GetCurrent().Add(actor);
590
591   // Build the animation
592   float durationSeconds(1.0f);
593   Animation animation = Animation::New(durationSeconds);
594   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
595   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
596   animation.SetEndAction(Animation::Discard);
597
598   float intervalSeconds = 3.0f;
599
600   bool signalReceived(false);
601   AnimationFinishCheck finishCheck(signalReceived);
602   animation.FinishedSignal().Connect(&application, finishCheck);
603
604   // loop forever
605   animation.SetLooping(true);
606   DALI_TEST_CHECK(animation.IsLooping());
607
608   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
609   application.SendNotification();
610   finishCheck.CheckSignalNotReceived();
611
612   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
613   application.SendNotification();
614   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
615   application.SendNotification();
616   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
617   application.SendNotification();
618   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
619   application.SendNotification();
620   finishCheck.CheckSignalNotReceived();
621
622   finishCheck.Reset();
623
624   // Loop N again
625   animation.SetLoopCount(3);
626   DALI_TEST_CHECK(animation.IsLooping());
627
628   application.SendNotification();
629   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
630   application.SendNotification();
631   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
632   application.SendNotification();
633   finishCheck.CheckSignalNotReceived();
634
635   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
636   application.SendNotification();
637   finishCheck.CheckSignalNotReceived(); // we never hit play
638
639   finishCheck.Reset();
640
641
642   END_TEST;
643 }
644
645 int UtcDaliAnimationSetLoopCountP4(void)
646 {
647   TestApplication application;
648
649   //
650   // ..and play again
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   animation.SetEndAction(Animation::Bake);
661
662   float intervalSeconds = 3.0f;
663
664   bool signalReceived(false);
665   AnimationFinishCheck finishCheck(signalReceived);
666   animation.FinishedSignal().Connect(&application, finishCheck);
667
668   animation.SetLoopCount(1);
669   animation.Play();
670   DALI_TEST_CHECK(!animation.IsLooping());
671
672   application.SendNotification();
673   finishCheck.CheckSignalNotReceived();
674   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
675   application.SendNotification();
676   finishCheck.CheckSignalReceived();
677
678   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
679   actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f) );
680
681   finishCheck.Reset();
682
683   animation.Play(); // again
684   DALI_TEST_CHECK(!animation.IsLooping());
685
686   application.SendNotification();
687   finishCheck.CheckSignalNotReceived();
688   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
689   application.SendNotification();
690   finishCheck.CheckSignalReceived();
691
692   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
693
694   END_TEST;
695 }
696
697 int UtcDaliAnimationGetLoopCountP(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   DALI_TEST_CHECK(1 == animation.GetLoopCount());
711
712   // Start the animation
713   animation.SetLoopCount(3);
714   DALI_TEST_CHECK(animation.IsLooping());
715   DALI_TEST_CHECK(3 == animation.GetLoopCount());
716
717   animation.Play();
718
719   application.Render(0);
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.Render(0);
729   application.SendNotification();
730
731   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
732   application.SendNotification();
733
734   animation.SetLoopCount(0);
735   DALI_TEST_CHECK(animation.IsLooping());
736   DALI_TEST_CHECK(0 == animation.GetLoopCount());
737
738   animation.SetLoopCount(1);
739   DALI_TEST_CHECK(!animation.IsLooping());
740   DALI_TEST_CHECK(1 == animation.GetLoopCount());
741
742   END_TEST;
743 }
744
745
746 int UtcDaliAnimationGetCurrentLoopP(void)
747 {
748   TestApplication application;
749
750   Actor actor = Actor::New();
751   Stage::GetCurrent().Add(actor);
752
753   // Build the animation
754   float durationSeconds(1.0f);
755   Animation animation = Animation::New(durationSeconds);
756   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
757   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
758
759   // Start the animation
760   animation.SetLoopCount(3);
761   DALI_TEST_CHECK(animation.IsLooping());
762   DALI_TEST_CHECK(0 == animation.GetCurrentLoop());
763   animation.Play();
764
765   bool signalReceived(false);
766   AnimationFinishCheck finishCheck(signalReceived);
767   animation.FinishedSignal().Connect(&application, finishCheck);
768
769   application.SendNotification();
770
771   // Loop
772   float intervalSeconds = 3.0f;
773
774   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
775   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
776
777   application.SendNotification();
778   finishCheck.CheckSignalNotReceived();
779   DALI_TEST_CHECK(2 == animation.GetCurrentLoop());
780
781   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
782
783   application.SendNotification();
784   finishCheck.CheckSignalReceived();
785   DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
786   DALI_TEST_CHECK(animation.GetLoopCount() == animation.GetCurrentLoop());
787
788   finishCheck.Reset();
789
790   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
791   application.SendNotification();
792   finishCheck.CheckSignalNotReceived();
793   DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
794
795   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
796   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
797   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
798   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
799   application.SendNotification();
800   finishCheck.CheckSignalNotReceived();
801   DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
802
803   END_TEST;
804 }
805
806 int UtcDaliAnimationIsLoopingP(void)
807 {
808   TestApplication application;
809
810   Animation animation = Animation::New(1.0f);
811   DALI_TEST_CHECK(!animation.IsLooping());
812
813   animation.SetLooping(true);
814   DALI_TEST_CHECK(animation.IsLooping());
815   END_TEST;
816 }
817
818 int UtcDaliAnimationSetEndActioN(void)
819 {
820   TestApplication application;
821
822   Actor actor = Actor::New();
823   Stage::GetCurrent().Add(actor);
824
825   // Build the animation
826   float durationSeconds(1.0f);
827   Animation animation = Animation::New(durationSeconds);
828   DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
829
830   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
831   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
832
833   // Start the animation
834   animation.Play();
835
836   bool signalReceived(false);
837   AnimationFinishCheck finishCheck(signalReceived);
838   animation.FinishedSignal().Connect(&application, finishCheck);
839
840   application.SendNotification();
841   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
842
843   // We did expect the animation to finish
844   application.SendNotification();
845   finishCheck.CheckSignalReceived();
846   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
847
848   // Go back to the start
849   actor.SetPosition(Vector3::ZERO);
850   application.SendNotification();
851   application.Render(0);
852   DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
853
854   // Test BakeFinal, animate again, for half the duration
855   finishCheck.Reset();
856   animation.SetEndAction(Animation::BakeFinal);
857   DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
858   animation.Play();
859
860   application.SendNotification();
861   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f*0.5f) /*half of the animation duration*/);
862
863   // Stop the animation early
864   animation.Stop();
865
866   // We did NOT expect the animation to finish
867   application.SendNotification();
868   finishCheck.CheckSignalNotReceived();
869   DALI_TEST_EQUALS( targetPosition * 0.5f, actor.GetCurrentPosition(), VECTOR4_EPSILON, TEST_LOCATION );
870
871   // The position should be same with target position in the next frame
872   application.Render(0);
873   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
874
875   // Go back to the start
876   actor.SetPosition(Vector3::ZERO);
877   application.SendNotification();
878   application.Render(0);
879   DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
880
881   // Test EndAction::Discard, animate again, but don't bake this time
882   finishCheck.Reset();
883   animation.SetEndAction(Animation::Discard);
884   DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
885   animation.Play();
886
887   application.SendNotification();
888   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
889
890   // We did expect the animation to finish
891   application.SendNotification();
892   finishCheck.CheckSignalReceived();
893   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
894
895   // The position should be discarded in the next frame
896   application.Render(0);
897   DALI_TEST_EQUALS( Vector3::ZERO/*discarded*/, actor.GetCurrentPosition(), TEST_LOCATION );
898
899   // Check that nothing has changed after a couple of buffer swaps
900   application.Render(0);
901   DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
902   application.Render(0);
903   DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
904   END_TEST;
905 }
906
907 int UtcDaliAnimationGetEndActionP(void)
908 {
909   TestApplication application;
910
911   Animation animation = Animation::New(1.0f);
912   DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
913
914   animation.SetEndAction(Animation::Discard);
915   DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
916
917   animation.SetEndAction(Animation::BakeFinal);
918   DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
919
920   END_TEST;
921 }
922
923 int UtcDaliAnimationSetDisconnectActionP(void)
924 {
925   TestApplication application;
926   Stage stage( Stage::GetCurrent() );
927
928   // Default: BakeFinal
929   {
930     Actor actor = Actor::New();
931     stage.Add(actor);
932
933     // Build the animation
934     float durationSeconds(1.0f);
935     Animation animation = Animation::New(durationSeconds);
936     DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal);
937
938     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
939     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
940
941     // Start the animation
942     animation.Play();
943
944     application.SendNotification();
945     application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
946
947     actor.Unparent();
948
949     application.SendNotification();
950     application.Render();
951
952     DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
953   }
954
955   // Bake
956   {
957     Actor actor = Actor::New();
958     stage.Add(actor);
959
960     // Build the animation
961     float durationSeconds(1.0f);
962     Animation animation = Animation::New(durationSeconds);
963     animation.SetDisconnectAction( Animation::Bake );
964
965     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
966     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
967
968     // Start the animation
969     animation.Play();
970
971     application.SendNotification();
972     application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
973
974     actor.Unparent();
975
976     application.SendNotification();
977     application.Render();
978
979     DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition*0.5f, TEST_LOCATION );
980   }
981
982   // Discard
983   {
984     Actor actor = Actor::New();
985     stage.Add(actor);
986
987     // Build the animation
988     float durationSeconds(1.0f);
989     Animation animation = Animation::New(durationSeconds);
990     animation.SetDisconnectAction( Animation::Discard );
991
992     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
993     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
994
995     // Start the animation
996     animation.Play();
997
998     application.SendNotification();
999     application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
1000
1001     actor.Unparent();
1002
1003     application.SendNotification();
1004     application.Render();
1005
1006     DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
1007   }
1008
1009   // Don't play the animation: disconnect action should not be applied
1010   {
1011     Actor actor = Actor::New();
1012     stage.Add(actor);
1013
1014     // Build the animation
1015     float durationSeconds(1.0f);
1016     Animation animation = Animation::New(durationSeconds);
1017
1018     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
1019     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1020
1021     application.SendNotification();
1022     application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
1023
1024     actor.Unparent();
1025
1026     application.SendNotification();
1027     application.Render();
1028
1029     DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
1030   }
1031
1032   END_TEST;
1033 }
1034
1035 int UtcDaliAnimationGetDisconnectActionP(void)
1036 {
1037   TestApplication application;
1038   Animation animation = Animation::New(1.0f);
1039   DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal); // default!
1040
1041   animation.SetDisconnectAction(Animation::Discard);
1042   DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Discard);
1043
1044   animation.SetDisconnectAction(Animation::Bake);
1045   DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Bake);
1046
1047   END_TEST;
1048 }
1049
1050 int UtcDaliAnimationSetDefaultAlphaFunctionP(void)
1051 {
1052   TestApplication application;
1053
1054   Animation animation = Animation::New(1.0f);
1055   AlphaFunction func = animation.GetDefaultAlphaFunction();
1056   DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1057
1058   animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1059   AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1060   DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1061   END_TEST;
1062 }
1063
1064 int UtcDaliAnimationGetDefaultAlphaFunctionP(void)
1065 {
1066   TestApplication application;
1067
1068   Animation animation = Animation::New(1.0f);
1069   AlphaFunction func = animation.GetDefaultAlphaFunction();
1070
1071   // Test that the default is linear
1072   DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1073
1074   animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1075   AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1076   DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1077
1078   END_TEST;
1079 }
1080
1081 int UtcDaliAnimationSetCurrentProgressP(void)
1082 {
1083   TestApplication application;
1084
1085   Actor actor = Actor::New();
1086   Stage::GetCurrent().Add(actor);
1087
1088   // Build the animation
1089   Animation animation = Animation::New(0.0f);
1090
1091   //Set duration
1092   float durationSeconds(1.0f);
1093   animation.SetDuration(durationSeconds);
1094
1095   bool signalReceived(false);
1096   AnimationFinishCheck finishCheck(signalReceived);
1097   animation.FinishedSignal().Connect(&application, finishCheck);
1098   application.SendNotification();
1099
1100   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1101   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1102
1103   // Start the animation from 40% progress
1104   animation.SetCurrentProgress( 0.4f );
1105   animation.Play();
1106
1107   application.SendNotification();
1108   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1109
1110   // We didn't expect the animation to finish yet
1111   application.SendNotification();
1112   finishCheck.CheckSignalNotReceived();
1113   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1114   DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
1115
1116   animation.Play(); // Test that calling play has no effect, when animation is already playing
1117   application.SendNotification();
1118
1119   //Set the progress to 70%
1120   animation.SetCurrentProgress( 0.7f );
1121   application.SendNotification();
1122   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 80% progress */);
1123   DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1124
1125   application.SendNotification();
1126   finishCheck.CheckSignalNotReceived();
1127   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1128   DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1129
1130   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1131   // We did expect the animation to finish
1132   application.SendNotification();
1133   finishCheck.CheckSignalReceived();
1134   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1135
1136   // Check that nothing has changed after a couple of buffer swaps
1137   application.Render(0);
1138   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1139   application.Render(0);
1140   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1141   END_TEST;
1142 }
1143
1144 int UtcDaliAnimationSetCurrentProgressN(void)
1145 {
1146   TestApplication application;
1147
1148   Actor actor = Actor::New();
1149   Stage::GetCurrent().Add(actor);
1150
1151   // Build the animation
1152   Animation animation = Animation::New(0.0f);
1153
1154   //Set duration
1155   float durationSeconds(1.0f);
1156   animation.SetDuration(durationSeconds);
1157
1158   bool signalReceived(false);
1159   AnimationFinishCheck finishCheck(signalReceived);
1160   animation.FinishedSignal().Connect(&application, finishCheck);
1161   application.SendNotification();
1162
1163   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1164   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1165
1166   //Trying to set the current cursor outside the range [0..1] is ignored
1167   animation.SetCurrentProgress( -1.0f);
1168   application.SendNotification();
1169   DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1170
1171   animation.SetCurrentProgress( 100.0f);
1172   application.SendNotification();
1173   DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1174   END_TEST;
1175 }
1176
1177 int UtcDaliAnimationGetCurrentProgressP(void)
1178 {
1179   TestApplication application;
1180
1181   Actor actor = Actor::New();
1182   Stage::GetCurrent().Add(actor);
1183
1184   // Build the animation
1185   Animation animation = Animation::New(0.0f);
1186   animation.Play();
1187
1188   //Test GetCurrentProgress return 0.0 as the duration is 0.0
1189   DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1190
1191   animation.SetCurrentProgress( 0.5f );
1192   application.SendNotification();
1193   application.Render(static_cast<unsigned int>(100.0f));
1194
1195   //Progress should still be 0.0
1196   DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1197
1198   //Set duration
1199   float durationSeconds(1.0f);
1200   animation.SetDuration(durationSeconds);
1201   application.SendNotification();
1202
1203   bool signalReceived(false);
1204   AnimationFinishCheck finishCheck(signalReceived);
1205   animation.FinishedSignal().Connect(&application, finishCheck);
1206   application.SendNotification();
1207
1208   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1209   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1210
1211   // Start the animation from 40% progress
1212   animation.SetCurrentProgress( 0.4f );
1213   animation.Play();
1214
1215   application.SendNotification();
1216   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1217
1218   // We didn't expect the animation to finish yet
1219   application.SendNotification();
1220   finishCheck.CheckSignalNotReceived();
1221   DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
1222
1223   animation.Play(); // Test that calling play has no effect, when animation is already playing
1224   application.SendNotification();
1225
1226   //Set the progress to 70%
1227   animation.SetCurrentProgress( 0.7f );
1228   application.SendNotification();
1229   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 80% progress */);
1230   DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1231
1232   application.SendNotification();
1233   finishCheck.CheckSignalNotReceived();
1234   DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1235
1236   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1237   // We did expect the animation to finish
1238   application.SendNotification();
1239   finishCheck.CheckSignalReceived();
1240   END_TEST;
1241 }
1242
1243 int UtcDaliAnimationSetSpeedFactorP1(void)
1244 {
1245   TestApplication application;
1246
1247   tet_printf("Testing that setting a speed factor of 2 takes half the time\n");
1248
1249   Actor actor = Actor::New();
1250   Stage::GetCurrent().Add(actor);
1251
1252   // Build the animation
1253   float durationSeconds(1.0f);
1254   Animation animation = Animation::New(durationSeconds);
1255
1256   const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1257   const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1258
1259   KeyFrames keyframes = KeyFrames::New();
1260   keyframes.Add( 0.0f, initialPosition);
1261   keyframes.Add( 1.0f, targetPosition );
1262   animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1263
1264   //Set speed to be x2
1265   animation.SetSpeedFactor(2.0f);
1266
1267   // Start the animation
1268   animation.Play();
1269
1270   bool signalReceived(false);
1271   AnimationFinishCheck finishCheck(signalReceived);
1272   animation.FinishedSignal().Connect(&application, finishCheck);
1273
1274   application.SendNotification();
1275   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1276
1277   // We didn't expect the animation to finish yet
1278   application.SendNotification();
1279   finishCheck.CheckSignalNotReceived();
1280   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1281
1282   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1283
1284   // We didn't expect the animation to finish yet
1285   application.SendNotification();
1286   finishCheck.CheckSignalNotReceived();
1287   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1288
1289   application.Render(static_cast<unsigned int>(durationSeconds*100.0f) + 1u/*just beyond half the duration*/);
1290
1291   // We did expect the animation to finish
1292   application.SendNotification();
1293   finishCheck.CheckSignalReceived();
1294   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1295
1296   // Check that nothing has changed after a couple of buffer swaps
1297   application.Render(0);
1298   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1299   application.Render(0);
1300   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1301
1302   END_TEST;
1303 }
1304
1305 int UtcDaliAnimationSetSpeedFactorP2(void)
1306 {
1307   TestApplication application;
1308
1309   Actor actor = Actor::New();
1310   Stage::GetCurrent().Add(actor);
1311
1312   // Build the animation
1313   float durationSeconds(1.0f);
1314   Animation animation = Animation::New(durationSeconds);
1315
1316   const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1317   const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1318
1319   KeyFrames keyframes = KeyFrames::New();
1320   keyframes.Add( 0.0f, initialPosition);
1321   keyframes.Add( 1.0f, targetPosition );
1322   animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1323
1324   tet_printf("Test -1 speed factor. Animation will play in reverse at normal speed\n");
1325   animation.SetSpeedFactor( -1.0f );
1326
1327   // Start the animation
1328   animation.Play();
1329
1330   bool signalReceived(false);
1331   AnimationFinishCheck finishCheck(signalReceived);
1332   animation.FinishedSignal().Connect(&application, finishCheck);
1333
1334   application.SendNotification();
1335   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1336
1337   // We didn't expect the animation to finish yet
1338   application.SendNotification();
1339   finishCheck.CheckSignalNotReceived();
1340   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1341
1342   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1343
1344   // We didn't expect the animation to finish yet
1345   application.SendNotification();
1346   finishCheck.CheckSignalNotReceived();
1347   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1348
1349   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1350
1351   // We didn't expect the animation to finish yet
1352   application.SendNotification();
1353   finishCheck.CheckSignalNotReceived();
1354   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1355
1356   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1357
1358   // We didn't expect the animation to finish yet
1359   application.SendNotification();
1360   finishCheck.CheckSignalNotReceived();
1361   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1362
1363   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1364
1365   // We did expect the animation to finish
1366   application.SendNotification();
1367   finishCheck.CheckSignalReceived();
1368   DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
1369
1370   // Check that nothing has changed after a couple of buffer swaps
1371   application.Render(0);
1372   DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1373   application.Render(0);
1374   DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1375
1376   END_TEST;
1377 }
1378
1379 int UtcDaliAnimationSetSpeedFactorP3(void)
1380 {
1381   TestApplication application;
1382
1383   Actor actor = Actor::New();
1384   Stage::GetCurrent().Add(actor);
1385
1386   // Build the animation
1387   float durationSeconds(1.0f);
1388   Animation animation = Animation::New(durationSeconds);
1389
1390   const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1391   const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1392
1393   KeyFrames keyframes = KeyFrames::New();
1394   keyframes.Add( 0.0f, initialPosition);
1395   keyframes.Add( 1.0f, targetPosition );
1396   animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1397
1398   bool signalReceived(false);
1399   AnimationFinishCheck finishCheck(signalReceived);
1400   animation.FinishedSignal().Connect(&application, finishCheck);
1401
1402   tet_printf("Test half speed factor. Animation will take twice the duration\n");
1403
1404   //Set speed to be half of normal speed
1405   animation.SetSpeedFactor( 0.5f );
1406
1407   // Start the animation
1408   animation.Play();
1409
1410   application.SendNotification();
1411   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1412
1413   // We didn't expect the animation to finish yet
1414   application.SendNotification();
1415   finishCheck.CheckSignalNotReceived();
1416   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), TEST_LOCATION );
1417
1418   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1419
1420   // We didn't expect the animation to finish yet
1421   application.SendNotification();
1422   finishCheck.CheckSignalNotReceived();
1423   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1424
1425   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
1426
1427   // We didn't expect the animation to finish yet
1428   application.SendNotification();
1429   finishCheck.CheckSignalNotReceived();
1430   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.3f), TEST_LOCATION );
1431
1432   application.SendNotification();
1433   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1434
1435   // We didn't expect the animation to finish yet
1436   application.SendNotification();
1437   finishCheck.CheckSignalNotReceived();
1438   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1439
1440   application.Render(static_cast<unsigned int>(durationSeconds*1200.0f) + 1u/*just beyond the animation duration*/);
1441
1442   // We did expect the animation to finish
1443   application.SendNotification();
1444   finishCheck.CheckSignalReceived();
1445   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1446
1447   // Check that nothing has changed after a couple of buffer swaps
1448   application.Render(0);
1449   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1450   application.Render(0);
1451   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1452   END_TEST;
1453 }
1454
1455
1456 int UtcDaliAnimationSetSpeedFactorP4(void)
1457 {
1458   TestApplication application;
1459
1460   Actor actor = Actor::New();
1461   Stage::GetCurrent().Add(actor);
1462
1463   // Build the animation
1464   float durationSeconds(1.0f);
1465   Animation animation = Animation::New(durationSeconds);
1466
1467   const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1468   const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1469
1470   KeyFrames keyframes = KeyFrames::New();
1471   keyframes.Add( 0.0f, initialPosition);
1472   keyframes.Add( 1.0f, targetPosition );
1473   animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1474
1475   bool signalReceived(false);
1476   AnimationFinishCheck finishCheck(signalReceived);
1477   animation.FinishedSignal().Connect(&application, finishCheck);
1478
1479   tet_printf("Test half speed factor. Animation will take twice the duration\n");
1480
1481   tet_printf("Set speed to be half of normal speed\n");
1482   tet_printf("SetSpeedFactor(0.5f)\n");
1483   animation.SetSpeedFactor( 0.5f );
1484
1485   // Start the animation
1486   animation.Play();
1487
1488   application.SendNotification();
1489   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1490
1491   // We didn't expect the animation to finish yet
1492   application.SendNotification();
1493   finishCheck.CheckSignalNotReceived();
1494   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), TEST_LOCATION );
1495
1496   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1497
1498   // We didn't expect the animation to finish yet
1499   application.SendNotification();
1500   finishCheck.CheckSignalNotReceived();
1501   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1502
1503   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
1504
1505   // We didn't expect the animation to finish yet
1506   application.SendNotification();
1507   finishCheck.CheckSignalNotReceived();
1508   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.3f), TEST_LOCATION );
1509
1510   tet_printf("Reverse direction of animation whilst playing\n");
1511   tet_printf("SetSpeedFactor(-0.5f)\n");
1512   animation.SetSpeedFactor(-0.5f);
1513
1514   application.SendNotification();
1515   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1516
1517   // We didn't expect the animation to finish yet
1518   application.SendNotification();
1519   finishCheck.CheckSignalNotReceived();
1520   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1521
1522   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1523
1524   // We didn't expect the animation to finish yet
1525   application.SendNotification();
1526   finishCheck.CheckSignalNotReceived();
1527   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), 0.0001, TEST_LOCATION );
1528
1529   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1530
1531   // We did expect the animation to finish
1532   application.SendNotification();
1533   finishCheck.CheckSignalReceived();
1534   DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
1535
1536   // Check that nothing has changed after a couple of buffer swaps
1537   application.Render(0);
1538   DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1539   application.Render(0);
1540   DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1541   END_TEST;
1542 }
1543
1544 int UtcDaliAnimationSetSpeedFactorAndRange(void)
1545 {
1546   TestApplication application;
1547
1548   const unsigned int NUM_FRAMES(15);
1549
1550   struct TestData
1551   {
1552     float startTime;
1553     float endTime;
1554     float startX;
1555     float endX;
1556     float expected[NUM_FRAMES];
1557   };
1558
1559   TestData testData[] = {
1560     // ACTOR 0
1561     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1562     /*                       |----------PlayRange---------------|                 */
1563     /*                                            | reverse                       */
1564     { 0.0f,                                                                  1.0f, // TimePeriod
1565       0.0f,                                                                100.0f, // POS
1566       {/**/                 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,  /* Loop */
1567        /**/                 30.0f, 40.0f, 50.0f, 60.0f, /* Reverse direction */
1568        /**/                               50.0f,
1569        /**/                        40.0f,
1570        /**/                 30.0f,
1571        /**/                                             70.0f,
1572        /**/                                      60.0f,
1573        /**/                               50.0f,
1574        /**/
1575       }
1576     },
1577
1578     // ACTOR 1 - Across start of range
1579     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1580     /*                       |----------PlayRange---------------|                 */
1581     /*                                            | reverse                       */
1582     {                0.2f,                0.5f,                               // TimePeriod
1583                      20.0f,               50.0f,                // POS
1584       {/**/                 30.0f, 40.0f, 50.0f, 50.0f, 50.0f,  /* Loop */
1585        /**/                 30.0f, 40.0f, 50.0f, 50.0f, /* Reverse direction @ frame #9 */
1586        /**/                               50.0f,
1587        /**/                        40.0f,
1588        /**/                 30.0f,
1589        /**/                                             50.0f,
1590        /**/                                      50.0f,
1591        /**/                               50.0f
1592       }
1593     },
1594
1595     // ACTOR 2 - Across end of range
1596     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1597     /*                       |----------PlayRange---------------|                 */
1598     /*                                            | reverse                       */
1599     {/**/                                  0.5f,                      0.9f,   // TimePeriod
1600      /**/                                 50.0f,                      90.0f,  // POS
1601      { /**/                 50.0f, 50.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1602        /**/                 50.0f, 50.0f, 50.0f, 60.0f,/* Reverse direction @ frame #9 */
1603        /**/                               50.0f,
1604        /**/                        50.0f,
1605        /**/                 50.0f,                      70.0f,
1606        /**/                                      60.0f,
1607        /**/                               50.0f,
1608       }
1609     },
1610
1611     // ACTOR 3 - Before beginning of range
1612     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1613     /*                       |----------PlayRange---------------|                 */
1614     /*                                            | reverse                       */
1615     {/**/     0.1f,      0.25f, // TimePeriod
1616      /**/     10.0f,     25.0f, // POS
1617      { /**/
1618        /**/ 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
1619        /**/
1620       }
1621     },
1622
1623     // ACTOR 4 - After end of range
1624     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1625     /*                       |----------PlayRange---------------|                 */
1626     /*                                            | reverse                       */
1627     {/**/                                                           0.85f,   1.0f, // TimePeriod
1628      /**/                                                           85.0f,  100.0f, // POS
1629      { /**/
1630        /**/ 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
1631        /**/
1632      }
1633     },
1634     // Actor 5 - Middle of range
1635     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1636     /*                       |----------PlayRange---------------|                 */
1637     /*                                            | reverse                       */
1638     {/**/                          0.4f,            0.65f, // Time Period
1639      /**/                         40.0f,            65.0f, // Position
1640      { /**/                40.0f, 40.0f, 50.0f, 60.0f, 65.0f,
1641        /**/                40.0f, 40.0f, 50.0f, 60.0f, // Reverse
1642        /**/                              50.0f,
1643        /**/                       40.0f,
1644        /**/                40.0f,
1645        /**/                                            65.0f,
1646        /**/                                      60.0f,
1647        /**/                              50.0f,
1648      }
1649     }
1650   };
1651
1652   const size_t NUM_ENTRIES(sizeof(testData)/sizeof(TestData));
1653
1654   // Build the animation
1655   float durationSeconds(1.0f);
1656   Animation animation = Animation::New(durationSeconds);
1657   bool signalReceived(false);
1658   AnimationFinishCheck finishCheck(signalReceived);
1659   animation.FinishedSignal().Connect(&application, finishCheck);
1660
1661   std::vector<Dali::Actor> actors;
1662
1663   for( unsigned int actorIndex = 0; actorIndex < NUM_ENTRIES; ++actorIndex )
1664   {
1665     Actor actor = Actor::New();
1666     actor.SetPosition( Vector3( testData[actorIndex].startX, 0, 0 ) );
1667     actors.push_back(actor);
1668     Stage::GetCurrent().Add(actor);
1669
1670     if( actorIndex == 0 || actorIndex == NUM_ENTRIES-1 )
1671     {
1672       KeyFrames keyframes = KeyFrames::New();
1673       keyframes.Add( testData[actorIndex].startTime, Vector3(testData[actorIndex].startX, 0, 0));
1674       keyframes.Add( testData[actorIndex].endTime, Vector3(testData[actorIndex].endX, 0, 0));
1675       animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1676     }
1677     else
1678     {
1679       animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( testData[actorIndex].endX, 0, 0 ), TimePeriod( testData[actorIndex].startTime, testData[actorIndex].endTime - testData[actorIndex].startTime) );
1680     }
1681   }
1682
1683   tet_printf("Test half speed factor. Animation will take twice the duration\n");
1684   tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1685   tet_printf("SetSpeedFactor(0.5f)\n");
1686   animation.SetSpeedFactor( 0.5f );
1687   animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1688   animation.SetLooping(true);
1689
1690   // Start the animation
1691   animation.Play();
1692   application.SendNotification();
1693   application.Render(0);   // Frame 0 tests initial values
1694
1695   for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1696   {
1697     unsigned int actorIndex = 0u;
1698     for( actorIndex = 0u; actorIndex < NUM_ENTRIES; ++actorIndex )
1699     {
1700       DALI_TEST_EQUALS( actors[actorIndex].GetCurrentPosition().x, testData[actorIndex].expected[frame], 0.001, TEST_LOCATION );
1701       if( ! Equals(actors[actorIndex].GetCurrentPosition().x, testData[actorIndex].expected[frame]) )
1702       {
1703         tet_printf("Failed at frame %u, actorIndex %u\n", frame, actorIndex );
1704       }
1705     }
1706
1707     if( frame == 8 )
1708     {
1709       tet_printf("Reverse direction of animation whilst playing after frame 8\n");
1710       tet_printf("SetSpeedFactor(-0.5f)\n");
1711       animation.SetSpeedFactor(-0.5f);
1712       application.SendNotification();
1713     }
1714     application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1715
1716     // We didn't expect the animation to finish yet
1717     application.SendNotification();
1718     finishCheck.CheckSignalNotReceived();
1719   }
1720
1721   END_TEST;
1722 }
1723
1724 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount01(void)
1725 {
1726   TestApplication application;
1727
1728   const unsigned int NUM_FRAMES(15);
1729
1730   struct TestData
1731   {
1732     float startTime;
1733     float endTime;
1734     float startX;
1735     float endX;
1736     float expected[NUM_FRAMES];
1737   };
1738
1739   TestData testData =
1740     // ACTOR 0
1741     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1742     /*                       |----------PlayRange---------------|                 */
1743     { 0.0f,                                                                  1.0f, // TimePeriod
1744       0.0f,                                                                100.0f, // POS
1745       {/**/                 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,  /* Loop */
1746        /**/                 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,
1747        /**/                 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,
1748        /**/
1749       }
1750     };
1751
1752
1753   // Build the animation
1754   float durationSeconds(1.0f);
1755   Animation animation = Animation::New(durationSeconds);
1756   bool signalReceived(false);
1757   AnimationFinishCheck finishCheck(signalReceived);
1758   animation.FinishedSignal().Connect(&application, finishCheck);
1759
1760   std::vector<Dali::Actor> actors;
1761
1762   Actor actor = Actor::New();
1763   actor.SetPosition( Vector3( testData.startX, 0, 0 ) );
1764   actors.push_back(actor);
1765   Stage::GetCurrent().Add(actor);
1766
1767   KeyFrames keyframes = KeyFrames::New();
1768   keyframes.Add( testData.startTime, Vector3(testData.startX, 0, 0));
1769   keyframes.Add( testData.endTime, Vector3(testData.endX, 0, 0));
1770   animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1771
1772   tet_printf("Test half speed factor. Animation will take twice the duration\n");
1773   tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1774   tet_printf("SetSpeedFactor(0.5f)\n");
1775   tet_printf("SetLoopCount(3)\n");
1776   animation.SetSpeedFactor( 0.5f );
1777   animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1778   animation.SetLoopCount(3);
1779
1780   // Start the animation
1781   animation.Play();
1782   application.SendNotification();
1783   application.Render(0);   // Frame 0 tests initial values
1784
1785   for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1786   {
1787     DALI_TEST_EQUALS( actor.GetCurrentPosition().x, testData.expected[frame], 0.001, TEST_LOCATION );
1788
1789     application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1790
1791     if( frame < NUM_FRAMES-1 )
1792     {
1793       // We didn't expect the animation to finish yet
1794       application.SendNotification();
1795       finishCheck.CheckSignalNotReceived();
1796     }
1797   }
1798
1799   // We did expect the animation to finish
1800   application.SendNotification();
1801   finishCheck.CheckSignalReceived();
1802   DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 80.0f, 0.001, TEST_LOCATION );
1803
1804   END_TEST;
1805 }
1806
1807 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount02(void)
1808 {
1809   TestApplication application;
1810
1811   const unsigned int NUM_FRAMES(15);
1812
1813   struct TestData
1814   {
1815     float startTime;
1816     float endTime;
1817     float startX;
1818     float endX;
1819     float expected[NUM_FRAMES];
1820   };
1821
1822   TestData testData =
1823     // ACTOR 0
1824     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1825     /*                       |----------PlayRange---------------|                 */
1826     { 0.0f,                                                                  1.0f, // TimePeriod
1827       0.0f,                                                                100.0f, // POS
1828       {/**/                 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1829        /**/                 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1830        /**/                 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1831       }
1832     };
1833
1834
1835   // Build the animation
1836   float durationSeconds(1.0f);
1837   Animation animation = Animation::New(durationSeconds);
1838   bool signalReceived(false);
1839   AnimationFinishCheck finishCheck(signalReceived);
1840   animation.FinishedSignal().Connect(&application, finishCheck);
1841
1842   std::vector<Dali::Actor> actors;
1843
1844   Actor actor = Actor::New();
1845   actor.SetPosition( Vector3( testData.startX, 0, 0 ) );
1846   actors.push_back(actor);
1847   Stage::GetCurrent().Add(actor);
1848
1849   KeyFrames keyframes = KeyFrames::New();
1850   keyframes.Add( testData.startTime, Vector3(testData.startX, 0, 0));
1851   keyframes.Add( testData.endTime, Vector3(testData.endX, 0, 0));
1852   animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1853
1854   tet_printf("Test reverse half speed factor. Animation will take twice the duration\n");
1855   tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1856   tet_printf("SetSpeedFactor(-0.5f)\n");
1857   tet_printf("SetLoopCount(3)\n");
1858   animation.SetSpeedFactor( -0.5f );
1859   animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1860   animation.SetLoopCount(3);
1861
1862   // Start the animation
1863   animation.Play();
1864   application.SendNotification();
1865   application.Render(0);   // Frame 0 tests initial values
1866
1867   for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1868   {
1869     DALI_TEST_EQUALS( actor.GetCurrentPosition().x, testData.expected[frame], 0.001, TEST_LOCATION );
1870
1871     application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1872
1873     if( frame < NUM_FRAMES-1 )
1874     {
1875       // We didn't expect the animation to finish yet
1876       application.SendNotification();
1877       finishCheck.CheckSignalNotReceived();
1878     }
1879   }
1880
1881   // We did expect the animation to finish
1882   application.SendNotification();
1883   finishCheck.CheckSignalReceived();
1884   DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 30.0f, 0.001, TEST_LOCATION );
1885
1886   END_TEST;
1887 }
1888
1889
1890 int UtcDaliAnimationGetSpeedFactorP(void)
1891 {
1892   TestApplication application;
1893
1894   Animation animation = Animation::New(1.0f);
1895   animation.SetSpeedFactor(0.5f);
1896   DALI_TEST_EQUALS(animation.GetSpeedFactor(), 0.5f, TEST_LOCATION);
1897
1898   animation.SetSpeedFactor(-2.5f);
1899   DALI_TEST_EQUALS(animation.GetSpeedFactor(), -2.5f, TEST_LOCATION);
1900   END_TEST;
1901 }
1902
1903 int UtcDaliAnimationSetPlayRangeP(void)
1904 {
1905   TestApplication application;
1906
1907   Actor actor = Actor::New();
1908   Stage::GetCurrent().Add( actor );
1909
1910   // Build the animation
1911   float durationSeconds( 1.0f );
1912   Animation animation = Animation::New( durationSeconds );
1913
1914   bool signalReceived( false );
1915   AnimationFinishCheck finishCheck( signalReceived );
1916   animation.FinishedSignal().Connect( &application, finishCheck );
1917   application.SendNotification();
1918
1919   // Set range between 0.4 and 0.8
1920   animation.SetPlayRange( Vector2( 0.4f, 0.9f ) );
1921   application.SendNotification();
1922   DALI_TEST_EQUALS( Vector2( 0.4f, 0.9f ), animation.GetPlayRange(), TEST_LOCATION );
1923
1924   Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
1925   animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR );
1926
1927   // Start the animation from 40% progress
1928   animation.Play();
1929
1930   application.SendNotification();
1931   application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 60% progress */ );
1932
1933   // We didn't expect the animation to finish yet
1934   application.SendNotification();
1935   finishCheck.CheckSignalNotReceived();
1936   DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.6f ), TEST_LOCATION );
1937
1938   application.SendNotification();
1939   application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 80% progress */ );
1940
1941   application.SendNotification();
1942   finishCheck.CheckSignalNotReceived();
1943   DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.8f ), TEST_LOCATION );
1944
1945   application.SendNotification();
1946   application.Render( static_cast< unsigned int >( durationSeconds*100.0f ) + 1u/*just beyond the animation duration*/ );
1947
1948   // We did expect the animation to finish
1949   application.SendNotification();
1950   finishCheck.CheckSignalReceived();
1951   DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.9f ), TEST_LOCATION );
1952   END_TEST;
1953 }
1954
1955 int UtcDaliAnimationSetPlayRangeN(void)
1956 {
1957   TestApplication application;
1958
1959   Actor actor = Actor::New();
1960   Stage::GetCurrent().Add(actor);
1961
1962   // Build the animation
1963   Animation animation = Animation::New(0);
1964   application.SendNotification();
1965
1966   //PlayRange out of bounds
1967   animation.SetPlayRange( Vector2(-1.0f,1.0f) );
1968   application.SendNotification();
1969   DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
1970   animation.SetPlayRange( Vector2(0.0f,2.0f) );
1971   application.SendNotification();
1972   DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
1973
1974   //If playRange is not in the correct order it has to be ordered
1975   animation.SetPlayRange( Vector2(0.8f,0.2f) );
1976   application.SendNotification();
1977   DALI_TEST_EQUALS( Vector2(0.2f,0.8f), animation.GetPlayRange(), TEST_LOCATION );
1978
1979   END_TEST;
1980 }
1981
1982 int UtcDaliAnimationGetPlayRangeP(void)
1983 {
1984   TestApplication application;
1985
1986   Actor actor = Actor::New();
1987   Stage::GetCurrent().Add( actor );
1988
1989   // Build the animation
1990   Animation animation = Animation::New( 1.0f );
1991   application.SendNotification();
1992
1993   //If PlayRange not specified it should be 0.0-1.0 by default
1994   DALI_TEST_EQUALS( Vector2( 0.0f,1.0f ), animation.GetPlayRange(), TEST_LOCATION );
1995
1996   // Set range between 0.4 and 0.8
1997   animation.SetPlayRange( Vector2( 0.4f, 0.8f ) );
1998   application.SendNotification();
1999   DALI_TEST_EQUALS( Vector2( 0.4f, 0.8f ), animation.GetPlayRange(), TEST_LOCATION );
2000
2001   END_TEST;
2002 }
2003
2004 int UtcDaliAnimationPlayP(void)
2005 {
2006   TestApplication application;
2007
2008   Actor actor = Actor::New();
2009   Stage::GetCurrent().Add(actor);
2010
2011   // Build the animation
2012   float durationSeconds(1.0f);
2013   Animation animation = Animation::New(durationSeconds);
2014   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2015   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2016
2017   // Start the animation
2018   animation.Play();
2019
2020   bool signalReceived(false);
2021   AnimationFinishCheck finishCheck(signalReceived);
2022   animation.FinishedSignal().Connect(&application, finishCheck);
2023
2024   application.SendNotification();
2025   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2026
2027   // We didn't expect the animation to finish yet
2028   application.SendNotification();
2029   finishCheck.CheckSignalNotReceived();
2030   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2031
2032   animation.Play(); // Test that calling play has no effect, when animation is already playing
2033   application.SendNotification();
2034   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2035
2036   // We didn't expect the animation to finish yet
2037   application.SendNotification();
2038   finishCheck.CheckSignalNotReceived();
2039   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
2040
2041   animation.Play(); // Test that calling play has no effect, when animation is already playing
2042   application.SendNotification();
2043   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2044
2045   // We didn't expect the animation to finish yet
2046   application.SendNotification();
2047   finishCheck.CheckSignalNotReceived();
2048   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2049
2050   animation.Play(); // Test that calling play has no effect, when animation is already playing
2051   application.SendNotification();
2052   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2053
2054   // We didn't expect the animation to finish yet
2055   application.SendNotification();
2056   finishCheck.CheckSignalNotReceived();
2057   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2058
2059   animation.Play(); // Test that calling play has no effect, when animation is already playing
2060   application.SendNotification();
2061   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2062
2063   // We did expect the animation to finish
2064   application.SendNotification();
2065   finishCheck.CheckSignalReceived();
2066   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2067
2068   // Check that nothing has changed after a couple of buffer swaps
2069   application.Render(0);
2070   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2071   application.Render(0);
2072   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2073   END_TEST;
2074 }
2075
2076 int UtcDaliAnimationPlayOffStageDiscardP(void)
2077 {
2078   // Test that an animation can be played, when the actor is off-stage.
2079   // When the actor is added to the stage, it should appear at the current position
2080   // i.e. where it would have been anyway, if on-stage from the beginning.
2081
2082   TestApplication application;
2083
2084   Actor actor = Actor::New();
2085   Vector3 basePosition(Vector3::ZERO);
2086   DALI_TEST_EQUALS( actor.GetCurrentPosition(), basePosition, TEST_LOCATION );
2087   // Not added to the stage yet!
2088
2089   // Build the animation
2090   float durationSeconds(1.0f);
2091   Animation animation = Animation::New(durationSeconds);
2092   animation.SetDisconnectAction( Animation::Discard );
2093   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2094   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2095
2096   // Start the animation
2097   animation.Play();
2098
2099   bool signalReceived(false);
2100   AnimationFinishCheck finishCheck(signalReceived);
2101   animation.FinishedSignal().Connect(&application, finishCheck);
2102
2103   application.SendNotification();
2104   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2105
2106   // We didn't expect the animation to finish yet
2107   application.SendNotification();
2108   finishCheck.CheckSignalNotReceived();
2109   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(20,20,20), TEST_LOCATION );
2110
2111   // Add to the stage
2112   Stage::GetCurrent().Add(actor);
2113
2114   application.SendNotification();
2115   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2116
2117   // We didn't expect the animation to finish yet
2118   application.SendNotification();
2119   finishCheck.CheckSignalNotReceived();
2120   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(40,40,40)/*on-stage*/, TEST_LOCATION );
2121
2122   // Remove from the stage
2123   Stage::GetCurrent().Remove(actor);
2124
2125   application.SendNotification();
2126   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2127
2128   // We didn't expect the animation to finish yet
2129   application.SendNotification();
2130   finishCheck.CheckSignalNotReceived();
2131   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*back to start position as disconnect behaviour is discard*/, TEST_LOCATION );
2132   // Check that nothing has changed after a couple of buffer swaps
2133   application.Render(0);
2134   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
2135   application.Render(0);
2136   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
2137   application.Render(0);
2138   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
2139
2140   // Add to the stage
2141   Stage::GetCurrent().Add(actor);
2142
2143   application.SendNotification();
2144   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2145
2146   // We didn't expect the animation to finish yet
2147   application.SendNotification();
2148   finishCheck.CheckSignalNotReceived();
2149   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(80,80,80), TEST_LOCATION );
2150
2151   application.SendNotification();
2152   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2153
2154   // We did expect the animation to finish
2155   application.SendNotification();
2156   finishCheck.CheckSignalReceived();
2157   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2158
2159   // Check that nothing has changed after a couple of buffer swaps
2160   application.Render(0);
2161   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2162
2163
2164   application.Render(0);
2165   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2166   END_TEST;
2167 }
2168
2169 int UtcDaliAnimationPlayOffStageBakeFinalP(void)
2170 {
2171   // Test that an animation can be played, when the actor is off-stage.
2172   // When the actor is added to the stage, it should appear at the current position
2173   // i.e. where it would have been anyway, if on-stage from the beginning.
2174
2175   TestApplication application;
2176
2177   Actor actor = Actor::New();
2178   Vector3 basePosition(Vector3::ZERO);
2179   DALI_TEST_EQUALS( actor.GetCurrentPosition(), basePosition, TEST_LOCATION );
2180   // Not added to the stage!
2181
2182   // Build the animation
2183   float durationSeconds(1.0f);
2184   Animation animation = Animation::New(durationSeconds);
2185   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2186   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2187
2188   // Start the animation
2189   animation.Play();
2190
2191   bool signalReceived(false);
2192   AnimationFinishCheck finishCheck(signalReceived);
2193   animation.FinishedSignal().Connect(&application, finishCheck);
2194
2195   application.SendNotification();
2196   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2197
2198   // We didn't expect the animation to finish yet
2199   application.SendNotification();
2200   finishCheck.CheckSignalNotReceived();
2201   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(20,20,20), TEST_LOCATION );
2202
2203   // Add to the stage
2204   Stage::GetCurrent().Add(actor);
2205
2206   application.SendNotification();
2207   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2208
2209   // We didn't expect the animation to finish yet
2210   application.SendNotification();
2211   finishCheck.CheckSignalNotReceived();
2212   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(40,40,40)/*on-stage*/, TEST_LOCATION );
2213
2214   // Remove from the stage
2215   Stage::GetCurrent().Remove(actor);
2216
2217   application.SendNotification();
2218   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2219
2220   // We didn't expect the animation to finish yet
2221   application.SendNotification();
2222   finishCheck.CheckSignalNotReceived();
2223   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition /*bake final*/, TEST_LOCATION );
2224
2225   // Add to the stage
2226   Stage::GetCurrent().Add(actor);
2227
2228   application.SendNotification();
2229   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2230
2231   // We didn't expect the animation to finish yet
2232   application.SendNotification();
2233   finishCheck.CheckSignalNotReceived();
2234   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition /*bake final removed the */, TEST_LOCATION );
2235
2236   application.SendNotification();
2237   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2238
2239   // We did expect the animation to finish
2240   application.SendNotification();
2241   finishCheck.CheckSignalReceived();
2242   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2243
2244   // Check that nothing has changed after a couple of buffer swaps
2245   application.Render(0);
2246   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2247
2248   application.Render(0);
2249   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2250   END_TEST;
2251 }
2252
2253 int UtcDaliAnimationPlayOffStageBakeP(void)
2254 {
2255   // Test that an animation can be played, when the actor is off-stage.
2256   // When the actor is added to the stage, it should appear at the current position
2257   // i.e. where it would have been anyway, if on-stage from the beginning.
2258
2259   TestApplication application;
2260
2261   Actor actor = Actor::New();
2262   Vector3 basePosition(Vector3::ZERO);
2263   DALI_TEST_EQUALS( actor.GetCurrentPosition(), basePosition, TEST_LOCATION );
2264   // Not added to the stage!
2265
2266   // Build the animation
2267   float durationSeconds(1.0f);
2268   Animation animation = Animation::New(durationSeconds);
2269   animation.SetDisconnectAction( Animation::Bake );
2270   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2271   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2272
2273   // Start the animation
2274   animation.Play();
2275
2276   bool signalReceived(false);
2277   AnimationFinishCheck finishCheck(signalReceived);
2278   animation.FinishedSignal().Connect(&application, finishCheck);
2279
2280   application.SendNotification();
2281   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2282
2283   // We didn't expect the animation to finish yet
2284   application.SendNotification();
2285   finishCheck.CheckSignalNotReceived();
2286   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(20,20,20), TEST_LOCATION );
2287
2288   // Add to the stage
2289   Stage::GetCurrent().Add(actor);
2290
2291   application.SendNotification();
2292   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2293
2294   // We didn't expect the animation to finish yet
2295   application.SendNotification();
2296   finishCheck.CheckSignalNotReceived();
2297   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(40,40,40)/*on-stage*/, TEST_LOCATION );
2298
2299   // Remove from the stage
2300   Stage::GetCurrent().Remove(actor); // baked here
2301
2302   application.SendNotification();
2303   // this render is a no-op in this case as animator is disabled while off stage
2304   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2305   // We didn't expect the animation to finish yet
2306   application.SendNotification();
2307   finishCheck.CheckSignalNotReceived();
2308   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(40,40,40) /*baked value*/, TEST_LOCATION );
2309
2310   // Add back to the stage
2311   Stage::GetCurrent().Add(actor);
2312
2313   application.SendNotification();
2314   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2315   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(88,88,88) /* animation restarted at 40,40,40 + 80%*60 */, TEST_LOCATION );
2316   application.Render(static_cast<unsigned int>(0.0f) );
2317   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
2318   application.Render(static_cast<unsigned int>(0.0f) );
2319   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
2320
2321   // Remove from the stage
2322   Stage::GetCurrent().Remove(actor); // baked here
2323
2324   application.SendNotification();
2325   // this render is a no-op in this case as animator is disabled while off stage
2326   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 100% progress */);
2327   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
2328   application.Render(static_cast<unsigned int>(0.0f) );
2329   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
2330   application.Render(static_cast<unsigned int>(0.0f) );
2331   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
2332
2333   // Add back to the stage
2334   Stage::GetCurrent().Add(actor);
2335
2336   // We didn't expect the animation to finish yet
2337   application.SendNotification();
2338   finishCheck.CheckSignalNotReceived();
2339   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(88,88,88) , TEST_LOCATION );
2340
2341   application.SendNotification();
2342   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2343
2344   // We did expect the animation to finish
2345   application.SendNotification();
2346   finishCheck.CheckSignalReceived();
2347   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2348
2349   // Check that nothing has changed after a couple of buffer swaps
2350   application.Render(0);
2351   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2352
2353   application.Render(0);
2354   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2355   END_TEST;
2356 }
2357
2358 int UtcDaliAnimationPlayDiscardHandleP(void)
2359 {
2360   TestApplication application;
2361
2362   Actor actor = Actor::New();
2363   Stage::GetCurrent().Add(actor);
2364
2365   // Build the animation
2366   float durationSeconds(1.0f);
2367   Animation animation = Animation::New(durationSeconds);
2368   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2369   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2370
2371   bool signalReceived(false);
2372   AnimationFinishCheck finishCheck(signalReceived);
2373   animation.FinishedSignal().Connect(&application, finishCheck);
2374
2375   // Start the animation
2376   animation.Play();
2377
2378   // This is a test of the "Fire and Forget" behaviour
2379   // Discard the animation handle!
2380   animation.Reset();
2381   DALI_TEST_CHECK( !animation );
2382
2383   application.SendNotification();
2384   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2385
2386   // We didn't expect the animation to finish yet
2387   application.SendNotification();
2388   finishCheck.CheckSignalNotReceived();
2389   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2390
2391   application.SendNotification();
2392   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2393
2394   // We didn't expect the animation to finish yet
2395   application.SendNotification();
2396   finishCheck.CheckSignalNotReceived();
2397   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
2398
2399   application.SendNotification();
2400   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2401
2402   // We didn't expect the animation to finish yet
2403   application.SendNotification();
2404   finishCheck.CheckSignalNotReceived();
2405   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2406
2407   application.SendNotification();
2408   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2409
2410   // We didn't expect the animation to finish yet
2411   application.SendNotification();
2412   finishCheck.CheckSignalNotReceived();
2413   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2414
2415   application.SendNotification();
2416   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2417
2418   // We did expect the animation to finish
2419   application.SendNotification();
2420   finishCheck.CheckSignalReceived();
2421   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2422
2423   // Check that nothing has changed after a couple of buffer swaps
2424   application.Render(0);
2425   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2426   application.Render(0);
2427   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2428   END_TEST;
2429 }
2430
2431 int UtcDaliAnimationPlayStopDiscardHandleP(void)
2432 {
2433   TestApplication application;
2434
2435   Actor actor = Actor::New();
2436   Stage::GetCurrent().Add(actor);
2437
2438   // Build the animation
2439   float durationSeconds(1.0f);
2440   Animation animation = Animation::New(durationSeconds);
2441   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2442   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2443
2444   // Start the animation
2445   animation.Play();
2446
2447   bool signalReceived(false);
2448   AnimationFinishCheck finishCheck(signalReceived);
2449   animation.FinishedSignal().Connect(&application, finishCheck);
2450
2451   application.SendNotification();
2452   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2453
2454   // We didn't expect the animation to finish yet
2455   application.SendNotification();
2456   finishCheck.CheckSignalNotReceived();
2457   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2458
2459   // This is a test of the "Fire and Forget" behaviour
2460   // Stop the animation, and Discard the animation handle!
2461   animation.Stop();
2462   animation.Reset();
2463   DALI_TEST_CHECK( !animation );
2464
2465   application.SendNotification();
2466   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2467
2468   // We expect the animation to finish at 20% progress
2469   application.SendNotification();
2470   finishCheck.CheckSignalReceived();
2471   finishCheck.Reset();
2472   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2473
2474   application.SendNotification();
2475   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2476
2477   // Check that nothing has changed
2478   application.SendNotification();
2479   finishCheck.CheckSignalNotReceived();
2480   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2481
2482   application.SendNotification();
2483   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2484
2485   // Check that nothing has changed
2486   application.SendNotification();
2487   finishCheck.CheckSignalNotReceived();
2488   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2489
2490   application.SendNotification();
2491   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 100% progress */);
2492
2493   // Check that nothing has changed
2494   application.SendNotification();
2495   finishCheck.CheckSignalNotReceived();
2496   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2497   END_TEST;
2498 }
2499
2500 int UtcDaliAnimationPlayRangeP(void)
2501 {
2502   TestApplication application;
2503
2504   Actor actor = Actor::New();
2505   Stage::GetCurrent().Add(actor);
2506
2507   // Build the animation
2508   float durationSeconds(1.0f);
2509   Animation animation = Animation::New(durationSeconds);
2510   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2511   KeyFrames keyframes = KeyFrames::New();
2512   keyframes.Add( 0.0f , Vector3(0.0f,0.0f,0.0f ) );
2513   keyframes.Add( 1.0f , Vector3(100.0f,100.0f,100.0f ) );
2514
2515   animation.AnimateBetween( Property( actor, Actor::Property::POSITION), keyframes );
2516
2517   // Set range between 0.4 and 0.8
2518   animation.SetPlayRange( Vector2(0.4f,0.8f) );
2519   animation.Play();
2520
2521   bool signalReceived(false);
2522   AnimationFinishCheck finishCheck(signalReceived);
2523   animation.FinishedSignal().Connect(&application, finishCheck);
2524
2525   //Test that setting progress outside the range doesn't work
2526   animation.SetCurrentProgress( 0.9f );
2527   application.SendNotification();
2528   application.Render(0);
2529   DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
2530   animation.SetCurrentProgress( 0.2f );
2531   application.SendNotification();
2532   application.Render(0);
2533   DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
2534
2535   application.SendNotification();
2536   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2537
2538   // We didn't expect the animation to finish yet
2539   application.SendNotification();
2540   finishCheck.CheckSignalNotReceived();
2541   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2542
2543   animation.Play(); // Test that calling play has no effect, when animation is already playing
2544   application.SendNotification();
2545   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/* 80% progress */);
2546
2547   // We did expect the animation to finish
2548   application.SendNotification();
2549   finishCheck.CheckSignalReceived();
2550   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2551
2552   // Check that nothing has changed after a couple of buffer swaps
2553   application.Render(0);
2554   DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentPosition(), TEST_LOCATION );
2555   application.Render(0);
2556   DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentPosition(), TEST_LOCATION );
2557
2558
2559   //Loop inside the range
2560   finishCheck.Reset();
2561   animation.SetLooping( true );
2562   animation.Play();
2563   application.SendNotification();
2564   float intervalSeconds = 0.1f;
2565   float progress = 0.4f;
2566   for (int iterations = 0; iterations < 10; ++iterations )
2567   {
2568     application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
2569
2570     progress += intervalSeconds;
2571     if (progress > 0.8f)
2572     {
2573       progress = progress - 0.4f;
2574     }
2575
2576     DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
2577   }
2578
2579   // We didn't expect the animation to finish yet
2580   application.SendNotification();
2581   finishCheck.CheckSignalNotReceived();
2582
2583
2584   //Test change range on the fly
2585   animation.SetPlayRange( Vector2( 0.2f, 0.9f ) );
2586   application.SendNotification();
2587
2588   for (int iterations = 0; iterations < 10; ++iterations )
2589   {
2590     application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
2591
2592     progress += intervalSeconds;
2593     if (progress > 0.9f)
2594     {
2595       progress = progress - 0.7f;
2596     }
2597
2598     DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
2599   }
2600
2601   END_TEST;
2602 }
2603
2604 int UtcDaliAnimationPlayFromP(void)
2605 {
2606   TestApplication application;
2607
2608   Actor actor = Actor::New();
2609   Stage::GetCurrent().Add(actor);
2610
2611   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
2612
2613   // Build the animation
2614   float durationSeconds(1.0f);
2615   Animation animation = Animation::New(durationSeconds);
2616   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2617   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2618
2619   // Start the animation from 40% progress
2620   animation.PlayFrom( 0.4f );
2621
2622   // Target value should be updated straight away
2623   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
2624
2625   bool signalReceived(false);
2626   AnimationFinishCheck finishCheck(signalReceived);
2627   animation.FinishedSignal().Connect(&application, finishCheck);
2628
2629   application.SendNotification();
2630   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2631
2632   // We didn't expect the animation to finish yet
2633   application.SendNotification();
2634   finishCheck.CheckSignalNotReceived();
2635   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2636
2637   animation.Play(); // Test that calling play has no effect, when animation is already playing
2638   application.SendNotification();
2639   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2640
2641   // We didn't expect the animation to finish yet
2642   application.SendNotification();
2643   finishCheck.CheckSignalNotReceived();
2644   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2645
2646   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2647   // We did expect the animation to finish
2648   application.SendNotification();
2649   finishCheck.CheckSignalReceived();
2650   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2651
2652   // Check that nothing has changed after a couple of buffer swaps
2653   application.Render(0);
2654   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2655   application.Render(0);
2656   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2657   END_TEST;
2658 }
2659
2660 int UtcDaliAnimationPlayFromN(void)
2661 {
2662   TestApplication application;
2663
2664   Actor actor = Actor::New();
2665   Stage::GetCurrent().Add(actor);
2666
2667   // Build the animation
2668   float durationSeconds(1.0f);
2669   Animation animation = Animation::New(durationSeconds);
2670   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2671   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2672
2673   //PlayFrom with an argument outside the range [0..1] will be ignored
2674   animation.PlayFrom(-1.0f);
2675   application.SendNotification();
2676   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
2677
2678   animation.PlayFrom(100.0f);
2679   application.SendNotification();
2680   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
2681   END_TEST;
2682 }
2683
2684 int UtcDaliAnimationPauseP(void)
2685 {
2686   TestApplication application;
2687
2688   Actor actor = Actor::New();
2689   Stage::GetCurrent().Add(actor);
2690
2691   // Build the animation
2692   float durationSeconds(1.0f);
2693   Animation animation = Animation::New(durationSeconds);
2694   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2695   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2696
2697   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2698
2699   // Start the animation
2700   animation.Play();
2701
2702   bool signalReceived(false);
2703   AnimationFinishCheck finishCheck(signalReceived);
2704   animation.FinishedSignal().Connect(&application, finishCheck);
2705
2706   application.SendNotification();
2707   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2708
2709   // We didn't expect the animation to finish yet
2710   application.SendNotification();
2711   finishCheck.CheckSignalNotReceived();
2712   DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2713
2714   // Pause the animation
2715   animation.Pause();
2716   application.SendNotification();
2717
2718   // Loop 5 times
2719   for (int i=0; i<5; ++i)
2720   {
2721     application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2722
2723     // We didn't expect the animation to finish yet
2724     application.SendNotification();
2725     finishCheck.CheckSignalNotReceived();
2726     DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
2727   }
2728
2729   // Keep going
2730   animation.Play();
2731   application.SendNotification();
2732   application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2733
2734   // We didn't expect the animation to finish yet
2735   application.SendNotification();
2736   finishCheck.CheckSignalNotReceived();
2737
2738   application.SendNotification();
2739   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2740
2741   // We did expect the animation to finish
2742   application.SendNotification();
2743   finishCheck.CheckSignalReceived();
2744   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2745
2746   // Check that nothing has changed after a couple of buffer swaps
2747   application.Render(0);
2748   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2749   application.Render(0);
2750   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2751   END_TEST;
2752 }
2753
2754
2755 int UtcDaliAnimationGetStateP(void)
2756 {
2757   TestApplication application;
2758
2759   Actor actor = Actor::New();
2760   Stage::GetCurrent().Add(actor);
2761
2762   // Build the animation
2763   float durationSeconds(1.0f);
2764   Animation animation = Animation::New(durationSeconds);
2765   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2766   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2767   DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2768
2769   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2770
2771   // Start the animation
2772   animation.Play();
2773
2774   DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2775
2776   bool signalReceived(false);
2777   AnimationFinishCheck finishCheck(signalReceived);
2778   animation.FinishedSignal().Connect(&application, finishCheck);
2779
2780   application.SendNotification();
2781   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2782
2783   // We didn't expect the animation to finish yet
2784   application.SendNotification();
2785   finishCheck.CheckSignalNotReceived();
2786   DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2787   DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2788
2789   // Pause the animation
2790   animation.Pause();
2791   DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
2792   application.SendNotification();
2793   application.Render(0.f);
2794
2795   // Loop 5 times
2796   for (int i=0; i<5; ++i)
2797   {
2798     application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2799
2800     // We didn't expect the animation to finish yet
2801     application.SendNotification();
2802     finishCheck.CheckSignalNotReceived();
2803     DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
2804     DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
2805   }
2806
2807   // Keep going
2808   finishCheck.Reset();
2809   animation.Play();
2810   DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2811   application.SendNotification();
2812   application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2813   // We didn't expect the animation to finish yet
2814   application.SendNotification();
2815   finishCheck.CheckSignalNotReceived();
2816   DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2817
2818   application.SendNotification();
2819   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2820
2821   // We did expect the animation to finish
2822   application.SendNotification();
2823   finishCheck.CheckSignalReceived();
2824   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2825   DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2826
2827   // Check that nothing has changed after a couple of buffer swaps
2828   application.Render(0);
2829   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2830   application.Render(0);
2831   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2832   DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2833
2834   // re-play
2835   finishCheck.Reset();
2836   animation.Play();
2837   DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2838   application.SendNotification();
2839   application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2840   application.SendNotification();
2841   finishCheck.CheckSignalNotReceived();
2842   DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2843
2844
2845   END_TEST;
2846 }
2847
2848 int UtcDaliAnimationStopP(void)
2849 {
2850   TestApplication application;
2851
2852   Actor actor = Actor::New();
2853   Stage::GetCurrent().Add(actor);
2854
2855   // Build the animation
2856   float durationSeconds(1.0f);
2857   Animation animation = Animation::New(durationSeconds);
2858   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2859   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2860
2861   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2862
2863   // Start the animation
2864   animation.Play();
2865
2866   bool signalReceived(false);
2867   AnimationFinishCheck finishCheck(signalReceived);
2868   animation.FinishedSignal().Connect(&application, finishCheck);
2869
2870   application.SendNotification();
2871   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2872
2873   // We didn't expect the animation to finish yet
2874   application.SendNotification();
2875   finishCheck.CheckSignalNotReceived();
2876   DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2877
2878   // Stop the animation
2879   animation.Stop();
2880   application.SendNotification();
2881
2882   // Loop 5 times
2883   for (int i=0; i<5; ++i)
2884   {
2885     application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2886
2887     // We did expect the animation to finish
2888     application.SendNotification();
2889     finishCheck.CheckSignalReceived();
2890     DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when stopped */, TEST_LOCATION );
2891   }
2892   END_TEST;
2893 }
2894
2895 int UtcDaliAnimationStopSetPositionP(void)
2896 {
2897   // Test that Animation::Stop & Actor::SetPosition can be used in conjunction
2898   // i.e. to check that the animation does not interfere with the position set.
2899
2900   TestApplication application;
2901
2902   Actor actor = Actor::New();
2903   Stage::GetCurrent().Add(actor);
2904
2905   // Build the animation
2906   float durationSeconds(1.0f);
2907   Animation animation = Animation::New(durationSeconds);
2908   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2909   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2910
2911   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2912
2913   // Start the animation
2914   animation.Play();
2915
2916   bool signalReceived(false);
2917   AnimationFinishCheck finishCheck(signalReceived);
2918   animation.FinishedSignal().Connect(&application, finishCheck);
2919
2920   application.SendNotification();
2921   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2922
2923   // We didn't expect the animation to finish yet
2924   application.SendNotification();
2925   finishCheck.CheckSignalNotReceived();
2926   DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2927
2928   // Stop the animation
2929   animation.Stop();
2930   Vector3 positionSet(2.0f, 3.0f, 4.0f);
2931   actor.SetPosition(positionSet);
2932   application.SendNotification();
2933
2934   // Loop 5 times
2935   for (int i=0; i<5; ++i)
2936   {
2937     application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2938
2939     // We did expect the animation to finish
2940     application.SendNotification();
2941     finishCheck.CheckSignalReceived();
2942     DALI_TEST_EQUALS( actor.GetCurrentPosition(), positionSet/*Animation should not interfere with this*/, TEST_LOCATION );
2943   }
2944   END_TEST;
2945 }
2946
2947 int UtcDaliAnimationClearP(void)
2948 {
2949   TestApplication application;
2950
2951   Actor actor = Actor::New();
2952   Stage::GetCurrent().Add(actor);
2953
2954   // Build the animation
2955   float durationSeconds(1.0f);
2956   Animation animation = Animation::New(durationSeconds);
2957   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2958   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2959
2960   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2961
2962   // Start the animation
2963   animation.Play();
2964
2965   bool signalReceived(false);
2966   AnimationFinishCheck finishCheck(signalReceived);
2967   animation.FinishedSignal().Connect(&application, finishCheck);
2968
2969   application.SendNotification();
2970   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2971
2972   // We didn't expect the animation to finish yet
2973   application.SendNotification();
2974   finishCheck.CheckSignalNotReceived();
2975   DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2976
2977   // Clear the animation
2978   animation.Clear();
2979   application.SendNotification();
2980
2981   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2982
2983   // We don't expect the animation to finish now
2984   application.SendNotification();
2985   finishCheck.CheckSignalNotReceived();
2986   DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress since the animator was destroyed */, TEST_LOCATION );
2987
2988   // Restart as a scale animation; this should not move the actor's position
2989   finishCheck.Reset();
2990   actor.SetPosition(Vector3::ZERO);
2991   Vector3 targetScale(3.0f, 3.0f, 3.0f);
2992   animation.AnimateTo( Property( actor, Actor::Property::SCALE ), targetScale, AlphaFunction::LINEAR );
2993   animation.Play();
2994
2995   application.SendNotification();
2996   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2997
2998   // We didn't expect the animation to finish yet
2999   application.SendNotification();
3000   finishCheck.CheckSignalNotReceived();
3001   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
3002   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION );
3003
3004   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
3005
3006   // We did expect the animation to finish
3007   application.SendNotification();
3008   finishCheck.CheckSignalReceived();
3009   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
3010   DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
3011   END_TEST;
3012 }
3013
3014 int UtcDaliAnimationFinishedSignalP(void)
3015 {
3016   TestApplication application;
3017
3018   // Start the empty animation
3019   float durationSeconds(1.0f);
3020   Animation animation = Animation::New(durationSeconds);
3021   animation.Play();
3022
3023   bool signalReceived(false);
3024   AnimationFinishCheck finishCheck(signalReceived);
3025   animation.FinishedSignal().Connect(&application, finishCheck);
3026
3027   application.SendNotification();
3028   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*beyond the animation duration*/);
3029
3030   // We did expect the animation to finish
3031   application.SendNotification();
3032   finishCheck.CheckSignalReceived();
3033   END_TEST;
3034 }
3035
3036 int UtcDaliAnimationAnimateByBooleanP(void)
3037 {
3038   TestApplication application;
3039
3040   Actor actor = Actor::New();
3041
3042   // Register a boolean property
3043   bool startValue(false);
3044   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3045   Stage::GetCurrent().Add(actor);
3046   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3047   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3048
3049   // Build the animation
3050   float durationSeconds(2.0f);
3051   Animation animation = Animation::New(durationSeconds);
3052   const bool relativeValue(true);
3053   const bool finalValue( false || relativeValue );
3054   animation.AnimateBy(Property(actor, index), relativeValue);
3055
3056   // Start the animation
3057   animation.Play();
3058
3059   // Target value should be retrievable straight away
3060   DALI_TEST_EQUALS( actor.GetProperty< bool >( index ), finalValue, TEST_LOCATION );
3061
3062   bool signalReceived(false);
3063   AnimationFinishCheck finishCheck(signalReceived);
3064   animation.FinishedSignal().Connect(&application, finishCheck);
3065
3066   application.SendNotification();
3067   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3068
3069   // We didn't expect the animation to finish yet
3070   application.SendNotification();
3071   finishCheck.CheckSignalNotReceived();
3072   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3073
3074   application.SendNotification();
3075   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3076
3077   // We did expect the animation to finish
3078   application.SendNotification();
3079   finishCheck.CheckSignalReceived();
3080   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3081
3082   // Check that nothing has changed after a couple of buffer swaps
3083   application.Render(0);
3084   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3085   application.Render(0);
3086   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3087
3088   // Repeat with relative value "false" - this should be an NOOP
3089   animation = Animation::New(durationSeconds);
3090   bool noOpValue(false);
3091   animation.AnimateBy(Property(actor, index), noOpValue);
3092
3093   // Start the animation
3094   animation.Play();
3095
3096   finishCheck.Reset();
3097   animation.FinishedSignal().Connect(&application, finishCheck);
3098
3099   application.SendNotification();
3100   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3101
3102   // We didn't expect the animation to finish yet
3103   application.SendNotification();
3104   finishCheck.CheckSignalNotReceived();
3105   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3106
3107   application.SendNotification();
3108   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3109
3110   // We did expect the animation to finish
3111   application.SendNotification();
3112   finishCheck.CheckSignalReceived();
3113   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3114
3115   // Check that nothing has changed after a couple of buffer swaps
3116   application.Render(0);
3117   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3118   application.Render(0);
3119   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3120   END_TEST;
3121 }
3122
3123 int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void)
3124 {
3125   TestApplication application;
3126
3127   Actor actor = Actor::New();
3128
3129   // Register a boolean property
3130   bool startValue(false);
3131   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3132   Stage::GetCurrent().Add(actor);
3133   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3134   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3135
3136   // Build the animation
3137   float durationSeconds(2.0f);
3138   Animation animation = Animation::New(durationSeconds);
3139   bool relativeValue(true);
3140   bool finalValue( false || relativeValue );
3141   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN);
3142
3143   // Start the animation
3144   animation.Play();
3145
3146   bool signalReceived(false);
3147   AnimationFinishCheck finishCheck(signalReceived);
3148   animation.FinishedSignal().Connect(&application, finishCheck);
3149
3150   application.SendNotification();
3151   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3152
3153   // We didn't expect the animation to finish yet
3154   application.SendNotification();
3155   finishCheck.CheckSignalNotReceived();
3156   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3157
3158   application.SendNotification();
3159   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3160
3161   // We did expect the animation to finish
3162   application.SendNotification();
3163   finishCheck.CheckSignalReceived();
3164   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3165
3166   // Check that nothing has changed after a couple of buffer swaps
3167   application.Render(0);
3168   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3169   application.Render(0);
3170   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3171
3172   // Repeat with relative value "false" - this should be an NOOP
3173   animation = Animation::New(durationSeconds);
3174   bool noOpValue(false);
3175   animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunction::EASE_IN);
3176
3177   // Start the animation
3178   animation.Play();
3179
3180   finishCheck.Reset();
3181   animation.FinishedSignal().Connect(&application, finishCheck);
3182
3183   application.SendNotification();
3184   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3185
3186   // We didn't expect the animation to finish yet
3187   application.SendNotification();
3188   finishCheck.CheckSignalNotReceived();
3189   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3190
3191   application.SendNotification();
3192   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3193
3194   // We did expect the animation to finish
3195   application.SendNotification();
3196   finishCheck.CheckSignalReceived();
3197   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3198   END_TEST;
3199 }
3200
3201 int UtcDaliAnimationAnimateByBooleanTimePeriodP(void)
3202 {
3203   TestApplication application;
3204
3205   Actor actor = Actor::New();
3206
3207   // Register a boolean property
3208   bool startValue(false);
3209   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3210   Stage::GetCurrent().Add(actor);
3211   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3212   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3213
3214   // Build the animation
3215   float durationSeconds(2.0f);
3216   Animation animation = Animation::New(durationSeconds);
3217   bool relativeValue(true);
3218   bool finalValue( false || relativeValue );
3219   float animatorDurationSeconds(durationSeconds * 0.5f);
3220   animation.AnimateBy( Property(actor, index),
3221                        relativeValue,
3222                        TimePeriod( animatorDurationSeconds ) );
3223
3224   // Start the animation
3225   animation.Play();
3226
3227   bool signalReceived(false);
3228   AnimationFinishCheck finishCheck(signalReceived);
3229   animation.FinishedSignal().Connect(&application, finishCheck);
3230
3231   application.SendNotification();
3232   application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
3233
3234   // We didn't expect the animation to finish yet
3235   application.SendNotification();
3236   finishCheck.CheckSignalNotReceived();
3237   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3238
3239   application.SendNotification();
3240   application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
3241
3242   // We didn't expect the animation to finish yet...
3243   application.SendNotification();
3244   finishCheck.CheckSignalNotReceived();
3245
3246   // ...however we should have reached the final value
3247   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3248
3249   application.SendNotification();
3250   application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
3251
3252   // We did expect the animation to finish
3253   application.SendNotification();
3254   finishCheck.CheckSignalReceived();
3255   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3256
3257   // Check that nothing has changed after a couple of buffer swaps
3258   application.Render(0);
3259   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3260   application.Render(0);
3261   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3262   END_TEST;
3263 }
3264
3265 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void)
3266 {
3267   TestApplication application;
3268
3269   Actor actor = Actor::New();
3270
3271   // Register a boolean property
3272   bool startValue(false);
3273   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3274   Stage::GetCurrent().Add(actor);
3275   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3276   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3277
3278   // Build the animation
3279   float durationSeconds(2.0f);
3280   Animation animation = Animation::New(durationSeconds);
3281   bool relativeValue(true);
3282   bool finalValue( false || relativeValue );
3283   float animatorDurationSeconds(durationSeconds * 0.5f);
3284   animation.AnimateBy( Property(actor, index),
3285                        relativeValue,
3286                        AlphaFunction::EASE_IN_OUT,
3287                        TimePeriod( animatorDurationSeconds ) );
3288
3289   // Start the animation
3290   animation.Play();
3291
3292   bool signalReceived(false);
3293   AnimationFinishCheck finishCheck(signalReceived);
3294   animation.FinishedSignal().Connect(&application, finishCheck);
3295
3296   application.SendNotification();
3297   application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
3298
3299   // We didn't expect the animation to finish yet
3300   application.SendNotification();
3301   finishCheck.CheckSignalNotReceived();
3302   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3303
3304   application.SendNotification();
3305   application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
3306
3307   // We didn't expect the animation to finish yet...
3308   application.SendNotification();
3309   finishCheck.CheckSignalNotReceived();
3310
3311   // ...however we should have reached the final value
3312   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3313
3314   application.SendNotification();
3315   application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
3316
3317   // We did expect the animation to finish
3318   application.SendNotification();
3319   finishCheck.CheckSignalReceived();
3320   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3321
3322   // Check that nothing has changed after a couple of buffer swaps
3323   application.Render(0);
3324   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3325   application.Render(0);
3326   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3327   END_TEST;
3328 }
3329
3330 int UtcDaliAnimationAnimateByFloatP(void)
3331 {
3332   TestApplication application;
3333
3334   Actor actor = Actor::New();
3335
3336   // Register a float property
3337   float startValue(10.0f);
3338   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3339   Stage::GetCurrent().Add(actor);
3340   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3341   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3342
3343   // Build the animation
3344   float durationSeconds(2.0f);
3345   Animation animation = Animation::New(durationSeconds);
3346   float targetValue(50.0f);
3347   float relativeValue(targetValue - startValue);
3348   animation.AnimateBy(Property(actor, index), relativeValue);
3349
3350   float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3351
3352   // Start the animation
3353   animation.Play();
3354
3355   // Target value should be retrievable straight away
3356   DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
3357
3358   bool signalReceived(false);
3359   AnimationFinishCheck finishCheck(signalReceived);
3360   animation.FinishedSignal().Connect(&application, finishCheck);
3361
3362   application.SendNotification();
3363   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3364
3365   // We didn't expect the animation to finish yet
3366   application.SendNotification();
3367   finishCheck.CheckSignalNotReceived();
3368   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3369
3370   application.SendNotification();
3371   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3372
3373   // We did expect the animation to finish
3374   application.SendNotification();
3375   finishCheck.CheckSignalReceived();
3376   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3377
3378   // Check that nothing has changed after a couple of buffer swaps
3379   application.Render(0);
3380   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3381   application.Render(0);
3382   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3383   END_TEST;
3384 }
3385
3386 int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void)
3387 {
3388   TestApplication application;
3389
3390   Actor actor = Actor::New();
3391
3392   // Register a float property
3393   float startValue(10.0f);
3394   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3395   Stage::GetCurrent().Add(actor);
3396   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3397   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3398
3399   // Build the animation
3400   float durationSeconds(1.0f);
3401   Animation animation = Animation::New(durationSeconds);
3402   float targetValue(90.0f);
3403   float relativeValue(targetValue - startValue);
3404   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3405
3406   float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3407
3408   // Start the animation
3409   animation.Play();
3410
3411   bool signalReceived(false);
3412   AnimationFinishCheck finishCheck(signalReceived);
3413   animation.FinishedSignal().Connect(&application, finishCheck);
3414
3415   application.SendNotification();
3416   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3417
3418   // We didn't expect the animation to finish yet
3419   application.SendNotification();
3420   finishCheck.CheckSignalNotReceived();
3421
3422   // The position should have moved more, than with a linear alpha function
3423   float current( actor.GetCurrentProperty< float >( index ) );
3424   DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3425
3426   application.SendNotification();
3427   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3428
3429   // We did expect the animation to finish
3430   application.SendNotification();
3431   finishCheck.CheckSignalReceived();
3432   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3433
3434   // Check that nothing has changed after a couple of buffer swaps
3435   application.Render(0);
3436   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3437   application.Render(0);
3438   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3439   END_TEST;
3440 }
3441
3442 int UtcDaliAnimationAnimateByFloatTimePeriodP(void)
3443 {
3444   TestApplication application;
3445
3446   Actor actor = Actor::New();
3447
3448   // Register a float property
3449   float startValue(10.0f);
3450   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3451   Stage::GetCurrent().Add(actor);
3452   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3453   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3454
3455   // Build the animation
3456   float durationSeconds(1.0f);
3457   Animation animation = Animation::New(durationSeconds);
3458   float targetValue(30.0f);
3459   float relativeValue(targetValue - startValue);
3460   float delay = 0.5f;
3461   animation.AnimateBy(Property(actor, index),
3462                       relativeValue,
3463                       TimePeriod(delay, durationSeconds - delay));
3464
3465   // Start the animation
3466   animation.Play();
3467
3468   bool signalReceived(false);
3469   AnimationFinishCheck finishCheck(signalReceived);
3470   animation.FinishedSignal().Connect(&application, finishCheck);
3471
3472   application.SendNotification();
3473   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3474
3475   // We didn't expect the animation to finish yet
3476   application.SendNotification();
3477   finishCheck.CheckSignalNotReceived();
3478   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3479
3480   application.SendNotification();
3481   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3482
3483   // We didn't expect the animation to finish yet
3484   application.SendNotification();
3485   finishCheck.CheckSignalNotReceived();
3486   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3487
3488   application.SendNotification();
3489   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3490
3491   // We did expect the animation to finish
3492   application.SendNotification();
3493   finishCheck.CheckSignalReceived();
3494   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3495
3496   // Check that nothing has changed after a couple of buffer swaps
3497   application.Render(0);
3498   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3499   application.Render(0);
3500   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3501   END_TEST;
3502 }
3503
3504 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void)
3505 {
3506   TestApplication application;
3507
3508   Actor actor = Actor::New();
3509
3510   // Register a float property
3511   float startValue(10.0f);
3512   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3513   Stage::GetCurrent().Add(actor);
3514   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3515   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3516
3517   // Build the animation
3518   float durationSeconds(1.0f);
3519   Animation animation = Animation::New(durationSeconds);
3520   float targetValue(30.0f);
3521   float relativeValue(targetValue - startValue);
3522   float delay = 0.5f;
3523   animation.AnimateBy(Property(actor, index),
3524                       relativeValue,
3525                       AlphaFunction::LINEAR,
3526                       TimePeriod(delay, durationSeconds - delay));
3527
3528   // Start the animation
3529   animation.Play();
3530
3531   bool signalReceived(false);
3532   AnimationFinishCheck finishCheck(signalReceived);
3533   animation.FinishedSignal().Connect(&application, finishCheck);
3534
3535   application.SendNotification();
3536   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3537
3538   // We didn't expect the animation to finish yet
3539   application.SendNotification();
3540   finishCheck.CheckSignalNotReceived();
3541   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3542
3543   application.SendNotification();
3544   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3545
3546   // We didn't expect the animation to finish yet
3547   application.SendNotification();
3548   finishCheck.CheckSignalNotReceived();
3549   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3550
3551   application.SendNotification();
3552   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3553
3554   // We did expect the animation to finish
3555   application.SendNotification();
3556   finishCheck.CheckSignalReceived();
3557   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3558
3559   // Check that nothing has changed after a couple of buffer swaps
3560   application.Render(0);
3561   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3562   application.Render(0);
3563   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3564   END_TEST;
3565 }
3566
3567 int UtcDaliAnimationAnimateByIntegerP(void)
3568 {
3569   TestApplication application;
3570
3571   Actor actor = Actor::New();
3572
3573   // Register an integer property
3574   int startValue(1);
3575   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3576   Stage::GetCurrent().Add(actor);
3577   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3578   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3579
3580   // Build the animation
3581   float durationSeconds(2.0f);
3582   Animation animation = Animation::New(durationSeconds);
3583   int targetValue(50);
3584   int relativeValue(targetValue - startValue);
3585   animation.AnimateBy(Property(actor, index), relativeValue);
3586
3587   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3588
3589   // Start the animation
3590   animation.Play();
3591
3592   // Target value should be retrievable straight away
3593   DALI_TEST_EQUALS( actor.GetProperty< int >( index ), targetValue, TEST_LOCATION );
3594
3595   bool signalReceived(false);
3596   AnimationFinishCheck finishCheck(signalReceived);
3597   animation.FinishedSignal().Connect(&application, finishCheck);
3598
3599   application.SendNotification();
3600   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3601
3602   // We didn't expect the animation to finish yet
3603   application.SendNotification();
3604   finishCheck.CheckSignalNotReceived();
3605   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3606
3607   application.SendNotification();
3608   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3609
3610   // We did expect the animation to finish
3611   application.SendNotification();
3612   finishCheck.CheckSignalReceived();
3613   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3614
3615   // Check that nothing has changed after a couple of buffer swaps
3616   application.Render(0);
3617   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3618   application.Render(0);
3619   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3620   END_TEST;
3621 }
3622
3623 int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void)
3624 {
3625   TestApplication application;
3626
3627   Actor actor = Actor::New();
3628
3629   // Register an integer property
3630   int startValue(1);
3631   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3632   Stage::GetCurrent().Add(actor);
3633   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3634   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3635
3636   // Build the animation
3637   float durationSeconds(1.0f);
3638   Animation animation = Animation::New(durationSeconds);
3639   int targetValue(90);
3640   int relativeValue(targetValue - startValue);
3641   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3642
3643   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3644
3645   // Start the animation
3646   animation.Play();
3647
3648   bool signalReceived(false);
3649   AnimationFinishCheck finishCheck(signalReceived);
3650   animation.FinishedSignal().Connect(&application, finishCheck);
3651
3652   application.SendNotification();
3653   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3654
3655   // We didn't expect the animation to finish yet
3656   application.SendNotification();
3657   finishCheck.CheckSignalNotReceived();
3658
3659   // The position should have moved more, than with a linear alpha function
3660   int current( actor.GetCurrentProperty< int >( index ) );
3661   DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3662
3663   application.SendNotification();
3664   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3665
3666   // We did expect the animation to finish
3667   application.SendNotification();
3668   finishCheck.CheckSignalReceived();
3669   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3670
3671   // Check that nothing has changed after a couple of buffer swaps
3672   application.Render(0);
3673   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3674   application.Render(0);
3675   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3676   END_TEST;
3677 }
3678
3679 int UtcDaliAnimationAnimateByIntegerTimePeriodP(void)
3680 {
3681   TestApplication application;
3682
3683   Actor actor = Actor::New();
3684
3685   // Register an integer property
3686   int startValue(10);
3687   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3688   Stage::GetCurrent().Add(actor);
3689   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3690   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3691
3692   // Build the animation
3693   float durationSeconds(1.0f);
3694   Animation animation = Animation::New(durationSeconds);
3695   int targetValue(30);
3696   int relativeValue(targetValue - startValue);
3697   float delay = 0.5f;
3698   animation.AnimateBy(Property(actor, index),
3699                       relativeValue,
3700                       TimePeriod(delay, durationSeconds - delay));
3701
3702   // Start the animation
3703   animation.Play();
3704
3705   bool signalReceived(false);
3706   AnimationFinishCheck finishCheck(signalReceived);
3707   animation.FinishedSignal().Connect(&application, finishCheck);
3708
3709   application.SendNotification();
3710   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3711
3712   // We didn't expect the animation to finish yet
3713   application.SendNotification();
3714   finishCheck.CheckSignalNotReceived();
3715   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3716
3717   application.SendNotification();
3718   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3719
3720   // We didn't expect the animation to finish yet
3721   application.SendNotification();
3722   finishCheck.CheckSignalNotReceived();
3723   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3724
3725   application.SendNotification();
3726   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3727
3728   // We did expect the animation to finish
3729   application.SendNotification();
3730   finishCheck.CheckSignalReceived();
3731   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3732
3733   // Check that nothing has changed after a couple of buffer swaps
3734   application.Render(0);
3735   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3736   application.Render(0);
3737   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3738   END_TEST;
3739 }
3740
3741 int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void)
3742 {
3743   TestApplication application;
3744
3745   Actor actor = Actor::New();
3746
3747   // Register an integer property
3748   int startValue(10);
3749   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3750   Stage::GetCurrent().Add(actor);
3751   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3752   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3753
3754   // Build the animation
3755   float durationSeconds(1.0f);
3756   Animation animation = Animation::New(durationSeconds);
3757   int targetValue(30);
3758   int relativeValue(targetValue - startValue);
3759   float delay = 0.5f;
3760   animation.AnimateBy(Property(actor, index),
3761                       relativeValue,
3762                       AlphaFunction::LINEAR,
3763                       TimePeriod(delay, durationSeconds - delay));
3764
3765   // Start the animation
3766   animation.Play();
3767
3768   bool signalReceived(false);
3769   AnimationFinishCheck finishCheck(signalReceived);
3770   animation.FinishedSignal().Connect(&application, finishCheck);
3771
3772   application.SendNotification();
3773   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3774
3775   // We didn't expect the animation to finish yet
3776   application.SendNotification();
3777   finishCheck.CheckSignalNotReceived();
3778   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3779
3780   application.SendNotification();
3781   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3782
3783   // We didn't expect the animation to finish yet
3784   application.SendNotification();
3785   finishCheck.CheckSignalNotReceived();
3786   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3787
3788   application.SendNotification();
3789   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3790
3791   // We did expect the animation to finish
3792   application.SendNotification();
3793   finishCheck.CheckSignalReceived();
3794   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3795
3796   // Check that nothing has changed after a couple of buffer swaps
3797   application.Render(0);
3798   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3799   application.Render(0);
3800   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3801   END_TEST;
3802 }
3803
3804 int UtcDaliAnimationAnimateByQuaternionP(void)
3805 {
3806   TestApplication application;
3807
3808   Actor actor = Actor::New();
3809
3810   // Register a quaternion property
3811   const Quaternion startValue( Degree( 90 ), Vector3::XAXIS );
3812   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3813   Stage::GetCurrent().Add(actor);
3814   DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == startValue );
3815   DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == startValue );
3816
3817   // Build the animation
3818   float durationSeconds(2.0f);
3819   Animation animation = Animation::New(durationSeconds);
3820   const Quaternion relativeValue( Degree( 90 ), Vector3::ZAXIS );
3821   const Quaternion finalValue( startValue * relativeValue );
3822   animation.AnimateBy(Property(actor, index), relativeValue);
3823
3824   DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == startValue );
3825   DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == startValue );
3826
3827   // Start the animation
3828   animation.Play();
3829
3830   // Target value should be retrievable straight away
3831   DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == finalValue );
3832
3833   application.SendNotification();
3834   application.Render( 2000 ); // animation complete
3835
3836   DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == finalValue );
3837   DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == finalValue );
3838
3839   END_TEST;
3840 }
3841
3842 int UtcDaliAnimationAnimateByVector2P(void)
3843 {
3844   TestApplication application;
3845
3846   Actor actor = Actor::New();
3847
3848   // Register a Vector2 property
3849   Vector2 startValue(10.0f, 10.0f);
3850   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3851   Stage::GetCurrent().Add(actor);
3852   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3853   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3854
3855   // Build the animation
3856   float durationSeconds(2.0f);
3857   Animation animation = Animation::New(durationSeconds);
3858   Vector2 targetValue(60.0f, 60.0f);
3859   Vector2 relativeValue(targetValue - startValue);
3860   animation.AnimateBy(Property(actor, index), relativeValue);
3861
3862   Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3863
3864   // Start the animation
3865   animation.Play();
3866
3867   // Target value should be retrievable straight away
3868   DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3869
3870   bool signalReceived(false);
3871   AnimationFinishCheck finishCheck(signalReceived);
3872   animation.FinishedSignal().Connect(&application, finishCheck);
3873
3874   application.SendNotification();
3875   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3876
3877   // We didn't expect the animation to finish yet
3878   application.SendNotification();
3879   finishCheck.CheckSignalNotReceived();
3880   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3881
3882   application.SendNotification();
3883   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3884
3885   // We did expect the animation to finish
3886   application.SendNotification();
3887   finishCheck.CheckSignalReceived();
3888   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3889
3890   // Check that nothing has changed after a couple of buffer swaps
3891   application.Render(0);
3892   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3893   application.Render(0);
3894   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3895   END_TEST;
3896 }
3897
3898 int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void)
3899 {
3900   TestApplication application;
3901
3902   Actor actor = Actor::New();
3903
3904   // Register a Vector2 property
3905   Vector2 startValue(100.0f, 100.0f);
3906   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3907   Stage::GetCurrent().Add(actor);
3908   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3909   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3910
3911   // Build the animation
3912   float durationSeconds(1.0f);
3913   Animation animation = Animation::New(durationSeconds);
3914   Vector2 targetValue(20.0f, 20.0f);
3915   Vector2 relativeValue(targetValue - startValue);
3916   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3917
3918   Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3919
3920   // Start the animation
3921   animation.Play();
3922
3923   bool signalReceived(false);
3924   AnimationFinishCheck finishCheck(signalReceived);
3925   animation.FinishedSignal().Connect(&application, finishCheck);
3926
3927   application.SendNotification();
3928   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3929
3930   // We didn't expect the animation to finish yet
3931   application.SendNotification();
3932   finishCheck.CheckSignalNotReceived();
3933
3934   // The position should have moved more, than with a linear alpha function
3935   Vector2 current( actor.GetCurrentProperty< Vector2 >( index ) );
3936   DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3937   DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3938
3939   application.SendNotification();
3940   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3941
3942   // We did expect the animation to finish
3943   application.SendNotification();
3944   finishCheck.CheckSignalReceived();
3945   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3946
3947   // Check that nothing has changed after a couple of buffer swaps
3948   application.Render(0);
3949   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3950   application.Render(0);
3951   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3952   END_TEST;
3953 }
3954
3955 int UtcDaliAnimationAnimateByVector2TimePeriodP(void)
3956 {
3957   TestApplication application;
3958
3959   Actor actor = Actor::New();
3960
3961   // Register a Vector2 property
3962   Vector2 startValue(10.0f, 10.0f);
3963   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3964   Stage::GetCurrent().Add(actor);
3965   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3966   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3967
3968   // Build the animation
3969   float durationSeconds(1.0f);
3970   Animation animation = Animation::New(durationSeconds);
3971   Vector2 targetValue(30.0f, 30.0f);
3972   Vector2 relativeValue(targetValue - startValue);
3973   float delay = 0.5f;
3974   animation.AnimateBy(Property(actor, index),
3975                       relativeValue,
3976                       TimePeriod(delay, durationSeconds - delay));
3977
3978   // Start the animation
3979   animation.Play();
3980
3981   bool signalReceived(false);
3982   AnimationFinishCheck finishCheck(signalReceived);
3983   animation.FinishedSignal().Connect(&application, finishCheck);
3984
3985   application.SendNotification();
3986   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3987
3988   // We didn't expect the animation to finish yet
3989   application.SendNotification();
3990   finishCheck.CheckSignalNotReceived();
3991   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3992
3993   application.SendNotification();
3994   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3995
3996   // We didn't expect the animation to finish yet
3997   application.SendNotification();
3998   finishCheck.CheckSignalNotReceived();
3999   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4000
4001   application.SendNotification();
4002   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4003
4004   // We did expect the animation to finish
4005   application.SendNotification();
4006   finishCheck.CheckSignalReceived();
4007   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4008
4009   // Check that nothing has changed after a couple of buffer swaps
4010   application.Render(0);
4011   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4012   application.Render(0);
4013   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4014   END_TEST;
4015 }
4016
4017 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void)
4018 {
4019   TestApplication application;
4020
4021   Actor actor = Actor::New();
4022
4023   // Register a Vector2 property
4024   Vector2 startValue(5.0f, 5.0f);
4025   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4026   Stage::GetCurrent().Add(actor);
4027   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
4028   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
4029
4030   // Build the animation
4031   float durationSeconds(1.0f);
4032   Animation animation = Animation::New(durationSeconds);
4033   Vector2 targetValue(10.0f, 10.0f);
4034   Vector2 relativeValue(targetValue - startValue);
4035   float delay = 0.5f;
4036   animation.AnimateBy(Property(actor, index),
4037                       relativeValue,
4038                       AlphaFunction::LINEAR,
4039                       TimePeriod(delay, durationSeconds - delay));
4040
4041   // Start the animation
4042   animation.Play();
4043
4044   bool signalReceived(false);
4045   AnimationFinishCheck finishCheck(signalReceived);
4046   animation.FinishedSignal().Connect(&application, finishCheck);
4047
4048   application.SendNotification();
4049   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4050
4051   // We didn't expect the animation to finish yet
4052   application.SendNotification();
4053   finishCheck.CheckSignalNotReceived();
4054   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
4055
4056   application.SendNotification();
4057   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4058
4059   // We didn't expect the animation to finish yet
4060   application.SendNotification();
4061   finishCheck.CheckSignalNotReceived();
4062   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4063
4064   application.SendNotification();
4065   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4066
4067   // We did expect the animation to finish
4068   application.SendNotification();
4069   finishCheck.CheckSignalReceived();
4070   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4071
4072   // Check that nothing has changed after a couple of buffer swaps
4073   application.Render(0);
4074   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4075   application.Render(0);
4076   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4077   END_TEST;
4078 }
4079
4080 int UtcDaliAnimationAnimateByVector3P(void)
4081 {
4082   TestApplication application;
4083
4084   Actor actor = Actor::New();
4085
4086   // Register a Vector3 property
4087   Vector3 startValue(10.0f, 10.0f, 10.0f);
4088   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4089   Stage::GetCurrent().Add(actor);
4090   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4091   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4092
4093   // Build the animation
4094   float durationSeconds(2.0f);
4095   Animation animation = Animation::New(durationSeconds);
4096   Vector3 targetValue(60.0f, 60.0f, 60.0f);
4097   Vector3 relativeValue(targetValue - startValue);
4098   animation.AnimateBy(Property(actor, index), relativeValue);
4099
4100   Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4101
4102   // Start the animation
4103   animation.Play();
4104
4105   // Target value should be retrievable straight away
4106   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4107
4108   bool signalReceived(false);
4109   AnimationFinishCheck finishCheck(signalReceived);
4110   animation.FinishedSignal().Connect(&application, finishCheck);
4111
4112   application.SendNotification();
4113   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4114
4115   // We didn't expect the animation to finish yet
4116   application.SendNotification();
4117   finishCheck.CheckSignalNotReceived();
4118   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
4119
4120   application.SendNotification();
4121   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4122
4123   // We did expect the animation to finish
4124   application.SendNotification();
4125   finishCheck.CheckSignalReceived();
4126   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4127
4128   // Check that nothing has changed after a couple of buffer swaps
4129   application.Render(0);
4130   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4131   application.Render(0);
4132   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4133   END_TEST;
4134 }
4135
4136 int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void)
4137 {
4138   TestApplication application;
4139
4140   Actor actor = Actor::New();
4141
4142   // Register a Vector3 property
4143   Vector3 startValue(100.0f, 100.0f, 100.0f);
4144   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4145   Stage::GetCurrent().Add(actor);
4146   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4147   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4148
4149   // Build the animation
4150   float durationSeconds(1.0f);
4151   Animation animation = Animation::New(durationSeconds);
4152   Vector3 targetValue(20.0f, 20.0f, 20.0f);
4153   Vector3 relativeValue(targetValue - startValue);
4154   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4155
4156   Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4157
4158   // Start the animation
4159   animation.Play();
4160
4161   bool signalReceived(false);
4162   AnimationFinishCheck finishCheck(signalReceived);
4163   animation.FinishedSignal().Connect(&application, finishCheck);
4164
4165   application.SendNotification();
4166   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4167
4168   // We didn't expect the animation to finish yet
4169   application.SendNotification();
4170   finishCheck.CheckSignalNotReceived();
4171
4172   // The position should have moved more, than with a linear alpha function
4173   Vector3 current(actor.GetCurrentProperty< Vector3 >( index ));
4174   DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
4175   DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
4176   DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
4177
4178   application.SendNotification();
4179   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4180
4181   // We did expect the animation to finish
4182   application.SendNotification();
4183   finishCheck.CheckSignalReceived();
4184   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4185
4186   // Check that nothing has changed after a couple of buffer swaps
4187   application.Render(0);
4188   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4189   application.Render(0);
4190   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4191   END_TEST;
4192 }
4193
4194 int UtcDaliAnimationAnimateByVector3TimePeriodP(void)
4195 {
4196   TestApplication application;
4197
4198   Actor actor = Actor::New();
4199
4200   // Register a Vector3 property
4201   Vector3 startValue(10.0f, 10.0f, 10.0f);
4202   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4203   Stage::GetCurrent().Add(actor);
4204   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4205   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4206
4207   // Build the animation
4208   float durationSeconds(1.0f);
4209   Animation animation = Animation::New(durationSeconds);
4210   Vector3 targetValue(30.0f, 30.0f, 30.0f);
4211   Vector3 relativeValue(targetValue - startValue);
4212   float delay = 0.5f;
4213   animation.AnimateBy(Property(actor, index),
4214                       relativeValue,
4215                       TimePeriod(delay, durationSeconds - delay));
4216
4217   // Start the animation
4218   animation.Play();
4219
4220   bool signalReceived(false);
4221   AnimationFinishCheck finishCheck(signalReceived);
4222   animation.FinishedSignal().Connect(&application, finishCheck);
4223
4224   application.SendNotification();
4225   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4226
4227   // We didn't expect the animation to finish yet
4228   application.SendNotification();
4229   finishCheck.CheckSignalNotReceived();
4230   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4231
4232   application.SendNotification();
4233   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4234
4235   // We didn't expect the animation to finish yet
4236   application.SendNotification();
4237   finishCheck.CheckSignalNotReceived();
4238   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4239
4240   application.SendNotification();
4241   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4242
4243   // We did expect the animation to finish
4244   application.SendNotification();
4245   finishCheck.CheckSignalReceived();
4246   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4247
4248   // Check that nothing has changed after a couple of buffer swaps
4249   application.Render(0);
4250   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4251   application.Render(0);
4252   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4253   END_TEST;
4254 }
4255
4256 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void)
4257 {
4258   TestApplication application;
4259
4260   Actor actor = Actor::New();
4261
4262   // Register a Vector3 property
4263   Vector3 startValue(5.0f, 5.0f, 5.0f);
4264   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4265   Stage::GetCurrent().Add(actor);
4266   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4267   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4268
4269   // Build the animation
4270   float durationSeconds(1.0f);
4271   Animation animation = Animation::New(durationSeconds);
4272   Vector3 targetValue(10.0f, 10.0f, 10.0f);
4273   Vector3 relativeValue(targetValue - startValue);
4274   float delay = 0.5f;
4275   animation.AnimateBy(Property(actor, index),
4276                       relativeValue,
4277                       AlphaFunction::LINEAR,
4278                       TimePeriod(delay, durationSeconds - delay));
4279
4280   // Start the animation
4281   animation.Play();
4282
4283   bool signalReceived(false);
4284   AnimationFinishCheck finishCheck(signalReceived);
4285   animation.FinishedSignal().Connect(&application, finishCheck);
4286
4287   application.SendNotification();
4288   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4289
4290   // We didn't expect the animation to finish yet
4291   application.SendNotification();
4292   finishCheck.CheckSignalNotReceived();
4293   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4294
4295   application.SendNotification();
4296   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4297
4298   // We didn't expect the animation to finish yet
4299   application.SendNotification();
4300   finishCheck.CheckSignalNotReceived();
4301   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4302
4303   application.SendNotification();
4304   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4305
4306   // We did expect the animation to finish
4307   application.SendNotification();
4308   finishCheck.CheckSignalReceived();
4309   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4310
4311   // Check that nothing has changed after a couple of buffer swaps
4312   application.Render(0);
4313   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4314   application.Render(0);
4315   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4316   END_TEST;
4317 }
4318
4319 int UtcDaliAnimationAnimateByVector4P(void)
4320 {
4321   TestApplication application;
4322
4323   Actor actor = Actor::New();
4324
4325   // Register a Vector4 property
4326   Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4327   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4328   Stage::GetCurrent().Add(actor);
4329   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4330   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4331
4332   // Build the animation
4333   float durationSeconds(2.0f);
4334   Animation animation = Animation::New(durationSeconds);
4335   Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f);
4336   Vector4 relativeValue(targetValue - startValue);
4337   animation.AnimateBy(Property(actor, index), relativeValue);
4338
4339   Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4340
4341   // Start the animation
4342   animation.Play();
4343
4344   // Target value should be retrievable straight away
4345   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4346
4347   bool signalReceived(false);
4348   AnimationFinishCheck finishCheck(signalReceived);
4349   animation.FinishedSignal().Connect(&application, finishCheck);
4350
4351   application.SendNotification();
4352   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4353
4354   // We didn't expect the animation to finish yet
4355   application.SendNotification();
4356   finishCheck.CheckSignalNotReceived();
4357   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
4358
4359   application.SendNotification();
4360   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4361
4362   // We did expect the animation to finish
4363   application.SendNotification();
4364   finishCheck.CheckSignalReceived();
4365   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4366
4367   // Check that nothing has changed after a couple of buffer swaps
4368   application.Render(0);
4369   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4370   application.Render(0);
4371   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4372   END_TEST;
4373 }
4374
4375 int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void)
4376 {
4377   TestApplication application;
4378
4379   Actor actor = Actor::New();
4380
4381   // Register a Vector4 property
4382   Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f);
4383   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4384   Stage::GetCurrent().Add(actor);
4385   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4386   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4387
4388   // Build the animation
4389   float durationSeconds(1.0f);
4390   Animation animation = Animation::New(durationSeconds);
4391   Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
4392   Vector4 relativeValue(targetValue - startValue);
4393   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4394
4395   Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4396
4397   // Start the animation
4398   animation.Play();
4399
4400   bool signalReceived(false);
4401   AnimationFinishCheck finishCheck(signalReceived);
4402   animation.FinishedSignal().Connect(&application, finishCheck);
4403
4404   application.SendNotification();
4405   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4406
4407   // We didn't expect the animation to finish yet
4408   application.SendNotification();
4409   finishCheck.CheckSignalNotReceived();
4410
4411   // The position should have moved more, than with a linear alpha function
4412   Vector4 current( actor.GetCurrentProperty< Vector4 >( index ) );
4413   DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
4414   DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
4415   DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
4416   DALI_TEST_CHECK( current.w < ninetyFivePercentProgress.w );
4417
4418   application.SendNotification();
4419   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4420
4421   // We did expect the animation to finish
4422   application.SendNotification();
4423   finishCheck.CheckSignalReceived();
4424   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4425
4426   // Check that nothing has changed after a couple of buffer swaps
4427   application.Render(0);
4428   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4429   application.Render(0);
4430   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4431   END_TEST;
4432 }
4433
4434 int UtcDaliAnimationAnimateByVector4TimePeriodP(void)
4435 {
4436   TestApplication application;
4437
4438   Actor actor = Actor::New();
4439
4440   // Register a Vector4 property
4441   Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4442   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4443   Stage::GetCurrent().Add(actor);
4444   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4445   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4446
4447   // Build the animation
4448   float durationSeconds(1.0f);
4449   Animation animation = Animation::New(durationSeconds);
4450   Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
4451   Vector4 relativeValue(targetValue - startValue);
4452   float delay = 0.5f;
4453   animation.AnimateBy(Property(actor, index),
4454                       relativeValue,
4455                       TimePeriod(delay, durationSeconds - delay));
4456
4457   // Start the animation
4458   animation.Play();
4459
4460   bool signalReceived(false);
4461   AnimationFinishCheck finishCheck(signalReceived);
4462   animation.FinishedSignal().Connect(&application, finishCheck);
4463
4464   application.SendNotification();
4465   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4466
4467   // We didn't expect the animation to finish yet
4468   application.SendNotification();
4469   finishCheck.CheckSignalNotReceived();
4470   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4471
4472   application.SendNotification();
4473   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4474
4475   // We didn't expect the animation to finish yet
4476   application.SendNotification();
4477   finishCheck.CheckSignalNotReceived();
4478   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4479
4480   application.SendNotification();
4481   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4482
4483   // We did expect the animation to finish
4484   application.SendNotification();
4485   finishCheck.CheckSignalReceived();
4486   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4487
4488   // Check that nothing has changed after a couple of buffer swaps
4489   application.Render(0);
4490   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4491   application.Render(0);
4492   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4493   END_TEST;
4494 }
4495
4496 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void)
4497 {
4498   TestApplication application;
4499
4500   Actor actor = Actor::New();
4501
4502   // Register a Vector4 property
4503   Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f);
4504   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4505   Stage::GetCurrent().Add(actor);
4506   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4507   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4508
4509   // Build the animation
4510   float durationSeconds(1.0f);
4511   Animation animation = Animation::New(durationSeconds);
4512   Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f);
4513   Vector4 relativeValue(targetValue - startValue);
4514   float delay = 0.5f;
4515   animation.AnimateBy(Property(actor, index),
4516                       relativeValue,
4517                       AlphaFunction::LINEAR,
4518                       TimePeriod(delay, durationSeconds - delay));
4519
4520   // Start the animation
4521   animation.Play();
4522
4523   bool signalReceived(false);
4524   AnimationFinishCheck finishCheck(signalReceived);
4525   animation.FinishedSignal().Connect(&application, finishCheck);
4526
4527   application.SendNotification();
4528   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4529
4530   // We didn't expect the animation to finish yet
4531   application.SendNotification();
4532   finishCheck.CheckSignalNotReceived();
4533   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4534
4535   application.SendNotification();
4536   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4537
4538   // We didn't expect the animation to finish yet
4539   application.SendNotification();
4540   finishCheck.CheckSignalNotReceived();
4541   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4542
4543   application.SendNotification();
4544   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4545
4546   // We did expect the animation to finish
4547   application.SendNotification();
4548   finishCheck.CheckSignalReceived();
4549   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4550
4551   // Check that nothing has changed after a couple of buffer swaps
4552   application.Render(0);
4553   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4554   application.Render(0);
4555   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4556   END_TEST;
4557 }
4558
4559 int UtcDaliAnimationAnimateByActorPositionP(void)
4560 {
4561   TestApplication application;
4562
4563   Actor actor = Actor::New();
4564   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4565   actor.SetPosition(startPosition);
4566   Stage::GetCurrent().Add(actor);
4567   application.SendNotification();
4568   application.Render(0);
4569   DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4570
4571   // Build the animation
4572   float durationSeconds(1.0f);
4573   Animation animation = Animation::New(durationSeconds);
4574   Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4575   Vector3 relativePosition(targetPosition - startPosition);
4576   animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition);
4577
4578   Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4579
4580   // Start the animation
4581   animation.Play();
4582
4583   // Target value should be retrievable straight away
4584   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4585
4586   bool signalReceived(false);
4587   AnimationFinishCheck finishCheck(signalReceived);
4588   animation.FinishedSignal().Connect(&application, finishCheck);
4589
4590   application.SendNotification();
4591   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4592
4593   // We didn't expect the animation to finish yet
4594   application.SendNotification();
4595   finishCheck.CheckSignalNotReceived();
4596   DALI_TEST_EQUALS( actor.GetCurrentPosition(), ninetyFivePercentProgress, TEST_LOCATION );
4597
4598   application.SendNotification();
4599   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4600
4601   // We did expect the animation to finish
4602   application.SendNotification();
4603   finishCheck.CheckSignalReceived();
4604   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4605
4606   // Check that nothing has changed after a couple of buffer swaps
4607   application.Render(0);
4608   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4609   application.Render(0);
4610   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4611   END_TEST;
4612 }
4613
4614 int UtcDaliAnimationAnimateByActorPositionComponentsP(void)
4615 {
4616   TestApplication application;
4617
4618   Actor actor = Actor::New();
4619   Stage::GetCurrent().Add(actor);
4620   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
4621
4622   // Build the animation
4623   float durationSeconds(1.0f);
4624   Animation animation = Animation::New(durationSeconds);
4625   Vector3 targetPosition(200.0f, 300.0f, 400.0f);
4626   Vector3 relativePosition(targetPosition - Vector3::ZERO);
4627   animation.AnimateBy( Property( actor, Actor::Property::POSITION_X ), relativePosition.x );
4628   animation.AnimateBy( Property( actor, Actor::Property::POSITION_Y ), relativePosition.y );
4629   animation.AnimateBy( Property( actor, Actor::Property::POSITION_Z ), relativePosition.z );
4630
4631   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
4632   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
4633
4634   // Start the animation
4635   animation.Play();
4636
4637   // Target value should be retrievable straight away
4638   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4639   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetPosition.x, TEST_LOCATION );
4640   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetPosition.y, TEST_LOCATION );
4641   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetPosition.z, TEST_LOCATION );
4642
4643   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); // Not changed yet
4644
4645   application.SendNotification();
4646   application.Render( 1000 ); // 1 second progress
4647
4648   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4649
4650   END_TEST;
4651 }
4652
4653 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
4654 {
4655   TestApplication application;
4656
4657   Actor actor = Actor::New();
4658   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4659   actor.SetPosition(startPosition);
4660   Stage::GetCurrent().Add(actor);
4661   application.SendNotification();
4662   application.Render(0);
4663   DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4664
4665   // Build the animation
4666   float durationSeconds(1.0f);
4667   Animation animation = Animation::New(durationSeconds);
4668   Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4669   Vector3 relativePosition(targetPosition - startPosition);
4670   animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
4671
4672   Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4673
4674   // Start the animation
4675   animation.Play();
4676
4677   bool signalReceived(false);
4678   AnimationFinishCheck finishCheck(signalReceived);
4679   animation.FinishedSignal().Connect(&application, finishCheck);
4680
4681   application.SendNotification();
4682   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4683
4684   // We didn't expect the animation to finish yet
4685   application.SendNotification();
4686   finishCheck.CheckSignalNotReceived();
4687
4688   // The position should have moved more, than with a linear alpha function
4689   Vector3 current(actor.GetCurrentPosition());
4690   DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
4691   DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
4692   DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
4693
4694   application.SendNotification();
4695   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4696
4697   // We did expect the animation to finish
4698   application.SendNotification();
4699   finishCheck.CheckSignalReceived();
4700   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4701
4702   // Check that nothing has changed after a couple of buffer swaps
4703   application.Render(0);
4704   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4705   application.Render(0);
4706   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4707   END_TEST;
4708 }
4709
4710 int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void)
4711 {
4712   TestApplication application;
4713
4714   Actor actor = Actor::New();
4715   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4716   actor.SetPosition(startPosition);
4717   Stage::GetCurrent().Add(actor);
4718   application.SendNotification();
4719   application.Render(0);
4720   DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4721
4722   // Build the animation
4723   float durationSeconds(1.0f);
4724   Animation animation = Animation::New(durationSeconds);
4725   Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4726   Vector3 relativePosition(targetPosition - startPosition);
4727   float delay = 0.5f;
4728   animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4729                       relativePosition,
4730                       TimePeriod(delay, durationSeconds - delay));
4731
4732   Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4733
4734   // Start the animation
4735   animation.Play();
4736
4737   bool signalReceived(false);
4738   AnimationFinishCheck finishCheck(signalReceived);
4739   animation.FinishedSignal().Connect(&application, finishCheck);
4740
4741   application.SendNotification();
4742   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4743
4744   // We didn't expect the animation to finish yet
4745   application.SendNotification();
4746   finishCheck.CheckSignalNotReceived();
4747   DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4748
4749   application.SendNotification();
4750   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4751
4752   // We did expect the animation to finish
4753   application.SendNotification();
4754   finishCheck.CheckSignalReceived();
4755   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4756
4757   // Check that nothing has changed after a couple of buffer swaps
4758   application.Render(0);
4759   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4760   application.Render(0);
4761   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4762   END_TEST;
4763 }
4764
4765 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void)
4766 {
4767   TestApplication application;
4768
4769   Actor actor = Actor::New();
4770   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4771   actor.SetPosition(startPosition);
4772   Stage::GetCurrent().Add(actor);
4773   application.SendNotification();
4774   application.Render(0);
4775   DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4776
4777   // Build the animation
4778   float durationSeconds(1.0f);
4779   Animation animation = Animation::New(durationSeconds);
4780   Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4781   Vector3 relativePosition(targetPosition - startPosition);
4782   float delay = 0.5f;
4783   animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4784                       relativePosition,
4785                       AlphaFunction::LINEAR,
4786                       TimePeriod(delay, durationSeconds - delay));
4787
4788   Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4789
4790   // Start the animation
4791   animation.Play();
4792
4793   bool signalReceived(false);
4794   AnimationFinishCheck finishCheck(signalReceived);
4795   animation.FinishedSignal().Connect(&application, finishCheck);
4796
4797   application.SendNotification();
4798   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4799
4800   // We didn't expect the animation to finish yet
4801   application.SendNotification();
4802   finishCheck.CheckSignalNotReceived();
4803   DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4804
4805   application.SendNotification();
4806   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4807
4808   // We did expect the animation to finish
4809   application.SendNotification();
4810   finishCheck.CheckSignalReceived();
4811   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4812
4813   // Check that nothing has changed after a couple of buffer swaps
4814   application.Render(0);
4815   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4816   application.Render(0);
4817   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4818   END_TEST;
4819 }
4820
4821 int UtcDaliAnimationAnimateByActorOrientationP1(void)
4822 {
4823   TestApplication application;
4824
4825   Actor actor = Actor::New();
4826   actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4827   Stage::GetCurrent().Add(actor);
4828   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4829
4830   // Build the animation
4831   float durationSeconds(1.0f);
4832   Animation animation = Animation::New(durationSeconds);
4833   Degree relativeRotationDegrees(360.0f);
4834   Radian relativeRotationRadians(relativeRotationDegrees);
4835   animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ) );
4836
4837   // Start the animation
4838   animation.Play();
4839
4840   // Target value should be retrievable straight away
4841   DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::YAXIS), TEST_LOCATION );
4842
4843   bool signalReceived(false);
4844   AnimationFinishCheck finishCheck(signalReceived);
4845   animation.FinishedSignal().Connect(&application, finishCheck);
4846
4847   application.SendNotification();
4848   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4849
4850   // We didn't expect the animation to finish yet
4851   application.SendNotification();
4852   finishCheck.CheckSignalNotReceived();
4853   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4854
4855   application.SendNotification();
4856   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4857
4858   // We didn't expect the animation to finish yet
4859   application.SendNotification();
4860   finishCheck.CheckSignalNotReceived();
4861   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4862
4863   application.SendNotification();
4864   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4865
4866   // We didn't expect the animation to finish yet
4867   application.SendNotification();
4868   finishCheck.CheckSignalNotReceived();
4869   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4870
4871   application.SendNotification();
4872   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4873
4874   // We did expect the animation to finish
4875   application.SendNotification();
4876   finishCheck.CheckSignalReceived();
4877   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4878   END_TEST;
4879 }
4880
4881 int UtcDaliAnimationAnimateByActorOrientationP2(void)
4882 {
4883   TestApplication application;
4884
4885   tet_printf("Testing that rotation angle > 360 performs full rotations\n");
4886
4887   Actor actor = Actor::New();
4888   actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
4889   Stage::GetCurrent().Add(actor);
4890   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4891
4892   // Build the animation
4893   float durationSeconds(1.0f);
4894   Animation animation = Animation::New(durationSeconds);
4895   Degree relativeRotationDegrees(710.0f);
4896   Radian relativeRotationRadians(relativeRotationDegrees);
4897
4898   animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), AngleAxis( relativeRotationRadians, Vector3::ZAXIS ) );
4899
4900   // Start the animation
4901   animation.Play();
4902
4903   bool signalReceived(false);
4904   AnimationFinishCheck finishCheck(signalReceived);
4905   animation.FinishedSignal().Connect(&application, finishCheck);
4906
4907   application.SendNotification();
4908   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4909
4910   // We didn't expect the animation to finish yet
4911   application.SendNotification();
4912   finishCheck.CheckSignalNotReceived();
4913   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4914
4915   application.SendNotification();
4916   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4917
4918   // We didn't expect the animation to finish yet
4919   application.SendNotification();
4920   finishCheck.CheckSignalNotReceived();
4921   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4922
4923   application.SendNotification();
4924   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4925
4926   // We didn't expect the animation to finish yet
4927   application.SendNotification();
4928   finishCheck.CheckSignalNotReceived();
4929   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4930
4931   application.SendNotification();
4932   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4933
4934   // We did expect the animation to finish
4935   application.SendNotification();
4936   finishCheck.CheckSignalReceived();
4937   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4938   END_TEST;
4939 }
4940
4941
4942 int UtcDaliAnimationAnimateByActorOrientationP3(void)
4943 {
4944   TestApplication application;
4945
4946   tet_printf("Testing that rotation angle > 360 performs partial rotations when cast to Quaternion\n");
4947
4948   Actor actor = Actor::New();
4949   actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
4950   Stage::GetCurrent().Add(actor);
4951   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4952
4953   // Build the animation
4954   float durationSeconds(1.0f);
4955   Animation animation = Animation::New(durationSeconds);
4956   Degree relativeRotationDegrees(730.0f);
4957   Radian relativeRotationRadians(relativeRotationDegrees);
4958
4959   Radian actualRotationRadians( Degree(10.0f) );
4960
4961   animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::ZAXIS ) );
4962
4963   // Start the animation
4964   animation.Play();
4965
4966   bool signalReceived(false);
4967   AnimationFinishCheck finishCheck(signalReceived);
4968   animation.FinishedSignal().Connect(&application, finishCheck);
4969
4970   application.SendNotification();
4971   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4972
4973   // We didn't expect the animation to finish yet
4974   application.SendNotification();
4975   finishCheck.CheckSignalNotReceived();
4976   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4977
4978   application.SendNotification();
4979   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4980
4981   // We didn't expect the animation to finish yet
4982   application.SendNotification();
4983   finishCheck.CheckSignalNotReceived();
4984   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4985
4986   application.SendNotification();
4987   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4988
4989   // We didn't expect the animation to finish yet
4990   application.SendNotification();
4991   finishCheck.CheckSignalNotReceived();
4992   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4993
4994   application.SendNotification();
4995   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4996
4997   // We did expect the animation to finish
4998   application.SendNotification();
4999   finishCheck.CheckSignalReceived();
5000   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
5001   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
5002   END_TEST;
5003 }
5004
5005
5006 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
5007 {
5008   TestApplication application;
5009
5010   Actor actor = Actor::New();
5011   actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
5012   Stage::GetCurrent().Add(actor);
5013   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
5014
5015   // Build the animation
5016   float durationSeconds(1.0f);
5017   Animation animation = Animation::New(durationSeconds);
5018   Degree relativeRotationDegrees(360.0f);
5019   Radian relativeRotationRadians(relativeRotationDegrees);
5020   animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ), AlphaFunction::EASE_IN );
5021
5022   // Start the animation
5023   animation.Play();
5024
5025   bool signalReceived(false);
5026   AnimationFinishCheck finishCheck(signalReceived);
5027   animation.FinishedSignal().Connect(&application, finishCheck);
5028
5029   application.SendNotification();
5030   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
5031
5032   // We didn't expect the animation to finish yet
5033   application.SendNotification();
5034   finishCheck.CheckSignalNotReceived();
5035   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5036
5037   application.SendNotification();
5038   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
5039
5040   // We didn't expect the animation to finish yet
5041   application.SendNotification();
5042   finishCheck.CheckSignalNotReceived();
5043   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5044
5045   application.SendNotification();
5046   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
5047
5048   // We didn't expect the animation to finish yet
5049   application.SendNotification();
5050   finishCheck.CheckSignalNotReceived();
5051   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5052
5053   application.SendNotification();
5054   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5055
5056   // We did expect the animation to finish
5057   application.SendNotification();
5058   finishCheck.CheckSignalReceived();
5059   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5060   END_TEST;
5061 }
5062
5063 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void)
5064 {
5065   TestApplication application;
5066
5067   Actor actor = Actor::New();
5068   actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
5069   Stage::GetCurrent().Add(actor);
5070   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
5071
5072   // Build the animation
5073   float durationSeconds(1.0f);
5074   Animation animation = Animation::New(durationSeconds);
5075   Degree relativeRotationDegrees(360.0f);
5076   Radian relativeRotationRadians(relativeRotationDegrees);
5077   float delay = 0.3f;
5078   animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ),
5079                        AlphaFunction::EASE_IN, TimePeriod( delay, durationSeconds - delay ) );
5080
5081   // Start the animation
5082   animation.Play();
5083
5084   bool signalReceived(false);
5085   AnimationFinishCheck finishCheck(signalReceived);
5086   animation.FinishedSignal().Connect(&application, finishCheck);
5087
5088   application.SendNotification();
5089   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
5090
5091   // We didn't expect the animation to finish yet
5092   application.SendNotification();
5093   finishCheck.CheckSignalNotReceived();
5094   float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
5095   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5096
5097   application.SendNotification();
5098   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
5099
5100   // We didn't expect the animation to finish yet
5101   application.SendNotification();
5102   finishCheck.CheckSignalNotReceived();
5103   progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
5104   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5105
5106   application.SendNotification();
5107   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
5108
5109   // We didn't expect the animation to finish yet
5110   application.SendNotification();
5111   finishCheck.CheckSignalNotReceived();
5112   progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
5113   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5114
5115   application.SendNotification();
5116   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5117
5118   // We did expect the animation to finish
5119   application.SendNotification();
5120   finishCheck.CheckSignalReceived();
5121   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5122   END_TEST;
5123 }
5124
5125 int UtcDaliAnimationAnimateByActorScaleP(void)
5126 {
5127   TestApplication application;
5128
5129   Actor actor = Actor::New();
5130   Stage::GetCurrent().Add(actor);
5131   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
5132
5133   // Build the animation
5134   float durationSeconds(1.0f);
5135   Animation animation = Animation::New(durationSeconds);
5136   Vector3 targetScale(2.0f, 2.0f, 2.0f);
5137   Vector3 relativeScale(targetScale - Vector3::ONE);
5138   animation.AnimateBy( Property( actor, Actor::Property::SCALE ), Vector3( relativeScale.x, relativeScale.y, relativeScale.z ) );
5139
5140   Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale*0.99f);
5141
5142   // Start the animation
5143   animation.Play();
5144
5145   // Target value should be retrievable straight away
5146   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
5147
5148   bool signalReceived(false);
5149   AnimationFinishCheck finishCheck(signalReceived);
5150   animation.FinishedSignal().Connect(&application, finishCheck);
5151
5152   application.SendNotification();
5153   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
5154
5155   // We didn't expect the animation to finish yet
5156   application.SendNotification();
5157   finishCheck.CheckSignalNotReceived();
5158   DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
5159
5160   application.SendNotification();
5161   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
5162
5163   // We did expect the animation to finish
5164   application.SendNotification();
5165   finishCheck.CheckSignalReceived();
5166   DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
5167
5168   // Reset everything
5169   finishCheck.Reset();
5170   actor.SetScale(Vector3::ONE);
5171   application.SendNotification();
5172   application.Render(0);
5173   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
5174
5175   // Repeat with a different (ease-in) alpha function
5176   animation = Animation::New(durationSeconds);
5177   animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::EASE_IN );
5178   animation.FinishedSignal().Connect(&application, finishCheck);
5179   animation.Play();
5180
5181   application.SendNotification();
5182   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
5183
5184   // We didn't expect the animation to finish yet
5185   application.SendNotification();
5186   finishCheck.CheckSignalNotReceived();
5187
5188   // The scale should have grown less, than with a linear alpha function
5189   Vector3 current(actor.GetCurrentScale());
5190   DALI_TEST_CHECK( current.x > 1.0f );
5191   DALI_TEST_CHECK( current.y > 1.0f );
5192   DALI_TEST_CHECK( current.z > 1.0f );
5193   DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
5194   DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
5195   DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
5196
5197   application.SendNotification();
5198   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
5199
5200   // We did expect the animation to finish
5201   application.SendNotification();
5202   finishCheck.CheckSignalReceived();
5203   DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
5204
5205   // Reset everything
5206   finishCheck.Reset();
5207   actor.SetScale(Vector3::ONE);
5208   application.SendNotification();
5209   application.Render(0);
5210   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
5211
5212   // Repeat with a delay
5213   float delay = 0.5f;
5214   animation = Animation::New(durationSeconds);
5215   animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
5216   animation.FinishedSignal().Connect(&application, finishCheck);
5217   animation.Play();
5218
5219   application.SendNotification();
5220   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5221
5222   // We didn't expect the animation to finish yet
5223   application.SendNotification();
5224   finishCheck.CheckSignalNotReceived();
5225   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
5226
5227   application.SendNotification();
5228   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5229
5230   // We did expect the animation to finish
5231   application.SendNotification();
5232   finishCheck.CheckSignalReceived();
5233   DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
5234   END_TEST;
5235 }
5236
5237 int UtcDaliAnimationAnimateByActorScaleComponentsP(void)
5238 {
5239   TestApplication application;
5240
5241   Actor actor = Actor::New();
5242   Stage::GetCurrent().Add(actor);
5243   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
5244
5245   // Build the animation
5246   float durationSeconds(1.0f);
5247   Animation animation = Animation::New(durationSeconds);
5248   Vector3 targetScale(2.0f, 3.0f, 4.0f);
5249   Vector3 relativeScale(targetScale - Vector3::ONE);
5250   animation.AnimateBy( Property( actor, Actor::Property::SCALE_X ), relativeScale.x );
5251   animation.AnimateBy( Property( actor, Actor::Property::SCALE_Y ), relativeScale.y );
5252   animation.AnimateBy( Property( actor, Actor::Property::SCALE_Z ), relativeScale.z );
5253
5254   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
5255   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
5256
5257   // Start the animation
5258   animation.Play();
5259
5260   // Target value should be retrievable straight away
5261   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
5262   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetScale.x, TEST_LOCATION );
5263   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetScale.y, TEST_LOCATION );
5264   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetScale.z, TEST_LOCATION );
5265
5266   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION ); // Not changed yet
5267
5268   application.SendNotification();
5269   application.Render( 1000 ); // 1 second progress
5270
5271   DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
5272
5273   END_TEST;
5274 }
5275
5276 int UtcDaliAnimationAnimateByActorColorP(void)
5277 {
5278   TestApplication application;
5279
5280   Actor actor = Actor::New();
5281   Stage::GetCurrent().Add(actor);
5282   DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5283
5284   // Build the animation
5285   float durationSeconds(1.0f);
5286   Animation animation = Animation::New(durationSeconds);
5287   Vector4 targetColor( 0.5f, 0.75f, 0.8f, 0.1f );
5288   Vector4 relativeColor( targetColor - Color::WHITE );
5289   animation.AnimateBy( Property( actor, Actor::Property::COLOR ), relativeColor );
5290
5291   DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5292   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
5293
5294   // Start the animation
5295   animation.Play();
5296
5297   // Target value should be retrievable straight away
5298   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
5299   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
5300   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
5301   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
5302   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
5303
5304   DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION ); // Not changed yet
5305
5306   application.SendNotification();
5307   application.Render( 1000 ); // 1 second progress
5308
5309   DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
5310
5311   END_TEST;
5312 }
5313
5314 int UtcDaliAnimationAnimateByActorColorComponentsP(void)
5315 {
5316   TestApplication application;
5317
5318   Actor actor = Actor::New();
5319   Stage::GetCurrent().Add(actor);
5320   DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5321
5322   // Build the animation
5323   float durationSeconds(1.0f);
5324   Animation animation = Animation::New(durationSeconds);
5325   Vector4 targetColor( 0.5f, 0.75f, 0.8f, 0.1f );
5326   Vector4 relativeColor( targetColor - Color::WHITE );
5327   animation.AnimateBy( Property( actor, Actor::Property::COLOR_RED ), relativeColor.r );
5328   animation.AnimateBy( Property( actor, Actor::Property::COLOR_GREEN ), relativeColor.g );
5329   animation.AnimateBy( Property( actor, Actor::Property::COLOR_BLUE ), relativeColor.b );
5330   animation.AnimateBy( Property( actor, Actor::Property::COLOR_ALPHA ), relativeColor.a );
5331
5332   DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5333   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
5334
5335   // Start the animation
5336   animation.Play();
5337
5338   // Target value should be retrievable straight away
5339   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
5340   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
5341   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
5342   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
5343   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
5344
5345   DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION ); // Not changed yet
5346
5347   application.SendNotification();
5348   application.Render( 1000 ); // 1 second progress
5349
5350   DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
5351
5352   END_TEST;
5353 }
5354
5355 int UtcDaliAnimationAnimateByActorSizeP(void)
5356 {
5357   TestApplication application;
5358
5359   Actor actor = Actor::New();
5360   Stage::GetCurrent().Add(actor);
5361   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5362
5363   // Build the animation
5364   float durationSeconds(1.0f);
5365   Animation animation = Animation::New(durationSeconds);
5366   Vector3 targetSize( 100.0f, 200.0f, 300.0f );
5367   Vector3 relativeSize( targetSize - Vector3::ZERO );
5368   animation.AnimateBy( Property( actor, Actor::Property::SIZE ), relativeSize );
5369
5370   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5371   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
5372
5373   // Start the animation
5374   animation.Play();
5375
5376   // Target value should be retrievable straight away
5377   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
5378   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
5379   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
5380   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
5381
5382   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION ); // Not changed yet
5383
5384   application.SendNotification();
5385   application.Render( 1000 ); // 1 second progress
5386
5387   DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
5388
5389   END_TEST;
5390 }
5391
5392 int UtcDaliAnimationAnimateByActorSizeComponentsP(void)
5393 {
5394   TestApplication application;
5395
5396   Actor actor = Actor::New();
5397   Stage::GetCurrent().Add(actor);
5398   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5399
5400   // Build the animation
5401   float durationSeconds(1.0f);
5402   Animation animation = Animation::New(durationSeconds);
5403   Vector3 targetSize( 100.0f, 200.0f, 300.0f );
5404   Vector3 relativeSize( targetSize - Vector3::ZERO );
5405   animation.AnimateBy( Property( actor, Actor::Property::SIZE_WIDTH ), relativeSize.width );
5406   animation.AnimateBy( Property( actor, Actor::Property::SIZE_HEIGHT ), relativeSize.height );
5407   animation.AnimateBy( Property( actor, Actor::Property::SIZE_DEPTH ), relativeSize.depth );
5408
5409   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5410   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
5411
5412   // Start the animation
5413   animation.Play();
5414
5415   // Target value should be retrievable straight away
5416   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
5417   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
5418   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
5419   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
5420
5421   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION ); // Not changed yet
5422
5423   application.SendNotification();
5424   application.Render( 1000 ); // 1 second progress
5425
5426   DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
5427
5428   END_TEST;
5429 }
5430
5431 int UtcDaliAnimationAnimateByActorVisibilityP(void)
5432 {
5433   TestApplication application;
5434
5435   Actor actor = Actor::New();
5436   Stage::GetCurrent().Add(actor);
5437   DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
5438
5439   actor.SetVisible( false );
5440
5441   application.SendNotification();
5442   application.Render();
5443
5444   DALI_TEST_EQUALS( actor.IsVisible(), false, TEST_LOCATION );
5445
5446   // Build the animation
5447   float durationSeconds(1.0f);
5448   Animation animation = Animation::New(durationSeconds);
5449   bool targetVisibility( true );
5450   bool relativeVisibility( targetVisibility );
5451   animation.AnimateBy( Property( actor, Actor::Property::VISIBLE ), relativeVisibility );
5452
5453   DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION );
5454
5455   // Start the animation
5456   animation.Play();
5457
5458   // Target value should be retrievable straight away
5459   DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), targetVisibility, TEST_LOCATION );
5460   DALI_TEST_EQUALS( actor.IsVisible(), false, TEST_LOCATION ); // Not changed yet
5461
5462   application.SendNotification();
5463   application.Render( 1000 ); // 1 second progress
5464
5465   DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
5466
5467   END_TEST;
5468 }
5469
5470 int UtcDaliAnimationAnimateToBooleanP(void)
5471 {
5472   TestApplication application;
5473
5474   Actor actor = Actor::New();
5475
5476   // Register a boolean property
5477   const bool startValue(false);
5478   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5479   Stage::GetCurrent().Add(actor);
5480   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5481   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5482
5483   // Build the animation
5484   float durationSeconds(2.0f);
5485   Animation animation = Animation::New(durationSeconds);
5486   const bool targetValue( !startValue );
5487   animation.AnimateTo(Property(actor, index), targetValue);
5488
5489   // Start the animation
5490   animation.Play();
5491
5492   bool signalReceived(false);
5493   AnimationFinishCheck finishCheck(signalReceived);
5494   animation.FinishedSignal().Connect(&application, finishCheck);
5495
5496   application.SendNotification();
5497   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5498
5499   // We didn't expect the animation to finish yet
5500   application.SendNotification();
5501   finishCheck.CheckSignalNotReceived();
5502   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5503
5504   application.SendNotification();
5505   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5506
5507   // We did expect the animation to finish
5508   application.SendNotification();
5509   finishCheck.CheckSignalReceived();
5510   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5511
5512   // Check that nothing has changed after a couple of buffer swaps
5513   application.Render(0);
5514   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5515   application.Render(0);
5516   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5517
5518   // Repeat with target value "false"
5519   animation = Animation::New(durationSeconds);
5520   const bool finalValue( !targetValue );
5521   animation.AnimateTo(Property(actor, index), finalValue);
5522
5523   // Start the animation
5524   animation.Play();
5525
5526   finishCheck.Reset();
5527   animation.FinishedSignal().Connect(&application, finishCheck);
5528
5529   application.SendNotification();
5530   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5531
5532   // We didn't expect the animation to finish yet
5533   application.SendNotification();
5534   finishCheck.CheckSignalNotReceived();
5535   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5536
5537   application.SendNotification();
5538   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5539
5540   // We did expect the animation to finish
5541   application.SendNotification();
5542   finishCheck.CheckSignalReceived();
5543   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5544
5545   // Check that nothing has changed after a couple of buffer swaps
5546   application.Render(0);
5547   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5548   application.Render(0);
5549   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5550   END_TEST;
5551 }
5552
5553 int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void)
5554 {
5555   TestApplication application;
5556
5557   Actor actor = Actor::New();
5558
5559   // Register a boolean property
5560   const bool startValue(false);
5561   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5562   Stage::GetCurrent().Add(actor);
5563   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5564   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5565
5566   // Build the animation
5567   float durationSeconds(2.0f);
5568   Animation animation = Animation::New(durationSeconds);
5569   const bool targetValue( !startValue );
5570   animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
5571
5572   // Start the animation
5573   animation.Play();
5574
5575   bool signalReceived(false);
5576   AnimationFinishCheck finishCheck(signalReceived);
5577   animation.FinishedSignal().Connect(&application, finishCheck);
5578
5579   application.SendNotification();
5580   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5581
5582   // We didn't expect the animation to finish yet
5583   application.SendNotification();
5584   finishCheck.CheckSignalNotReceived();
5585   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5586
5587   application.SendNotification();
5588   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5589
5590   // We did expect the animation to finish
5591   application.SendNotification();
5592   finishCheck.CheckSignalReceived();
5593   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5594
5595   // Check that nothing has changed after a couple of buffer swaps
5596   application.Render(0);
5597   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5598   application.Render(0);
5599   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5600
5601   // Repeat with target value "false"
5602   animation = Animation::New(durationSeconds);
5603   const bool finalValue( !targetValue );
5604   animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
5605
5606   // Start the animation
5607   animation.Play();
5608
5609   finishCheck.Reset();
5610   animation.FinishedSignal().Connect(&application, finishCheck);
5611
5612   application.SendNotification();
5613   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5614
5615   // We didn't expect the animation to finish yet
5616   application.SendNotification();
5617   finishCheck.CheckSignalNotReceived();
5618   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5619
5620   application.SendNotification();
5621   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5622
5623   // We did expect the animation to finish
5624   application.SendNotification();
5625   finishCheck.CheckSignalReceived();
5626   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5627
5628   // Check that nothing has changed after a couple of buffer swaps
5629   application.Render(0);
5630   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5631   application.Render(0);
5632   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5633   END_TEST;
5634 }
5635
5636 int UtcDaliAnimationAnimateToBooleanTimePeriodP(void)
5637 {
5638   TestApplication application;
5639
5640   Actor actor = Actor::New();
5641
5642   // Register a boolean property
5643   bool startValue(false);
5644   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5645   Stage::GetCurrent().Add(actor);
5646   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5647   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5648
5649   // Build the animation
5650   float durationSeconds(2.0f);
5651   Animation animation = Animation::New(durationSeconds);
5652   bool finalValue( !startValue );
5653   float animatorDurationSeconds(durationSeconds * 0.5f);
5654   animation.AnimateTo( Property(actor, index),
5655                        finalValue,
5656                        TimePeriod( animatorDurationSeconds ) );
5657
5658   // Start the animation
5659   animation.Play();
5660
5661   bool signalReceived(false);
5662   AnimationFinishCheck finishCheck(signalReceived);
5663   animation.FinishedSignal().Connect(&application, finishCheck);
5664
5665   application.SendNotification();
5666   application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5667
5668   // We didn't expect the animation to finish yet
5669   application.SendNotification();
5670   finishCheck.CheckSignalNotReceived();
5671   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5672
5673   application.SendNotification();
5674   application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5675
5676   // We didn't expect the animation to finish yet...
5677   application.SendNotification();
5678   finishCheck.CheckSignalNotReceived();
5679
5680   // ...however we should have reached the final value
5681   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5682
5683   application.SendNotification();
5684   application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5685
5686   // We did expect the animation to finish
5687   application.SendNotification();
5688   finishCheck.CheckSignalReceived();
5689   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5690
5691   // Check that nothing has changed after a couple of buffer swaps
5692   application.Render(0);
5693   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5694   application.Render(0);
5695   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5696   END_TEST;
5697 }
5698
5699 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void)
5700 {
5701   TestApplication application;
5702
5703   Actor actor = Actor::New();
5704
5705   // Register a boolean property
5706   bool startValue(false);
5707   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5708   Stage::GetCurrent().Add(actor);
5709   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5710   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5711
5712   // Build the animation
5713   float durationSeconds(2.0f);
5714   Animation animation = Animation::New(durationSeconds);
5715   bool finalValue( !startValue );
5716   float animatorDurationSeconds(durationSeconds * 0.5f);
5717   animation.AnimateTo( Property(actor, index),
5718                        finalValue,
5719                        AlphaFunction::LINEAR,
5720                        TimePeriod( animatorDurationSeconds ) );
5721
5722   // Start the animation
5723   animation.Play();
5724
5725   bool signalReceived(false);
5726   AnimationFinishCheck finishCheck(signalReceived);
5727   animation.FinishedSignal().Connect(&application, finishCheck);
5728
5729   application.SendNotification();
5730   application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5731
5732   // We didn't expect the animation to finish yet
5733   application.SendNotification();
5734   finishCheck.CheckSignalNotReceived();
5735   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5736
5737   application.SendNotification();
5738   application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5739
5740   // We didn't expect the animation to finish yet...
5741   application.SendNotification();
5742   finishCheck.CheckSignalNotReceived();
5743
5744   // ...however we should have reached the final value
5745   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5746
5747   application.SendNotification();
5748   application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5749
5750   // We did expect the animation to finish
5751   application.SendNotification();
5752   finishCheck.CheckSignalReceived();
5753   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5754
5755   // Check that nothing has changed after a couple of buffer swaps
5756   application.Render(0);
5757   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5758   application.Render(0);
5759   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5760   END_TEST;
5761 }
5762
5763 int UtcDaliAnimationAnimateToFloatP(void)
5764 {
5765   TestApplication application;
5766
5767   Actor actor = Actor::New();
5768
5769   // Register a float property
5770   float startValue(10.0f);
5771   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5772   Stage::GetCurrent().Add(actor);
5773   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5774   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5775
5776   // Build the animation
5777   float durationSeconds(2.0f);
5778   Animation animation = Animation::New(durationSeconds);
5779   float targetValue(50.0f);
5780   float relativeValue(targetValue - startValue);
5781   animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5782
5783   float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5784
5785   // Start the animation
5786   animation.Play();
5787
5788   bool signalReceived(false);
5789   AnimationFinishCheck finishCheck(signalReceived);
5790   animation.FinishedSignal().Connect(&application, finishCheck);
5791
5792   application.SendNotification();
5793   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5794
5795   // We didn't expect the animation to finish yet
5796   application.SendNotification();
5797   finishCheck.CheckSignalNotReceived();
5798   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), ninetyFivePercentProgress, TEST_LOCATION );
5799
5800   application.SendNotification();
5801   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5802
5803   // We did expect the animation to finish
5804   application.SendNotification();
5805   finishCheck.CheckSignalReceived();
5806   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5807   END_TEST;
5808 }
5809
5810 int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void)
5811 {
5812   TestApplication application;
5813
5814   Actor actor = Actor::New();
5815
5816   // Register a float property
5817   float startValue(10.0f);
5818   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5819   Stage::GetCurrent().Add(actor);
5820   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5821   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5822
5823   // Build the animation
5824   float durationSeconds(1.0f);
5825   Animation animation = Animation::New(durationSeconds);
5826   float targetValue(90.0f);
5827   float relativeValue(targetValue - startValue);
5828   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5829
5830   float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5831
5832   // Start the animation
5833   animation.Play();
5834
5835   bool signalReceived(false);
5836   AnimationFinishCheck finishCheck(signalReceived);
5837   animation.FinishedSignal().Connect(&application, finishCheck);
5838
5839   application.SendNotification();
5840   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5841
5842   // We didn't expect the animation to finish yet
5843   application.SendNotification();
5844   finishCheck.CheckSignalNotReceived();
5845
5846   // The position should have moved more, than with a linear alpha function
5847   float current( actor.GetCurrentProperty< float >( index ) );
5848   DALI_TEST_CHECK( current > ninetyFivePercentProgress );
5849
5850   application.SendNotification();
5851   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5852
5853   // We did expect the animation to finish
5854   application.SendNotification();
5855   finishCheck.CheckSignalReceived();
5856   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5857   END_TEST;
5858 }
5859
5860 int UtcDaliAnimationAnimateToFloatTimePeriodP(void)
5861 {
5862   TestApplication application;
5863
5864   Actor actor = Actor::New();
5865
5866   // Register a float property
5867   float startValue(10.0f);
5868   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5869   Stage::GetCurrent().Add(actor);
5870   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5871   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5872
5873   // Build the animation
5874   float durationSeconds(1.0f);
5875   Animation animation = Animation::New(durationSeconds);
5876   float targetValue(30.0f);
5877   float relativeValue(targetValue - startValue);
5878   float delay = 0.5f;
5879   animation.AnimateTo(Property(actor, index),
5880                       targetValue,
5881                       TimePeriod(delay, durationSeconds - delay));
5882
5883   // Start the animation
5884   animation.Play();
5885
5886   bool signalReceived(false);
5887   AnimationFinishCheck finishCheck(signalReceived);
5888   animation.FinishedSignal().Connect(&application, finishCheck);
5889
5890   application.SendNotification();
5891   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5892
5893   // We didn't expect the animation to finish yet
5894   application.SendNotification();
5895   finishCheck.CheckSignalNotReceived();
5896   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5897
5898   application.SendNotification();
5899   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5900
5901   // We didn't expect the animation to finish yet
5902   application.SendNotification();
5903   finishCheck.CheckSignalNotReceived();
5904   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5905
5906   application.SendNotification();
5907   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5908
5909   // We did expect the animation to finish
5910   application.SendNotification();
5911   finishCheck.CheckSignalReceived();
5912   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5913   END_TEST;
5914 }
5915
5916 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void)
5917 {
5918   TestApplication application;
5919
5920   Actor actor = Actor::New();
5921
5922   // Register a float property
5923   float startValue(10.0f);
5924   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5925   Stage::GetCurrent().Add(actor);
5926   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5927   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5928
5929   // Build the animation
5930   float durationSeconds(1.0f);
5931   Animation animation = Animation::New(durationSeconds);
5932   float targetValue(30.0f);
5933   float relativeValue(targetValue - startValue);
5934   float delay = 0.5f;
5935   animation.AnimateTo(Property(actor, index),
5936                       targetValue,
5937                       AlphaFunction::LINEAR,
5938                       TimePeriod(delay, durationSeconds - delay));
5939
5940   // Start the animation
5941   animation.Play();
5942
5943   bool signalReceived(false);
5944   AnimationFinishCheck finishCheck(signalReceived);
5945   animation.FinishedSignal().Connect(&application, finishCheck);
5946
5947   application.SendNotification();
5948   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5949
5950   // We didn't expect the animation to finish yet
5951   application.SendNotification();
5952   finishCheck.CheckSignalNotReceived();
5953   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5954
5955   application.SendNotification();
5956   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5957
5958   // We didn't expect the animation to finish yet
5959   application.SendNotification();
5960   finishCheck.CheckSignalNotReceived();
5961   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5962
5963   application.SendNotification();
5964   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5965
5966   // We did expect the animation to finish
5967   application.SendNotification();
5968   finishCheck.CheckSignalReceived();
5969   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5970   END_TEST;
5971 }
5972
5973 int UtcDaliAnimationAnimateToIntegerP(void)
5974 {
5975   TestApplication application;
5976
5977   Actor actor = Actor::New();
5978
5979   // Register an integer property
5980   int startValue(10);
5981   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5982   Stage::GetCurrent().Add(actor);
5983   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5984   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5985
5986   // Build the animation
5987   float durationSeconds(2.0f);
5988   Animation animation = Animation::New(durationSeconds);
5989   int targetValue(50);
5990   int relativeValue(targetValue - startValue);
5991   animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5992
5993   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
5994
5995   // Start the animation
5996   animation.Play();
5997
5998   bool signalReceived(false);
5999   AnimationFinishCheck finishCheck(signalReceived);
6000   animation.FinishedSignal().Connect(&application, finishCheck);
6001
6002   application.SendNotification();
6003   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6004
6005   // We didn't expect the animation to finish yet
6006   application.SendNotification();
6007   finishCheck.CheckSignalNotReceived();
6008   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), ninetyFivePercentProgress, TEST_LOCATION );
6009
6010   application.SendNotification();
6011   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6012
6013   // We did expect the animation to finish
6014   application.SendNotification();
6015   finishCheck.CheckSignalReceived();
6016   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
6017   END_TEST;
6018 }
6019
6020 int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void)
6021 {
6022   TestApplication application;
6023
6024   Actor actor = Actor::New();
6025
6026   // Register an integer property
6027   int startValue(10);
6028   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6029   Stage::GetCurrent().Add(actor);
6030   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
6031   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
6032
6033   // Build the animation
6034   float durationSeconds(1.0f);
6035   Animation animation = Animation::New(durationSeconds);
6036   int targetValue(90);
6037   int relativeValue(targetValue - startValue);
6038   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6039
6040   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
6041
6042   // Start the animation
6043   animation.Play();
6044
6045   bool signalReceived(false);
6046   AnimationFinishCheck finishCheck(signalReceived);
6047   animation.FinishedSignal().Connect(&application, finishCheck);
6048
6049   application.SendNotification();
6050   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6051
6052   // We didn't expect the animation to finish yet
6053   application.SendNotification();
6054   finishCheck.CheckSignalNotReceived();
6055
6056   // The position should have moved more, than with a linear alpha function
6057   int current( actor.GetCurrentProperty< int >( index ) );
6058   DALI_TEST_CHECK( current > ninetyFivePercentProgress );
6059
6060   application.SendNotification();
6061   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6062
6063   // We did expect the animation to finish
6064   application.SendNotification();
6065   finishCheck.CheckSignalReceived();
6066   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
6067   END_TEST;
6068 }
6069
6070 int UtcDaliAnimationAnimateToIntegerTimePeriodP(void)
6071 {
6072   TestApplication application;
6073
6074   Actor actor = Actor::New();
6075
6076   // Register an integer property
6077   int startValue(10);
6078   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6079   Stage::GetCurrent().Add(actor);
6080   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
6081   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
6082
6083   // Build the animation
6084   float durationSeconds(1.0f);
6085   Animation animation = Animation::New(durationSeconds);
6086   int targetValue(30);
6087   int relativeValue(targetValue - startValue);
6088   float delay = 0.5f;
6089   animation.AnimateTo(Property(actor, index),
6090                       targetValue,
6091                       TimePeriod(delay, durationSeconds - delay));
6092
6093   // Start the animation
6094   animation.Play();
6095
6096   bool signalReceived(false);
6097   AnimationFinishCheck finishCheck(signalReceived);
6098   animation.FinishedSignal().Connect(&application, finishCheck);
6099
6100   application.SendNotification();
6101   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6102
6103   // We didn't expect the animation to finish yet
6104   application.SendNotification();
6105   finishCheck.CheckSignalNotReceived();
6106   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
6107
6108   application.SendNotification();
6109   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6110
6111   // We didn't expect the animation to finish yet
6112   application.SendNotification();
6113   finishCheck.CheckSignalNotReceived();
6114   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
6115
6116   application.SendNotification();
6117   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6118
6119   // We did expect the animation to finish
6120   application.SendNotification();
6121   finishCheck.CheckSignalReceived();
6122   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
6123   END_TEST;
6124 }
6125
6126 int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void)
6127 {
6128   TestApplication application;
6129
6130   Actor actor = Actor::New();
6131
6132   // Register an integer property
6133   int startValue(10);
6134   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6135   Stage::GetCurrent().Add(actor);
6136   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
6137   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
6138
6139   // Build the animation
6140   float durationSeconds(1.0f);
6141   Animation animation = Animation::New(durationSeconds);
6142   int targetValue(30);
6143   int relativeValue(targetValue - startValue);
6144   float delay = 0.5f;
6145   animation.AnimateTo(Property(actor, index),
6146                       targetValue,
6147                       AlphaFunction::LINEAR,
6148                       TimePeriod(delay, durationSeconds - delay));
6149
6150   // Start the animation
6151   animation.Play();
6152
6153   bool signalReceived(false);
6154   AnimationFinishCheck finishCheck(signalReceived);
6155   animation.FinishedSignal().Connect(&application, finishCheck);
6156
6157   application.SendNotification();
6158   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6159
6160   // We didn't expect the animation to finish yet
6161   application.SendNotification();
6162   finishCheck.CheckSignalNotReceived();
6163   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
6164
6165   application.SendNotification();
6166   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6167
6168   // We didn't expect the animation to finish yet
6169   application.SendNotification();
6170   finishCheck.CheckSignalNotReceived();
6171   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
6172
6173   application.SendNotification();
6174   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6175
6176   // We did expect the animation to finish
6177   application.SendNotification();
6178   finishCheck.CheckSignalReceived();
6179   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
6180   END_TEST;
6181 }
6182
6183 int UtcDaliAnimationAnimateToVector2P(void)
6184 {
6185   TestApplication application;
6186
6187   Actor actor = Actor::New();
6188
6189   // Register a Vector2 property
6190   Vector2 startValue(-50.0f, -50.0f);
6191   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6192   Stage::GetCurrent().Add(actor);
6193   DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6194   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6195
6196   // Build the animation
6197   float durationSeconds(2.0f);
6198   Animation animation = Animation::New(durationSeconds);
6199   Vector2 targetValue(50.0f, 50.0f);
6200   Vector2 relativeValue(targetValue - startValue);
6201   animation.AnimateTo(Property(actor, index), targetValue);
6202
6203   Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6204
6205   // Start the animation
6206   animation.Play();
6207
6208   bool signalReceived(false);
6209   AnimationFinishCheck finishCheck(signalReceived);
6210   animation.FinishedSignal().Connect(&application, finishCheck);
6211
6212   application.SendNotification();
6213   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6214
6215   // We didn't expect the animation to finish yet
6216   application.SendNotification();
6217   finishCheck.CheckSignalNotReceived();
6218   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
6219
6220   application.SendNotification();
6221   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6222
6223   // We did expect the animation to finish
6224   application.SendNotification();
6225   finishCheck.CheckSignalReceived();
6226   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6227   END_TEST;
6228 }
6229
6230 int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void)
6231 {
6232   TestApplication application;
6233
6234   Actor actor = Actor::New();
6235
6236   // Register a Vector2 property
6237   Vector2 startValue(1000.0f, 1000.0f);
6238   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6239   Stage::GetCurrent().Add(actor);
6240   DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6241   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6242
6243   // Build the animation
6244   float durationSeconds(1.0f);
6245   Animation animation = Animation::New(durationSeconds);
6246   Vector2 targetValue(9000.0f, 9000.0f);
6247   Vector2 relativeValue(targetValue - startValue);
6248   animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
6249
6250   Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6251
6252   // Start the animation
6253   animation.Play();
6254
6255   bool signalReceived(false);
6256   AnimationFinishCheck finishCheck(signalReceived);
6257   animation.FinishedSignal().Connect(&application, finishCheck);
6258
6259   application.SendNotification();
6260   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6261
6262   // We didn't expect the animation to finish yet
6263   application.SendNotification();
6264   finishCheck.CheckSignalNotReceived();
6265
6266   // The position should have moved more, than with a linear alpha function
6267   Vector2 current( actor.GetCurrentProperty< Vector2 >( index ) );
6268   DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6269   DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6270
6271   application.SendNotification();
6272   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6273
6274   // We did expect the animation to finish
6275   application.SendNotification();
6276   finishCheck.CheckSignalReceived();
6277   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6278   END_TEST;
6279 }
6280
6281 int UtcDaliAnimationAnimateToVector2TimePeriodP(void)
6282 {
6283   TestApplication application;
6284
6285   Actor actor = Actor::New();
6286
6287   // Register a Vector2 property
6288   Vector2 startValue(10.0f, 10.0f);
6289   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6290   Stage::GetCurrent().Add(actor);
6291   DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6292   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6293
6294   // Build the animation
6295   float durationSeconds(1.0f);
6296   Animation animation = Animation::New(durationSeconds);
6297   Vector2 targetValue(-10.0f, 20.0f);
6298   Vector2 relativeValue(targetValue - startValue);
6299   float delay = 0.5f;
6300   animation.AnimateTo(Property(actor, index),
6301                       targetValue,
6302                       TimePeriod(delay, durationSeconds - delay));
6303
6304   // Start the animation
6305   animation.Play();
6306
6307   bool signalReceived(false);
6308   AnimationFinishCheck finishCheck(signalReceived);
6309   animation.FinishedSignal().Connect(&application, finishCheck);
6310
6311   application.SendNotification();
6312   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6313
6314   // We didn't expect the animation to finish yet
6315   application.SendNotification();
6316   finishCheck.CheckSignalNotReceived();
6317   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6318
6319   application.SendNotification();
6320   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6321
6322   // We didn't expect the animation to finish yet
6323   application.SendNotification();
6324   finishCheck.CheckSignalNotReceived();
6325   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6326
6327   application.SendNotification();
6328   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6329
6330   // We did expect the animation to finish
6331   application.SendNotification();
6332   finishCheck.CheckSignalReceived();
6333   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6334   END_TEST;
6335 }
6336
6337 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void)
6338 {
6339   TestApplication application;
6340
6341   Actor actor = Actor::New();
6342
6343   // Register a Vector2 property
6344   Vector2 startValue(10.0f, 10.0f);
6345   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6346   Stage::GetCurrent().Add(actor);
6347   DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6348   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6349
6350   // Build the animation
6351   float durationSeconds(1.0f);
6352   Animation animation = Animation::New(durationSeconds);
6353   Vector2 targetValue(30.0f, 30.0f);
6354   Vector2 relativeValue(targetValue - startValue);
6355   float delay = 0.5f;
6356   animation.AnimateTo(Property(actor, index),
6357                       targetValue,
6358                       AlphaFunction::LINEAR,
6359                       TimePeriod(delay, durationSeconds - delay));
6360
6361   // Start the animation
6362   animation.Play();
6363
6364   bool signalReceived(false);
6365   AnimationFinishCheck finishCheck(signalReceived);
6366   animation.FinishedSignal().Connect(&application, finishCheck);
6367
6368   application.SendNotification();
6369   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6370
6371   // We didn't expect the animation to finish yet, but cached value should be the final one
6372   application.SendNotification();
6373   finishCheck.CheckSignalNotReceived();
6374   DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6375   DALI_TEST_EQUALS( actor.GetCurrentProperty<Vector2>( index ), startValue, TEST_LOCATION );
6376
6377   application.SendNotification();
6378   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6379
6380   // We didn't expect the animation to finish yet
6381   application.SendNotification();
6382   finishCheck.CheckSignalNotReceived();
6383   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6384
6385   application.SendNotification();
6386   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6387
6388   // We did expect the animation to finish
6389   application.SendNotification();
6390   finishCheck.CheckSignalReceived();
6391   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6392   DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6393   END_TEST;
6394 }
6395
6396 int UtcDaliAnimationAnimateToVector3P(void)
6397 {
6398   TestApplication application;
6399
6400   Actor actor = Actor::New();
6401
6402   // Register a Vector3 property
6403   Vector3 startValue(-50.0f, -50.0f, -50.0f);
6404   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6405   Stage::GetCurrent().Add(actor);
6406   DALI_TEST_EQUALS( actor.GetProperty<Vector3>( index ), startValue, TEST_LOCATION );
6407   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6408
6409   // Build the animation
6410   float durationSeconds(2.0f);
6411   Animation animation = Animation::New(durationSeconds);
6412   Vector3 targetValue(50.0f, 50.0f, 50.0f);
6413   Vector3 relativeValue(targetValue - startValue);
6414   animation.AnimateTo(Property(actor, index), targetValue);
6415
6416   Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6417
6418   // Start the animation
6419   animation.Play();
6420
6421   bool signalReceived(false);
6422   AnimationFinishCheck finishCheck(signalReceived);
6423   animation.FinishedSignal().Connect(&application, finishCheck);
6424
6425   application.SendNotification();
6426   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6427
6428   // We didn't expect the animation to finish yet
6429   application.SendNotification();
6430   finishCheck.CheckSignalNotReceived();
6431   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
6432
6433   application.SendNotification();
6434   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6435
6436   // We did expect the animation to finish
6437   application.SendNotification();
6438   finishCheck.CheckSignalReceived();
6439   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6440   END_TEST;
6441 }
6442
6443 int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void)
6444 {
6445   TestApplication application;
6446
6447   Actor actor = Actor::New();
6448
6449   // Register a Vector3 property
6450   Vector3 startValue(1000.0f, 1000.0f, 1000.0f);
6451   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6452   Stage::GetCurrent().Add(actor);
6453   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6454   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6455
6456   // Build the animation
6457   float durationSeconds(1.0f);
6458   Animation animation = Animation::New(durationSeconds);
6459   Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
6460   Vector3 relativeValue(targetValue - startValue);
6461   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6462
6463   Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6464
6465   // Start the animation
6466   animation.Play();
6467
6468   bool signalReceived(false);
6469   AnimationFinishCheck finishCheck(signalReceived);
6470   animation.FinishedSignal().Connect(&application, finishCheck);
6471
6472   application.SendNotification();
6473   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6474
6475   // We didn't expect the animation to finish yet
6476   application.SendNotification();
6477   finishCheck.CheckSignalNotReceived();
6478
6479   // The position should have moved more, than with a linear alpha function
6480   Vector3 current( actor.GetCurrentProperty< Vector3 >( index ) );
6481   DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6482   DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6483   DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
6484
6485   application.SendNotification();
6486   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6487
6488   // We did expect the animation to finish
6489   application.SendNotification();
6490   finishCheck.CheckSignalReceived();
6491   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6492   END_TEST;
6493 }
6494
6495 int UtcDaliAnimationAnimateToVector3TimePeriodP(void)
6496 {
6497   TestApplication application;
6498
6499   Actor actor = Actor::New();
6500
6501   // Register a Vector3 property
6502   Vector3 startValue(10.0f, 10.0f, 10.0f);
6503   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6504   Stage::GetCurrent().Add(actor);
6505   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6506   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6507
6508   // Build the animation
6509   float durationSeconds(1.0f);
6510   Animation animation = Animation::New(durationSeconds);
6511   Vector3 targetValue(-10.0f, 20.0f, 100.0f);
6512   Vector3 relativeValue(targetValue - startValue);
6513   float delay = 0.5f;
6514   animation.AnimateTo(Property(actor, index),
6515                       targetValue,
6516                       TimePeriod(delay, durationSeconds - delay));
6517
6518   // Start the animation
6519   animation.Play();
6520
6521   bool signalReceived(false);
6522   AnimationFinishCheck finishCheck(signalReceived);
6523   animation.FinishedSignal().Connect(&application, finishCheck);
6524
6525   application.SendNotification();
6526   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6527
6528   // We didn't expect the animation to finish yet
6529   application.SendNotification();
6530   finishCheck.CheckSignalNotReceived();
6531   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6532
6533   application.SendNotification();
6534   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6535
6536   // We didn't expect the animation to finish yet
6537   application.SendNotification();
6538   finishCheck.CheckSignalNotReceived();
6539   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6540
6541   application.SendNotification();
6542   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6543
6544   // We did expect the animation to finish
6545   application.SendNotification();
6546   finishCheck.CheckSignalReceived();
6547   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6548   END_TEST;
6549 }
6550
6551 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void)
6552 {
6553   TestApplication application;
6554
6555   Actor actor = Actor::New();
6556
6557   // Register a Vector3 property
6558   Vector3 startValue(10.0f, 10.0f, 10.0f);
6559   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6560   Stage::GetCurrent().Add(actor);
6561   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6562   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6563
6564   // Build the animation
6565   float durationSeconds(1.0f);
6566   Animation animation = Animation::New(durationSeconds);
6567   Vector3 targetValue(30.0f, 30.0f, 30.0f);
6568   Vector3 relativeValue(targetValue - startValue);
6569   float delay = 0.5f;
6570   animation.AnimateTo(Property(actor, "testProperty"),
6571                       targetValue,
6572                       AlphaFunction::LINEAR,
6573                       TimePeriod(delay, durationSeconds - delay));
6574
6575   // Start the animation
6576   animation.Play();
6577
6578   bool signalReceived(false);
6579   AnimationFinishCheck finishCheck(signalReceived);
6580   animation.FinishedSignal().Connect(&application, finishCheck);
6581
6582   application.SendNotification();
6583   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6584
6585   // We didn't expect the animation to finish yet
6586   application.SendNotification();
6587   finishCheck.CheckSignalNotReceived();
6588   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6589
6590   application.SendNotification();
6591   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6592
6593   // We didn't expect the animation to finish yet
6594   application.SendNotification();
6595   finishCheck.CheckSignalNotReceived();
6596   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6597
6598   application.SendNotification();
6599   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6600
6601   // We did expect the animation to finish
6602   application.SendNotification();
6603   finishCheck.CheckSignalReceived();
6604   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6605   END_TEST;
6606 }
6607
6608 int UtcDaliAnimationAnimateToVector3ComponentP(void)
6609 {
6610   TestApplication application;
6611
6612   Actor actor = Actor::New();
6613
6614   // Register a Vector3 property
6615   Vector3 startValue(10.0f, 10.0f, 10.0f);
6616   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6617   Stage::GetCurrent().Add(actor);
6618   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6619   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6620
6621   // Build the animation
6622   float durationSeconds(1.0f);
6623   Animation animation = Animation::New(durationSeconds);
6624   Vector3 targetValue(30.0f, 30.0f, 10.0f);
6625   Vector3 relativeValue(targetValue - startValue);
6626   float delay = 0.5f;
6627   animation.AnimateTo(Property(actor, "testProperty",  0),
6628                       30.0f,
6629                       AlphaFunction::LINEAR,
6630                       TimePeriod(delay, durationSeconds - delay));
6631   animation.AnimateTo(Property(actor, index, 1),
6632                       30.0f,
6633                       AlphaFunction::LINEAR,
6634                       TimePeriod(delay, durationSeconds - delay));
6635
6636   // Start the animation
6637   animation.Play();
6638
6639   bool signalReceived(false);
6640   AnimationFinishCheck finishCheck(signalReceived);
6641   animation.FinishedSignal().Connect(&application, finishCheck);
6642
6643   application.SendNotification();
6644   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6645
6646   // We didn't expect the animation to finish yet
6647   application.SendNotification();
6648   finishCheck.CheckSignalNotReceived();
6649   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6650
6651   application.SendNotification();
6652   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6653
6654   // We didn't expect the animation to finish yet
6655   application.SendNotification();
6656   finishCheck.CheckSignalNotReceived();
6657   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6658
6659   application.SendNotification();
6660   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6661
6662   // We did expect the animation to finish
6663   application.SendNotification();
6664   finishCheck.CheckSignalReceived();
6665   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6666   END_TEST;
6667 }
6668
6669 int UtcDaliAnimationAnimateToVector4P(void)
6670 {
6671   TestApplication application;
6672
6673   Actor actor = Actor::New();
6674
6675   // Register a Vector4 property
6676   Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f);
6677   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6678   Stage::GetCurrent().Add(actor);
6679   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6680   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6681
6682   // Build the animation
6683   float durationSeconds(2.0f);
6684   Animation animation = Animation::New(durationSeconds);
6685   Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f);
6686   Vector4 relativeValue(targetValue - startValue);
6687   animation.AnimateTo(Property(actor, index), targetValue);
6688
6689   Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6690
6691   // Start the animation
6692   animation.Play();
6693
6694   bool signalReceived(false);
6695   AnimationFinishCheck finishCheck(signalReceived);
6696   animation.FinishedSignal().Connect(&application, finishCheck);
6697
6698   application.SendNotification();
6699   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6700
6701   // We didn't expect the animation to finish yet
6702   application.SendNotification();
6703   finishCheck.CheckSignalNotReceived();
6704   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
6705
6706   application.SendNotification();
6707   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6708
6709   // We did expect the animation to finish
6710   application.SendNotification();
6711   finishCheck.CheckSignalReceived();
6712   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
6713   END_TEST;
6714 }
6715
6716 int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void)
6717 {
6718   TestApplication application;
6719
6720   Actor actor = Actor::New();
6721
6722   // Register a Vector4 property
6723   Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
6724   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6725   Stage::GetCurrent().Add(actor);
6726   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6727   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6728
6729   // Build the animation
6730   float durationSeconds(1.0f);
6731   Animation animation = Animation::New(durationSeconds);
6732   Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
6733   Vector4 relativeValue(targetValue - startValue);
6734   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6735
6736   Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6737
6738   // Start the animation
6739   animation.Play();
6740
6741   bool signalReceived(false);
6742   AnimationFinishCheck finishCheck(signalReceived);
6743   animation.FinishedSignal().Connect(&application, finishCheck);
6744
6745   application.SendNotification();
6746   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6747
6748   // We didn't expect the animation to finish yet
6749   application.SendNotification();
6750   finishCheck.CheckSignalNotReceived();
6751
6752   // The position should have moved more, than with a linear alpha function
6753   Vector4 current( actor.GetCurrentProperty< Vector4 >( index ) );
6754   DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6755   DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6756   DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
6757   DALI_TEST_CHECK( current.w > ninetyFivePercentProgress.w );
6758
6759   application.SendNotification();
6760   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6761
6762   // We did expect the animation to finish
6763   application.SendNotification();
6764   finishCheck.CheckSignalReceived();
6765   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
6766   END_TEST;
6767 }
6768
6769 int UtcDaliAnimationAnimateToVector4TimePeriodP(void)
6770 {
6771   TestApplication application;
6772
6773   Actor actor = Actor::New();
6774
6775   // Register a Vector4 property
6776   Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6777   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6778   Stage::GetCurrent().Add(actor);
6779   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6780   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6781
6782   // Build the animation
6783   float durationSeconds(1.0f);
6784   Animation animation = Animation::New(durationSeconds);
6785   Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
6786   Vector4 relativeValue(targetValue - startValue);
6787   float delay = 0.5f;
6788   animation.AnimateTo(Property(actor, index),
6789                       targetValue,
6790                       TimePeriod(delay, durationSeconds - delay));
6791
6792   // Start the animation
6793   animation.Play();
6794
6795   bool signalReceived(false);
6796   AnimationFinishCheck finishCheck(signalReceived);
6797   animation.FinishedSignal().Connect(&application, finishCheck);
6798
6799   application.SendNotification();
6800   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6801
6802   // We didn't expect the animation to finish yet
6803   application.SendNotification();
6804   finishCheck.CheckSignalNotReceived();
6805   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6806
6807   application.SendNotification();
6808   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6809
6810   // We didn't expect the animation to finish yet
6811   application.SendNotification();
6812   finishCheck.CheckSignalNotReceived();
6813   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), VECTOR4_EPSILON, TEST_LOCATION );
6814
6815   application.SendNotification();
6816   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6817
6818   // We did expect the animation to finish
6819   application.SendNotification();
6820   finishCheck.CheckSignalReceived();
6821   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, VECTOR4_EPSILON, TEST_LOCATION );
6822   END_TEST;
6823 }
6824
6825 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void)
6826 {
6827   TestApplication application;
6828
6829   Actor actor = Actor::New();
6830
6831   // Register a Vector4 property
6832   Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6833   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6834   Stage::GetCurrent().Add(actor);
6835   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6836   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6837
6838   // Build the animation
6839   float durationSeconds(1.0f);
6840   Animation animation = Animation::New(durationSeconds);
6841   Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
6842   Vector4 relativeValue(targetValue - startValue);
6843   float delay = 0.5f;
6844   animation.AnimateTo(Property(actor, index),
6845                       targetValue,
6846                       AlphaFunction::LINEAR,
6847                       TimePeriod(delay, durationSeconds - delay));
6848
6849   // Start the animation
6850   animation.Play();
6851
6852   bool signalReceived(false);
6853   AnimationFinishCheck finishCheck(signalReceived);
6854   animation.FinishedSignal().Connect(&application, finishCheck);
6855
6856   application.SendNotification();
6857   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6858
6859   // We didn't expect the animation to finish yet
6860   application.SendNotification();
6861   finishCheck.CheckSignalNotReceived();
6862   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6863
6864   application.SendNotification();
6865   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6866
6867   // We didn't expect the animation to finish yet
6868   application.SendNotification();
6869   finishCheck.CheckSignalNotReceived();
6870   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6871
6872   application.SendNotification();
6873   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6874
6875   // We did expect the animation to finish
6876   application.SendNotification();
6877   finishCheck.CheckSignalReceived();
6878   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
6879   END_TEST;
6880 }
6881
6882 int UtcDaliAnimationAnimateToActorParentOriginP(void)
6883 {
6884   TestApplication application;
6885
6886   Actor actor = Actor::New();
6887   Stage::GetCurrent().Add(actor);
6888   DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_LEFT, TEST_LOCATION );
6889
6890   // Build the animation
6891   float durationSeconds(1.0f);
6892   Animation animation = Animation::New(durationSeconds);
6893   Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
6894
6895   DALI_TEST_ASSERTION(
6896   {
6897     animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin );
6898   }, "Property is not animatable" );
6899
6900   END_TEST;
6901 }
6902
6903 int UtcDaliAnimationAnimateToActorParentOriginXN(void)
6904 {
6905   TestApplication application;
6906
6907   Actor actor = Actor::New();
6908   Stage::GetCurrent().Add(actor);
6909   float startValue(0.0f);
6910   DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().x, startValue, TEST_LOCATION );
6911   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION );
6912
6913   // Build the animation
6914   float durationSeconds(1.0f);
6915   Animation animation = Animation::New(durationSeconds);
6916   float targetX(1.0f);
6917
6918   DALI_TEST_ASSERTION(
6919   {
6920     animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX );
6921   }, "Property is not animatable" );
6922
6923   END_TEST;
6924 }
6925
6926 int UtcDaliAnimationAnimateToActorParentOriginYN(void)
6927 {
6928   TestApplication application;
6929
6930   Actor actor = Actor::New();
6931   Stage::GetCurrent().Add(actor);
6932   float startValue(0.0f);
6933   DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().y, startValue, TEST_LOCATION );
6934   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION );
6935
6936   // Build the animation
6937   float durationSeconds(1.0f);
6938   Animation animation = Animation::New(durationSeconds);
6939   float targetY(1.0f);
6940
6941   DALI_TEST_ASSERTION(
6942   {
6943     animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY );
6944   }, "Property is not animatable" );
6945
6946   END_TEST;
6947 }
6948
6949 int UtcDaliAnimationAnimateToActorParentOriginZN(void)
6950 {
6951   TestApplication application;
6952
6953   Actor actor = Actor::New();
6954   Stage::GetCurrent().Add(actor);
6955   float startValue(0.5f);
6956   DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().z, startValue, TEST_LOCATION );
6957   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION );
6958
6959   // Build the animation
6960   float durationSeconds(1.0f);
6961   Animation animation = Animation::New(durationSeconds);
6962   float targetZ(1.0f);
6963
6964   DALI_TEST_ASSERTION(
6965   {
6966     animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ );
6967   }, "Property is not animatable" );
6968
6969   END_TEST;
6970 }
6971
6972 int UtcDaliAnimationAnimateToActorAnchorPointN(void)
6973 {
6974   TestApplication application;
6975
6976   Actor actor = Actor::New();
6977   Stage::GetCurrent().Add(actor);
6978   DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), AnchorPoint::CENTER, TEST_LOCATION );
6979
6980   // Build the animation
6981   float durationSeconds(1.0f);
6982   Animation animation = Animation::New(durationSeconds);
6983   Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT);
6984
6985   DALI_TEST_ASSERTION(
6986   {
6987     animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
6988   }, "Property is not animatable" );
6989
6990   END_TEST;
6991 }
6992
6993 int UtcDaliAnimationAnimateToActorAnchorPointXN(void)
6994 {
6995   TestApplication application;
6996
6997   Actor actor = Actor::New();
6998   Stage::GetCurrent().Add(actor);
6999   float startValue(0.5f);
7000   DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().x, startValue, TEST_LOCATION );
7001   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION );
7002
7003   // Build the animation
7004   float durationSeconds(1.0f);
7005   Animation animation = Animation::New(durationSeconds);
7006   float targetX(1.0f);
7007
7008   DALI_TEST_ASSERTION(
7009   {
7010     animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_X), targetX );
7011   }, "Property is not animatable" );
7012
7013   END_TEST;
7014 }
7015
7016 int UtcDaliAnimationAnimateToActorAnchorPointYN(void)
7017 {
7018   TestApplication application;
7019
7020   Actor actor = Actor::New();
7021   Stage::GetCurrent().Add(actor);
7022   float startValue(0.5f);
7023   DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().y, startValue, TEST_LOCATION );
7024   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION );
7025
7026   // Build the animation
7027   float durationSeconds(1.0f);
7028   Animation animation = Animation::New(durationSeconds);
7029   float targetY(0.0f);
7030
7031   DALI_TEST_ASSERTION(
7032   {
7033     animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY );
7034   }, "Property is not animatable" );
7035
7036   END_TEST;
7037 }
7038
7039 int UtcDaliAnimationAnimateToActorAnchorPointZN(void)
7040 {
7041   TestApplication application;
7042
7043   Actor actor = Actor::New();
7044   Stage::GetCurrent().Add(actor);
7045   float startValue(0.5f);
7046   DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().z, startValue, TEST_LOCATION );
7047   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION );
7048
7049   // Build the animation
7050   float durationSeconds(1.0f);
7051   Animation animation = Animation::New(durationSeconds);
7052   float targetZ(100.0f);
7053
7054   DALI_TEST_ASSERTION(
7055   {
7056     animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ );
7057   }, "Property is not animatable" );
7058
7059   END_TEST;
7060 }
7061
7062 int UtcDaliAnimationAnimateToActorSizeP(void)
7063 {
7064   TestApplication application;
7065
7066   Actor actor = Actor::New();
7067   Stage::GetCurrent().Add(actor);
7068   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7069
7070   // Build the animation
7071   float durationSeconds(1.0f);
7072   Animation animation = Animation::New(durationSeconds);
7073   Vector3 targetSize(100.0f, 100.0f, 100.0f);
7074   animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize );
7075
7076   Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7077
7078   // Should return the initial properties before play
7079   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7080   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), 0.0f, TEST_LOCATION );
7081   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), 0.0f, TEST_LOCATION );
7082   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), 0.0f, TEST_LOCATION );
7083
7084   // Start the animation
7085   animation.Play();
7086
7087   // Should return the target property after play
7088   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
7089   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
7090   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
7091   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
7092
7093   bool signalReceived(false);
7094   AnimationFinishCheck finishCheck(signalReceived);
7095   animation.FinishedSignal().Connect(&application, finishCheck);
7096
7097   application.SendNotification();
7098   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7099
7100   // We didn't expect the animation to finish yet
7101   application.SendNotification();
7102   finishCheck.CheckSignalNotReceived();
7103   DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
7104
7105   application.SendNotification();
7106   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7107
7108   // We did expect the animation to finish
7109   application.SendNotification();
7110   finishCheck.CheckSignalReceived();
7111   DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
7112
7113   // Reset everything
7114   finishCheck.Reset();
7115   actor.SetSize(Vector3::ZERO);
7116   application.SendNotification();
7117   application.Render(0);
7118   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7119
7120   // Repeat with a different (ease-in) alpha function
7121   animation = Animation::New(durationSeconds);
7122   animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
7123   animation.FinishedSignal().Connect(&application, finishCheck);
7124   animation.Play();
7125
7126   application.SendNotification();
7127   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7128
7129   // We didn't expect the animation to finish yet
7130   application.SendNotification();
7131   finishCheck.CheckSignalNotReceived();
7132
7133   // The size should have travelled less, than with a linear alpha function
7134   Vector3 current(actor.GetCurrentSize());
7135   DALI_TEST_CHECK( current.x > 0.0f );
7136   DALI_TEST_CHECK( current.y > 0.0f );
7137   DALI_TEST_CHECK( current.z > 0.0f );
7138   DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
7139   DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
7140   DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
7141
7142   application.SendNotification();
7143   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7144
7145   // We did expect the animation to finish
7146   application.SendNotification();
7147   finishCheck.CheckSignalReceived();
7148   DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
7149
7150   // Reset everything
7151   finishCheck.Reset();
7152   actor.SetSize(Vector3::ZERO);
7153   application.SendNotification();
7154   application.Render(0);
7155   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7156
7157   // Repeat with a delay
7158   float delay = 0.5f;
7159   animation = Animation::New(durationSeconds);
7160   animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7161   animation.FinishedSignal().Connect(&application, finishCheck);
7162   animation.Play();
7163
7164   application.SendNotification();
7165   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7166
7167   // We didn't expect the animation to finish yet
7168   application.SendNotification();
7169   finishCheck.CheckSignalNotReceived();
7170   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7171
7172   application.SendNotification();
7173   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7174
7175   // We did expect the animation to finish
7176   application.SendNotification();
7177   finishCheck.CheckSignalReceived();
7178   DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
7179   END_TEST;
7180 }
7181
7182 int UtcDaliAnimationAnimateToActorSizeWidthP(void)
7183 {
7184   TestApplication application;
7185
7186   Actor actor = Actor::New();
7187   Stage::GetCurrent().Add(actor);
7188   float startValue(0.0f);
7189   DALI_TEST_EQUALS( actor.GetCurrentSize().width, startValue, TEST_LOCATION );
7190   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION );
7191
7192   // Build the animation
7193   float durationSeconds(1.0f);
7194   Animation animation = Animation::New(durationSeconds);
7195   float targetWidth(10.0f);
7196   animation.AnimateTo( Property(actor, Actor::Property::SIZE_WIDTH), targetWidth );
7197
7198   float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f);
7199
7200   // Should return the initial properties before play
7201   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7202   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), startValue, TEST_LOCATION );
7203
7204   // Start the animation
7205   animation.Play();
7206
7207   // Should return the target property after play
7208   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( targetWidth, 0.0f, 0.0f ), TEST_LOCATION );
7209   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetWidth, TEST_LOCATION );
7210
7211   bool signalReceived(false);
7212   AnimationFinishCheck finishCheck(signalReceived);
7213   animation.FinishedSignal().Connect(&application, finishCheck);
7214
7215   application.SendNotification();
7216   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7217
7218   // We didn't expect the animation to finish yet
7219   application.SendNotification();
7220   finishCheck.CheckSignalNotReceived();
7221   DALI_TEST_EQUALS( actor.GetCurrentSize().width, fiftyPercentProgress, TEST_LOCATION );
7222
7223   application.SendNotification();
7224   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7225
7226   // We did expect the animation to finish
7227   application.SendNotification();
7228   finishCheck.CheckSignalReceived();
7229   DALI_TEST_EQUALS( actor.GetCurrentSize().width, targetWidth, TEST_LOCATION );
7230   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION );
7231   END_TEST;
7232 }
7233
7234 int UtcDaliAnimationAnimateToActorSizeHeightP(void)
7235 {
7236   TestApplication application;
7237
7238   Actor actor = Actor::New();
7239   Stage::GetCurrent().Add(actor);
7240   float startValue(0.0f);
7241   DALI_TEST_EQUALS( actor.GetCurrentSize().height, startValue, TEST_LOCATION );
7242   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION );
7243
7244   // Build the animation
7245   float durationSeconds(1.0f);
7246   Animation animation = Animation::New(durationSeconds);
7247   float targetHeight(-10.0f);
7248   animation.AnimateTo( Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight );
7249
7250   float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f);
7251
7252   // Should return the initial properties before play
7253   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7254   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), startValue, TEST_LOCATION );
7255
7256   // Start the animation
7257   animation.Play();
7258
7259   // Should return the target property after play
7260   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, targetHeight, 0.0f ), TEST_LOCATION );
7261   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetHeight, TEST_LOCATION );
7262
7263   bool signalReceived(false);
7264   AnimationFinishCheck finishCheck(signalReceived);
7265   animation.FinishedSignal().Connect(&application, finishCheck);
7266
7267   application.SendNotification();
7268   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7269
7270   // We didn't expect the animation to finish yet
7271   application.SendNotification();
7272   finishCheck.CheckSignalNotReceived();
7273   DALI_TEST_EQUALS( actor.GetCurrentSize().height, fiftyPercentProgress, TEST_LOCATION );
7274
7275   application.SendNotification();
7276   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7277
7278   // We did expect the animation to finish
7279   application.SendNotification();
7280   finishCheck.CheckSignalReceived();
7281   DALI_TEST_EQUALS( actor.GetCurrentSize().height, targetHeight, TEST_LOCATION );
7282   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION );
7283   END_TEST;
7284 }
7285
7286 int UtcDaliAnimationAnimateToActorSizeDepthP(void)
7287 {
7288   TestApplication application;
7289
7290   Actor actor = Actor::New();
7291   Stage::GetCurrent().Add(actor);
7292   float startValue(0.0f);
7293   DALI_TEST_EQUALS( actor.GetCurrentSize().depth, startValue, TEST_LOCATION );
7294   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION );
7295
7296   // Build the animation
7297   float durationSeconds(1.0f);
7298   Animation animation = Animation::New(durationSeconds);
7299   float targetDepth(-10.0f);
7300   animation.AnimateTo( Property(actor, Actor::Property::SIZE_DEPTH), targetDepth );
7301
7302   float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f);
7303
7304   // Should return the initial properties before play
7305   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7306   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), startValue, TEST_LOCATION );
7307
7308   // Start the animation
7309   animation.Play();
7310
7311   // Should return the target property after play
7312   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, 0.0f, targetDepth ), TEST_LOCATION );
7313   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetDepth, TEST_LOCATION );
7314
7315   bool signalReceived(false);
7316   AnimationFinishCheck finishCheck(signalReceived);
7317   animation.FinishedSignal().Connect(&application, finishCheck);
7318
7319   application.SendNotification();
7320   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7321
7322   // We didn't expect the animation to finish yet
7323   application.SendNotification();
7324   finishCheck.CheckSignalNotReceived();
7325   DALI_TEST_EQUALS( actor.GetCurrentSize().depth, fiftyPercentProgress, TEST_LOCATION );
7326
7327   application.SendNotification();
7328   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7329
7330   // We did expect the animation to finish
7331   application.SendNotification();
7332   finishCheck.CheckSignalReceived();
7333   DALI_TEST_EQUALS( actor.GetCurrentSize().depth, targetDepth, TEST_LOCATION );
7334   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION );
7335   END_TEST;
7336 }
7337
7338 int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void)
7339 {
7340   TestApplication application;
7341
7342   Actor actor = Actor::New();
7343   Stage::GetCurrent().Add(actor);
7344   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7345
7346   // Build the animation
7347   float durationSeconds(1.0f);
7348   Animation animation = Animation::New(durationSeconds);
7349   Vector3 targetSize(100.0f, 100.0f, 100.0f);
7350   animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetSize );
7351
7352   Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7353
7354   // Start the animation
7355   animation.Play();
7356
7357   bool signalReceived(false);
7358   AnimationFinishCheck finishCheck(signalReceived);
7359   animation.FinishedSignal().Connect(&application, finishCheck);
7360
7361   application.SendNotification();
7362   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7363
7364   // We didn't expect the animation to finish yet
7365   application.SendNotification();
7366   finishCheck.CheckSignalNotReceived();
7367   DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
7368
7369   application.SendNotification();
7370   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7371
7372   // We did expect the animation to finish
7373   application.SendNotification();
7374   finishCheck.CheckSignalReceived();
7375   DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
7376
7377   // Reset everything
7378   finishCheck.Reset();
7379   actor.SetSize(Vector3::ZERO);
7380   application.SendNotification();
7381   application.Render(0);
7382   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7383
7384   // Repeat with a different (ease-in) alpha function
7385   animation = Animation::New(durationSeconds);
7386   animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::EASE_IN );
7387   animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::EASE_IN );
7388   animation.FinishedSignal().Connect(&application, finishCheck);
7389   animation.Play();
7390
7391   application.SendNotification();
7392   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7393
7394   // We didn't expect the animation to finish yet
7395   application.SendNotification();
7396   finishCheck.CheckSignalNotReceived();
7397
7398   // The size should have travelled less, than with a linear alpha function
7399   Vector3 current(actor.GetCurrentSize());
7400   DALI_TEST_CHECK( current.x > 0.0f );
7401   DALI_TEST_CHECK( current.y > 0.0f );
7402   DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
7403   DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
7404
7405   application.SendNotification();
7406   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7407
7408   // We did expect the animation to finish
7409   application.SendNotification();
7410   finishCheck.CheckSignalReceived();
7411   DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
7412   DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
7413
7414   // Reset everything
7415   finishCheck.Reset();
7416   actor.SetSize(Vector3::ZERO);
7417   application.SendNotification();
7418   application.Render(0);
7419   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7420
7421   // Repeat with a delay
7422   float delay = 0.5f;
7423   animation = Animation::New(durationSeconds);
7424   animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
7425   animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
7426   animation.FinishedSignal().Connect(&application, finishCheck);
7427   animation.Play();
7428
7429   application.SendNotification();
7430   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7431
7432   // We didn't expect the animation to finish yet
7433   application.SendNotification();
7434   finishCheck.CheckSignalNotReceived();
7435   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7436
7437   application.SendNotification();
7438   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7439
7440   // We did expect the animation to finish
7441   application.SendNotification();
7442   finishCheck.CheckSignalReceived();
7443   DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
7444   DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
7445   END_TEST;
7446 }
7447
7448 int UtcDaliAnimationAnimateToActorPositionP(void)
7449 {
7450   TestApplication application;
7451
7452   Actor actor = Actor::New();
7453   Stage::GetCurrent().Add(actor);
7454   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7455
7456   // Build the animation
7457   float durationSeconds(1.0f);
7458   Animation animation = Animation::New(durationSeconds);
7459   Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7460   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
7461
7462   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7463
7464   // Should return the initial properties before play
7465   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7466   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
7467   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), 0.0f, TEST_LOCATION );
7468   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), 0.0f, TEST_LOCATION );
7469
7470   // Start the animation
7471   animation.Play();
7472
7473   // Should return the target property after play
7474   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
7475   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetPosition.x, TEST_LOCATION );
7476   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetPosition.y, TEST_LOCATION );
7477   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetPosition.z, TEST_LOCATION );
7478
7479   bool signalReceived(false);
7480   AnimationFinishCheck finishCheck(signalReceived);
7481   animation.FinishedSignal().Connect(&application, finishCheck);
7482
7483   application.SendNotification();
7484   application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
7485
7486   // We didn't expect the animation to finish yet
7487   application.SendNotification();
7488   finishCheck.CheckSignalNotReceived();
7489   DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7490
7491   application.SendNotification();
7492   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7493
7494   // We did expect the animation to finish
7495   application.SendNotification();
7496   finishCheck.CheckSignalReceived();
7497   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7498   END_TEST;
7499 }
7500
7501 int UtcDaliAnimationAnimateToActorPositionXP(void)
7502 {
7503   TestApplication application;
7504
7505   Actor actor = Actor::New();
7506   Stage::GetCurrent().Add(actor);
7507   float startValue(0.0f);
7508   DALI_TEST_EQUALS( actor.GetCurrentPosition().x, startValue, TEST_LOCATION );
7509   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7510   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7511   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7512
7513   // Build the animation
7514   float durationSeconds(1.0f);
7515   Animation animation = Animation::New(durationSeconds);
7516   float targetX(1.0f);
7517   animation.AnimateTo( Property(actor, Actor::Property::POSITION_X), targetX );
7518
7519   float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
7520
7521   // Should return the initial properties before play
7522   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7523   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), startValue, TEST_LOCATION );
7524
7525   // Start the animation
7526   animation.Play();
7527
7528   // Should return the target property after play
7529   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( targetX, 0.0f, 0.0f ), TEST_LOCATION );
7530   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetX, TEST_LOCATION );
7531
7532   bool signalReceived(false);
7533   AnimationFinishCheck finishCheck(signalReceived);
7534   animation.FinishedSignal().Connect(&application, finishCheck);
7535
7536   application.SendNotification();
7537   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7538
7539   // We didn't expect the animation to finish yet
7540   application.SendNotification();
7541   finishCheck.CheckSignalNotReceived();
7542   DALI_TEST_EQUALS( actor.GetCurrentPosition().x, fiftyPercentProgress, TEST_LOCATION );
7543
7544   application.SendNotification();
7545   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7546
7547   // We did expect the animation to finish
7548   application.SendNotification();
7549   finishCheck.CheckSignalReceived();
7550   DALI_TEST_EQUALS( actor.GetCurrentPosition().x, targetX, TEST_LOCATION );
7551   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION );
7552   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7553   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7554   END_TEST;
7555 }
7556
7557 int UtcDaliAnimationAnimateToActorPositionYP(void)
7558 {
7559   TestApplication application;
7560
7561   Actor actor = Actor::New();
7562   Stage::GetCurrent().Add(actor);
7563   float startValue(0.0f);
7564   DALI_TEST_EQUALS( actor.GetCurrentPosition().y, startValue, TEST_LOCATION );
7565   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7566   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7567   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7568
7569   // Build the animation
7570   float durationSeconds(1.0f);
7571   Animation animation = Animation::New(durationSeconds);
7572   float targetY(10.0f);
7573   animation.AnimateTo( Property(actor, Actor::Property::POSITION_Y), targetY );
7574
7575   float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
7576
7577   // Should return the initial properties before play
7578   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7579   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), startValue, TEST_LOCATION );
7580
7581   // Start the animation
7582   animation.Play();
7583
7584   // Should return the target property after play
7585   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, targetY, 0.0f ), TEST_LOCATION );
7586   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetY, TEST_LOCATION );
7587
7588   bool signalReceived(false);
7589   AnimationFinishCheck finishCheck(signalReceived);
7590   animation.FinishedSignal().Connect(&application, finishCheck);
7591
7592   application.SendNotification();
7593   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7594
7595   // We didn't expect the animation to finish yet
7596   application.SendNotification();
7597   finishCheck.CheckSignalNotReceived();
7598   DALI_TEST_EQUALS( actor.GetCurrentPosition().y, fiftyPercentProgress, TEST_LOCATION );
7599
7600   application.SendNotification();
7601   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7602
7603   // We did expect the animation to finish
7604   application.SendNotification();
7605   finishCheck.CheckSignalReceived();
7606   DALI_TEST_EQUALS( actor.GetCurrentPosition().y, targetY, TEST_LOCATION );
7607   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7608   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION );
7609   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7610   END_TEST;
7611 }
7612
7613 int UtcDaliAnimationAnimateToActorPositionZP(void)
7614 {
7615   TestApplication application;
7616
7617   Actor actor = Actor::New();
7618   Stage::GetCurrent().Add(actor);
7619   float startValue(0.0f);
7620   DALI_TEST_EQUALS( actor.GetCurrentPosition().z, startValue, TEST_LOCATION );
7621   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7622   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7623   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7624
7625   // Build the animation
7626   float durationSeconds(1.0f);
7627   Animation animation = Animation::New(durationSeconds);
7628   float targetZ(-5.0f);
7629   animation.AnimateTo( Property(actor, Actor::Property::POSITION_Z), targetZ );
7630
7631   float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
7632
7633   // Should return the initial properties before play
7634   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7635   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), startValue, TEST_LOCATION );
7636
7637   // Start the animation
7638   animation.Play();
7639
7640   // Should return the target property after play
7641   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, targetZ ), TEST_LOCATION );
7642   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetZ, TEST_LOCATION );
7643
7644   bool signalReceived(false);
7645   AnimationFinishCheck finishCheck(signalReceived);
7646   animation.FinishedSignal().Connect(&application, finishCheck);
7647
7648   application.SendNotification();
7649   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7650
7651   // We didn't expect the animation to finish yet
7652   application.SendNotification();
7653   finishCheck.CheckSignalNotReceived();
7654   DALI_TEST_EQUALS( actor.GetCurrentPosition().z, fiftyPercentProgress, TEST_LOCATION );
7655
7656   application.SendNotification();
7657   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7658
7659   // We did expect the animation to finish
7660   application.SendNotification();
7661   finishCheck.CheckSignalReceived();
7662   DALI_TEST_EQUALS( actor.GetCurrentPosition().z, targetZ, TEST_LOCATION );
7663   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7664   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7665   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION );
7666   END_TEST;
7667 }
7668
7669 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void)
7670 {
7671   TestApplication application;
7672
7673   Actor actor = Actor::New();
7674   Stage::GetCurrent().Add(actor);
7675   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7676
7677   // Build the animation
7678   float durationSeconds(1.0f);
7679   Animation animation = Animation::New(durationSeconds);
7680   Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7681   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
7682
7683   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7684
7685   // Start the animation
7686   animation.Play();
7687
7688   bool signalReceived(false);
7689   AnimationFinishCheck finishCheck(signalReceived);
7690   animation.FinishedSignal().Connect(&application, finishCheck);
7691
7692   application.SendNotification();
7693   application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
7694
7695   // We didn't expect the animation to finish yet
7696   application.SendNotification();
7697   finishCheck.CheckSignalNotReceived();
7698
7699   // The position should have moved less, than with a linear alpha function
7700   Vector3 current(actor.GetCurrentPosition());
7701   DALI_TEST_CHECK( current.x > Vector3::ZERO.x );
7702   DALI_TEST_CHECK( current.y > Vector3::ZERO.y );
7703   DALI_TEST_CHECK( current.z > Vector3::ZERO.z );
7704   DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x );
7705   DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y );
7706   DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z );
7707
7708   application.SendNotification();
7709   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7710
7711   // We did expect the animation to finish
7712   application.SendNotification();
7713   finishCheck.CheckSignalReceived();
7714   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7715   END_TEST;
7716 }
7717
7718 int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void)
7719 {
7720   TestApplication application;
7721
7722   Actor actor = Actor::New();
7723   Stage::GetCurrent().Add(actor);
7724   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7725
7726   // Build the animation
7727   float durationSeconds(1.0f);
7728   Animation animation = Animation::New(durationSeconds);
7729   Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7730   float delay = 0.5f;
7731   animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7732                        targetPosition,
7733                        TimePeriod( delay, durationSeconds - delay ) );
7734
7735   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7736
7737   // Start the animation
7738   animation.Play();
7739
7740   bool signalReceived(false);
7741   AnimationFinishCheck finishCheck(signalReceived);
7742   animation.FinishedSignal().Connect(&application, finishCheck);
7743
7744   application.SendNotification();
7745   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7746
7747   // We didn't expect the animation to finish yet
7748   application.SendNotification();
7749   finishCheck.CheckSignalNotReceived();
7750   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7751
7752   application.SendNotification();
7753   application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7754
7755   // We didn't expect the animation to finish yet
7756   application.SendNotification();
7757   finishCheck.CheckSignalNotReceived();
7758   DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7759
7760   application.SendNotification();
7761   application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7762
7763   // We did expect the animation to finish
7764   application.SendNotification();
7765   finishCheck.CheckSignalReceived();
7766   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7767   END_TEST;
7768 }
7769
7770 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void)
7771 {
7772   TestApplication application;
7773
7774   Actor actor = Actor::New();
7775   Stage::GetCurrent().Add(actor);
7776   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7777
7778   // Build the animation
7779   float durationSeconds(1.0f);
7780   Animation animation = Animation::New(durationSeconds);
7781   Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7782   float delay = 0.5f;
7783   animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7784                        targetPosition,
7785                        AlphaFunction::LINEAR,
7786                        TimePeriod( delay, durationSeconds - delay ) );
7787
7788   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7789
7790   // Start the animation
7791   animation.Play();
7792
7793   bool signalReceived(false);
7794   AnimationFinishCheck finishCheck(signalReceived);
7795   animation.FinishedSignal().Connect(&application, finishCheck);
7796
7797   application.SendNotification();
7798   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7799
7800   // We didn't expect the animation to finish yet
7801   application.SendNotification();
7802   finishCheck.CheckSignalNotReceived();
7803   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7804
7805   application.SendNotification();
7806   application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7807
7808   // We didn't expect the animation to finish yet
7809   application.SendNotification();
7810   finishCheck.CheckSignalNotReceived();
7811   DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7812
7813   application.SendNotification();
7814   application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7815
7816   // We did expect the animation to finish
7817   application.SendNotification();
7818   finishCheck.CheckSignalReceived();
7819   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7820   END_TEST;
7821 }
7822
7823 int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void)
7824 {
7825   TestApplication application;
7826
7827   Actor actor = Actor::New();
7828   actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7829   Stage::GetCurrent().Add(actor);
7830   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7831
7832   // Build the animation
7833   float durationSeconds(1.0f);
7834   Animation animation = Animation::New(durationSeconds);
7835   Degree targetRotationDegrees(90.0f);
7836   Radian targetRotationRadians(targetRotationDegrees);
7837   animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS) );
7838
7839   // Start the animation
7840   animation.Play();
7841
7842   // Target value should be retrievable straight away
7843   DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7844
7845   bool signalReceived(false);
7846   AnimationFinishCheck finishCheck(signalReceived);
7847   animation.FinishedSignal().Connect(&application, finishCheck);
7848
7849   application.SendNotification();
7850   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7851
7852   // We didn't expect the animation to finish yet
7853   application.SendNotification();
7854   finishCheck.CheckSignalNotReceived();
7855   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7856
7857   application.SendNotification();
7858   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7859
7860   // We didn't expect the animation to finish yet
7861   application.SendNotification();
7862   finishCheck.CheckSignalNotReceived();
7863   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7864
7865   application.SendNotification();
7866   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7867
7868   // We didn't expect the animation to finish yet
7869   application.SendNotification();
7870   finishCheck.CheckSignalNotReceived();
7871   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7872
7873   application.SendNotification();
7874   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7875
7876   // We did expect the animation to finish
7877   application.SendNotification();
7878   finishCheck.CheckSignalReceived();
7879   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7880   END_TEST;
7881 }
7882
7883 int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void)
7884 {
7885   TestApplication application;
7886
7887   Actor actor = Actor::New();
7888   actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7889   Stage::GetCurrent().Add(actor);
7890   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7891
7892   // Build the animation
7893   float durationSeconds(1.0f);
7894   Animation animation = Animation::New(durationSeconds);
7895   Degree targetRotationDegrees(90.0f);
7896   Radian targetRotationRadians(targetRotationDegrees);
7897   Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
7898   animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), targetRotation );
7899
7900   // Start the animation
7901   animation.Play();
7902
7903   bool signalReceived(false);
7904   AnimationFinishCheck finishCheck(signalReceived);
7905   animation.FinishedSignal().Connect(&application, finishCheck);
7906
7907   application.SendNotification();
7908   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7909
7910   // We didn't expect the animation to finish yet
7911   application.SendNotification();
7912   finishCheck.CheckSignalNotReceived();
7913   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7914
7915   application.SendNotification();
7916   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7917
7918   // We didn't expect the animation to finish yet
7919   application.SendNotification();
7920   finishCheck.CheckSignalNotReceived();
7921   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7922
7923   application.SendNotification();
7924   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7925
7926   // We didn't expect the animation to finish yet
7927   application.SendNotification();
7928   finishCheck.CheckSignalNotReceived();
7929   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7930
7931   application.SendNotification();
7932   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7933
7934   // We did expect the animation to finish
7935   application.SendNotification();
7936   finishCheck.CheckSignalReceived();
7937   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7938   END_TEST;
7939 }
7940
7941 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void)
7942 {
7943   TestApplication application;
7944
7945   Actor actor = Actor::New();
7946   actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7947   Stage::GetCurrent().Add(actor);
7948   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7949
7950   // Build the animation
7951   float durationSeconds(1.0f);
7952   Animation animation = Animation::New(durationSeconds);
7953   Degree targetRotationDegrees(90.0f);
7954   Radian targetRotationRadians(targetRotationDegrees);
7955   animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
7956
7957   // Start the animation
7958   animation.Play();
7959
7960   bool signalReceived(false);
7961   AnimationFinishCheck finishCheck(signalReceived);
7962   animation.FinishedSignal().Connect(&application, finishCheck);
7963
7964   application.SendNotification();
7965   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7966
7967   // We didn't expect the animation to finish yet
7968   application.SendNotification();
7969   finishCheck.CheckSignalNotReceived();
7970   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7971
7972   application.SendNotification();
7973   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7974
7975   // We didn't expect the animation to finish yet
7976   application.SendNotification();
7977   finishCheck.CheckSignalNotReceived();
7978   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7979
7980   application.SendNotification();
7981   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7982
7983   // We didn't expect the animation to finish yet
7984   application.SendNotification();
7985   finishCheck.CheckSignalNotReceived();
7986   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7987
7988   application.SendNotification();
7989   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7990
7991   // We did expect the animation to finish
7992   application.SendNotification();
7993   finishCheck.CheckSignalReceived();
7994   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7995   END_TEST;
7996 }
7997
7998 int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void)
7999 {
8000   TestApplication application;
8001
8002   Actor actor = Actor::New();
8003   actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
8004   Stage::GetCurrent().Add(actor);
8005   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
8006
8007   // Build the animation
8008   float durationSeconds(1.0f);
8009   Animation animation = Animation::New(durationSeconds);
8010   Degree targetRotationDegrees(90.0f);
8011   Radian targetRotationRadians(targetRotationDegrees);
8012   float delay(0.1f);
8013   animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
8014
8015   // Start the animation
8016   animation.Play();
8017
8018   bool signalReceived(false);
8019   AnimationFinishCheck finishCheck(signalReceived);
8020   animation.FinishedSignal().Connect(&application, finishCheck);
8021
8022   application.SendNotification();
8023   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8024
8025   // We didn't expect the animation to finish yet
8026   application.SendNotification();
8027   finishCheck.CheckSignalNotReceived();
8028   float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
8029   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8030
8031   application.SendNotification();
8032   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8033
8034   // We didn't expect the animation to finish yet
8035   application.SendNotification();
8036   finishCheck.CheckSignalNotReceived();
8037   progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
8038   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8039
8040   application.SendNotification();
8041   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8042
8043   // We didn't expect the animation to finish yet
8044   application.SendNotification();
8045   finishCheck.CheckSignalNotReceived();
8046   progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
8047   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8048
8049   application.SendNotification();
8050   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8051
8052   // We did expect the animation to finish
8053   application.SendNotification();
8054   finishCheck.CheckSignalReceived();
8055   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8056   END_TEST;
8057 }
8058
8059 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void)
8060 {
8061   TestApplication application;
8062
8063   Actor actor = Actor::New();
8064   actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
8065   Stage::GetCurrent().Add(actor);
8066   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
8067
8068   // Build the animation
8069   float durationSeconds(1.0f);
8070   Animation animation = Animation::New(durationSeconds);
8071   Degree targetRotationDegrees(90.0f);
8072   Radian targetRotationRadians(targetRotationDegrees);
8073   float delay(0.1f);
8074   animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
8075
8076   // Start the animation
8077   animation.Play();
8078
8079   bool signalReceived(false);
8080   AnimationFinishCheck finishCheck(signalReceived);
8081   animation.FinishedSignal().Connect(&application, finishCheck);
8082
8083   application.SendNotification();
8084   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8085
8086   // We didn't expect the animation to finish yet
8087   application.SendNotification();
8088   finishCheck.CheckSignalNotReceived();
8089   float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
8090   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8091
8092   application.SendNotification();
8093   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8094
8095   // We didn't expect the animation to finish yet
8096   application.SendNotification();
8097   finishCheck.CheckSignalNotReceived();
8098   progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
8099   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8100
8101   application.SendNotification();
8102   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8103
8104   // We didn't expect the animation to finish yet
8105   application.SendNotification();
8106   finishCheck.CheckSignalNotReceived();
8107   progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
8108   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8109
8110   application.SendNotification();
8111   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8112
8113   // We did expect the animation to finish
8114   application.SendNotification();
8115   finishCheck.CheckSignalReceived();
8116   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8117   END_TEST;
8118 }
8119
8120 int UtcDaliAnimationAnimateToActorScaleP(void)
8121 {
8122   TestApplication application;
8123
8124   Actor actor = Actor::New();
8125   Stage::GetCurrent().Add(actor);
8126   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
8127
8128   // Build the animation
8129   float durationSeconds(1.0f);
8130   Animation animation = Animation::New(durationSeconds);
8131   Vector3 targetScale(2.0f, 2.0f, 2.0f);
8132   animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale );
8133
8134   Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f);
8135
8136   // Start the animation
8137   animation.Play();
8138
8139   // Target value should be retrievable straight away
8140   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
8141   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetScale.x, TEST_LOCATION );
8142   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetScale.y, TEST_LOCATION );
8143   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetScale.z, TEST_LOCATION );
8144
8145   bool signalReceived(false);
8146   AnimationFinishCheck finishCheck(signalReceived);
8147   animation.FinishedSignal().Connect(&application, finishCheck);
8148
8149   application.SendNotification();
8150   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8151
8152   // We didn't expect the animation to finish yet
8153   application.SendNotification();
8154   finishCheck.CheckSignalNotReceived();
8155   DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
8156
8157   application.SendNotification();
8158   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8159
8160   // We did expect the animation to finish
8161   application.SendNotification();
8162   finishCheck.CheckSignalReceived();
8163   DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
8164
8165   // Reset everything
8166   finishCheck.Reset();
8167   actor.SetScale(Vector3::ONE);
8168   application.SendNotification();
8169   application.Render(0);
8170   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
8171
8172   // Repeat with a different (ease-in) alpha function
8173   animation = Animation::New(durationSeconds);
8174   animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
8175   animation.FinishedSignal().Connect(&application, finishCheck);
8176   animation.Play();
8177
8178   application.SendNotification();
8179   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8180
8181   // We didn't expect the animation to finish yet
8182   application.SendNotification();
8183   finishCheck.CheckSignalNotReceived();
8184
8185   // The scale should have grown less, than with a linear alpha function
8186   Vector3 current(actor.GetCurrentScale());
8187   DALI_TEST_CHECK( current.x > 1.0f );
8188   DALI_TEST_CHECK( current.y > 1.0f );
8189   DALI_TEST_CHECK( current.z > 1.0f );
8190   DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
8191   DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
8192   DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
8193
8194   application.SendNotification();
8195   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8196
8197   // We did expect the animation to finish
8198   application.SendNotification();
8199   finishCheck.CheckSignalReceived();
8200   DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
8201
8202   // Reset everything
8203   finishCheck.Reset();
8204   actor.SetScale(Vector3::ONE);
8205   application.SendNotification();
8206   application.Render(0);
8207   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
8208
8209   // Repeat with a delay
8210   float delay = 0.5f;
8211   animation = Animation::New(durationSeconds);
8212   animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
8213   animation.FinishedSignal().Connect(&application, finishCheck);
8214   animation.Play();
8215
8216   application.SendNotification();
8217   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
8218
8219   // We didn't expect the animation to finish yet
8220   application.SendNotification();
8221   finishCheck.CheckSignalNotReceived();
8222   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
8223
8224   application.SendNotification();
8225   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8226
8227   // We did expect the animation to finish
8228   application.SendNotification();
8229   finishCheck.CheckSignalReceived();
8230   DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
8231   END_TEST;
8232 }
8233
8234 int UtcDaliAnimationAnimateToActorScaleXP(void)
8235 {
8236   TestApplication application;
8237
8238   Actor actor = Actor::New();
8239   Stage::GetCurrent().Add(actor);
8240   float startValue(1.0f);
8241   DALI_TEST_EQUALS( actor.GetCurrentScale().x, startValue, TEST_LOCATION );
8242   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
8243   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
8244   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
8245   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8246   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8247   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8248
8249   // Build the animation
8250   float durationSeconds(1.0f);
8251   Animation animation = Animation::New(durationSeconds);
8252   float targetX(10.0f);
8253   animation.AnimateTo( Property(actor, Actor::Property::SCALE_X), targetX );
8254
8255   float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
8256
8257   // Start the animation
8258   animation.Play();
8259
8260   // Target value should be retrievable straight away
8261   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( targetX, startValue, startValue ), TEST_LOCATION );
8262   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetX, TEST_LOCATION );
8263
8264   bool signalReceived(false);
8265   AnimationFinishCheck finishCheck(signalReceived);
8266   animation.FinishedSignal().Connect(&application, finishCheck);
8267
8268   application.SendNotification();
8269   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8270
8271   // We didn't expect the animation to finish yet
8272   application.SendNotification();
8273   finishCheck.CheckSignalNotReceived();
8274   DALI_TEST_EQUALS( actor.GetCurrentScale().x, fiftyPercentProgress, TEST_LOCATION );
8275   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), fiftyPercentProgress, TEST_LOCATION );
8276   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8277   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8278
8279   application.SendNotification();
8280   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8281
8282   // We did expect the animation to finish
8283   application.SendNotification();
8284   finishCheck.CheckSignalReceived();
8285   DALI_TEST_EQUALS( actor.GetCurrentScale().x, targetX, TEST_LOCATION );
8286   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), targetX, TEST_LOCATION );
8287   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8288   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8289   END_TEST;
8290 }
8291
8292 int UtcDaliAnimationAnimateToActorScaleYP(void)
8293 {
8294   TestApplication application;
8295
8296   Actor actor = Actor::New();
8297   Stage::GetCurrent().Add(actor);
8298   float startValue(1.0f);
8299   DALI_TEST_EQUALS( actor.GetCurrentScale().y, startValue, TEST_LOCATION );
8300   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
8301   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
8302   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
8303   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8304   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8305   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8306
8307   // Build the animation
8308   float durationSeconds(1.0f);
8309   Animation animation = Animation::New(durationSeconds);
8310   float targetY(1000.0f);
8311   animation.AnimateTo( Property(actor, Actor::Property::SCALE_Y), targetY );
8312
8313   float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
8314
8315   // Start the animation
8316   animation.Play();
8317
8318   // Target value should be retrievable straight away
8319   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, targetY, startValue ), TEST_LOCATION );
8320   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetY, TEST_LOCATION );
8321
8322   bool signalReceived(false);
8323   AnimationFinishCheck finishCheck(signalReceived);
8324   animation.FinishedSignal().Connect(&application, finishCheck);
8325
8326   application.SendNotification();
8327   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8328
8329   // We didn't expect the animation to finish yet
8330   application.SendNotification();
8331   finishCheck.CheckSignalNotReceived();
8332   DALI_TEST_EQUALS( actor.GetCurrentScale().y, fiftyPercentProgress, TEST_LOCATION );
8333   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8334   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), fiftyPercentProgress, TEST_LOCATION );
8335   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8336
8337   application.SendNotification();
8338   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8339
8340   // We did expect the animation to finish
8341   application.SendNotification();
8342   finishCheck.CheckSignalReceived();
8343   DALI_TEST_EQUALS( actor.GetCurrentScale().y, targetY, TEST_LOCATION );
8344   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8345   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), targetY, TEST_LOCATION );
8346   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8347   END_TEST;
8348 }
8349
8350 int UtcDaliAnimationAnimateToActorScaleZP(void)
8351 {
8352   TestApplication application;
8353
8354   Actor actor = Actor::New();
8355   Stage::GetCurrent().Add(actor);
8356   float startValue(1.0f);
8357   DALI_TEST_EQUALS( actor.GetCurrentScale().z, startValue, TEST_LOCATION );
8358   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
8359   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
8360   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
8361   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8362   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8363   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8364
8365   // Build the animation
8366   float durationSeconds(1.0f);
8367   Animation animation = Animation::New(durationSeconds);
8368   float targetZ(-1000.0f);
8369   animation.AnimateTo( Property(actor, Actor::Property::SCALE_Z), targetZ );
8370
8371   float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
8372
8373   // Start the animation
8374   animation.Play();
8375
8376   // Target value should be retrievable straight away
8377   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, startValue, targetZ ), TEST_LOCATION );
8378   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION );
8379
8380   bool signalReceived(false);
8381   AnimationFinishCheck finishCheck(signalReceived);
8382   animation.FinishedSignal().Connect(&application, finishCheck);
8383
8384   application.SendNotification();
8385   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8386
8387   // We didn't expect the animation to finish yet
8388   application.SendNotification();
8389   finishCheck.CheckSignalNotReceived();
8390   DALI_TEST_EQUALS( actor.GetCurrentScale().z, fiftyPercentProgress, TEST_LOCATION );
8391   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8392   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8393   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), fiftyPercentProgress, TEST_LOCATION );
8394
8395   application.SendNotification();
8396   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8397
8398   // We did expect the animation to finish
8399   application.SendNotification();
8400   finishCheck.CheckSignalReceived();
8401   DALI_TEST_EQUALS( actor.GetCurrentScale().z, targetZ, TEST_LOCATION );
8402   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8403   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8404   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION );
8405   END_TEST;
8406 }
8407
8408 int UtcDaliAnimationAnimateToActorColorP(void)
8409 {
8410   TestApplication application;
8411
8412   Actor actor = Actor::New();
8413   Stage::GetCurrent().Add(actor);
8414   DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
8415
8416   // Build the animation
8417   float durationSeconds(1.0f);
8418   Animation animation = Animation::New(durationSeconds);
8419   Vector4 targetColor(Color::RED);
8420   animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor );
8421
8422   Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
8423   Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
8424
8425   // Start the animation
8426   animation.Play();
8427
8428   // Target value should be retrievable straight away
8429   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
8430   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
8431   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
8432   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
8433   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
8434   DALI_TEST_EQUALS( actor.GetProperty< float >( DevelActor::Property::OPACITY ), targetColor.a, TEST_LOCATION );
8435
8436   bool signalReceived(false);
8437   AnimationFinishCheck finishCheck(signalReceived);
8438   animation.FinishedSignal().Connect(&application, finishCheck);
8439
8440   application.SendNotification();
8441   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8442
8443   // We didn't expect the animation to finish yet
8444   application.SendNotification();
8445   finishCheck.CheckSignalNotReceived();
8446   DALI_TEST_EQUALS( actor.GetCurrentColor(), tenPercentProgress, TEST_LOCATION );
8447
8448   application.SendNotification();
8449   application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
8450
8451   // We did expect the animation to finish
8452   application.SendNotification();
8453   finishCheck.CheckSignalReceived();
8454   DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8455
8456   // Reset everything
8457   finishCheck.Reset();
8458   actor.SetColor(Color::WHITE);
8459   application.SendNotification();
8460   application.Render(0);
8461   DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
8462
8463   // Repeat with a different (ease-in) alpha function
8464   animation = Animation::New(durationSeconds);
8465   animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
8466   animation.FinishedSignal().Connect(&application, finishCheck);
8467   animation.Play();
8468
8469   application.SendNotification();
8470   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8471
8472   // We didn't expect the animation to finish yet
8473   application.SendNotification();
8474   finishCheck.CheckSignalNotReceived();
8475
8476   // The color should have changed less, than with a linear alpha function
8477   Vector4 current(actor.GetCurrentColor());
8478   DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change
8479   DALI_TEST_CHECK( current.y < 1.0f );
8480   DALI_TEST_CHECK( current.y > tenPercentProgress.y );
8481   DALI_TEST_CHECK( current.z  < 1.0f );
8482   DALI_TEST_CHECK( current.z  > tenPercentProgress.z );
8483   DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
8484
8485   application.SendNotification();
8486   application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
8487
8488   // We did expect the animation to finish
8489   application.SendNotification();
8490   finishCheck.CheckSignalReceived();
8491   DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8492
8493   // Reset everything
8494   finishCheck.Reset();
8495   actor.SetColor(Color::WHITE);
8496   application.SendNotification();
8497   application.Render(0);
8498   DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
8499
8500   // Repeat with a shorter animator duration
8501   float animatorDuration = 0.5f;
8502   animation = Animation::New(durationSeconds);
8503   animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
8504   animation.FinishedSignal().Connect(&application, finishCheck);
8505   animation.Play();
8506
8507   application.SendNotification();
8508   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
8509
8510   // We didn't expect the animation to finish yet
8511   application.SendNotification();
8512   finishCheck.CheckSignalNotReceived();
8513   DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION );
8514
8515   application.SendNotification();
8516   application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
8517
8518   // We didn't expect the animation to finish yet
8519   application.SendNotification();
8520   finishCheck.CheckSignalNotReceived();
8521   DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8522
8523   application.SendNotification();
8524   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8525
8526   // We did expect the animation to finish
8527   application.SendNotification();
8528   finishCheck.CheckSignalReceived();
8529   DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8530   END_TEST;
8531 }
8532
8533 int UtcDaliAnimationAnimateToActorColorRedP(void)
8534 {
8535   TestApplication application;
8536
8537   Actor actor = Actor::New();
8538   Stage::GetCurrent().Add(actor);
8539   float startValue(1.0f);
8540   DALI_TEST_EQUALS( actor.GetCurrentColor().r, startValue, TEST_LOCATION );
8541   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8542   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8543   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8544   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8545   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8546   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8547   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8548   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8549
8550   // Build the animation
8551   float durationSeconds(1.0f);
8552   Animation animation = Animation::New(durationSeconds);
8553   float targetRed(0.5f);
8554   animation.AnimateTo( Property(actor, Actor::Property::COLOR_RED), targetRed );
8555
8556   float fiftyPercentProgress(startValue + (targetRed - startValue)*0.5f);
8557
8558   // Start the animation
8559   animation.Play();
8560
8561   // Target value should be retrievable straight away
8562   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( targetRed, startValue, startValue, startValue ), TEST_LOCATION );
8563   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetRed, TEST_LOCATION );
8564
8565   bool signalReceived(false);
8566   AnimationFinishCheck finishCheck(signalReceived);
8567   animation.FinishedSignal().Connect(&application, finishCheck);
8568
8569   application.SendNotification();
8570   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8571
8572   // We didn't expect the animation to finish yet
8573   application.SendNotification();
8574   finishCheck.CheckSignalNotReceived();
8575   DALI_TEST_EQUALS( actor.GetCurrentColor().r, fiftyPercentProgress, TEST_LOCATION );
8576   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED),   fiftyPercentProgress, TEST_LOCATION );
8577   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue,           TEST_LOCATION );
8578   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE),  startValue,           TEST_LOCATION );
8579   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue,           TEST_LOCATION );
8580
8581   application.SendNotification();
8582   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8583
8584   // We did expect the animation to finish
8585   application.SendNotification();
8586   finishCheck.CheckSignalReceived();
8587   DALI_TEST_EQUALS( actor.GetCurrentColor().r, targetRed, TEST_LOCATION );
8588   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED),   targetRed,  TEST_LOCATION );
8589   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8590   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8591   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8592   END_TEST;
8593 }
8594
8595 int UtcDaliAnimationAnimateToActorColorGreenP(void)
8596 {
8597   TestApplication application;
8598
8599   Actor actor = Actor::New();
8600   Stage::GetCurrent().Add(actor);
8601   float startValue(1.0f);
8602   DALI_TEST_EQUALS( actor.GetCurrentColor().g, startValue, TEST_LOCATION );
8603   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8604   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8605   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8606   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8607   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8608   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8609   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8610   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8611
8612   // Build the animation
8613   float durationSeconds(1.0f);
8614   Animation animation = Animation::New(durationSeconds);
8615   float targetGreen(0.5f);
8616   animation.AnimateTo( Property(actor, Actor::Property::COLOR_GREEN), targetGreen );
8617
8618   float fiftyPercentProgress(startValue + (targetGreen - startValue)*0.5f);
8619
8620   // Start the animation
8621   animation.Play();
8622
8623   // Target value should be retrievable straight away
8624   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, targetGreen, startValue, startValue ), TEST_LOCATION );
8625   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetGreen, TEST_LOCATION );
8626
8627   bool signalReceived(false);
8628   AnimationFinishCheck finishCheck(signalReceived);
8629   animation.FinishedSignal().Connect(&application, finishCheck);
8630
8631   application.SendNotification();
8632   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8633
8634   // We didn't expect the animation to finish yet
8635   application.SendNotification();
8636   finishCheck.CheckSignalNotReceived();
8637   DALI_TEST_EQUALS( actor.GetCurrentColor().g, fiftyPercentProgress, TEST_LOCATION );
8638   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED),   startValue,           TEST_LOCATION );
8639   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION );
8640   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE),  startValue,           TEST_LOCATION );
8641   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue,           TEST_LOCATION );
8642
8643   application.SendNotification();
8644   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8645
8646   // We did expect the animation to finish
8647   application.SendNotification();
8648   finishCheck.CheckSignalReceived();
8649   DALI_TEST_EQUALS( actor.GetCurrentColor().g, targetGreen, TEST_LOCATION );
8650   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED),   startValue,  TEST_LOCATION );
8651   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION );
8652   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE),  startValue,  TEST_LOCATION );
8653   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue,  TEST_LOCATION );
8654   END_TEST;
8655 }
8656
8657 int UtcDaliAnimationAnimateToActorColorBlueP(void)
8658 {
8659   TestApplication application;
8660
8661   Actor actor = Actor::New();
8662   Stage::GetCurrent().Add(actor);
8663   float startValue(1.0f);
8664   DALI_TEST_EQUALS( actor.GetCurrentColor().b, startValue, TEST_LOCATION );
8665   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8666   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8667   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8668   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8669   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8670   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8671   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8672   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8673
8674   // Build the animation
8675   float durationSeconds(1.0f);
8676   Animation animation = Animation::New(durationSeconds);
8677   float targetBlue(0.5f);
8678   animation.AnimateTo( Property(actor, Actor::Property::COLOR_BLUE), targetBlue );
8679
8680   float fiftyPercentProgress(startValue + (targetBlue - startValue)*0.5f);
8681
8682   // Start the animation
8683   animation.Play();
8684
8685   // Target value should be retrievable straight away
8686   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, targetBlue, startValue ), TEST_LOCATION );
8687   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetBlue, TEST_LOCATION );
8688
8689   bool signalReceived(false);
8690   AnimationFinishCheck finishCheck(signalReceived);
8691   animation.FinishedSignal().Connect(&application, finishCheck);
8692
8693   application.SendNotification();
8694   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8695
8696   // We didn't expect the animation to finish yet
8697   application.SendNotification();
8698   finishCheck.CheckSignalNotReceived();
8699   DALI_TEST_EQUALS( actor.GetCurrentColor().b, fiftyPercentProgress, TEST_LOCATION );
8700   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue,           TEST_LOCATION );
8701   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue,           TEST_LOCATION );
8702   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  fiftyPercentProgress, TEST_LOCATION );
8703   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue,           TEST_LOCATION );
8704
8705   application.SendNotification();
8706   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8707
8708   // We did expect the animation to finish
8709   application.SendNotification();
8710   finishCheck.CheckSignalReceived();
8711   DALI_TEST_EQUALS( actor.GetCurrentColor().b, targetBlue, TEST_LOCATION );
8712   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8713   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8714   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  targetBlue, TEST_LOCATION );
8715   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8716   END_TEST;
8717 }
8718
8719 int UtcDaliAnimationAnimateToActorColorAlphaP(void)
8720 {
8721   TestApplication application;
8722
8723   Actor actor = Actor::New();
8724   Stage::GetCurrent().Add(actor);
8725   float startValue(1.0f);
8726   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8727   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8728   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8729   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8730   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8731   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8732   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8733   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8734   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8735
8736   // Build the animation
8737   float durationSeconds(1.0f);
8738   Animation animation = Animation::New(durationSeconds);
8739   float targetAlpha(0.5f);
8740   animation.AnimateTo( Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha );
8741
8742   float fiftyPercentProgress(startValue + (targetAlpha - startValue)*0.5f);
8743
8744   // Start the animation
8745   animation.Play();
8746
8747   // Target value should be retrievable straight away
8748   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, startValue, targetAlpha ), TEST_LOCATION );
8749   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
8750   DALI_TEST_EQUALS( actor.GetProperty< float >( DevelActor::Property::OPACITY ), targetAlpha, TEST_LOCATION );
8751
8752   bool signalReceived(false);
8753   AnimationFinishCheck finishCheck(signalReceived);
8754   animation.FinishedSignal().Connect(&application, finishCheck);
8755
8756   application.SendNotification();
8757   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8758
8759   // We didn't expect the animation to finish yet
8760   application.SendNotification();
8761   finishCheck.CheckSignalNotReceived();
8762   DALI_TEST_EQUALS( actor.GetCurrentColor().a, fiftyPercentProgress, TEST_LOCATION );
8763   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue,           TEST_LOCATION );
8764   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue,           TEST_LOCATION );
8765   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue,           TEST_LOCATION );
8766   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), fiftyPercentProgress, TEST_LOCATION );
8767
8768   application.SendNotification();
8769   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8770
8771   // We did expect the animation to finish
8772   application.SendNotification();
8773   finishCheck.CheckSignalReceived();
8774   DALI_TEST_EQUALS( actor.GetCurrentColor().a, targetAlpha, TEST_LOCATION );
8775   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue,  TEST_LOCATION );
8776   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue,  TEST_LOCATION );
8777   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue,  TEST_LOCATION );
8778   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
8779   END_TEST;
8780 }
8781
8782 int UtcDaliAnimationKeyFrames01P(void)
8783 {
8784   TestApplication application;
8785
8786   KeyFrames keyFrames = KeyFrames::New();
8787   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8788
8789   keyFrames.Add(0.0f, 0.1f);
8790
8791   DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8792
8793   KeyFrames keyFrames2( keyFrames);
8794   DALI_TEST_CHECK( keyFrames2 );
8795   DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
8796
8797   KeyFrames keyFrames3 = KeyFrames::New();
8798   keyFrames3.Add(0.6f, true);
8799   DALI_TEST_CHECK( keyFrames3 );
8800   DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
8801
8802   keyFrames3 = keyFrames;
8803   DALI_TEST_CHECK( keyFrames3 );
8804   DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
8805
8806   END_TEST;
8807 }
8808
8809 int UtcDaliAnimationKeyFrames02N(void)
8810 {
8811   TestApplication application;
8812
8813   KeyFrames keyFrames = KeyFrames::New();
8814   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8815
8816   keyFrames.Add(0.0f, 0.1f);
8817   keyFrames.Add(0.2f, 0.5f);
8818   keyFrames.Add(0.4f, 0.0f);
8819   keyFrames.Add(0.6f, 1.0f);
8820   keyFrames.Add(0.8f, 0.7f);
8821   keyFrames.Add(1.0f, 0.9f);
8822
8823   DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8824
8825   DALI_TEST_ASSERTION(
8826   {
8827     keyFrames.Add(1.9f, false);
8828   }, "mType == value.GetType()" );
8829
8830   END_TEST;
8831 }
8832
8833 int UtcDaliAnimationKeyFrames03N(void)
8834 {
8835   TestApplication application;
8836
8837   KeyFrames keyFrames = KeyFrames::New();
8838   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8839
8840   keyFrames.Add(0.0f, true);
8841   keyFrames.Add(0.2f, false);
8842   keyFrames.Add(0.4f, false);
8843   keyFrames.Add(0.6f, true);
8844   keyFrames.Add(0.8f, true);
8845   keyFrames.Add(1.0f, false);
8846
8847   DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
8848
8849   DALI_TEST_ASSERTION(
8850   {
8851     keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8852   }, "mType == value.GetType()" );
8853
8854   END_TEST;
8855 }
8856
8857 int UtcDaliAnimationKeyFrames04N(void)
8858 {
8859   TestApplication application;
8860
8861   KeyFrames keyFrames = KeyFrames::New();
8862   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8863
8864   keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
8865   keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
8866   keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
8867   keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
8868   keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
8869   keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
8870
8871   DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
8872
8873   DALI_TEST_ASSERTION(
8874   {
8875     keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8876   }, "mType == value.GetType()" );
8877
8878   END_TEST;
8879 }
8880
8881 int UtcDaliAnimationKeyFrames05N(void)
8882 {
8883   TestApplication application;
8884
8885   KeyFrames keyFrames = KeyFrames::New();
8886   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8887
8888   keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
8889   keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
8890   keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
8891   keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
8892   keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
8893   keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
8894
8895   DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
8896
8897   DALI_TEST_ASSERTION(
8898   {
8899     keyFrames.Add(0.7f, 1.0f);
8900   }, "mType == value.GetType()" );
8901
8902   END_TEST;
8903 }
8904
8905 int UtcDaliAnimationKeyFrames06N(void)
8906 {
8907   TestApplication application;
8908
8909   KeyFrames keyFrames = KeyFrames::New();
8910   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8911
8912   keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
8913   keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8914   keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
8915   keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
8916   keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
8917   keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
8918
8919   DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
8920
8921   DALI_TEST_ASSERTION(
8922   {
8923     keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
8924   }, "mType == value.GetType()" );
8925
8926   END_TEST;
8927 }
8928
8929 int UtcDaliAnimationKeyFrames07N(void)
8930 {
8931   TestApplication application;
8932
8933   KeyFrames keyFrames = KeyFrames::New();
8934   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8935
8936   keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
8937   keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
8938   keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
8939   keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
8940   keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
8941   keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
8942
8943   DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
8944
8945   DALI_TEST_ASSERTION(
8946   {
8947     keyFrames.Add(0.7f, 1.1f);
8948   }, "mType == value.GetType()" );
8949
8950   END_TEST;
8951 }
8952
8953 int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
8954 {
8955   TestApplication application;
8956
8957   float startValue(1.0f);
8958   Actor actor = Actor::New();
8959   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8960   Stage::GetCurrent().Add(actor);
8961
8962   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8963   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8964   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8965   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8966   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8967   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8968   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8969   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8970   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8971
8972   // Build the animation
8973   float durationSeconds(1.0f);
8974   Animation animation = Animation::New(durationSeconds);
8975
8976   KeyFrames keyFrames = KeyFrames::New();
8977   keyFrames.Add(0.0f, 0.1f);
8978   keyFrames.Add(0.2f, 0.5f);
8979   keyFrames.Add(0.4f, 0.0f);
8980   keyFrames.Add(0.6f, 1.0f);
8981   keyFrames.Add(0.8f, 0.7f);
8982   keyFrames.Add(1.0f, 0.9f);
8983
8984   animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames );
8985
8986   // Start the animation
8987   animation.Play();
8988
8989   // Final key frame value should be retrievable straight away
8990   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), 0.9f, TEST_LOCATION );
8991
8992   bool signalReceived(false);
8993   AnimationFinishCheck finishCheck(signalReceived);
8994   animation.FinishedSignal().Connect(&application, finishCheck);
8995   application.SendNotification();
8996   application.Render(0);
8997   application.SendNotification();
8998   finishCheck.CheckSignalNotReceived();
8999   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
9000
9001   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
9002   application.SendNotification();
9003   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9004   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9005   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9006   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION );
9007   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.3f, 0.01f, TEST_LOCATION );
9008
9009   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
9010   application.SendNotification();
9011   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9012   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9013   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9014   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION );
9015   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.25f, 0.01f, TEST_LOCATION );
9016
9017   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
9018   application.SendNotification();
9019   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9020   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9021   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9022   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
9023   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
9024
9025   application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
9026   application.SendNotification();
9027   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9028   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9029   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9030   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
9031   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
9032
9033   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
9034   application.SendNotification();
9035   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9036   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9037   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9038   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION );
9039   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.8f, 0.01f, TEST_LOCATION );
9040
9041   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
9042   application.SendNotification();
9043   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9044   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9045   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9046   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
9047   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
9048
9049   // We did expect the animation to finish
9050
9051   finishCheck.CheckSignalReceived();
9052   END_TEST;
9053 }
9054
9055 int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
9056 {
9057   TestApplication application;
9058
9059   float startValue(1.0f);
9060   Actor actor = Actor::New();
9061   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9062   Stage::GetCurrent().Add(actor);
9063
9064   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9065   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9066   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9067   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9068   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9069   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9070   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9071   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9072   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9073
9074   // Build the animation
9075   float durationSeconds(1.0f);
9076   Animation animation = Animation::New(durationSeconds);
9077
9078   KeyFrames keyFrames = KeyFrames::New();
9079   keyFrames.Add(0.0f, 0.1f);
9080   keyFrames.Add(0.2f, 0.5f);
9081   keyFrames.Add(0.4f, 0.0f);
9082   keyFrames.Add(0.6f, 1.0f);
9083   keyFrames.Add(0.8f, 0.7f);
9084   keyFrames.Add(1.0f, 0.9f);
9085
9086   animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::Cubic );
9087
9088   // Start the animation
9089   animation.Play();
9090
9091   bool signalReceived(false);
9092   AnimationFinishCheck finishCheck(signalReceived);
9093   animation.FinishedSignal().Connect(&application, finishCheck);
9094   application.SendNotification();
9095   application.Render(0);
9096   application.SendNotification();
9097   finishCheck.CheckSignalNotReceived();
9098   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
9099
9100   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
9101   application.SendNotification();
9102   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9103   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9104   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9105   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.36f, 0.01f, TEST_LOCATION );
9106   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.36f, 0.01f, TEST_LOCATION );
9107
9108   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
9109   application.SendNotification();
9110   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9111   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9112   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9113   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.21f, 0.01f, TEST_LOCATION );
9114   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.21f, 0.01f, TEST_LOCATION );
9115
9116   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
9117   application.SendNotification();
9118   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9119   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9120   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9121   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.0f, 0.01f, TEST_LOCATION );
9122   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
9123
9124   application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
9125   application.SendNotification();
9126   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9127   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9128   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9129   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7f, 0.01f, TEST_LOCATION );
9130   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
9131
9132   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
9133   application.SendNotification();
9134   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9135   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9136   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9137   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.76f, 0.01f, TEST_LOCATION );
9138   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.76f, 0.01f, TEST_LOCATION );
9139
9140   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
9141   application.SendNotification();
9142   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9143   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9144   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9145   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.9f, 0.01f, TEST_LOCATION );
9146   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
9147
9148   // We did expect the animation to finish
9149
9150   finishCheck.CheckSignalReceived();
9151   END_TEST;
9152 }
9153
9154 int UtcDaliAnimationAnimateBetweenActorColorP(void)
9155 {
9156   TestApplication application;
9157
9158   float startValue(1.0f);
9159   Actor actor = Actor::New();
9160   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9161   Stage::GetCurrent().Add(actor);
9162
9163   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9164   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9165   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9166   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9167   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9168   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9169   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9170   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9171   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9172
9173   // Build the animation
9174   float durationSeconds(1.0f);
9175   Animation animation = Animation::New(durationSeconds);
9176
9177   KeyFrames keyFrames = KeyFrames::New();
9178   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9179   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9180   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9181
9182   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames );
9183
9184   // Start the animation
9185   animation.Play();
9186
9187   bool signalReceived(false);
9188   AnimationFinishCheck finishCheck(signalReceived);
9189   animation.FinishedSignal().Connect(&application, finishCheck);
9190   application.SendNotification();
9191   application.Render(0);
9192   application.SendNotification();
9193   finishCheck.CheckSignalNotReceived();
9194   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
9195   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9196   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
9197   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9198
9199   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9200   application.SendNotification();
9201   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.5f, 0.01f, TEST_LOCATION );
9202   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9203   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.5f, 0.01f, TEST_LOCATION );
9204   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9205
9206   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9207   application.SendNotification();
9208   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
9209   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9210   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
9211   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9212
9213   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9214   application.SendNotification();
9215   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.95f, 0.01f, TEST_LOCATION );
9216   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9217   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.85f, 0.01f, TEST_LOCATION );
9218   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9219
9220   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9221   application.SendNotification();
9222   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
9223   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9224   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
9225   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9226
9227   // We did expect the animation to finish
9228
9229   finishCheck.CheckSignalReceived();
9230   END_TEST;
9231 }
9232
9233 int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
9234 {
9235   TestApplication application;
9236
9237   float startValue(1.0f);
9238   Actor actor = Actor::New();
9239   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9240   Stage::GetCurrent().Add(actor);
9241
9242   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9243   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9244   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9245   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9246   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9247   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9248   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9249   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9250   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9251
9252   // Build the animation
9253   float durationSeconds(1.0f);
9254   Animation animation = Animation::New(durationSeconds);
9255
9256   KeyFrames keyFrames = KeyFrames::New();
9257   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9258   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9259   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9260
9261   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, Animation::Cubic );
9262
9263   // Start the animation
9264   animation.Play();
9265
9266   bool signalReceived(false);
9267   AnimationFinishCheck finishCheck(signalReceived);
9268   animation.FinishedSignal().Connect(&application, finishCheck);
9269   application.SendNotification();
9270   application.Render(0);
9271   application.SendNotification();
9272   finishCheck.CheckSignalNotReceived();
9273   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
9274   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9275   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
9276   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9277
9278   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9279   application.SendNotification();
9280   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.55f, 0.01f, TEST_LOCATION );
9281   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9282   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.506f, 0.01f, TEST_LOCATION );
9283   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9284
9285   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9286   application.SendNotification();
9287   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
9288   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9289   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
9290   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9291
9292   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9293   application.SendNotification();
9294   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.99375f, 0.01f, TEST_LOCATION );
9295   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9296   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.85625f, 0.01f, TEST_LOCATION );
9297   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9298
9299   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9300   application.SendNotification();
9301   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
9302   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9303   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
9304   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9305
9306   // We did expect the animation to finish
9307
9308   finishCheck.CheckSignalReceived();
9309   END_TEST;
9310 }
9311
9312 int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
9313 {
9314   TestApplication application;
9315
9316   Actor actor = Actor::New();
9317   AngleAxis aa(Degree(90), Vector3::XAXIS);
9318   actor.SetOrientation(aa.angle, aa.axis);
9319   Stage::GetCurrent().Add(actor);
9320
9321   application.SendNotification();
9322   application.Render(0);
9323
9324   DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
9325
9326   // Build the animation
9327   float durationSeconds(1.0f);
9328   Animation animation = Animation::New(durationSeconds);
9329
9330   KeyFrames keyFrames = KeyFrames::New();
9331   keyFrames.Add(0.0f, false);
9332   keyFrames.Add(0.2f, true);
9333   keyFrames.Add(0.4f, true);
9334   keyFrames.Add(0.8f, false);
9335   keyFrames.Add(1.0f, true);
9336
9337   animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames );
9338
9339   // Start the animation
9340   animation.Play();
9341
9342   // Final key frame value should be retrievable straight away
9343   DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
9344
9345   bool signalReceived(false);
9346   AnimationFinishCheck finishCheck(signalReceived);
9347   animation.FinishedSignal().Connect(&application, finishCheck);
9348   application.SendNotification();
9349   application.SendNotification();
9350   application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9351   application.SendNotification();
9352   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9353   application.SendNotification();
9354
9355   DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
9356   finishCheck.CheckSignalReceived();
9357   END_TEST;
9358 }
9359
9360 int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
9361 {
9362   TestApplication application;
9363
9364   Actor actor = Actor::New();
9365   AngleAxis aa(Degree(90), Vector3::XAXIS);
9366   actor.SetOrientation(aa.angle, aa.axis);
9367   Stage::GetCurrent().Add(actor);
9368
9369   application.SendNotification();
9370   application.Render(0);
9371
9372   DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
9373
9374   // Build the animation
9375   float durationSeconds(1.0f);
9376   Animation animation = Animation::New(durationSeconds);
9377
9378   KeyFrames keyFrames = KeyFrames::New();
9379   keyFrames.Add(0.0f, false);
9380   keyFrames.Add(0.2f, true);
9381   keyFrames.Add(0.4f, true);
9382   keyFrames.Add(0.8f, false);
9383   keyFrames.Add(1.0f, true);
9384
9385   //Cubic interpolation for boolean values should be ignored
9386   animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::Cubic );
9387
9388   // Start the animation
9389   animation.Play();
9390
9391   bool signalReceived(false);
9392   AnimationFinishCheck finishCheck(signalReceived);
9393   animation.FinishedSignal().Connect(&application, finishCheck);
9394   application.SendNotification();
9395   application.SendNotification();
9396   application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9397   application.SendNotification();
9398   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9399   application.SendNotification();
9400
9401   DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
9402   finishCheck.CheckSignalReceived();
9403   END_TEST;
9404 }
9405
9406 int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
9407 {
9408   TestApplication application;
9409
9410   Actor actor = Actor::New();
9411   AngleAxis aa(Degree(90), Vector3::XAXIS);
9412   actor.SetOrientation(aa.angle, aa.axis);
9413   Stage::GetCurrent().Add(actor);
9414
9415   application.SendNotification();
9416   application.Render(0);
9417   Quaternion start(Radian(aa.angle), aa.axis);
9418   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
9419
9420   // Build the animation
9421   float durationSeconds(1.0f);
9422   Animation animation = Animation::New(durationSeconds);
9423
9424   KeyFrames keyFrames = KeyFrames::New();
9425   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9426
9427   animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
9428
9429   // Start the animation
9430   animation.Play();
9431
9432   // Final key frame value should be retrievable straight away
9433   DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Degree( 60 ), Vector3::ZAXIS ), TEST_LOCATION );
9434
9435   bool signalReceived(false);
9436   AnimationFinishCheck finishCheck(signalReceived);
9437   animation.FinishedSignal().Connect(&application, finishCheck);
9438   application.SendNotification();
9439   application.SendNotification();
9440   application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9441   application.SendNotification();
9442   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9443   application.SendNotification();
9444
9445   Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
9446
9447   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9448   finishCheck.CheckSignalReceived();
9449   END_TEST;
9450 }
9451
9452 int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
9453 {
9454   TestApplication application;
9455
9456   Actor actor = Actor::New();
9457   AngleAxis aa(Degree(90), Vector3::XAXIS);
9458   actor.SetOrientation(aa.angle, aa.axis);
9459   application.SendNotification();
9460   application.Render(0);
9461   Stage::GetCurrent().Add(actor);
9462
9463   Quaternion start(Radian(aa.angle), aa.axis);
9464   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
9465
9466   // Build the animation
9467   float durationSeconds(1.0f);
9468   Animation animation = Animation::New(durationSeconds);
9469
9470   KeyFrames keyFrames = KeyFrames::New();
9471   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9472   keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9473   keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9474
9475   animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
9476
9477   // Start the animation
9478   animation.Play();
9479
9480   bool signalReceived(false);
9481   AnimationFinishCheck finishCheck(signalReceived);
9482   animation.FinishedSignal().Connect(&application, finishCheck);
9483   application.SendNotification();
9484   application.Render(0);
9485   application.SendNotification();
9486   finishCheck.CheckSignalNotReceived();
9487
9488   Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9489   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9490
9491   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9492   application.SendNotification();
9493   check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
9494   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9495
9496   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9497   application.SendNotification();
9498   check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
9499   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9500
9501   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9502   application.SendNotification();
9503   check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f) );
9504   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9505
9506   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9507   application.SendNotification();
9508   check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
9509   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9510
9511   // We did expect the animation to finish
9512
9513   finishCheck.CheckSignalReceived();
9514   END_TEST;
9515 }
9516
9517 int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
9518 {
9519   TestApplication application;
9520
9521   Actor actor = Actor::New();
9522   AngleAxis aa(Degree(90), Vector3::XAXIS);
9523   actor.SetOrientation(aa.angle, aa.axis);
9524   Stage::GetCurrent().Add(actor);
9525
9526   application.SendNotification();
9527   application.Render(0);
9528   Quaternion start(Radian(aa.angle), aa.axis);
9529   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
9530
9531   // Build the animation
9532   float durationSeconds(1.0f);
9533   Animation animation = Animation::New(durationSeconds);
9534
9535   KeyFrames keyFrames = KeyFrames::New();
9536   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9537
9538   //Cubic interpolation should be ignored for quaternions
9539   animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
9540
9541   // Start the animation
9542   animation.Play();
9543
9544   bool signalReceived(false);
9545   AnimationFinishCheck finishCheck(signalReceived);
9546   animation.FinishedSignal().Connect(&application, finishCheck);
9547   application.SendNotification();
9548   application.SendNotification();
9549   application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9550   application.SendNotification();
9551   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9552   application.SendNotification();
9553
9554   Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
9555
9556   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9557   finishCheck.CheckSignalReceived();
9558   END_TEST;
9559 }
9560
9561 int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
9562 {
9563   TestApplication application;
9564
9565   Actor actor = Actor::New();
9566   AngleAxis aa(Degree(90), Vector3::XAXIS);
9567   actor.SetOrientation(aa.angle, aa.axis);
9568   application.SendNotification();
9569   application.Render(0);
9570   Stage::GetCurrent().Add(actor);
9571
9572   Quaternion start(Radian(aa.angle), aa.axis);
9573   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
9574
9575   // Build the animation
9576   float durationSeconds(1.0f);
9577   Animation animation = Animation::New(durationSeconds);
9578
9579   KeyFrames keyFrames = KeyFrames::New();
9580   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9581   keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9582   keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9583
9584   //Cubic interpolation should be ignored for quaternions
9585   animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
9586
9587   // Start the animation
9588   animation.Play();
9589
9590   bool signalReceived(false);
9591   AnimationFinishCheck finishCheck(signalReceived);
9592   animation.FinishedSignal().Connect(&application, finishCheck);
9593   application.SendNotification();
9594   application.Render(0);
9595   application.SendNotification();
9596   finishCheck.CheckSignalNotReceived();
9597
9598   Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9599   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9600
9601   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9602   application.SendNotification();
9603   check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
9604   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9605
9606   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9607   application.SendNotification();
9608   check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
9609   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9610
9611   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9612   application.SendNotification();
9613   check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f ) );
9614   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9615
9616   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9617   application.SendNotification();
9618   check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
9619   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9620
9621   // We did expect the animation to finish
9622
9623   finishCheck.CheckSignalReceived();
9624   END_TEST;
9625 }
9626
9627 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
9628 {
9629   TestApplication application;
9630
9631   float startValue(1.0f);
9632   Actor actor = Actor::New();
9633   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9634   Stage::GetCurrent().Add(actor);
9635
9636   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9637   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9638   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9639   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9640   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9641   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9642   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9643   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9644   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9645
9646   // Build the animation
9647   float durationSeconds(1.0f);
9648   Animation animation = Animation::New(durationSeconds);
9649
9650   KeyFrames keyFrames = KeyFrames::New();
9651   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9652   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9653   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9654
9655   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR );
9656
9657   // Start the animation
9658   animation.Play();
9659
9660   bool signalReceived(false);
9661   AnimationFinishCheck finishCheck(signalReceived);
9662   animation.FinishedSignal().Connect(&application, finishCheck);
9663   application.SendNotification();
9664   application.Render(0);
9665   application.SendNotification();
9666   finishCheck.CheckSignalNotReceived();
9667   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
9668   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9669   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
9670   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9671
9672   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9673   application.SendNotification();
9674   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.5f, 0.01f, TEST_LOCATION );
9675   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9676   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.5f, 0.01f, TEST_LOCATION );
9677   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9678
9679   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9680   application.SendNotification();
9681   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
9682   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9683   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
9684   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9685
9686   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9687   application.SendNotification();
9688   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.95f, 0.01f, TEST_LOCATION );
9689   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9690   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.85f, 0.01f, TEST_LOCATION );
9691   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9692
9693   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9694   application.SendNotification();
9695   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
9696   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9697   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
9698   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9699
9700   // We did expect the animation to finish
9701
9702   finishCheck.CheckSignalReceived();
9703   END_TEST;
9704 }
9705
9706 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
9707 {
9708   TestApplication application;
9709
9710   float startValue(1.0f);
9711   Actor actor = Actor::New();
9712   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9713   Stage::GetCurrent().Add(actor);
9714
9715   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9716   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9717   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9718   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9719   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9720   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9721   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9722   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9723   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9724
9725   // Build the animation
9726   float durationSeconds(1.0f);
9727   Animation animation = Animation::New(durationSeconds);
9728
9729   KeyFrames keyFrames = KeyFrames::New();
9730   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9731   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9732   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9733
9734   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::Cubic );
9735
9736   // Start the animation
9737   animation.Play();
9738
9739   bool signalReceived(false);
9740   AnimationFinishCheck finishCheck(signalReceived);
9741   animation.FinishedSignal().Connect(&application, finishCheck);
9742   application.SendNotification();
9743   application.Render(0);
9744   application.SendNotification();
9745   finishCheck.CheckSignalNotReceived();
9746   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
9747   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9748   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
9749   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9750
9751   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9752   application.SendNotification();
9753   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.55f, 0.01f, TEST_LOCATION );
9754   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9755   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.506f, 0.01f, TEST_LOCATION );
9756   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9757
9758   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9759   application.SendNotification();
9760   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
9761   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9762   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
9763   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9764
9765   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9766   application.SendNotification();
9767   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.99375f, 0.01f, TEST_LOCATION );
9768   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9769   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.85625f, 0.01f, TEST_LOCATION );
9770   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9771
9772   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9773   application.SendNotification();
9774   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
9775   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9776   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
9777   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9778
9779   // We did expect the animation to finish
9780
9781   finishCheck.CheckSignalReceived();
9782   END_TEST;
9783 }
9784
9785 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void)
9786 {
9787   TestApplication application;
9788
9789   float startValue(1.0f);
9790   Actor actor = Actor::New();
9791   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9792   Stage::GetCurrent().Add(actor);
9793
9794   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9795   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9796   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9797   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9798   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9799   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9800   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9801   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9802   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9803
9804   // Build the animation
9805   float durationSeconds(1.0f);
9806   float delay = 0.5f;
9807   Animation animation = Animation::New(durationSeconds);
9808
9809   KeyFrames keyFrames = KeyFrames::New();
9810   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9811   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9812   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9813
9814   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ) );
9815
9816   // Start the animation
9817   animation.Play();
9818
9819   bool signalReceived(false);
9820   AnimationFinishCheck finishCheck(signalReceived);
9821   animation.FinishedSignal().Connect(&application, finishCheck);
9822   application.SendNotification();
9823
9824   application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9825   application.SendNotification();
9826   finishCheck.CheckSignalNotReceived();
9827   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
9828   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9829   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
9830   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9831
9832   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9833   application.SendNotification();
9834   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.5f, 0.01f, TEST_LOCATION );
9835   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9836   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.5f, 0.01f, TEST_LOCATION );
9837   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9838
9839   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9840   application.SendNotification();
9841   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
9842   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9843   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
9844   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9845
9846   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9847   application.SendNotification();
9848   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.95f, 0.01f, TEST_LOCATION );
9849   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9850   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.85f, 0.01f, TEST_LOCATION );
9851   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9852
9853   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9854   application.SendNotification();
9855   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
9856   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9857   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
9858   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9859
9860   // We did expect the animation to finish
9861
9862   finishCheck.CheckSignalReceived();
9863   END_TEST;
9864 }
9865
9866 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
9867 {
9868   TestApplication application;
9869
9870   float startValue(1.0f);
9871   Actor actor = Actor::New();
9872   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9873   Stage::GetCurrent().Add(actor);
9874
9875   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9876   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9877   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9878   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9879   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9880   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9881   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9882   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9883   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9884
9885   // Build the animation
9886   float durationSeconds(1.0f);
9887   float delay = 0.5f;
9888   Animation animation = Animation::New(durationSeconds);
9889
9890   KeyFrames keyFrames = KeyFrames::New();
9891   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9892   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9893   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9894
9895   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
9896
9897   // Start the animation
9898   animation.Play();
9899
9900   bool signalReceived(false);
9901   AnimationFinishCheck finishCheck(signalReceived);
9902   animation.FinishedSignal().Connect(&application, finishCheck);
9903   application.SendNotification();
9904
9905   application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9906   application.SendNotification();
9907   finishCheck.CheckSignalNotReceived();
9908   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
9909   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9910   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
9911   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9912
9913   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9914   application.SendNotification();
9915   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.55f, 0.01f, TEST_LOCATION );
9916   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9917   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.506f, 0.01f, TEST_LOCATION );
9918   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9919
9920   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9921   application.SendNotification();
9922   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
9923   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
9924   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
9925   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9926
9927   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9928   application.SendNotification();
9929   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.99375f, 0.01f, TEST_LOCATION );
9930   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9931   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.85625f, 0.01f, TEST_LOCATION );
9932   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9933
9934   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9935   application.SendNotification();
9936   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
9937   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9938   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
9939   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9940
9941   // We did expect the animation to finish
9942
9943   finishCheck.CheckSignalReceived();
9944   END_TEST;
9945 }
9946
9947 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
9948 {
9949   TestApplication application;
9950
9951   float startValue(1.0f);
9952   float delay = 0.5f;
9953   Actor actor = Actor::New();
9954   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9955   Stage::GetCurrent().Add(actor);
9956
9957   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9958   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9959   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9960   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9961   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9962   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9963   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9964   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9965   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9966
9967   // Build the animation
9968   float durationSeconds(1.0f);
9969   Animation animation = Animation::New(durationSeconds);
9970
9971   KeyFrames keyFrames = KeyFrames::New();
9972   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9973   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9974   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9975
9976   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
9977
9978   // Start the animation
9979   animation.Play();
9980
9981   bool signalReceived(false);
9982   AnimationFinishCheck finishCheck(signalReceived);
9983   animation.FinishedSignal().Connect(&application, finishCheck);
9984   application.SendNotification();
9985
9986   application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9987   application.SendNotification();
9988   finishCheck.CheckSignalNotReceived();
9989   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
9990   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9991   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
9992   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9993
9994   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9995   application.SendNotification();
9996   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.5f, 0.01f, TEST_LOCATION );
9997   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9998   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.5f, 0.01f, TEST_LOCATION );
9999   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
10000
10001   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
10002   application.SendNotification();
10003   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
10004   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
10005   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
10006   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
10007
10008   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
10009   application.SendNotification();
10010   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.95f, 0.01f, TEST_LOCATION );
10011   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
10012   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.85f, 0.01f, TEST_LOCATION );
10013   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
10014
10015   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
10016   application.SendNotification();
10017   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
10018   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
10019   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
10020   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
10021
10022   // We did expect the animation to finish
10023
10024   finishCheck.CheckSignalReceived();
10025   END_TEST;
10026 }
10027
10028 int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void)
10029 {
10030   TestApplication application;
10031
10032   float startValue(1.0f);
10033   Actor actor = Actor::New();
10034   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
10035   Stage::GetCurrent().Add(actor);
10036
10037   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
10038   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
10039   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
10040   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
10041   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
10042   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
10043   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
10044   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
10045   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
10046
10047
10048   // Build the animation
10049   float durationSeconds(1.0f);
10050   float delay = 0.5f;
10051   Animation animation = Animation::New(durationSeconds);
10052
10053   KeyFrames keyFrames = KeyFrames::New();
10054   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10055   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10056   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10057
10058   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
10059
10060   // Start the animation
10061   animation.Play();
10062
10063   bool signalReceived(false);
10064   AnimationFinishCheck finishCheck(signalReceived);
10065   animation.FinishedSignal().Connect(&application, finishCheck);
10066   application.SendNotification();
10067
10068   application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
10069   application.SendNotification();
10070   finishCheck.CheckSignalNotReceived();
10071   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
10072   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
10073   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
10074   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
10075
10076   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
10077   application.SendNotification();
10078   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.55f, 0.01f, TEST_LOCATION );
10079   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
10080   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.506f, 0.01f, TEST_LOCATION );
10081   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
10082
10083   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
10084   application.SendNotification();
10085   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
10086   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
10087   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
10088   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
10089
10090   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
10091   application.SendNotification();
10092   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.99375f, 0.01f, TEST_LOCATION );
10093   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
10094   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.85625f, 0.01f, TEST_LOCATION );
10095   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
10096
10097   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
10098   application.SendNotification();
10099   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
10100   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
10101   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
10102   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
10103
10104   // We did expect the animation to finish
10105
10106   finishCheck.CheckSignalReceived();
10107   END_TEST;
10108 }
10109
10110 int UtcDaliAnimationAnimateP(void)
10111 {
10112   TestApplication application;
10113
10114   Actor actor = Actor::New();
10115   Stage::GetCurrent().Add(actor);
10116
10117   //Build the path
10118   Vector3 position0( 30.0,  80.0,  0.0);
10119   Vector3 position1( 70.0,  120.0, 0.0);
10120   Vector3 position2( 100.0, 100.0, 0.0);
10121
10122   Dali::Path path = Dali::Path::New();
10123   path.AddPoint(position0);
10124   path.AddPoint(position1);
10125   path.AddPoint(position2);
10126
10127   //Control points for first segment
10128   path.AddControlPoint( Vector3( 39.0,  90.0, 0.0) );
10129   path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
10130
10131   //Control points for second segment
10132   path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
10133   path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
10134
10135   // Build the animation
10136   float durationSeconds( 1.0f );
10137   Animation animation = Animation::New(durationSeconds);
10138   animation.Animate(actor, path, Vector3::XAXIS);
10139
10140   // Start the animation
10141   animation.Play();
10142
10143   bool signalReceived(false);
10144   AnimationFinishCheck finishCheck(signalReceived);
10145   animation.FinishedSignal().Connect(&application, finishCheck);
10146   application.SendNotification();
10147   application.Render(0);
10148   application.SendNotification();
10149   finishCheck.CheckSignalNotReceived();
10150   Vector3 position, tangent;
10151   Quaternion rotation;
10152   path.Sample( 0.0f, position, tangent );
10153   rotation = Quaternion( Vector3::XAXIS, tangent );
10154   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10155   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10156
10157   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
10158   application.SendNotification();
10159   path.Sample( 0.25f, position, tangent );
10160   rotation = Quaternion( Vector3::XAXIS, tangent );
10161   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10162   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10163
10164   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
10165   application.SendNotification();
10166   path.Sample( 0.5f, position, tangent );
10167   rotation = Quaternion( Vector3::XAXIS, tangent );
10168   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10169   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10170
10171   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
10172   application.SendNotification();
10173   path.Sample( 0.75f, position, tangent );
10174   rotation = Quaternion( Vector3::XAXIS, tangent );
10175   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10176   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10177
10178   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
10179   application.SendNotification();
10180   path.Sample( 1.0f, position, tangent );
10181   rotation = Quaternion( Vector3::XAXIS, tangent );
10182   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10183   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10184
10185   finishCheck.CheckSignalReceived();
10186   END_TEST;
10187 }
10188
10189 int UtcDaliAnimationAnimateAlphaFunctionP(void)
10190 {
10191   TestApplication application;
10192
10193   Actor actor = Actor::New();
10194   Stage::GetCurrent().Add(actor);
10195
10196   //Build the path
10197   Vector3 position0( 30.0,  80.0,  0.0);
10198   Vector3 position1( 70.0,  120.0, 0.0);
10199   Vector3 position2( 100.0, 100.0, 0.0);
10200
10201   Dali::Path path = Dali::Path::New();
10202   path.AddPoint(position0);
10203   path.AddPoint(position1);
10204   path.AddPoint(position2);
10205
10206   //Control points for first segment
10207   path.AddControlPoint( Vector3( 39.0,  90.0, 0.0) );
10208   path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
10209
10210   //Control points for second segment
10211   path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
10212   path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
10213
10214   // Build the animation
10215   float durationSeconds( 1.0f );
10216   Animation animation = Animation::New(durationSeconds);
10217   animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
10218
10219   // Start the animation
10220   animation.Play();
10221
10222   bool signalReceived(false);
10223   AnimationFinishCheck finishCheck(signalReceived);
10224   animation.FinishedSignal().Connect(&application, finishCheck);
10225   application.SendNotification();
10226   application.Render(0);
10227   application.SendNotification();
10228   finishCheck.CheckSignalNotReceived();
10229   Vector3 position, tangent;
10230   Quaternion rotation;
10231   path.Sample( 0.0f, position, tangent );
10232   rotation = Quaternion( Vector3::XAXIS, tangent );
10233   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10234   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10235
10236   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
10237   application.SendNotification();
10238   path.Sample( 0.25f, position, tangent );
10239   rotation = Quaternion( Vector3::XAXIS, tangent );
10240   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10241   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10242
10243   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
10244   application.SendNotification();
10245   path.Sample( 0.5f, position, tangent );
10246   rotation = Quaternion( Vector3::XAXIS, tangent );
10247   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10248   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10249
10250   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
10251   application.SendNotification();
10252   path.Sample( 0.75f, position, tangent );
10253   rotation = Quaternion( Vector3::XAXIS, tangent );
10254   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10255   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10256
10257   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
10258   application.SendNotification();
10259   path.Sample( 1.0f, position, tangent );
10260   rotation = Quaternion( Vector3::XAXIS, tangent );
10261   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10262   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10263
10264   finishCheck.CheckSignalReceived();
10265   END_TEST;
10266 }
10267
10268 int UtcDaliAnimationAnimateTimePeriodP(void)
10269 {
10270   TestApplication application;
10271
10272   Actor actor = Actor::New();
10273   Stage::GetCurrent().Add(actor);
10274
10275   //Build the path
10276   Vector3 position0( 30.0,  80.0,  0.0);
10277   Vector3 position1( 70.0,  120.0, 0.0);
10278   Vector3 position2( 100.0, 100.0, 0.0);
10279
10280   Dali::Path path = Dali::Path::New();
10281   path.AddPoint(position0);
10282   path.AddPoint(position1);
10283   path.AddPoint(position2);
10284
10285   //Control points for first segment
10286   path.AddControlPoint( Vector3( 39.0,  90.0, 0.0) );
10287   path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
10288
10289   //Control points for second segment
10290   path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
10291   path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
10292
10293   // Build the animation
10294   float durationSeconds( 1.0f );
10295   Animation animation = Animation::New(durationSeconds);
10296   animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
10297
10298   // Start the animation
10299   animation.Play();
10300
10301   bool signalReceived(false);
10302   AnimationFinishCheck finishCheck(signalReceived);
10303   animation.FinishedSignal().Connect(&application, finishCheck);
10304   application.SendNotification();
10305   application.Render(0);
10306   application.SendNotification();
10307   finishCheck.CheckSignalNotReceived();
10308   Vector3 position, tangent;
10309   Quaternion rotation;
10310   path.Sample( 0.0f, position, tangent );
10311   rotation = Quaternion( Vector3::XAXIS, tangent );
10312   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10313   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10314
10315   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
10316   application.SendNotification();
10317   path.Sample( 0.25f, position, tangent );
10318   rotation = Quaternion( Vector3::XAXIS, tangent );
10319   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10320   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10321
10322   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
10323   application.SendNotification();
10324   path.Sample( 0.5f, position, tangent );
10325   rotation = Quaternion( Vector3::XAXIS, tangent );
10326   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10327   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10328
10329   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
10330   application.SendNotification();
10331   path.Sample( 0.75f, position, tangent );
10332   rotation = Quaternion( Vector3::XAXIS, tangent );
10333   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10334   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10335
10336   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
10337   application.SendNotification();
10338   path.Sample( 1.0f, position, tangent );
10339   rotation = Quaternion( Vector3::XAXIS, tangent );
10340   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10341   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10342
10343   finishCheck.CheckSignalReceived();
10344   END_TEST;
10345 }
10346
10347 int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
10348 {
10349   TestApplication application;
10350
10351   Actor actor = Actor::New();
10352   Stage::GetCurrent().Add(actor);
10353
10354   //Build the path
10355   Vector3 position0( 30.0,  80.0,  0.0);
10356   Vector3 position1( 70.0,  120.0, 0.0);
10357   Vector3 position2( 100.0, 100.0, 0.0);
10358
10359   Dali::Path path = Dali::Path::New();
10360   path.AddPoint(position0);
10361   path.AddPoint(position1);
10362   path.AddPoint(position2);
10363
10364   //Control points for first segment
10365   path.AddControlPoint( Vector3( 39.0,  90.0, 0.0) );
10366   path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
10367
10368   //Control points for second segment
10369   path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
10370   path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
10371
10372   // Build the animation
10373   float durationSeconds( 1.0f );
10374   Animation animation = Animation::New(durationSeconds);
10375   animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
10376
10377   // Start the animation
10378   animation.Play();
10379
10380   bool signalReceived(false);
10381   AnimationFinishCheck finishCheck(signalReceived);
10382   animation.FinishedSignal().Connect(&application, finishCheck);
10383   application.SendNotification();
10384   application.Render(0);
10385   application.SendNotification();
10386   finishCheck.CheckSignalNotReceived();
10387   Vector3 position, tangent;
10388   Quaternion rotation;
10389   path.Sample( 0.0f, position, tangent );
10390   rotation = Quaternion( Vector3::XAXIS, tangent );
10391   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10392   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10393
10394   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
10395   application.SendNotification();
10396   path.Sample( 0.25f, position, tangent );
10397   rotation = Quaternion( Vector3::XAXIS, tangent );
10398   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10399   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10400
10401   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
10402   application.SendNotification();
10403   path.Sample( 0.5f, position, tangent );
10404   rotation = Quaternion( Vector3::XAXIS, tangent );
10405   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10406   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10407
10408   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
10409   application.SendNotification();
10410   path.Sample( 0.75f, position, tangent );
10411   rotation = Quaternion( Vector3::XAXIS, tangent );
10412   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10413   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10414
10415   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
10416   application.SendNotification();
10417   path.Sample( 1.0f, position, tangent );
10418   rotation = Quaternion( Vector3::XAXIS, tangent );
10419   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10420   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10421
10422   finishCheck.CheckSignalReceived();
10423   END_TEST;
10424 }
10425
10426 int UtcDaliAnimationShowP(void)
10427 {
10428   TestApplication application;
10429
10430   Actor actor = Actor::New();
10431   actor.SetVisible(false);
10432   application.SendNotification();
10433   application.Render(0);
10434   DALI_TEST_CHECK( !actor.IsVisible() );
10435   Stage::GetCurrent().Add(actor);
10436
10437   // Start the animation
10438   float durationSeconds(10.0f);
10439   Animation animation = Animation::New(durationSeconds);
10440   animation.Show(actor, durationSeconds*0.5f);
10441   animation.Play();
10442
10443   bool signalReceived(false);
10444   AnimationFinishCheck finishCheck(signalReceived);
10445   animation.FinishedSignal().Connect(&application, finishCheck);
10446
10447   application.SendNotification();
10448   application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
10449
10450   // We didn't expect the animation to finish yet
10451   application.SendNotification();
10452   finishCheck.CheckSignalNotReceived();
10453   DALI_TEST_CHECK( !actor.IsVisible() );
10454
10455   application.SendNotification();
10456   application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be shown now*/);
10457
10458   // We didn't expect the animation to finish yet
10459   application.SendNotification();
10460   finishCheck.CheckSignalNotReceived();
10461   DALI_TEST_CHECK( actor.IsVisible() );
10462
10463   application.SendNotification();
10464   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10465
10466   // We did expect the animation to finish
10467   application.SendNotification();
10468   finishCheck.CheckSignalReceived();
10469   DALI_TEST_CHECK( actor.IsVisible() );
10470   END_TEST;
10471 }
10472
10473 int UtcDaliAnimationHideP(void)
10474 {
10475   TestApplication application;
10476
10477   Actor actor = Actor::New();
10478   DALI_TEST_CHECK( actor.IsVisible() );
10479   Stage::GetCurrent().Add(actor);
10480
10481   // Start the animation
10482   float durationSeconds(10.0f);
10483   Animation animation = Animation::New(durationSeconds);
10484   animation.Hide(actor, durationSeconds*0.5f);
10485   animation.Play();
10486
10487   bool signalReceived(false);
10488   AnimationFinishCheck finishCheck(signalReceived);
10489   animation.FinishedSignal().Connect(&application, finishCheck);
10490
10491   application.SendNotification();
10492   application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
10493
10494   // We didn't expect the animation to finish yet
10495   application.SendNotification();
10496   finishCheck.CheckSignalNotReceived();
10497   DALI_TEST_CHECK( actor.IsVisible() );
10498
10499   application.SendNotification();
10500   application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be hidden now*/);
10501
10502   // We didn't expect the animation to finish yet
10503   application.SendNotification();
10504   finishCheck.CheckSignalNotReceived();
10505   DALI_TEST_CHECK( !actor.IsVisible() );
10506
10507   application.SendNotification();
10508   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10509
10510   // We did expect the animation to finish
10511   application.SendNotification();
10512   finishCheck.CheckSignalReceived();
10513   DALI_TEST_CHECK( !actor.IsVisible() );
10514   END_TEST;
10515 }
10516
10517 int UtcDaliAnimationShowHideAtEndP(void)
10518 {
10519   // Test that show/hide delay can be the same as animation duration
10520   // i.e. to show/hide at the end of the animation
10521
10522   TestApplication application;
10523
10524   Actor actor = Actor::New();
10525   DALI_TEST_CHECK( actor.IsVisible() );
10526   Stage::GetCurrent().Add(actor);
10527
10528   // Start Hide animation
10529   float durationSeconds(10.0f);
10530   Animation animation = Animation::New(durationSeconds);
10531   animation.Hide(actor, durationSeconds/*Hide at end*/);
10532   animation.Play();
10533
10534   bool signalReceived(false);
10535   AnimationFinishCheck finishCheck(signalReceived);
10536   animation.FinishedSignal().Connect(&application, finishCheck);
10537
10538   application.SendNotification();
10539   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
10540
10541   // We did expect the animation to finish
10542   application.SendNotification();
10543   finishCheck.CheckSignalReceived();
10544   DALI_TEST_CHECK( !actor.IsVisible() );
10545
10546   // Start Show animation
10547   animation = Animation::New(durationSeconds);
10548   animation.Show(actor, durationSeconds/*Show at end*/);
10549   animation.FinishedSignal().Connect(&application, finishCheck);
10550   animation.Play();
10551
10552   application.SendNotification();
10553   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
10554
10555   // We did expect the animation to finish
10556   application.SendNotification();
10557   finishCheck.CheckSignalReceived();
10558   DALI_TEST_CHECK( actor.IsVisible() );
10559   END_TEST;
10560 }
10561
10562 int UtcDaliKeyFramesCreateDestroyP(void)
10563 {
10564   tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
10565
10566   KeyFrames* keyFrames = new KeyFrames;
10567   delete keyFrames;
10568   DALI_TEST_CHECK( true );
10569   END_TEST;
10570 }
10571
10572 int UtcDaliKeyFramesDownCastP(void)
10573 {
10574   TestApplication application;
10575   tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
10576
10577   KeyFrames keyFrames = KeyFrames::New();
10578   BaseHandle object(keyFrames);
10579
10580   KeyFrames keyFrames2 = KeyFrames::DownCast(object);
10581   DALI_TEST_CHECK(keyFrames2);
10582
10583   KeyFrames keyFrames3 = DownCast< KeyFrames >(object);
10584   DALI_TEST_CHECK(keyFrames3);
10585
10586   BaseHandle unInitializedObject;
10587   KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
10588   DALI_TEST_CHECK(!keyFrames4);
10589
10590   KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject);
10591   DALI_TEST_CHECK(!keyFrames5);
10592   END_TEST;
10593 }
10594
10595 int UtcDaliAnimationCreateDestroyP(void)
10596 {
10597   TestApplication application;
10598   Animation* animation = new Animation;
10599   DALI_TEST_CHECK( animation );
10600   delete animation;
10601   END_TEST;
10602 }
10603
10604 struct UpdateManagerTestConstraint
10605 {
10606   UpdateManagerTestConstraint(TestApplication& application)
10607   : mApplication(application)
10608   {
10609   }
10610
10611   void operator()( Vector3& current, const PropertyInputContainer& /* inputs */)
10612   {
10613     mApplication.SendNotification();  // Process events
10614   }
10615
10616   TestApplication& mApplication;
10617 };
10618
10619 int UtcDaliAnimationUpdateManagerP(void)
10620 {
10621   TestApplication application;
10622
10623   Actor actor = Actor::New();
10624   Stage::GetCurrent().Add( actor );
10625
10626   // Build the animation
10627   Animation animation = Animation::New( 0.0f );
10628
10629   bool signalReceived = false;
10630   AnimationFinishCheck finishCheck( signalReceived );
10631   animation.FinishedSignal().Connect( &application, finishCheck );
10632
10633   Vector3 startValue(1.0f, 1.0f, 1.0f);
10634   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
10635   Constraint constraint = Constraint::New<Vector3>( actor, index, UpdateManagerTestConstraint( application ) );
10636   constraint.Apply();
10637
10638   // Apply animation to actor
10639   animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunction::LINEAR );
10640   animation.AnimateTo( Property(actor, DevelActor::Property::OPACITY), 0.3f, AlphaFunction::LINEAR );
10641
10642   animation.Play();
10643
10644   application.SendNotification();
10645   application.UpdateOnly( 16 );
10646
10647   finishCheck.CheckSignalNotReceived();
10648
10649   application.SendNotification();   // Process events
10650
10651   finishCheck.CheckSignalReceived();
10652
10653   END_TEST;
10654 }
10655
10656 int UtcDaliAnimationSignalOrderP(void)
10657 {
10658   TestApplication application;
10659
10660   Actor actor = Actor::New();
10661   Stage::GetCurrent().Add( actor );
10662
10663   // Build the animations
10664   Animation animation1 = Animation::New( 0.0f ); // finishes first frame
10665   Animation animation2 = Animation::New( 0.02f ); // finishes in 20 ms
10666
10667   bool signal1Received = false;
10668   animation1.FinishedSignal().Connect( &application, AnimationFinishCheck( signal1Received ) );
10669
10670   bool signal2Received = false;
10671   animation2.FinishedSignal().Connect( &application, AnimationFinishCheck( signal2Received ) );
10672
10673   // Apply animations to actor
10674   animation1.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 3.0f, 2.0f, 1.0f ), AlphaFunction::LINEAR );
10675   animation1.Play();
10676   animation2.AnimateTo( Property(actor, Actor::Property::SIZE ), Vector3( 10.0f, 20.0f, 30.0f ), AlphaFunction::LINEAR );
10677   animation2.Play();
10678
10679   DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10680   DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10681
10682   application.SendNotification();
10683   application.UpdateOnly( 10 ); // 10ms progress
10684
10685   // no notifications yet
10686   DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10687   DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10688
10689   application.SendNotification();
10690
10691   // first completed
10692   DALI_TEST_EQUALS( signal1Received, true, TEST_LOCATION );
10693   DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10694   signal1Received = false;
10695
10696   // 1st animation is complete now, do another update with no ProcessEvents in between
10697   application.UpdateOnly( 20 ); // 20ms progress
10698
10699   // ProcessEvents
10700   application.SendNotification();
10701
10702   // 2nd should complete now
10703   DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10704   DALI_TEST_EQUALS( signal2Received, true, TEST_LOCATION );
10705
10706   END_TEST;
10707 }
10708
10709 int UtcDaliAnimationExtendDurationP(void)
10710 {
10711   TestApplication application;
10712
10713   Actor actor = Actor::New();
10714
10715   // Register a float property
10716   float startValue(10.0f);
10717   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
10718   Stage::GetCurrent().Add(actor);
10719   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
10720   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
10721
10722   // Build the animation
10723   float initialDurationSeconds(1.0f);
10724   float animatorDelay = 5.0f;
10725   float animatorDurationSeconds(5.0f);
10726   float extendedDurationSeconds(animatorDelay+animatorDurationSeconds);
10727   Animation animation = Animation::New(initialDurationSeconds);
10728   float targetValue(30.0f);
10729   float relativeValue(targetValue - startValue);
10730
10731   animation.AnimateTo(Property(actor, index),
10732                       targetValue,
10733                       TimePeriod(animatorDelay, animatorDurationSeconds));
10734
10735   // The duration should have been extended
10736   DALI_TEST_EQUALS( animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION );
10737
10738   // Start the animation
10739   animation.Play();
10740
10741   bool signalReceived(false);
10742   AnimationFinishCheck finishCheck(signalReceived);
10743   animation.FinishedSignal().Connect(&application, finishCheck);
10744
10745   application.SendNotification();
10746   application.Render(static_cast<unsigned int>(extendedDurationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
10747
10748   // We didn't expect the animation to finish yet, but cached value should be the final one
10749   application.SendNotification();
10750   finishCheck.CheckSignalNotReceived();
10751   DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
10752   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
10753
10754   application.SendNotification();
10755   application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
10756
10757   // We didn't expect the animation to finish yet
10758   application.SendNotification();
10759   finishCheck.CheckSignalNotReceived();
10760   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
10761
10762   application.SendNotification();
10763   application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
10764
10765   // We did expect the animation to finish
10766   application.SendNotification();
10767   finishCheck.CheckSignalReceived();
10768   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
10769   DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
10770   END_TEST;
10771 }
10772
10773 int UtcDaliAnimationCustomIntProperty(void)
10774 {
10775   TestApplication application;
10776
10777   Actor actor = Actor::New();
10778   Stage::GetCurrent().Add(actor);
10779   int startValue(0u);
10780
10781   Property::Index index = actor.RegisterProperty("anIndex",  startValue);
10782   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
10783   DALI_TEST_EQUALS( actor.GetProperty< int >( index ), startValue, TEST_LOCATION );
10784
10785   // Build the animation
10786   float durationSeconds(1.0f);
10787   Animation animation = Animation::New(durationSeconds);
10788   animation.AnimateTo( Property(actor, index), 20 );
10789
10790   // Start the animation
10791   animation.Play();
10792
10793   // Target value should be retrievable straight away
10794   DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION );
10795
10796   bool signalReceived(false);
10797   AnimationFinishCheck finishCheck(signalReceived);
10798   animation.FinishedSignal().Connect(&application, finishCheck);
10799
10800   application.SendNotification();
10801   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
10802
10803   // We didn't expect the animation to finish yet
10804   application.SendNotification();
10805   finishCheck.CheckSignalNotReceived();
10806   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), 10, TEST_LOCATION );
10807
10808   application.SendNotification();
10809   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10810
10811   // We did expect the animation to finish
10812   application.SendNotification();
10813   finishCheck.CheckSignalReceived();
10814   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), 20, TEST_LOCATION );
10815   DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION );
10816   END_TEST;
10817 }
10818
10819 int UtcDaliAnimationDuration(void)
10820 {
10821   TestApplication application;
10822
10823   Actor actor = Actor::New();
10824   Stage::GetCurrent().Add(actor);
10825
10826   Animation animation = Animation::New( 0.0f );
10827   DALI_TEST_EQUALS( 0.0f, animation.GetDuration(), TEST_LOCATION );
10828
10829   // The animation duration should automatically increase depending on the animator time period
10830
10831   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 0.0f, 1.0f ) );
10832   DALI_TEST_EQUALS( 1.0f, animation.GetDuration(), TEST_LOCATION );
10833
10834   animation.AnimateTo( Property( actor, Actor::Property::POSITION_Y ), 200.0f, TimePeriod( 10.0f, 1.0f ) );
10835   DALI_TEST_EQUALS( 11.0f, animation.GetDuration(), TEST_LOCATION );
10836
10837   END_TEST;
10838 }
10839
10840 int UtcDaliAnimationAnimateByNonAnimateableTypeN(void)
10841 {
10842   TestApplication application;
10843
10844   Actor actor = Actor::New();
10845
10846   // Register an integer property
10847   int startValue(1);
10848   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
10849   Stage::GetCurrent().Add(actor);
10850   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10851
10852   DALI_TEST_ASSERTION(
10853   {
10854     // Build the animation
10855     Animation animation = Animation::New( 2.0f );
10856     std::string relativeValue = "relative string";
10857     animation.AnimateBy( Property(actor, index), relativeValue );
10858     tet_result(TET_FAIL);
10859   }, "Target value is not animatable" );
10860
10861   END_TEST;
10862 }
10863
10864
10865 int UtcDaliAnimationAnimateToNonAnimateableTypeN(void)
10866 {
10867   TestApplication application;
10868
10869   Actor actor = Actor::New();
10870
10871   // Register an integer property
10872   int startValue(1);
10873   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
10874   Stage::GetCurrent().Add(actor);
10875   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10876
10877   DALI_TEST_ASSERTION(
10878   {
10879     // Build the animation
10880     Animation animation = Animation::New( 2.0f );
10881     std::string relativeValue = "relative string";
10882     animation.AnimateTo( Property(actor, index), relativeValue );
10883   }, "Target value is not animatable" );
10884
10885   END_TEST;
10886 }
10887
10888 int UtcDaliAnimationAnimateBetweenNonAnimateableTypeN(void)
10889 {
10890   TestApplication application;
10891
10892   Actor actor = Actor::New();
10893
10894   // Register an integer property
10895   int startValue(1);
10896   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
10897   Stage::GetCurrent().Add(actor);
10898   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10899
10900   DALI_TEST_ASSERTION(
10901   {
10902     // Build the animation
10903     KeyFrames keyFrames = KeyFrames::New();
10904     keyFrames.Add( 0.0f, std::string("relative string1") );
10905     keyFrames.Add( 1.0f, std::string("relative string2") );
10906     // no need to really create the animation as keyframes do the check
10907   }, "Property type is not animatable" );
10908
10909   END_TEST;
10910 }
10911
10912 int UtcDaliAnimationSetAndGetTargetBeforePlayP(void)
10913 {
10914   tet_infoline("Setting up an animation should not effect it's position property until the animation plays");
10915
10916   TestApplication application;
10917
10918   tet_infoline("Set initial position and set up animation to re-position actor");
10919
10920   Actor actor = Actor::New();
10921   Stage::GetCurrent().Add(actor);
10922   Vector3 initialPosition(0.0f, 0.0f, 0.0f);
10923   actor.SetProperty( Actor::Property::POSITION, initialPosition );
10924
10925   // Build the animation
10926   Animation animation = Animation::New(2.0f);
10927
10928   //Test GetCurrentProgress return 0.0 as the duration is 0.0
10929   DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
10930   DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentPosition(), TEST_LOCATION );
10931
10932   tet_infoline("Set target position in animation without intiating play");
10933
10934   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
10935   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
10936
10937   application.SendNotification();
10938   application.Render();
10939
10940   tet_infoline("Ensure position of actor is still at intial value");
10941
10942   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
10943   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
10944   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
10945
10946   tet_infoline("Play animation and ensure actor position is now target");
10947
10948   animation.Play();
10949   application.SendNotification();
10950   application.Render(1000u);
10951
10952   tet_infoline("Ensure position of actor is at target value when aninmation half way");
10953
10954   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
10955   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
10956   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
10957
10958   tet_printf( "x position at half way point(%f)\n", actor.GetCurrentPosition().x );
10959
10960   application.Render(2000u);
10961
10962   tet_infoline("Ensure position of actor is still at target value when aninmation complete");
10963
10964   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
10965   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
10966   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
10967
10968   END_TEST;
10969 }
10970
10971 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsPositionP(void)
10972 {
10973   tet_infoline("Setting up an animation should not effect it's position property until the animation plays even with mulitple animators");
10974
10975   TestApplication application;
10976
10977   std::vector<Vector3> targetPositions;
10978
10979   targetPositions.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
10980   targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
10981   targetPositions.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
10982
10983   tet_infoline("Set initial position and set up animation to re-position actor");
10984
10985   Actor actor = Actor::New();
10986   Stage::GetCurrent().Add(actor);
10987   Vector3 initialPosition(0.0f, 0.0f, 0.0f);
10988   actor.SetProperty( Actor::Property::POSITION, initialPosition );
10989
10990   // Build the animation
10991   Animation animation = Animation::New(2.0f);
10992
10993   //Test GetCurrentProgress return 0.0 as the duration is 0.0
10994   DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
10995   DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentPosition(), TEST_LOCATION );
10996
10997   tet_infoline("Set target position in animation without intiating play");
10998
10999   for ( unsigned int i = 0; i < targetPositions.size(); i++ )
11000   {
11001     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[i], AlphaFunction::LINEAR);
11002   }
11003
11004   application.SendNotification();
11005   application.Render();
11006
11007   tet_infoline("Ensure position of actor is still at intial value");
11008
11009   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
11010   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
11011   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
11012
11013   tet_infoline("Play animation and ensure actor position is now target");
11014
11015   animation.Play();
11016   application.SendNotification();
11017   application.Render(1000u);
11018
11019   tet_infoline("Ensure position of actor is at target value when aninmation half way");
11020
11021   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
11022   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
11023   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
11024
11025   tet_printf( "x position at half way point(%f)\n", actor.GetCurrentPosition().x );
11026
11027   application.Render(2000u);
11028
11029   tet_infoline("Ensure position of actor is still at target value when aninmation complete");
11030
11031   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
11032   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
11033   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
11034
11035   END_TEST;
11036 }
11037
11038 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionP(void)
11039 {
11040   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");
11041
11042   TestApplication application;
11043
11044   std::vector<Vector3> targetSizes;
11045   std::vector<Vector3> targetPositions;
11046
11047   targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
11048   targetSizes.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
11049
11050   targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
11051
11052   tet_infoline("Set initial position and set up animation to re-position actor");
11053
11054   Actor actor = Actor::New();
11055   Stage::GetCurrent().Add(actor);
11056   Vector3 initialSize( 10.0f, 10.0f, 10.0f);
11057   Vector3 initialPosition(10.0f, 10.0f, 10.0f);
11058
11059   actor.SetProperty( Actor::Property::SIZE, initialSize );
11060   actor.SetProperty( Actor::Property::POSITION, initialPosition );
11061
11062   // Build the animation
11063   Animation animation = Animation::New(2.0f);
11064
11065   tet_infoline("Set target size in animation without intiating play");
11066   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
11067   tet_infoline("Set target position in animation without intiating play");
11068   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[0], AlphaFunction::LINEAR);
11069   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
11070
11071   application.SendNotification();
11072   application.Render();
11073
11074   tet_infoline("Ensure position of actor is still at intial size and position");
11075
11076   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
11077   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
11078   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
11079
11080   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialPosition.x, TEST_LOCATION );
11081   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialPosition.y, TEST_LOCATION );
11082   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialPosition.z, TEST_LOCATION );
11083
11084   tet_infoline("Play animation and ensure actor position and size is now matches targets");
11085
11086   animation.Play();
11087   application.SendNotification();
11088   application.Render(2000u);
11089
11090   tet_infoline("Ensure position and size of actor is at target value when aninmation playing");
11091
11092   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
11093   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
11094   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
11095
11096   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[0].x, TEST_LOCATION );
11097   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[0].y, TEST_LOCATION );
11098   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[0].z, TEST_LOCATION );
11099
11100   END_TEST;
11101 }
11102
11103 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionColourP(void)
11104 {
11105   tet_infoline("Setting up an animation should not effect it's size property until the animation plays even if other Properties animated");
11106
11107   TestApplication application;
11108
11109   std::vector<Vector3> targetSizes;
11110   std::vector<float> targetColors;
11111
11112   targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
11113   targetSizes.push_back( Vector3( 50.0f, 10.0f, 150.0f ) );
11114
11115   targetColors.push_back( 1.0f );
11116
11117   tet_infoline("Set initial position and set up animation to re-position actor");
11118
11119   Actor actor = Actor::New();
11120   Stage::GetCurrent().Add(actor);
11121   Vector3 initialSize( 10.0f, 5.0f, 10.0f);
11122
11123   actor.SetProperty( Actor::Property::SIZE, initialSize );
11124
11125   // Build the animation
11126   Animation animation = Animation::New(2.0f);
11127
11128   tet_infoline("Set target size in animation without initiating play");
11129   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
11130   tet_infoline("Set target position in animation without intiating play");
11131   animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetColors[0], AlphaFunction::LINEAR);
11132   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
11133
11134   application.SendNotification();
11135   application.Render();
11136
11137   tet_infoline("Ensure position of actor is still at initial size and position");
11138
11139   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
11140   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
11141   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
11142
11143   tet_infoline("Play animation and ensure actor position and size is now matches targets");
11144
11145   animation.Play();
11146   application.SendNotification();
11147   application.Render(2000u);
11148
11149   tet_infoline("Ensure position and size of actor is at target value when animation playing");
11150
11151   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
11152   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
11153   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
11154
11155   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColors[0], TEST_LOCATION );
11156
11157   END_TEST;
11158 }
11159
11160 int UtcDaliAnimationTimePeriodOrder(void)
11161 {
11162   tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place" );
11163
11164   TestApplication application;
11165
11166   Actor actor = Actor::New();
11167   Stage::GetCurrent().Add( actor );
11168
11169   application.SendNotification();
11170   application.Render();
11171
11172   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
11173   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11174   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11175   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11176   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11177
11178   //////////////////////////////////////////////////////////////////////////////////
11179
11180   tet_infoline( "With two AnimateTo calls" );
11181
11182   Animation animation = Animation::New( 0.0f );
11183   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
11184   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
11185   animation.Play();
11186
11187   tet_infoline( "The target position should change instantly" );
11188   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11189   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11190
11191   application.SendNotification();
11192   application.Render(5000); // After the animation is complete
11193
11194   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11195   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11196   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11197
11198   //////////////////////////////////////////////////////////////////////////////////
11199
11200   tet_infoline( "Same animation again but in a different order - should yield the same result" );
11201
11202   actor.SetX( 0.0f );
11203   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11204   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11205
11206   application.SendNotification();
11207   application.Render();
11208
11209   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
11210   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11211   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11212
11213   animation = Animation::New( 0.0f );
11214   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
11215   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
11216   animation.Play();
11217
11218   tet_infoline( "The target position should change instantly" );
11219   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11220   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11221
11222   application.SendNotification();
11223   application.Render(5000); // After the animation is complete
11224
11225   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11226   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11227   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11228
11229   END_TEST;
11230 }
11231
11232 int UtcDaliAnimationTimePeriodOrderSeveralAnimateToCalls(void)
11233 {
11234   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" );
11235
11236   TestApplication application;
11237
11238   Actor actor = Actor::New();
11239   Stage::GetCurrent().Add( actor );
11240
11241   application.SendNotification();
11242   application.Render();
11243
11244   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
11245   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11246   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11247   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11248   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11249
11250   //////////////////////////////////////////////////////////////////////////////////
11251
11252   tet_infoline( "" );
11253
11254   Animation animation = Animation::New( 0.0f );
11255   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
11256   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
11257   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
11258   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) );
11259   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) );
11260   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
11261   animation.Play();
11262
11263   tet_infoline( "The target position should change instantly" );
11264   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11265   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
11266
11267   application.SendNotification();
11268   application.Render(14000); // After the animation is complete
11269
11270   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11271   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11272   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
11273
11274   //////////////////////////////////////////////////////////////////////////////////
11275
11276   tet_infoline( "Same animation again but in a different order - should end up at the same point" );
11277
11278   actor.SetX( 0.0f );
11279
11280   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11281   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11282
11283   application.SendNotification();
11284   application.Render();
11285
11286   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
11287   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11288   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11289
11290   animation = Animation::New( 0.0f );
11291   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) );
11292   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
11293   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
11294   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
11295   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) );
11296   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
11297   animation.Play();
11298
11299   tet_infoline( "The target position should change instantly" );
11300   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11301   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
11302
11303   application.SendNotification();
11304   application.Render(14000); // After the animation is complete
11305
11306   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11307   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11308   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
11309
11310   END_TEST;
11311 }
11312
11313 int UtcDaliAnimationAnimateBetweenIntegerP(void)
11314 {
11315   TestApplication application;
11316
11317   int startValue(1);
11318   Actor actor = Actor::New();
11319   const Property::Index index = actor.RegisterProperty("customProperty", startValue );
11320   Stage::GetCurrent().Add(actor);
11321
11322   application.Render();
11323   application.SendNotification();
11324
11325   DALI_TEST_EQUALS( actor.GetProperty< int >( index ), startValue, TEST_LOCATION );
11326
11327   // Build the animation
11328   float durationSeconds(1.0f);
11329   Animation animation = Animation::New(durationSeconds);
11330
11331   KeyFrames keyFrames = KeyFrames::New();
11332   keyFrames.Add(0.0f, 10);
11333   keyFrames.Add(0.2f, 20);
11334   keyFrames.Add(0.4f, 30);
11335   keyFrames.Add(0.6f, 40);
11336   keyFrames.Add(0.8f, 50);
11337   keyFrames.Add(1.0f, 60);
11338
11339   animation.AnimateBetween( Property(actor, index ), keyFrames );
11340
11341   // Start the animation
11342   animation.Play();
11343
11344   // Target value should change to the last key-frame's value straight away
11345   DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 60, TEST_LOCATION );
11346
11347   END_TEST;
11348 }
11349
11350 int UtcDaliAnimationAnimateBetweenVector2P(void)
11351 {
11352   TestApplication application;
11353
11354   Vector2 startValue( 10.0f, 20.0f );
11355   Actor actor = Actor::New();
11356   const Property::Index index = actor.RegisterProperty("customProperty", startValue );
11357   Stage::GetCurrent().Add(actor);
11358
11359   application.Render();
11360   application.SendNotification();
11361
11362   DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
11363
11364   // Build the animation
11365   float durationSeconds(1.0f);
11366   Animation animation = Animation::New(durationSeconds);
11367
11368   KeyFrames keyFrames = KeyFrames::New();
11369   keyFrames.Add( 0.0f, Vector2( 0.0f, 5.0f ) );
11370   keyFrames.Add( 0.2f, Vector2( 30.0f, 25.0f ) );
11371   keyFrames.Add( 0.4f, Vector2( 40.0f, 35.0f ) );
11372   keyFrames.Add( 0.6f, Vector2( 50.0f, 45.0f ) );
11373   keyFrames.Add( 0.8f, Vector2( 60.0f, 55.0f ) );
11374   keyFrames.Add( 1.0f, Vector2( 70.0f, 65.0f ) );
11375
11376   animation.AnimateBetween( Property(actor, index ), keyFrames );
11377
11378   // Start the animation
11379   animation.Play();
11380
11381   // Target value should change to the last key-frame's value straight away
11382   DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), Vector2( 70.0f, 65.0f ), TEST_LOCATION );
11383
11384   END_TEST;
11385 }
11386
11387 int UtcDaliAnimationProgressCallbackP(void)
11388 {
11389   TestApplication application;
11390
11391   Actor actor = Actor::New();
11392   Stage::GetCurrent().Add(actor);
11393
11394   // Build the animation
11395   Animation animation = Animation::New(0.0f);
11396
11397   //Set duration
11398   float durationSeconds(1.0f);
11399   animation.SetDuration(durationSeconds);
11400
11401   bool finishedSignalReceived(false);
11402   bool progressSignalReceived(false);
11403
11404   AnimationFinishCheck finishCheck(finishedSignalReceived);
11405   animation.FinishedSignal().Connect(&application, finishCheck);
11406
11407   AnimationProgressCheck progressCheck(progressSignalReceived);
11408   DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
11409   application.SendNotification();
11410
11411   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11412   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
11413
11414   tet_infoline( "Animation Progress notification set to 30%" );
11415   DevelAnimation::SetProgressNotification( animation, 0.3f );
11416
11417   application.SendNotification();
11418   application.Render( );
11419
11420   DALI_TEST_EQUALS( 0.3f, DevelAnimation::GetProgressNotification( animation ), TEST_LOCATION );
11421
11422   progressCheck.CheckSignalNotReceived();
11423
11424   // Start the animation from 10% progress
11425   animation.SetCurrentProgress( 0.1f );
11426   animation.Play();
11427
11428   tet_infoline( "Animation Playing from 10%" );
11429
11430   application.SendNotification();
11431   application.Render(0); // start animation
11432   application.Render(durationSeconds*100.0f ); // 20% progress
11433
11434   tet_infoline( "Animation at 20%" );
11435
11436   progressCheck.CheckSignalNotReceived();
11437
11438   application.SendNotification();
11439   application.Render(durationSeconds*200.0f ); // 40% progress
11440   application.SendNotification();
11441   tet_infoline( "Animation at 40%" );
11442   DALI_TEST_EQUALS( 0.4f, animation.GetCurrentProgress(), TEST_LOCATION );
11443
11444   progressCheck.CheckSignalReceived();
11445
11446   tet_infoline( "Progress check reset" );
11447   progressCheck.Reset();
11448
11449   application.Render(durationSeconds*100.0f ); // 50% progress
11450   tet_infoline( "Animation at 50%" );
11451   application.SendNotification();
11452
11453   DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
11454
11455   progressCheck.CheckSignalNotReceived();
11456
11457   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 60% progress */);
11458   application.SendNotification();
11459
11460   tet_infoline( "Animation at 60%" );
11461
11462   finishCheck.CheckSignalNotReceived();
11463
11464   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
11465   application.SendNotification();
11466   DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
11467   tet_infoline( "Animation at 80%" );
11468
11469   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
11470   // We did expect the animation to finish
11471   application.SendNotification();
11472   finishCheck.CheckSignalReceived();
11473   tet_infoline( "Animation finished" );
11474   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11475
11476   END_TEST;
11477 }
11478
11479 int UtcDaliAnimationPlayAfterP(void)
11480 {
11481   TestApplication application;
11482
11483   tet_printf("Testing that playing after 2 seconds\n");
11484
11485   {
11486     Actor actor = Actor::New();
11487     Stage::GetCurrent().Add(actor);
11488
11489     // Build the animation
11490     float durationSeconds(1.0f);
11491     Animation animation = Animation::New(durationSeconds);
11492
11493     bool signalReceived( false );
11494     AnimationFinishCheck finishCheck( signalReceived );
11495     animation.FinishedSignal().Connect( &application, finishCheck );
11496     application.SendNotification();
11497
11498     Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
11499     animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
11500
11501     // Play animation after the initial delay time
11502     animation.PlayAfter( 0.2f );
11503     application.SendNotification();
11504     application.Render(0); // start animation
11505
11506     application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter
11507     application.SendNotification();
11508     finishCheck.CheckSignalNotReceived();
11509     DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move
11510
11511     application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% animation progress, 0% animator progress */ );
11512
11513     // We didn't expect the animation to finish yet
11514     application.SendNotification();
11515     finishCheck.CheckSignalNotReceived();
11516     DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
11517
11518     application.SendNotification();
11519     application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 75% animation progress, 50% animator progress */ );
11520
11521     application.SendNotification();
11522     finishCheck.CheckSignalNotReceived();
11523     DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.5f ), TEST_LOCATION );
11524
11525     application.SendNotification();
11526     application.Render( static_cast< unsigned int >( durationSeconds * 250.0f ) + 1u/*just beyond the animation duration*/ );
11527
11528     // We did expect the animation to finish
11529     application.SendNotification();
11530     finishCheck.CheckSignalReceived();
11531     DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11532
11533     // Check that nothing has changed after a couple of buffer swaps
11534     application.Render(0);
11535     DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11536   }
11537
11538   tet_printf("Testing that playing after 2 seconds with negative speedfactor\n");
11539   // SpeedFactor < 0
11540   {
11541     Actor actor = Actor::New();
11542     Stage::GetCurrent().Add(actor);
11543
11544     // Build the animation
11545     float durationSeconds(1.0f);
11546     Animation animation = Animation::New(durationSeconds);
11547     animation.SetSpeedFactor( -1.0f ); // Set SpeedFactor as < 0
11548
11549     bool signalReceived( false );
11550     AnimationFinishCheck finishCheck( signalReceived );
11551     animation.FinishedSignal().Connect( &application, finishCheck );
11552     application.SendNotification();
11553
11554     Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
11555     animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
11556
11557     // Play animation after the initial delay time
11558     animation.PlayAfter( 0.2f );
11559     application.SendNotification();
11560     application.Render(0); // start animation
11561
11562     application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter
11563     application.SendNotification();
11564     finishCheck.CheckSignalNotReceived();
11565     DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 1.0f ), TEST_LOCATION ); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
11566
11567     application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 25% animation progress, 50% animator progress */ );
11568
11569     // We didn't expect the animation to finish yet
11570     application.SendNotification();
11571     finishCheck.CheckSignalNotReceived();
11572     DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.5f ), TEST_LOCATION );
11573
11574     application.SendNotification();
11575     application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 50% animation progress, 100% animator progress */ );
11576
11577     application.SendNotification();
11578     finishCheck.CheckSignalNotReceived();
11579     DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION );
11580
11581     application.SendNotification();
11582     application.Render( static_cast< unsigned int >( durationSeconds * 500.0f ) + 1u/*just beyond the animation duration*/ );
11583
11584     // We did expect the animation to finish
11585     application.SendNotification();
11586     finishCheck.CheckSignalReceived();
11587     DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of Timeperiod in seconds
11588
11589     // Check that nothing has changed after a couple of buffer swaps
11590     application.Render(0);
11591     DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(0.0, 0.0, 0.0), TEST_LOCATION );
11592   }
11593
11594   END_TEST;
11595 }
11596
11597 int UtcDaliAnimationPlayAfterP2(void)
11598 {
11599   TestApplication application;
11600
11601   tet_printf("Testing that playing after 2 seconds before looping\n");
11602
11603   {
11604     Actor actor = Actor::New();
11605     Stage::GetCurrent().Add(actor);
11606
11607     // Build the animation
11608     float durationSeconds(1.0f);
11609     Animation animation = Animation::New(durationSeconds);
11610     animation.SetLooping( true );
11611
11612     bool signalReceived( false );
11613     AnimationFinishCheck finishCheck( signalReceived );
11614     animation.FinishedSignal().Connect( &application, finishCheck );
11615     application.SendNotification();
11616
11617     Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
11618     animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
11619
11620     // Play animation after the initial delay time
11621     animation.PlayAfter( 0.2f );
11622     application.SendNotification();
11623     application.Render(0); // start animation
11624
11625     for( int iterations = 0; iterations < 3; ++iterations )
11626     {
11627       // The initial delay time of PlayAfter() applies only once in looping mode.
11628       if( iterations == 0 )
11629       {
11630         application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter
11631         application.SendNotification();
11632         finishCheck.CheckSignalNotReceived();
11633         DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move
11634       }
11635
11636       application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% animation progress, 0% animator progress */ );
11637
11638       // We didn't expect the animation to finish yet
11639       application.SendNotification();
11640       finishCheck.CheckSignalNotReceived();
11641       DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
11642
11643       application.SendNotification();
11644       application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 75% animation progress, 50% animator progress */ );
11645
11646       application.SendNotification();
11647       finishCheck.CheckSignalNotReceived();
11648       DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.5f ), TEST_LOCATION );
11649
11650       application.SendNotification();
11651       application.Render( static_cast< unsigned int >( durationSeconds * 250.0f ) /* 100% progress */ );
11652
11653       // We did expect the animation to finish
11654       application.SendNotification();
11655       finishCheck.CheckSignalNotReceived();
11656       DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11657     }
11658
11659     animation.SetLooping(false);
11660     application.SendNotification();
11661     application.Render( static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/ );
11662
11663     application.SendNotification();
11664     finishCheck.CheckSignalReceived();
11665     DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11666   }
11667
11668   tet_printf("Testing that playing after 2 seconds before looping with negative speedfactor\n");
11669   // SpeedFactor < 0
11670   {
11671     Actor actor = Actor::New();
11672     Stage::GetCurrent().Add(actor);
11673
11674     // Build the animation
11675     float durationSeconds(1.0f);
11676     Animation animation = Animation::New(durationSeconds);
11677     animation.SetLooping( true );
11678     animation.SetSpeedFactor( -1.0f ); //Set SpeedFactor as < 0
11679
11680     bool signalReceived( false );
11681     AnimationFinishCheck finishCheck( signalReceived );
11682     animation.FinishedSignal().Connect( &application, finishCheck );
11683     application.SendNotification();
11684
11685     Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
11686     animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
11687
11688     // Play animation after the initial delay time
11689     animation.PlayAfter( 0.2f );
11690     application.SendNotification();
11691     application.Render(0); // start animation
11692
11693     for( int iterations = 0; iterations < 3; ++iterations )
11694     {
11695       // The initial delay time of PlayAfter() applies only once in looping mode.
11696       if( iterations == 0 )
11697       {
11698         application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter
11699         application.SendNotification();
11700         finishCheck.CheckSignalNotReceived();
11701         DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 1.0f ), TEST_LOCATION ); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
11702       }
11703
11704       application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 25% animation progress, 50% animator progress */ );
11705
11706       // We didn't expect the animation to finish yet
11707       application.SendNotification();
11708       finishCheck.CheckSignalNotReceived();
11709       DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.5f ), TEST_LOCATION );
11710
11711       application.SendNotification();
11712       application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 50% animation progress, 100% animator progress */ );
11713
11714       application.SendNotification();
11715       finishCheck.CheckSignalNotReceived();
11716       DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION );
11717
11718       application.SendNotification();
11719       application.Render( static_cast< unsigned int >( durationSeconds * 500.0f ) /* 100% progress */ );
11720
11721       // We did expect the animation to finish
11722       application.SendNotification();
11723       finishCheck.CheckSignalNotReceived();
11724       DALI_TEST_EQUALS( actor.GetCurrentPosition(),  ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in second
11725     }
11726
11727     animation.SetLooping(false);
11728     application.SendNotification();
11729     application.Render( static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/ );
11730
11731     application.SendNotification();
11732     finishCheck.CheckSignalReceived();
11733     DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(0.0, 0.0, 0.0), TEST_LOCATION );
11734   }
11735
11736   END_TEST;
11737 }
11738
11739 int UtcDaliAnimationPlayAfterP3(void)
11740 {
11741   TestApplication application;
11742
11743   tet_printf("Testing that PlayAfter with the negative delay seconds\n");
11744
11745   Actor actor = Actor::New();
11746   Stage::GetCurrent().Add(actor);
11747
11748   // Build the animation
11749   float durationSeconds(1.0f);
11750   Animation animation = Animation::New(durationSeconds);
11751
11752   bool signalReceived( false );
11753   AnimationFinishCheck finishCheck( signalReceived );
11754   animation.FinishedSignal().Connect( &application, finishCheck );
11755   application.SendNotification();
11756
11757   Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
11758   animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
11759
11760   // When the delay time is negative value, it would treat as play immediately.
11761   animation.PlayAfter( -2.0f );
11762   application.SendNotification();
11763   application.Render(0); // start animation
11764
11765   application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% animation progress, 0% animator progress */ );
11766
11767   // We didn't expect the animation to finish yet
11768   application.SendNotification();
11769   finishCheck.CheckSignalNotReceived();
11770   DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
11771
11772   application.SendNotification();
11773   application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 75% animation progress, 50% animator progress */ );
11774
11775   application.SendNotification();
11776   finishCheck.CheckSignalNotReceived();
11777   DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.5f ), TEST_LOCATION );
11778
11779   application.SendNotification();
11780   application.Render( static_cast< unsigned int >( durationSeconds * 250.0f ) + 1u/*just beyond the animation duration*/ );
11781
11782   // We did expect the animation to finish
11783   application.SendNotification();
11784   finishCheck.CheckSignalReceived();
11785   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11786
11787   // Check that nothing has changed after a couple of buffer swaps
11788   application.Render(0);
11789   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11790   END_TEST;
11791 }
11792
11793 int UtcDaliAnimationPlayAfterP4(void)
11794 {
11795   TestApplication application;
11796
11797   tet_printf("Testing that PlayAfter with progress value\n");
11798
11799   Actor actor = Actor::New();
11800   Stage::GetCurrent().Add(actor);
11801
11802   // Build the animation
11803   float durationSeconds(1.0f);
11804   Animation animation = Animation::New(durationSeconds);
11805
11806   bool signalReceived( false );
11807   AnimationFinishCheck finishCheck( signalReceived );
11808   animation.FinishedSignal().Connect( &application, finishCheck );
11809   application.SendNotification();
11810
11811   Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
11812   animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
11813
11814   // Delay time is 0.3s. So after duration times, progress must be 70%. animation will finished at 1.3s.
11815   animation.PlayAfter( durationSeconds * 0.3f );
11816   application.SendNotification();
11817   application.Render(0); // start animation
11818
11819   application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 5/6 delay progress, 0% animation progress, 0% animator progress */ );
11820
11821   // We didn't expect the animation to finish yet
11822   application.SendNotification();
11823   finishCheck.CheckSignalNotReceived();
11824   DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of PlayAfter
11825
11826   application.SendNotification();
11827   application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 20% animation progress, 0% animator progress */ );
11828
11829   application.SendNotification();
11830   finishCheck.CheckSignalNotReceived();
11831   DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
11832
11833   application.SendNotification();
11834   application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 45% animation progress, 0% animator progress */ );
11835
11836   application.SendNotification();
11837   finishCheck.CheckSignalNotReceived();
11838   DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
11839
11840   application.SendNotification();
11841   application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 70% animation progress, 40% animator progress */ );
11842
11843   application.SendNotification();
11844   finishCheck.CheckSignalNotReceived();
11845   DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.4f ), TEST_LOCATION ); // 40% of animator progress
11846
11847   application.SendNotification();
11848   application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 95% animation progress, 90% animator progress */ );
11849
11850   application.SendNotification();
11851   finishCheck.CheckSignalNotReceived();
11852   DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.9f ), TEST_LOCATION ); // 90% of animator progress
11853
11854   application.SendNotification();
11855   application.Render( static_cast< unsigned int >( durationSeconds * 50.0f ) + 1u/*just beyond the animation duration*/ );
11856
11857   // We did expect the animation to finish
11858   application.SendNotification();
11859   finishCheck.CheckSignalReceived();
11860   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11861
11862   // Check that nothing has changed after a couple of buffer swaps
11863   application.Render(0);
11864   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11865   END_TEST;
11866 }
11867
11868 int UtcDaliAnimationSetLoopingModeP(void)
11869 {
11870   // Test Loop forever and Loop mode being set
11871   TestApplication application;
11872   Stage stage( Stage::GetCurrent() );
11873
11874   // Default: LoopingMode::RESTART
11875   {
11876     Actor actor = Actor::New();
11877     stage.Add( actor );
11878
11879     float durationSeconds( 1.0f );
11880     Animation animation = Animation::New( durationSeconds );
11881     DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::RESTART );
11882
11883     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
11884     animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
11885
11886     // Start the animation
11887     animation.Play();
11888     application.SendNotification();
11889     application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
11890
11891     actor.Unparent();
11892
11893     application.SendNotification();
11894     application.Render();
11895     DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11896   }
11897
11898   // LoopingMode::AUTO_REVERSE
11899   {
11900     Actor actor = Actor::New();
11901     stage.Add( actor );
11902
11903     float durationSeconds( 1.0f );
11904     Animation animation = Animation::New( durationSeconds );
11905     animation.SetLooping( true );
11906
11907     bool signalReceived( false );
11908     AnimationFinishCheck finishCheck( signalReceived );
11909     animation.FinishedSignal().Connect( &application, finishCheck );
11910     application.SendNotification();
11911
11912     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11913     animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
11914
11915     animation.SetLoopingMode( Animation::LoopingMode::AUTO_REVERSE );
11916     DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
11917
11918     // Start the animation
11919     animation.Play();
11920     application.SendNotification();
11921     application.Render(0);
11922
11923     for( int iterations = 0; iterations < 3; ++iterations )
11924     {
11925       application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% time progress */ );
11926       application.SendNotification();
11927       finishCheck.CheckSignalNotReceived();
11928
11929       // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
11930       // and arrives at the beginning.
11931       DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11932
11933       application.SendNotification();
11934       application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 100% time progress */ );
11935
11936       // We did expect the animation to finish
11937       application.SendNotification();
11938       finishCheck.CheckSignalNotReceived();
11939       DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
11940     }
11941
11942     animation.SetLooping( false );
11943     application.SendNotification();
11944     application.Render(static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/);
11945
11946     application.SendNotification();
11947     finishCheck.CheckSignalReceived();
11948
11949     DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
11950   }
11951
11952   // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
11953   {
11954     Actor actor = Actor::New();
11955     stage.Add( actor );
11956
11957     float durationSeconds( 1.0f );
11958     Animation animation = Animation::New( durationSeconds );
11959     animation.SetLooping( true );
11960
11961     bool signalReceived( false );
11962     AnimationFinishCheck finishCheck( signalReceived );
11963     animation.FinishedSignal().Connect( &application, finishCheck );
11964     application.SendNotification();
11965
11966     // Specify a negative multiplier to play the animation in reverse
11967     animation.SetSpeedFactor( -1.0f );
11968
11969     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11970     animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
11971
11972     animation.SetLoopingMode( Animation::AUTO_REVERSE );
11973     DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
11974
11975     // Start the animation
11976     animation.Play();
11977     application.SendNotification();
11978     application.Render(0);
11979
11980     for( int iterations = 0; iterations < 3; ++iterations )
11981     {
11982       application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% time progress */ );
11983       application.SendNotification();
11984       finishCheck.CheckSignalNotReceived();
11985
11986       // Setting a negative speed factor is to play the animation in reverse.
11987       // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
11988       // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
11989       DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
11990
11991       application.SendNotification();
11992       application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 100% time progress */ );
11993
11994       // We did expect the animation to finish
11995       application.SendNotification();
11996       finishCheck.CheckSignalNotReceived();
11997       DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11998     }
11999
12000     animation.SetLooping( false );
12001     application.SendNotification();
12002     application.Render(static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/);
12003
12004     application.SendNotification();
12005     finishCheck.CheckSignalReceived();
12006
12007     DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
12008   }
12009
12010   END_TEST;
12011 }
12012
12013 int UtcDaliAnimationSetLoopingModeP2(void)
12014 {
12015   // Test Loop Count and Loop mode being set
12016   TestApplication application;
12017   Stage stage( Stage::GetCurrent() );
12018
12019   // LoopingMode::AUTO_REVERSE
12020   {
12021     Actor actor = Actor::New();
12022     stage.Add( actor );
12023
12024     float durationSeconds( 1.0f );
12025     Animation animation = Animation::New( durationSeconds );
12026     animation.SetLoopCount(3);
12027     DALI_TEST_CHECK(animation.IsLooping());
12028
12029     bool signalReceived( false );
12030     AnimationFinishCheck finishCheck( signalReceived );
12031     animation.FinishedSignal().Connect( &application, finishCheck );
12032     application.SendNotification();
12033
12034     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12035     animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
12036
12037     animation.SetLoopingMode( Animation::AUTO_REVERSE );
12038     DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
12039
12040     // Start the animation
12041     animation.Play();
12042
12043     application.Render(0);
12044     application.SendNotification();
12045     application.Render(0);
12046     application.SendNotification();
12047     application.Render(0);
12048     application.SendNotification();
12049     application.Render(0);
12050     application.SendNotification();
12051
12052     // Loop
12053     float intervalSeconds = 3.0f;
12054
12055     application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
12056     // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12057     // and arrives at the beginning.
12058     DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
12059
12060     application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
12061
12062     application.Render(0);
12063     application.SendNotification();
12064     application.Render(0);
12065     application.SendNotification();
12066     application.Render(0);
12067     application.SendNotification();
12068     application.Render(0);
12069     application.SendNotification();
12070     finishCheck.CheckSignalNotReceived();
12071
12072     application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
12073
12074     application.SendNotification();
12075     finishCheck.CheckSignalReceived();
12076     DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
12077
12078     finishCheck.Reset();
12079   }
12080
12081   // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12082   {
12083     Actor actor = Actor::New();
12084     stage.Add( actor );
12085
12086     float durationSeconds( 1.0f );
12087     Animation animation = Animation::New( durationSeconds );
12088     animation.SetLoopCount(3);
12089     DALI_TEST_CHECK(animation.IsLooping());
12090
12091     bool signalReceived( false );
12092     AnimationFinishCheck finishCheck( signalReceived );
12093     animation.FinishedSignal().Connect( &application, finishCheck );
12094     application.SendNotification();
12095
12096     // Specify a negative multiplier to play the animation in reverse
12097     animation.SetSpeedFactor( -1.0f );
12098
12099     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12100     animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
12101
12102     animation.SetLoopingMode( Animation::AUTO_REVERSE );
12103     DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
12104
12105     // Start the animation
12106     animation.Play();
12107
12108     application.Render(0);
12109     application.SendNotification();
12110     application.Render(0);
12111     application.SendNotification();
12112     application.Render(0);
12113     application.SendNotification();
12114     application.Render(0);
12115     application.SendNotification();
12116
12117     // Loop
12118     float intervalSeconds = 3.0f;
12119
12120     application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
12121     // Setting a negative speed factor is to play the animation in reverse.
12122     // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12123     // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12124     DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
12125
12126     application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
12127
12128     application.Render(0);
12129     application.SendNotification();
12130     application.Render(0);
12131     application.SendNotification();
12132     application.Render(0);
12133     application.SendNotification();
12134     application.Render(0);
12135     application.SendNotification();
12136     finishCheck.CheckSignalNotReceived();
12137
12138     application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
12139
12140     application.SendNotification();
12141     finishCheck.CheckSignalReceived();
12142     DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
12143
12144     finishCheck.Reset();
12145   }
12146
12147   END_TEST;
12148 }
12149
12150 int UtcDaliAnimationSetLoopingModeP3(void)
12151 {
12152   // Test Loop Count is 1 (== default) and Loop mode being set
12153   TestApplication application;
12154   Stage stage( Stage::GetCurrent() );
12155
12156   // LoopingMode::AUTO_REVERSE
12157   {
12158     Actor actor = Actor::New();
12159     stage.Add( actor );
12160
12161     float durationSeconds( 1.0f );
12162     Animation animation = Animation::New( durationSeconds );
12163     DALI_TEST_CHECK(1 == animation.GetLoopCount());
12164
12165     bool signalReceived( false );
12166     AnimationFinishCheck finishCheck( signalReceived );
12167     animation.FinishedSignal().Connect( &application, finishCheck );
12168     application.SendNotification();
12169
12170     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12171     animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
12172
12173     animation.SetLoopingMode( Animation::AUTO_REVERSE );
12174     DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
12175
12176     // Start the animation
12177     animation.Play();
12178     application.Render(0);
12179     application.SendNotification();
12180
12181     application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 50% time progress */ );
12182     application.SendNotification();
12183     finishCheck.CheckSignalNotReceived();
12184
12185     // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12186     // and arrives at the beginning.
12187     DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
12188
12189     application.SendNotification();
12190     application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 100% time progress */ );
12191
12192     application.SendNotification();
12193     DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
12194
12195     application.SendNotification();
12196     application.Render( static_cast< unsigned int >( durationSeconds * 1.0f * 1000.0f ) + 1u /*just beyond the animation duration*/ );
12197
12198     application.SendNotification();
12199     application.Render(0);
12200     application.SendNotification();
12201     finishCheck.CheckSignalReceived();
12202
12203     // After all animation finished, arrives at the beginning.
12204     DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
12205
12206     finishCheck.Reset();
12207   }
12208
12209   // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12210   {
12211     Actor actor = Actor::New();
12212     stage.Add( actor );
12213
12214     float durationSeconds( 1.0f );
12215     Animation animation = Animation::New( durationSeconds );
12216     DALI_TEST_CHECK(1 == animation.GetLoopCount());
12217
12218     bool signalReceived( false );
12219     AnimationFinishCheck finishCheck( signalReceived );
12220     animation.FinishedSignal().Connect( &application, finishCheck );
12221     application.SendNotification();
12222
12223     // Specify a negative multiplier to play the animation in reverse
12224     animation.SetSpeedFactor( -1.0f );
12225
12226     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12227     animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
12228
12229     animation.SetLoopingMode( Animation::AUTO_REVERSE );
12230     DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
12231
12232     // Start the animation
12233     animation.Play();
12234     application.Render(0);
12235     application.SendNotification();
12236
12237     application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 50% time progress */ );
12238     application.SendNotification();
12239     finishCheck.CheckSignalNotReceived();
12240
12241     // Setting a negative speed factor is to play the animation in reverse.
12242     // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12243     // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12244     DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
12245
12246     application.SendNotification();
12247     application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 100% time progress */ );
12248
12249     application.SendNotification();
12250     DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
12251
12252     application.SendNotification();
12253     application.Render( static_cast< unsigned int >( durationSeconds * 1.0f * 1000.0f ) + 1u /*just beyond the animation duration*/ );
12254
12255     application.SendNotification();
12256     application.Render(0);
12257     application.SendNotification();
12258     finishCheck.CheckSignalReceived();
12259
12260     // After all animation finished, arrives at the target.
12261     DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
12262
12263     finishCheck.Reset();
12264   }
12265
12266   END_TEST;
12267 }
12268
12269 int UtcDaliAnimationGetLoopingModeP(void)
12270 {
12271   TestApplication application;
12272
12273   Animation animation = Animation::New(1.0f);
12274
12275   // default mode
12276   DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::RESTART );
12277
12278   animation.SetLoopingMode( Animation::AUTO_REVERSE );
12279   DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
12280
12281   END_TEST;
12282 }
12283
12284 int UtcDaliAnimationProgressSignalConnectionWithoutProgressMarkerP(void)
12285 {
12286   TestApplication application;
12287
12288   tet_infoline( "Connect to ProgressReachedSignal but do not set a required Progress marker" );
12289
12290   Actor actor = Actor::New();
12291   Stage::GetCurrent().Add(actor);
12292
12293   // Build the animation
12294   Animation animation = Animation::New(0.0f);
12295
12296   //Set duration
12297   float durationSeconds(1.0f);
12298   animation.SetDuration(durationSeconds);
12299
12300   bool finishedSignalReceived(false);
12301   bool progressSignalReceived(false);
12302
12303   AnimationFinishCheck finishCheck(finishedSignalReceived);
12304   animation.FinishedSignal().Connect(&application, finishCheck);
12305
12306   AnimationProgressCheck progressCheck( progressSignalReceived );
12307   DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
12308   application.SendNotification();
12309
12310   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12311   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12312
12313   progressCheck.CheckSignalNotReceived();
12314
12315   animation.Play();
12316
12317   application.SendNotification();
12318   application.Render(0); // start animation
12319   application.Render(durationSeconds*100.0f ); // 10% progress
12320   application.SendNotification();
12321
12322   tet_infoline( "Ensure after animation has started playing that ProgressReachedSignal not emitted" );
12323   progressCheck.CheckSignalNotReceived();
12324
12325   application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
12326
12327   application.SendNotification();
12328   finishCheck.CheckSignalReceived();
12329   tet_infoline( "Animation finished" );
12330   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
12331
12332   END_TEST;
12333 }
12334
12335 int UtcDaliAnimationMultipleProgressSignalsP(void)
12336 {
12337   tet_infoline( "Multiple animations with different progress markers" );
12338
12339   TestApplication application;
12340
12341   Actor actor = Actor::New();
12342   Stage::GetCurrent().Add(actor);
12343
12344   // Build the animation
12345   Animation animationAlpha = Animation::New(0.0f);
12346   Animation animationBeta = Animation::New(0.0f);
12347
12348   //Set duration
12349   float durationSeconds(1.0f);
12350   animationAlpha.SetDuration(durationSeconds);
12351   animationBeta.SetDuration(durationSeconds);
12352
12353   bool progressSignalReceivedAlpha(false);
12354   bool progressSignalReceivedBeta(false);
12355
12356   AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12357   AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta" );
12358
12359   DevelAnimation::ProgressReachedSignal( animationAlpha ).Connect( &application, progressCheckAlpha );
12360   DevelAnimation::ProgressReachedSignal( animationBeta ).Connect( &application, progressCheckBeta);
12361   application.SendNotification();
12362
12363   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12364   animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12365   animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12366
12367   tet_infoline( "AnimationAlpha Progress notification set to 30%" );
12368   DevelAnimation::SetProgressNotification( animationAlpha, 0.3f );
12369
12370   tet_infoline( "AnimationBeta Progress notification set to 50%" );
12371   DevelAnimation::SetProgressNotification( animationBeta, 0.5f );
12372
12373   application.SendNotification();
12374   application.Render( );
12375
12376   progressCheckAlpha.CheckSignalNotReceived();
12377   progressCheckBeta.CheckSignalNotReceived();
12378
12379   // Start the animations from 10% progress
12380   animationAlpha.SetCurrentProgress( 0.1f );
12381   animationBeta.SetCurrentProgress( 0.1f );
12382   animationAlpha.Play();
12383   animationBeta.Play();
12384
12385   tet_infoline( "Animation Playing from 10%" );
12386
12387   application.SendNotification();
12388   application.Render(0); // start animation
12389   application.Render(durationSeconds*100.0f ); // 20% progress
12390
12391   tet_infoline( "Animation at 20% - No signals to be received" );
12392
12393   progressCheckAlpha.CheckSignalNotReceived();
12394   progressCheckBeta.CheckSignalNotReceived();
12395
12396   application.SendNotification();
12397   application.Render(durationSeconds*200.0f ); // 40% progress
12398   application.SendNotification();
12399   tet_infoline( "Animation at 40% - Alpha signal should be received" );
12400   DALI_TEST_EQUALS( 0.4f, animationAlpha.GetCurrentProgress(), TEST_LOCATION );
12401
12402   progressCheckAlpha.CheckSignalReceived();
12403   progressCheckBeta.CheckSignalNotReceived();
12404
12405   tet_infoline( "Progress check reset" );
12406   progressCheckAlpha.Reset();
12407   progressCheckBeta.Reset();
12408
12409   application.Render(durationSeconds*100.0f ); // 50% progress
12410   tet_infoline( "Animation at 50% - Beta should receive signal, Alpha should not" );
12411   application.SendNotification();
12412
12413   DALI_TEST_EQUALS( 0.5f, animationBeta.GetCurrentProgress(), TEST_LOCATION );
12414
12415   progressCheckAlpha.CheckSignalNotReceived();
12416   progressCheckBeta.CheckSignalReceived();
12417   tet_infoline( "Progress check reset" );
12418   progressCheckAlpha.Reset();
12419   progressCheckBeta.Reset();
12420
12421   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 60% progress */);
12422   application.SendNotification();
12423
12424   tet_infoline( "Animation at 60%" );
12425
12426   progressCheckAlpha.CheckSignalNotReceived();
12427   progressCheckBeta.CheckSignalNotReceived();
12428
12429   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
12430   application.SendNotification();
12431   tet_infoline( "Animation at 80%" );
12432
12433   progressCheckAlpha.CheckSignalNotReceived();
12434   progressCheckBeta.CheckSignalNotReceived();
12435
12436   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
12437   // We did expect the animation to finish
12438   tet_infoline( "Animation finished" );
12439
12440   END_TEST;
12441 }
12442
12443 int UtcDaliAnimationMultipleProgressSignalsP2(void)
12444 {
12445   tet_infoline( "Multiple animations with different progress markers and big step time" );
12446
12447   TestApplication application;
12448
12449   Actor actor = Actor::New();
12450   Stage::GetCurrent().Add(actor);
12451
12452   // Build the animation
12453   Animation animationAlpha = Animation::New(0.0f);
12454   Animation animationBeta = Animation::New(0.0f);
12455
12456   //Set duration
12457   const float durationSeconds(1.0f);
12458   animationAlpha.SetDuration(durationSeconds);
12459   animationBeta.SetDuration(durationSeconds);
12460
12461   bool progressSignalReceivedAlpha(false);
12462   bool progressSignalReceivedBeta(false);
12463
12464   AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12465   AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta" );
12466
12467   DevelAnimation::ProgressReachedSignal( animationAlpha ).Connect( &application, progressCheckAlpha );
12468   DevelAnimation::ProgressReachedSignal( animationBeta ).Connect( &application, progressCheckBeta);
12469   application.SendNotification();
12470
12471   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12472   animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12473   animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12474
12475   tet_infoline( "AnimationAlpha Progress notification set to 1%" );
12476   DevelAnimation::SetProgressNotification( animationAlpha, 0.01f );
12477
12478   tet_infoline( "AnimationBeta Progress notification set to 99%" );
12479   DevelAnimation::SetProgressNotification( animationBeta, 0.99f );
12480
12481   application.SendNotification();
12482   application.Render( );
12483
12484   progressCheckAlpha.CheckSignalNotReceived();
12485   progressCheckBeta.CheckSignalNotReceived();
12486
12487   // Start the animations unlimited looping
12488   animationAlpha.SetLooping( true );
12489   animationBeta.SetLooping( true );
12490   animationAlpha.Play();
12491   animationBeta.Play();
12492
12493   application.SendNotification();
12494   application.Render(0); // start animation
12495   application.Render(durationSeconds*20.0f ); // 2% progress
12496   application.SendNotification();
12497   DALI_TEST_EQUALS( 0.02f, animationAlpha.GetCurrentProgress(), TEST_LOCATION );
12498
12499   tet_infoline( "Animation at 2% - Alpha signals should be received, Beta should not." );
12500
12501   progressCheckAlpha.CheckSignalReceived();
12502   progressCheckBeta.CheckSignalNotReceived();
12503
12504   tet_infoline( "Progress check reset" );
12505   progressCheckAlpha.Reset();
12506   progressCheckBeta.Reset();
12507
12508   application.SendNotification();
12509   application.Render(durationSeconds*960.0f ); // 98% progress
12510   application.SendNotification();
12511   tet_infoline( "Animation at 98% - No signal received" );
12512   DALI_TEST_EQUALS( 0.98f, animationAlpha.GetCurrentProgress(), TEST_LOCATION );
12513
12514   progressCheckAlpha.CheckSignalNotReceived();
12515   progressCheckBeta.CheckSignalNotReceived();
12516
12517   application.SendNotification();
12518   application.Render(durationSeconds*40.0f ); // 2% progress
12519   application.SendNotification();
12520   tet_infoline( "Animation loop once and now 2% - Alpha and Beta should receive signal" );
12521   application.SendNotification();
12522
12523   DALI_TEST_EQUALS( 0.02f, animationBeta.GetCurrentProgress(), TEST_LOCATION );
12524
12525   progressCheckAlpha.CheckSignalReceived();
12526   progressCheckBeta.CheckSignalReceived();
12527
12528   tet_infoline( "Progress check reset" );
12529   progressCheckAlpha.Reset();
12530   progressCheckBeta.Reset();
12531
12532   application.SendNotification();
12533   application.Render(durationSeconds*980.0f ); // 100% progress
12534   application.SendNotification();
12535   tet_infoline( "Animation loop one more time. and now 100% - Beta should receive signal, Alhpa sholud not" );
12536   application.SendNotification();
12537
12538   progressCheckAlpha.CheckSignalNotReceived();
12539   progressCheckBeta.CheckSignalReceived();
12540
12541   tet_infoline( "Progress check reset" );
12542   progressCheckAlpha.Reset();
12543   progressCheckBeta.Reset();
12544
12545   animationAlpha.SetLooping( false );
12546   animationBeta.SetLooping( false );
12547
12548   application.SendNotification();
12549   application.Render(static_cast<unsigned int>(durationSeconds*2000.0f) + 1u/*just beyond the animation duration*/);
12550   application.SendNotification();
12551
12552   // We did expect the animation to finish
12553   tet_infoline( "Animation finished" );
12554
12555   END_TEST;
12556 }
12557
12558 int UtcDaliAnimationProgressSignalWithPlayAfterP(void)
12559 {
12560   tet_infoline( "Multiple animations with different progress markers" );
12561
12562   TestApplication application;
12563
12564   Actor actor = Actor::New();
12565   Stage::GetCurrent().Add(actor);
12566
12567   // Build the animation
12568   Animation animationAlpha = Animation::New(0.0f);
12569   Animation animationBeta = Animation::New(0.0f);
12570
12571   //Set duration
12572   float durationSeconds(1.0f);
12573   float delaySeconds(0.5f);
12574   animationAlpha.SetDuration(durationSeconds);
12575   animationBeta.SetDuration(durationSeconds);
12576
12577   bool progressSignalReceivedAlpha(false);
12578   bool progressSignalReceivedBeta(false);
12579
12580   AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12581   AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta" );
12582
12583   DevelAnimation::ProgressReachedSignal( animationAlpha ).Connect( &application, progressCheckAlpha );
12584   DevelAnimation::ProgressReachedSignal( animationBeta ).Connect( &application, progressCheckBeta);
12585   application.SendNotification();
12586
12587   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12588   animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12589   animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12590
12591   tet_infoline( "AnimationAlpha Progress notification set to 30%" );
12592   DevelAnimation::SetProgressNotification( animationAlpha, 0.3f );
12593
12594   tet_infoline( "AnimationBeta Progress notification set to ~0% (==Notify when delay is done)" );
12595   DevelAnimation::SetProgressNotification( animationBeta, Math::MACHINE_EPSILON_1 );
12596
12597   application.SendNotification();
12598   application.Render( );
12599
12600   progressCheckAlpha.CheckSignalNotReceived();
12601   progressCheckBeta.CheckSignalNotReceived();
12602
12603   // Start the animations from 10% progress
12604   animationAlpha.PlayAfter(delaySeconds);
12605   animationBeta.PlayAfter(delaySeconds);
12606
12607   application.SendNotification();
12608   application.Render(0); // start animation
12609   application.Render(delaySeconds * 500.0f ); // 50% wait progress
12610
12611   tet_infoline( "Delay at 50% - No signals to be received" );
12612
12613   progressCheckAlpha.CheckSignalNotReceived();
12614   progressCheckBeta.CheckSignalNotReceived();
12615
12616   application.SendNotification();
12617   application.Render(delaySeconds * 500.0f + durationSeconds * 50.0f ); // 100% wait, 5% progress
12618   application.SendNotification();
12619   tet_infoline( "Delay at 100%, Animation at 5% - Beta signal should be received" );
12620   DALI_TEST_EQUALS( 0.05f, animationBeta.GetCurrentProgress(), TEST_LOCATION );
12621
12622   progressCheckBeta.CheckSignalReceived();
12623   progressCheckAlpha.CheckSignalNotReceived();
12624
12625   tet_infoline( "Progress check reset" );
12626   progressCheckAlpha.Reset();
12627   progressCheckBeta.Reset();
12628
12629   application.Render(durationSeconds * 200.0f ); // 25% progress
12630   tet_infoline( "Animation at 25% - No signals to be received" );
12631   application.SendNotification();
12632
12633   progressCheckAlpha.CheckSignalNotReceived();
12634   progressCheckBeta.CheckSignalNotReceived();
12635
12636   application.Render(durationSeconds * 200.0f ); // 45% progress
12637   tet_infoline( "Animation at 45% - Alpha should receive signal, Beta should not" );
12638   application.SendNotification();
12639
12640   DALI_TEST_EQUALS( 0.45f, animationAlpha.GetCurrentProgress(), TEST_LOCATION );
12641
12642   progressCheckAlpha.CheckSignalReceived();
12643   progressCheckBeta.CheckSignalNotReceived();
12644
12645   tet_infoline( "Progress check reset" );
12646   progressCheckAlpha.Reset();
12647   progressCheckBeta.Reset();
12648
12649   application.Render(static_cast<unsigned int>(durationSeconds*150.0f)/* 60% progress */);
12650   application.SendNotification();
12651
12652   tet_infoline( "Animation at 60%" );
12653
12654   progressCheckAlpha.CheckSignalNotReceived();
12655   progressCheckBeta.CheckSignalNotReceived();
12656
12657   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
12658   application.SendNotification();
12659   tet_infoline( "Animation at 80%" );
12660
12661   progressCheckAlpha.CheckSignalNotReceived();
12662   progressCheckBeta.CheckSignalNotReceived();
12663
12664   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
12665   // We did expect the animation to finish
12666   tet_infoline( "Animation finished" );
12667
12668   END_TEST;
12669 }
12670
12671 int UtcDaliAnimationProgressCallbackWithLoopingP(void)
12672 {
12673   TestApplication application;
12674
12675   Actor actor = Actor::New();
12676   Stage::GetCurrent().Add(actor);
12677
12678   // Build the animation
12679   Animation animation = Animation::New(0.0f);
12680
12681   //Set duration
12682   const float durationSeconds(1.0f);
12683   animation.SetDuration(durationSeconds);
12684
12685   // Set Looping Count
12686   const int loopCount( 4 );
12687   animation.SetLoopCount( loopCount );
12688
12689   bool finishedSignalReceived(false);
12690   bool progressSignalReceived(false);
12691
12692   AnimationFinishCheck finishCheck(finishedSignalReceived);
12693   animation.FinishedSignal().Connect(&application, finishCheck);
12694
12695   AnimationProgressCheck progressCheck(progressSignalReceived);
12696   DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
12697   application.SendNotification();
12698
12699   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12700   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12701
12702   tet_infoline( "Animation Progress notification set to 50% with looping count 4" );
12703   DevelAnimation::SetProgressNotification( animation, 0.5f );
12704
12705   application.SendNotification();
12706   application.Render( );
12707
12708   progressCheck.CheckSignalNotReceived();
12709
12710   animation.Play();
12711
12712   for(int count = 0; count < loopCount; count++)
12713   {
12714     application.SendNotification();
12715     application.Render(0); // start animation
12716     application.Render(durationSeconds*0.25*1000.0f ); // 25% progress
12717     DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
12718
12719     tet_infoline( "Animation at 25%" );
12720
12721     progressCheck.CheckSignalNotReceived();
12722
12723     application.SendNotification();
12724     application.Render(durationSeconds*0.25*1000.0f ); // 50% progress
12725     application.SendNotification();
12726     tet_infoline( "Animation at 50%" );
12727     DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
12728
12729     progressCheck.CheckSignalReceived();
12730
12731     tet_infoline( "Progress check reset" );
12732     progressCheck.Reset();
12733
12734     application.Render(durationSeconds*0.25*1000.0f ); // 75% progress
12735     tet_infoline( "Animation at 75%" );
12736     application.SendNotification();
12737
12738     DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
12739
12740     progressCheck.CheckSignalNotReceived();
12741
12742     application.Render(durationSeconds*0.25*1000.0f ); // 100% progress
12743     tet_infoline( "Animation at 100%" );
12744     application.SendNotification();
12745
12746     //Nothing check at 100% progress. cause It can be both 100% and 0%.
12747     application.SendNotification();
12748   }
12749   application.Render(10u);
12750   application.SendNotification();
12751   application.Render(0u);
12752   application.SendNotification();
12753
12754   finishCheck.CheckSignalReceived();
12755
12756   END_TEST;
12757 }
12758
12759 int UtcDaliAnimationProgressCallbackWithLoopingP2(void)
12760 {
12761   TestApplication application;
12762
12763   Actor actor = Actor::New();
12764   Stage::GetCurrent().Add(actor);
12765
12766   // Build the animation
12767   Animation animation = Animation::New(0.0f);
12768
12769   //Set duration
12770   const float durationSeconds(1.0f);
12771   animation.SetDuration(durationSeconds);
12772
12773   // Set Looping Unlmited
12774   animation.SetLooping( true );
12775
12776   bool finishedSignalReceived(false);
12777   bool progressSignalReceived(false);
12778
12779   AnimationFinishCheck finishCheck(finishedSignalReceived);
12780   animation.FinishedSignal().Connect(&application, finishCheck);
12781
12782   AnimationProgressCheck progressCheck(progressSignalReceived);
12783   DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
12784   application.SendNotification();
12785
12786   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12787   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12788
12789   tet_infoline( "Animation Progress notification set to 50% with unlimited looping" );
12790   DevelAnimation::SetProgressNotification( animation, 0.5f );
12791
12792   application.SendNotification();
12793   application.Render( );
12794
12795   progressCheck.CheckSignalNotReceived();
12796
12797   animation.Play();
12798
12799   for(int count = 0; count < 4; count++)
12800   {
12801     application.SendNotification();
12802     application.Render(0); // start animation
12803     application.Render(durationSeconds*0.25*1000.0f ); // 25% progress
12804     DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
12805
12806     tet_infoline( "Animation at 25%" );
12807
12808     progressCheck.CheckSignalNotReceived();
12809
12810     application.SendNotification();
12811     application.Render(durationSeconds*0.25*1000.0f ); // 50% progress
12812     application.SendNotification();
12813     tet_infoline( "Animation at 50%" );
12814     DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
12815
12816     progressCheck.CheckSignalReceived();
12817
12818     tet_infoline( "Progress check reset" );
12819     progressCheck.Reset();
12820
12821     application.Render(durationSeconds*0.25*1000.0f ); // 75% progress
12822     tet_infoline( "Animation at 75%" );
12823     application.SendNotification();
12824
12825     DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
12826
12827     progressCheck.CheckSignalNotReceived();
12828
12829     application.Render(durationSeconds*0.25*1000.0f ); // 100% progress
12830     tet_infoline( "Animation at 100%" );
12831     application.SendNotification();
12832
12833     //Nothing check at 100% progress. cause It can be both 100% and 0%.
12834     finishCheck.CheckSignalNotReceived();
12835     application.SendNotification();
12836   }
12837   finishCheck.CheckSignalNotReceived();
12838
12839   animation.SetLooping( false );
12840   application.Render(0u);
12841   application.SendNotification();
12842   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 10u);
12843   application.SendNotification();
12844   application.Render(0u);
12845   application.SendNotification();
12846
12847   finishCheck.CheckSignalReceived();
12848
12849   END_TEST;
12850 }
12851
12852 int UtcDaliAnimationProgressCallbackNegativeSpeed(void)
12853 {
12854   TestApplication application;
12855
12856   Actor actor = Actor::New();
12857   Stage::GetCurrent().Add(actor);
12858
12859   // Build the animation
12860   Animation animation = Animation::New(0.0f);
12861
12862   //Set duration
12863   const float durationSeconds(1.0f);
12864   animation.SetDuration(durationSeconds);
12865
12866   //Set speed negative
12867   animation.SetSpeedFactor( -1.0f );
12868
12869   // Set Looping Unlmited
12870   animation.SetLooping( true );
12871
12872   bool finishedSignalReceived(false);
12873   bool progressSignalReceived(false);
12874
12875   AnimationFinishCheck finishCheck(finishedSignalReceived);
12876   animation.FinishedSignal().Connect(&application, finishCheck);
12877
12878   AnimationProgressCheck progressCheck(progressSignalReceived);
12879   DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
12880   application.SendNotification();
12881
12882   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12883   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12884
12885   tet_infoline( "Animation Progress notification set to 50%" );
12886   DevelAnimation::SetProgressNotification( animation, 0.5f );
12887
12888   application.SendNotification();
12889   application.Render( );
12890
12891   progressCheck.CheckSignalNotReceived();
12892
12893   animation.Play();
12894
12895   for(int count = 0; count < 4; count++)
12896   {
12897     application.SendNotification();
12898     application.Render(0); // start animation
12899     progressCheck.CheckSignalNotReceived();
12900
12901     application.SendNotification();
12902     application.Render(durationSeconds*0.25*1000.0f ); // 25% progress
12903     DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
12904
12905     tet_infoline( "Animation at 25%" );
12906
12907     progressCheck.CheckSignalNotReceived();
12908
12909     application.SendNotification();
12910     application.Render(durationSeconds*0.25*1000.0f ); // 50% progress
12911     application.SendNotification();
12912     tet_infoline( "Animation at 50%" );
12913     DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
12914
12915     progressCheck.CheckSignalReceived();
12916
12917     tet_infoline( "Progress check reset" );
12918     progressCheck.Reset();
12919
12920     application.Render(durationSeconds*0.25*1000.0f ); // 75% progress
12921     tet_infoline( "Animation at 75%" );
12922     application.SendNotification();
12923
12924     DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
12925
12926     progressCheck.CheckSignalNotReceived();
12927
12928     application.Render(durationSeconds*0.25*1000.0f ); // 100% progress
12929     tet_infoline( "Animation at 100%" );
12930     application.SendNotification();
12931
12932     //Nothing check at 100% progress. cause It can be both 100% and 0%.
12933     finishCheck.CheckSignalNotReceived();
12934     application.SendNotification();
12935   }
12936   finishCheck.CheckSignalNotReceived();
12937
12938   animation.Stop();
12939   animation.SetLooping( false );
12940   animation.SetLoopCount( 4 );
12941   animation.Play();
12942   application.Render(0u);
12943   application.SendNotification();
12944
12945   for(int count = 0; count < 4; count++)
12946   {
12947     application.SendNotification();
12948     application.Render(0); // start animation
12949     progressCheck.CheckSignalNotReceived();
12950
12951     application.SendNotification();
12952     application.Render(durationSeconds*0.25*1000.0f ); // 25% progress
12953     DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
12954
12955     tet_infoline( "Animation at 25%" );
12956
12957     progressCheck.CheckSignalNotReceived();
12958
12959     application.SendNotification();
12960     application.Render(durationSeconds*0.25*1000.0f ); // 50% progress
12961     application.SendNotification();
12962     tet_infoline( "Animation at 50%" );
12963     DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
12964
12965     progressCheck.CheckSignalReceived();
12966
12967     tet_infoline( "Progress check reset" );
12968     progressCheck.Reset();
12969
12970     application.Render(durationSeconds*0.25*1000.0f ); // 75% progress
12971     tet_infoline( "Animation at 75%" );
12972     application.SendNotification();
12973
12974     DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
12975
12976     progressCheck.CheckSignalNotReceived();
12977
12978     application.Render(durationSeconds*0.25*1000.0f ); // 100% progress
12979     tet_infoline( "Animation at 100%" );
12980     application.SendNotification();
12981
12982     //Nothing check at 100% progress. cause It can be both 100% and 0%.
12983     application.SendNotification();
12984   }
12985   application.Render(10u);
12986   application.SendNotification();
12987   application.Render(0u);
12988   application.SendNotification();
12989
12990   finishCheck.CheckSignalReceived();
12991
12992   END_TEST;
12993 }
12994
12995 int UtcDaliAnimationProgressCallbackInvalidSignalN(void)
12996 {
12997   TestApplication application;
12998
12999   Actor actor = Actor::New();
13000   Stage::GetCurrent().Add(actor);
13001
13002   // Build the animation
13003   Animation animation = Animation::New(0.0f);
13004
13005   //Set duration
13006   const float durationSeconds(1.0f);
13007   animation.SetDuration(durationSeconds);
13008
13009   bool finishedSignalReceived(false);
13010   bool progressSignalReceived(false);
13011
13012   AnimationFinishCheck finishCheck(finishedSignalReceived);
13013   animation.FinishedSignal().Connect(&application, finishCheck);
13014
13015   AnimationProgressCheck progressCheck(progressSignalReceived);
13016   DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
13017   application.SendNotification();
13018
13019   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13020   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13021
13022   tet_infoline( "Animation Progress PlayRange as 10% ~ 90%" );
13023   animation.SetPlayRange( Vector2( 0.1f, 0.9f ) );
13024
13025   tet_infoline( "Animation Progress notification set to >90% that never can notificated" );
13026   DevelAnimation::SetProgressNotification( animation, 0.9f + Math::MACHINE_EPSILON_1 );
13027
13028   application.SendNotification();
13029   application.Render( );
13030
13031   progressCheck.CheckSignalNotReceived();
13032
13033   animation.Play();
13034
13035   application.SendNotification();
13036   application.Render(0); // start animation
13037   application.Render(durationSeconds*0.25*1000.0f ); // 35% progress
13038   DALI_TEST_EQUALS( 0.35f, animation.GetCurrentProgress(), TEST_LOCATION );
13039
13040   tet_infoline( "Animation at 35%" );
13041
13042   progressCheck.CheckSignalNotReceived();
13043
13044   application.SendNotification();
13045   application.Render(durationSeconds*0.25*1000.0f ); // 60% progress
13046   application.SendNotification();
13047   DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
13048
13049   tet_infoline( "Animation at 60%" );
13050
13051   progressCheck.CheckSignalNotReceived();
13052
13053   application.Render(durationSeconds*0.25*1000.0f ); // 85% progress
13054   tet_infoline( "Animation at 85%" );
13055   application.SendNotification();
13056   DALI_TEST_EQUALS( 0.85f, animation.GetCurrentProgress(), TEST_LOCATION );
13057
13058   progressCheck.CheckSignalNotReceived();
13059
13060   application.Render(durationSeconds*0.25*1000.0f ); // 90% progress
13061   tet_infoline( "Animation over 90%" );
13062   application.SendNotification();
13063
13064   // progress never signaled because playrange is 90%
13065   progressCheck.CheckSignalNotReceived();
13066
13067   END_TEST;
13068 }
13069
13070 int UtcDaliAnimationProgressCallbackLongDurationP(void)
13071 {
13072   TestApplication application;
13073
13074   Actor actor = Actor::New();
13075   Stage::GetCurrent().Add(actor);
13076
13077   // Build the animation
13078   Animation animation = Animation::New(0.0f);
13079
13080   //Set duration
13081   float durationSeconds(5.0f);
13082   animation.SetDuration(durationSeconds);
13083
13084   bool finishedSignalReceived(false);
13085   bool progressSignalReceived(false);
13086
13087   AnimationFinishCheck finishCheck(finishedSignalReceived);
13088   animation.FinishedSignal().Connect(&application, finishCheck);
13089
13090   AnimationProgressCheck progressCheck(progressSignalReceived);
13091   DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
13092   application.SendNotification();
13093
13094   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13095   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13096
13097   tet_infoline( "Animation Progress notification set to 50%" );
13098   DevelAnimation::SetProgressNotification( animation, 0.5f );
13099
13100   application.SendNotification();
13101   application.Render( );
13102
13103   progressCheck.CheckSignalNotReceived();
13104
13105   animation.Play();
13106
13107   application.SendNotification();
13108   application.Render(0); // start animation
13109   application.Render(durationSeconds*0.25*1000.0f ); // 25% progress
13110   DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
13111
13112   tet_infoline( "Animation at 25%" );
13113
13114   progressCheck.CheckSignalNotReceived();
13115
13116   application.SendNotification();
13117   application.Render(durationSeconds*0.25*1000.0f ); // 50% progress
13118   application.SendNotification();
13119   tet_infoline( "Animation at 50%" );
13120   DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
13121
13122   progressCheck.CheckSignalReceived();
13123
13124   tet_infoline( "Progress check reset" );
13125   progressCheck.Reset();
13126
13127   application.Render(durationSeconds*0.25*1000.0f ); // 75% progress
13128   tet_infoline( "Animation at 75%" );
13129   application.SendNotification();
13130
13131   DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
13132
13133   progressCheck.CheckSignalNotReceived();
13134
13135   END_TEST;
13136 }
13137
13138 int UtcDaliAnimationAnimateByInvalidParameters(void)
13139 {
13140   TestApplication application;
13141
13142   Actor actor = Actor::New();
13143   Stage::GetCurrent().Add(actor);
13144
13145   // Create the animation
13146   Animation animation = Animation::New(1.0f);
13147
13148   DALI_TEST_ASSERTION(
13149   {
13150     // non animateable property (STRING)
13151     animation.AnimateBy( Property( actor, Actor::Property::LAYOUT_DIRECTION ), Property::Value( "new direction" ) );
13152   }, "Property type is not animatable" );
13153
13154   DALI_TEST_ASSERTION(
13155   {
13156     // non animateable property (MATRIX)
13157     Property::Index index = actor.RegisterProperty( "Foobar", Property::Value( Dali::Matrix() ), Property::ANIMATABLE );
13158     animation.AnimateBy( Property( actor, index ), Property::Value( Property::MATRIX ) );
13159   }, "Property type is not animatable" );
13160
13161   // AnimateBy
13162   DALI_TEST_ASSERTION(
13163   {
13164     // non animateable target (NONE)
13165     animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value() );
13166   }, "Target value is not animatable" );
13167
13168   DALI_TEST_ASSERTION(
13169   {
13170     // non animateable target (STRING)
13171     animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value("foo") );
13172   }, "Target value is not animatable" );
13173
13174   DALI_TEST_ASSERTION(
13175   {
13176     // not mathing properties (VECTOR3, FLOAT)
13177     animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value( 10.f ) );
13178   }, "Property and target types don't match" );
13179
13180   DALI_TEST_ASSERTION(
13181   {
13182     // not mathing properties (VECTOR3.A, VECTOR2)
13183     animation.AnimateBy( Property( actor, Actor::Property::COLOR_ALPHA ), Property::Value( Property::VECTOR2 ) );
13184   }, "Property and target types don't match" );
13185
13186   DALI_TEST_ASSERTION(
13187   {
13188     // negative duration
13189     animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value( Vector3(1,2,3) ), TimePeriod(-1) );
13190   }, "Duration must be >=0" );
13191
13192   END_TEST;
13193 }
13194
13195 int UtcDaliAnimationAnimateToInvalidParameters(void)
13196 {
13197   TestApplication application;
13198
13199   Actor actor = Actor::New();
13200   Stage::GetCurrent().Add(actor);
13201
13202   // Create the animation
13203   Animation animation = Animation::New(1.0f);
13204
13205   // AnimateTo
13206   DALI_TEST_ASSERTION(
13207   {
13208     // non animateable property (MAP)
13209     Property::Index index = actor.RegisterProperty( "Foobar", Property::Value( Property::MAP ), Property::ANIMATABLE );
13210     animation.AnimateTo( Property( actor, index ), Property::Value( Property::MAP ) );
13211   }, "Property type is not animatable" );
13212
13213   DALI_TEST_ASSERTION(
13214   {
13215     // non animateable target (NONE)
13216     animation.AnimateTo( Property( actor, Actor::Property::CLIPPING_MODE ), Property::Value() );
13217   }, "Property type is not animatable" );
13218
13219   DALI_TEST_ASSERTION(
13220   {
13221     // non animateable target (ARRAY)
13222     animation.AnimateTo( Property( actor, Actor::Property::POSITION ), Property::Value( Property::ARRAY ) );
13223   }, "Target value is not animatable" );
13224
13225   DALI_TEST_ASSERTION(
13226   {
13227     // non animateable target (RECTANGLE)
13228     animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value( Rect<int32_t>() ) );
13229   }, "Target value is not animatable" );
13230
13231   DALI_TEST_ASSERTION(
13232   {
13233     // not mathing properties (FLOAT, INT)
13234     animation.AnimateTo( Property( actor, Actor::Property::SCALE_Y ), Property::Value(10) );
13235   }, "Property and target types don't match" );
13236
13237   DALI_TEST_ASSERTION(
13238   {
13239     // not mathing properties (VECTOR3, VECTOR2)
13240     animation.AnimateTo( Property( actor, Actor::Property::COLOR ), Property::Value( Property::VECTOR2 ) );
13241   }, "Property and target types don't match" );
13242
13243   DALI_TEST_ASSERTION(
13244   {
13245     // negative duration
13246     animation.AnimateTo( Property( actor, Actor::Property::POSITION ), Property::Value( Vector3(1,2,3) ), TimePeriod(-1) );
13247   }, "Duration must be >=0" );
13248
13249   END_TEST;
13250 }
13251
13252 int UtcDaliAnimationAnimateBetweenInvalidParameters(void)
13253 {
13254   TestApplication application;
13255
13256   Actor actor = Actor::New();
13257   Stage::GetCurrent().Add(actor);
13258
13259   // Create the animation
13260   Animation animation = Animation::New(1.0f);
13261
13262   // AnimateBetween
13263   DALI_TEST_ASSERTION(
13264   {
13265     // non animateable property (ARRAY)
13266     Property::Index index = actor.RegisterProperty( "Foobar", Property::Value( Property::ARRAY ), Property::ANIMATABLE );
13267     KeyFrames keyframes = KeyFrames::New();
13268     keyframes.Add( 0.5f, Property::Value( Property::ARRAY ) );
13269     animation.AnimateBetween( Property( actor, index ), keyframes );
13270   }, "Property type is not animatable" );
13271
13272   DALI_TEST_ASSERTION(
13273   {
13274     // non animateable target (NONE)
13275     KeyFrames keyframes = KeyFrames::New();
13276     keyframes.Add( 0.5f, Property::Value() );
13277     animation.AnimateBetween( Property( actor, Actor::Property::CLIPPING_MODE ), keyframes );
13278   }, "Property type is not animatable" );
13279
13280   DALI_TEST_ASSERTION(
13281   {
13282     // non animateable target (EXTENTS)
13283     KeyFrames keyframes = KeyFrames::New();
13284     keyframes.Add( 0.5f, Property::Value( Property::EXTENTS ) ); // throws
13285     animation.AnimateBetween( Property( actor, Actor::Property::POSITION ), keyframes );
13286   }, "Property type is not animatable" );
13287
13288   DALI_TEST_ASSERTION(
13289   {
13290     // non animateable target (RECTANGLE)
13291     KeyFrames keyframes = KeyFrames::New();
13292     keyframes.Add( 0.5f, Property::Value( Property::MAP ) ); // throws
13293     animation.AnimateBetween( Property( actor, Actor::Property::POSITION ), keyframes );
13294   }, "Property type is not animatable" );
13295
13296   DALI_TEST_ASSERTION(
13297   {
13298     // not mathing properties (VECTOR2, VECTOR4)
13299     KeyFrames keyframes = KeyFrames::New();
13300     keyframes.Add( 0.5f, Property::Value( Vector4( 1, 2, 3, 4 ) ) );
13301     animation.AnimateBetween( Property( actor, Actor::Property::MAXIMUM_SIZE ), keyframes );
13302   }, "Property and target types don't match" );
13303
13304   DALI_TEST_ASSERTION(
13305   {
13306     // negative duration
13307     KeyFrames keyframes = KeyFrames::New();
13308     keyframes.Add( 0.5f, Property::Value(Vector3( 1, 2, 3 ) ) );
13309     animation.AnimateBetween( Property( actor, Actor::Property::POSITION ), keyframes, TimePeriod(-1) );
13310   }, "Duration must be >=0" );
13311
13312   END_TEST;
13313 }