Ensure cached values of properties animated using AnimateTo are updated
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-Animation.cpp
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 #include <iostream>
19 #include <algorithm>
20
21 #include <stdlib.h>
22 #include <dali/public-api/dali-core.h>
23 #include <dali/devel-api/actors/actor-devel.h>
24 #include <dali/devel-api/object/handle-devel.h>
25 #include <dali-test-suite-utils.h>
26
27 using std::max;
28 using namespace Dali;
29
30 void utc_dali_animation_startuP(void)
31 {
32   test_return_value = TET_UNDEF;
33 }
34
35 void utc_dali_animation_cleanuP(void)
36 {
37   test_return_value = TET_PASS;
38 }
39
40 namespace
41 {
42
43 static const float ROTATION_EPSILON = 0.0001f;
44 static const float VECTOR4_EPSILON = 0.0001f;
45
46 // Functor to test whether a Finish signal is emitted
47 struct AnimationFinishCheck
48 {
49   AnimationFinishCheck(bool& signalReceived)
50   : mSignalReceived(signalReceived)
51   {
52   }
53
54   void operator()(Animation& animation)
55   {
56     mSignalReceived = true;
57   }
58
59   void Reset()
60   {
61     mSignalReceived = false;
62   }
63
64   void CheckSignalReceived()
65   {
66     if (!mSignalReceived)
67     {
68       tet_printf("Expected Finish signal was not received\n");
69       tet_result(TET_FAIL);
70     }
71     else
72     {
73       tet_result(TET_PASS);
74     }
75   }
76
77   void CheckSignalNotReceived()
78   {
79     if (mSignalReceived)
80     {
81       tet_printf("Unexpected Finish signal was received\n");
82       tet_result(TET_FAIL);
83     }
84     else
85     {
86       tet_result(TET_PASS);
87     }
88   }
89
90   bool& mSignalReceived; // owned by individual tests
91 };
92
93 } // anon namespace
94
95 int UtcDaliAnimationConstructorP(void)
96 {
97   TestApplication application;
98
99   Animation animation;
100
101   DALI_TEST_CHECK( !animation );
102   END_TEST;
103 }
104
105 int UtcDaliAnimationNewP(void)
106 {
107   TestApplication application;
108
109   Animation animation = Animation::New( 1.0f );
110
111   DALI_TEST_CHECK(animation);
112   END_TEST;
113 }
114
115 int UtcDaliAnimationNewN(void)
116 {
117   TestApplication application;
118
119   Animation animation = Animation::New( -1.0f );
120
121   DALI_TEST_CHECK(animation);
122   DALI_TEST_EQUALS(animation.GetDuration(), 0.0f, TEST_LOCATION);
123   END_TEST;
124 }
125
126 int UtcDaliAnimationDownCastP(void)
127 {
128   TestApplication application;
129
130   tet_infoline("Testing Dali::Animation::DownCast()");
131
132   float durationSeconds(1.0f);
133   Animation animation = Animation::New(durationSeconds);
134
135   BaseHandle object(animation);
136
137   Animation animation2 = Animation::DownCast(object);
138   DALI_TEST_CHECK(animation2);
139
140   Animation animation3 = DownCast< Animation >(object);
141   DALI_TEST_CHECK(animation3);
142   END_TEST;
143 }
144
145 int UtcDaliAnimationDownCastN(void)
146 {
147   TestApplication application;
148
149   BaseHandle unInitializedObject;
150
151   Animation animation1 = Animation::DownCast( unInitializedObject );
152   DALI_TEST_CHECK( !animation1 );
153
154   Animation animation2 = DownCast< Animation >( unInitializedObject );
155   DALI_TEST_CHECK( !animation2 );
156   END_TEST;
157 }
158
159 int UtcDaliAnimationCopyConstructorP(void)
160 {
161   TestApplication application;
162
163   // Initialize an object, ref count == 1
164   Animation animation = Animation::New( 1.0f );
165
166   Animation copy( animation );
167   DALI_TEST_CHECK( copy );
168
169   DALI_TEST_CHECK( copy.GetDuration() == animation.GetDuration() );
170   END_TEST;
171 }
172
173 int UtcDaliAnimationAssignmentOperatorP(void)
174 {
175   TestApplication application;
176
177   Animation animation = Animation::New( 1.0f );
178
179   Animation copy = animation;
180   DALI_TEST_CHECK( copy );
181
182   DALI_TEST_CHECK( animation == copy );
183
184   DALI_TEST_CHECK( copy.GetDuration() == animation.GetDuration() );
185   END_TEST;
186 }
187
188 int UtcDaliAnimationSetDurationP(void)
189 {
190   TestApplication application;
191
192   Actor actor = Actor::New();
193   Stage::GetCurrent().Add(actor);
194
195   // Build the animation
196   float durationSeconds(1.0f);
197   Animation animation = Animation::New(durationSeconds);
198   DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
199
200   // Start the animation
201   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
202   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
203   animation.Play();
204
205   bool signalReceived(false);
206   AnimationFinishCheck finishCheck(signalReceived);
207   animation.FinishedSignal().Connect(&application, finishCheck);
208
209   application.SendNotification();
210   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
211
212   // We didn't expect the animation to finish yet
213   application.SendNotification();
214   finishCheck.CheckSignalNotReceived();
215
216   application.Render(2u/*just beyond the animation duration*/);
217
218   // We did expect the animation to finish
219   application.SendNotification();
220   finishCheck.CheckSignalReceived();
221   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
222
223   // Restart the animation, with a different duration
224   finishCheck.Reset();
225   actor.SetPosition(Vector3::ZERO);
226   durationSeconds = 3.5f;
227   animation.SetDuration(durationSeconds);
228   DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
229   animation.Play();
230
231   application.SendNotification();
232   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
233
234   // We didn't expect the animation to finish yet
235   application.SendNotification();
236   finishCheck.CheckSignalNotReceived();
237
238   application.Render(2u/*just beyond the animation duration*/);
239
240   // We did expect the animation to finish
241   application.SendNotification();
242   finishCheck.CheckSignalReceived();
243   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
244
245   // Check that nothing has changed after a couple of buffer swaps
246   application.Render(0);
247   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
248   application.Render(0);
249   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
250   END_TEST;
251 }
252
253 int UtcDaliAnimationSetDurationN(void)
254 {
255   TestApplication application;
256
257   Animation animation = Animation::New( 1.0f );
258   DALI_TEST_EQUALS( animation.GetDuration(), 1.0f, TEST_LOCATION );
259
260   animation.SetDuration( -1.0f );
261   DALI_TEST_EQUALS( animation.GetDuration(), 0.0f, TEST_LOCATION );
262   END_TEST;
263 }
264
265 int UtcDaliAnimationGetDurationP(void)
266 {
267   TestApplication application;
268
269   Animation animation = Animation::New(1.0f);
270   DALI_TEST_EQUALS(animation.GetDuration(), 1.0f, TEST_LOCATION);
271
272   animation.SetDuration(2.0f);
273   DALI_TEST_EQUALS(animation.GetDuration(), 2.0f, TEST_LOCATION);
274   END_TEST;
275 }
276
277 int UtcDaliAnimationSetLoopingP(void)
278 {
279   TestApplication application;
280
281   Actor actor = Actor::New();
282   Stage::GetCurrent().Add(actor);
283
284   // Build the animation
285   float durationSeconds(1.0f);
286   Animation animation = Animation::New(durationSeconds);
287   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
288   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
289
290   // Start the animation
291   animation.SetLooping(true);
292   DALI_TEST_CHECK(animation.IsLooping());
293   animation.Play();
294
295   bool signalReceived(false);
296   AnimationFinishCheck finishCheck(signalReceived);
297   animation.FinishedSignal().Connect(&application, finishCheck);
298
299   application.SendNotification();
300
301   // Loop 5 times
302   float intervalSeconds = 0.25f;
303   float progress = 0.0f;
304   for (int iterations = 0; iterations < 5;)
305   {
306     application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
307
308     progress += intervalSeconds;
309     DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
310
311     if (progress >= 1.0f)
312     {
313       progress = progress - 1.0f;
314       ++iterations;
315     }
316   }
317
318   // We didn't expect the animation to finish yet
319   application.SendNotification();
320   finishCheck.CheckSignalNotReceived();
321
322   animation.SetLooping(false);
323   DALI_TEST_CHECK(!animation.IsLooping());
324
325   application.SendNotification();
326   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
327
328   // We did expect the animation to finish
329   application.SendNotification();
330   finishCheck.CheckSignalReceived();
331   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
332
333   // Check that nothing has changed after a couple of buffer swaps
334   application.Render(0);
335   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
336   application.Render(0);
337   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
338   END_TEST;
339 }
340
341 int UtcDaliAnimationSetLoopCountP(void)
342 {
343   TestApplication application;
344
345   Actor actor = Actor::New();
346   Stage::GetCurrent().Add(actor);
347
348   // Build the animation
349   float durationSeconds(1.0f);
350   Animation animation = Animation::New(durationSeconds);
351   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
352   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
353
354   // Start the animation
355   animation.SetLoopCount(3);
356   DALI_TEST_CHECK(animation.IsLooping());
357   animation.Play();
358
359   bool signalReceived(false);
360   AnimationFinishCheck finishCheck(signalReceived);
361   animation.FinishedSignal().Connect(&application, finishCheck);
362
363   application.Render(0);
364   application.SendNotification();
365   application.Render(0);
366   application.SendNotification();
367   application.Render(0);
368   application.SendNotification();
369   application.Render(0);
370   application.SendNotification();
371
372   // Loop
373   float intervalSeconds = 3.0f;
374
375   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
376   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
377
378   application.Render(0);
379   application.SendNotification();
380   application.Render(0);
381   application.SendNotification();
382   application.Render(0);
383   application.SendNotification();
384   application.Render(0);
385   application.SendNotification();
386   finishCheck.CheckSignalNotReceived();
387
388   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
389
390   application.SendNotification();
391   finishCheck.CheckSignalReceived();
392   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
393
394   finishCheck.Reset();
395
396   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
397   application.SendNotification();
398   finishCheck.CheckSignalNotReceived();
399
400   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
401   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
402   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
403   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
404   application.SendNotification();
405   finishCheck.CheckSignalNotReceived();
406
407   END_TEST;
408 }
409
410 int UtcDaliAnimationSetLoopCountP2(void)
411 {
412   TestApplication application;
413
414   //
415   // switching between forever and loop count
416   //
417
418   Actor actor = Actor::New();
419   Stage::GetCurrent().Add(actor);
420
421   // Build the animation
422   float durationSeconds(1.0f);
423   Animation animation = Animation::New(durationSeconds);
424   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
425   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
426   animation.SetEndAction(Animation::Discard);
427
428   // Start the animation
429   animation.SetLoopCount(3);
430   DALI_TEST_CHECK(animation.IsLooping());
431   animation.Play();
432
433   bool signalReceived(false);
434   AnimationFinishCheck finishCheck(signalReceived);
435   animation.FinishedSignal().Connect(&application, finishCheck);
436
437   float intervalSeconds = 3.0f;
438
439   application.SendNotification();
440   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
441   application.SendNotification();
442   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
443   application.SendNotification();
444   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
445   application.SendNotification();
446
447   application.SendNotification();
448   finishCheck.CheckSignalReceived();
449
450   finishCheck.Reset();
451
452   // Loop forever
453   animation.SetLooping(true);
454   DALI_TEST_CHECK(animation.IsLooping());
455
456   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
457   application.SendNotification();
458   finishCheck.CheckSignalNotReceived();
459
460   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
461   application.SendNotification();
462   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
463   application.SendNotification();
464   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
465   application.SendNotification();
466   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
467   application.SendNotification();
468   application.SendNotification();
469   finishCheck.CheckSignalNotReceived();
470
471   finishCheck.Reset();
472
473   // Loop N again
474   animation.SetLoopCount(3);
475   DALI_TEST_CHECK(animation.IsLooping());
476   animation.Play();
477
478   application.SendNotification();
479   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
480   application.SendNotification();
481   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
482   application.SendNotification();
483   finishCheck.CheckSignalNotReceived();
484
485   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
486   application.SendNotification();
487   finishCheck.CheckSignalReceived();
488
489   finishCheck.Reset();
490
491   // loop forever
492   animation.SetLooping(true);
493   DALI_TEST_CHECK(animation.IsLooping());
494
495   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
496   application.SendNotification();
497   finishCheck.CheckSignalNotReceived();
498
499   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
500   application.SendNotification();
501   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
502   application.SendNotification();
503   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
504   application.SendNotification();
505   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
506   application.SendNotification();
507   finishCheck.CheckSignalNotReceived();
508
509   finishCheck.Reset();
510
511   // Loop N again
512   animation.SetLoopCount(3);
513   DALI_TEST_CHECK(animation.IsLooping());
514
515   application.SendNotification();
516   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
517   application.SendNotification();
518   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
519   application.SendNotification();
520   finishCheck.CheckSignalNotReceived();
521
522   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
523   application.SendNotification();
524   finishCheck.CheckSignalNotReceived(); // we never hit play
525
526   finishCheck.Reset();
527
528
529   END_TEST;
530 }
531
532 int UtcDaliAnimationSetLoopCountP3(void)
533 {
534   TestApplication application;
535
536   //
537   // switching between forever and loop count
538   //
539   Actor actor = Actor::New();
540   Stage::GetCurrent().Add(actor);
541
542   // Build the animation
543   float durationSeconds(1.0f);
544   Animation animation = Animation::New(durationSeconds);
545   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
546   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
547   animation.SetEndAction(Animation::Discard);
548
549   float intervalSeconds = 3.0f;
550
551   bool signalReceived(false);
552   AnimationFinishCheck finishCheck(signalReceived);
553   animation.FinishedSignal().Connect(&application, finishCheck);
554
555   // loop forever
556   animation.SetLooping(true);
557   DALI_TEST_CHECK(animation.IsLooping());
558
559   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
560   application.SendNotification();
561   finishCheck.CheckSignalNotReceived();
562
563   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
564   application.SendNotification();
565   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
566   application.SendNotification();
567   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
568   application.SendNotification();
569   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
570   application.SendNotification();
571   finishCheck.CheckSignalNotReceived();
572
573   finishCheck.Reset();
574
575   // Loop N again
576   animation.SetLoopCount(3);
577   DALI_TEST_CHECK(animation.IsLooping());
578
579   application.SendNotification();
580   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
581   application.SendNotification();
582   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
583   application.SendNotification();
584   finishCheck.CheckSignalNotReceived();
585
586   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
587   application.SendNotification();
588   finishCheck.CheckSignalNotReceived(); // we never hit play
589
590   finishCheck.Reset();
591
592
593   END_TEST;
594 }
595
596 int UtcDaliAnimationSetLoopCountP4(void)
597 {
598   TestApplication application;
599
600   //
601   // ..and play again
602   //
603   Actor actor = Actor::New();
604   Stage::GetCurrent().Add(actor);
605
606   // Build the animation
607   float durationSeconds(1.0f);
608   Animation animation = Animation::New(durationSeconds);
609   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
610   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
611   animation.SetEndAction(Animation::Bake);
612
613   float intervalSeconds = 3.0f;
614
615   bool signalReceived(false);
616   AnimationFinishCheck finishCheck(signalReceived);
617   animation.FinishedSignal().Connect(&application, finishCheck);
618
619   animation.SetLoopCount(1);
620   animation.Play();
621   DALI_TEST_CHECK(!animation.IsLooping());
622
623   application.SendNotification();
624   finishCheck.CheckSignalNotReceived();
625   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
626   application.SendNotification();
627   finishCheck.CheckSignalReceived();
628
629   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
630   actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f) );
631
632   finishCheck.Reset();
633
634   animation.Play(); // again
635   DALI_TEST_CHECK(!animation.IsLooping());
636
637   application.SendNotification();
638   finishCheck.CheckSignalNotReceived();
639   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
640   application.SendNotification();
641   finishCheck.CheckSignalReceived();
642
643   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
644
645   END_TEST;
646 }
647
648 int UtcDaliAnimationGetLoopCountP(void)
649 {
650   TestApplication application;
651
652   Actor actor = Actor::New();
653   Stage::GetCurrent().Add(actor);
654
655   // Build the animation
656   float durationSeconds(1.0f);
657   Animation animation = Animation::New(durationSeconds);
658   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
659   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
660
661   DALI_TEST_CHECK(1 == animation.GetLoopCount());
662
663   // Start the animation
664   animation.SetLoopCount(3);
665   DALI_TEST_CHECK(animation.IsLooping());
666   DALI_TEST_CHECK(3 == animation.GetLoopCount());
667
668   animation.Play();
669
670   application.Render(0);
671   application.SendNotification();
672
673   // Loop
674   float intervalSeconds = 3.0f;
675
676   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
677   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
678
679   application.Render(0);
680   application.SendNotification();
681
682   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
683   application.SendNotification();
684
685   animation.SetLoopCount(0);
686   DALI_TEST_CHECK(animation.IsLooping());
687   DALI_TEST_CHECK(0 == animation.GetLoopCount());
688
689   animation.SetLoopCount(1);
690   DALI_TEST_CHECK(!animation.IsLooping());
691   DALI_TEST_CHECK(1 == animation.GetLoopCount());
692
693   END_TEST;
694 }
695
696
697 int UtcDaliAnimationGetCurrentLoopP(void)
698 {
699   TestApplication application;
700
701   Actor actor = Actor::New();
702   Stage::GetCurrent().Add(actor);
703
704   // Build the animation
705   float durationSeconds(1.0f);
706   Animation animation = Animation::New(durationSeconds);
707   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
708   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
709
710   // Start the animation
711   animation.SetLoopCount(3);
712   DALI_TEST_CHECK(animation.IsLooping());
713   DALI_TEST_CHECK(0 == animation.GetCurrentLoop());
714   animation.Play();
715
716   bool signalReceived(false);
717   AnimationFinishCheck finishCheck(signalReceived);
718   animation.FinishedSignal().Connect(&application, finishCheck);
719
720   application.SendNotification();
721
722   // Loop
723   float intervalSeconds = 3.0f;
724
725   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
726   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
727
728   application.SendNotification();
729   finishCheck.CheckSignalNotReceived();
730   DALI_TEST_CHECK(2 == animation.GetCurrentLoop());
731
732   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
733
734   application.SendNotification();
735   finishCheck.CheckSignalReceived();
736   DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
737   DALI_TEST_CHECK(animation.GetLoopCount() == animation.GetCurrentLoop());
738
739   finishCheck.Reset();
740
741   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
742   application.SendNotification();
743   finishCheck.CheckSignalNotReceived();
744   DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
745
746   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
747   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
748   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
749   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
750   application.SendNotification();
751   finishCheck.CheckSignalNotReceived();
752   DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
753
754   END_TEST;
755 }
756
757 int UtcDaliAnimationIsLoopingP(void)
758 {
759   TestApplication application;
760
761   Animation animation = Animation::New(1.0f);
762   DALI_TEST_CHECK(!animation.IsLooping());
763
764   animation.SetLooping(true);
765   DALI_TEST_CHECK(animation.IsLooping());
766   END_TEST;
767 }
768
769 int UtcDaliAnimationSetEndActioN(void)
770 {
771   TestApplication application;
772
773   Actor actor = Actor::New();
774   Stage::GetCurrent().Add(actor);
775
776   // Build the animation
777   float durationSeconds(1.0f);
778   Animation animation = Animation::New(durationSeconds);
779   DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
780
781   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
782   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
783
784   // Start the animation
785   animation.Play();
786
787   bool signalReceived(false);
788   AnimationFinishCheck finishCheck(signalReceived);
789   animation.FinishedSignal().Connect(&application, finishCheck);
790
791   application.SendNotification();
792   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
793
794   // We did expect the animation to finish
795   application.SendNotification();
796   finishCheck.CheckSignalReceived();
797   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
798
799   // Go back to the start
800   actor.SetPosition(Vector3::ZERO);
801   application.SendNotification();
802   application.Render(0);
803   DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
804
805   // Test BakeFinal, animate again, for half the duration
806   finishCheck.Reset();
807   animation.SetEndAction(Animation::BakeFinal);
808   DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
809   animation.Play();
810
811   application.SendNotification();
812   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f*0.5f) /*half of the animation duration*/);
813
814   // Stop the animation early
815   animation.Stop();
816
817   // We did NOT expect the animation to finish
818   application.SendNotification();
819   finishCheck.CheckSignalNotReceived();
820   DALI_TEST_EQUALS( targetPosition * 0.5f, actor.GetCurrentPosition(), VECTOR4_EPSILON, TEST_LOCATION );
821
822   // The position should be same with target position in the next frame
823   application.Render(0);
824   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
825
826   // Go back to the start
827   actor.SetPosition(Vector3::ZERO);
828   application.SendNotification();
829   application.Render(0);
830   DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
831
832   // Test EndAction::Discard, animate again, but don't bake this time
833   finishCheck.Reset();
834   animation.SetEndAction(Animation::Discard);
835   DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
836   animation.Play();
837
838   application.SendNotification();
839   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
840
841   // We did expect the animation to finish
842   application.SendNotification();
843   finishCheck.CheckSignalReceived();
844   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
845
846   // The position should be discarded in the next frame
847   application.Render(0);
848   DALI_TEST_EQUALS( Vector3::ZERO/*discarded*/, actor.GetCurrentPosition(), TEST_LOCATION );
849
850   // Check that nothing has changed after a couple of buffer swaps
851   application.Render(0);
852   DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
853   application.Render(0);
854   DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
855   END_TEST;
856 }
857
858 int UtcDaliAnimationGetEndActionP(void)
859 {
860   TestApplication application;
861
862   Animation animation = Animation::New(1.0f);
863   DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
864
865   animation.SetEndAction(Animation::Discard);
866   DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
867
868   animation.SetEndAction(Animation::BakeFinal);
869   DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
870
871   END_TEST;
872 }
873
874 int UtcDaliAnimationSetDisconnectActionP(void)
875 {
876   TestApplication application;
877   Stage stage( Stage::GetCurrent() );
878
879   // Default: BakeFinal
880   {
881     Actor actor = Actor::New();
882     stage.Add(actor);
883
884     // Build the animation
885     float durationSeconds(1.0f);
886     Animation animation = Animation::New(durationSeconds);
887     DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal);
888
889     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
890     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
891
892     // Start the animation
893     animation.Play();
894
895     application.SendNotification();
896     application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
897
898     actor.Unparent();
899
900     application.SendNotification();
901     application.Render();
902
903     DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
904   }
905
906   // Bake
907   {
908     Actor actor = Actor::New();
909     stage.Add(actor);
910
911     // Build the animation
912     float durationSeconds(1.0f);
913     Animation animation = Animation::New(durationSeconds);
914     animation.SetDisconnectAction( Animation::Bake );
915
916     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
917     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
918
919     // Start the animation
920     animation.Play();
921
922     application.SendNotification();
923     application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
924
925     actor.Unparent();
926
927     application.SendNotification();
928     application.Render();
929
930     DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition*0.5f, TEST_LOCATION );
931   }
932
933   // Discard
934   {
935     Actor actor = Actor::New();
936     stage.Add(actor);
937
938     // Build the animation
939     float durationSeconds(1.0f);
940     Animation animation = Animation::New(durationSeconds);
941     animation.SetDisconnectAction( Animation::Discard );
942
943     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
944     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
945
946     // Start the animation
947     animation.Play();
948
949     application.SendNotification();
950     application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
951
952     actor.Unparent();
953
954     application.SendNotification();
955     application.Render();
956
957     DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
958   }
959
960   // Don't play the animation: disconnect action should not be applied
961   {
962     Actor actor = Actor::New();
963     stage.Add(actor);
964
965     // Build the animation
966     float durationSeconds(1.0f);
967     Animation animation = Animation::New(durationSeconds);
968
969     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
970     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
971
972     application.SendNotification();
973     application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
974
975     actor.Unparent();
976
977     application.SendNotification();
978     application.Render();
979
980     DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
981   }
982
983   END_TEST;
984 }
985
986 int UtcDaliAnimationGetDisconnectActionP(void)
987 {
988   TestApplication application;
989   Animation animation = Animation::New(1.0f);
990   DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal); // default!
991
992   animation.SetDisconnectAction(Animation::Discard);
993   DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Discard);
994
995   animation.SetDisconnectAction(Animation::Bake);
996   DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Bake);
997
998   END_TEST;
999 }
1000
1001 int UtcDaliAnimationSetDefaultAlphaFunctionP(void)
1002 {
1003   TestApplication application;
1004
1005   Animation animation = Animation::New(1.0f);
1006   AlphaFunction func = animation.GetDefaultAlphaFunction();
1007   DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1008
1009   animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1010   AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1011   DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1012   END_TEST;
1013 }
1014
1015 int UtcDaliAnimationGetDefaultAlphaFunctionP(void)
1016 {
1017   TestApplication application;
1018
1019   Animation animation = Animation::New(1.0f);
1020   AlphaFunction func = animation.GetDefaultAlphaFunction();
1021
1022   // Test that the default is linear
1023   DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1024
1025   animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1026   AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1027   DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1028
1029   END_TEST;
1030 }
1031
1032 int UtcDaliAnimationSetCurrentProgressP(void)
1033 {
1034   TestApplication application;
1035
1036   Actor actor = Actor::New();
1037   Stage::GetCurrent().Add(actor);
1038
1039   // Build the animation
1040   Animation animation = Animation::New(0.0f);
1041
1042   //Set duration
1043   float durationSeconds(1.0f);
1044   animation.SetDuration(durationSeconds);
1045
1046   bool signalReceived(false);
1047   AnimationFinishCheck finishCheck(signalReceived);
1048   animation.FinishedSignal().Connect(&application, finishCheck);
1049   application.SendNotification();
1050
1051   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1052   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1053
1054   // Start the animation from 40% progress
1055   animation.SetCurrentProgress( 0.4f );
1056   animation.Play();
1057
1058   application.SendNotification();
1059   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1060
1061   // We didn't expect the animation to finish yet
1062   application.SendNotification();
1063   finishCheck.CheckSignalNotReceived();
1064   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1065   DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
1066
1067   animation.Play(); // Test that calling play has no effect, when animation is already playing
1068   application.SendNotification();
1069
1070   //Set the progress to 70%
1071   animation.SetCurrentProgress( 0.7f );
1072   application.SendNotification();
1073   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 80% progress */);
1074   DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1075
1076   application.SendNotification();
1077   finishCheck.CheckSignalNotReceived();
1078   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1079   DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1080
1081   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1082   // We did expect the animation to finish
1083   application.SendNotification();
1084   finishCheck.CheckSignalReceived();
1085   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1086
1087   // Check that nothing has changed after a couple of buffer swaps
1088   application.Render(0);
1089   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1090   application.Render(0);
1091   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1092   END_TEST;
1093 }
1094
1095 int UtcDaliAnimationSetCurrentProgressN(void)
1096 {
1097   TestApplication application;
1098
1099   Actor actor = Actor::New();
1100   Stage::GetCurrent().Add(actor);
1101
1102   // Build the animation
1103   Animation animation = Animation::New(0.0f);
1104
1105   //Set duration
1106   float durationSeconds(1.0f);
1107   animation.SetDuration(durationSeconds);
1108
1109   bool signalReceived(false);
1110   AnimationFinishCheck finishCheck(signalReceived);
1111   animation.FinishedSignal().Connect(&application, finishCheck);
1112   application.SendNotification();
1113
1114   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1115   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1116
1117   //Trying to set the current cursor outside the range [0..1] is ignored
1118   animation.SetCurrentProgress( -1.0f);
1119   application.SendNotification();
1120   DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1121
1122   animation.SetCurrentProgress( 100.0f);
1123   application.SendNotification();
1124   DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1125   END_TEST;
1126 }
1127
1128 int UtcDaliAnimationGetCurrentProgressP(void)
1129 {
1130   TestApplication application;
1131
1132   Actor actor = Actor::New();
1133   Stage::GetCurrent().Add(actor);
1134
1135   // Build the animation
1136   Animation animation = Animation::New(0.0f);
1137   animation.Play();
1138
1139   //Test GetCurrentProgress return 0.0 as the duration is 0.0
1140   DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1141
1142   animation.SetCurrentProgress( 0.5f );
1143   application.SendNotification();
1144   application.Render(static_cast<unsigned int>(100.0f));
1145
1146   //Progress should still be 0.0
1147   DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1148
1149   //Set duration
1150   float durationSeconds(1.0f);
1151   animation.SetDuration(durationSeconds);
1152   application.SendNotification();
1153
1154   bool signalReceived(false);
1155   AnimationFinishCheck finishCheck(signalReceived);
1156   animation.FinishedSignal().Connect(&application, finishCheck);
1157   application.SendNotification();
1158
1159   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1160   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1161
1162   // Start the animation from 40% progress
1163   animation.SetCurrentProgress( 0.4f );
1164   animation.Play();
1165
1166   application.SendNotification();
1167   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1168
1169   // We didn't expect the animation to finish yet
1170   application.SendNotification();
1171   finishCheck.CheckSignalNotReceived();
1172   DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
1173
1174   animation.Play(); // Test that calling play has no effect, when animation is already playing
1175   application.SendNotification();
1176
1177   //Set the progress to 70%
1178   animation.SetCurrentProgress( 0.7f );
1179   application.SendNotification();
1180   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 80% progress */);
1181   DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1182
1183   application.SendNotification();
1184   finishCheck.CheckSignalNotReceived();
1185   DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1186
1187   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1188   // We did expect the animation to finish
1189   application.SendNotification();
1190   finishCheck.CheckSignalReceived();
1191   END_TEST;
1192 }
1193
1194 int UtcDaliAnimationSetSpeedFactorP1(void)
1195 {
1196   TestApplication application;
1197
1198   tet_printf("Testing that setting a speed factor of 2 takes half the time\n");
1199
1200   Actor actor = Actor::New();
1201   Stage::GetCurrent().Add(actor);
1202
1203   // Build the animation
1204   float durationSeconds(1.0f);
1205   Animation animation = Animation::New(durationSeconds);
1206
1207   const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1208   const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1209
1210   KeyFrames keyframes = KeyFrames::New();
1211   keyframes.Add( 0.0f, initialPosition);
1212   keyframes.Add( 1.0f, targetPosition );
1213   animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1214
1215   //Set speed to be x2
1216   animation.SetSpeedFactor(2.0f);
1217
1218   // Start the animation
1219   animation.Play();
1220
1221   bool signalReceived(false);
1222   AnimationFinishCheck finishCheck(signalReceived);
1223   animation.FinishedSignal().Connect(&application, finishCheck);
1224
1225   application.SendNotification();
1226   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1227
1228   // We didn't expect the animation to finish yet
1229   application.SendNotification();
1230   finishCheck.CheckSignalNotReceived();
1231   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1232
1233   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1234
1235   // We didn't expect the animation to finish yet
1236   application.SendNotification();
1237   finishCheck.CheckSignalNotReceived();
1238   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1239
1240   application.Render(static_cast<unsigned int>(durationSeconds*100.0f) + 1u/*just beyond half the duration*/);
1241
1242   // We did expect the animation to finish
1243   application.SendNotification();
1244   finishCheck.CheckSignalReceived();
1245   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1246
1247   // Check that nothing has changed after a couple of buffer swaps
1248   application.Render(0);
1249   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1250   application.Render(0);
1251   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1252
1253   END_TEST;
1254 }
1255
1256 int UtcDaliAnimationSetSpeedFactorP2(void)
1257 {
1258   TestApplication application;
1259
1260   Actor actor = Actor::New();
1261   Stage::GetCurrent().Add(actor);
1262
1263   // Build the animation
1264   float durationSeconds(1.0f);
1265   Animation animation = Animation::New(durationSeconds);
1266
1267   const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1268   const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1269
1270   KeyFrames keyframes = KeyFrames::New();
1271   keyframes.Add( 0.0f, initialPosition);
1272   keyframes.Add( 1.0f, targetPosition );
1273   animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1274
1275   tet_printf("Test -1 speed factor. Animation will play in reverse at normal speed\n");
1276   animation.SetSpeedFactor( -1.0f );
1277
1278   // Start the animation
1279   animation.Play();
1280
1281   bool signalReceived(false);
1282   AnimationFinishCheck finishCheck(signalReceived);
1283   animation.FinishedSignal().Connect(&application, finishCheck);
1284
1285   application.SendNotification();
1286   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1287
1288   // We didn't expect the animation to finish yet
1289   application.SendNotification();
1290   finishCheck.CheckSignalNotReceived();
1291   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1292
1293   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1294
1295   // We didn't expect the animation to finish yet
1296   application.SendNotification();
1297   finishCheck.CheckSignalNotReceived();
1298   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1299
1300   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1301
1302   // We didn't expect the animation to finish yet
1303   application.SendNotification();
1304   finishCheck.CheckSignalNotReceived();
1305   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1306
1307   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1308
1309   // We didn't expect the animation to finish yet
1310   application.SendNotification();
1311   finishCheck.CheckSignalNotReceived();
1312   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1313
1314   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1315
1316   // We did expect the animation to finish
1317   application.SendNotification();
1318   finishCheck.CheckSignalReceived();
1319   DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
1320
1321   // Check that nothing has changed after a couple of buffer swaps
1322   application.Render(0);
1323   DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1324   application.Render(0);
1325   DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1326
1327   END_TEST;
1328 }
1329
1330 int UtcDaliAnimationSetSpeedFactorP3(void)
1331 {
1332   TestApplication application;
1333
1334   Actor actor = Actor::New();
1335   Stage::GetCurrent().Add(actor);
1336
1337   // Build the animation
1338   float durationSeconds(1.0f);
1339   Animation animation = Animation::New(durationSeconds);
1340
1341   const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1342   const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1343
1344   KeyFrames keyframes = KeyFrames::New();
1345   keyframes.Add( 0.0f, initialPosition);
1346   keyframes.Add( 1.0f, targetPosition );
1347   animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1348
1349   bool signalReceived(false);
1350   AnimationFinishCheck finishCheck(signalReceived);
1351   animation.FinishedSignal().Connect(&application, finishCheck);
1352
1353   tet_printf("Test half speed factor. Animation will take twice the duration\n");
1354
1355   //Set speed to be half of normal speed
1356   animation.SetSpeedFactor( 0.5f );
1357
1358   // Start the animation
1359   animation.Play();
1360
1361   application.SendNotification();
1362   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1363
1364   // We didn't expect the animation to finish yet
1365   application.SendNotification();
1366   finishCheck.CheckSignalNotReceived();
1367   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), TEST_LOCATION );
1368
1369   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1370
1371   // We didn't expect the animation to finish yet
1372   application.SendNotification();
1373   finishCheck.CheckSignalNotReceived();
1374   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1375
1376   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
1377
1378   // We didn't expect the animation to finish yet
1379   application.SendNotification();
1380   finishCheck.CheckSignalNotReceived();
1381   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.3f), TEST_LOCATION );
1382
1383   application.SendNotification();
1384   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1385
1386   // We didn't expect the animation to finish yet
1387   application.SendNotification();
1388   finishCheck.CheckSignalNotReceived();
1389   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1390
1391   application.Render(static_cast<unsigned int>(durationSeconds*1200.0f) + 1u/*just beyond the animation duration*/);
1392
1393   // We did expect the animation to finish
1394   application.SendNotification();
1395   finishCheck.CheckSignalReceived();
1396   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1397
1398   // Check that nothing has changed after a couple of buffer swaps
1399   application.Render(0);
1400   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1401   application.Render(0);
1402   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1403   END_TEST;
1404 }
1405
1406
1407 int UtcDaliAnimationSetSpeedFactorP4(void)
1408 {
1409   TestApplication application;
1410
1411   Actor actor = Actor::New();
1412   Stage::GetCurrent().Add(actor);
1413
1414   // Build the animation
1415   float durationSeconds(1.0f);
1416   Animation animation = Animation::New(durationSeconds);
1417
1418   const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1419   const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1420
1421   KeyFrames keyframes = KeyFrames::New();
1422   keyframes.Add( 0.0f, initialPosition);
1423   keyframes.Add( 1.0f, targetPosition );
1424   animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1425
1426   bool signalReceived(false);
1427   AnimationFinishCheck finishCheck(signalReceived);
1428   animation.FinishedSignal().Connect(&application, finishCheck);
1429
1430   tet_printf("Test half speed factor. Animation will take twice the duration\n");
1431
1432   tet_printf("Set speed to be half of normal speed\n");
1433   tet_printf("SetSpeedFactor(0.5f)\n");
1434   animation.SetSpeedFactor( 0.5f );
1435
1436   // Start the animation
1437   animation.Play();
1438
1439   application.SendNotification();
1440   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1441
1442   // We didn't expect the animation to finish yet
1443   application.SendNotification();
1444   finishCheck.CheckSignalNotReceived();
1445   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), TEST_LOCATION );
1446
1447   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1448
1449   // We didn't expect the animation to finish yet
1450   application.SendNotification();
1451   finishCheck.CheckSignalNotReceived();
1452   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1453
1454   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
1455
1456   // We didn't expect the animation to finish yet
1457   application.SendNotification();
1458   finishCheck.CheckSignalNotReceived();
1459   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.3f), TEST_LOCATION );
1460
1461   tet_printf("Reverse direction of animation whilst playing\n");
1462   tet_printf("SetSpeedFactor(-0.5f)\n");
1463   animation.SetSpeedFactor(-0.5f);
1464
1465   application.SendNotification();
1466   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1467
1468   // We didn't expect the animation to finish yet
1469   application.SendNotification();
1470   finishCheck.CheckSignalNotReceived();
1471   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1472
1473   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1474
1475   // We didn't expect the animation to finish yet
1476   application.SendNotification();
1477   finishCheck.CheckSignalNotReceived();
1478   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), 0.0001, TEST_LOCATION );
1479
1480   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1481
1482   // We did expect the animation to finish
1483   application.SendNotification();
1484   finishCheck.CheckSignalReceived();
1485   DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
1486
1487   // Check that nothing has changed after a couple of buffer swaps
1488   application.Render(0);
1489   DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1490   application.Render(0);
1491   DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1492   END_TEST;
1493 }
1494
1495 int UtcDaliAnimationSetSpeedFactorAndRange(void)
1496 {
1497   TestApplication application;
1498
1499   const unsigned int NUM_FRAMES(15);
1500
1501   struct TestData
1502   {
1503     float startTime;
1504     float endTime;
1505     float startX;
1506     float endX;
1507     float expected[NUM_FRAMES];
1508   };
1509
1510   TestData testData[] = {
1511     // ACTOR 0
1512     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1513     /*                       |----------PlayRange---------------|                 */
1514     /*                                            | reverse                       */
1515     { 0.0f,                                                                  1.0f, // TimePeriod
1516       0.0f,                                                                100.0f, // POS
1517       {/**/                 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,  /* Loop */
1518        /**/                 30.0f, 40.0f, 50.0f, 60.0f, /* Reverse direction */
1519        /**/                               50.0f,
1520        /**/                        40.0f,
1521        /**/                 30.0f,
1522        /**/                                             70.0f,
1523        /**/                                      60.0f,
1524        /**/                               50.0f,
1525        /**/
1526       }
1527     },
1528
1529     // ACTOR 1 - Across start of range
1530     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1531     /*                       |----------PlayRange---------------|                 */
1532     /*                                            | reverse                       */
1533     {                0.2f,                0.5f,                               // TimePeriod
1534                      20.0f,               50.0f,                // POS
1535       {/**/                 30.0f, 40.0f, 50.0f, 50.0f, 50.0f,  /* Loop */
1536        /**/                 30.0f, 40.0f, 50.0f, 50.0f, /* Reverse direction @ frame #9 */
1537        /**/                               50.0f,
1538        /**/                        40.0f,
1539        /**/                 30.0f,
1540        /**/                                             50.0f,
1541        /**/                                      50.0f,
1542        /**/                               50.0f
1543       }
1544     },
1545
1546     // ACTOR 2 - Across end of range
1547     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1548     /*                       |----------PlayRange---------------|                 */
1549     /*                                            | reverse                       */
1550     {/**/                                  0.5f,                      0.9f,   // TimePeriod
1551      /**/                                 50.0f,                      90.0f,  // POS
1552      { /**/                 50.0f, 50.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1553        /**/                 50.0f, 50.0f, 50.0f, 60.0f,/* Reverse direction @ frame #9 */
1554        /**/                               50.0f,
1555        /**/                        50.0f,
1556        /**/                 50.0f,                      70.0f,
1557        /**/                                      60.0f,
1558        /**/                               50.0f,
1559       }
1560     },
1561
1562     // ACTOR 3 - Before beginning of range
1563     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1564     /*                       |----------PlayRange---------------|                 */
1565     /*                                            | reverse                       */
1566     {/**/     0.1f,      0.25f, // TimePeriod
1567      /**/     10.0f,     25.0f, // POS
1568      { /**/
1569        /**/ 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f
1570        /**/
1571       }
1572     },
1573
1574     // ACTOR 4 - After end of range
1575     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1576     /*                       |----------PlayRange---------------|                 */
1577     /*                                            | reverse                       */
1578     {/**/                                                           0.85f,   1.0f, // TimePeriod
1579      /**/                                                           85.0f,  100.0f, // POS
1580      { /**/
1581        /**/ 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f
1582        /**/
1583      }
1584     },
1585     // Actor 5 - Middle of range
1586     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1587     /*                       |----------PlayRange---------------|                 */
1588     /*                                            | reverse                       */
1589     {/**/                          0.4f,            0.65f, // Time Period
1590      /**/                         40.0f,            65.0f, // Position
1591      { /**/                40.0f, 40.0f, 50.0f, 60.0f, 65.0f,
1592        /**/                40.0f, 40.0f, 50.0f, 60.0f, // Reverse
1593        /**/                              50.0f,
1594        /**/                       40.0f,
1595        /**/                40.0f,
1596        /**/                                            65.0f,
1597        /**/                                      60.0f,
1598        /**/                              50.0f,
1599      }
1600     }
1601   };
1602
1603   const size_t NUM_ENTRIES(sizeof(testData)/sizeof(TestData));
1604
1605   // Build the animation
1606   float durationSeconds(1.0f);
1607   Animation animation = Animation::New(durationSeconds);
1608   bool signalReceived(false);
1609   AnimationFinishCheck finishCheck(signalReceived);
1610   animation.FinishedSignal().Connect(&application, finishCheck);
1611
1612   std::vector<Dali::Actor> actors;
1613
1614   for( unsigned int actorIndex = 0; actorIndex < NUM_ENTRIES; ++actorIndex )
1615   {
1616     Actor actor = Actor::New();
1617     actor.SetPosition( Vector3( testData[actorIndex].startX, 0, 0 ) );
1618     actors.push_back(actor);
1619     Stage::GetCurrent().Add(actor);
1620
1621     if( actorIndex == 0 || actorIndex == NUM_ENTRIES-1 )
1622     {
1623       KeyFrames keyframes = KeyFrames::New();
1624       keyframes.Add( testData[actorIndex].startTime, Vector3(testData[actorIndex].startX, 0, 0));
1625       keyframes.Add( testData[actorIndex].endTime, Vector3(testData[actorIndex].endX, 0, 0));
1626       animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1627     }
1628     else
1629     {
1630       animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( testData[actorIndex].endX, 0, 0 ), TimePeriod( testData[actorIndex].startTime, testData[actorIndex].endTime - testData[actorIndex].startTime) );
1631     }
1632   }
1633
1634   tet_printf("Test half speed factor. Animation will take twice the duration\n");
1635   tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1636   tet_printf("SetSpeedFactor(0.5f)\n");
1637   animation.SetSpeedFactor( 0.5f );
1638   animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1639   animation.SetLooping(true);
1640
1641   // Start the animation
1642   animation.Play();
1643   application.SendNotification();
1644   application.Render(0);   // Frame 0 tests initial values
1645
1646   for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1647   {
1648     unsigned int actorIndex = 0u;
1649     for( actorIndex = 0u; actorIndex < NUM_ENTRIES; ++actorIndex )
1650     {
1651       DALI_TEST_EQUALS( actors[actorIndex].GetCurrentPosition().x, testData[actorIndex].expected[frame], 0.001, TEST_LOCATION );
1652       if( ! Equals(actors[actorIndex].GetCurrentPosition().x, testData[actorIndex].expected[frame]) )
1653       {
1654         tet_printf("Failed at frame %u, actorIndex %u\n", frame, actorIndex );
1655       }
1656     }
1657
1658     if( frame == 8 )
1659     {
1660       tet_printf("Reverse direction of animation whilst playing after frame 8\n");
1661       tet_printf("SetSpeedFactor(-0.5f)\n");
1662       animation.SetSpeedFactor(-0.5f);
1663       application.SendNotification();
1664     }
1665     application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1666
1667     // We didn't expect the animation to finish yet
1668     application.SendNotification();
1669     finishCheck.CheckSignalNotReceived();
1670   }
1671
1672   END_TEST;
1673 }
1674
1675 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount01(void)
1676 {
1677   TestApplication application;
1678
1679   const unsigned int NUM_FRAMES(15);
1680
1681   struct TestData
1682   {
1683     float startTime;
1684     float endTime;
1685     float startX;
1686     float endX;
1687     float expected[NUM_FRAMES];
1688   };
1689
1690   TestData testData =
1691     // ACTOR 0
1692     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1693     /*                       |----------PlayRange---------------|                 */
1694     { 0.0f,                                                                  1.0f, // TimePeriod
1695       0.0f,                                                                100.0f, // POS
1696       {/**/                 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,  /* Loop */
1697        /**/                 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,
1698        /**/                 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,
1699        /**/
1700       }
1701     };
1702
1703
1704   // Build the animation
1705   float durationSeconds(1.0f);
1706   Animation animation = Animation::New(durationSeconds);
1707   bool signalReceived(false);
1708   AnimationFinishCheck finishCheck(signalReceived);
1709   animation.FinishedSignal().Connect(&application, finishCheck);
1710
1711   std::vector<Dali::Actor> actors;
1712
1713   Actor actor = Actor::New();
1714   actor.SetPosition( Vector3( testData.startX, 0, 0 ) );
1715   actors.push_back(actor);
1716   Stage::GetCurrent().Add(actor);
1717
1718   KeyFrames keyframes = KeyFrames::New();
1719   keyframes.Add( testData.startTime, Vector3(testData.startX, 0, 0));
1720   keyframes.Add( testData.endTime, Vector3(testData.endX, 0, 0));
1721   animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1722
1723   tet_printf("Test half speed factor. Animation will take twice the duration\n");
1724   tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1725   tet_printf("SetSpeedFactor(0.5f)\n");
1726   tet_printf("SetLoopCount(3)\n");
1727   animation.SetSpeedFactor( 0.5f );
1728   animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1729   animation.SetLoopCount(3);
1730
1731   // Start the animation
1732   animation.Play();
1733   application.SendNotification();
1734   application.Render(0);   // Frame 0 tests initial values
1735
1736   for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1737   {
1738     DALI_TEST_EQUALS( actor.GetCurrentPosition().x, testData.expected[frame], 0.001, TEST_LOCATION );
1739
1740     application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1741
1742     if( frame < NUM_FRAMES-1 )
1743     {
1744       // We didn't expect the animation to finish yet
1745       application.SendNotification();
1746       finishCheck.CheckSignalNotReceived();
1747     }
1748   }
1749
1750   // We did expect the animation to finish
1751   application.SendNotification();
1752   finishCheck.CheckSignalReceived();
1753   DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 80.0f, 0.001, TEST_LOCATION );
1754
1755   END_TEST;
1756 }
1757
1758 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount02(void)
1759 {
1760   TestApplication application;
1761
1762   const unsigned int NUM_FRAMES(15);
1763
1764   struct TestData
1765   {
1766     float startTime;
1767     float endTime;
1768     float startX;
1769     float endX;
1770     float expected[NUM_FRAMES];
1771   };
1772
1773   TestData testData =
1774     // ACTOR 0
1775     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1776     /*                       |----------PlayRange---------------|                 */
1777     { 0.0f,                                                                  1.0f, // TimePeriod
1778       0.0f,                                                                100.0f, // POS
1779       {/**/                 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1780        /**/                 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1781        /**/                 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1782       }
1783     };
1784
1785
1786   // Build the animation
1787   float durationSeconds(1.0f);
1788   Animation animation = Animation::New(durationSeconds);
1789   bool signalReceived(false);
1790   AnimationFinishCheck finishCheck(signalReceived);
1791   animation.FinishedSignal().Connect(&application, finishCheck);
1792
1793   std::vector<Dali::Actor> actors;
1794
1795   Actor actor = Actor::New();
1796   actor.SetPosition( Vector3( testData.startX, 0, 0 ) );
1797   actors.push_back(actor);
1798   Stage::GetCurrent().Add(actor);
1799
1800   KeyFrames keyframes = KeyFrames::New();
1801   keyframes.Add( testData.startTime, Vector3(testData.startX, 0, 0));
1802   keyframes.Add( testData.endTime, Vector3(testData.endX, 0, 0));
1803   animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1804
1805   tet_printf("Test reverse half speed factor. Animation will take twice the duration\n");
1806   tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1807   tet_printf("SetSpeedFactor(-0.5f)\n");
1808   tet_printf("SetLoopCount(3)\n");
1809   animation.SetSpeedFactor( -0.5f );
1810   animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1811   animation.SetLoopCount(3);
1812
1813   // Start the animation
1814   animation.Play();
1815   application.SendNotification();
1816   application.Render(0);   // Frame 0 tests initial values
1817
1818   for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1819   {
1820     DALI_TEST_EQUALS( actor.GetCurrentPosition().x, testData.expected[frame], 0.001, TEST_LOCATION );
1821
1822     application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1823
1824     if( frame < NUM_FRAMES-1 )
1825     {
1826       // We didn't expect the animation to finish yet
1827       application.SendNotification();
1828       finishCheck.CheckSignalNotReceived();
1829     }
1830   }
1831
1832   // We did expect the animation to finish
1833   application.SendNotification();
1834   finishCheck.CheckSignalReceived();
1835   DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 30.0f, 0.001, TEST_LOCATION );
1836
1837   END_TEST;
1838 }
1839
1840
1841 int UtcDaliAnimationGetSpeedFactorP(void)
1842 {
1843   TestApplication application;
1844
1845   Animation animation = Animation::New(1.0f);
1846   animation.SetSpeedFactor(0.5f);
1847   DALI_TEST_EQUALS(animation.GetSpeedFactor(), 0.5f, TEST_LOCATION);
1848
1849   animation.SetSpeedFactor(-2.5f);
1850   DALI_TEST_EQUALS(animation.GetSpeedFactor(), -2.5f, TEST_LOCATION);
1851   END_TEST;
1852 }
1853
1854 int UtcDaliAnimationSetPlayRangeP(void)
1855 {
1856   TestApplication application;
1857
1858   Actor actor = Actor::New();
1859   Stage::GetCurrent().Add( actor );
1860
1861   // Build the animation
1862   float durationSeconds( 1.0f );
1863   Animation animation = Animation::New( durationSeconds );
1864
1865   bool signalReceived( false );
1866   AnimationFinishCheck finishCheck( signalReceived );
1867   animation.FinishedSignal().Connect( &application, finishCheck );
1868   application.SendNotification();
1869
1870   // Set range between 0.4 and 0.8
1871   animation.SetPlayRange( Vector2( 0.4f, 0.9f ) );
1872   application.SendNotification();
1873   DALI_TEST_EQUALS( Vector2( 0.4f, 0.9f ), animation.GetPlayRange(), TEST_LOCATION );
1874
1875   Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
1876   animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR );
1877
1878   // Start the animation from 40% progress
1879   animation.Play();
1880
1881   application.SendNotification();
1882   application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 60% progress */ );
1883
1884   // We didn't expect the animation to finish yet
1885   application.SendNotification();
1886   finishCheck.CheckSignalNotReceived();
1887   DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.6f ), TEST_LOCATION );
1888
1889   application.SendNotification();
1890   application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 80% progress */ );
1891
1892   application.SendNotification();
1893   finishCheck.CheckSignalNotReceived();
1894   DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.8f ), TEST_LOCATION );
1895
1896   application.SendNotification();
1897   application.Render( static_cast< unsigned int >( durationSeconds*100.0f ) + 1u/*just beyond the animation duration*/ );
1898
1899   // We did expect the animation to finish
1900   application.SendNotification();
1901   finishCheck.CheckSignalReceived();
1902   DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.9f ), TEST_LOCATION );
1903   END_TEST;
1904 }
1905
1906 int UtcDaliAnimationSetPlayRangeN(void)
1907 {
1908   TestApplication application;
1909
1910   Actor actor = Actor::New();
1911   Stage::GetCurrent().Add(actor);
1912
1913   // Build the animation
1914   Animation animation = Animation::New(0);
1915   application.SendNotification();
1916
1917   //PlayRange out of bounds
1918   animation.SetPlayRange( Vector2(-1.0f,1.0f) );
1919   application.SendNotification();
1920   DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
1921   animation.SetPlayRange( Vector2(0.0f,2.0f) );
1922   application.SendNotification();
1923   DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
1924
1925   //If playRange is not in the correct order it has to be ordered
1926   animation.SetPlayRange( Vector2(0.8f,0.2f) );
1927   application.SendNotification();
1928   DALI_TEST_EQUALS( Vector2(0.2f,0.8f), animation.GetPlayRange(), TEST_LOCATION );
1929
1930   END_TEST;
1931 }
1932
1933 int UtcDaliAnimationGetPlayRangeP(void)
1934 {
1935   TestApplication application;
1936
1937   Actor actor = Actor::New();
1938   Stage::GetCurrent().Add( actor );
1939
1940   // Build the animation
1941   Animation animation = Animation::New( 1.0f );
1942   application.SendNotification();
1943
1944   //If PlayRange not specified it should be 0.0-1.0 by default
1945   DALI_TEST_EQUALS( Vector2( 0.0f,1.0f ), animation.GetPlayRange(), TEST_LOCATION );
1946
1947   // Set range between 0.4 and 0.8
1948   animation.SetPlayRange( Vector2( 0.4f, 0.8f ) );
1949   application.SendNotification();
1950   DALI_TEST_EQUALS( Vector2( 0.4f, 0.8f ), animation.GetPlayRange(), TEST_LOCATION );
1951
1952   END_TEST;
1953 }
1954
1955 int UtcDaliAnimationPlayP(void)
1956 {
1957   TestApplication application;
1958
1959   Actor actor = Actor::New();
1960   Stage::GetCurrent().Add(actor);
1961
1962   // Build the animation
1963   float durationSeconds(1.0f);
1964   Animation animation = Animation::New(durationSeconds);
1965   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1966   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1967
1968   // Start the animation
1969   animation.Play();
1970
1971   bool signalReceived(false);
1972   AnimationFinishCheck finishCheck(signalReceived);
1973   animation.FinishedSignal().Connect(&application, finishCheck);
1974
1975   application.SendNotification();
1976   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1977
1978   // We didn't expect the animation to finish yet
1979   application.SendNotification();
1980   finishCheck.CheckSignalNotReceived();
1981   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1982
1983   animation.Play(); // Test that calling play has no effect, when animation is already playing
1984   application.SendNotification();
1985   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1986
1987   // We didn't expect the animation to finish yet
1988   application.SendNotification();
1989   finishCheck.CheckSignalNotReceived();
1990   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1991
1992   animation.Play(); // Test that calling play has no effect, when animation is already playing
1993   application.SendNotification();
1994   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1995
1996   // We didn't expect the animation to finish yet
1997   application.SendNotification();
1998   finishCheck.CheckSignalNotReceived();
1999   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2000
2001   animation.Play(); // Test that calling play has no effect, when animation is already playing
2002   application.SendNotification();
2003   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2004
2005   // We didn't expect the animation to finish yet
2006   application.SendNotification();
2007   finishCheck.CheckSignalNotReceived();
2008   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2009
2010   animation.Play(); // Test that calling play has no effect, when animation is already playing
2011   application.SendNotification();
2012   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2013
2014   // We did expect the animation to finish
2015   application.SendNotification();
2016   finishCheck.CheckSignalReceived();
2017   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2018
2019   // Check that nothing has changed after a couple of buffer swaps
2020   application.Render(0);
2021   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2022   application.Render(0);
2023   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2024   END_TEST;
2025 }
2026
2027 int UtcDaliAnimationPlayOffStageP(void)
2028 {
2029   // Test that an animation can be played, when the actor is off-stage.
2030   // When the actor is added to the stage, it should appear at the current position
2031   // i.e. where it would have been anyway, if on-stage from the beginning.
2032
2033   TestApplication application;
2034
2035   Actor actor = Actor::New();
2036   Vector3 basePosition(Vector3::ZERO);
2037   DALI_TEST_EQUALS( actor.GetCurrentPosition(), basePosition, TEST_LOCATION );
2038   // Not added to the stage!
2039
2040   // Build the animation
2041   float durationSeconds(1.0f);
2042   Animation animation = Animation::New(durationSeconds);
2043   animation.SetDisconnectAction( Animation::Discard );
2044   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2045   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2046
2047   // Start the animation
2048   animation.Play();
2049
2050   bool signalReceived(false);
2051   AnimationFinishCheck finishCheck(signalReceived);
2052   animation.FinishedSignal().Connect(&application, finishCheck);
2053
2054   application.SendNotification();
2055   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2056
2057   // We didn't expect the animation to finish yet
2058   application.SendNotification();
2059   finishCheck.CheckSignalNotReceived();
2060   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*off-stage*/, TEST_LOCATION );
2061
2062   // Add to the stage
2063   Stage::GetCurrent().Add(actor);
2064
2065   application.SendNotification();
2066   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2067
2068   // We didn't expect the animation to finish yet
2069   application.SendNotification();
2070   finishCheck.CheckSignalNotReceived();
2071   Vector3 expectedPosition(basePosition + (targetPosition - basePosition)*0.4f);
2072   DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition/*on-stage*/, TEST_LOCATION );
2073
2074   // Remove from the stage
2075   Stage::GetCurrent().Remove(actor);
2076
2077   application.SendNotification();
2078   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2079
2080   // We didn't expect the animation to finish yet
2081   application.SendNotification();
2082   finishCheck.CheckSignalNotReceived();
2083   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*back to start position*/, TEST_LOCATION );
2084
2085   // Add to the stage
2086   Stage::GetCurrent().Add(actor);
2087
2088   application.SendNotification();
2089   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2090
2091   // We didn't expect the animation to finish yet
2092   application.SendNotification();
2093   finishCheck.CheckSignalNotReceived();
2094   expectedPosition = Vector3(basePosition + (targetPosition - basePosition)*0.8f);
2095   DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition, TEST_LOCATION );
2096
2097   application.SendNotification();
2098   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2099
2100   // We did expect the animation to finish
2101   application.SendNotification();
2102   finishCheck.CheckSignalReceived();
2103   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2104
2105   // Check that nothing has changed after a couple of buffer swaps
2106   application.Render(0);
2107   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2108   application.Render(0);
2109   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2110   END_TEST;
2111 }
2112
2113 int UtcDaliAnimationPlayDiscardHandleP(void)
2114 {
2115   TestApplication application;
2116
2117   Actor actor = Actor::New();
2118   Stage::GetCurrent().Add(actor);
2119
2120   // Build the animation
2121   float durationSeconds(1.0f);
2122   Animation animation = Animation::New(durationSeconds);
2123   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2124   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2125
2126   bool signalReceived(false);
2127   AnimationFinishCheck finishCheck(signalReceived);
2128   animation.FinishedSignal().Connect(&application, finishCheck);
2129
2130   // Start the animation
2131   animation.Play();
2132
2133   // This is a test of the "Fire and Forget" behaviour
2134   // Discard the animation handle!
2135   animation.Reset();
2136   DALI_TEST_CHECK( !animation );
2137
2138   application.SendNotification();
2139   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2140
2141   // We didn't expect the animation to finish yet
2142   application.SendNotification();
2143   finishCheck.CheckSignalNotReceived();
2144   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2145
2146   application.SendNotification();
2147   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2148
2149   // We didn't expect the animation to finish yet
2150   application.SendNotification();
2151   finishCheck.CheckSignalNotReceived();
2152   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
2153
2154   application.SendNotification();
2155   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2156
2157   // We didn't expect the animation to finish yet
2158   application.SendNotification();
2159   finishCheck.CheckSignalNotReceived();
2160   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2161
2162   application.SendNotification();
2163   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2164
2165   // We didn't expect the animation to finish yet
2166   application.SendNotification();
2167   finishCheck.CheckSignalNotReceived();
2168   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2169
2170   application.SendNotification();
2171   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2172
2173   // We did expect the animation to finish
2174   application.SendNotification();
2175   finishCheck.CheckSignalReceived();
2176   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2177
2178   // Check that nothing has changed after a couple of buffer swaps
2179   application.Render(0);
2180   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2181   application.Render(0);
2182   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2183   END_TEST;
2184 }
2185
2186 int UtcDaliAnimationPlayStopDiscardHandleP(void)
2187 {
2188   TestApplication application;
2189
2190   Actor actor = Actor::New();
2191   Stage::GetCurrent().Add(actor);
2192
2193   // Build the animation
2194   float durationSeconds(1.0f);
2195   Animation animation = Animation::New(durationSeconds);
2196   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2197   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2198
2199   // Start the animation
2200   animation.Play();
2201
2202   bool signalReceived(false);
2203   AnimationFinishCheck finishCheck(signalReceived);
2204   animation.FinishedSignal().Connect(&application, finishCheck);
2205
2206   application.SendNotification();
2207   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2208
2209   // We didn't expect the animation to finish yet
2210   application.SendNotification();
2211   finishCheck.CheckSignalNotReceived();
2212   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2213
2214   // This is a test of the "Fire and Forget" behaviour
2215   // Stop the animation, and Discard the animation handle!
2216   animation.Stop();
2217   animation.Reset();
2218   DALI_TEST_CHECK( !animation );
2219
2220   application.SendNotification();
2221   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2222
2223   // We expect the animation to finish at 20% progress
2224   application.SendNotification();
2225   finishCheck.CheckSignalReceived();
2226   finishCheck.Reset();
2227   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2228
2229   application.SendNotification();
2230   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2231
2232   // Check that nothing has changed
2233   application.SendNotification();
2234   finishCheck.CheckSignalNotReceived();
2235   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2236
2237   application.SendNotification();
2238   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2239
2240   // Check that nothing has changed
2241   application.SendNotification();
2242   finishCheck.CheckSignalNotReceived();
2243   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2244
2245   application.SendNotification();
2246   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 100% progress */);
2247
2248   // Check that nothing has changed
2249   application.SendNotification();
2250   finishCheck.CheckSignalNotReceived();
2251   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2252   END_TEST;
2253 }
2254
2255 int UtcDaliAnimationPlayRangeP(void)
2256 {
2257   TestApplication application;
2258
2259   Actor actor = Actor::New();
2260   Stage::GetCurrent().Add(actor);
2261
2262   // Build the animation
2263   float durationSeconds(1.0f);
2264   Animation animation = Animation::New(durationSeconds);
2265   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2266   KeyFrames keyframes = KeyFrames::New();
2267   keyframes.Add( 0.0f , Vector3(0.0f,0.0f,0.0f ) );
2268   keyframes.Add( 1.0f , Vector3(100.0f,100.0f,100.0f ) );
2269
2270   animation.AnimateBetween( Property( actor, Actor::Property::POSITION), keyframes );
2271
2272   // Set range between 0.4 and 0.8
2273   animation.SetPlayRange( Vector2(0.4f,0.8f) );
2274   animation.Play();
2275
2276   bool signalReceived(false);
2277   AnimationFinishCheck finishCheck(signalReceived);
2278   animation.FinishedSignal().Connect(&application, finishCheck);
2279
2280   //Test that setting progress outside the range doesn't work
2281   animation.SetCurrentProgress( 0.9f );
2282   application.SendNotification();
2283   application.Render(0);
2284   DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
2285   animation.SetCurrentProgress( 0.2f );
2286   application.SendNotification();
2287   application.Render(0);
2288   DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
2289
2290   application.SendNotification();
2291   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2292
2293   // We didn't expect the animation to finish yet
2294   application.SendNotification();
2295   finishCheck.CheckSignalNotReceived();
2296   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2297
2298   animation.Play(); // Test that calling play has no effect, when animation is already playing
2299   application.SendNotification();
2300   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/* 80% progress */);
2301
2302   // We did expect the animation to finish
2303   application.SendNotification();
2304   finishCheck.CheckSignalReceived();
2305   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2306
2307   // Check that nothing has changed after a couple of buffer swaps
2308   application.Render(0);
2309   DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentPosition(), TEST_LOCATION );
2310   application.Render(0);
2311   DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentPosition(), TEST_LOCATION );
2312
2313
2314   //Loop inside the range
2315   finishCheck.Reset();
2316   animation.SetLooping( true );
2317   animation.Play();
2318   application.SendNotification();
2319   float intervalSeconds = 0.1f;
2320   float progress = 0.4f;
2321   for (int iterations = 0; iterations < 10; ++iterations )
2322   {
2323     application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
2324
2325     progress += intervalSeconds;
2326     if (progress > 0.8f)
2327     {
2328       progress = progress - 0.4f;
2329     }
2330
2331     DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
2332   }
2333
2334   // We didn't expect the animation to finish yet
2335   application.SendNotification();
2336   finishCheck.CheckSignalNotReceived();
2337
2338
2339   //Test change range on the fly
2340   animation.SetPlayRange( Vector2( 0.2f, 0.9f ) );
2341   application.SendNotification();
2342
2343   for (int iterations = 0; iterations < 10; ++iterations )
2344   {
2345     application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
2346
2347     progress += intervalSeconds;
2348     if (progress > 0.9f)
2349     {
2350       progress = progress - 0.7f;
2351     }
2352
2353     DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
2354   }
2355
2356   END_TEST;
2357 }
2358
2359 int UtcDaliAnimationPlayFromP(void)
2360 {
2361   TestApplication application;
2362
2363   Actor actor = Actor::New();
2364   Stage::GetCurrent().Add(actor);
2365
2366   // Build the animation
2367   float durationSeconds(1.0f);
2368   Animation animation = Animation::New(durationSeconds);
2369   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2370   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2371
2372   // Start the animation from 40% progress
2373   animation.PlayFrom( 0.4f );
2374
2375   bool signalReceived(false);
2376   AnimationFinishCheck finishCheck(signalReceived);
2377   animation.FinishedSignal().Connect(&application, finishCheck);
2378
2379   application.SendNotification();
2380   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2381
2382   // We didn't expect the animation to finish yet
2383   application.SendNotification();
2384   finishCheck.CheckSignalNotReceived();
2385   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2386
2387   animation.Play(); // Test that calling play has no effect, when animation is already playing
2388   application.SendNotification();
2389   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2390
2391   // We didn't expect the animation to finish yet
2392   application.SendNotification();
2393   finishCheck.CheckSignalNotReceived();
2394   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2395
2396   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2397   // We did expect the animation to finish
2398   application.SendNotification();
2399   finishCheck.CheckSignalReceived();
2400   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2401
2402   // Check that nothing has changed after a couple of buffer swaps
2403   application.Render(0);
2404   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2405   application.Render(0);
2406   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2407   END_TEST;
2408 }
2409
2410 int UtcDaliAnimationPlayFromN(void)
2411 {
2412   TestApplication application;
2413
2414   Actor actor = Actor::New();
2415   Stage::GetCurrent().Add(actor);
2416
2417   // Build the animation
2418   float durationSeconds(1.0f);
2419   Animation animation = Animation::New(durationSeconds);
2420   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2421   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2422
2423   //PlayFrom with an argument outside the range [0..1] will be ignored
2424   animation.PlayFrom(-1.0f);
2425   application.SendNotification();
2426   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
2427
2428   animation.PlayFrom(100.0f);
2429   application.SendNotification();
2430   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
2431   END_TEST;
2432 }
2433
2434 int UtcDaliAnimationPauseP(void)
2435 {
2436   TestApplication application;
2437
2438   Actor actor = Actor::New();
2439   Stage::GetCurrent().Add(actor);
2440
2441   // Build the animation
2442   float durationSeconds(1.0f);
2443   Animation animation = Animation::New(durationSeconds);
2444   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2445   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2446
2447   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2448
2449   // Start the animation
2450   animation.Play();
2451
2452   bool signalReceived(false);
2453   AnimationFinishCheck finishCheck(signalReceived);
2454   animation.FinishedSignal().Connect(&application, finishCheck);
2455
2456   application.SendNotification();
2457   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2458
2459   // We didn't expect the animation to finish yet
2460   application.SendNotification();
2461   finishCheck.CheckSignalNotReceived();
2462   DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2463
2464   // Pause the animation
2465   animation.Pause();
2466   application.SendNotification();
2467
2468   // Loop 5 times
2469   for (int i=0; i<5; ++i)
2470   {
2471     application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2472
2473     // We didn't expect the animation to finish yet
2474     application.SendNotification();
2475     finishCheck.CheckSignalNotReceived();
2476     DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
2477   }
2478
2479   // Keep going
2480   animation.Play();
2481   application.SendNotification();
2482   application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2483
2484   // We didn't expect the animation to finish yet
2485   application.SendNotification();
2486   finishCheck.CheckSignalNotReceived();
2487
2488   application.SendNotification();
2489   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2490
2491   // We did expect the animation to finish
2492   application.SendNotification();
2493   finishCheck.CheckSignalReceived();
2494   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2495
2496   // Check that nothing has changed after a couple of buffer swaps
2497   application.Render(0);
2498   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2499   application.Render(0);
2500   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2501   END_TEST;
2502 }
2503
2504
2505 int UtcDaliAnimationGetStateP(void)
2506 {
2507   TestApplication application;
2508
2509   Actor actor = Actor::New();
2510   Stage::GetCurrent().Add(actor);
2511
2512   // Build the animation
2513   float durationSeconds(1.0f);
2514   Animation animation = Animation::New(durationSeconds);
2515   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2516   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2517   DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2518
2519   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2520
2521   // Start the animation
2522   animation.Play();
2523
2524   DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2525
2526   bool signalReceived(false);
2527   AnimationFinishCheck finishCheck(signalReceived);
2528   animation.FinishedSignal().Connect(&application, finishCheck);
2529
2530   application.SendNotification();
2531   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2532
2533   // We didn't expect the animation to finish yet
2534   application.SendNotification();
2535   finishCheck.CheckSignalNotReceived();
2536   DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2537   DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2538
2539   // Pause the animation
2540   animation.Pause();
2541   DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
2542   application.SendNotification();
2543   application.Render(0.f);
2544
2545   // Loop 5 times
2546   for (int i=0; i<5; ++i)
2547   {
2548     application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2549
2550     // We didn't expect the animation to finish yet
2551     application.SendNotification();
2552     finishCheck.CheckSignalNotReceived();
2553     DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
2554     DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
2555   }
2556
2557   // Keep going
2558   finishCheck.Reset();
2559   animation.Play();
2560   DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2561   application.SendNotification();
2562   application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2563   // We didn't expect the animation to finish yet
2564   application.SendNotification();
2565   finishCheck.CheckSignalNotReceived();
2566   DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2567
2568   application.SendNotification();
2569   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2570
2571   // We did expect the animation to finish
2572   application.SendNotification();
2573   finishCheck.CheckSignalReceived();
2574   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2575   DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2576
2577   // Check that nothing has changed after a couple of buffer swaps
2578   application.Render(0);
2579   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2580   application.Render(0);
2581   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2582   DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2583
2584   // re-play
2585   finishCheck.Reset();
2586   animation.Play();
2587   DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2588   application.SendNotification();
2589   application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2590   application.SendNotification();
2591   finishCheck.CheckSignalNotReceived();
2592   DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2593
2594
2595   END_TEST;
2596 }
2597
2598 int UtcDaliAnimationStopP(void)
2599 {
2600   TestApplication application;
2601
2602   Actor actor = Actor::New();
2603   Stage::GetCurrent().Add(actor);
2604
2605   // Build the animation
2606   float durationSeconds(1.0f);
2607   Animation animation = Animation::New(durationSeconds);
2608   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2609   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2610
2611   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2612
2613   // Start the animation
2614   animation.Play();
2615
2616   bool signalReceived(false);
2617   AnimationFinishCheck finishCheck(signalReceived);
2618   animation.FinishedSignal().Connect(&application, finishCheck);
2619
2620   application.SendNotification();
2621   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2622
2623   // We didn't expect the animation to finish yet
2624   application.SendNotification();
2625   finishCheck.CheckSignalNotReceived();
2626   DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2627
2628   // Stop the animation
2629   animation.Stop();
2630   application.SendNotification();
2631
2632   // Loop 5 times
2633   for (int i=0; i<5; ++i)
2634   {
2635     application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2636
2637     // We did expect the animation to finish
2638     application.SendNotification();
2639     finishCheck.CheckSignalReceived();
2640     DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when stopped */, TEST_LOCATION );
2641   }
2642   END_TEST;
2643 }
2644
2645 int UtcDaliAnimationStopSetPositionP(void)
2646 {
2647   // Test that Animation::Stop & Actor::SetPosition can be used in conjunction
2648   // i.e. to check that the animation does not interfere with the position set.
2649
2650   TestApplication application;
2651
2652   Actor actor = Actor::New();
2653   Stage::GetCurrent().Add(actor);
2654
2655   // Build the animation
2656   float durationSeconds(1.0f);
2657   Animation animation = Animation::New(durationSeconds);
2658   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2659   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2660
2661   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2662
2663   // Start the animation
2664   animation.Play();
2665
2666   bool signalReceived(false);
2667   AnimationFinishCheck finishCheck(signalReceived);
2668   animation.FinishedSignal().Connect(&application, finishCheck);
2669
2670   application.SendNotification();
2671   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2672
2673   // We didn't expect the animation to finish yet
2674   application.SendNotification();
2675   finishCheck.CheckSignalNotReceived();
2676   DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2677
2678   // Stop the animation
2679   animation.Stop();
2680   Vector3 positionSet(2.0f, 3.0f, 4.0f);
2681   actor.SetPosition(positionSet);
2682   application.SendNotification();
2683
2684   // Loop 5 times
2685   for (int i=0; i<5; ++i)
2686   {
2687     application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2688
2689     // We did expect the animation to finish
2690     application.SendNotification();
2691     finishCheck.CheckSignalReceived();
2692     DALI_TEST_EQUALS( actor.GetCurrentPosition(), positionSet/*Animation should not interfere with this*/, TEST_LOCATION );
2693   }
2694   END_TEST;
2695 }
2696
2697 int UtcDaliAnimationClearP(void)
2698 {
2699   TestApplication application;
2700
2701   Actor actor = Actor::New();
2702   Stage::GetCurrent().Add(actor);
2703
2704   // Build the animation
2705   float durationSeconds(1.0f);
2706   Animation animation = Animation::New(durationSeconds);
2707   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2708   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2709
2710   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2711
2712   // Start the animation
2713   animation.Play();
2714
2715   bool signalReceived(false);
2716   AnimationFinishCheck finishCheck(signalReceived);
2717   animation.FinishedSignal().Connect(&application, finishCheck);
2718
2719   application.SendNotification();
2720   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2721
2722   // We didn't expect the animation to finish yet
2723   application.SendNotification();
2724   finishCheck.CheckSignalNotReceived();
2725   DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2726
2727   // Clear the animation
2728   animation.Clear();
2729   application.SendNotification();
2730
2731   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2732
2733   // We don't expect the animation to finish now
2734   application.SendNotification();
2735   finishCheck.CheckSignalNotReceived();
2736   DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress since the animator was destroyed */, TEST_LOCATION );
2737
2738   // Restart as a scale animation; this should not move the actor's position
2739   finishCheck.Reset();
2740   actor.SetPosition(Vector3::ZERO);
2741   Vector3 targetScale(3.0f, 3.0f, 3.0f);
2742   animation.AnimateTo( Property( actor, Actor::Property::SCALE ), targetScale, AlphaFunction::LINEAR );
2743   animation.Play();
2744
2745   application.SendNotification();
2746   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2747
2748   // We didn't expect the animation to finish yet
2749   application.SendNotification();
2750   finishCheck.CheckSignalNotReceived();
2751   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
2752   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION );
2753
2754   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2755
2756   // We did expect the animation to finish
2757   application.SendNotification();
2758   finishCheck.CheckSignalReceived();
2759   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
2760   DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
2761   END_TEST;
2762 }
2763
2764 int UtcDaliAnimationFinishedSignalP(void)
2765 {
2766   TestApplication application;
2767
2768   // Start the empty animation
2769   float durationSeconds(1.0f);
2770   Animation animation = Animation::New(durationSeconds);
2771   animation.Play();
2772
2773   bool signalReceived(false);
2774   AnimationFinishCheck finishCheck(signalReceived);
2775   animation.FinishedSignal().Connect(&application, finishCheck);
2776
2777   application.SendNotification();
2778   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*beyond the animation duration*/);
2779
2780   // We did expect the animation to finish
2781   application.SendNotification();
2782   finishCheck.CheckSignalReceived();
2783   END_TEST;
2784 }
2785
2786 int UtcDaliAnimationAnimateByBooleanP(void)
2787 {
2788   TestApplication application;
2789
2790   Actor actor = Actor::New();
2791
2792   // Register a boolean property
2793   bool startValue(false);
2794   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
2795   Stage::GetCurrent().Add(actor);
2796   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2797   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
2798
2799   // Build the animation
2800   float durationSeconds(2.0f);
2801   Animation animation = Animation::New(durationSeconds);
2802   const bool relativeValue(true);
2803   const bool finalValue( false || relativeValue );
2804   animation.AnimateBy(Property(actor, index), relativeValue);
2805
2806   // Start the animation
2807   animation.Play();
2808
2809   bool signalReceived(false);
2810   AnimationFinishCheck finishCheck(signalReceived);
2811   animation.FinishedSignal().Connect(&application, finishCheck);
2812
2813   application.SendNotification();
2814   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2815
2816   // We didn't expect the animation to finish yet
2817   application.SendNotification();
2818   finishCheck.CheckSignalNotReceived();
2819   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
2820
2821   application.SendNotification();
2822   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2823
2824   // We did expect the animation to finish
2825   application.SendNotification();
2826   finishCheck.CheckSignalReceived();
2827   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2828
2829   // Check that nothing has changed after a couple of buffer swaps
2830   application.Render(0);
2831   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2832   application.Render(0);
2833   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2834
2835   // Repeat with relative value "false" - this should be an NOOP
2836   animation = Animation::New(durationSeconds);
2837   bool noOpValue(false);
2838   animation.AnimateBy(Property(actor, index), noOpValue);
2839
2840   // Start the animation
2841   animation.Play();
2842
2843   finishCheck.Reset();
2844   animation.FinishedSignal().Connect(&application, finishCheck);
2845
2846   application.SendNotification();
2847   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2848
2849   // We didn't expect the animation to finish yet
2850   application.SendNotification();
2851   finishCheck.CheckSignalNotReceived();
2852   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2853
2854   application.SendNotification();
2855   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2856
2857   // We did expect the animation to finish
2858   application.SendNotification();
2859   finishCheck.CheckSignalReceived();
2860   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2861
2862   // Check that nothing has changed after a couple of buffer swaps
2863   application.Render(0);
2864   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2865   application.Render(0);
2866   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2867   END_TEST;
2868 }
2869
2870 int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void)
2871 {
2872   TestApplication application;
2873
2874   Actor actor = Actor::New();
2875
2876   // Register a boolean property
2877   bool startValue(false);
2878   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
2879   Stage::GetCurrent().Add(actor);
2880   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2881   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
2882
2883   // Build the animation
2884   float durationSeconds(2.0f);
2885   Animation animation = Animation::New(durationSeconds);
2886   bool relativeValue(true);
2887   bool finalValue( false || relativeValue );
2888   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN);
2889
2890   // Start the animation
2891   animation.Play();
2892
2893   bool signalReceived(false);
2894   AnimationFinishCheck finishCheck(signalReceived);
2895   animation.FinishedSignal().Connect(&application, finishCheck);
2896
2897   application.SendNotification();
2898   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2899
2900   // We didn't expect the animation to finish yet
2901   application.SendNotification();
2902   finishCheck.CheckSignalNotReceived();
2903   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
2904
2905   application.SendNotification();
2906   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2907
2908   // We did expect the animation to finish
2909   application.SendNotification();
2910   finishCheck.CheckSignalReceived();
2911   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2912
2913   // Check that nothing has changed after a couple of buffer swaps
2914   application.Render(0);
2915   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2916   application.Render(0);
2917   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2918
2919   // Repeat with relative value "false" - this should be an NOOP
2920   animation = Animation::New(durationSeconds);
2921   bool noOpValue(false);
2922   animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunction::EASE_IN);
2923
2924   // Start the animation
2925   animation.Play();
2926
2927   finishCheck.Reset();
2928   animation.FinishedSignal().Connect(&application, finishCheck);
2929
2930   application.SendNotification();
2931   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2932
2933   // We didn't expect the animation to finish yet
2934   application.SendNotification();
2935   finishCheck.CheckSignalNotReceived();
2936   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2937
2938   application.SendNotification();
2939   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2940
2941   // We did expect the animation to finish
2942   application.SendNotification();
2943   finishCheck.CheckSignalReceived();
2944   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2945   END_TEST;
2946 }
2947
2948 int UtcDaliAnimationAnimateByBooleanTimePeriodP(void)
2949 {
2950   TestApplication application;
2951
2952   Actor actor = Actor::New();
2953
2954   // Register a boolean property
2955   bool startValue(false);
2956   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
2957   Stage::GetCurrent().Add(actor);
2958   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2959   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
2960
2961   // Build the animation
2962   float durationSeconds(2.0f);
2963   Animation animation = Animation::New(durationSeconds);
2964   bool relativeValue(true);
2965   bool finalValue( false || relativeValue );
2966   float animatorDurationSeconds(durationSeconds * 0.5f);
2967   animation.AnimateBy( Property(actor, index),
2968                        relativeValue,
2969                        TimePeriod( animatorDurationSeconds ) );
2970
2971   // Start the animation
2972   animation.Play();
2973
2974   bool signalReceived(false);
2975   AnimationFinishCheck finishCheck(signalReceived);
2976   animation.FinishedSignal().Connect(&application, finishCheck);
2977
2978   application.SendNotification();
2979   application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
2980
2981   // We didn't expect the animation to finish yet
2982   application.SendNotification();
2983   finishCheck.CheckSignalNotReceived();
2984   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
2985
2986   application.SendNotification();
2987   application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
2988
2989   // We didn't expect the animation to finish yet...
2990   application.SendNotification();
2991   finishCheck.CheckSignalNotReceived();
2992
2993   // ...however we should have reached the final value
2994   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
2995
2996   application.SendNotification();
2997   application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
2998
2999   // We did expect the animation to finish
3000   application.SendNotification();
3001   finishCheck.CheckSignalReceived();
3002   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
3003
3004   // Check that nothing has changed after a couple of buffer swaps
3005   application.Render(0);
3006   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
3007   application.Render(0);
3008   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
3009   END_TEST;
3010 }
3011
3012 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void)
3013 {
3014   TestApplication application;
3015
3016   Actor actor = Actor::New();
3017
3018   // Register a boolean property
3019   bool startValue(false);
3020   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3021   Stage::GetCurrent().Add(actor);
3022   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3023   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
3024
3025   // Build the animation
3026   float durationSeconds(2.0f);
3027   Animation animation = Animation::New(durationSeconds);
3028   bool relativeValue(true);
3029   bool finalValue( false || relativeValue );
3030   float animatorDurationSeconds(durationSeconds * 0.5f);
3031   animation.AnimateBy( Property(actor, index),
3032                        relativeValue,
3033                        AlphaFunction::EASE_IN_OUT,
3034                        TimePeriod( animatorDurationSeconds ) );
3035
3036   // Start the animation
3037   animation.Play();
3038
3039   bool signalReceived(false);
3040   AnimationFinishCheck finishCheck(signalReceived);
3041   animation.FinishedSignal().Connect(&application, finishCheck);
3042
3043   application.SendNotification();
3044   application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
3045
3046   // We didn't expect the animation to finish yet
3047   application.SendNotification();
3048   finishCheck.CheckSignalNotReceived();
3049   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
3050
3051   application.SendNotification();
3052   application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
3053
3054   // We didn't expect the animation to finish yet...
3055   application.SendNotification();
3056   finishCheck.CheckSignalNotReceived();
3057
3058   // ...however we should have reached the final value
3059   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
3060
3061   application.SendNotification();
3062   application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
3063
3064   // We did expect the animation to finish
3065   application.SendNotification();
3066   finishCheck.CheckSignalReceived();
3067   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
3068
3069   // Check that nothing has changed after a couple of buffer swaps
3070   application.Render(0);
3071   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
3072   application.Render(0);
3073   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
3074   END_TEST;
3075 }
3076
3077 int UtcDaliAnimationAnimateByFloatP(void)
3078 {
3079   TestApplication application;
3080
3081   Actor actor = Actor::New();
3082
3083   // Register a float property
3084   float startValue(10.0f);
3085   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3086   Stage::GetCurrent().Add(actor);
3087   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3088   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
3089
3090   // Build the animation
3091   float durationSeconds(2.0f);
3092   Animation animation = Animation::New(durationSeconds);
3093   float targetValue(50.0f);
3094   float relativeValue(targetValue - startValue);
3095   animation.AnimateBy(Property(actor, index), relativeValue);
3096
3097   float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3098
3099   // Start the animation
3100   animation.Play();
3101
3102   bool signalReceived(false);
3103   AnimationFinishCheck finishCheck(signalReceived);
3104   animation.FinishedSignal().Connect(&application, finishCheck);
3105
3106   application.SendNotification();
3107   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3108
3109   // We didn't expect the animation to finish yet
3110   application.SendNotification();
3111   finishCheck.CheckSignalNotReceived();
3112   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
3113
3114   application.SendNotification();
3115   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3116
3117   // We did expect the animation to finish
3118   application.SendNotification();
3119   finishCheck.CheckSignalReceived();
3120   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3121
3122   // Check that nothing has changed after a couple of buffer swaps
3123   application.Render(0);
3124   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3125   application.Render(0);
3126   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3127   END_TEST;
3128 }
3129
3130 int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void)
3131 {
3132   TestApplication application;
3133
3134   Actor actor = Actor::New();
3135
3136   // Register a float property
3137   float startValue(10.0f);
3138   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3139   Stage::GetCurrent().Add(actor);
3140   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3141   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
3142
3143   // Build the animation
3144   float durationSeconds(1.0f);
3145   Animation animation = Animation::New(durationSeconds);
3146   float targetValue(90.0f);
3147   float relativeValue(targetValue - startValue);
3148   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3149
3150   float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3151
3152   // Start the animation
3153   animation.Play();
3154
3155   bool signalReceived(false);
3156   AnimationFinishCheck finishCheck(signalReceived);
3157   animation.FinishedSignal().Connect(&application, finishCheck);
3158
3159   application.SendNotification();
3160   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3161
3162   // We didn't expect the animation to finish yet
3163   application.SendNotification();
3164   finishCheck.CheckSignalNotReceived();
3165
3166   // The position should have moved more, than with a linear alpha function
3167   float current( DevelHandle::GetCurrentProperty< float >( actor, index ) );
3168   DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3169
3170   application.SendNotification();
3171   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3172
3173   // We did expect the animation to finish
3174   application.SendNotification();
3175   finishCheck.CheckSignalReceived();
3176   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3177
3178   // Check that nothing has changed after a couple of buffer swaps
3179   application.Render(0);
3180   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3181   application.Render(0);
3182   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3183   END_TEST;
3184 }
3185
3186 int UtcDaliAnimationAnimateByFloatTimePeriodP(void)
3187 {
3188   TestApplication application;
3189
3190   Actor actor = Actor::New();
3191
3192   // Register a float property
3193   float startValue(10.0f);
3194   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3195   Stage::GetCurrent().Add(actor);
3196   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3197   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
3198
3199   // Build the animation
3200   float durationSeconds(1.0f);
3201   Animation animation = Animation::New(durationSeconds);
3202   float targetValue(30.0f);
3203   float relativeValue(targetValue - startValue);
3204   float delay = 0.5f;
3205   animation.AnimateBy(Property(actor, index),
3206                       relativeValue,
3207                       TimePeriod(delay, durationSeconds - delay));
3208
3209   // Start the animation
3210   animation.Play();
3211
3212   bool signalReceived(false);
3213   AnimationFinishCheck finishCheck(signalReceived);
3214   animation.FinishedSignal().Connect(&application, finishCheck);
3215
3216   application.SendNotification();
3217   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3218
3219   // We didn't expect the animation to finish yet
3220   application.SendNotification();
3221   finishCheck.CheckSignalNotReceived();
3222   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
3223
3224   application.SendNotification();
3225   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3226
3227   // We didn't expect the animation to finish yet
3228   application.SendNotification();
3229   finishCheck.CheckSignalNotReceived();
3230   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3231
3232   application.SendNotification();
3233   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3234
3235   // We did expect the animation to finish
3236   application.SendNotification();
3237   finishCheck.CheckSignalReceived();
3238   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3239
3240   // Check that nothing has changed after a couple of buffer swaps
3241   application.Render(0);
3242   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3243   application.Render(0);
3244   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3245   END_TEST;
3246 }
3247
3248 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void)
3249 {
3250   TestApplication application;
3251
3252   Actor actor = Actor::New();
3253
3254   // Register a float property
3255   float startValue(10.0f);
3256   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3257   Stage::GetCurrent().Add(actor);
3258   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3259   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
3260
3261   // Build the animation
3262   float durationSeconds(1.0f);
3263   Animation animation = Animation::New(durationSeconds);
3264   float targetValue(30.0f);
3265   float relativeValue(targetValue - startValue);
3266   float delay = 0.5f;
3267   animation.AnimateBy(Property(actor, index),
3268                       relativeValue,
3269                       AlphaFunction::LINEAR,
3270                       TimePeriod(delay, durationSeconds - delay));
3271
3272   // Start the animation
3273   animation.Play();
3274
3275   bool signalReceived(false);
3276   AnimationFinishCheck finishCheck(signalReceived);
3277   animation.FinishedSignal().Connect(&application, finishCheck);
3278
3279   application.SendNotification();
3280   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3281
3282   // We didn't expect the animation to finish yet
3283   application.SendNotification();
3284   finishCheck.CheckSignalNotReceived();
3285   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
3286
3287   application.SendNotification();
3288   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3289
3290   // We didn't expect the animation to finish yet
3291   application.SendNotification();
3292   finishCheck.CheckSignalNotReceived();
3293   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3294
3295   application.SendNotification();
3296   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3297
3298   // We did expect the animation to finish
3299   application.SendNotification();
3300   finishCheck.CheckSignalReceived();
3301   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3302
3303   // Check that nothing has changed after a couple of buffer swaps
3304   application.Render(0);
3305   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3306   application.Render(0);
3307   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
3308   END_TEST;
3309 }
3310
3311 int UtcDaliAnimationAnimateByIntegerP(void)
3312 {
3313   TestApplication application;
3314
3315   Actor actor = Actor::New();
3316
3317   // Register an integer property
3318   int startValue(1);
3319   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3320   Stage::GetCurrent().Add(actor);
3321   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3322   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
3323
3324   // Build the animation
3325   float durationSeconds(2.0f);
3326   Animation animation = Animation::New(durationSeconds);
3327   int targetValue(50);
3328   int relativeValue(targetValue - startValue);
3329   animation.AnimateBy(Property(actor, index), relativeValue);
3330
3331   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3332
3333   // Start the animation
3334   animation.Play();
3335
3336   bool signalReceived(false);
3337   AnimationFinishCheck finishCheck(signalReceived);
3338   animation.FinishedSignal().Connect(&application, finishCheck);
3339
3340   application.SendNotification();
3341   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3342
3343   // We didn't expect the animation to finish yet
3344   application.SendNotification();
3345   finishCheck.CheckSignalNotReceived();
3346   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
3347
3348   application.SendNotification();
3349   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3350
3351   // We did expect the animation to finish
3352   application.SendNotification();
3353   finishCheck.CheckSignalReceived();
3354   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3355
3356   // Check that nothing has changed after a couple of buffer swaps
3357   application.Render(0);
3358   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3359   application.Render(0);
3360   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3361   END_TEST;
3362 }
3363
3364 int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void)
3365 {
3366   TestApplication application;
3367
3368   Actor actor = Actor::New();
3369
3370   // Register an integer property
3371   int startValue(1);
3372   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3373   Stage::GetCurrent().Add(actor);
3374   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3375   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
3376
3377   // Build the animation
3378   float durationSeconds(1.0f);
3379   Animation animation = Animation::New(durationSeconds);
3380   int targetValue(90);
3381   int relativeValue(targetValue - startValue);
3382   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3383
3384   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3385
3386   // Start the animation
3387   animation.Play();
3388
3389   bool signalReceived(false);
3390   AnimationFinishCheck finishCheck(signalReceived);
3391   animation.FinishedSignal().Connect(&application, finishCheck);
3392
3393   application.SendNotification();
3394   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3395
3396   // We didn't expect the animation to finish yet
3397   application.SendNotification();
3398   finishCheck.CheckSignalNotReceived();
3399
3400   // The position should have moved more, than with a linear alpha function
3401   int current( DevelHandle::GetCurrentProperty< int >( actor, index ) );
3402   DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3403
3404   application.SendNotification();
3405   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3406
3407   // We did expect the animation to finish
3408   application.SendNotification();
3409   finishCheck.CheckSignalReceived();
3410   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3411
3412   // Check that nothing has changed after a couple of buffer swaps
3413   application.Render(0);
3414   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3415   application.Render(0);
3416   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3417   END_TEST;
3418 }
3419
3420 int UtcDaliAnimationAnimateByIntegerTimePeriodP(void)
3421 {
3422   TestApplication application;
3423
3424   Actor actor = Actor::New();
3425
3426   // Register an integer property
3427   int startValue(10);
3428   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3429   Stage::GetCurrent().Add(actor);
3430   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3431   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
3432
3433   // Build the animation
3434   float durationSeconds(1.0f);
3435   Animation animation = Animation::New(durationSeconds);
3436   int targetValue(30);
3437   int relativeValue(targetValue - startValue);
3438   float delay = 0.5f;
3439   animation.AnimateBy(Property(actor, index),
3440                       relativeValue,
3441                       TimePeriod(delay, durationSeconds - delay));
3442
3443   // Start the animation
3444   animation.Play();
3445
3446   bool signalReceived(false);
3447   AnimationFinishCheck finishCheck(signalReceived);
3448   animation.FinishedSignal().Connect(&application, finishCheck);
3449
3450   application.SendNotification();
3451   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3452
3453   // We didn't expect the animation to finish yet
3454   application.SendNotification();
3455   finishCheck.CheckSignalNotReceived();
3456   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
3457
3458   application.SendNotification();
3459   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3460
3461   // We didn't expect the animation to finish yet
3462   application.SendNotification();
3463   finishCheck.CheckSignalNotReceived();
3464   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3465
3466   application.SendNotification();
3467   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3468
3469   // We did expect the animation to finish
3470   application.SendNotification();
3471   finishCheck.CheckSignalReceived();
3472   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3473
3474   // Check that nothing has changed after a couple of buffer swaps
3475   application.Render(0);
3476   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3477   application.Render(0);
3478   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3479   END_TEST;
3480 }
3481
3482 int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void)
3483 {
3484   TestApplication application;
3485
3486   Actor actor = Actor::New();
3487
3488   // Register an integer property
3489   int startValue(10);
3490   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3491   Stage::GetCurrent().Add(actor);
3492   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3493   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
3494
3495   // Build the animation
3496   float durationSeconds(1.0f);
3497   Animation animation = Animation::New(durationSeconds);
3498   int targetValue(30);
3499   int relativeValue(targetValue - startValue);
3500   float delay = 0.5f;
3501   animation.AnimateBy(Property(actor, index),
3502                       relativeValue,
3503                       AlphaFunction::LINEAR,
3504                       TimePeriod(delay, durationSeconds - delay));
3505
3506   // Start the animation
3507   animation.Play();
3508
3509   bool signalReceived(false);
3510   AnimationFinishCheck finishCheck(signalReceived);
3511   animation.FinishedSignal().Connect(&application, finishCheck);
3512
3513   application.SendNotification();
3514   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3515
3516   // We didn't expect the animation to finish yet
3517   application.SendNotification();
3518   finishCheck.CheckSignalNotReceived();
3519   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
3520
3521   application.SendNotification();
3522   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3523
3524   // We didn't expect the animation to finish yet
3525   application.SendNotification();
3526   finishCheck.CheckSignalNotReceived();
3527   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3528
3529   application.SendNotification();
3530   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3531
3532   // We did expect the animation to finish
3533   application.SendNotification();
3534   finishCheck.CheckSignalReceived();
3535   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3536
3537   // Check that nothing has changed after a couple of buffer swaps
3538   application.Render(0);
3539   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3540   application.Render(0);
3541   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
3542   END_TEST;
3543 }
3544
3545 int UtcDaliAnimationAnimateByVector2P(void)
3546 {
3547   TestApplication application;
3548
3549   Actor actor = Actor::New();
3550
3551   // Register a Vector2 property
3552   Vector2 startValue(10.0f, 10.0f);
3553   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3554   Stage::GetCurrent().Add(actor);
3555   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3556   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
3557
3558   // Build the animation
3559   float durationSeconds(2.0f);
3560   Animation animation = Animation::New(durationSeconds);
3561   Vector2 targetValue(60.0f, 60.0f);
3562   Vector2 relativeValue(targetValue - startValue);
3563   animation.AnimateBy(Property(actor, index), relativeValue);
3564
3565   Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3566
3567   // Start the animation
3568   animation.Play();
3569
3570   bool signalReceived(false);
3571   AnimationFinishCheck finishCheck(signalReceived);
3572   animation.FinishedSignal().Connect(&application, finishCheck);
3573
3574   application.SendNotification();
3575   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3576
3577   // We didn't expect the animation to finish yet
3578   application.SendNotification();
3579   finishCheck.CheckSignalNotReceived();
3580   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
3581
3582   application.SendNotification();
3583   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3584
3585   // We did expect the animation to finish
3586   application.SendNotification();
3587   finishCheck.CheckSignalReceived();
3588   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3589
3590   // Check that nothing has changed after a couple of buffer swaps
3591   application.Render(0);
3592   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3593   application.Render(0);
3594   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3595   END_TEST;
3596 }
3597
3598 int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void)
3599 {
3600   TestApplication application;
3601
3602   Actor actor = Actor::New();
3603
3604   // Register a Vector2 property
3605   Vector2 startValue(100.0f, 100.0f);
3606   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3607   Stage::GetCurrent().Add(actor);
3608   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3609   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
3610
3611   // Build the animation
3612   float durationSeconds(1.0f);
3613   Animation animation = Animation::New(durationSeconds);
3614   Vector2 targetValue(20.0f, 20.0f);
3615   Vector2 relativeValue(targetValue - startValue);
3616   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3617
3618   Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3619
3620   // Start the animation
3621   animation.Play();
3622
3623   bool signalReceived(false);
3624   AnimationFinishCheck finishCheck(signalReceived);
3625   animation.FinishedSignal().Connect(&application, finishCheck);
3626
3627   application.SendNotification();
3628   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3629
3630   // We didn't expect the animation to finish yet
3631   application.SendNotification();
3632   finishCheck.CheckSignalNotReceived();
3633
3634   // The position should have moved more, than with a linear alpha function
3635   Vector2 current( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ) );
3636   DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3637   DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3638
3639   application.SendNotification();
3640   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3641
3642   // We did expect the animation to finish
3643   application.SendNotification();
3644   finishCheck.CheckSignalReceived();
3645   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3646
3647   // Check that nothing has changed after a couple of buffer swaps
3648   application.Render(0);
3649   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3650   application.Render(0);
3651   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3652   END_TEST;
3653 }
3654
3655 int UtcDaliAnimationAnimateByVector2TimePeriodP(void)
3656 {
3657   TestApplication application;
3658
3659   Actor actor = Actor::New();
3660
3661   // Register a Vector2 property
3662   Vector2 startValue(10.0f, 10.0f);
3663   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3664   Stage::GetCurrent().Add(actor);
3665   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3666   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
3667
3668   // Build the animation
3669   float durationSeconds(1.0f);
3670   Animation animation = Animation::New(durationSeconds);
3671   Vector2 targetValue(30.0f, 30.0f);
3672   Vector2 relativeValue(targetValue - startValue);
3673   float delay = 0.5f;
3674   animation.AnimateBy(Property(actor, index),
3675                       relativeValue,
3676                       TimePeriod(delay, durationSeconds - delay));
3677
3678   // Start the animation
3679   animation.Play();
3680
3681   bool signalReceived(false);
3682   AnimationFinishCheck finishCheck(signalReceived);
3683   animation.FinishedSignal().Connect(&application, finishCheck);
3684
3685   application.SendNotification();
3686   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3687
3688   // We didn't expect the animation to finish yet
3689   application.SendNotification();
3690   finishCheck.CheckSignalNotReceived();
3691   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
3692
3693   application.SendNotification();
3694   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3695
3696   // We didn't expect the animation to finish yet
3697   application.SendNotification();
3698   finishCheck.CheckSignalNotReceived();
3699   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3700
3701   application.SendNotification();
3702   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3703
3704   // We did expect the animation to finish
3705   application.SendNotification();
3706   finishCheck.CheckSignalReceived();
3707   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3708
3709   // Check that nothing has changed after a couple of buffer swaps
3710   application.Render(0);
3711   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3712   application.Render(0);
3713   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3714   END_TEST;
3715 }
3716
3717 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void)
3718 {
3719   TestApplication application;
3720
3721   Actor actor = Actor::New();
3722
3723   // Register a Vector2 property
3724   Vector2 startValue(5.0f, 5.0f);
3725   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3726   Stage::GetCurrent().Add(actor);
3727   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3728   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
3729
3730   // Build the animation
3731   float durationSeconds(1.0f);
3732   Animation animation = Animation::New(durationSeconds);
3733   Vector2 targetValue(10.0f, 10.0f);
3734   Vector2 relativeValue(targetValue - startValue);
3735   float delay = 0.5f;
3736   animation.AnimateBy(Property(actor, index),
3737                       relativeValue,
3738                       AlphaFunction::LINEAR,
3739                       TimePeriod(delay, durationSeconds - delay));
3740
3741   // Start the animation
3742   animation.Play();
3743
3744   bool signalReceived(false);
3745   AnimationFinishCheck finishCheck(signalReceived);
3746   animation.FinishedSignal().Connect(&application, finishCheck);
3747
3748   application.SendNotification();
3749   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3750
3751   // We didn't expect the animation to finish yet
3752   application.SendNotification();
3753   finishCheck.CheckSignalNotReceived();
3754   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
3755
3756   application.SendNotification();
3757   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3758
3759   // We didn't expect the animation to finish yet
3760   application.SendNotification();
3761   finishCheck.CheckSignalNotReceived();
3762   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3763
3764   application.SendNotification();
3765   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3766
3767   // We did expect the animation to finish
3768   application.SendNotification();
3769   finishCheck.CheckSignalReceived();
3770   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3771
3772   // Check that nothing has changed after a couple of buffer swaps
3773   application.Render(0);
3774   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3775   application.Render(0);
3776   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
3777   END_TEST;
3778 }
3779
3780 int UtcDaliAnimationAnimateByVector3P(void)
3781 {
3782   TestApplication application;
3783
3784   Actor actor = Actor::New();
3785
3786   // Register a Vector3 property
3787   Vector3 startValue(10.0f, 10.0f, 10.0f);
3788   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3789   Stage::GetCurrent().Add(actor);
3790   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3791   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
3792
3793   // Build the animation
3794   float durationSeconds(2.0f);
3795   Animation animation = Animation::New(durationSeconds);
3796   Vector3 targetValue(60.0f, 60.0f, 60.0f);
3797   Vector3 relativeValue(targetValue - startValue);
3798   animation.AnimateBy(Property(actor, index), relativeValue);
3799
3800   Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3801
3802   // Start the animation
3803   animation.Play();
3804
3805   bool signalReceived(false);
3806   AnimationFinishCheck finishCheck(signalReceived);
3807   animation.FinishedSignal().Connect(&application, finishCheck);
3808
3809   application.SendNotification();
3810   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3811
3812   // We didn't expect the animation to finish yet
3813   application.SendNotification();
3814   finishCheck.CheckSignalNotReceived();
3815   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
3816
3817   application.SendNotification();
3818   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3819
3820   // We did expect the animation to finish
3821   application.SendNotification();
3822   finishCheck.CheckSignalReceived();
3823   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3824
3825   // Check that nothing has changed after a couple of buffer swaps
3826   application.Render(0);
3827   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3828   application.Render(0);
3829   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3830   END_TEST;
3831 }
3832
3833 int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void)
3834 {
3835   TestApplication application;
3836
3837   Actor actor = Actor::New();
3838
3839   // Register a Vector3 property
3840   Vector3 startValue(100.0f, 100.0f, 100.0f);
3841   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3842   Stage::GetCurrent().Add(actor);
3843   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3844   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
3845
3846   // Build the animation
3847   float durationSeconds(1.0f);
3848   Animation animation = Animation::New(durationSeconds);
3849   Vector3 targetValue(20.0f, 20.0f, 20.0f);
3850   Vector3 relativeValue(targetValue - startValue);
3851   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3852
3853   Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3854
3855   // Start the animation
3856   animation.Play();
3857
3858   bool signalReceived(false);
3859   AnimationFinishCheck finishCheck(signalReceived);
3860   animation.FinishedSignal().Connect(&application, finishCheck);
3861
3862   application.SendNotification();
3863   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3864
3865   // We didn't expect the animation to finish yet
3866   application.SendNotification();
3867   finishCheck.CheckSignalNotReceived();
3868
3869   // The position should have moved more, than with a linear alpha function
3870   Vector3 current(DevelHandle::GetCurrentProperty< Vector3 >( actor, index ));
3871   DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3872   DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3873   DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
3874
3875   application.SendNotification();
3876   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3877
3878   // We did expect the animation to finish
3879   application.SendNotification();
3880   finishCheck.CheckSignalReceived();
3881   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3882
3883   // Check that nothing has changed after a couple of buffer swaps
3884   application.Render(0);
3885   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3886   application.Render(0);
3887   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3888   END_TEST;
3889 }
3890
3891 int UtcDaliAnimationAnimateByVector3TimePeriodP(void)
3892 {
3893   TestApplication application;
3894
3895   Actor actor = Actor::New();
3896
3897   // Register a Vector3 property
3898   Vector3 startValue(10.0f, 10.0f, 10.0f);
3899   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3900   Stage::GetCurrent().Add(actor);
3901   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3902   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
3903
3904   // Build the animation
3905   float durationSeconds(1.0f);
3906   Animation animation = Animation::New(durationSeconds);
3907   Vector3 targetValue(30.0f, 30.0f, 30.0f);
3908   Vector3 relativeValue(targetValue - startValue);
3909   float delay = 0.5f;
3910   animation.AnimateBy(Property(actor, index),
3911                       relativeValue,
3912                       TimePeriod(delay, durationSeconds - delay));
3913
3914   // Start the animation
3915   animation.Play();
3916
3917   bool signalReceived(false);
3918   AnimationFinishCheck finishCheck(signalReceived);
3919   animation.FinishedSignal().Connect(&application, finishCheck);
3920
3921   application.SendNotification();
3922   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3923
3924   // We didn't expect the animation to finish yet
3925   application.SendNotification();
3926   finishCheck.CheckSignalNotReceived();
3927   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
3928
3929   application.SendNotification();
3930   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3931
3932   // We didn't expect the animation to finish yet
3933   application.SendNotification();
3934   finishCheck.CheckSignalNotReceived();
3935   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3936
3937   application.SendNotification();
3938   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3939
3940   // We did expect the animation to finish
3941   application.SendNotification();
3942   finishCheck.CheckSignalReceived();
3943   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3944
3945   // Check that nothing has changed after a couple of buffer swaps
3946   application.Render(0);
3947   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3948   application.Render(0);
3949   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
3950   END_TEST;
3951 }
3952
3953 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void)
3954 {
3955   TestApplication application;
3956
3957   Actor actor = Actor::New();
3958
3959   // Register a Vector3 property
3960   Vector3 startValue(5.0f, 5.0f, 5.0f);
3961   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3962   Stage::GetCurrent().Add(actor);
3963   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3964   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
3965
3966   // Build the animation
3967   float durationSeconds(1.0f);
3968   Animation animation = Animation::New(durationSeconds);
3969   Vector3 targetValue(10.0f, 10.0f, 10.0f);
3970   Vector3 relativeValue(targetValue - startValue);
3971   float delay = 0.5f;
3972   animation.AnimateBy(Property(actor, index),
3973                       relativeValue,
3974                       AlphaFunction::LINEAR,
3975                       TimePeriod(delay, durationSeconds - delay));
3976
3977   // Start the animation
3978   animation.Play();
3979
3980   bool signalReceived(false);
3981   AnimationFinishCheck finishCheck(signalReceived);
3982   animation.FinishedSignal().Connect(&application, finishCheck);
3983
3984   application.SendNotification();
3985   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3986
3987   // We didn't expect the animation to finish yet
3988   application.SendNotification();
3989   finishCheck.CheckSignalNotReceived();
3990   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
3991
3992   application.SendNotification();
3993   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3994
3995   // We didn't expect the animation to finish yet
3996   application.SendNotification();
3997   finishCheck.CheckSignalNotReceived();
3998   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3999
4000   application.SendNotification();
4001   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4002
4003   // We did expect the animation to finish
4004   application.SendNotification();
4005   finishCheck.CheckSignalReceived();
4006   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
4007
4008   // Check that nothing has changed after a couple of buffer swaps
4009   application.Render(0);
4010   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
4011   application.Render(0);
4012   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
4013   END_TEST;
4014 }
4015
4016 int UtcDaliAnimationAnimateByVector4P(void)
4017 {
4018   TestApplication application;
4019
4020   Actor actor = Actor::New();
4021
4022   // Register a Vector4 property
4023   Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4024   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4025   Stage::GetCurrent().Add(actor);
4026   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4027   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
4028
4029   // Build the animation
4030   float durationSeconds(2.0f);
4031   Animation animation = Animation::New(durationSeconds);
4032   Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f);
4033   Vector4 relativeValue(targetValue - startValue);
4034   animation.AnimateBy(Property(actor, index), relativeValue);
4035
4036   Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4037
4038   // Start the animation
4039   animation.Play();
4040
4041   bool signalReceived(false);
4042   AnimationFinishCheck finishCheck(signalReceived);
4043   animation.FinishedSignal().Connect(&application, finishCheck);
4044
4045   application.SendNotification();
4046   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4047
4048   // We didn't expect the animation to finish yet
4049   application.SendNotification();
4050   finishCheck.CheckSignalNotReceived();
4051   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
4052
4053   application.SendNotification();
4054   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4055
4056   // We did expect the animation to finish
4057   application.SendNotification();
4058   finishCheck.CheckSignalReceived();
4059   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4060
4061   // Check that nothing has changed after a couple of buffer swaps
4062   application.Render(0);
4063   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4064   application.Render(0);
4065   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4066   END_TEST;
4067 }
4068
4069 int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void)
4070 {
4071   TestApplication application;
4072
4073   Actor actor = Actor::New();
4074
4075   // Register a Vector4 property
4076   Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f);
4077   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4078   Stage::GetCurrent().Add(actor);
4079   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4080   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
4081
4082   // Build the animation
4083   float durationSeconds(1.0f);
4084   Animation animation = Animation::New(durationSeconds);
4085   Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
4086   Vector4 relativeValue(targetValue - startValue);
4087   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4088
4089   Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4090
4091   // Start the animation
4092   animation.Play();
4093
4094   bool signalReceived(false);
4095   AnimationFinishCheck finishCheck(signalReceived);
4096   animation.FinishedSignal().Connect(&application, finishCheck);
4097
4098   application.SendNotification();
4099   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4100
4101   // We didn't expect the animation to finish yet
4102   application.SendNotification();
4103   finishCheck.CheckSignalNotReceived();
4104
4105   // The position should have moved more, than with a linear alpha function
4106   Vector4 current( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ) );
4107   DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
4108   DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
4109   DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
4110   DALI_TEST_CHECK( current.w < ninetyFivePercentProgress.w );
4111
4112   application.SendNotification();
4113   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4114
4115   // We did expect the animation to finish
4116   application.SendNotification();
4117   finishCheck.CheckSignalReceived();
4118   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4119
4120   // Check that nothing has changed after a couple of buffer swaps
4121   application.Render(0);
4122   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4123   application.Render(0);
4124   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4125   END_TEST;
4126 }
4127
4128 int UtcDaliAnimationAnimateByVector4TimePeriodP(void)
4129 {
4130   TestApplication application;
4131
4132   Actor actor = Actor::New();
4133
4134   // Register a Vector4 property
4135   Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4136   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4137   Stage::GetCurrent().Add(actor);
4138   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4139   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
4140
4141   // Build the animation
4142   float durationSeconds(1.0f);
4143   Animation animation = Animation::New(durationSeconds);
4144   Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
4145   Vector4 relativeValue(targetValue - startValue);
4146   float delay = 0.5f;
4147   animation.AnimateBy(Property(actor, index),
4148                       relativeValue,
4149                       TimePeriod(delay, durationSeconds - delay));
4150
4151   // Start the animation
4152   animation.Play();
4153
4154   bool signalReceived(false);
4155   AnimationFinishCheck finishCheck(signalReceived);
4156   animation.FinishedSignal().Connect(&application, finishCheck);
4157
4158   application.SendNotification();
4159   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4160
4161   // We didn't expect the animation to finish yet
4162   application.SendNotification();
4163   finishCheck.CheckSignalNotReceived();
4164   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
4165
4166   application.SendNotification();
4167   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4168
4169   // We didn't expect the animation to finish yet
4170   application.SendNotification();
4171   finishCheck.CheckSignalNotReceived();
4172   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4173
4174   application.SendNotification();
4175   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4176
4177   // We did expect the animation to finish
4178   application.SendNotification();
4179   finishCheck.CheckSignalReceived();
4180   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4181
4182   // Check that nothing has changed after a couple of buffer swaps
4183   application.Render(0);
4184   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4185   application.Render(0);
4186   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4187   END_TEST;
4188 }
4189
4190 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void)
4191 {
4192   TestApplication application;
4193
4194   Actor actor = Actor::New();
4195
4196   // Register a Vector4 property
4197   Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f);
4198   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4199   Stage::GetCurrent().Add(actor);
4200   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4201   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
4202
4203   // Build the animation
4204   float durationSeconds(1.0f);
4205   Animation animation = Animation::New(durationSeconds);
4206   Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f);
4207   Vector4 relativeValue(targetValue - startValue);
4208   float delay = 0.5f;
4209   animation.AnimateBy(Property(actor, index),
4210                       relativeValue,
4211                       AlphaFunction::LINEAR,
4212                       TimePeriod(delay, durationSeconds - delay));
4213
4214   // Start the animation
4215   animation.Play();
4216
4217   bool signalReceived(false);
4218   AnimationFinishCheck finishCheck(signalReceived);
4219   animation.FinishedSignal().Connect(&application, finishCheck);
4220
4221   application.SendNotification();
4222   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4223
4224   // We didn't expect the animation to finish yet
4225   application.SendNotification();
4226   finishCheck.CheckSignalNotReceived();
4227   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
4228
4229   application.SendNotification();
4230   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4231
4232   // We didn't expect the animation to finish yet
4233   application.SendNotification();
4234   finishCheck.CheckSignalNotReceived();
4235   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4236
4237   application.SendNotification();
4238   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4239
4240   // We did expect the animation to finish
4241   application.SendNotification();
4242   finishCheck.CheckSignalReceived();
4243   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4244
4245   // Check that nothing has changed after a couple of buffer swaps
4246   application.Render(0);
4247   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4248   application.Render(0);
4249   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
4250   END_TEST;
4251 }
4252
4253 int UtcDaliAnimationAnimateByActorPositionP(void)
4254 {
4255   TestApplication application;
4256
4257   Actor actor = Actor::New();
4258   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4259   actor.SetPosition(startPosition);
4260   Stage::GetCurrent().Add(actor);
4261   application.SendNotification();
4262   application.Render(0);
4263   DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4264
4265   // Build the animation
4266   float durationSeconds(1.0f);
4267   Animation animation = Animation::New(durationSeconds);
4268   Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4269   Vector3 relativePosition(targetPosition - startPosition);
4270   animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition);
4271
4272   Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4273
4274   // Start the animation
4275   animation.Play();
4276
4277   bool signalReceived(false);
4278   AnimationFinishCheck finishCheck(signalReceived);
4279   animation.FinishedSignal().Connect(&application, finishCheck);
4280
4281   application.SendNotification();
4282   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4283
4284   // We didn't expect the animation to finish yet
4285   application.SendNotification();
4286   finishCheck.CheckSignalNotReceived();
4287   DALI_TEST_EQUALS( actor.GetCurrentPosition(), ninetyFivePercentProgress, TEST_LOCATION );
4288
4289   application.SendNotification();
4290   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4291
4292   // We did expect the animation to finish
4293   application.SendNotification();
4294   finishCheck.CheckSignalReceived();
4295   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4296
4297   // Check that nothing has changed after a couple of buffer swaps
4298   application.Render(0);
4299   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4300   application.Render(0);
4301   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4302   END_TEST;
4303 }
4304
4305 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
4306 {
4307   TestApplication application;
4308
4309   Actor actor = Actor::New();
4310   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4311   actor.SetPosition(startPosition);
4312   Stage::GetCurrent().Add(actor);
4313   application.SendNotification();
4314   application.Render(0);
4315   DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4316
4317   // Build the animation
4318   float durationSeconds(1.0f);
4319   Animation animation = Animation::New(durationSeconds);
4320   Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4321   Vector3 relativePosition(targetPosition - startPosition);
4322   animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
4323
4324   Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4325
4326   // Start the animation
4327   animation.Play();
4328
4329   bool signalReceived(false);
4330   AnimationFinishCheck finishCheck(signalReceived);
4331   animation.FinishedSignal().Connect(&application, finishCheck);
4332
4333   application.SendNotification();
4334   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4335
4336   // We didn't expect the animation to finish yet
4337   application.SendNotification();
4338   finishCheck.CheckSignalNotReceived();
4339
4340   // The position should have moved more, than with a linear alpha function
4341   Vector3 current(actor.GetCurrentPosition());
4342   DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
4343   DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
4344   DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
4345
4346   application.SendNotification();
4347   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4348
4349   // We did expect the animation to finish
4350   application.SendNotification();
4351   finishCheck.CheckSignalReceived();
4352   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4353
4354   // Check that nothing has changed after a couple of buffer swaps
4355   application.Render(0);
4356   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4357   application.Render(0);
4358   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4359   END_TEST;
4360 }
4361
4362 int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void)
4363 {
4364   TestApplication application;
4365
4366   Actor actor = Actor::New();
4367   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4368   actor.SetPosition(startPosition);
4369   Stage::GetCurrent().Add(actor);
4370   application.SendNotification();
4371   application.Render(0);
4372   DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4373
4374   // Build the animation
4375   float durationSeconds(1.0f);
4376   Animation animation = Animation::New(durationSeconds);
4377   Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4378   Vector3 relativePosition(targetPosition - startPosition);
4379   float delay = 0.5f;
4380   animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4381                       relativePosition,
4382                       TimePeriod(delay, durationSeconds - delay));
4383
4384   Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4385
4386   // Start the animation
4387   animation.Play();
4388
4389   bool signalReceived(false);
4390   AnimationFinishCheck finishCheck(signalReceived);
4391   animation.FinishedSignal().Connect(&application, finishCheck);
4392
4393   application.SendNotification();
4394   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4395
4396   // We didn't expect the animation to finish yet
4397   application.SendNotification();
4398   finishCheck.CheckSignalNotReceived();
4399   DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4400
4401   application.SendNotification();
4402   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4403
4404   // We did expect the animation to finish
4405   application.SendNotification();
4406   finishCheck.CheckSignalReceived();
4407   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4408
4409   // Check that nothing has changed after a couple of buffer swaps
4410   application.Render(0);
4411   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4412   application.Render(0);
4413   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4414   END_TEST;
4415 }
4416
4417 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void)
4418 {
4419   TestApplication application;
4420
4421   Actor actor = Actor::New();
4422   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4423   actor.SetPosition(startPosition);
4424   Stage::GetCurrent().Add(actor);
4425   application.SendNotification();
4426   application.Render(0);
4427   DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4428
4429   // Build the animation
4430   float durationSeconds(1.0f);
4431   Animation animation = Animation::New(durationSeconds);
4432   Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4433   Vector3 relativePosition(targetPosition - startPosition);
4434   float delay = 0.5f;
4435   animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4436                       relativePosition,
4437                       AlphaFunction::LINEAR,
4438                       TimePeriod(delay, durationSeconds - delay));
4439
4440   Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4441
4442   // Start the animation
4443   animation.Play();
4444
4445   bool signalReceived(false);
4446   AnimationFinishCheck finishCheck(signalReceived);
4447   animation.FinishedSignal().Connect(&application, finishCheck);
4448
4449   application.SendNotification();
4450   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4451
4452   // We didn't expect the animation to finish yet
4453   application.SendNotification();
4454   finishCheck.CheckSignalNotReceived();
4455   DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4456
4457   application.SendNotification();
4458   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4459
4460   // We did expect the animation to finish
4461   application.SendNotification();
4462   finishCheck.CheckSignalReceived();
4463   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4464
4465   // Check that nothing has changed after a couple of buffer swaps
4466   application.Render(0);
4467   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4468   application.Render(0);
4469   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4470   END_TEST;
4471 }
4472
4473 int UtcDaliAnimationAnimateByActorOrientationP1(void)
4474 {
4475   TestApplication application;
4476
4477   Actor actor = Actor::New();
4478   actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4479   Stage::GetCurrent().Add(actor);
4480   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4481
4482   // Build the animation
4483   float durationSeconds(1.0f);
4484   Animation animation = Animation::New(durationSeconds);
4485   Degree relativeRotationDegrees(360.0f);
4486   Radian relativeRotationRadians(relativeRotationDegrees);
4487   animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ) );
4488
4489   // Start the animation
4490   animation.Play();
4491
4492   bool signalReceived(false);
4493   AnimationFinishCheck finishCheck(signalReceived);
4494   animation.FinishedSignal().Connect(&application, finishCheck);
4495
4496   application.SendNotification();
4497   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4498
4499   // We didn't expect the animation to finish yet
4500   application.SendNotification();
4501   finishCheck.CheckSignalNotReceived();
4502   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4503
4504   application.SendNotification();
4505   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4506
4507   // We didn't expect the animation to finish yet
4508   application.SendNotification();
4509   finishCheck.CheckSignalNotReceived();
4510   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4511
4512   application.SendNotification();
4513   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4514
4515   // We didn't expect the animation to finish yet
4516   application.SendNotification();
4517   finishCheck.CheckSignalNotReceived();
4518   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4519
4520   application.SendNotification();
4521   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4522
4523   // We did expect the animation to finish
4524   application.SendNotification();
4525   finishCheck.CheckSignalReceived();
4526   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4527   END_TEST;
4528 }
4529
4530 int UtcDaliAnimationAnimateByActorOrientationP2(void)
4531 {
4532   TestApplication application;
4533
4534   tet_printf("Testing that rotation angle > 360 performs full rotations\n");
4535
4536   Actor actor = Actor::New();
4537   actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
4538   Stage::GetCurrent().Add(actor);
4539   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4540
4541   // Build the animation
4542   float durationSeconds(1.0f);
4543   Animation animation = Animation::New(durationSeconds);
4544   Degree relativeRotationDegrees(710.0f);
4545   Radian relativeRotationRadians(relativeRotationDegrees);
4546
4547   animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), AngleAxis( relativeRotationRadians, Vector3::ZAXIS ) );
4548
4549   // Start the animation
4550   animation.Play();
4551
4552   bool signalReceived(false);
4553   AnimationFinishCheck finishCheck(signalReceived);
4554   animation.FinishedSignal().Connect(&application, finishCheck);
4555
4556   application.SendNotification();
4557   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4558
4559   // We didn't expect the animation to finish yet
4560   application.SendNotification();
4561   finishCheck.CheckSignalNotReceived();
4562   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4563
4564   application.SendNotification();
4565   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4566
4567   // We didn't expect the animation to finish yet
4568   application.SendNotification();
4569   finishCheck.CheckSignalNotReceived();
4570   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4571
4572   application.SendNotification();
4573   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4574
4575   // We didn't expect the animation to finish yet
4576   application.SendNotification();
4577   finishCheck.CheckSignalNotReceived();
4578   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4579
4580   application.SendNotification();
4581   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4582
4583   // We did expect the animation to finish
4584   application.SendNotification();
4585   finishCheck.CheckSignalReceived();
4586   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4587   END_TEST;
4588 }
4589
4590
4591 int UtcDaliAnimationAnimateByActorOrientationP3(void)
4592 {
4593   TestApplication application;
4594
4595   tet_printf("Testing that rotation angle > 360 performs partial rotations when cast to Quaternion\n");
4596
4597   Actor actor = Actor::New();
4598   actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
4599   Stage::GetCurrent().Add(actor);
4600   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4601
4602   // Build the animation
4603   float durationSeconds(1.0f);
4604   Animation animation = Animation::New(durationSeconds);
4605   Degree relativeRotationDegrees(730.0f);
4606   Radian relativeRotationRadians(relativeRotationDegrees);
4607
4608   Radian actualRotationRadians( Degree(10.0f) );
4609
4610   animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::ZAXIS ) );
4611
4612   // Start the animation
4613   animation.Play();
4614
4615   bool signalReceived(false);
4616   AnimationFinishCheck finishCheck(signalReceived);
4617   animation.FinishedSignal().Connect(&application, finishCheck);
4618
4619   application.SendNotification();
4620   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4621
4622   // We didn't expect the animation to finish yet
4623   application.SendNotification();
4624   finishCheck.CheckSignalNotReceived();
4625   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4626
4627   application.SendNotification();
4628   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4629
4630   // We didn't expect the animation to finish yet
4631   application.SendNotification();
4632   finishCheck.CheckSignalNotReceived();
4633   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4634
4635   application.SendNotification();
4636   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4637
4638   // We didn't expect the animation to finish yet
4639   application.SendNotification();
4640   finishCheck.CheckSignalNotReceived();
4641   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4642
4643   application.SendNotification();
4644   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4645
4646   // We did expect the animation to finish
4647   application.SendNotification();
4648   finishCheck.CheckSignalReceived();
4649   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4650   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4651   END_TEST;
4652 }
4653
4654
4655 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
4656 {
4657   TestApplication application;
4658
4659   Actor actor = Actor::New();
4660   actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4661   Stage::GetCurrent().Add(actor);
4662   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4663
4664   // Build the animation
4665   float durationSeconds(1.0f);
4666   Animation animation = Animation::New(durationSeconds);
4667   Degree relativeRotationDegrees(360.0f);
4668   Radian relativeRotationRadians(relativeRotationDegrees);
4669   animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ), AlphaFunction::EASE_IN );
4670
4671   // Start the animation
4672   animation.Play();
4673
4674   bool signalReceived(false);
4675   AnimationFinishCheck finishCheck(signalReceived);
4676   animation.FinishedSignal().Connect(&application, finishCheck);
4677
4678   application.SendNotification();
4679   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4680
4681   // We didn't expect the animation to finish yet
4682   application.SendNotification();
4683   finishCheck.CheckSignalNotReceived();
4684   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4685
4686   application.SendNotification();
4687   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4688
4689   // We didn't expect the animation to finish yet
4690   application.SendNotification();
4691   finishCheck.CheckSignalNotReceived();
4692   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4693
4694   application.SendNotification();
4695   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4696
4697   // We didn't expect the animation to finish yet
4698   application.SendNotification();
4699   finishCheck.CheckSignalNotReceived();
4700   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4701
4702   application.SendNotification();
4703   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4704
4705   // We did expect the animation to finish
4706   application.SendNotification();
4707   finishCheck.CheckSignalReceived();
4708   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4709   END_TEST;
4710 }
4711
4712 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void)
4713 {
4714   TestApplication application;
4715
4716   Actor actor = Actor::New();
4717   actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4718   Stage::GetCurrent().Add(actor);
4719   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4720
4721   // Build the animation
4722   float durationSeconds(1.0f);
4723   Animation animation = Animation::New(durationSeconds);
4724   Degree relativeRotationDegrees(360.0f);
4725   Radian relativeRotationRadians(relativeRotationDegrees);
4726   float delay = 0.3f;
4727   animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ),
4728                        AlphaFunction::EASE_IN, TimePeriod( delay, durationSeconds - delay ) );
4729
4730   // Start the animation
4731   animation.Play();
4732
4733   bool signalReceived(false);
4734   AnimationFinishCheck finishCheck(signalReceived);
4735   animation.FinishedSignal().Connect(&application, finishCheck);
4736
4737   application.SendNotification();
4738   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4739
4740   // We didn't expect the animation to finish yet
4741   application.SendNotification();
4742   finishCheck.CheckSignalNotReceived();
4743   float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
4744   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4745
4746   application.SendNotification();
4747   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4748
4749   // We didn't expect the animation to finish yet
4750   application.SendNotification();
4751   finishCheck.CheckSignalNotReceived();
4752   progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
4753   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4754
4755   application.SendNotification();
4756   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4757
4758   // We didn't expect the animation to finish yet
4759   application.SendNotification();
4760   finishCheck.CheckSignalNotReceived();
4761   progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
4762   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4763
4764   application.SendNotification();
4765   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4766
4767   // We did expect the animation to finish
4768   application.SendNotification();
4769   finishCheck.CheckSignalReceived();
4770   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4771   END_TEST;
4772 }
4773
4774 int UtcDaliAnimationAnimateByActorScaleP(void)
4775 {
4776   TestApplication application;
4777
4778   Actor actor = Actor::New();
4779   Stage::GetCurrent().Add(actor);
4780   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4781
4782   // Build the animation
4783   float durationSeconds(1.0f);
4784   Animation animation = Animation::New(durationSeconds);
4785   Vector3 targetScale(2.0f, 2.0f, 2.0f);
4786   Vector3 relativeScale(targetScale - Vector3::ONE);
4787   animation.AnimateBy( Property( actor, Actor::Property::SCALE ), Vector3( relativeScale.x, relativeScale.y, relativeScale.z ) );
4788
4789   Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale*0.99f);
4790
4791   // Start the animation
4792   animation.Play();
4793
4794   bool signalReceived(false);
4795   AnimationFinishCheck finishCheck(signalReceived);
4796   animation.FinishedSignal().Connect(&application, finishCheck);
4797
4798   application.SendNotification();
4799   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4800
4801   // We didn't expect the animation to finish yet
4802   application.SendNotification();
4803   finishCheck.CheckSignalNotReceived();
4804   DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
4805
4806   application.SendNotification();
4807   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4808
4809   // We did expect the animation to finish
4810   application.SendNotification();
4811   finishCheck.CheckSignalReceived();
4812   DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4813
4814   // Reset everything
4815   finishCheck.Reset();
4816   actor.SetScale(Vector3::ONE);
4817   application.SendNotification();
4818   application.Render(0);
4819   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4820
4821   // Repeat with a different (ease-in) alpha function
4822   animation = Animation::New(durationSeconds);
4823   animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::EASE_IN );
4824   animation.FinishedSignal().Connect(&application, finishCheck);
4825   animation.Play();
4826
4827   application.SendNotification();
4828   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4829
4830   // We didn't expect the animation to finish yet
4831   application.SendNotification();
4832   finishCheck.CheckSignalNotReceived();
4833
4834   // The scale should have grown less, than with a linear alpha function
4835   Vector3 current(actor.GetCurrentScale());
4836   DALI_TEST_CHECK( current.x > 1.0f );
4837   DALI_TEST_CHECK( current.y > 1.0f );
4838   DALI_TEST_CHECK( current.z > 1.0f );
4839   DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
4840   DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
4841   DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
4842
4843   application.SendNotification();
4844   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4845
4846   // We did expect the animation to finish
4847   application.SendNotification();
4848   finishCheck.CheckSignalReceived();
4849   DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4850
4851   // Reset everything
4852   finishCheck.Reset();
4853   actor.SetScale(Vector3::ONE);
4854   application.SendNotification();
4855   application.Render(0);
4856   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4857
4858   // Repeat with a delay
4859   float delay = 0.5f;
4860   animation = Animation::New(durationSeconds);
4861   animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
4862   animation.FinishedSignal().Connect(&application, finishCheck);
4863   animation.Play();
4864
4865   application.SendNotification();
4866   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4867
4868   // We didn't expect the animation to finish yet
4869   application.SendNotification();
4870   finishCheck.CheckSignalNotReceived();
4871   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4872
4873   application.SendNotification();
4874   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4875
4876   // We did expect the animation to finish
4877   application.SendNotification();
4878   finishCheck.CheckSignalReceived();
4879   DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4880   END_TEST;
4881 }
4882
4883 int UtcDaliAnimationAnimateToBooleanP(void)
4884 {
4885   TestApplication application;
4886
4887   Actor actor = Actor::New();
4888
4889   // Register a boolean property
4890   const bool startValue(false);
4891   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4892   Stage::GetCurrent().Add(actor);
4893   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4894   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
4895
4896   // Build the animation
4897   float durationSeconds(2.0f);
4898   Animation animation = Animation::New(durationSeconds);
4899   const bool targetValue( !startValue );
4900   animation.AnimateTo(Property(actor, index), targetValue);
4901
4902   // Start the animation
4903   animation.Play();
4904
4905   bool signalReceived(false);
4906   AnimationFinishCheck finishCheck(signalReceived);
4907   animation.FinishedSignal().Connect(&application, finishCheck);
4908
4909   application.SendNotification();
4910   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4911
4912   // We didn't expect the animation to finish yet
4913   application.SendNotification();
4914   finishCheck.CheckSignalNotReceived();
4915   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
4916
4917   application.SendNotification();
4918   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4919
4920   // We did expect the animation to finish
4921   application.SendNotification();
4922   finishCheck.CheckSignalReceived();
4923   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
4924
4925   // Check that nothing has changed after a couple of buffer swaps
4926   application.Render(0);
4927   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
4928   application.Render(0);
4929   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
4930
4931   // Repeat with target value "false"
4932   animation = Animation::New(durationSeconds);
4933   const bool finalValue( !targetValue );
4934   animation.AnimateTo(Property(actor, index), finalValue);
4935
4936   // Start the animation
4937   animation.Play();
4938
4939   finishCheck.Reset();
4940   animation.FinishedSignal().Connect(&application, finishCheck);
4941
4942   application.SendNotification();
4943   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4944
4945   // We didn't expect the animation to finish yet
4946   application.SendNotification();
4947   finishCheck.CheckSignalNotReceived();
4948   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
4949
4950   application.SendNotification();
4951   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4952
4953   // We did expect the animation to finish
4954   application.SendNotification();
4955   finishCheck.CheckSignalReceived();
4956   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
4957
4958   // Check that nothing has changed after a couple of buffer swaps
4959   application.Render(0);
4960   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
4961   application.Render(0);
4962   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
4963   END_TEST;
4964 }
4965
4966 int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void)
4967 {
4968   TestApplication application;
4969
4970   Actor actor = Actor::New();
4971
4972   // Register a boolean property
4973   const bool startValue(false);
4974   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4975   Stage::GetCurrent().Add(actor);
4976   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4977   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
4978
4979   // Build the animation
4980   float durationSeconds(2.0f);
4981   Animation animation = Animation::New(durationSeconds);
4982   const bool targetValue( !startValue );
4983   animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
4984
4985   // Start the animation
4986   animation.Play();
4987
4988   bool signalReceived(false);
4989   AnimationFinishCheck finishCheck(signalReceived);
4990   animation.FinishedSignal().Connect(&application, finishCheck);
4991
4992   application.SendNotification();
4993   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4994
4995   // We didn't expect the animation to finish yet
4996   application.SendNotification();
4997   finishCheck.CheckSignalNotReceived();
4998   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
4999
5000   application.SendNotification();
5001   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5002
5003   // We did expect the animation to finish
5004   application.SendNotification();
5005   finishCheck.CheckSignalReceived();
5006   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
5007
5008   // Check that nothing has changed after a couple of buffer swaps
5009   application.Render(0);
5010   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
5011   application.Render(0);
5012   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
5013
5014   // Repeat with target value "false"
5015   animation = Animation::New(durationSeconds);
5016   const bool finalValue( !targetValue );
5017   animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
5018
5019   // Start the animation
5020   animation.Play();
5021
5022   finishCheck.Reset();
5023   animation.FinishedSignal().Connect(&application, finishCheck);
5024
5025   application.SendNotification();
5026   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5027
5028   // We didn't expect the animation to finish yet
5029   application.SendNotification();
5030   finishCheck.CheckSignalNotReceived();
5031   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue );
5032
5033   application.SendNotification();
5034   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5035
5036   // We did expect the animation to finish
5037   application.SendNotification();
5038   finishCheck.CheckSignalReceived();
5039   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5040
5041   // Check that nothing has changed after a couple of buffer swaps
5042   application.Render(0);
5043   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5044   application.Render(0);
5045   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5046   END_TEST;
5047 }
5048
5049 int UtcDaliAnimationAnimateToBooleanTimePeriodP(void)
5050 {
5051   TestApplication application;
5052
5053   Actor actor = Actor::New();
5054
5055   // Register a boolean property
5056   bool startValue(false);
5057   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5058   Stage::GetCurrent().Add(actor);
5059   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5060   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
5061
5062   // Build the animation
5063   float durationSeconds(2.0f);
5064   Animation animation = Animation::New(durationSeconds);
5065   bool finalValue( !startValue );
5066   float animatorDurationSeconds(durationSeconds * 0.5f);
5067   animation.AnimateTo( Property(actor, index),
5068                        finalValue,
5069                        TimePeriod( animatorDurationSeconds ) );
5070
5071   // Start the animation
5072   animation.Play();
5073
5074   bool signalReceived(false);
5075   AnimationFinishCheck finishCheck(signalReceived);
5076   animation.FinishedSignal().Connect(&application, finishCheck);
5077
5078   application.SendNotification();
5079   application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5080
5081   // We didn't expect the animation to finish yet
5082   application.SendNotification();
5083   finishCheck.CheckSignalNotReceived();
5084   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
5085
5086   application.SendNotification();
5087   application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5088
5089   // We didn't expect the animation to finish yet...
5090   application.SendNotification();
5091   finishCheck.CheckSignalNotReceived();
5092
5093   // ...however we should have reached the final value
5094   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5095
5096   application.SendNotification();
5097   application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5098
5099   // We did expect the animation to finish
5100   application.SendNotification();
5101   finishCheck.CheckSignalReceived();
5102   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5103
5104   // Check that nothing has changed after a couple of buffer swaps
5105   application.Render(0);
5106   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5107   application.Render(0);
5108   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5109   END_TEST;
5110 }
5111
5112 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void)
5113 {
5114   TestApplication application;
5115
5116   Actor actor = Actor::New();
5117
5118   // Register a boolean property
5119   bool startValue(false);
5120   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5121   Stage::GetCurrent().Add(actor);
5122   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5123   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
5124
5125   // Build the animation
5126   float durationSeconds(2.0f);
5127   Animation animation = Animation::New(durationSeconds);
5128   bool finalValue( !startValue );
5129   float animatorDurationSeconds(durationSeconds * 0.5f);
5130   animation.AnimateTo( Property(actor, index),
5131                        finalValue,
5132                        AlphaFunction::LINEAR,
5133                        TimePeriod( animatorDurationSeconds ) );
5134
5135   // Start the animation
5136   animation.Play();
5137
5138   bool signalReceived(false);
5139   AnimationFinishCheck finishCheck(signalReceived);
5140   animation.FinishedSignal().Connect(&application, finishCheck);
5141
5142   application.SendNotification();
5143   application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5144
5145   // We didn't expect the animation to finish yet
5146   application.SendNotification();
5147   finishCheck.CheckSignalNotReceived();
5148   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue );
5149
5150   application.SendNotification();
5151   application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5152
5153   // We didn't expect the animation to finish yet...
5154   application.SendNotification();
5155   finishCheck.CheckSignalNotReceived();
5156
5157   // ...however we should have reached the final value
5158   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5159
5160   application.SendNotification();
5161   application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5162
5163   // We did expect the animation to finish
5164   application.SendNotification();
5165   finishCheck.CheckSignalReceived();
5166   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5167
5168   // Check that nothing has changed after a couple of buffer swaps
5169   application.Render(0);
5170   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5171   application.Render(0);
5172   DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue );
5173   END_TEST;
5174 }
5175
5176 int UtcDaliAnimationAnimateToFloatP(void)
5177 {
5178   TestApplication application;
5179
5180   Actor actor = Actor::New();
5181
5182   // Register a float property
5183   float startValue(10.0f);
5184   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5185   Stage::GetCurrent().Add(actor);
5186   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5187   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
5188
5189   // Build the animation
5190   float durationSeconds(2.0f);
5191   Animation animation = Animation::New(durationSeconds);
5192   float targetValue(50.0f);
5193   float relativeValue(targetValue - startValue);
5194   animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5195
5196   float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5197
5198   // Start the animation
5199   animation.Play();
5200
5201   bool signalReceived(false);
5202   AnimationFinishCheck finishCheck(signalReceived);
5203   animation.FinishedSignal().Connect(&application, finishCheck);
5204
5205   application.SendNotification();
5206   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5207
5208   // We didn't expect the animation to finish yet
5209   application.SendNotification();
5210   finishCheck.CheckSignalNotReceived();
5211   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
5212
5213   application.SendNotification();
5214   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5215
5216   // We did expect the animation to finish
5217   application.SendNotification();
5218   finishCheck.CheckSignalReceived();
5219   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
5220   END_TEST;
5221 }
5222
5223 int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void)
5224 {
5225   TestApplication application;
5226
5227   Actor actor = Actor::New();
5228
5229   // Register a float property
5230   float startValue(10.0f);
5231   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5232   Stage::GetCurrent().Add(actor);
5233   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5234   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
5235
5236   // Build the animation
5237   float durationSeconds(1.0f);
5238   Animation animation = Animation::New(durationSeconds);
5239   float targetValue(90.0f);
5240   float relativeValue(targetValue - startValue);
5241   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5242
5243   float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5244
5245   // Start the animation
5246   animation.Play();
5247
5248   bool signalReceived(false);
5249   AnimationFinishCheck finishCheck(signalReceived);
5250   animation.FinishedSignal().Connect(&application, finishCheck);
5251
5252   application.SendNotification();
5253   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5254
5255   // We didn't expect the animation to finish yet
5256   application.SendNotification();
5257   finishCheck.CheckSignalNotReceived();
5258
5259   // The position should have moved more, than with a linear alpha function
5260   float current( DevelHandle::GetCurrentProperty< float >( actor, index ) );
5261   DALI_TEST_CHECK( current > ninetyFivePercentProgress );
5262
5263   application.SendNotification();
5264   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5265
5266   // We did expect the animation to finish
5267   application.SendNotification();
5268   finishCheck.CheckSignalReceived();
5269   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
5270   END_TEST;
5271 }
5272
5273 int UtcDaliAnimationAnimateToFloatTimePeriodP(void)
5274 {
5275   TestApplication application;
5276
5277   Actor actor = Actor::New();
5278
5279   // Register a float property
5280   float startValue(10.0f);
5281   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5282   Stage::GetCurrent().Add(actor);
5283   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5284   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
5285
5286   // Build the animation
5287   float durationSeconds(1.0f);
5288   Animation animation = Animation::New(durationSeconds);
5289   float targetValue(30.0f);
5290   float relativeValue(targetValue - startValue);
5291   float delay = 0.5f;
5292   animation.AnimateTo(Property(actor, index),
5293                       targetValue,
5294                       TimePeriod(delay, durationSeconds - delay));
5295
5296   // Start the animation
5297   animation.Play();
5298
5299   bool signalReceived(false);
5300   AnimationFinishCheck finishCheck(signalReceived);
5301   animation.FinishedSignal().Connect(&application, finishCheck);
5302
5303   application.SendNotification();
5304   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5305
5306   // We didn't expect the animation to finish yet
5307   application.SendNotification();
5308   finishCheck.CheckSignalNotReceived();
5309   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
5310
5311   application.SendNotification();
5312   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5313
5314   // We didn't expect the animation to finish yet
5315   application.SendNotification();
5316   finishCheck.CheckSignalNotReceived();
5317   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5318
5319   application.SendNotification();
5320   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5321
5322   // We did expect the animation to finish
5323   application.SendNotification();
5324   finishCheck.CheckSignalReceived();
5325   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
5326   END_TEST;
5327 }
5328
5329 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void)
5330 {
5331   TestApplication application;
5332
5333   Actor actor = Actor::New();
5334
5335   // Register a float property
5336   float startValue(10.0f);
5337   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5338   Stage::GetCurrent().Add(actor);
5339   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5340   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
5341
5342   // Build the animation
5343   float durationSeconds(1.0f);
5344   Animation animation = Animation::New(durationSeconds);
5345   float targetValue(30.0f);
5346   float relativeValue(targetValue - startValue);
5347   float delay = 0.5f;
5348   animation.AnimateTo(Property(actor, index),
5349                       targetValue,
5350                       AlphaFunction::LINEAR,
5351                       TimePeriod(delay, durationSeconds - delay));
5352
5353   // Start the animation
5354   animation.Play();
5355
5356   bool signalReceived(false);
5357   AnimationFinishCheck finishCheck(signalReceived);
5358   animation.FinishedSignal().Connect(&application, finishCheck);
5359
5360   application.SendNotification();
5361   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5362
5363   // We didn't expect the animation to finish yet
5364   application.SendNotification();
5365   finishCheck.CheckSignalNotReceived();
5366   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
5367
5368   application.SendNotification();
5369   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5370
5371   // We didn't expect the animation to finish yet
5372   application.SendNotification();
5373   finishCheck.CheckSignalNotReceived();
5374   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5375
5376   application.SendNotification();
5377   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5378
5379   // We did expect the animation to finish
5380   application.SendNotification();
5381   finishCheck.CheckSignalReceived();
5382   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
5383   END_TEST;
5384 }
5385
5386 int UtcDaliAnimationAnimateToIntegerP(void)
5387 {
5388   TestApplication application;
5389
5390   Actor actor = Actor::New();
5391
5392   // Register an integer property
5393   int startValue(10);
5394   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5395   Stage::GetCurrent().Add(actor);
5396   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5397   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
5398
5399   // Build the animation
5400   float durationSeconds(2.0f);
5401   Animation animation = Animation::New(durationSeconds);
5402   int targetValue(50);
5403   int relativeValue(targetValue - startValue);
5404   animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5405
5406   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
5407
5408   // Start the animation
5409   animation.Play();
5410
5411   bool signalReceived(false);
5412   AnimationFinishCheck finishCheck(signalReceived);
5413   animation.FinishedSignal().Connect(&application, finishCheck);
5414
5415   application.SendNotification();
5416   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5417
5418   // We didn't expect the animation to finish yet
5419   application.SendNotification();
5420   finishCheck.CheckSignalNotReceived();
5421   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
5422
5423   application.SendNotification();
5424   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5425
5426   // We did expect the animation to finish
5427   application.SendNotification();
5428   finishCheck.CheckSignalReceived();
5429   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
5430   END_TEST;
5431 }
5432
5433 int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void)
5434 {
5435   TestApplication application;
5436
5437   Actor actor = Actor::New();
5438
5439   // Register an integer property
5440   int startValue(10);
5441   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5442   Stage::GetCurrent().Add(actor);
5443   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5444   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
5445
5446   // Build the animation
5447   float durationSeconds(1.0f);
5448   Animation animation = Animation::New(durationSeconds);
5449   int targetValue(90);
5450   int relativeValue(targetValue - startValue);
5451   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5452
5453   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
5454
5455   // Start the animation
5456   animation.Play();
5457
5458   bool signalReceived(false);
5459   AnimationFinishCheck finishCheck(signalReceived);
5460   animation.FinishedSignal().Connect(&application, finishCheck);
5461
5462   application.SendNotification();
5463   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5464
5465   // We didn't expect the animation to finish yet
5466   application.SendNotification();
5467   finishCheck.CheckSignalNotReceived();
5468
5469   // The position should have moved more, than with a linear alpha function
5470   int current( DevelHandle::GetCurrentProperty< int >( actor, index ) );
5471   DALI_TEST_CHECK( current > ninetyFivePercentProgress );
5472
5473   application.SendNotification();
5474   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5475
5476   // We did expect the animation to finish
5477   application.SendNotification();
5478   finishCheck.CheckSignalReceived();
5479   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
5480   END_TEST;
5481 }
5482
5483 int UtcDaliAnimationAnimateToIntegerTimePeriodP(void)
5484 {
5485   TestApplication application;
5486
5487   Actor actor = Actor::New();
5488
5489   // Register an integer property
5490   int startValue(10);
5491   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5492   Stage::GetCurrent().Add(actor);
5493   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5494   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
5495
5496   // Build the animation
5497   float durationSeconds(1.0f);
5498   Animation animation = Animation::New(durationSeconds);
5499   int targetValue(30);
5500   int relativeValue(targetValue - startValue);
5501   float delay = 0.5f;
5502   animation.AnimateTo(Property(actor, index),
5503                       targetValue,
5504                       TimePeriod(delay, durationSeconds - delay));
5505
5506   // Start the animation
5507   animation.Play();
5508
5509   bool signalReceived(false);
5510   AnimationFinishCheck finishCheck(signalReceived);
5511   animation.FinishedSignal().Connect(&application, finishCheck);
5512
5513   application.SendNotification();
5514   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5515
5516   // We didn't expect the animation to finish yet
5517   application.SendNotification();
5518   finishCheck.CheckSignalNotReceived();
5519   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
5520
5521   application.SendNotification();
5522   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5523
5524   // We didn't expect the animation to finish yet
5525   application.SendNotification();
5526   finishCheck.CheckSignalNotReceived();
5527   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
5528
5529   application.SendNotification();
5530   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5531
5532   // We did expect the animation to finish
5533   application.SendNotification();
5534   finishCheck.CheckSignalReceived();
5535   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
5536   END_TEST;
5537 }
5538
5539 int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void)
5540 {
5541   TestApplication application;
5542
5543   Actor actor = Actor::New();
5544
5545   // Register an integer property
5546   int startValue(10);
5547   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5548   Stage::GetCurrent().Add(actor);
5549   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5550   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
5551
5552   // Build the animation
5553   float durationSeconds(1.0f);
5554   Animation animation = Animation::New(durationSeconds);
5555   int targetValue(30);
5556   int relativeValue(targetValue - startValue);
5557   float delay = 0.5f;
5558   animation.AnimateTo(Property(actor, index),
5559                       targetValue,
5560                       AlphaFunction::LINEAR,
5561                       TimePeriod(delay, durationSeconds - delay));
5562
5563   // Start the animation
5564   animation.Play();
5565
5566   bool signalReceived(false);
5567   AnimationFinishCheck finishCheck(signalReceived);
5568   animation.FinishedSignal().Connect(&application, finishCheck);
5569
5570   application.SendNotification();
5571   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5572
5573   // We didn't expect the animation to finish yet
5574   application.SendNotification();
5575   finishCheck.CheckSignalNotReceived();
5576   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
5577
5578   application.SendNotification();
5579   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5580
5581   // We didn't expect the animation to finish yet
5582   application.SendNotification();
5583   finishCheck.CheckSignalNotReceived();
5584   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
5585
5586   application.SendNotification();
5587   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5588
5589   // We did expect the animation to finish
5590   application.SendNotification();
5591   finishCheck.CheckSignalReceived();
5592   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION );
5593   END_TEST;
5594 }
5595
5596 int UtcDaliAnimationAnimateToVector2P(void)
5597 {
5598   TestApplication application;
5599
5600   Actor actor = Actor::New();
5601
5602   // Register a Vector2 property
5603   Vector2 startValue(-50.0f, -50.0f);
5604   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5605   Stage::GetCurrent().Add(actor);
5606   DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5607   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
5608
5609   // Build the animation
5610   float durationSeconds(2.0f);
5611   Animation animation = Animation::New(durationSeconds);
5612   Vector2 targetValue(50.0f, 50.0f);
5613   Vector2 relativeValue(targetValue - startValue);
5614   animation.AnimateTo(Property(actor, index), targetValue);
5615
5616   Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5617
5618   // Start the animation
5619   animation.Play();
5620
5621   bool signalReceived(false);
5622   AnimationFinishCheck finishCheck(signalReceived);
5623   animation.FinishedSignal().Connect(&application, finishCheck);
5624
5625   application.SendNotification();
5626   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5627
5628   // We didn't expect the animation to finish yet
5629   application.SendNotification();
5630   finishCheck.CheckSignalNotReceived();
5631   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
5632
5633   application.SendNotification();
5634   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5635
5636   // We did expect the animation to finish
5637   application.SendNotification();
5638   finishCheck.CheckSignalReceived();
5639   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
5640   END_TEST;
5641 }
5642
5643 int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void)
5644 {
5645   TestApplication application;
5646
5647   Actor actor = Actor::New();
5648
5649   // Register a Vector2 property
5650   Vector2 startValue(1000.0f, 1000.0f);
5651   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5652   Stage::GetCurrent().Add(actor);
5653   DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5654   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
5655
5656   // Build the animation
5657   float durationSeconds(1.0f);
5658   Animation animation = Animation::New(durationSeconds);
5659   Vector2 targetValue(9000.0f, 9000.0f);
5660   Vector2 relativeValue(targetValue - startValue);
5661   animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
5662
5663   Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5664
5665   // Start the animation
5666   animation.Play();
5667
5668   bool signalReceived(false);
5669   AnimationFinishCheck finishCheck(signalReceived);
5670   animation.FinishedSignal().Connect(&application, finishCheck);
5671
5672   application.SendNotification();
5673   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5674
5675   // We didn't expect the animation to finish yet
5676   application.SendNotification();
5677   finishCheck.CheckSignalNotReceived();
5678
5679   // The position should have moved more, than with a linear alpha function
5680   Vector2 current( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ) );
5681   DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
5682   DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
5683
5684   application.SendNotification();
5685   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5686
5687   // We did expect the animation to finish
5688   application.SendNotification();
5689   finishCheck.CheckSignalReceived();
5690   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
5691   END_TEST;
5692 }
5693
5694 int UtcDaliAnimationAnimateToVector2TimePeriodP(void)
5695 {
5696   TestApplication application;
5697
5698   Actor actor = Actor::New();
5699
5700   // Register a Vector2 property
5701   Vector2 startValue(10.0f, 10.0f);
5702   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5703   Stage::GetCurrent().Add(actor);
5704   DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5705   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
5706
5707   // Build the animation
5708   float durationSeconds(1.0f);
5709   Animation animation = Animation::New(durationSeconds);
5710   Vector2 targetValue(-10.0f, 20.0f);
5711   Vector2 relativeValue(targetValue - startValue);
5712   float delay = 0.5f;
5713   animation.AnimateTo(Property(actor, index),
5714                       targetValue,
5715                       TimePeriod(delay, durationSeconds - delay));
5716
5717   // Start the animation
5718   animation.Play();
5719
5720   bool signalReceived(false);
5721   AnimationFinishCheck finishCheck(signalReceived);
5722   animation.FinishedSignal().Connect(&application, finishCheck);
5723
5724   application.SendNotification();
5725   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5726
5727   // We didn't expect the animation to finish yet
5728   application.SendNotification();
5729   finishCheck.CheckSignalNotReceived();
5730   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
5731
5732   application.SendNotification();
5733   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5734
5735   // We didn't expect the animation to finish yet
5736   application.SendNotification();
5737   finishCheck.CheckSignalNotReceived();
5738   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5739
5740   application.SendNotification();
5741   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5742
5743   // We did expect the animation to finish
5744   application.SendNotification();
5745   finishCheck.CheckSignalReceived();
5746   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
5747   END_TEST;
5748 }
5749
5750 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void)
5751 {
5752   TestApplication application;
5753
5754   Actor actor = Actor::New();
5755
5756   // Register a Vector2 property
5757   Vector2 startValue(10.0f, 10.0f);
5758   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5759   Stage::GetCurrent().Add(actor);
5760   DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5761   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION );
5762
5763   // Build the animation
5764   float durationSeconds(1.0f);
5765   Animation animation = Animation::New(durationSeconds);
5766   Vector2 targetValue(30.0f, 30.0f);
5767   Vector2 relativeValue(targetValue - startValue);
5768   float delay = 0.5f;
5769   animation.AnimateTo(Property(actor, index),
5770                       targetValue,
5771                       AlphaFunction::LINEAR,
5772                       TimePeriod(delay, durationSeconds - delay));
5773
5774   // Start the animation
5775   animation.Play();
5776
5777   bool signalReceived(false);
5778   AnimationFinishCheck finishCheck(signalReceived);
5779   animation.FinishedSignal().Connect(&application, finishCheck);
5780
5781   application.SendNotification();
5782   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5783
5784   // We didn't expect the animation to finish yet, but cached value should be the final one
5785   application.SendNotification();
5786   finishCheck.CheckSignalNotReceived();
5787   DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
5788   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty<Vector2>( actor, index ), startValue, TEST_LOCATION );
5789
5790   application.SendNotification();
5791   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5792
5793   // We didn't expect the animation to finish yet
5794   application.SendNotification();
5795   finishCheck.CheckSignalNotReceived();
5796   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5797
5798   application.SendNotification();
5799   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5800
5801   // We did expect the animation to finish
5802   application.SendNotification();
5803   finishCheck.CheckSignalReceived();
5804   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
5805   DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
5806   END_TEST;
5807 }
5808
5809 int UtcDaliAnimationAnimateToVector3P(void)
5810 {
5811   TestApplication application;
5812
5813   Actor actor = Actor::New();
5814
5815   // Register a Vector3 property
5816   Vector3 startValue(-50.0f, -50.0f, -50.0f);
5817   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5818   Stage::GetCurrent().Add(actor);
5819   DALI_TEST_EQUALS( actor.GetProperty<Vector3>( index ), startValue, TEST_LOCATION );
5820   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
5821
5822   // Build the animation
5823   float durationSeconds(2.0f);
5824   Animation animation = Animation::New(durationSeconds);
5825   Vector3 targetValue(50.0f, 50.0f, 50.0f);
5826   Vector3 relativeValue(targetValue - startValue);
5827   animation.AnimateTo(Property(actor, index), targetValue);
5828
5829   Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5830
5831   // Start the animation
5832   animation.Play();
5833
5834   bool signalReceived(false);
5835   AnimationFinishCheck finishCheck(signalReceived);
5836   animation.FinishedSignal().Connect(&application, finishCheck);
5837
5838   application.SendNotification();
5839   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5840
5841   // We didn't expect the animation to finish yet
5842   application.SendNotification();
5843   finishCheck.CheckSignalNotReceived();
5844   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
5845
5846   application.SendNotification();
5847   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5848
5849   // We did expect the animation to finish
5850   application.SendNotification();
5851   finishCheck.CheckSignalReceived();
5852   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
5853   END_TEST;
5854 }
5855
5856 int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void)
5857 {
5858   TestApplication application;
5859
5860   Actor actor = Actor::New();
5861
5862   // Register a Vector3 property
5863   Vector3 startValue(1000.0f, 1000.0f, 1000.0f);
5864   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5865   Stage::GetCurrent().Add(actor);
5866   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5867   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
5868
5869   // Build the animation
5870   float durationSeconds(1.0f);
5871   Animation animation = Animation::New(durationSeconds);
5872   Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
5873   Vector3 relativeValue(targetValue - startValue);
5874   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5875
5876   Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5877
5878   // Start the animation
5879   animation.Play();
5880
5881   bool signalReceived(false);
5882   AnimationFinishCheck finishCheck(signalReceived);
5883   animation.FinishedSignal().Connect(&application, finishCheck);
5884
5885   application.SendNotification();
5886   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5887
5888   // We didn't expect the animation to finish yet
5889   application.SendNotification();
5890   finishCheck.CheckSignalNotReceived();
5891
5892   // The position should have moved more, than with a linear alpha function
5893   Vector3 current( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ) );
5894   DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
5895   DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
5896   DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
5897
5898   application.SendNotification();
5899   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5900
5901   // We did expect the animation to finish
5902   application.SendNotification();
5903   finishCheck.CheckSignalReceived();
5904   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
5905   END_TEST;
5906 }
5907
5908 int UtcDaliAnimationAnimateToVector3TimePeriodP(void)
5909 {
5910   TestApplication application;
5911
5912   Actor actor = Actor::New();
5913
5914   // Register a Vector3 property
5915   Vector3 startValue(10.0f, 10.0f, 10.0f);
5916   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5917   Stage::GetCurrent().Add(actor);
5918   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5919   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
5920
5921   // Build the animation
5922   float durationSeconds(1.0f);
5923   Animation animation = Animation::New(durationSeconds);
5924   Vector3 targetValue(-10.0f, 20.0f, 100.0f);
5925   Vector3 relativeValue(targetValue - startValue);
5926   float delay = 0.5f;
5927   animation.AnimateTo(Property(actor, index),
5928                       targetValue,
5929                       TimePeriod(delay, durationSeconds - delay));
5930
5931   // Start the animation
5932   animation.Play();
5933
5934   bool signalReceived(false);
5935   AnimationFinishCheck finishCheck(signalReceived);
5936   animation.FinishedSignal().Connect(&application, finishCheck);
5937
5938   application.SendNotification();
5939   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5940
5941   // We didn't expect the animation to finish yet
5942   application.SendNotification();
5943   finishCheck.CheckSignalNotReceived();
5944   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
5945
5946   application.SendNotification();
5947   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5948
5949   // We didn't expect the animation to finish yet
5950   application.SendNotification();
5951   finishCheck.CheckSignalNotReceived();
5952   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5953
5954   application.SendNotification();
5955   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5956
5957   // We did expect the animation to finish
5958   application.SendNotification();
5959   finishCheck.CheckSignalReceived();
5960   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
5961   END_TEST;
5962 }
5963
5964 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void)
5965 {
5966   TestApplication application;
5967
5968   Actor actor = Actor::New();
5969
5970   // Register a Vector3 property
5971   Vector3 startValue(10.0f, 10.0f, 10.0f);
5972   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5973   Stage::GetCurrent().Add(actor);
5974   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5975   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
5976
5977   // Build the animation
5978   float durationSeconds(1.0f);
5979   Animation animation = Animation::New(durationSeconds);
5980   Vector3 targetValue(30.0f, 30.0f, 30.0f);
5981   Vector3 relativeValue(targetValue - startValue);
5982   float delay = 0.5f;
5983   animation.AnimateTo(Property(actor, "testProperty"),
5984                       targetValue,
5985                       AlphaFunction::LINEAR,
5986                       TimePeriod(delay, durationSeconds - delay));
5987
5988   // Start the animation
5989   animation.Play();
5990
5991   bool signalReceived(false);
5992   AnimationFinishCheck finishCheck(signalReceived);
5993   animation.FinishedSignal().Connect(&application, finishCheck);
5994
5995   application.SendNotification();
5996   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5997
5998   // We didn't expect the animation to finish yet
5999   application.SendNotification();
6000   finishCheck.CheckSignalNotReceived();
6001   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
6002
6003   application.SendNotification();
6004   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6005
6006   // We didn't expect the animation to finish yet
6007   application.SendNotification();
6008   finishCheck.CheckSignalNotReceived();
6009   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6010
6011   application.SendNotification();
6012   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6013
6014   // We did expect the animation to finish
6015   application.SendNotification();
6016   finishCheck.CheckSignalReceived();
6017   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
6018   END_TEST;
6019 }
6020
6021 int UtcDaliAnimationAnimateToVector3ComponentP(void)
6022 {
6023   TestApplication application;
6024
6025   Actor actor = Actor::New();
6026
6027   // Register a Vector3 property
6028   Vector3 startValue(10.0f, 10.0f, 10.0f);
6029   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6030   Stage::GetCurrent().Add(actor);
6031   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6032   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
6033
6034   // Build the animation
6035   float durationSeconds(1.0f);
6036   Animation animation = Animation::New(durationSeconds);
6037   Vector3 targetValue(30.0f, 30.0f, 10.0f);
6038   Vector3 relativeValue(targetValue - startValue);
6039   float delay = 0.5f;
6040   animation.AnimateTo(Property(actor, "testProperty",  0),
6041                       30.0f,
6042                       AlphaFunction::LINEAR,
6043                       TimePeriod(delay, durationSeconds - delay));
6044   animation.AnimateTo(Property(actor, index, 1),
6045                       30.0f,
6046                       AlphaFunction::LINEAR,
6047                       TimePeriod(delay, durationSeconds - delay));
6048
6049   // Start the animation
6050   animation.Play();
6051
6052   bool signalReceived(false);
6053   AnimationFinishCheck finishCheck(signalReceived);
6054   animation.FinishedSignal().Connect(&application, finishCheck);
6055
6056   application.SendNotification();
6057   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6058
6059   // We didn't expect the animation to finish yet
6060   application.SendNotification();
6061   finishCheck.CheckSignalNotReceived();
6062   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION );
6063
6064   application.SendNotification();
6065   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6066
6067   // We didn't expect the animation to finish yet
6068   application.SendNotification();
6069   finishCheck.CheckSignalNotReceived();
6070   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6071
6072   application.SendNotification();
6073   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6074
6075   // We did expect the animation to finish
6076   application.SendNotification();
6077   finishCheck.CheckSignalReceived();
6078   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION );
6079   END_TEST;
6080 }
6081
6082 int UtcDaliAnimationAnimateToVector4P(void)
6083 {
6084   TestApplication application;
6085
6086   Actor actor = Actor::New();
6087
6088   // Register a Vector4 property
6089   Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f);
6090   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6091   Stage::GetCurrent().Add(actor);
6092   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6093   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
6094
6095   // Build the animation
6096   float durationSeconds(2.0f);
6097   Animation animation = Animation::New(durationSeconds);
6098   Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f);
6099   Vector4 relativeValue(targetValue - startValue);
6100   animation.AnimateTo(Property(actor, index), targetValue);
6101
6102   Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6103
6104   // Start the animation
6105   animation.Play();
6106
6107   bool signalReceived(false);
6108   AnimationFinishCheck finishCheck(signalReceived);
6109   animation.FinishedSignal().Connect(&application, finishCheck);
6110
6111   application.SendNotification();
6112   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6113
6114   // We didn't expect the animation to finish yet
6115   application.SendNotification();
6116   finishCheck.CheckSignalNotReceived();
6117   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION );
6118
6119   application.SendNotification();
6120   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6121
6122   // We did expect the animation to finish
6123   application.SendNotification();
6124   finishCheck.CheckSignalReceived();
6125   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
6126   END_TEST;
6127 }
6128
6129 int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void)
6130 {
6131   TestApplication application;
6132
6133   Actor actor = Actor::New();
6134
6135   // Register a Vector4 property
6136   Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
6137   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6138   Stage::GetCurrent().Add(actor);
6139   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6140   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
6141
6142   // Build the animation
6143   float durationSeconds(1.0f);
6144   Animation animation = Animation::New(durationSeconds);
6145   Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
6146   Vector4 relativeValue(targetValue - startValue);
6147   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6148
6149   Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6150
6151   // Start the animation
6152   animation.Play();
6153
6154   bool signalReceived(false);
6155   AnimationFinishCheck finishCheck(signalReceived);
6156   animation.FinishedSignal().Connect(&application, finishCheck);
6157
6158   application.SendNotification();
6159   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6160
6161   // We didn't expect the animation to finish yet
6162   application.SendNotification();
6163   finishCheck.CheckSignalNotReceived();
6164
6165   // The position should have moved more, than with a linear alpha function
6166   Vector4 current( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ) );
6167   DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6168   DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6169   DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
6170   DALI_TEST_CHECK( current.w > ninetyFivePercentProgress.w );
6171
6172   application.SendNotification();
6173   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6174
6175   // We did expect the animation to finish
6176   application.SendNotification();
6177   finishCheck.CheckSignalReceived();
6178   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
6179   END_TEST;
6180 }
6181
6182 int UtcDaliAnimationAnimateToVector4TimePeriodP(void)
6183 {
6184   TestApplication application;
6185
6186   Actor actor = Actor::New();
6187
6188   // Register a Vector4 property
6189   Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6190   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6191   Stage::GetCurrent().Add(actor);
6192   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6193   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6194
6195   // Build the animation
6196   float durationSeconds(1.0f);
6197   Animation animation = Animation::New(durationSeconds);
6198   Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
6199   Vector4 relativeValue(targetValue - startValue);
6200   float delay = 0.5f;
6201   animation.AnimateTo(Property(actor, index),
6202                       targetValue,
6203                       TimePeriod(delay, durationSeconds - delay));
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*500.0f)/* 50% animation progress, 0% animator progress */);
6214
6215   // We didn't expect the animation to finish yet
6216   application.SendNotification();
6217   finishCheck.CheckSignalNotReceived();
6218   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6219
6220   application.SendNotification();
6221   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6222
6223   // We didn't expect the animation to finish yet
6224   application.SendNotification();
6225   finishCheck.CheckSignalNotReceived();
6226   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue+(relativeValue*0.5f), VECTOR4_EPSILON, TEST_LOCATION );
6227
6228   application.SendNotification();
6229   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6230
6231   // We did expect the animation to finish
6232   application.SendNotification();
6233   finishCheck.CheckSignalReceived();
6234   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, VECTOR4_EPSILON, TEST_LOCATION );
6235   END_TEST;
6236 }
6237
6238 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void)
6239 {
6240   TestApplication application;
6241
6242   Actor actor = Actor::New();
6243
6244   // Register a Vector4 property
6245   Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6246   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6247   Stage::GetCurrent().Add(actor);
6248   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6249   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
6250
6251   // Build the animation
6252   float durationSeconds(1.0f);
6253   Animation animation = Animation::New(durationSeconds);
6254   Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
6255   Vector4 relativeValue(targetValue - startValue);
6256   float delay = 0.5f;
6257   animation.AnimateTo(Property(actor, index),
6258                       targetValue,
6259                       AlphaFunction::LINEAR,
6260                       TimePeriod(delay, durationSeconds - delay));
6261
6262   // Start the animation
6263   animation.Play();
6264
6265   bool signalReceived(false);
6266   AnimationFinishCheck finishCheck(signalReceived);
6267   animation.FinishedSignal().Connect(&application, finishCheck);
6268
6269   application.SendNotification();
6270   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6271
6272   // We didn't expect the animation to finish yet
6273   application.SendNotification();
6274   finishCheck.CheckSignalNotReceived();
6275   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION );
6276
6277   application.SendNotification();
6278   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6279
6280   // We didn't expect the animation to finish yet
6281   application.SendNotification();
6282   finishCheck.CheckSignalNotReceived();
6283   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6284
6285   application.SendNotification();
6286   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6287
6288   // We did expect the animation to finish
6289   application.SendNotification();
6290   finishCheck.CheckSignalReceived();
6291   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION );
6292   END_TEST;
6293 }
6294
6295 int UtcDaliAnimationAnimateToActorParentOriginP(void)
6296 {
6297   TestApplication application;
6298
6299   Actor actor = Actor::New();
6300   Stage::GetCurrent().Add(actor);
6301   DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_LEFT, TEST_LOCATION );
6302
6303   // Build the animation
6304   float durationSeconds(1.0f);
6305   Animation animation = Animation::New(durationSeconds);
6306   Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
6307
6308   try
6309   {
6310     animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin );
6311   }
6312   catch (Dali::DaliException& e)
6313   {
6314     DALI_TEST_PRINT_ASSERT( e );
6315     DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6316   }
6317   END_TEST;
6318 }
6319
6320 int UtcDaliAnimationAnimateToActorParentOriginXP(void)
6321 {
6322   TestApplication application;
6323
6324   Actor actor = Actor::New();
6325   Stage::GetCurrent().Add(actor);
6326   float startValue(0.0f);
6327   DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().x, startValue, TEST_LOCATION );
6328   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION );
6329
6330   // Build the animation
6331   float durationSeconds(1.0f);
6332   Animation animation = Animation::New(durationSeconds);
6333   float targetX(1.0f);
6334
6335   try
6336   {
6337     animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX );
6338   }
6339   catch (Dali::DaliException& e)
6340   {
6341     DALI_TEST_PRINT_ASSERT( e );
6342     DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6343   }
6344   END_TEST;
6345 }
6346
6347 int UtcDaliAnimationAnimateToActorParentOriginYP(void)
6348 {
6349   TestApplication application;
6350
6351   Actor actor = Actor::New();
6352   Stage::GetCurrent().Add(actor);
6353   float startValue(0.0f);
6354   DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().y, startValue, TEST_LOCATION );
6355   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION );
6356
6357   // Build the animation
6358   float durationSeconds(1.0f);
6359   Animation animation = Animation::New(durationSeconds);
6360   float targetY(1.0f);
6361
6362   try
6363   {
6364     animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY );
6365   }
6366   catch (Dali::DaliException& e)
6367   {
6368     DALI_TEST_PRINT_ASSERT( e );
6369     DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6370   }
6371   END_TEST;
6372 }
6373
6374 int UtcDaliAnimationAnimateToActorParentOriginZP(void)
6375 {
6376   TestApplication application;
6377
6378   Actor actor = Actor::New();
6379   Stage::GetCurrent().Add(actor);
6380   float startValue(0.5f);
6381   DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().z, startValue, TEST_LOCATION );
6382   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION );
6383
6384   // Build the animation
6385   float durationSeconds(1.0f);
6386   Animation animation = Animation::New(durationSeconds);
6387   float targetZ(1.0f);
6388
6389   try
6390   {
6391     animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ );
6392   }
6393   catch (Dali::DaliException& e)
6394   {
6395     DALI_TEST_PRINT_ASSERT( e );
6396     DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6397   }
6398   END_TEST;
6399 }
6400
6401 int UtcDaliAnimationAnimateToActorAnchorPointP(void)
6402 {
6403   TestApplication application;
6404
6405   Actor actor = Actor::New();
6406   Stage::GetCurrent().Add(actor);
6407   DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), AnchorPoint::CENTER, TEST_LOCATION );
6408
6409   // Build the animation
6410   float durationSeconds(1.0f);
6411   Animation animation = Animation::New(durationSeconds);
6412   Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT);
6413
6414   try
6415   {
6416     animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
6417   }
6418   catch (Dali::DaliException& e)
6419   {
6420     DALI_TEST_PRINT_ASSERT( e );
6421     DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6422   }
6423   END_TEST;
6424 }
6425
6426 int UtcDaliAnimationAnimateToActorAnchorPointXP(void)
6427 {
6428   TestApplication application;
6429
6430   Actor actor = Actor::New();
6431   Stage::GetCurrent().Add(actor);
6432   float startValue(0.5f);
6433   DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().x, startValue, TEST_LOCATION );
6434   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION );
6435
6436   // Build the animation
6437   float durationSeconds(1.0f);
6438   Animation animation = Animation::New(durationSeconds);
6439   float targetX(1.0f);
6440
6441   try
6442   {
6443     animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_X), targetX );
6444   }
6445   catch (Dali::DaliException& e)
6446   {
6447     DALI_TEST_PRINT_ASSERT( e );
6448     DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6449   }
6450   END_TEST;
6451 }
6452
6453 int UtcDaliAnimationAnimateToActorAnchorPointYP(void)
6454 {
6455   TestApplication application;
6456
6457   Actor actor = Actor::New();
6458   Stage::GetCurrent().Add(actor);
6459   float startValue(0.5f);
6460   DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().y, startValue, TEST_LOCATION );
6461   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION );
6462
6463   // Build the animation
6464   float durationSeconds(1.0f);
6465   Animation animation = Animation::New(durationSeconds);
6466   float targetY(0.0f);
6467
6468   try
6469   {
6470     animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY );
6471   }
6472   catch (Dali::DaliException& e)
6473   {
6474     DALI_TEST_PRINT_ASSERT( e );
6475     DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6476   }
6477   END_TEST;
6478 }
6479
6480 int UtcDaliAnimationAnimateToActorAnchorPointZP(void)
6481 {
6482   TestApplication application;
6483
6484   Actor actor = Actor::New();
6485   Stage::GetCurrent().Add(actor);
6486   float startValue(0.5f);
6487   DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().z, startValue, TEST_LOCATION );
6488   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION );
6489
6490   // Build the animation
6491   float durationSeconds(1.0f);
6492   Animation animation = Animation::New(durationSeconds);
6493   float targetZ(100.0f);
6494
6495   try
6496   {
6497     animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ );
6498   }
6499   catch (Dali::DaliException& e)
6500   {
6501     DALI_TEST_PRINT_ASSERT( e );
6502     DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6503   }
6504   END_TEST;
6505 }
6506
6507 int UtcDaliAnimationAnimateToActorSizeP(void)
6508 {
6509   TestApplication application;
6510
6511   Actor actor = Actor::New();
6512   Stage::GetCurrent().Add(actor);
6513   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6514
6515   // Build the animation
6516   float durationSeconds(1.0f);
6517   Animation animation = Animation::New(durationSeconds);
6518   Vector3 targetSize(100.0f, 100.0f, 100.0f);
6519   animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize );
6520
6521   Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
6522
6523   // Should return the initial properties before play
6524   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
6525   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), 0.0f, TEST_LOCATION );
6526   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), 0.0f, TEST_LOCATION );
6527   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), 0.0f, TEST_LOCATION );
6528
6529   // Start the animation
6530   animation.Play();
6531
6532   // Should return the target property after play
6533   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
6534   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
6535   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
6536   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
6537
6538   bool signalReceived(false);
6539   AnimationFinishCheck finishCheck(signalReceived);
6540   animation.FinishedSignal().Connect(&application, finishCheck);
6541
6542   application.SendNotification();
6543   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6544
6545   // We didn't expect the animation to finish yet
6546   application.SendNotification();
6547   finishCheck.CheckSignalNotReceived();
6548   DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
6549
6550   application.SendNotification();
6551   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6552
6553   // We did expect the animation to finish
6554   application.SendNotification();
6555   finishCheck.CheckSignalReceived();
6556   DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6557
6558   // Reset everything
6559   finishCheck.Reset();
6560   actor.SetSize(Vector3::ZERO);
6561   application.SendNotification();
6562   application.Render(0);
6563   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6564
6565   // Repeat with a different (ease-in) alpha function
6566   animation = Animation::New(durationSeconds);
6567   animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
6568   animation.FinishedSignal().Connect(&application, finishCheck);
6569   animation.Play();
6570
6571   application.SendNotification();
6572   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6573
6574   // We didn't expect the animation to finish yet
6575   application.SendNotification();
6576   finishCheck.CheckSignalNotReceived();
6577
6578   // The size should have travelled less, than with a linear alpha function
6579   Vector3 current(actor.GetCurrentSize());
6580   DALI_TEST_CHECK( current.x > 0.0f );
6581   DALI_TEST_CHECK( current.y > 0.0f );
6582   DALI_TEST_CHECK( current.z > 0.0f );
6583   DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
6584   DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
6585   DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
6586
6587   application.SendNotification();
6588   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6589
6590   // We did expect the animation to finish
6591   application.SendNotification();
6592   finishCheck.CheckSignalReceived();
6593   DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6594
6595   // Reset everything
6596   finishCheck.Reset();
6597   actor.SetSize(Vector3::ZERO);
6598   application.SendNotification();
6599   application.Render(0);
6600   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6601
6602   // Repeat with a delay
6603   float delay = 0.5f;
6604   animation = Animation::New(durationSeconds);
6605   animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
6606   animation.FinishedSignal().Connect(&application, finishCheck);
6607   animation.Play();
6608
6609   application.SendNotification();
6610   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6611
6612   // We didn't expect the animation to finish yet
6613   application.SendNotification();
6614   finishCheck.CheckSignalNotReceived();
6615   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6616
6617   application.SendNotification();
6618   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6619
6620   // We did expect the animation to finish
6621   application.SendNotification();
6622   finishCheck.CheckSignalReceived();
6623   DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6624   END_TEST;
6625 }
6626
6627 int UtcDaliAnimationAnimateToActorSizeWidthP(void)
6628 {
6629   TestApplication application;
6630
6631   Actor actor = Actor::New();
6632   Stage::GetCurrent().Add(actor);
6633   float startValue(0.0f);
6634   DALI_TEST_EQUALS( actor.GetCurrentSize().width, startValue, TEST_LOCATION );
6635   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION );
6636
6637   // Build the animation
6638   float durationSeconds(1.0f);
6639   Animation animation = Animation::New(durationSeconds);
6640   float targetWidth(10.0f);
6641   animation.AnimateTo( Property(actor, Actor::Property::SIZE_WIDTH), targetWidth );
6642
6643   float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f);
6644
6645   // Should return the initial properties before play
6646   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
6647   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), startValue, TEST_LOCATION );
6648
6649   // Start the animation
6650   animation.Play();
6651
6652   // Should return the target property after play
6653   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( targetWidth, 0.0f, 0.0f ), TEST_LOCATION );
6654   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetWidth, TEST_LOCATION );
6655
6656   bool signalReceived(false);
6657   AnimationFinishCheck finishCheck(signalReceived);
6658   animation.FinishedSignal().Connect(&application, finishCheck);
6659
6660   application.SendNotification();
6661   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6662
6663   // We didn't expect the animation to finish yet
6664   application.SendNotification();
6665   finishCheck.CheckSignalNotReceived();
6666   DALI_TEST_EQUALS( actor.GetCurrentSize().width, fiftyPercentProgress, TEST_LOCATION );
6667
6668   application.SendNotification();
6669   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6670
6671   // We did expect the animation to finish
6672   application.SendNotification();
6673   finishCheck.CheckSignalReceived();
6674   DALI_TEST_EQUALS( actor.GetCurrentSize().width, targetWidth, TEST_LOCATION );
6675   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION );
6676   END_TEST;
6677 }
6678
6679 int UtcDaliAnimationAnimateToActorSizeHeightP(void)
6680 {
6681   TestApplication application;
6682
6683   Actor actor = Actor::New();
6684   Stage::GetCurrent().Add(actor);
6685   float startValue(0.0f);
6686   DALI_TEST_EQUALS( actor.GetCurrentSize().height, startValue, TEST_LOCATION );
6687   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION );
6688
6689   // Build the animation
6690   float durationSeconds(1.0f);
6691   Animation animation = Animation::New(durationSeconds);
6692   float targetHeight(-10.0f);
6693   animation.AnimateTo( Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight );
6694
6695   float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f);
6696
6697   // Should return the initial properties before play
6698   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
6699   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), startValue, TEST_LOCATION );
6700
6701   // Start the animation
6702   animation.Play();
6703
6704   // Should return the target property after play
6705   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, targetHeight, 0.0f ), TEST_LOCATION );
6706   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetHeight, TEST_LOCATION );
6707
6708   bool signalReceived(false);
6709   AnimationFinishCheck finishCheck(signalReceived);
6710   animation.FinishedSignal().Connect(&application, finishCheck);
6711
6712   application.SendNotification();
6713   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6714
6715   // We didn't expect the animation to finish yet
6716   application.SendNotification();
6717   finishCheck.CheckSignalNotReceived();
6718   DALI_TEST_EQUALS( actor.GetCurrentSize().height, fiftyPercentProgress, TEST_LOCATION );
6719
6720   application.SendNotification();
6721   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6722
6723   // We did expect the animation to finish
6724   application.SendNotification();
6725   finishCheck.CheckSignalReceived();
6726   DALI_TEST_EQUALS( actor.GetCurrentSize().height, targetHeight, TEST_LOCATION );
6727   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION );
6728   END_TEST;
6729 }
6730
6731 int UtcDaliAnimationAnimateToActorSizeDepthP(void)
6732 {
6733   TestApplication application;
6734
6735   Actor actor = Actor::New();
6736   Stage::GetCurrent().Add(actor);
6737   float startValue(0.0f);
6738   DALI_TEST_EQUALS( actor.GetCurrentSize().depth, startValue, TEST_LOCATION );
6739   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION );
6740
6741   // Build the animation
6742   float durationSeconds(1.0f);
6743   Animation animation = Animation::New(durationSeconds);
6744   float targetDepth(-10.0f);
6745   animation.AnimateTo( Property(actor, Actor::Property::SIZE_DEPTH), targetDepth );
6746
6747   float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f);
6748
6749   // Should return the initial properties before play
6750   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
6751   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), startValue, TEST_LOCATION );
6752
6753   // Start the animation
6754   animation.Play();
6755
6756   // Should return the target property after play
6757   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, 0.0f, targetDepth ), TEST_LOCATION );
6758   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetDepth, TEST_LOCATION );
6759
6760   bool signalReceived(false);
6761   AnimationFinishCheck finishCheck(signalReceived);
6762   animation.FinishedSignal().Connect(&application, finishCheck);
6763
6764   application.SendNotification();
6765   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6766
6767   // We didn't expect the animation to finish yet
6768   application.SendNotification();
6769   finishCheck.CheckSignalNotReceived();
6770   DALI_TEST_EQUALS( actor.GetCurrentSize().depth, fiftyPercentProgress, TEST_LOCATION );
6771
6772   application.SendNotification();
6773   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6774
6775   // We did expect the animation to finish
6776   application.SendNotification();
6777   finishCheck.CheckSignalReceived();
6778   DALI_TEST_EQUALS( actor.GetCurrentSize().depth, targetDepth, TEST_LOCATION );
6779   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION );
6780   END_TEST;
6781 }
6782
6783 int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void)
6784 {
6785   TestApplication application;
6786
6787   Actor actor = Actor::New();
6788   Stage::GetCurrent().Add(actor);
6789   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6790
6791   // Build the animation
6792   float durationSeconds(1.0f);
6793   Animation animation = Animation::New(durationSeconds);
6794   Vector3 targetSize(100.0f, 100.0f, 100.0f);
6795   animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetSize );
6796
6797   Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
6798
6799   // Start the animation
6800   animation.Play();
6801
6802   bool signalReceived(false);
6803   AnimationFinishCheck finishCheck(signalReceived);
6804   animation.FinishedSignal().Connect(&application, finishCheck);
6805
6806   application.SendNotification();
6807   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6808
6809   // We didn't expect the animation to finish yet
6810   application.SendNotification();
6811   finishCheck.CheckSignalNotReceived();
6812   DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
6813
6814   application.SendNotification();
6815   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6816
6817   // We did expect the animation to finish
6818   application.SendNotification();
6819   finishCheck.CheckSignalReceived();
6820   DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6821
6822   // Reset everything
6823   finishCheck.Reset();
6824   actor.SetSize(Vector3::ZERO);
6825   application.SendNotification();
6826   application.Render(0);
6827   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6828
6829   // Repeat with a different (ease-in) alpha function
6830   animation = Animation::New(durationSeconds);
6831   animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::EASE_IN );
6832   animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::EASE_IN );
6833   animation.FinishedSignal().Connect(&application, finishCheck);
6834   animation.Play();
6835
6836   application.SendNotification();
6837   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6838
6839   // We didn't expect the animation to finish yet
6840   application.SendNotification();
6841   finishCheck.CheckSignalNotReceived();
6842
6843   // The size should have travelled less, than with a linear alpha function
6844   Vector3 current(actor.GetCurrentSize());
6845   DALI_TEST_CHECK( current.x > 0.0f );
6846   DALI_TEST_CHECK( current.y > 0.0f );
6847   DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
6848   DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
6849
6850   application.SendNotification();
6851   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6852
6853   // We did expect the animation to finish
6854   application.SendNotification();
6855   finishCheck.CheckSignalReceived();
6856   DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
6857   DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
6858
6859   // Reset everything
6860   finishCheck.Reset();
6861   actor.SetSize(Vector3::ZERO);
6862   application.SendNotification();
6863   application.Render(0);
6864   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6865
6866   // Repeat with a delay
6867   float delay = 0.5f;
6868   animation = Animation::New(durationSeconds);
6869   animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
6870   animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
6871   animation.FinishedSignal().Connect(&application, finishCheck);
6872   animation.Play();
6873
6874   application.SendNotification();
6875   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6876
6877   // We didn't expect the animation to finish yet
6878   application.SendNotification();
6879   finishCheck.CheckSignalNotReceived();
6880   DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6881
6882   application.SendNotification();
6883   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6884
6885   // We did expect the animation to finish
6886   application.SendNotification();
6887   finishCheck.CheckSignalReceived();
6888   DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
6889   DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
6890   END_TEST;
6891 }
6892
6893 int UtcDaliAnimationAnimateToActorPositionP(void)
6894 {
6895   TestApplication application;
6896
6897   Actor actor = Actor::New();
6898   Stage::GetCurrent().Add(actor);
6899   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6900
6901   // Build the animation
6902   float durationSeconds(1.0f);
6903   Animation animation = Animation::New(durationSeconds);
6904   Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6905   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
6906
6907   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6908
6909   // Should return the initial properties before play
6910   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
6911   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
6912   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), 0.0f, TEST_LOCATION );
6913   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), 0.0f, TEST_LOCATION );
6914
6915   // Start the animation
6916   animation.Play();
6917
6918   // Should return the target property after play
6919   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
6920   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetPosition.x, TEST_LOCATION );
6921   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetPosition.y, TEST_LOCATION );
6922   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetPosition.z, TEST_LOCATION );
6923
6924   bool signalReceived(false);
6925   AnimationFinishCheck finishCheck(signalReceived);
6926   animation.FinishedSignal().Connect(&application, finishCheck);
6927
6928   application.SendNotification();
6929   application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
6930
6931   // We didn't expect the animation to finish yet
6932   application.SendNotification();
6933   finishCheck.CheckSignalNotReceived();
6934   DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
6935
6936   application.SendNotification();
6937   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6938
6939   // We did expect the animation to finish
6940   application.SendNotification();
6941   finishCheck.CheckSignalReceived();
6942   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6943   END_TEST;
6944 }
6945
6946 int UtcDaliAnimationAnimateToActorPositionXP(void)
6947 {
6948   TestApplication application;
6949
6950   Actor actor = Actor::New();
6951   Stage::GetCurrent().Add(actor);
6952   float startValue(0.0f);
6953   DALI_TEST_EQUALS( actor.GetCurrentPosition().x, startValue, TEST_LOCATION );
6954   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6955   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6956   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6957
6958   // Build the animation
6959   float durationSeconds(1.0f);
6960   Animation animation = Animation::New(durationSeconds);
6961   float targetX(1.0f);
6962   animation.AnimateTo( Property(actor, Actor::Property::POSITION_X), targetX );
6963
6964   float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
6965
6966   // Should return the initial properties before play
6967   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
6968   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), startValue, TEST_LOCATION );
6969
6970   // Start the animation
6971   animation.Play();
6972
6973   // Should return the target property after play
6974   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( targetX, 0.0f, 0.0f ), TEST_LOCATION );
6975   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetX, TEST_LOCATION );
6976
6977   bool signalReceived(false);
6978   AnimationFinishCheck finishCheck(signalReceived);
6979   animation.FinishedSignal().Connect(&application, finishCheck);
6980
6981   application.SendNotification();
6982   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6983
6984   // We didn't expect the animation to finish yet
6985   application.SendNotification();
6986   finishCheck.CheckSignalNotReceived();
6987   DALI_TEST_EQUALS( actor.GetCurrentPosition().x, fiftyPercentProgress, TEST_LOCATION );
6988
6989   application.SendNotification();
6990   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6991
6992   // We did expect the animation to finish
6993   application.SendNotification();
6994   finishCheck.CheckSignalReceived();
6995   DALI_TEST_EQUALS( actor.GetCurrentPosition().x, targetX, TEST_LOCATION );
6996   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION );
6997   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6998   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6999   END_TEST;
7000 }
7001
7002 int UtcDaliAnimationAnimateToActorPositionYP(void)
7003 {
7004   TestApplication application;
7005
7006   Actor actor = Actor::New();
7007   Stage::GetCurrent().Add(actor);
7008   float startValue(0.0f);
7009   DALI_TEST_EQUALS( actor.GetCurrentPosition().y, startValue, TEST_LOCATION );
7010   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7011   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7012   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7013
7014   // Build the animation
7015   float durationSeconds(1.0f);
7016   Animation animation = Animation::New(durationSeconds);
7017   float targetY(10.0f);
7018   animation.AnimateTo( Property(actor, Actor::Property::POSITION_Y), targetY );
7019
7020   float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
7021
7022   // Should return the initial properties before play
7023   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7024   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), startValue, TEST_LOCATION );
7025
7026   // Start the animation
7027   animation.Play();
7028
7029   // Should return the target property after play
7030   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, targetY, 0.0f ), TEST_LOCATION );
7031   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetY, TEST_LOCATION );
7032
7033   bool signalReceived(false);
7034   AnimationFinishCheck finishCheck(signalReceived);
7035   animation.FinishedSignal().Connect(&application, finishCheck);
7036
7037   application.SendNotification();
7038   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7039
7040   // We didn't expect the animation to finish yet
7041   application.SendNotification();
7042   finishCheck.CheckSignalNotReceived();
7043   DALI_TEST_EQUALS( actor.GetCurrentPosition().y, fiftyPercentProgress, TEST_LOCATION );
7044
7045   application.SendNotification();
7046   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7047
7048   // We did expect the animation to finish
7049   application.SendNotification();
7050   finishCheck.CheckSignalReceived();
7051   DALI_TEST_EQUALS( actor.GetCurrentPosition().y, targetY, TEST_LOCATION );
7052   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7053   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION );
7054   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7055   END_TEST;
7056 }
7057
7058 int UtcDaliAnimationAnimateToActorPositionZP(void)
7059 {
7060   TestApplication application;
7061
7062   Actor actor = Actor::New();
7063   Stage::GetCurrent().Add(actor);
7064   float startValue(0.0f);
7065   DALI_TEST_EQUALS( actor.GetCurrentPosition().z, startValue, TEST_LOCATION );
7066   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7067   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7068   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7069
7070   // Build the animation
7071   float durationSeconds(1.0f);
7072   Animation animation = Animation::New(durationSeconds);
7073   float targetZ(-5.0f);
7074   animation.AnimateTo( Property(actor, Actor::Property::POSITION_Z), targetZ );
7075
7076   float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
7077
7078   // Should return the initial properties before play
7079   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7080   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), startValue, TEST_LOCATION );
7081
7082   // Start the animation
7083   animation.Play();
7084
7085   // Should return the target property after play
7086   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, targetZ ), TEST_LOCATION );
7087   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetZ, TEST_LOCATION );
7088
7089   bool signalReceived(false);
7090   AnimationFinishCheck finishCheck(signalReceived);
7091   animation.FinishedSignal().Connect(&application, finishCheck);
7092
7093   application.SendNotification();
7094   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7095
7096   // We didn't expect the animation to finish yet
7097   application.SendNotification();
7098   finishCheck.CheckSignalNotReceived();
7099   DALI_TEST_EQUALS( actor.GetCurrentPosition().z, fiftyPercentProgress, TEST_LOCATION );
7100
7101   application.SendNotification();
7102   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7103
7104   // We did expect the animation to finish
7105   application.SendNotification();
7106   finishCheck.CheckSignalReceived();
7107   DALI_TEST_EQUALS( actor.GetCurrentPosition().z, targetZ, TEST_LOCATION );
7108   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7109   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7110   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION );
7111   END_TEST;
7112 }
7113
7114 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void)
7115 {
7116   TestApplication application;
7117
7118   Actor actor = Actor::New();
7119   Stage::GetCurrent().Add(actor);
7120   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7121
7122   // Build the animation
7123   float durationSeconds(1.0f);
7124   Animation animation = Animation::New(durationSeconds);
7125   Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7126   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
7127
7128   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7129
7130   // Start the animation
7131   animation.Play();
7132
7133   bool signalReceived(false);
7134   AnimationFinishCheck finishCheck(signalReceived);
7135   animation.FinishedSignal().Connect(&application, finishCheck);
7136
7137   application.SendNotification();
7138   application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
7139
7140   // We didn't expect the animation to finish yet
7141   application.SendNotification();
7142   finishCheck.CheckSignalNotReceived();
7143
7144   // The position should have moved less, than with a linear alpha function
7145   Vector3 current(actor.GetCurrentPosition());
7146   DALI_TEST_CHECK( current.x > Vector3::ZERO.x );
7147   DALI_TEST_CHECK( current.y > Vector3::ZERO.y );
7148   DALI_TEST_CHECK( current.z > Vector3::ZERO.z );
7149   DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x );
7150   DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y );
7151   DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z );
7152
7153   application.SendNotification();
7154   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7155
7156   // We did expect the animation to finish
7157   application.SendNotification();
7158   finishCheck.CheckSignalReceived();
7159   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7160   END_TEST;
7161 }
7162
7163 int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void)
7164 {
7165   TestApplication application;
7166
7167   Actor actor = Actor::New();
7168   Stage::GetCurrent().Add(actor);
7169   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7170
7171   // Build the animation
7172   float durationSeconds(1.0f);
7173   Animation animation = Animation::New(durationSeconds);
7174   Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7175   float delay = 0.5f;
7176   animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7177                        targetPosition,
7178                        TimePeriod( delay, durationSeconds - delay ) );
7179
7180   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7181
7182   // Start the animation
7183   animation.Play();
7184
7185   bool signalReceived(false);
7186   AnimationFinishCheck finishCheck(signalReceived);
7187   animation.FinishedSignal().Connect(&application, finishCheck);
7188
7189   application.SendNotification();
7190   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7191
7192   // We didn't expect the animation to finish yet
7193   application.SendNotification();
7194   finishCheck.CheckSignalNotReceived();
7195   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7196
7197   application.SendNotification();
7198   application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7199
7200   // We didn't expect the animation to finish yet
7201   application.SendNotification();
7202   finishCheck.CheckSignalNotReceived();
7203   DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7204
7205   application.SendNotification();
7206   application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7207
7208   // We did expect the animation to finish
7209   application.SendNotification();
7210   finishCheck.CheckSignalReceived();
7211   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7212   END_TEST;
7213 }
7214
7215 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void)
7216 {
7217   TestApplication application;
7218
7219   Actor actor = Actor::New();
7220   Stage::GetCurrent().Add(actor);
7221   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7222
7223   // Build the animation
7224   float durationSeconds(1.0f);
7225   Animation animation = Animation::New(durationSeconds);
7226   Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7227   float delay = 0.5f;
7228   animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7229                        targetPosition,
7230                        AlphaFunction::LINEAR,
7231                        TimePeriod( delay, durationSeconds - delay ) );
7232
7233   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7234
7235   // Start the animation
7236   animation.Play();
7237
7238   bool signalReceived(false);
7239   AnimationFinishCheck finishCheck(signalReceived);
7240   animation.FinishedSignal().Connect(&application, finishCheck);
7241
7242   application.SendNotification();
7243   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7244
7245   // We didn't expect the animation to finish yet
7246   application.SendNotification();
7247   finishCheck.CheckSignalNotReceived();
7248   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7249
7250   application.SendNotification();
7251   application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7252
7253   // We didn't expect the animation to finish yet
7254   application.SendNotification();
7255   finishCheck.CheckSignalNotReceived();
7256   DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7257
7258   application.SendNotification();
7259   application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7260
7261   // We did expect the animation to finish
7262   application.SendNotification();
7263   finishCheck.CheckSignalReceived();
7264   DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7265   END_TEST;
7266 }
7267
7268 int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void)
7269 {
7270   TestApplication application;
7271
7272   Actor actor = Actor::New();
7273   actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7274   Stage::GetCurrent().Add(actor);
7275   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7276
7277   // Build the animation
7278   float durationSeconds(1.0f);
7279   Animation animation = Animation::New(durationSeconds);
7280   Degree targetRotationDegrees(90.0f);
7281   Radian targetRotationRadians(targetRotationDegrees);
7282   animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS) );
7283
7284   // Start the animation
7285   animation.Play();
7286
7287   // Target value should be retrievable straight away
7288   DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7289
7290   bool signalReceived(false);
7291   AnimationFinishCheck finishCheck(signalReceived);
7292   animation.FinishedSignal().Connect(&application, finishCheck);
7293
7294   application.SendNotification();
7295   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7296
7297   // We didn't expect the animation to finish yet
7298   application.SendNotification();
7299   finishCheck.CheckSignalNotReceived();
7300   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7301
7302   application.SendNotification();
7303   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7304
7305   // We didn't expect the animation to finish yet
7306   application.SendNotification();
7307   finishCheck.CheckSignalNotReceived();
7308   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7309
7310   application.SendNotification();
7311   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7312
7313   // We didn't expect the animation to finish yet
7314   application.SendNotification();
7315   finishCheck.CheckSignalNotReceived();
7316   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7317
7318   application.SendNotification();
7319   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7320
7321   // We did expect the animation to finish
7322   application.SendNotification();
7323   finishCheck.CheckSignalReceived();
7324   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7325   END_TEST;
7326 }
7327
7328 int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void)
7329 {
7330   TestApplication application;
7331
7332   Actor actor = Actor::New();
7333   actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7334   Stage::GetCurrent().Add(actor);
7335   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7336
7337   // Build the animation
7338   float durationSeconds(1.0f);
7339   Animation animation = Animation::New(durationSeconds);
7340   Degree targetRotationDegrees(90.0f);
7341   Radian targetRotationRadians(targetRotationDegrees);
7342   Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
7343   animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), targetRotation );
7344
7345   // Start the animation
7346   animation.Play();
7347
7348   bool signalReceived(false);
7349   AnimationFinishCheck finishCheck(signalReceived);
7350   animation.FinishedSignal().Connect(&application, finishCheck);
7351
7352   application.SendNotification();
7353   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7354
7355   // We didn't expect the animation to finish yet
7356   application.SendNotification();
7357   finishCheck.CheckSignalNotReceived();
7358   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7359
7360   application.SendNotification();
7361   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7362
7363   // We didn't expect the animation to finish yet
7364   application.SendNotification();
7365   finishCheck.CheckSignalNotReceived();
7366   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7367
7368   application.SendNotification();
7369   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7370
7371   // We didn't expect the animation to finish yet
7372   application.SendNotification();
7373   finishCheck.CheckSignalNotReceived();
7374   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7375
7376   application.SendNotification();
7377   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7378
7379   // We did expect the animation to finish
7380   application.SendNotification();
7381   finishCheck.CheckSignalReceived();
7382   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7383   END_TEST;
7384 }
7385
7386 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void)
7387 {
7388   TestApplication application;
7389
7390   Actor actor = Actor::New();
7391   actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7392   Stage::GetCurrent().Add(actor);
7393   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7394
7395   // Build the animation
7396   float durationSeconds(1.0f);
7397   Animation animation = Animation::New(durationSeconds);
7398   Degree targetRotationDegrees(90.0f);
7399   Radian targetRotationRadians(targetRotationDegrees);
7400   animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
7401
7402   // Start the animation
7403   animation.Play();
7404
7405   bool signalReceived(false);
7406   AnimationFinishCheck finishCheck(signalReceived);
7407   animation.FinishedSignal().Connect(&application, finishCheck);
7408
7409   application.SendNotification();
7410   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7411
7412   // We didn't expect the animation to finish yet
7413   application.SendNotification();
7414   finishCheck.CheckSignalNotReceived();
7415   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7416
7417   application.SendNotification();
7418   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7419
7420   // We didn't expect the animation to finish yet
7421   application.SendNotification();
7422   finishCheck.CheckSignalNotReceived();
7423   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7424
7425   application.SendNotification();
7426   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7427
7428   // We didn't expect the animation to finish yet
7429   application.SendNotification();
7430   finishCheck.CheckSignalNotReceived();
7431   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7432
7433   application.SendNotification();
7434   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7435
7436   // We did expect the animation to finish
7437   application.SendNotification();
7438   finishCheck.CheckSignalReceived();
7439   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7440   END_TEST;
7441 }
7442
7443 int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void)
7444 {
7445   TestApplication application;
7446
7447   Actor actor = Actor::New();
7448   actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7449   Stage::GetCurrent().Add(actor);
7450   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7451
7452   // Build the animation
7453   float durationSeconds(1.0f);
7454   Animation animation = Animation::New(durationSeconds);
7455   Degree targetRotationDegrees(90.0f);
7456   Radian targetRotationRadians(targetRotationDegrees);
7457   float delay(0.1f);
7458   animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
7459
7460   // Start the animation
7461   animation.Play();
7462
7463   bool signalReceived(false);
7464   AnimationFinishCheck finishCheck(signalReceived);
7465   animation.FinishedSignal().Connect(&application, finishCheck);
7466
7467   application.SendNotification();
7468   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7469
7470   // We didn't expect the animation to finish yet
7471   application.SendNotification();
7472   finishCheck.CheckSignalNotReceived();
7473   float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7474   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7475
7476   application.SendNotification();
7477   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7478
7479   // We didn't expect the animation to finish yet
7480   application.SendNotification();
7481   finishCheck.CheckSignalNotReceived();
7482   progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7483   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7484
7485   application.SendNotification();
7486   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7487
7488   // We didn't expect the animation to finish yet
7489   application.SendNotification();
7490   finishCheck.CheckSignalNotReceived();
7491   progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7492   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7493
7494   application.SendNotification();
7495   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7496
7497   // We did expect the animation to finish
7498   application.SendNotification();
7499   finishCheck.CheckSignalReceived();
7500   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7501   END_TEST;
7502 }
7503
7504 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void)
7505 {
7506   TestApplication application;
7507
7508   Actor actor = Actor::New();
7509   actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7510   Stage::GetCurrent().Add(actor);
7511   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7512
7513   // Build the animation
7514   float durationSeconds(1.0f);
7515   Animation animation = Animation::New(durationSeconds);
7516   Degree targetRotationDegrees(90.0f);
7517   Radian targetRotationRadians(targetRotationDegrees);
7518   float delay(0.1f);
7519   animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
7520
7521   // Start the animation
7522   animation.Play();
7523
7524   bool signalReceived(false);
7525   AnimationFinishCheck finishCheck(signalReceived);
7526   animation.FinishedSignal().Connect(&application, finishCheck);
7527
7528   application.SendNotification();
7529   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7530
7531   // We didn't expect the animation to finish yet
7532   application.SendNotification();
7533   finishCheck.CheckSignalNotReceived();
7534   float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7535   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7536
7537   application.SendNotification();
7538   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7539
7540   // We didn't expect the animation to finish yet
7541   application.SendNotification();
7542   finishCheck.CheckSignalNotReceived();
7543   progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7544   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7545
7546   application.SendNotification();
7547   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7548
7549   // We didn't expect the animation to finish yet
7550   application.SendNotification();
7551   finishCheck.CheckSignalNotReceived();
7552   progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7553   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7554
7555   application.SendNotification();
7556   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7557
7558   // We did expect the animation to finish
7559   application.SendNotification();
7560   finishCheck.CheckSignalReceived();
7561   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7562   END_TEST;
7563 }
7564
7565 int UtcDaliAnimationAnimateToActorScaleP(void)
7566 {
7567   TestApplication application;
7568
7569   Actor actor = Actor::New();
7570   Stage::GetCurrent().Add(actor);
7571   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7572
7573   // Build the animation
7574   float durationSeconds(1.0f);
7575   Animation animation = Animation::New(durationSeconds);
7576   Vector3 targetScale(2.0f, 2.0f, 2.0f);
7577   animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale );
7578
7579   Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f);
7580
7581   // Start the animation
7582   animation.Play();
7583
7584   // Target value should be retrievable straight away
7585   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
7586   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetScale.x, TEST_LOCATION );
7587   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetScale.y, TEST_LOCATION );
7588   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetScale.z, TEST_LOCATION );
7589
7590   bool signalReceived(false);
7591   AnimationFinishCheck finishCheck(signalReceived);
7592   animation.FinishedSignal().Connect(&application, finishCheck);
7593
7594   application.SendNotification();
7595   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7596
7597   // We didn't expect the animation to finish yet
7598   application.SendNotification();
7599   finishCheck.CheckSignalNotReceived();
7600   DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
7601
7602   application.SendNotification();
7603   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7604
7605   // We did expect the animation to finish
7606   application.SendNotification();
7607   finishCheck.CheckSignalReceived();
7608   DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7609
7610   // Reset everything
7611   finishCheck.Reset();
7612   actor.SetScale(Vector3::ONE);
7613   application.SendNotification();
7614   application.Render(0);
7615   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7616
7617   // Repeat with a different (ease-in) alpha function
7618   animation = Animation::New(durationSeconds);
7619   animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
7620   animation.FinishedSignal().Connect(&application, finishCheck);
7621   animation.Play();
7622
7623   application.SendNotification();
7624   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7625
7626   // We didn't expect the animation to finish yet
7627   application.SendNotification();
7628   finishCheck.CheckSignalNotReceived();
7629
7630   // The scale should have grown less, than with a linear alpha function
7631   Vector3 current(actor.GetCurrentScale());
7632   DALI_TEST_CHECK( current.x > 1.0f );
7633   DALI_TEST_CHECK( current.y > 1.0f );
7634   DALI_TEST_CHECK( current.z > 1.0f );
7635   DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
7636   DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
7637   DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
7638
7639   application.SendNotification();
7640   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7641
7642   // We did expect the animation to finish
7643   application.SendNotification();
7644   finishCheck.CheckSignalReceived();
7645   DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7646
7647   // Reset everything
7648   finishCheck.Reset();
7649   actor.SetScale(Vector3::ONE);
7650   application.SendNotification();
7651   application.Render(0);
7652   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7653
7654   // Repeat with a delay
7655   float delay = 0.5f;
7656   animation = Animation::New(durationSeconds);
7657   animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7658   animation.FinishedSignal().Connect(&application, finishCheck);
7659   animation.Play();
7660
7661   application.SendNotification();
7662   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7663
7664   // We didn't expect the animation to finish yet
7665   application.SendNotification();
7666   finishCheck.CheckSignalNotReceived();
7667   DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7668
7669   application.SendNotification();
7670   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7671
7672   // We did expect the animation to finish
7673   application.SendNotification();
7674   finishCheck.CheckSignalReceived();
7675   DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7676   END_TEST;
7677 }
7678
7679 int UtcDaliAnimationAnimateToActorScaleXP(void)
7680 {
7681   TestApplication application;
7682
7683   Actor actor = Actor::New();
7684   Stage::GetCurrent().Add(actor);
7685   float startValue(1.0f);
7686   DALI_TEST_EQUALS( actor.GetCurrentScale().x, startValue, TEST_LOCATION );
7687   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7688   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7689   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7690   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7691   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7692   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7693
7694   // Build the animation
7695   float durationSeconds(1.0f);
7696   Animation animation = Animation::New(durationSeconds);
7697   float targetX(10.0f);
7698   animation.AnimateTo( Property(actor, Actor::Property::SCALE_X), targetX );
7699
7700   float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
7701
7702   // Start the animation
7703   animation.Play();
7704
7705   // Target value should be retrievable straight away
7706   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( targetX, startValue, startValue ), TEST_LOCATION );
7707   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetX, TEST_LOCATION );
7708
7709   bool signalReceived(false);
7710   AnimationFinishCheck finishCheck(signalReceived);
7711   animation.FinishedSignal().Connect(&application, finishCheck);
7712
7713   application.SendNotification();
7714   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7715
7716   // We didn't expect the animation to finish yet
7717   application.SendNotification();
7718   finishCheck.CheckSignalNotReceived();
7719   DALI_TEST_EQUALS( actor.GetCurrentScale().x, fiftyPercentProgress, TEST_LOCATION );
7720   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), fiftyPercentProgress, TEST_LOCATION );
7721   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7722   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7723
7724   application.SendNotification();
7725   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7726
7727   // We did expect the animation to finish
7728   application.SendNotification();
7729   finishCheck.CheckSignalReceived();
7730   DALI_TEST_EQUALS( actor.GetCurrentScale().x, targetX, TEST_LOCATION );
7731   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), targetX, TEST_LOCATION );
7732   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7733   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7734   END_TEST;
7735 }
7736
7737 int UtcDaliAnimationAnimateToActorScaleYP(void)
7738 {
7739   TestApplication application;
7740
7741   Actor actor = Actor::New();
7742   Stage::GetCurrent().Add(actor);
7743   float startValue(1.0f);
7744   DALI_TEST_EQUALS( actor.GetCurrentScale().y, startValue, TEST_LOCATION );
7745   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7746   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7747   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7748   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7749   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7750   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7751
7752   // Build the animation
7753   float durationSeconds(1.0f);
7754   Animation animation = Animation::New(durationSeconds);
7755   float targetY(1000.0f);
7756   animation.AnimateTo( Property(actor, Actor::Property::SCALE_Y), targetY );
7757
7758   float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
7759
7760   // Start the animation
7761   animation.Play();
7762
7763   // Target value should be retrievable straight away
7764   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, targetY, startValue ), TEST_LOCATION );
7765   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetY, TEST_LOCATION );
7766
7767   bool signalReceived(false);
7768   AnimationFinishCheck finishCheck(signalReceived);
7769   animation.FinishedSignal().Connect(&application, finishCheck);
7770
7771   application.SendNotification();
7772   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7773
7774   // We didn't expect the animation to finish yet
7775   application.SendNotification();
7776   finishCheck.CheckSignalNotReceived();
7777   DALI_TEST_EQUALS( actor.GetCurrentScale().y, fiftyPercentProgress, TEST_LOCATION );
7778   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7779   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), fiftyPercentProgress, TEST_LOCATION );
7780   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7781
7782   application.SendNotification();
7783   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7784
7785   // We did expect the animation to finish
7786   application.SendNotification();
7787   finishCheck.CheckSignalReceived();
7788   DALI_TEST_EQUALS( actor.GetCurrentScale().y, targetY, TEST_LOCATION );
7789   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7790   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), targetY, TEST_LOCATION );
7791   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7792   END_TEST;
7793 }
7794
7795 int UtcDaliAnimationAnimateToActorScaleZP(void)
7796 {
7797   TestApplication application;
7798
7799   Actor actor = Actor::New();
7800   Stage::GetCurrent().Add(actor);
7801   float startValue(1.0f);
7802   DALI_TEST_EQUALS( actor.GetCurrentScale().z, startValue, TEST_LOCATION );
7803   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7804   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7805   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7806   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7807   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7808   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7809
7810   // Build the animation
7811   float durationSeconds(1.0f);
7812   Animation animation = Animation::New(durationSeconds);
7813   float targetZ(-1000.0f);
7814   animation.AnimateTo( Property(actor, Actor::Property::SCALE_Z), targetZ );
7815
7816   float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
7817
7818   // Start the animation
7819   animation.Play();
7820
7821   // Target value should be retrievable straight away
7822   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, startValue, targetZ ), TEST_LOCATION );
7823   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION );
7824
7825   bool signalReceived(false);
7826   AnimationFinishCheck finishCheck(signalReceived);
7827   animation.FinishedSignal().Connect(&application, finishCheck);
7828
7829   application.SendNotification();
7830   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7831
7832   // We didn't expect the animation to finish yet
7833   application.SendNotification();
7834   finishCheck.CheckSignalNotReceived();
7835   DALI_TEST_EQUALS( actor.GetCurrentScale().z, fiftyPercentProgress, TEST_LOCATION );
7836   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7837   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7838   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), fiftyPercentProgress, TEST_LOCATION );
7839
7840   application.SendNotification();
7841   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7842
7843   // We did expect the animation to finish
7844   application.SendNotification();
7845   finishCheck.CheckSignalReceived();
7846   DALI_TEST_EQUALS( actor.GetCurrentScale().z, targetZ, TEST_LOCATION );
7847   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7848   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7849   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION );
7850   END_TEST;
7851 }
7852
7853 int UtcDaliAnimationAnimateToActorColorP(void)
7854 {
7855   TestApplication application;
7856
7857   Actor actor = Actor::New();
7858   Stage::GetCurrent().Add(actor);
7859   DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7860
7861   // Build the animation
7862   float durationSeconds(1.0f);
7863   Animation animation = Animation::New(durationSeconds);
7864   Vector4 targetColor(Color::RED);
7865   animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor );
7866
7867   Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
7868   Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
7869
7870   // Start the animation
7871   animation.Play();
7872
7873   // Target value should be retrievable straight away
7874   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
7875   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
7876   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
7877   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
7878   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
7879   DALI_TEST_EQUALS( actor.GetProperty< float >( DevelActor::Property::OPACITY ), targetColor.a, TEST_LOCATION );
7880
7881   bool signalReceived(false);
7882   AnimationFinishCheck finishCheck(signalReceived);
7883   animation.FinishedSignal().Connect(&application, finishCheck);
7884
7885   application.SendNotification();
7886   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7887
7888   // We didn't expect the animation to finish yet
7889   application.SendNotification();
7890   finishCheck.CheckSignalNotReceived();
7891   DALI_TEST_EQUALS( actor.GetCurrentColor(), tenPercentProgress, TEST_LOCATION );
7892
7893   application.SendNotification();
7894   application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7895
7896   // We did expect the animation to finish
7897   application.SendNotification();
7898   finishCheck.CheckSignalReceived();
7899   DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7900
7901   // Reset everything
7902   finishCheck.Reset();
7903   actor.SetColor(Color::WHITE);
7904   application.SendNotification();
7905   application.Render(0);
7906   DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7907
7908   // Repeat with a different (ease-in) alpha function
7909   animation = Animation::New(durationSeconds);
7910   animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
7911   animation.FinishedSignal().Connect(&application, finishCheck);
7912   animation.Play();
7913
7914   application.SendNotification();
7915   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7916
7917   // We didn't expect the animation to finish yet
7918   application.SendNotification();
7919   finishCheck.CheckSignalNotReceived();
7920
7921   // The color should have changed less, than with a linear alpha function
7922   Vector4 current(actor.GetCurrentColor());
7923   DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change
7924   DALI_TEST_CHECK( current.y < 1.0f );
7925   DALI_TEST_CHECK( current.y > tenPercentProgress.y );
7926   DALI_TEST_CHECK( current.z  < 1.0f );
7927   DALI_TEST_CHECK( current.z  > tenPercentProgress.z );
7928   DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
7929
7930   application.SendNotification();
7931   application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7932
7933   // We did expect the animation to finish
7934   application.SendNotification();
7935   finishCheck.CheckSignalReceived();
7936   DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7937
7938   // Reset everything
7939   finishCheck.Reset();
7940   actor.SetColor(Color::WHITE);
7941   application.SendNotification();
7942   application.Render(0);
7943   DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7944
7945   // Repeat with a shorter animator duration
7946   float animatorDuration = 0.5f;
7947   animation = Animation::New(durationSeconds);
7948   animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
7949   animation.FinishedSignal().Connect(&application, finishCheck);
7950   animation.Play();
7951
7952   application.SendNotification();
7953   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
7954
7955   // We didn't expect the animation to finish yet
7956   application.SendNotification();
7957   finishCheck.CheckSignalNotReceived();
7958   DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION );
7959
7960   application.SendNotification();
7961   application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
7962
7963   // We didn't expect the animation to finish yet
7964   application.SendNotification();
7965   finishCheck.CheckSignalNotReceived();
7966   DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7967
7968   application.SendNotification();
7969   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7970
7971   // We did expect the animation to finish
7972   application.SendNotification();
7973   finishCheck.CheckSignalReceived();
7974   DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7975   END_TEST;
7976 }
7977
7978 int UtcDaliAnimationAnimateToActorColorRedP(void)
7979 {
7980   TestApplication application;
7981
7982   Actor actor = Actor::New();
7983   Stage::GetCurrent().Add(actor);
7984   float startValue(1.0f);
7985   DALI_TEST_EQUALS( actor.GetCurrentColor().r, startValue, TEST_LOCATION );
7986   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
7987   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7988   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
7989   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7990   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
7991   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
7992   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
7993   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
7994
7995   // Build the animation
7996   float durationSeconds(1.0f);
7997   Animation animation = Animation::New(durationSeconds);
7998   float targetRed(0.5f);
7999   animation.AnimateTo( Property(actor, Actor::Property::COLOR_RED), targetRed );
8000
8001   float fiftyPercentProgress(startValue + (targetRed - startValue)*0.5f);
8002
8003   // Start the animation
8004   animation.Play();
8005
8006   // Target value should be retrievable straight away
8007   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( targetRed, startValue, startValue, startValue ), TEST_LOCATION );
8008   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetRed, TEST_LOCATION );
8009
8010   bool signalReceived(false);
8011   AnimationFinishCheck finishCheck(signalReceived);
8012   animation.FinishedSignal().Connect(&application, finishCheck);
8013
8014   application.SendNotification();
8015   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8016
8017   // We didn't expect the animation to finish yet
8018   application.SendNotification();
8019   finishCheck.CheckSignalNotReceived();
8020   DALI_TEST_EQUALS( actor.GetCurrentColor().r, fiftyPercentProgress, TEST_LOCATION );
8021   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED),   fiftyPercentProgress, TEST_LOCATION );
8022   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue,           TEST_LOCATION );
8023   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE),  startValue,           TEST_LOCATION );
8024   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), startValue,           TEST_LOCATION );
8025
8026   application.SendNotification();
8027   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8028
8029   // We did expect the animation to finish
8030   application.SendNotification();
8031   finishCheck.CheckSignalReceived();
8032   DALI_TEST_EQUALS( actor.GetCurrentColor().r, targetRed, TEST_LOCATION );
8033   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED),   targetRed,  TEST_LOCATION );
8034   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8035   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8036   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8037   END_TEST;
8038 }
8039
8040 int UtcDaliAnimationAnimateToActorColorGreenP(void)
8041 {
8042   TestApplication application;
8043
8044   Actor actor = Actor::New();
8045   Stage::GetCurrent().Add(actor);
8046   float startValue(1.0f);
8047   DALI_TEST_EQUALS( actor.GetCurrentColor().g, startValue, TEST_LOCATION );
8048   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8049   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8050   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8051   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8052   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8053   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8054   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8055   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8056
8057   // Build the animation
8058   float durationSeconds(1.0f);
8059   Animation animation = Animation::New(durationSeconds);
8060   float targetGreen(0.5f);
8061   animation.AnimateTo( Property(actor, Actor::Property::COLOR_GREEN), targetGreen );
8062
8063   float fiftyPercentProgress(startValue + (targetGreen - startValue)*0.5f);
8064
8065   // Start the animation
8066   animation.Play();
8067
8068   // Target value should be retrievable straight away
8069   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, targetGreen, startValue, startValue ), TEST_LOCATION );
8070   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetGreen, TEST_LOCATION );
8071
8072   bool signalReceived(false);
8073   AnimationFinishCheck finishCheck(signalReceived);
8074   animation.FinishedSignal().Connect(&application, finishCheck);
8075
8076   application.SendNotification();
8077   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8078
8079   // We didn't expect the animation to finish yet
8080   application.SendNotification();
8081   finishCheck.CheckSignalNotReceived();
8082   DALI_TEST_EQUALS( actor.GetCurrentColor().g, fiftyPercentProgress, TEST_LOCATION );
8083   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED),   startValue,           TEST_LOCATION );
8084   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION );
8085   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE),  startValue,           TEST_LOCATION );
8086   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), startValue,           TEST_LOCATION );
8087
8088   application.SendNotification();
8089   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8090
8091   // We did expect the animation to finish
8092   application.SendNotification();
8093   finishCheck.CheckSignalReceived();
8094   DALI_TEST_EQUALS( actor.GetCurrentColor().g, targetGreen, TEST_LOCATION );
8095   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED),   startValue,  TEST_LOCATION );
8096   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION );
8097   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE),  startValue,  TEST_LOCATION );
8098   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), startValue,  TEST_LOCATION );
8099   END_TEST;
8100 }
8101
8102 int UtcDaliAnimationAnimateToActorColorBlueP(void)
8103 {
8104   TestApplication application;
8105
8106   Actor actor = Actor::New();
8107   Stage::GetCurrent().Add(actor);
8108   float startValue(1.0f);
8109   DALI_TEST_EQUALS( actor.GetCurrentColor().b, startValue, TEST_LOCATION );
8110   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8111   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8112   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8113   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8114   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8115   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8116   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8117   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8118
8119   // Build the animation
8120   float durationSeconds(1.0f);
8121   Animation animation = Animation::New(durationSeconds);
8122   float targetBlue(0.5f);
8123   animation.AnimateTo( Property(actor, Actor::Property::COLOR_BLUE), targetBlue );
8124
8125   float fiftyPercentProgress(startValue + (targetBlue - startValue)*0.5f);
8126
8127   // Start the animation
8128   animation.Play();
8129
8130   // Target value should be retrievable straight away
8131   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, targetBlue, startValue ), TEST_LOCATION );
8132   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetBlue, TEST_LOCATION );
8133
8134   bool signalReceived(false);
8135   AnimationFinishCheck finishCheck(signalReceived);
8136   animation.FinishedSignal().Connect(&application, finishCheck);
8137
8138   application.SendNotification();
8139   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8140
8141   // We didn't expect the animation to finish yet
8142   application.SendNotification();
8143   finishCheck.CheckSignalNotReceived();
8144   DALI_TEST_EQUALS( actor.GetCurrentColor().b, fiftyPercentProgress, TEST_LOCATION );
8145   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue,           TEST_LOCATION );
8146   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue,           TEST_LOCATION );
8147   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  fiftyPercentProgress, TEST_LOCATION );
8148   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue,           TEST_LOCATION );
8149
8150   application.SendNotification();
8151   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8152
8153   // We did expect the animation to finish
8154   application.SendNotification();
8155   finishCheck.CheckSignalReceived();
8156   DALI_TEST_EQUALS( actor.GetCurrentColor().b, targetBlue, TEST_LOCATION );
8157   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8158   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8159   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  targetBlue, TEST_LOCATION );
8160   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8161   END_TEST;
8162 }
8163
8164 int UtcDaliAnimationAnimateToActorColorAlphaP(void)
8165 {
8166   TestApplication application;
8167
8168   Actor actor = Actor::New();
8169   Stage::GetCurrent().Add(actor);
8170   float startValue(1.0f);
8171   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8172   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8173   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8174   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8175   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8176   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8177   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8178   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8179   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8180
8181   // Build the animation
8182   float durationSeconds(1.0f);
8183   Animation animation = Animation::New(durationSeconds);
8184   float targetAlpha(0.5f);
8185   animation.AnimateTo( Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha );
8186
8187   float fiftyPercentProgress(startValue + (targetAlpha - startValue)*0.5f);
8188
8189   // Start the animation
8190   animation.Play();
8191
8192   // Target value should be retrievable straight away
8193   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, startValue, targetAlpha ), TEST_LOCATION );
8194   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
8195   DALI_TEST_EQUALS( actor.GetProperty< float >( DevelActor::Property::OPACITY ), targetAlpha, TEST_LOCATION );
8196
8197   bool signalReceived(false);
8198   AnimationFinishCheck finishCheck(signalReceived);
8199   animation.FinishedSignal().Connect(&application, finishCheck);
8200
8201   application.SendNotification();
8202   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8203
8204   // We didn't expect the animation to finish yet
8205   application.SendNotification();
8206   finishCheck.CheckSignalNotReceived();
8207   DALI_TEST_EQUALS( actor.GetCurrentColor().a, fiftyPercentProgress, TEST_LOCATION );
8208   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue,           TEST_LOCATION );
8209   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue,           TEST_LOCATION );
8210   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue,           TEST_LOCATION );
8211   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), fiftyPercentProgress, TEST_LOCATION );
8212
8213   application.SendNotification();
8214   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8215
8216   // We did expect the animation to finish
8217   application.SendNotification();
8218   finishCheck.CheckSignalReceived();
8219   DALI_TEST_EQUALS( actor.GetCurrentColor().a, targetAlpha, TEST_LOCATION );
8220   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue,  TEST_LOCATION );
8221   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue,  TEST_LOCATION );
8222   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue,  TEST_LOCATION );
8223   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
8224   END_TEST;
8225 }
8226
8227 int UtcDaliAnimationKeyFrames01P(void)
8228 {
8229   TestApplication application;
8230
8231   KeyFrames keyFrames = KeyFrames::New();
8232   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8233
8234   keyFrames.Add(0.0f, 0.1f);
8235
8236   DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8237
8238   KeyFrames keyFrames2( keyFrames);
8239   DALI_TEST_CHECK( keyFrames2 );
8240   DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
8241
8242   KeyFrames keyFrames3 = KeyFrames::New();
8243   keyFrames3.Add(0.6f, true);
8244   DALI_TEST_CHECK( keyFrames3 );
8245   DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
8246
8247   keyFrames3 = keyFrames;
8248   DALI_TEST_CHECK( keyFrames3 );
8249   DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
8250
8251   END_TEST;
8252 }
8253
8254 int UtcDaliAnimationKeyFrames02P(void)
8255 {
8256   TestApplication application;
8257
8258   KeyFrames keyFrames = KeyFrames::New();
8259   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8260
8261   keyFrames.Add(0.0f, 0.1f);
8262   keyFrames.Add(0.2f, 0.5f);
8263   keyFrames.Add(0.4f, 0.0f);
8264   keyFrames.Add(0.6f, 1.0f);
8265   keyFrames.Add(0.8f, 0.7f);
8266   keyFrames.Add(1.0f, 0.9f);
8267
8268   DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8269
8270   try
8271   {
8272     keyFrames.Add(1.9f, false);
8273   }
8274   catch (Dali::DaliException& e)
8275   {
8276     DALI_TEST_PRINT_ASSERT( e );
8277     DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8278   }
8279   END_TEST;
8280 }
8281
8282 int UtcDaliAnimationKeyFrames03P(void)
8283 {
8284   TestApplication application;
8285
8286   KeyFrames keyFrames = KeyFrames::New();
8287   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8288
8289   keyFrames.Add(0.0f, true);
8290   keyFrames.Add(0.2f, false);
8291   keyFrames.Add(0.4f, false);
8292   keyFrames.Add(0.6f, true);
8293   keyFrames.Add(0.8f, true);
8294   keyFrames.Add(1.0f, false);
8295
8296   DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
8297
8298   try
8299   {
8300     keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8301   }
8302   catch (Dali::DaliException& e)
8303   {
8304     DALI_TEST_PRINT_ASSERT( e );
8305     DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8306   }
8307   END_TEST;
8308 }
8309
8310 int UtcDaliAnimationKeyFrames04P(void)
8311 {
8312   TestApplication application;
8313
8314   KeyFrames keyFrames = KeyFrames::New();
8315   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8316
8317   keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
8318   keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
8319   keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
8320   keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
8321   keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
8322   keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
8323
8324   DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
8325
8326   try
8327   {
8328     keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8329   }
8330   catch (Dali::DaliException& e)
8331   {
8332     DALI_TEST_PRINT_ASSERT( e );
8333     DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8334   }
8335   END_TEST;
8336 }
8337
8338 int UtcDaliAnimationKeyFrames05P(void)
8339 {
8340   TestApplication application;
8341
8342   KeyFrames keyFrames = KeyFrames::New();
8343   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8344
8345   keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
8346   keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
8347   keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
8348   keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
8349   keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
8350   keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
8351
8352   DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
8353
8354   try
8355   {
8356     keyFrames.Add(0.7f, 1.0f);
8357   }
8358   catch (Dali::DaliException& e)
8359   {
8360     DALI_TEST_PRINT_ASSERT( e );
8361     DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8362   }
8363   END_TEST;
8364 }
8365
8366 int UtcDaliAnimationKeyFrames06P(void)
8367 {
8368   TestApplication application;
8369
8370   KeyFrames keyFrames = KeyFrames::New();
8371   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8372
8373   keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
8374   keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8375   keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
8376   keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
8377   keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
8378   keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
8379
8380   DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
8381
8382   try
8383   {
8384     keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
8385   }
8386   catch (Dali::DaliException& e)
8387   {
8388     DALI_TEST_PRINT_ASSERT( e );
8389     DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8390   }
8391   END_TEST;
8392 }
8393
8394 int UtcDaliAnimationKeyFrames07P(void)
8395 {
8396   TestApplication application;
8397
8398   KeyFrames keyFrames = KeyFrames::New();
8399   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8400
8401   keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
8402   keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
8403   keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
8404   keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
8405   keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
8406   keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
8407
8408   DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
8409
8410   try
8411   {
8412     keyFrames.Add(0.7f, 1.1f);
8413   }
8414   catch (Dali::DaliException& e)
8415   {
8416     DALI_TEST_PRINT_ASSERT( e );
8417     DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8418   }
8419   END_TEST;
8420 }
8421
8422 int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
8423 {
8424   TestApplication application;
8425
8426   float startValue(1.0f);
8427   Actor actor = Actor::New();
8428   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8429   Stage::GetCurrent().Add(actor);
8430
8431   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8432   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8433   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8434   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8435   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8436   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8437   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8438   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8439   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8440
8441   // Build the animation
8442   float durationSeconds(1.0f);
8443   Animation animation = Animation::New(durationSeconds);
8444
8445   KeyFrames keyFrames = KeyFrames::New();
8446   keyFrames.Add(0.0f, 0.1f);
8447   keyFrames.Add(0.2f, 0.5f);
8448   keyFrames.Add(0.4f, 0.0f);
8449   keyFrames.Add(0.6f, 1.0f);
8450   keyFrames.Add(0.8f, 0.7f);
8451   keyFrames.Add(1.0f, 0.9f);
8452
8453   animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames );
8454
8455   // Start the animation
8456   animation.Play();
8457
8458   bool signalReceived(false);
8459   AnimationFinishCheck finishCheck(signalReceived);
8460   animation.FinishedSignal().Connect(&application, finishCheck);
8461   application.SendNotification();
8462   application.Render(0);
8463   application.SendNotification();
8464   finishCheck.CheckSignalNotReceived();
8465   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
8466
8467   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8468   application.SendNotification();
8469   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8470   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8471   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8472   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION );
8473   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.3f, 0.01f, TEST_LOCATION );
8474
8475   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
8476   application.SendNotification();
8477   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8478   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8479   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8480   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION );
8481   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.25f, 0.01f, TEST_LOCATION );
8482
8483   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
8484   application.SendNotification();
8485   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8486   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8487   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8488   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
8489   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
8490
8491   application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
8492   application.SendNotification();
8493   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8494   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8495   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8496   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
8497   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
8498
8499   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
8500   application.SendNotification();
8501   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8502   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8503   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8504   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION );
8505   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.8f, 0.01f, TEST_LOCATION );
8506
8507   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
8508   application.SendNotification();
8509   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8510   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8511   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8512   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
8513   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
8514
8515   // We did expect the animation to finish
8516
8517   finishCheck.CheckSignalReceived();
8518   END_TEST;
8519 }
8520
8521 int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
8522 {
8523   TestApplication application;
8524
8525   float startValue(1.0f);
8526   Actor actor = Actor::New();
8527   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8528   Stage::GetCurrent().Add(actor);
8529
8530   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8531   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8532   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8533   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8534   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8535   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8536   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8537   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8538   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8539
8540   // Build the animation
8541   float durationSeconds(1.0f);
8542   Animation animation = Animation::New(durationSeconds);
8543
8544   KeyFrames keyFrames = KeyFrames::New();
8545   keyFrames.Add(0.0f, 0.1f);
8546   keyFrames.Add(0.2f, 0.5f);
8547   keyFrames.Add(0.4f, 0.0f);
8548   keyFrames.Add(0.6f, 1.0f);
8549   keyFrames.Add(0.8f, 0.7f);
8550   keyFrames.Add(1.0f, 0.9f);
8551
8552   animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::Cubic );
8553
8554   // Start the animation
8555   animation.Play();
8556
8557   bool signalReceived(false);
8558   AnimationFinishCheck finishCheck(signalReceived);
8559   animation.FinishedSignal().Connect(&application, finishCheck);
8560   application.SendNotification();
8561   application.Render(0);
8562   application.SendNotification();
8563   finishCheck.CheckSignalNotReceived();
8564   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
8565
8566   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8567   application.SendNotification();
8568   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8569   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8570   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8571   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.36f, 0.01f, TEST_LOCATION );
8572   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.36f, 0.01f, TEST_LOCATION );
8573
8574   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
8575   application.SendNotification();
8576   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8577   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8578   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8579   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.21f, 0.01f, TEST_LOCATION );
8580   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.21f, 0.01f, TEST_LOCATION );
8581
8582   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
8583   application.SendNotification();
8584   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8585   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8586   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8587   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.0f, 0.01f, TEST_LOCATION );
8588   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
8589
8590   application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
8591   application.SendNotification();
8592   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8593   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8594   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8595   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.7f, 0.01f, TEST_LOCATION );
8596   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
8597
8598   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
8599   application.SendNotification();
8600   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8601   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8602   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8603   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.76f, 0.01f, TEST_LOCATION );
8604   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.76f, 0.01f, TEST_LOCATION );
8605
8606   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
8607   application.SendNotification();
8608   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8609   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8610   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8611   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.9f, 0.01f, TEST_LOCATION );
8612   DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
8613
8614   // We did expect the animation to finish
8615
8616   finishCheck.CheckSignalReceived();
8617   END_TEST;
8618 }
8619
8620 int UtcDaliAnimationAnimateBetweenActorColorP(void)
8621 {
8622   TestApplication application;
8623
8624   float startValue(1.0f);
8625   Actor actor = Actor::New();
8626   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8627   Stage::GetCurrent().Add(actor);
8628
8629   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8630   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8631   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8632   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8633   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8634   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8635   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8636   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8637   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8638
8639   // Build the animation
8640   float durationSeconds(1.0f);
8641   Animation animation = Animation::New(durationSeconds);
8642
8643   KeyFrames keyFrames = KeyFrames::New();
8644   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8645   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8646   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8647
8648   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames );
8649
8650   // Start the animation
8651   animation.Play();
8652
8653   bool signalReceived(false);
8654   AnimationFinishCheck finishCheck(signalReceived);
8655   animation.FinishedSignal().Connect(&application, finishCheck);
8656   application.SendNotification();
8657   application.Render(0);
8658   application.SendNotification();
8659   finishCheck.CheckSignalNotReceived();
8660   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
8661   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
8662   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
8663   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
8664
8665   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8666   application.SendNotification();
8667   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.5f, 0.01f, TEST_LOCATION );
8668   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
8669   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.5f, 0.01f, TEST_LOCATION );
8670   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
8671
8672   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8673   application.SendNotification();
8674   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
8675   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
8676   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
8677   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
8678
8679   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8680   application.SendNotification();
8681   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.95f, 0.01f, TEST_LOCATION );
8682   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
8683   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.85f, 0.01f, TEST_LOCATION );
8684   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
8685
8686   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8687   application.SendNotification();
8688   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
8689   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
8690   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
8691   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
8692
8693   // We did expect the animation to finish
8694
8695   finishCheck.CheckSignalReceived();
8696   END_TEST;
8697 }
8698
8699 int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
8700 {
8701   TestApplication application;
8702
8703   float startValue(1.0f);
8704   Actor actor = Actor::New();
8705   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8706   Stage::GetCurrent().Add(actor);
8707
8708   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8709   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8710   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8711   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8712   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8713   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8714   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8715   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8716   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8717
8718   // Build the animation
8719   float durationSeconds(1.0f);
8720   Animation animation = Animation::New(durationSeconds);
8721
8722   KeyFrames keyFrames = KeyFrames::New();
8723   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8724   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8725   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8726
8727   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, Animation::Cubic );
8728
8729   // Start the animation
8730   animation.Play();
8731
8732   bool signalReceived(false);
8733   AnimationFinishCheck finishCheck(signalReceived);
8734   animation.FinishedSignal().Connect(&application, finishCheck);
8735   application.SendNotification();
8736   application.Render(0);
8737   application.SendNotification();
8738   finishCheck.CheckSignalNotReceived();
8739   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
8740   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
8741   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
8742   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
8743
8744   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8745   application.SendNotification();
8746   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.55f, 0.01f, TEST_LOCATION );
8747   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
8748   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.506f, 0.01f, TEST_LOCATION );
8749   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
8750
8751   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8752   application.SendNotification();
8753   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
8754   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
8755   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
8756   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
8757
8758   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8759   application.SendNotification();
8760   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.99375f, 0.01f, TEST_LOCATION );
8761   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
8762   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.85625f, 0.01f, TEST_LOCATION );
8763   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
8764
8765   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8766   application.SendNotification();
8767   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
8768   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
8769   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
8770   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
8771
8772   // We did expect the animation to finish
8773
8774   finishCheck.CheckSignalReceived();
8775   END_TEST;
8776 }
8777
8778 int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
8779 {
8780   TestApplication application;
8781
8782   Actor actor = Actor::New();
8783   AngleAxis aa(Degree(90), Vector3::XAXIS);
8784   actor.SetOrientation(aa.angle, aa.axis);
8785   Stage::GetCurrent().Add(actor);
8786
8787   application.SendNotification();
8788   application.Render(0);
8789
8790   DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
8791
8792   // Build the animation
8793   float durationSeconds(1.0f);
8794   Animation animation = Animation::New(durationSeconds);
8795
8796   KeyFrames keyFrames = KeyFrames::New();
8797   keyFrames.Add(0.0f, false);
8798   keyFrames.Add(0.2f, true);
8799   keyFrames.Add(0.4f, true);
8800   keyFrames.Add(0.8f, false);
8801   keyFrames.Add(1.0f, true);
8802
8803   animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames );
8804
8805   // Start the animation
8806   animation.Play();
8807
8808   bool signalReceived(false);
8809   AnimationFinishCheck finishCheck(signalReceived);
8810   animation.FinishedSignal().Connect(&application, finishCheck);
8811   application.SendNotification();
8812   application.SendNotification();
8813   application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8814   application.SendNotification();
8815   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8816   application.SendNotification();
8817
8818   DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
8819   finishCheck.CheckSignalReceived();
8820   END_TEST;
8821 }
8822
8823 int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
8824 {
8825   TestApplication application;
8826
8827   Actor actor = Actor::New();
8828   AngleAxis aa(Degree(90), Vector3::XAXIS);
8829   actor.SetOrientation(aa.angle, aa.axis);
8830   Stage::GetCurrent().Add(actor);
8831
8832   application.SendNotification();
8833   application.Render(0);
8834
8835   DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
8836
8837   // Build the animation
8838   float durationSeconds(1.0f);
8839   Animation animation = Animation::New(durationSeconds);
8840
8841   KeyFrames keyFrames = KeyFrames::New();
8842   keyFrames.Add(0.0f, false);
8843   keyFrames.Add(0.2f, true);
8844   keyFrames.Add(0.4f, true);
8845   keyFrames.Add(0.8f, false);
8846   keyFrames.Add(1.0f, true);
8847
8848   //Cubic interpolation for boolean values should be ignored
8849   animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::Cubic );
8850
8851   // Start the animation
8852   animation.Play();
8853
8854   bool signalReceived(false);
8855   AnimationFinishCheck finishCheck(signalReceived);
8856   animation.FinishedSignal().Connect(&application, finishCheck);
8857   application.SendNotification();
8858   application.SendNotification();
8859   application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8860   application.SendNotification();
8861   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8862   application.SendNotification();
8863
8864   DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
8865   finishCheck.CheckSignalReceived();
8866   END_TEST;
8867 }
8868
8869 int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
8870 {
8871   TestApplication application;
8872
8873   Actor actor = Actor::New();
8874   AngleAxis aa(Degree(90), Vector3::XAXIS);
8875   actor.SetOrientation(aa.angle, aa.axis);
8876   Stage::GetCurrent().Add(actor);
8877
8878   application.SendNotification();
8879   application.Render(0);
8880   Quaternion start(Radian(aa.angle), aa.axis);
8881   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8882
8883   // Build the animation
8884   float durationSeconds(1.0f);
8885   Animation animation = Animation::New(durationSeconds);
8886
8887   KeyFrames keyFrames = KeyFrames::New();
8888   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
8889
8890   animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
8891
8892   // Start the animation
8893   animation.Play();
8894
8895   bool signalReceived(false);
8896   AnimationFinishCheck finishCheck(signalReceived);
8897   animation.FinishedSignal().Connect(&application, finishCheck);
8898   application.SendNotification();
8899   application.SendNotification();
8900   application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8901   application.SendNotification();
8902   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8903   application.SendNotification();
8904
8905   Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
8906
8907   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8908   finishCheck.CheckSignalReceived();
8909   END_TEST;
8910 }
8911
8912 int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
8913 {
8914   TestApplication application;
8915
8916   Actor actor = Actor::New();
8917   AngleAxis aa(Degree(90), Vector3::XAXIS);
8918   actor.SetOrientation(aa.angle, aa.axis);
8919   application.SendNotification();
8920   application.Render(0);
8921   Stage::GetCurrent().Add(actor);
8922
8923   Quaternion start(Radian(aa.angle), aa.axis);
8924   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8925
8926   // Build the animation
8927   float durationSeconds(1.0f);
8928   Animation animation = Animation::New(durationSeconds);
8929
8930   KeyFrames keyFrames = KeyFrames::New();
8931   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
8932   keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
8933   keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
8934
8935   animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
8936
8937   // Start the animation
8938   animation.Play();
8939
8940   bool signalReceived(false);
8941   AnimationFinishCheck finishCheck(signalReceived);
8942   animation.FinishedSignal().Connect(&application, finishCheck);
8943   application.SendNotification();
8944   application.Render(0);
8945   application.SendNotification();
8946   finishCheck.CheckSignalNotReceived();
8947
8948   Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
8949   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8950
8951   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8952   application.SendNotification();
8953   check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
8954   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8955
8956   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8957   application.SendNotification();
8958   check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
8959   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8960
8961   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8962   application.SendNotification();
8963   check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f) );
8964   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8965
8966   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8967   application.SendNotification();
8968   check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
8969   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8970
8971   // We did expect the animation to finish
8972
8973   finishCheck.CheckSignalReceived();
8974   END_TEST;
8975 }
8976
8977 int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
8978 {
8979   TestApplication application;
8980
8981   Actor actor = Actor::New();
8982   AngleAxis aa(Degree(90), Vector3::XAXIS);
8983   actor.SetOrientation(aa.angle, aa.axis);
8984   Stage::GetCurrent().Add(actor);
8985
8986   application.SendNotification();
8987   application.Render(0);
8988   Quaternion start(Radian(aa.angle), aa.axis);
8989   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8990
8991   // Build the animation
8992   float durationSeconds(1.0f);
8993   Animation animation = Animation::New(durationSeconds);
8994
8995   KeyFrames keyFrames = KeyFrames::New();
8996   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
8997
8998   //Cubic interpolation should be ignored for quaternions
8999   animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
9000
9001   // Start the animation
9002   animation.Play();
9003
9004   bool signalReceived(false);
9005   AnimationFinishCheck finishCheck(signalReceived);
9006   animation.FinishedSignal().Connect(&application, finishCheck);
9007   application.SendNotification();
9008   application.SendNotification();
9009   application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9010   application.SendNotification();
9011   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9012   application.SendNotification();
9013
9014   Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
9015
9016   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9017   finishCheck.CheckSignalReceived();
9018   END_TEST;
9019 }
9020
9021 int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
9022 {
9023   TestApplication application;
9024
9025   Actor actor = Actor::New();
9026   AngleAxis aa(Degree(90), Vector3::XAXIS);
9027   actor.SetOrientation(aa.angle, aa.axis);
9028   application.SendNotification();
9029   application.Render(0);
9030   Stage::GetCurrent().Add(actor);
9031
9032   Quaternion start(Radian(aa.angle), aa.axis);
9033   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
9034
9035   // Build the animation
9036   float durationSeconds(1.0f);
9037   Animation animation = Animation::New(durationSeconds);
9038
9039   KeyFrames keyFrames = KeyFrames::New();
9040   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9041   keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9042   keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9043
9044   //Cubic interpolation should be ignored for quaternions
9045   animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
9046
9047   // Start the animation
9048   animation.Play();
9049
9050   bool signalReceived(false);
9051   AnimationFinishCheck finishCheck(signalReceived);
9052   animation.FinishedSignal().Connect(&application, finishCheck);
9053   application.SendNotification();
9054   application.Render(0);
9055   application.SendNotification();
9056   finishCheck.CheckSignalNotReceived();
9057
9058   Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9059   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9060
9061   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9062   application.SendNotification();
9063   check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
9064   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9065
9066   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9067   application.SendNotification();
9068   check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
9069   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9070
9071   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9072   application.SendNotification();
9073   check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f ) );
9074   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9075
9076   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9077   application.SendNotification();
9078   check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
9079   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9080
9081   // We did expect the animation to finish
9082
9083   finishCheck.CheckSignalReceived();
9084   END_TEST;
9085 }
9086
9087 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
9088 {
9089   TestApplication application;
9090
9091   float startValue(1.0f);
9092   Actor actor = Actor::New();
9093   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9094   Stage::GetCurrent().Add(actor);
9095
9096   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9097   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9098   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9099   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9100   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9101   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9102   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9103   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9104   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9105
9106   // Build the animation
9107   float durationSeconds(1.0f);
9108   Animation animation = Animation::New(durationSeconds);
9109
9110   KeyFrames keyFrames = KeyFrames::New();
9111   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9112   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9113   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9114
9115   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR );
9116
9117   // Start the animation
9118   animation.Play();
9119
9120   bool signalReceived(false);
9121   AnimationFinishCheck finishCheck(signalReceived);
9122   animation.FinishedSignal().Connect(&application, finishCheck);
9123   application.SendNotification();
9124   application.Render(0);
9125   application.SendNotification();
9126   finishCheck.CheckSignalNotReceived();
9127   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
9128   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9129   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
9130   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9131
9132   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9133   application.SendNotification();
9134   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.5f, 0.01f, TEST_LOCATION );
9135   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9136   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.5f, 0.01f, TEST_LOCATION );
9137   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9138
9139   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9140   application.SendNotification();
9141   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
9142   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9143   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
9144   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9145
9146   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9147   application.SendNotification();
9148   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.95f, 0.01f, TEST_LOCATION );
9149   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9150   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.85f, 0.01f, TEST_LOCATION );
9151   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9152
9153   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9154   application.SendNotification();
9155   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
9156   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9157   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
9158   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9159
9160   // We did expect the animation to finish
9161
9162   finishCheck.CheckSignalReceived();
9163   END_TEST;
9164 }
9165
9166 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
9167 {
9168   TestApplication application;
9169
9170   float startValue(1.0f);
9171   Actor actor = Actor::New();
9172   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9173   Stage::GetCurrent().Add(actor);
9174
9175   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9176   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9177   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9178   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9179   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9180   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9181   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9182   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9183   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9184
9185   // Build the animation
9186   float durationSeconds(1.0f);
9187   Animation animation = Animation::New(durationSeconds);
9188
9189   KeyFrames keyFrames = KeyFrames::New();
9190   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9191   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9192   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9193
9194   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::Cubic );
9195
9196   // Start the animation
9197   animation.Play();
9198
9199   bool signalReceived(false);
9200   AnimationFinishCheck finishCheck(signalReceived);
9201   animation.FinishedSignal().Connect(&application, finishCheck);
9202   application.SendNotification();
9203   application.Render(0);
9204   application.SendNotification();
9205   finishCheck.CheckSignalNotReceived();
9206   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
9207   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9208   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
9209   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9210
9211   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9212   application.SendNotification();
9213   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.55f, 0.01f, TEST_LOCATION );
9214   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9215   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.506f, 0.01f, TEST_LOCATION );
9216   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9217
9218   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9219   application.SendNotification();
9220   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
9221   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9222   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
9223   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9224
9225   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9226   application.SendNotification();
9227   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.99375f, 0.01f, TEST_LOCATION );
9228   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9229   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.85625f, 0.01f, TEST_LOCATION );
9230   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9231
9232   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9233   application.SendNotification();
9234   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
9235   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9236   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
9237   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9238
9239   // We did expect the animation to finish
9240
9241   finishCheck.CheckSignalReceived();
9242   END_TEST;
9243 }
9244
9245 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void)
9246 {
9247   TestApplication application;
9248
9249   float startValue(1.0f);
9250   Actor actor = Actor::New();
9251   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9252   Stage::GetCurrent().Add(actor);
9253
9254   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9255   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9256   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9257   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9258   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9259   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9260   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9261   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9262   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9263
9264   // Build the animation
9265   float durationSeconds(1.0f);
9266   float delay = 0.5f;
9267   Animation animation = Animation::New(durationSeconds);
9268
9269   KeyFrames keyFrames = KeyFrames::New();
9270   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9271   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9272   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9273
9274   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ) );
9275
9276   // Start the animation
9277   animation.Play();
9278
9279   bool signalReceived(false);
9280   AnimationFinishCheck finishCheck(signalReceived);
9281   animation.FinishedSignal().Connect(&application, finishCheck);
9282   application.SendNotification();
9283
9284   application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9285   application.SendNotification();
9286   finishCheck.CheckSignalNotReceived();
9287   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
9288   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9289   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
9290   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9291
9292   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9293   application.SendNotification();
9294   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.5f, 0.01f, TEST_LOCATION );
9295   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9296   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.5f, 0.01f, TEST_LOCATION );
9297   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9298
9299   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9300   application.SendNotification();
9301   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
9302   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9303   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
9304   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9305
9306   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9307   application.SendNotification();
9308   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.95f, 0.01f, TEST_LOCATION );
9309   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9310   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.85f, 0.01f, TEST_LOCATION );
9311   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9312
9313   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9314   application.SendNotification();
9315   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
9316   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9317   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
9318   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9319
9320   // We did expect the animation to finish
9321
9322   finishCheck.CheckSignalReceived();
9323   END_TEST;
9324 }
9325
9326 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
9327 {
9328   TestApplication application;
9329
9330   float startValue(1.0f);
9331   Actor actor = Actor::New();
9332   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9333   Stage::GetCurrent().Add(actor);
9334
9335   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9336   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9337   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9338   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9339   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9340   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9341   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9342   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9343   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9344
9345   // Build the animation
9346   float durationSeconds(1.0f);
9347   float delay = 0.5f;
9348   Animation animation = Animation::New(durationSeconds);
9349
9350   KeyFrames keyFrames = KeyFrames::New();
9351   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9352   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9353   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9354
9355   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
9356
9357   // Start the animation
9358   animation.Play();
9359
9360   bool signalReceived(false);
9361   AnimationFinishCheck finishCheck(signalReceived);
9362   animation.FinishedSignal().Connect(&application, finishCheck);
9363   application.SendNotification();
9364
9365   application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9366   application.SendNotification();
9367   finishCheck.CheckSignalNotReceived();
9368   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
9369   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9370   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
9371   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9372
9373   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9374   application.SendNotification();
9375   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.55f, 0.01f, TEST_LOCATION );
9376   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9377   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.506f, 0.01f, TEST_LOCATION );
9378   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9379
9380   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9381   application.SendNotification();
9382   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
9383   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
9384   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
9385   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9386
9387   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9388   application.SendNotification();
9389   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.99375f, 0.01f, TEST_LOCATION );
9390   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9391   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.85625f, 0.01f, TEST_LOCATION );
9392   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9393
9394   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9395   application.SendNotification();
9396   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
9397   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9398   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
9399   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9400
9401   // We did expect the animation to finish
9402
9403   finishCheck.CheckSignalReceived();
9404   END_TEST;
9405 }
9406
9407 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
9408 {
9409   TestApplication application;
9410
9411   float startValue(1.0f);
9412   float delay = 0.5f;
9413   Actor actor = Actor::New();
9414   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9415   Stage::GetCurrent().Add(actor);
9416
9417   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9418   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9419   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9420   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9421   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9422   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9423   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9424   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9425   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9426
9427   // Build the animation
9428   float durationSeconds(1.0f);
9429   Animation animation = Animation::New(durationSeconds);
9430
9431   KeyFrames keyFrames = KeyFrames::New();
9432   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9433   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9434   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9435
9436   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
9437
9438   // Start the animation
9439   animation.Play();
9440
9441   bool signalReceived(false);
9442   AnimationFinishCheck finishCheck(signalReceived);
9443   animation.FinishedSignal().Connect(&application, finishCheck);
9444   application.SendNotification();
9445
9446   application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9447   application.SendNotification();
9448   finishCheck.CheckSignalNotReceived();
9449   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
9450   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9451   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
9452   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9453
9454   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9455   application.SendNotification();
9456   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.5f, 0.01f, TEST_LOCATION );
9457   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9458   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.5f, 0.01f, TEST_LOCATION );
9459   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9460
9461   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9462   application.SendNotification();
9463   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
9464   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9465   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
9466   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9467
9468   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9469   application.SendNotification();
9470   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.95f, 0.01f, TEST_LOCATION );
9471   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9472   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.85f, 0.01f, TEST_LOCATION );
9473   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9474
9475   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9476   application.SendNotification();
9477   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
9478   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9479   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
9480   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9481
9482   // We did expect the animation to finish
9483
9484   finishCheck.CheckSignalReceived();
9485   END_TEST;
9486 }
9487
9488 int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void)
9489 {
9490   TestApplication application;
9491
9492   float startValue(1.0f);
9493   Actor actor = Actor::New();
9494   actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9495   Stage::GetCurrent().Add(actor);
9496
9497   DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9498   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9499   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9500   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9501   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9502   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9503   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9504   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9505   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9506
9507
9508   // Build the animation
9509   float durationSeconds(1.0f);
9510   float delay = 0.5f;
9511   Animation animation = Animation::New(durationSeconds);
9512
9513   KeyFrames keyFrames = KeyFrames::New();
9514   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9515   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9516   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9517
9518   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
9519
9520   // Start the animation
9521   animation.Play();
9522
9523   bool signalReceived(false);
9524   AnimationFinishCheck finishCheck(signalReceived);
9525   animation.FinishedSignal().Connect(&application, finishCheck);
9526   application.SendNotification();
9527
9528   application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9529   application.SendNotification();
9530   finishCheck.CheckSignalNotReceived();
9531   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
9532   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9533   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
9534   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9535
9536   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9537   application.SendNotification();
9538   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.55f, 0.01f, TEST_LOCATION );
9539   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9540   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.506f, 0.01f, TEST_LOCATION );
9541   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9542
9543   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9544   application.SendNotification();
9545   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
9546   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9547   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
9548   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9549
9550   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9551   application.SendNotification();
9552   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   0.99375f, 0.01f, TEST_LOCATION );
9553   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9554   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  0.85625f, 0.01f, TEST_LOCATION );
9555   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9556
9557   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9558   application.SendNotification();
9559   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
9560   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9561   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
9562   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9563
9564   // We did expect the animation to finish
9565
9566   finishCheck.CheckSignalReceived();
9567   END_TEST;
9568 }
9569
9570 int UtcDaliAnimationAnimateP(void)
9571 {
9572   TestApplication application;
9573
9574   Actor actor = Actor::New();
9575   Stage::GetCurrent().Add(actor);
9576
9577   //Build the path
9578   Vector3 position0( 30.0,  80.0,  0.0);
9579   Vector3 position1( 70.0,  120.0, 0.0);
9580   Vector3 position2( 100.0, 100.0, 0.0);
9581
9582   Dali::Path path = Dali::Path::New();
9583   path.AddPoint(position0);
9584   path.AddPoint(position1);
9585   path.AddPoint(position2);
9586
9587   //Control points for first segment
9588   path.AddControlPoint( Vector3( 39.0,  90.0, 0.0) );
9589   path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9590
9591   //Control points for second segment
9592   path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9593   path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9594
9595   // Build the animation
9596   float durationSeconds( 1.0f );
9597   Animation animation = Animation::New(durationSeconds);
9598   animation.Animate(actor, path, Vector3::XAXIS);
9599
9600   // Start the animation
9601   animation.Play();
9602
9603   bool signalReceived(false);
9604   AnimationFinishCheck finishCheck(signalReceived);
9605   animation.FinishedSignal().Connect(&application, finishCheck);
9606   application.SendNotification();
9607   application.Render(0);
9608   application.SendNotification();
9609   finishCheck.CheckSignalNotReceived();
9610   Vector3 position, tangent;
9611   Quaternion rotation;
9612   path.Sample( 0.0f, position, tangent );
9613   rotation = Quaternion( Vector3::XAXIS, tangent );
9614   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9615   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9616
9617   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9618   application.SendNotification();
9619   path.Sample( 0.25f, position, tangent );
9620   rotation = Quaternion( Vector3::XAXIS, tangent );
9621   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9622   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9623
9624   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9625   application.SendNotification();
9626   path.Sample( 0.5f, position, tangent );
9627   rotation = Quaternion( Vector3::XAXIS, tangent );
9628   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9629   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9630
9631   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9632   application.SendNotification();
9633   path.Sample( 0.75f, position, tangent );
9634   rotation = Quaternion( Vector3::XAXIS, tangent );
9635   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9636   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9637
9638   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9639   application.SendNotification();
9640   path.Sample( 1.0f, position, tangent );
9641   rotation = Quaternion( Vector3::XAXIS, tangent );
9642   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9643   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9644
9645   finishCheck.CheckSignalReceived();
9646   END_TEST;
9647 }
9648
9649 int UtcDaliAnimationAnimateAlphaFunctionP(void)
9650 {
9651   TestApplication application;
9652
9653   Actor actor = Actor::New();
9654   Stage::GetCurrent().Add(actor);
9655
9656   //Build the path
9657   Vector3 position0( 30.0,  80.0,  0.0);
9658   Vector3 position1( 70.0,  120.0, 0.0);
9659   Vector3 position2( 100.0, 100.0, 0.0);
9660
9661   Dali::Path path = Dali::Path::New();
9662   path.AddPoint(position0);
9663   path.AddPoint(position1);
9664   path.AddPoint(position2);
9665
9666   //Control points for first segment
9667   path.AddControlPoint( Vector3( 39.0,  90.0, 0.0) );
9668   path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9669
9670   //Control points for second segment
9671   path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9672   path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9673
9674   // Build the animation
9675   float durationSeconds( 1.0f );
9676   Animation animation = Animation::New(durationSeconds);
9677   animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
9678
9679   // Start the animation
9680   animation.Play();
9681
9682   bool signalReceived(false);
9683   AnimationFinishCheck finishCheck(signalReceived);
9684   animation.FinishedSignal().Connect(&application, finishCheck);
9685   application.SendNotification();
9686   application.Render(0);
9687   application.SendNotification();
9688   finishCheck.CheckSignalNotReceived();
9689   Vector3 position, tangent;
9690   Quaternion rotation;
9691   path.Sample( 0.0f, position, tangent );
9692   rotation = Quaternion( Vector3::XAXIS, tangent );
9693   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9694   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9695
9696   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9697   application.SendNotification();
9698   path.Sample( 0.25f, position, tangent );
9699   rotation = Quaternion( Vector3::XAXIS, tangent );
9700   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9701   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9702
9703   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9704   application.SendNotification();
9705   path.Sample( 0.5f, position, tangent );
9706   rotation = Quaternion( Vector3::XAXIS, tangent );
9707   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9708   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9709
9710   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9711   application.SendNotification();
9712   path.Sample( 0.75f, position, tangent );
9713   rotation = Quaternion( Vector3::XAXIS, tangent );
9714   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9715   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9716
9717   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9718   application.SendNotification();
9719   path.Sample( 1.0f, position, tangent );
9720   rotation = Quaternion( Vector3::XAXIS, tangent );
9721   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9722   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9723
9724   finishCheck.CheckSignalReceived();
9725   END_TEST;
9726 }
9727
9728 int UtcDaliAnimationAnimateTimePeriodP(void)
9729 {
9730   TestApplication application;
9731
9732   Actor actor = Actor::New();
9733   Stage::GetCurrent().Add(actor);
9734
9735   //Build the path
9736   Vector3 position0( 30.0,  80.0,  0.0);
9737   Vector3 position1( 70.0,  120.0, 0.0);
9738   Vector3 position2( 100.0, 100.0, 0.0);
9739
9740   Dali::Path path = Dali::Path::New();
9741   path.AddPoint(position0);
9742   path.AddPoint(position1);
9743   path.AddPoint(position2);
9744
9745   //Control points for first segment
9746   path.AddControlPoint( Vector3( 39.0,  90.0, 0.0) );
9747   path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9748
9749   //Control points for second segment
9750   path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9751   path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9752
9753   // Build the animation
9754   float durationSeconds( 1.0f );
9755   Animation animation = Animation::New(durationSeconds);
9756   animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
9757
9758   // Start the animation
9759   animation.Play();
9760
9761   bool signalReceived(false);
9762   AnimationFinishCheck finishCheck(signalReceived);
9763   animation.FinishedSignal().Connect(&application, finishCheck);
9764   application.SendNotification();
9765   application.Render(0);
9766   application.SendNotification();
9767   finishCheck.CheckSignalNotReceived();
9768   Vector3 position, tangent;
9769   Quaternion rotation;
9770   path.Sample( 0.0f, position, tangent );
9771   rotation = Quaternion( Vector3::XAXIS, tangent );
9772   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9773   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9774
9775   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9776   application.SendNotification();
9777   path.Sample( 0.25f, position, tangent );
9778   rotation = Quaternion( Vector3::XAXIS, tangent );
9779   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9780   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9781
9782   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9783   application.SendNotification();
9784   path.Sample( 0.5f, position, tangent );
9785   rotation = Quaternion( Vector3::XAXIS, tangent );
9786   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9787   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9788
9789   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9790   application.SendNotification();
9791   path.Sample( 0.75f, position, tangent );
9792   rotation = Quaternion( Vector3::XAXIS, tangent );
9793   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9794   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9795
9796   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9797   application.SendNotification();
9798   path.Sample( 1.0f, position, tangent );
9799   rotation = Quaternion( Vector3::XAXIS, tangent );
9800   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9801   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9802
9803   finishCheck.CheckSignalReceived();
9804   END_TEST;
9805 }
9806
9807 int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
9808 {
9809   TestApplication application;
9810
9811   Actor actor = Actor::New();
9812   Stage::GetCurrent().Add(actor);
9813
9814   //Build the path
9815   Vector3 position0( 30.0,  80.0,  0.0);
9816   Vector3 position1( 70.0,  120.0, 0.0);
9817   Vector3 position2( 100.0, 100.0, 0.0);
9818
9819   Dali::Path path = Dali::Path::New();
9820   path.AddPoint(position0);
9821   path.AddPoint(position1);
9822   path.AddPoint(position2);
9823
9824   //Control points for first segment
9825   path.AddControlPoint( Vector3( 39.0,  90.0, 0.0) );
9826   path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9827
9828   //Control points for second segment
9829   path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9830   path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9831
9832   // Build the animation
9833   float durationSeconds( 1.0f );
9834   Animation animation = Animation::New(durationSeconds);
9835   animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
9836
9837   // Start the animation
9838   animation.Play();
9839
9840   bool signalReceived(false);
9841   AnimationFinishCheck finishCheck(signalReceived);
9842   animation.FinishedSignal().Connect(&application, finishCheck);
9843   application.SendNotification();
9844   application.Render(0);
9845   application.SendNotification();
9846   finishCheck.CheckSignalNotReceived();
9847   Vector3 position, tangent;
9848   Quaternion rotation;
9849   path.Sample( 0.0f, position, tangent );
9850   rotation = Quaternion( Vector3::XAXIS, tangent );
9851   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9852   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9853
9854   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9855   application.SendNotification();
9856   path.Sample( 0.25f, position, tangent );
9857   rotation = Quaternion( Vector3::XAXIS, tangent );
9858   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9859   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9860
9861   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9862   application.SendNotification();
9863   path.Sample( 0.5f, position, tangent );
9864   rotation = Quaternion( Vector3::XAXIS, tangent );
9865   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9866   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9867
9868   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9869   application.SendNotification();
9870   path.Sample( 0.75f, position, tangent );
9871   rotation = Quaternion( Vector3::XAXIS, tangent );
9872   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9873   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9874
9875   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9876   application.SendNotification();
9877   path.Sample( 1.0f, position, tangent );
9878   rotation = Quaternion( Vector3::XAXIS, tangent );
9879   DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9880   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9881
9882   finishCheck.CheckSignalReceived();
9883   END_TEST;
9884 }
9885
9886 int UtcDaliAnimationShowP(void)
9887 {
9888   TestApplication application;
9889
9890   Actor actor = Actor::New();
9891   actor.SetVisible(false);
9892   application.SendNotification();
9893   application.Render(0);
9894   DALI_TEST_CHECK( !actor.IsVisible() );
9895   Stage::GetCurrent().Add(actor);
9896
9897   // Start the animation
9898   float durationSeconds(10.0f);
9899   Animation animation = Animation::New(durationSeconds);
9900   animation.Show(actor, durationSeconds*0.5f);
9901   animation.Play();
9902
9903   bool signalReceived(false);
9904   AnimationFinishCheck finishCheck(signalReceived);
9905   animation.FinishedSignal().Connect(&application, finishCheck);
9906
9907   application.SendNotification();
9908   application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
9909
9910   // We didn't expect the animation to finish yet
9911   application.SendNotification();
9912   finishCheck.CheckSignalNotReceived();
9913   DALI_TEST_CHECK( !actor.IsVisible() );
9914
9915   application.SendNotification();
9916   application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be shown now*/);
9917
9918   // We didn't expect the animation to finish yet
9919   application.SendNotification();
9920   finishCheck.CheckSignalNotReceived();
9921   DALI_TEST_CHECK( actor.IsVisible() );
9922
9923   application.SendNotification();
9924   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
9925
9926   // We did expect the animation to finish
9927   application.SendNotification();
9928   finishCheck.CheckSignalReceived();
9929   DALI_TEST_CHECK( actor.IsVisible() );
9930   END_TEST;
9931 }
9932
9933 int UtcDaliAnimationHideP(void)
9934 {
9935   TestApplication application;
9936
9937   Actor actor = Actor::New();
9938   DALI_TEST_CHECK( actor.IsVisible() );
9939   Stage::GetCurrent().Add(actor);
9940
9941   // Start the animation
9942   float durationSeconds(10.0f);
9943   Animation animation = Animation::New(durationSeconds);
9944   animation.Hide(actor, durationSeconds*0.5f);
9945   animation.Play();
9946
9947   bool signalReceived(false);
9948   AnimationFinishCheck finishCheck(signalReceived);
9949   animation.FinishedSignal().Connect(&application, finishCheck);
9950
9951   application.SendNotification();
9952   application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
9953
9954   // We didn't expect the animation to finish yet
9955   application.SendNotification();
9956   finishCheck.CheckSignalNotReceived();
9957   DALI_TEST_CHECK( actor.IsVisible() );
9958
9959   application.SendNotification();
9960   application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be hidden now*/);
9961
9962   // We didn't expect the animation to finish yet
9963   application.SendNotification();
9964   finishCheck.CheckSignalNotReceived();
9965   DALI_TEST_CHECK( !actor.IsVisible() );
9966
9967   application.SendNotification();
9968   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
9969
9970   // We did expect the animation to finish
9971   application.SendNotification();
9972   finishCheck.CheckSignalReceived();
9973   DALI_TEST_CHECK( !actor.IsVisible() );
9974   END_TEST;
9975 }
9976
9977 int UtcDaliAnimationShowHideAtEndP(void)
9978 {
9979   // Test that show/hide delay can be the same as animation duration
9980   // i.e. to show/hide at the end of the animation
9981
9982   TestApplication application;
9983
9984   Actor actor = Actor::New();
9985   DALI_TEST_CHECK( actor.IsVisible() );
9986   Stage::GetCurrent().Add(actor);
9987
9988   // Start Hide animation
9989   float durationSeconds(10.0f);
9990   Animation animation = Animation::New(durationSeconds);
9991   animation.Hide(actor, durationSeconds/*Hide at end*/);
9992   animation.Play();
9993
9994   bool signalReceived(false);
9995   AnimationFinishCheck finishCheck(signalReceived);
9996   animation.FinishedSignal().Connect(&application, finishCheck);
9997
9998   application.SendNotification();
9999   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
10000
10001   // We did expect the animation to finish
10002   application.SendNotification();
10003   finishCheck.CheckSignalReceived();
10004   DALI_TEST_CHECK( !actor.IsVisible() );
10005
10006   // Start Show animation
10007   animation = Animation::New(durationSeconds);
10008   animation.Show(actor, durationSeconds/*Show at end*/);
10009   animation.FinishedSignal().Connect(&application, finishCheck);
10010   animation.Play();
10011
10012   application.SendNotification();
10013   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
10014
10015   // We did expect the animation to finish
10016   application.SendNotification();
10017   finishCheck.CheckSignalReceived();
10018   DALI_TEST_CHECK( actor.IsVisible() );
10019   END_TEST;
10020 }
10021
10022 int UtcDaliKeyFramesCreateDestroyP(void)
10023 {
10024   tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
10025
10026   KeyFrames* keyFrames = new KeyFrames;
10027   delete keyFrames;
10028   DALI_TEST_CHECK( true );
10029   END_TEST;
10030 }
10031
10032 int UtcDaliKeyFramesDownCastP(void)
10033 {
10034   TestApplication application;
10035   tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
10036
10037   KeyFrames keyFrames = KeyFrames::New();
10038   BaseHandle object(keyFrames);
10039
10040   KeyFrames keyFrames2 = KeyFrames::DownCast(object);
10041   DALI_TEST_CHECK(keyFrames2);
10042
10043   KeyFrames keyFrames3 = DownCast< KeyFrames >(object);
10044   DALI_TEST_CHECK(keyFrames3);
10045
10046   BaseHandle unInitializedObject;
10047   KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
10048   DALI_TEST_CHECK(!keyFrames4);
10049
10050   KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject);
10051   DALI_TEST_CHECK(!keyFrames5);
10052   END_TEST;
10053 }
10054
10055 int UtcDaliAnimationCreateDestroyP(void)
10056 {
10057   TestApplication application;
10058   Animation* animation = new Animation;
10059   DALI_TEST_CHECK( animation );
10060   delete animation;
10061   END_TEST;
10062 }
10063
10064 struct UpdateManagerTestConstraint
10065 {
10066   UpdateManagerTestConstraint(TestApplication& application)
10067   : mApplication(application)
10068   {
10069   }
10070
10071   void operator()( Vector3& current, const PropertyInputContainer& /* inputs */)
10072   {
10073     mApplication.SendNotification();  // Process events
10074   }
10075
10076   TestApplication& mApplication;
10077 };
10078
10079 int UtcDaliAnimationUpdateManagerP(void)
10080 {
10081   TestApplication application;
10082
10083   Actor actor = Actor::New();
10084   Stage::GetCurrent().Add( actor );
10085
10086   // Build the animation
10087   Animation animation = Animation::New( 0.0f );
10088
10089   bool signalReceived = false;
10090   AnimationFinishCheck finishCheck( signalReceived );
10091   animation.FinishedSignal().Connect( &application, finishCheck );
10092
10093   Vector3 startValue(1.0f, 1.0f, 1.0f);
10094   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
10095   Constraint constraint = Constraint::New<Vector3>( actor, index, UpdateManagerTestConstraint( application ) );
10096   constraint.Apply();
10097
10098   // Apply animation to actor
10099   animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunction::LINEAR );
10100   animation.AnimateTo( Property(actor, DevelActor::Property::OPACITY), 0.3f, AlphaFunction::LINEAR );
10101
10102   animation.Play();
10103
10104   application.SendNotification();
10105   application.UpdateOnly( 16 );
10106
10107   finishCheck.CheckSignalNotReceived();
10108
10109   application.SendNotification();   // Process events
10110
10111   finishCheck.CheckSignalReceived();
10112
10113   END_TEST;
10114 }
10115
10116 int UtcDaliAnimationSignalOrderP(void)
10117 {
10118   TestApplication application;
10119
10120   Actor actor = Actor::New();
10121   Stage::GetCurrent().Add( actor );
10122
10123   // Build the animations
10124   Animation animation1 = Animation::New( 0.0f ); // finishes first frame
10125   Animation animation2 = Animation::New( 0.02f ); // finishes in 20 ms
10126
10127   bool signal1Received = false;
10128   animation1.FinishedSignal().Connect( &application, AnimationFinishCheck( signal1Received ) );
10129
10130   bool signal2Received = false;
10131   animation2.FinishedSignal().Connect( &application, AnimationFinishCheck( signal2Received ) );
10132
10133   // Apply animations to actor
10134   animation1.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 3.0f, 2.0f, 1.0f ), AlphaFunction::LINEAR );
10135   animation1.Play();
10136   animation2.AnimateTo( Property(actor, Actor::Property::SIZE ), Vector3( 10.0f, 20.0f, 30.0f ), AlphaFunction::LINEAR );
10137   animation2.Play();
10138
10139   DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10140   DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10141
10142   application.SendNotification();
10143   application.UpdateOnly( 10 ); // 10ms progress
10144
10145   // no notifications yet
10146   DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10147   DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10148
10149   application.SendNotification();
10150
10151   // first completed
10152   DALI_TEST_EQUALS( signal1Received, true, TEST_LOCATION );
10153   DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10154   signal1Received = false;
10155
10156   // 1st animation is complete now, do another update with no ProcessEvents in between
10157   application.UpdateOnly( 20 ); // 20ms progress
10158
10159   // ProcessEvents
10160   application.SendNotification();
10161
10162   // 2nd should complete now
10163   DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10164   DALI_TEST_EQUALS( signal2Received, true, TEST_LOCATION );
10165
10166   END_TEST;
10167 }
10168
10169 int UtcDaliAnimationExtendDurationP(void)
10170 {
10171   TestApplication application;
10172
10173   Actor actor = Actor::New();
10174
10175   // Register a float property
10176   float startValue(10.0f);
10177   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
10178   Stage::GetCurrent().Add(actor);
10179   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
10180   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
10181
10182   // Build the animation
10183   float initialDurationSeconds(1.0f);
10184   float animatorDelay = 5.0f;
10185   float animatorDurationSeconds(5.0f);
10186   float extendedDurationSeconds(animatorDelay+animatorDurationSeconds);
10187   Animation animation = Animation::New(initialDurationSeconds);
10188   float targetValue(30.0f);
10189   float relativeValue(targetValue - startValue);
10190
10191   animation.AnimateTo(Property(actor, index),
10192                       targetValue,
10193                       TimePeriod(animatorDelay, animatorDurationSeconds));
10194
10195   // The duration should have been extended
10196   DALI_TEST_EQUALS( animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION );
10197
10198   // Start the animation
10199   animation.Play();
10200
10201   bool signalReceived(false);
10202   AnimationFinishCheck finishCheck(signalReceived);
10203   animation.FinishedSignal().Connect(&application, finishCheck);
10204
10205   application.SendNotification();
10206   application.Render(static_cast<unsigned int>(extendedDurationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
10207
10208   // We didn't expect the animation to finish yet, but cached value should be the final one
10209   application.SendNotification();
10210   finishCheck.CheckSignalNotReceived();
10211   DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
10212   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
10213
10214   application.SendNotification();
10215   application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
10216
10217   // We didn't expect the animation to finish yet
10218   application.SendNotification();
10219   finishCheck.CheckSignalNotReceived();
10220   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
10221
10222   application.SendNotification();
10223   application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
10224
10225   // We did expect the animation to finish
10226   application.SendNotification();
10227   finishCheck.CheckSignalReceived();
10228   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
10229   DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
10230   END_TEST;
10231 }
10232
10233 int UtcDaliAnimationCustomIntProperty(void)
10234 {
10235   TestApplication application;
10236
10237   Actor actor = Actor::New();
10238   Stage::GetCurrent().Add(actor);
10239   int startValue(0u);
10240
10241   Property::Index index = actor.RegisterProperty("anIndex",  startValue);
10242   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
10243
10244   // Build the animation
10245   float durationSeconds(1.0f);
10246   Animation animation = Animation::New(durationSeconds);
10247   animation.AnimateTo( Property(actor, index), 20 );
10248
10249   // Start the animation
10250   animation.Play();
10251
10252   bool signalReceived(false);
10253   AnimationFinishCheck finishCheck(signalReceived);
10254   animation.FinishedSignal().Connect(&application, finishCheck);
10255
10256   application.SendNotification();
10257   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
10258
10259   // We didn't expect the animation to finish yet
10260   application.SendNotification();
10261   finishCheck.CheckSignalNotReceived();
10262   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), 10, TEST_LOCATION );
10263
10264   application.SendNotification();
10265   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10266
10267   // We did expect the animation to finish
10268   application.SendNotification();
10269   finishCheck.CheckSignalReceived();
10270   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), 20, TEST_LOCATION );
10271   END_TEST;
10272 }
10273
10274 int UtcDaliAnimationDuration(void)
10275 {
10276   TestApplication application;
10277
10278   Actor actor = Actor::New();
10279   Stage::GetCurrent().Add(actor);
10280
10281   Animation animation = Animation::New( 0.0f );
10282   DALI_TEST_EQUALS( 0.0f, animation.GetDuration(), TEST_LOCATION );
10283
10284   // The animation duration should automatically increase depending on the animator time period
10285
10286   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 0.0f, 1.0f ) );
10287   DALI_TEST_EQUALS( 1.0f, animation.GetDuration(), TEST_LOCATION );
10288
10289   animation.AnimateTo( Property( actor, Actor::Property::POSITION_Y ), 200.0f, TimePeriod( 10.0f, 1.0f ) );
10290   DALI_TEST_EQUALS( 11.0f, animation.GetDuration(), TEST_LOCATION );
10291
10292   END_TEST;
10293 }
10294
10295 int UtcDaliAnimationAnimateByNonAnimateableTypeN(void)
10296 {
10297   TestApplication application;
10298
10299   Actor actor = Actor::New();
10300
10301   // Register an integer property
10302   int startValue(1);
10303   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
10304   Stage::GetCurrent().Add(actor);
10305   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10306
10307   try
10308   {
10309     // Build the animation
10310     Animation animation = Animation::New( 2.0f );
10311     std::string relativeValue = "relative string";
10312     animation.AnimateBy( Property(actor, index), relativeValue );
10313     tet_result(TET_FAIL);
10314   }
10315   catch ( Dali::DaliException& e )
10316   {
10317     DALI_TEST_ASSERT( e, "Animated value and Property type don't match", TEST_LOCATION );
10318   }
10319
10320
10321   END_TEST;
10322 }
10323
10324
10325 int UtcDaliAnimationAnimateToNonAnimateableTypeN(void)
10326 {
10327   TestApplication application;
10328
10329   Actor actor = Actor::New();
10330
10331   // Register an integer property
10332   int startValue(1);
10333   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
10334   Stage::GetCurrent().Add(actor);
10335   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10336
10337   try
10338   {
10339     // Build the animation
10340     Animation animation = Animation::New( 2.0f );
10341     std::string relativeValue = "relative string";
10342     animation.AnimateTo( Property(actor, index), relativeValue );
10343
10344     tet_result(TET_FAIL);
10345   }
10346   catch ( Dali::DaliException& e )
10347   {
10348    DALI_TEST_ASSERT( e, "Animated value and Property type don't match", TEST_LOCATION );
10349   }
10350
10351   END_TEST;
10352 }
10353
10354 int UtcDaliAnimationAnimateBetweenNonAnimateableTypeN(void)
10355 {
10356   TestApplication application;
10357
10358   Actor actor = Actor::New();
10359
10360   // Register an integer property
10361   int startValue(1);
10362   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
10363   Stage::GetCurrent().Add(actor);
10364   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10365
10366   try
10367   {
10368     // Build the animation
10369     KeyFrames keyFrames = KeyFrames::New();
10370     keyFrames.Add( 0.0f, std::string("relative string1") );
10371     keyFrames.Add( 1.0f, std::string("relative string2") );
10372     // no need to really create the animation as keyframes do the check
10373
10374     tet_result(TET_FAIL);
10375   }
10376   catch ( Dali::DaliException& e )
10377   {
10378     DALI_TEST_ASSERT( e, "Type not animateable", TEST_LOCATION );
10379   }
10380
10381   END_TEST;
10382 }
10383
10384 int UtcDaliAnimationSetAndGetTargetBeforePlayP(void)
10385 {
10386   tet_infoline("Setting up an animation should not effect it's position property until the animation plays");
10387
10388   TestApplication application;
10389
10390   tet_infoline("Set initial position and set up animation to re-position actor");
10391
10392   Actor actor = Actor::New();
10393   Stage::GetCurrent().Add(actor);
10394   Vector3 initialPosition(0.0f, 0.0f, 0.0f);
10395   actor.SetProperty( Actor::Property::POSITION, initialPosition );
10396
10397   // Build the animation
10398   Animation animation = Animation::New(2.0f);
10399
10400   //Test GetCurrentProgress return 0.0 as the duration is 0.0
10401   DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
10402   DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentPosition(), TEST_LOCATION );
10403
10404   tet_infoline("Set target position in animation without intiating play");
10405
10406   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
10407   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
10408
10409   application.SendNotification();
10410   application.Render();
10411
10412   tet_infoline("Ensure position of actor is still at intial value");
10413
10414   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
10415   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
10416   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
10417
10418   tet_infoline("Play animation and ensure actor position is now target");
10419
10420   animation.Play();
10421   application.SendNotification();
10422   application.Render(1000u);
10423
10424   tet_infoline("Ensure position of actor is at target value when aninmation half way");
10425
10426   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
10427   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
10428   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
10429
10430   tet_printf( "x position at half way point(%f)\n", actor.GetCurrentPosition().x );
10431
10432   application.Render(2000u);
10433
10434   tet_infoline("Ensure position of actor is still at target value when aninmation complete");
10435
10436   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
10437   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
10438   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
10439
10440   END_TEST;
10441 }
10442
10443 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsPositionP(void)
10444 {
10445   tet_infoline("Setting up an animation should not effect it's position property until the animation plays even with mulitple animators");
10446
10447   TestApplication application;
10448
10449   std::vector<Vector3> targetPositions;
10450
10451   targetPositions.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
10452   targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
10453   targetPositions.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
10454
10455   tet_infoline("Set initial position and set up animation to re-position actor");
10456
10457   Actor actor = Actor::New();
10458   Stage::GetCurrent().Add(actor);
10459   Vector3 initialPosition(0.0f, 0.0f, 0.0f);
10460   actor.SetProperty( Actor::Property::POSITION, initialPosition );
10461
10462   // Build the animation
10463   Animation animation = Animation::New(2.0f);
10464
10465   //Test GetCurrentProgress return 0.0 as the duration is 0.0
10466   DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
10467   DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentPosition(), TEST_LOCATION );
10468
10469   tet_infoline("Set target position in animation without intiating play");
10470
10471   for ( unsigned int i = 0; i < targetPositions.size(); i++ )
10472   {
10473     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[i], AlphaFunction::LINEAR);
10474   }
10475
10476   application.SendNotification();
10477   application.Render();
10478
10479   tet_infoline("Ensure position of actor is still at intial value");
10480
10481   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
10482   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
10483   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
10484
10485   tet_infoline("Play animation and ensure actor position is now target");
10486
10487   animation.Play();
10488   application.SendNotification();
10489   application.Render(1000u);
10490
10491   tet_infoline("Ensure position of actor is at target value when aninmation half way");
10492
10493   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
10494   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
10495   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
10496
10497   tet_printf( "x position at half way point(%f)\n", actor.GetCurrentPosition().x );
10498
10499   application.Render(2000u);
10500
10501   tet_infoline("Ensure position of actor is still at target value when aninmation complete");
10502
10503   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
10504   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
10505   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
10506
10507   END_TEST;
10508 }
10509
10510 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionP(void)
10511 {
10512   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");
10513
10514   TestApplication application;
10515
10516   std::vector<Vector3> targetSizes;
10517   std::vector<Vector3> targetPositions;
10518
10519   targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
10520   targetSizes.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
10521
10522   targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
10523
10524   tet_infoline("Set initial position and set up animation to re-position actor");
10525
10526   Actor actor = Actor::New();
10527   Stage::GetCurrent().Add(actor);
10528   Vector3 initialSize( 10.0f, 10.0f, 10.0f);
10529   Vector3 initialPosition(10.0f, 10.0f, 10.0f);
10530
10531   actor.SetProperty( Actor::Property::SIZE, initialSize );
10532   actor.SetProperty( Actor::Property::POSITION, initialPosition );
10533
10534   // Build the animation
10535   Animation animation = Animation::New(2.0f);
10536
10537   tet_infoline("Set target size in animation without intiating play");
10538   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
10539   tet_infoline("Set target position in animation without intiating play");
10540   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[0], AlphaFunction::LINEAR);
10541   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
10542
10543   application.SendNotification();
10544   application.Render();
10545
10546   tet_infoline("Ensure position of actor is still at intial size and position");
10547
10548   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
10549   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
10550   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
10551
10552   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialPosition.x, TEST_LOCATION );
10553   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialPosition.y, TEST_LOCATION );
10554   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialPosition.z, TEST_LOCATION );
10555
10556   tet_infoline("Play animation and ensure actor position and size is now matches targets");
10557
10558   animation.Play();
10559   application.SendNotification();
10560   application.Render(2000u);
10561
10562   tet_infoline("Ensure position and size of actor is at target value when aninmation playing");
10563
10564   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
10565   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
10566   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
10567
10568   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[0].x, TEST_LOCATION );
10569   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[0].y, TEST_LOCATION );
10570   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[0].z, TEST_LOCATION );
10571
10572   END_TEST;
10573 }
10574
10575 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionColourP(void)
10576 {
10577   tet_infoline("Setting up an animation should not effect it's size property until the animation plays even if other Properties animated");
10578
10579   TestApplication application;
10580
10581   std::vector<Vector3> targetSizes;
10582   std::vector<float> targetColors;
10583
10584   targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
10585   targetSizes.push_back( Vector3( 50.0f, 10.0f, 150.0f ) );
10586
10587   targetColors.push_back( 1.0f );
10588
10589   tet_infoline("Set initial position and set up animation to re-position actor");
10590
10591   Actor actor = Actor::New();
10592   Stage::GetCurrent().Add(actor);
10593   Vector3 initialSize( 10.0f, 5.0f, 10.0f);
10594
10595   actor.SetProperty( Actor::Property::SIZE, initialSize );
10596
10597   // Build the animation
10598   Animation animation = Animation::New(2.0f);
10599
10600   tet_infoline("Set target size in animation without initiating play");
10601   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
10602   tet_infoline("Set target position in animation without intiating play");
10603   animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetColors[0], AlphaFunction::LINEAR);
10604   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
10605
10606   application.SendNotification();
10607   application.Render();
10608
10609   tet_infoline("Ensure position of actor is still at initial size and position");
10610
10611   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
10612   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
10613   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
10614
10615   tet_infoline("Play animation and ensure actor position and size is now matches targets");
10616
10617   animation.Play();
10618   application.SendNotification();
10619   application.Render(2000u);
10620
10621   tet_infoline("Ensure position and size of actor is at target value when animation playing");
10622
10623   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
10624   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
10625   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
10626
10627   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColors[0], TEST_LOCATION );
10628
10629   END_TEST;
10630 }
10631
10632 int UtcDaliAnimationTimePeriodOrder(void)
10633 {
10634   tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place" );
10635
10636   TestApplication application;
10637
10638   Actor actor = Actor::New();
10639   Stage::GetCurrent().Add( actor );
10640
10641   application.SendNotification();
10642   application.Render();
10643
10644   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
10645
10646   tet_infoline( "With two AnimateTo calls" );
10647
10648   Animation animation = Animation::New( 0.0f );
10649   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
10650   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
10651   animation.Play();
10652
10653   application.SendNotification();
10654   application.Render(5000); // After the animation is complete
10655
10656   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
10657
10658   tet_infoline( "Same animation again but in a different order - should yield the same result" );
10659
10660   actor.SetX( 0.0f );
10661   application.SendNotification();
10662   application.Render();
10663
10664   animation = Animation::New( 0.0f );
10665   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
10666   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
10667   animation.Play();
10668
10669   application.SendNotification();
10670   application.Render(5000); // After the animation is complete
10671
10672   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
10673
10674   tet_infoline( "Now with several AnimateTo calls" );
10675
10676   actor.SetX( 0.0f );
10677   application.SendNotification();
10678   application.Render();
10679
10680   animation = Animation::New( 0.0f );
10681   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
10682   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
10683   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
10684   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) );
10685   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) );
10686   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
10687   animation.Play();
10688
10689   application.SendNotification();
10690   application.Render(14000); // After the animation is complete
10691
10692   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
10693
10694   tet_infoline( "Same animation again but in a different order - should end up at the same point" );
10695
10696   actor.SetX( 0.0f );
10697   application.SendNotification();
10698   application.Render();
10699
10700   animation = Animation::New( 0.0f );
10701   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) );
10702   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
10703   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
10704   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
10705   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) );
10706   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
10707   animation.Play();
10708
10709   application.SendNotification();
10710   application.Render(14000); // After the animation is complete
10711
10712   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
10713
10714   END_TEST;
10715 }