Merge branch 'devel/master' into tizen
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-Animation.cpp
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 #include <iostream>
19 #include <algorithm>
20
21 #include <stdlib.h>
22 #include <dali/public-api/dali-core.h>
23 #include <dali/devel-api/actors/actor-devel.h>
24 #include <dali-test-suite-utils.h>
25 #include <dali/devel-api/animation/animation-devel.h>
26
27 using std::max;
28 using namespace Dali;
29
30 void utc_dali_animation_startuP(void)
31 {
32   test_return_value = TET_UNDEF;
33 }
34
35 void utc_dali_animation_cleanuP(void)
36 {
37   test_return_value = TET_PASS;
38 }
39
40 namespace
41 {
42
43 static const float ROTATION_EPSILON = 0.0001f;
44 static const float VECTOR4_EPSILON = 0.0001f;
45 static const float VECTOR3_EPSILON = 0.0001f;
46
47 // Functor to test whether a Finish signal is emitted
48 struct AnimationFinishCheck
49 {
50   AnimationFinishCheck(bool& signalReceived)
51   : mSignalReceived(signalReceived)
52   {
53   }
54
55   void operator()(Animation& animation)
56   {
57     mSignalReceived = true;
58   }
59
60   void Reset()
61   {
62     mSignalReceived = false;
63   }
64
65   void CheckSignalReceived()
66   {
67     if (!mSignalReceived)
68     {
69       tet_printf("Expected Finish signal was not received\n");
70       tet_result(TET_FAIL);
71     }
72     else
73     {
74       tet_result(TET_PASS);
75     }
76   }
77
78   void CheckSignalNotReceived()
79   {
80     if (mSignalReceived)
81     {
82       tet_printf("Unexpected Finish signal was received\n");
83       tet_result(TET_FAIL);
84     }
85     else
86     {
87       tet_result(TET_PASS);
88     }
89   }
90
91   bool& mSignalReceived; // owned by individual tests
92 };
93
94 // Functor to test whether a Progress signal is emitted
95 struct AnimationProgressCheck
96 {
97   AnimationProgressCheck(bool& signalReceived, std::string name = " ")
98   : mSignalReceived(signalReceived),
99     mName( name )
100   {
101   }
102
103   void operator()(Animation& animation)
104   {
105     mSignalReceived = true;
106   }
107
108   void Reset()
109   {
110     mSignalReceived = false;
111   }
112
113   void CheckSignalReceived()
114   {
115     if (!mSignalReceived)
116     {
117       tet_printf("Expected Progress reached signal was not received %s \n", mName.c_str() );
118       tet_result(TET_FAIL);
119     }
120     else
121     {
122       tet_result(TET_PASS);
123     }
124   }
125
126   void CheckSignalNotReceived()
127   {
128     if (mSignalReceived)
129     {
130       tet_printf("Unexpected Progress reached signal was received %s \n", mName.c_str());
131       tet_result(TET_FAIL);
132     }
133     else
134     {
135       tet_result(TET_PASS);
136     }
137   }
138
139   bool& mSignalReceived; // owned by individual tests
140   std::string mName;
141 };
142
143 } // anon namespace
144
145 int UtcDaliAnimationConstructorP(void)
146 {
147   TestApplication application;
148
149   Animation animation;
150
151   DALI_TEST_CHECK( !animation );
152   END_TEST;
153 }
154
155 int UtcDaliAnimationNewP(void)
156 {
157   TestApplication application;
158
159   Animation animation = Animation::New( 1.0f );
160
161   DALI_TEST_CHECK(animation);
162   END_TEST;
163 }
164
165 int UtcDaliAnimationNewN(void)
166 {
167   TestApplication application;
168
169   Animation animation = Animation::New( -1.0f );
170
171   DALI_TEST_CHECK(animation);
172   DALI_TEST_EQUALS(animation.GetDuration(), 0.0f, TEST_LOCATION);
173   END_TEST;
174 }
175
176 int UtcDaliAnimationDownCastP(void)
177 {
178   TestApplication application;
179
180   tet_infoline("Testing Dali::Animation::DownCast()");
181
182   float durationSeconds(1.0f);
183   Animation animation = Animation::New(durationSeconds);
184
185   BaseHandle object(animation);
186
187   Animation animation2 = Animation::DownCast(object);
188   DALI_TEST_CHECK(animation2);
189
190   Animation animation3 = DownCast< Animation >(object);
191   DALI_TEST_CHECK(animation3);
192   END_TEST;
193 }
194
195 int UtcDaliAnimationDownCastN(void)
196 {
197   TestApplication application;
198
199   BaseHandle unInitializedObject;
200
201   Animation animation1 = Animation::DownCast( unInitializedObject );
202   DALI_TEST_CHECK( !animation1 );
203
204   Animation animation2 = DownCast< Animation >( unInitializedObject );
205   DALI_TEST_CHECK( !animation2 );
206   END_TEST;
207 }
208
209 int UtcDaliAnimationCopyConstructorP(void)
210 {
211   TestApplication application;
212
213   // Initialize an object, ref count == 1
214   Animation animation = Animation::New( 1.0f );
215
216   Animation copy( animation );
217   DALI_TEST_CHECK( copy );
218
219   DALI_TEST_CHECK( copy.GetDuration() == animation.GetDuration() );
220   END_TEST;
221 }
222
223 int UtcDaliAnimationAssignmentOperatorP(void)
224 {
225   TestApplication application;
226
227   Animation animation = Animation::New( 1.0f );
228
229   Animation copy = animation;
230   DALI_TEST_CHECK( copy );
231
232   DALI_TEST_CHECK( animation == copy );
233
234   DALI_TEST_CHECK( copy.GetDuration() == animation.GetDuration() );
235   END_TEST;
236 }
237
238 int UtcDaliAnimationMoveConstructor(void)
239 {
240   TestApplication application;
241
242   //Animation
243
244   Animation animation = Animation::New( 1.0f );
245   DALI_TEST_CHECK( animation );
246   DALI_TEST_EQUALS( 1, animation.GetBaseObject().ReferenceCount(), TEST_LOCATION );
247   DALI_TEST_EQUALS( 1.0f, animation.GetDuration(), 0.001f, TEST_LOCATION );
248
249   Animation movedAnimation = std::move( animation );
250   DALI_TEST_CHECK( movedAnimation );
251   DALI_TEST_EQUALS( 1, movedAnimation.GetBaseObject().ReferenceCount(), TEST_LOCATION );
252   DALI_TEST_EQUALS( 1.0f, movedAnimation.GetDuration(), 0.001f, TEST_LOCATION );
253   DALI_TEST_CHECK( !animation );
254
255   // KeyFrames
256
257   KeyFrames keyframes = KeyFrames::New();
258   DALI_TEST_CHECK( keyframes );
259   DALI_TEST_EQUALS( 1, keyframes.GetBaseObject().ReferenceCount(), TEST_LOCATION );
260   DALI_TEST_EQUALS( Property::Type::NONE, keyframes.GetType(), TEST_LOCATION );
261
262   keyframes.Add( 0.0f, Vector3( 0.0f, 0.0f, 0.0f ) );
263   keyframes.Add( 1.0f, Vector3( 100.0f, 100.0f, 100.0f ) );
264   DALI_TEST_EQUALS( Property::Type::VECTOR3, keyframes.GetType(), TEST_LOCATION );
265
266   KeyFrames movedKeyFrames = std::move( keyframes );
267   DALI_TEST_CHECK( movedKeyFrames );
268   DALI_TEST_EQUALS( 1, movedKeyFrames.GetBaseObject().ReferenceCount(), TEST_LOCATION );
269   DALI_TEST_EQUALS( Property::Type::VECTOR3, movedKeyFrames.GetType(), TEST_LOCATION );
270   DALI_TEST_CHECK( !keyframes );
271
272   END_TEST;
273 }
274
275 int UtcDaliAnimationMoveAssignment(void)
276 {
277   TestApplication application;
278
279   // Animation
280
281   Animation animation = Animation::New( 1.0f );
282   DALI_TEST_CHECK( animation );
283   DALI_TEST_EQUALS( 1, animation.GetBaseObject().ReferenceCount(), TEST_LOCATION );
284   DALI_TEST_EQUALS( 1.0f, animation.GetDuration(), 0.001f, TEST_LOCATION );
285
286   Animation move;
287   move = std::move( animation );
288   DALI_TEST_CHECK( move );
289   DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
290   DALI_TEST_EQUALS( 1.0f, move.GetDuration(), 0.001f, TEST_LOCATION );
291   DALI_TEST_CHECK( !animation );
292
293   // KeyFrames
294
295   KeyFrames keyframes = KeyFrames::New();
296   DALI_TEST_CHECK( keyframes );
297   DALI_TEST_EQUALS( 1, keyframes.GetBaseObject().ReferenceCount(), TEST_LOCATION );
298   DALI_TEST_EQUALS( Property::Type::NONE, keyframes.GetType(), TEST_LOCATION );
299
300   keyframes.Add( 0.0f, Vector3( 0.0f, 0.0f, 0.0f ) );
301   keyframes.Add( 1.0f, Vector3( 100.0f, 100.0f, 100.0f ) );
302   DALI_TEST_EQUALS( Property::Type::VECTOR3, keyframes.GetType(), TEST_LOCATION );
303
304   KeyFrames movedKeyFrames;
305   movedKeyFrames = std::move( keyframes );
306   DALI_TEST_CHECK( movedKeyFrames );
307   DALI_TEST_EQUALS( 1, movedKeyFrames.GetBaseObject().ReferenceCount(), TEST_LOCATION );
308   DALI_TEST_EQUALS( Property::Type::VECTOR3, movedKeyFrames.GetType(), TEST_LOCATION );
309   DALI_TEST_CHECK( !keyframes );
310
311   END_TEST;
312 }
313
314 int UtcDaliAnimationSetDurationP(void)
315 {
316   TestApplication application;
317
318   Actor actor = Actor::New();
319   application.GetScene().Add(actor);
320
321   // Build the animation
322   float durationSeconds(1.0f);
323   Animation animation = Animation::New(durationSeconds);
324   DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
325
326   // Start the animation
327   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
328   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
329   animation.Play();
330
331   bool signalReceived(false);
332   AnimationFinishCheck finishCheck(signalReceived);
333   animation.FinishedSignal().Connect(&application, finishCheck);
334
335   application.SendNotification();
336   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
337
338   // We didn't expect the animation to finish yet
339   application.SendNotification();
340   finishCheck.CheckSignalNotReceived();
341
342   application.Render(2u/*just beyond the animation duration*/);
343
344   // We did expect the animation to finish
345   application.SendNotification();
346   finishCheck.CheckSignalReceived();
347   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
348
349   // Restart the animation, with a different duration
350   finishCheck.Reset();
351   actor.SetProperty( Actor::Property::POSITION, Vector3::ZERO );
352   durationSeconds = 3.5f;
353   animation.SetDuration(durationSeconds);
354   DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
355   animation.Play();
356
357   application.SendNotification();
358   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
359
360   // We didn't expect the animation to finish yet
361   application.SendNotification();
362   finishCheck.CheckSignalNotReceived();
363
364   application.Render(2u/*just beyond the animation duration*/);
365
366   // We did expect the animation to finish
367   application.SendNotification();
368   finishCheck.CheckSignalReceived();
369   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
370
371   // Check that nothing has changed after a couple of buffer swaps
372   application.Render(0);
373   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
374   application.Render(0);
375   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
376   END_TEST;
377 }
378
379 int UtcDaliAnimationSetDurationN(void)
380 {
381   TestApplication application;
382
383   Animation animation = Animation::New( 1.0f );
384   DALI_TEST_EQUALS( animation.GetDuration(), 1.0f, TEST_LOCATION );
385
386   animation.SetDuration( -1.0f );
387   DALI_TEST_EQUALS( animation.GetDuration(), 0.0f, TEST_LOCATION );
388   END_TEST;
389 }
390
391 int UtcDaliAnimationGetDurationP(void)
392 {
393   TestApplication application;
394
395   Animation animation = Animation::New(1.0f);
396   DALI_TEST_EQUALS(animation.GetDuration(), 1.0f, TEST_LOCATION);
397
398   animation.SetDuration(2.0f);
399   DALI_TEST_EQUALS(animation.GetDuration(), 2.0f, TEST_LOCATION);
400   END_TEST;
401 }
402
403 int UtcDaliAnimationSetLoopingP(void)
404 {
405   TestApplication application;
406
407   Actor actor = Actor::New();
408   application.GetScene().Add(actor);
409
410   // Build the animation
411   float durationSeconds(1.0f);
412   Animation animation = Animation::New(durationSeconds);
413   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
414   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
415
416   // Start the animation
417   animation.SetLooping(true);
418   DALI_TEST_CHECK(animation.IsLooping());
419   animation.Play();
420
421   bool signalReceived(false);
422   AnimationFinishCheck finishCheck(signalReceived);
423   animation.FinishedSignal().Connect(&application, finishCheck);
424
425   application.SendNotification();
426
427   // Loop 5 times
428   float intervalSeconds = 0.25f;
429   float progress = 0.0f;
430   for (int iterations = 0; iterations < 5;)
431   {
432     application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
433
434     progress += intervalSeconds;
435     DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), 0.001f, TEST_LOCATION );
436
437     if (progress >= 1.0f)
438     {
439       progress = progress - 1.0f;
440       ++iterations;
441     }
442   }
443
444   // We didn't expect the animation to finish yet
445   application.SendNotification();
446   finishCheck.CheckSignalNotReceived();
447
448   animation.SetLooping(false);
449   DALI_TEST_CHECK(!animation.IsLooping());
450
451   application.SendNotification();
452   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
453
454   // We did expect the animation to finish
455   application.SendNotification();
456   finishCheck.CheckSignalReceived();
457   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
458
459   // Check that nothing has changed after a couple of buffer swaps
460   application.Render(0);
461   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
462   application.Render(0);
463   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
464   END_TEST;
465 }
466
467 int UtcDaliAnimationSetLoopCountP(void)
468 {
469   TestApplication application;
470
471   Actor actor = Actor::New();
472   application.GetScene().Add(actor);
473
474   // Build the animation
475   float durationSeconds(1.0f);
476   Animation animation = Animation::New(durationSeconds);
477   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
478   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
479
480   // Start the animation
481   animation.SetLoopCount(3);
482   DALI_TEST_CHECK(animation.IsLooping());
483   animation.Play();
484
485   bool signalReceived(false);
486   AnimationFinishCheck finishCheck(signalReceived);
487   animation.FinishedSignal().Connect(&application, finishCheck);
488
489   application.Render(0);
490   application.SendNotification();
491   application.Render(0);
492   application.SendNotification();
493   application.Render(0);
494   application.SendNotification();
495   application.Render(0);
496   application.SendNotification();
497
498   // Loop
499   float intervalSeconds = 3.0f;
500
501   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
502   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
503
504   application.Render(0);
505   application.SendNotification();
506   application.Render(0);
507   application.SendNotification();
508   application.Render(0);
509   application.SendNotification();
510   application.Render(0);
511   application.SendNotification();
512   finishCheck.CheckSignalNotReceived();
513
514   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
515
516   application.SendNotification();
517   finishCheck.CheckSignalReceived();
518   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
519
520   finishCheck.Reset();
521
522   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
523   application.SendNotification();
524   finishCheck.CheckSignalNotReceived();
525
526   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
527   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
528   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
529   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
530   application.SendNotification();
531   finishCheck.CheckSignalNotReceived();
532
533   END_TEST;
534 }
535
536 int UtcDaliAnimationSetLoopCountP2(void)
537 {
538   TestApplication application;
539
540   //
541   // switching between forever and loop count
542   //
543
544   Actor actor = Actor::New();
545   application.GetScene().Add(actor);
546
547   // Build the animation
548   float durationSeconds(1.0f);
549   Animation animation = Animation::New(durationSeconds);
550   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
551   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
552   animation.SetEndAction(Animation::Discard);
553
554   // Start the animation
555   animation.SetLoopCount(3);
556   DALI_TEST_CHECK(animation.IsLooping());
557   animation.Play();
558
559   bool signalReceived(false);
560   AnimationFinishCheck finishCheck(signalReceived);
561   animation.FinishedSignal().Connect(&application, finishCheck);
562
563   float intervalSeconds = 3.0f;
564
565   application.SendNotification();
566   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
567   application.SendNotification();
568   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
569   application.SendNotification();
570   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
571   application.SendNotification();
572
573   application.SendNotification();
574   finishCheck.CheckSignalReceived();
575
576   finishCheck.Reset();
577
578   // Loop forever
579   animation.SetLooping(true);
580   DALI_TEST_CHECK(animation.IsLooping());
581
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   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
589   application.SendNotification();
590   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
591   application.SendNotification();
592   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
593   application.SendNotification();
594   application.SendNotification();
595   finishCheck.CheckSignalNotReceived();
596
597   finishCheck.Reset();
598
599   // Loop N again
600   animation.SetLoopCount(3);
601   DALI_TEST_CHECK(animation.IsLooping());
602   animation.Play();
603
604   application.SendNotification();
605   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
606   application.SendNotification();
607   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
608   application.SendNotification();
609   finishCheck.CheckSignalNotReceived();
610
611   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
612   application.SendNotification();
613   finishCheck.CheckSignalReceived();
614
615   finishCheck.Reset();
616
617   // loop forever
618   animation.SetLooping(true);
619   DALI_TEST_CHECK(animation.IsLooping());
620
621   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
622   application.SendNotification();
623   finishCheck.CheckSignalNotReceived();
624
625   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
626   application.SendNotification();
627   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
628   application.SendNotification();
629   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
630   application.SendNotification();
631   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
632   application.SendNotification();
633   finishCheck.CheckSignalNotReceived();
634
635   finishCheck.Reset();
636
637   // Loop N again
638   animation.SetLoopCount(3);
639   DALI_TEST_CHECK(animation.IsLooping());
640
641   application.SendNotification();
642   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
643   application.SendNotification();
644   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
645   application.SendNotification();
646   finishCheck.CheckSignalNotReceived();
647
648   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
649   application.SendNotification();
650   finishCheck.CheckSignalNotReceived(); // we never hit play
651
652   finishCheck.Reset();
653
654
655   END_TEST;
656 }
657
658 int UtcDaliAnimationSetLoopCountP3(void)
659 {
660   TestApplication application;
661
662   //
663   // switching between forever and loop count
664   //
665   Actor actor = Actor::New();
666   application.GetScene().Add(actor);
667
668   // Build the animation
669   float durationSeconds(1.0f);
670   Animation animation = Animation::New(durationSeconds);
671   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
672   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
673   animation.SetEndAction(Animation::Discard);
674
675   float intervalSeconds = 3.0f;
676
677   bool signalReceived(false);
678   AnimationFinishCheck finishCheck(signalReceived);
679   animation.FinishedSignal().Connect(&application, finishCheck);
680
681   // loop forever
682   animation.SetLooping(true);
683   DALI_TEST_CHECK(animation.IsLooping());
684
685   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
686   application.SendNotification();
687   finishCheck.CheckSignalNotReceived();
688
689   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
690   application.SendNotification();
691   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
692   application.SendNotification();
693   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
694   application.SendNotification();
695   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
696   application.SendNotification();
697   finishCheck.CheckSignalNotReceived();
698
699   finishCheck.Reset();
700
701   // Loop N again
702   animation.SetLoopCount(3);
703   DALI_TEST_CHECK(animation.IsLooping());
704
705   application.SendNotification();
706   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
707   application.SendNotification();
708   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
709   application.SendNotification();
710   finishCheck.CheckSignalNotReceived();
711
712   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
713   application.SendNotification();
714   finishCheck.CheckSignalNotReceived(); // we never hit play
715
716   finishCheck.Reset();
717
718
719   END_TEST;
720 }
721
722 int UtcDaliAnimationSetLoopCountP4(void)
723 {
724   TestApplication application;
725
726   //
727   // ..and play again
728   //
729   Actor actor = Actor::New();
730   application.GetScene().Add(actor);
731
732   // Build the animation
733   float durationSeconds(1.0f);
734   Animation animation = Animation::New(durationSeconds);
735   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
736   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
737   animation.SetEndAction(Animation::Bake);
738
739   float intervalSeconds = 3.0f;
740
741   bool signalReceived(false);
742   AnimationFinishCheck finishCheck(signalReceived);
743   animation.FinishedSignal().Connect(&application, finishCheck);
744
745   animation.SetLoopCount(1);
746   animation.Play();
747   DALI_TEST_CHECK(!animation.IsLooping());
748
749   application.SendNotification();
750   finishCheck.CheckSignalNotReceived();
751   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
752   application.SendNotification();
753   finishCheck.CheckSignalReceived();
754
755   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
756   actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f) );
757
758   finishCheck.Reset();
759
760   animation.Play(); // again
761   DALI_TEST_CHECK(!animation.IsLooping());
762
763   application.SendNotification();
764   finishCheck.CheckSignalNotReceived();
765   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
766   application.SendNotification();
767   finishCheck.CheckSignalReceived();
768
769   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
770
771   END_TEST;
772 }
773
774 int UtcDaliAnimationGetLoopCountP(void)
775 {
776   TestApplication application;
777
778   Actor actor = Actor::New();
779   application.GetScene().Add(actor);
780
781   // Build the animation
782   float durationSeconds(1.0f);
783   Animation animation = Animation::New(durationSeconds);
784   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
785   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
786
787   DALI_TEST_CHECK(1 == animation.GetLoopCount());
788
789   // Start the animation
790   animation.SetLoopCount(3);
791   DALI_TEST_CHECK(animation.IsLooping());
792   DALI_TEST_CHECK(3 == animation.GetLoopCount());
793
794   animation.Play();
795
796   application.Render(0);
797   application.SendNotification();
798
799   // Loop
800   float intervalSeconds = 3.0f;
801
802   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
803   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
804
805   application.Render(0);
806   application.SendNotification();
807
808   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
809   application.SendNotification();
810
811   animation.SetLoopCount(0);
812   DALI_TEST_CHECK(animation.IsLooping());
813   DALI_TEST_CHECK(0 == animation.GetLoopCount());
814
815   animation.SetLoopCount(1);
816   DALI_TEST_CHECK(!animation.IsLooping());
817   DALI_TEST_CHECK(1 == animation.GetLoopCount());
818
819   END_TEST;
820 }
821
822
823 int UtcDaliAnimationGetCurrentLoopP(void)
824 {
825   TestApplication application;
826
827   Actor actor = Actor::New();
828   application.GetScene().Add(actor);
829
830   // Build the animation
831   float durationSeconds(1.0f);
832   Animation animation = Animation::New(durationSeconds);
833   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
834   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
835
836   // Start the animation
837   animation.SetLoopCount(3);
838   DALI_TEST_CHECK(animation.IsLooping());
839   DALI_TEST_CHECK(0 == animation.GetCurrentLoop());
840   animation.Play();
841
842   bool signalReceived(false);
843   AnimationFinishCheck finishCheck(signalReceived);
844   animation.FinishedSignal().Connect(&application, finishCheck);
845
846   application.SendNotification();
847
848   // Loop
849   float intervalSeconds = 3.0f;
850
851   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
852   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
853
854   application.SendNotification();
855   finishCheck.CheckSignalNotReceived();
856   DALI_TEST_CHECK(2 == animation.GetCurrentLoop());
857
858   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
859
860   application.SendNotification();
861   finishCheck.CheckSignalReceived();
862   DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
863   DALI_TEST_CHECK(animation.GetLoopCount() == animation.GetCurrentLoop());
864
865   finishCheck.Reset();
866
867   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
868   application.SendNotification();
869   finishCheck.CheckSignalNotReceived();
870   DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
871
872   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
873   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
874   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
875   application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
876   application.SendNotification();
877   finishCheck.CheckSignalNotReceived();
878   DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
879
880   END_TEST;
881 }
882
883 int UtcDaliAnimationIsLoopingP(void)
884 {
885   TestApplication application;
886
887   Animation animation = Animation::New(1.0f);
888   DALI_TEST_CHECK(!animation.IsLooping());
889
890   animation.SetLooping(true);
891   DALI_TEST_CHECK(animation.IsLooping());
892   END_TEST;
893 }
894
895 int UtcDaliAnimationSetEndActionN(void)
896 {
897   TestApplication application;
898
899   Actor actor = Actor::New();
900   application.GetScene().Add(actor);
901
902   // Build the animation
903   float durationSeconds(1.0f);
904   Animation animation = Animation::New(durationSeconds);
905   DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
906
907   Vector3 targetPosition(10.0f, 10.0f, 10.0f);
908   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
909
910   // Start the animation
911   animation.Play();
912
913   bool signalReceived(false);
914   AnimationFinishCheck finishCheck(signalReceived);
915   animation.FinishedSignal().Connect(&application, finishCheck);
916
917   application.SendNotification();
918   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
919
920   // We did expect the animation to finish
921   application.SendNotification();
922   finishCheck.CheckSignalReceived();
923   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
924
925   // Go back to the start
926   actor.SetProperty( Actor::Property::POSITION, Vector3::ZERO );
927   application.SendNotification();
928   application.Render(0);
929   DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
930
931   // Test BakeFinal, animate again, for half the duration
932   finishCheck.Reset();
933   animation.SetEndAction(Animation::BakeFinal);
934   DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
935   animation.Play();
936
937   application.SendNotification();
938   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f*0.5f) /*half of the animation duration*/);
939
940   // Stop the animation early
941   animation.Stop();
942
943   // We did NOT expect the animation to finish
944   application.SendNotification();
945   finishCheck.CheckSignalNotReceived();
946   DALI_TEST_EQUALS( targetPosition * 0.5f, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), VECTOR4_EPSILON, TEST_LOCATION );
947
948   // The position should be same with target position in the next frame
949   application.Render(0);
950   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
951
952   // Go back to the start
953   actor.SetProperty( Actor::Property::POSITION, Vector3::ZERO );
954   application.SendNotification();
955   application.Render(0);
956   DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
957
958   // Test EndAction::Discard, animate again, but don't bake this time
959   finishCheck.Reset();
960   animation.SetEndAction(Animation::Discard);
961   DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
962   animation.Play();
963
964   application.SendNotification();
965   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
966
967   // We did expect the animation to finish
968   application.SendNotification();
969   finishCheck.CheckSignalReceived();
970   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
971
972   // The position should be discarded in the next frame
973   application.Render(0);
974   DALI_TEST_EQUALS( Vector3::ZERO/*discarded*/, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
975
976   // Check that nothing has changed after a couple of buffer swaps
977   application.Render(0);
978   DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
979   application.Render(0);
980   DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
981   END_TEST;
982 }
983
984 int UtcDaliAnimationGetEndActionP(void)
985 {
986   TestApplication application;
987
988   Animation animation = Animation::New(1.0f);
989   DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
990
991   animation.SetEndAction(Animation::Discard);
992   DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
993
994   animation.SetEndAction(Animation::BakeFinal);
995   DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
996
997   END_TEST;
998 }
999
1000 int UtcDaliAnimationSetDisconnectActionP(void)
1001 {
1002   TestApplication application;
1003   Integration::Scene stage( application.GetScene() );
1004
1005   // Default: BakeFinal
1006   {
1007     Actor actor = Actor::New();
1008     stage.Add(actor);
1009
1010     // Build the animation
1011     float durationSeconds(1.0f);
1012     Animation animation = Animation::New(durationSeconds);
1013     DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal);
1014
1015     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
1016     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1017
1018     // Start the animation
1019     animation.Play();
1020
1021     application.SendNotification();
1022     application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
1023
1024     actor.Unparent();
1025
1026     application.SendNotification();
1027     application.Render();
1028
1029     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
1030   }
1031
1032   // Bake
1033   {
1034     Actor actor = Actor::New();
1035     stage.Add(actor);
1036
1037     // Build the animation
1038     float durationSeconds(1.0f);
1039     Animation animation = Animation::New(durationSeconds);
1040     animation.SetDisconnectAction( Animation::Bake );
1041
1042     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
1043     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1044
1045     // Start the animation
1046     animation.Play();
1047
1048     application.SendNotification();
1049     application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
1050
1051     actor.Unparent();
1052
1053     application.SendNotification();
1054     application.Render();
1055
1056     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition*0.5f, TEST_LOCATION );
1057   }
1058
1059   // Discard
1060   {
1061     Actor actor = Actor::New();
1062     stage.Add(actor);
1063
1064     // Build the animation
1065     float durationSeconds(1.0f);
1066     Animation animation = Animation::New(durationSeconds);
1067     animation.SetDisconnectAction( Animation::Discard );
1068
1069     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
1070     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1071
1072     // Start the animation
1073     animation.Play();
1074
1075     application.SendNotification();
1076     application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
1077
1078     actor.Unparent();
1079
1080     application.SendNotification();
1081     application.Render();
1082
1083     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
1084   }
1085
1086   // Don't play the animation: disconnect action should not be applied
1087   {
1088     Actor actor = Actor::New();
1089     stage.Add(actor);
1090
1091     // Build the animation
1092     float durationSeconds(1.0f);
1093     Animation animation = Animation::New(durationSeconds);
1094
1095     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
1096     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1097
1098     application.SendNotification();
1099     application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
1100
1101     actor.Unparent();
1102
1103     application.SendNotification();
1104     application.Render();
1105
1106     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
1107   }
1108
1109   END_TEST;
1110 }
1111
1112 int UtcDaliAnimationGetDisconnectActionP(void)
1113 {
1114   TestApplication application;
1115   Animation animation = Animation::New(1.0f);
1116   DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal); // default!
1117
1118   animation.SetDisconnectAction(Animation::Discard);
1119   DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Discard);
1120
1121   animation.SetDisconnectAction(Animation::Bake);
1122   DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Bake);
1123
1124   END_TEST;
1125 }
1126
1127 int UtcDaliAnimationSetDefaultAlphaFunctionP(void)
1128 {
1129   TestApplication application;
1130
1131   Animation animation = Animation::New(1.0f);
1132   AlphaFunction func = animation.GetDefaultAlphaFunction();
1133   DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1134
1135   animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1136   AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1137   DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1138   END_TEST;
1139 }
1140
1141 int UtcDaliAnimationGetDefaultAlphaFunctionP(void)
1142 {
1143   TestApplication application;
1144
1145   Animation animation = Animation::New(1.0f);
1146   AlphaFunction func = animation.GetDefaultAlphaFunction();
1147
1148   // Test that the default is linear
1149   DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1150
1151   animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1152   AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1153   DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1154
1155   END_TEST;
1156 }
1157
1158 int UtcDaliAnimationSetCurrentProgressP(void)
1159 {
1160   TestApplication application;
1161
1162   Actor actor = Actor::New();
1163   application.GetScene().Add(actor);
1164
1165   // Build the animation
1166   Animation animation = Animation::New(0.0f);
1167
1168   //Set duration
1169   float durationSeconds(1.0f);
1170   animation.SetDuration(durationSeconds);
1171
1172   bool signalReceived(false);
1173   AnimationFinishCheck finishCheck(signalReceived);
1174   animation.FinishedSignal().Connect(&application, finishCheck);
1175   application.SendNotification();
1176
1177   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1178   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1179
1180   // Start the animation from 40% progress
1181   animation.SetCurrentProgress( 0.4f );
1182   animation.Play();
1183
1184   application.SendNotification();
1185   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1186
1187   // We didn't expect the animation to finish yet
1188   application.SendNotification();
1189   finishCheck.CheckSignalNotReceived();
1190   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.6f), TEST_LOCATION );
1191   DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
1192
1193   animation.Play(); // Test that calling play has no effect, when animation is already playing
1194   application.SendNotification();
1195
1196   //Set the progress to 70%
1197   animation.SetCurrentProgress( 0.7f );
1198   application.SendNotification();
1199   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 80% progress */);
1200   DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1201
1202   application.SendNotification();
1203   finishCheck.CheckSignalNotReceived();
1204   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.8f), TEST_LOCATION );
1205   DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1206
1207   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1208   // We did expect the animation to finish
1209   application.SendNotification();
1210   finishCheck.CheckSignalReceived();
1211   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
1212
1213   // Check that nothing has changed after a couple of buffer swaps
1214   application.Render(0);
1215   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
1216   application.Render(0);
1217   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
1218   END_TEST;
1219 }
1220
1221 int UtcDaliAnimationSetCurrentProgressN(void)
1222 {
1223   TestApplication application;
1224
1225   Actor actor = Actor::New();
1226   application.GetScene().Add(actor);
1227
1228   // Build the animation
1229   Animation animation = Animation::New(0.0f);
1230
1231   //Set duration
1232   float durationSeconds(1.0f);
1233   animation.SetDuration(durationSeconds);
1234
1235   bool signalReceived(false);
1236   AnimationFinishCheck finishCheck(signalReceived);
1237   animation.FinishedSignal().Connect(&application, finishCheck);
1238   application.SendNotification();
1239
1240   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1241   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1242
1243   //Trying to set the current cursor outside the range [0..1] is ignored
1244   animation.SetCurrentProgress( -1.0f);
1245   application.SendNotification();
1246   DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1247
1248   animation.SetCurrentProgress( 100.0f);
1249   application.SendNotification();
1250   DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1251   END_TEST;
1252 }
1253
1254 int UtcDaliAnimationGetCurrentProgressP(void)
1255 {
1256   TestApplication application;
1257
1258   Actor actor = Actor::New();
1259   application.GetScene().Add(actor);
1260
1261   // Build the animation
1262   Animation animation = Animation::New(0.0f);
1263   animation.Play();
1264
1265   //Test GetCurrentProgress return 0.0 as the duration is 0.0
1266   DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1267
1268   animation.SetCurrentProgress( 0.5f );
1269   application.SendNotification();
1270   application.Render(static_cast<unsigned int>(100.0f));
1271
1272   //Progress should still be 0.0
1273   DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1274
1275   //Set duration
1276   float durationSeconds(1.0f);
1277   animation.SetDuration(durationSeconds);
1278   application.SendNotification();
1279
1280   bool signalReceived(false);
1281   AnimationFinishCheck finishCheck(signalReceived);
1282   animation.FinishedSignal().Connect(&application, finishCheck);
1283   application.SendNotification();
1284
1285   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1286   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1287
1288   // Start the animation from 40% progress
1289   animation.SetCurrentProgress( 0.4f );
1290   animation.Play();
1291
1292   application.SendNotification();
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( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
1299
1300   animation.Play(); // Test that calling play has no effect, when animation is already playing
1301   application.SendNotification();
1302
1303   //Set the progress to 70%
1304   animation.SetCurrentProgress( 0.7f );
1305   application.SendNotification();
1306   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 80% progress */);
1307   DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1308
1309   application.SendNotification();
1310   finishCheck.CheckSignalNotReceived();
1311   DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1312
1313   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1314   // We did expect the animation to finish
1315   application.SendNotification();
1316   finishCheck.CheckSignalReceived();
1317   END_TEST;
1318 }
1319
1320 int UtcDaliAnimationSetSpeedFactorP1(void)
1321 {
1322   TestApplication application;
1323
1324   tet_printf("Testing that setting a speed factor of 2 takes half the time\n");
1325
1326   Actor actor = Actor::New();
1327   application.GetScene().Add(actor);
1328
1329   // Build the animation
1330   float durationSeconds(1.0f);
1331   Animation animation = Animation::New(durationSeconds);
1332
1333   const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1334   const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1335
1336   KeyFrames keyframes = KeyFrames::New();
1337   keyframes.Add( 0.0f, initialPosition);
1338   keyframes.Add( 1.0f, targetPosition );
1339   animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1340
1341   //Set speed to be x2
1342   animation.SetSpeedFactor(2.0f);
1343
1344   // Start the animation
1345   animation.Play();
1346
1347   bool signalReceived(false);
1348   AnimationFinishCheck finishCheck(signalReceived);
1349   animation.FinishedSignal().Connect(&application, finishCheck);
1350
1351   application.SendNotification();
1352   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1353
1354   // We didn't expect the animation to finish yet
1355   application.SendNotification();
1356   finishCheck.CheckSignalNotReceived();
1357   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.4f), TEST_LOCATION );
1358
1359   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1360
1361   // We didn't expect the animation to finish yet
1362   application.SendNotification();
1363   finishCheck.CheckSignalNotReceived();
1364   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.8f), TEST_LOCATION );
1365
1366   application.Render(static_cast<unsigned int>(durationSeconds*100.0f) + 1u/*just beyond half the duration*/);
1367
1368   // We did expect the animation to finish
1369   application.SendNotification();
1370   finishCheck.CheckSignalReceived();
1371   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
1372
1373   // Check that nothing has changed after a couple of buffer swaps
1374   application.Render(0);
1375   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
1376   application.Render(0);
1377   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
1378
1379   END_TEST;
1380 }
1381
1382 int UtcDaliAnimationSetSpeedFactorP2(void)
1383 {
1384   TestApplication application;
1385
1386   Actor actor = Actor::New();
1387   application.GetScene().Add(actor);
1388
1389   // Build the animation
1390   float durationSeconds(1.0f);
1391   Animation animation = Animation::New(durationSeconds);
1392
1393   const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1394   const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1395
1396   KeyFrames keyframes = KeyFrames::New();
1397   keyframes.Add( 0.0f, initialPosition);
1398   keyframes.Add( 1.0f, targetPosition );
1399   animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1400
1401   tet_printf("Test -1 speed factor. Animation will play in reverse at normal speed\n");
1402   animation.SetSpeedFactor( -1.0f );
1403
1404   // Start the animation
1405   animation.Play();
1406
1407   bool signalReceived(false);
1408   AnimationFinishCheck finishCheck(signalReceived);
1409   animation.FinishedSignal().Connect(&application, finishCheck);
1410
1411   application.SendNotification();
1412   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1413
1414   // We didn't expect the animation to finish yet
1415   application.SendNotification();
1416   finishCheck.CheckSignalNotReceived();
1417   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.8f), TEST_LOCATION );
1418
1419   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1420
1421   // We didn't expect the animation to finish yet
1422   application.SendNotification();
1423   finishCheck.CheckSignalNotReceived();
1424   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.6f), TEST_LOCATION );
1425
1426   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1427
1428   // We didn't expect the animation to finish yet
1429   application.SendNotification();
1430   finishCheck.CheckSignalNotReceived();
1431   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.4f), TEST_LOCATION );
1432
1433   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1434
1435   // We didn't expect the animation to finish yet
1436   application.SendNotification();
1437   finishCheck.CheckSignalNotReceived();
1438   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
1439
1440   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1441
1442   // We did expect the animation to finish
1443   application.SendNotification();
1444   finishCheck.CheckSignalReceived();
1445   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), initialPosition, TEST_LOCATION );
1446
1447   // Check that nothing has changed after a couple of buffer swaps
1448   application.Render(0);
1449   DALI_TEST_EQUALS( initialPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
1450   application.Render(0);
1451   DALI_TEST_EQUALS( initialPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
1452
1453   END_TEST;
1454 }
1455
1456 int UtcDaliAnimationSetSpeedFactorP3(void)
1457 {
1458   TestApplication application;
1459
1460   Actor actor = Actor::New();
1461   application.GetScene().Add(actor);
1462
1463   // Build the animation
1464   float durationSeconds(1.0f);
1465   Animation animation = Animation::New(durationSeconds);
1466
1467   const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1468   const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1469
1470   KeyFrames keyframes = KeyFrames::New();
1471   keyframes.Add( 0.0f, initialPosition);
1472   keyframes.Add( 1.0f, targetPosition );
1473   animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1474
1475   bool signalReceived(false);
1476   AnimationFinishCheck finishCheck(signalReceived);
1477   animation.FinishedSignal().Connect(&application, finishCheck);
1478
1479   tet_printf("Test half speed factor. Animation will take twice the duration\n");
1480
1481   //Set speed to be half of normal speed
1482   animation.SetSpeedFactor( 0.5f );
1483
1484   // Start the animation
1485   animation.Play();
1486
1487   application.SendNotification();
1488   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1489
1490   // We didn't expect the animation to finish yet
1491   application.SendNotification();
1492   finishCheck.CheckSignalNotReceived();
1493   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.1f), TEST_LOCATION );
1494
1495   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1496
1497   // We didn't expect the animation to finish yet
1498   application.SendNotification();
1499   finishCheck.CheckSignalNotReceived();
1500   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
1501
1502   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
1503
1504   // We didn't expect the animation to finish yet
1505   application.SendNotification();
1506   finishCheck.CheckSignalNotReceived();
1507   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.3f), TEST_LOCATION );
1508
1509   application.SendNotification();
1510   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1511
1512   // We didn't expect the animation to finish yet
1513   application.SendNotification();
1514   finishCheck.CheckSignalNotReceived();
1515   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.4f), TEST_LOCATION );
1516
1517   application.Render(static_cast<unsigned int>(durationSeconds*1200.0f) + 1u/*just beyond the animation duration*/);
1518
1519   // We did expect the animation to finish
1520   application.SendNotification();
1521   finishCheck.CheckSignalReceived();
1522   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
1523
1524   // Check that nothing has changed after a couple of buffer swaps
1525   application.Render(0);
1526   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
1527   application.Render(0);
1528   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
1529   END_TEST;
1530 }
1531
1532
1533 int UtcDaliAnimationSetSpeedFactorP4(void)
1534 {
1535   TestApplication application;
1536
1537   Actor actor = Actor::New();
1538   application.GetScene().Add(actor);
1539
1540   // Build the animation
1541   float durationSeconds(1.0f);
1542   Animation animation = Animation::New(durationSeconds);
1543
1544   const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1545   const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1546
1547   KeyFrames keyframes = KeyFrames::New();
1548   keyframes.Add( 0.0f, initialPosition);
1549   keyframes.Add( 1.0f, targetPosition );
1550   animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1551
1552   bool signalReceived(false);
1553   AnimationFinishCheck finishCheck(signalReceived);
1554   animation.FinishedSignal().Connect(&application, finishCheck);
1555
1556   tet_printf("Test half speed factor. Animation will take twice the duration\n");
1557
1558   tet_printf("Set speed to be half of normal speed\n");
1559   tet_printf("SetSpeedFactor(0.5f)\n");
1560   animation.SetSpeedFactor( 0.5f );
1561
1562   // Start the animation
1563   animation.Play();
1564
1565   application.SendNotification();
1566   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1567
1568   // We didn't expect the animation to finish yet
1569   application.SendNotification();
1570   finishCheck.CheckSignalNotReceived();
1571   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.1f), TEST_LOCATION );
1572
1573   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1574
1575   // We didn't expect the animation to finish yet
1576   application.SendNotification();
1577   finishCheck.CheckSignalNotReceived();
1578   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
1579
1580   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
1581
1582   // We didn't expect the animation to finish yet
1583   application.SendNotification();
1584   finishCheck.CheckSignalNotReceived();
1585   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.3f), TEST_LOCATION );
1586
1587   tet_printf("Reverse direction of animation whilst playing\n");
1588   tet_printf("SetSpeedFactor(-0.5f)\n");
1589   animation.SetSpeedFactor(-0.5f);
1590
1591   application.SendNotification();
1592   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1593
1594   // We didn't expect the animation to finish yet
1595   application.SendNotification();
1596   finishCheck.CheckSignalNotReceived();
1597   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
1598
1599   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1600
1601   // We didn't expect the animation to finish yet
1602   application.SendNotification();
1603   finishCheck.CheckSignalNotReceived();
1604   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.1f), 0.0001, TEST_LOCATION );
1605
1606   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1607
1608   // We did expect the animation to finish
1609   application.SendNotification();
1610   finishCheck.CheckSignalReceived();
1611   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), initialPosition, TEST_LOCATION );
1612
1613   // Check that nothing has changed after a couple of buffer swaps
1614   application.Render(0);
1615   DALI_TEST_EQUALS( initialPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
1616   application.Render(0);
1617   DALI_TEST_EQUALS( initialPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
1618   END_TEST;
1619 }
1620
1621 int UtcDaliAnimationSetSpeedFactorAndRange(void)
1622 {
1623   TestApplication application;
1624
1625   const unsigned int NUM_FRAMES(15);
1626
1627   struct TestData
1628   {
1629     float startTime;
1630     float endTime;
1631     float startX;
1632     float endX;
1633     float expected[NUM_FRAMES];
1634   };
1635
1636   TestData testData[] = {
1637     // ACTOR 0
1638     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1639     /*                       |----------PlayRange---------------|                 */
1640     /*                                            | reverse                       */
1641     { 0.0f,                                                                  1.0f, // TimePeriod
1642       0.0f,                                                                100.0f, // POS
1643       {/**/                 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,  /* Loop */
1644        /**/                 30.0f, 40.0f, 50.0f, 60.0f, /* Reverse direction */
1645        /**/                               50.0f,
1646        /**/                        40.0f,
1647        /**/                 30.0f,
1648        /**/                                             70.0f,
1649        /**/                                      60.0f,
1650        /**/                               50.0f,
1651        /**/
1652       }
1653     },
1654
1655     // ACTOR 1 - Across start of range
1656     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1657     /*                       |----------PlayRange---------------|                 */
1658     /*                                            | reverse                       */
1659     {                0.2f,                0.5f,                               // TimePeriod
1660                      20.0f,               50.0f,                // POS
1661       {/**/                 30.0f, 40.0f, 50.0f, 50.0f, 50.0f,  /* Loop */
1662        /**/                 30.0f, 40.0f, 50.0f, 50.0f, /* Reverse direction @ frame #9 */
1663        /**/                               50.0f,
1664        /**/                        40.0f,
1665        /**/                 30.0f,
1666        /**/                                             50.0f,
1667        /**/                                      50.0f,
1668        /**/                               50.0f
1669       }
1670     },
1671
1672     // ACTOR 2 - Across end of range
1673     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1674     /*                       |----------PlayRange---------------|                 */
1675     /*                                            | reverse                       */
1676     {/**/                                  0.5f,                      0.9f,   // TimePeriod
1677      /**/                                 50.0f,                      90.0f,  // POS
1678      { /**/                 50.0f, 50.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1679        /**/                 50.0f, 50.0f, 50.0f, 60.0f,/* Reverse direction @ frame #9 */
1680        /**/                               50.0f,
1681        /**/                        50.0f,
1682        /**/                 50.0f,                      70.0f,
1683        /**/                                      60.0f,
1684        /**/                               50.0f,
1685       }
1686     },
1687
1688     // ACTOR 3 - Before beginning of range
1689     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1690     /*                       |----------PlayRange---------------|                 */
1691     /*                                            | reverse                       */
1692     {/**/     0.1f,      0.25f, // TimePeriod
1693      /**/     10.0f,     25.0f, // POS
1694      { /**/
1695        /**/ 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
1696        /**/
1697       }
1698     },
1699
1700     // ACTOR 4 - After end of range
1701     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1702     /*                       |----------PlayRange---------------|                 */
1703     /*                                            | reverse                       */
1704     {/**/                                                           0.85f,   1.0f, // TimePeriod
1705      /**/                                                           85.0f,  100.0f, // POS
1706      { /**/
1707        /**/ 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
1708        /**/
1709      }
1710     },
1711     // Actor 5 - Middle of range
1712     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1713     /*                       |----------PlayRange---------------|                 */
1714     /*                                            | reverse                       */
1715     {/**/                          0.4f,            0.65f, // Time Period
1716      /**/                         40.0f,            65.0f, // Position
1717      { /**/                40.0f, 40.0f, 50.0f, 60.0f, 65.0f,
1718        /**/                40.0f, 40.0f, 50.0f, 60.0f, // Reverse
1719        /**/                              50.0f,
1720        /**/                       40.0f,
1721        /**/                40.0f,
1722        /**/                                            65.0f,
1723        /**/                                      60.0f,
1724        /**/                              50.0f,
1725      }
1726     }
1727   };
1728
1729   const size_t NUM_ENTRIES(sizeof(testData)/sizeof(TestData));
1730
1731   // Build the animation
1732   float durationSeconds(1.0f);
1733   Animation animation = Animation::New(durationSeconds);
1734   bool signalReceived(false);
1735   AnimationFinishCheck finishCheck(signalReceived);
1736   animation.FinishedSignal().Connect(&application, finishCheck);
1737
1738   std::vector<Dali::Actor> actors;
1739
1740   for( unsigned int actorIndex = 0; actorIndex < NUM_ENTRIES; ++actorIndex )
1741   {
1742     Actor actor = Actor::New();
1743     actor.SetProperty( Actor::Property::POSITION, Vector3( testData[actorIndex].startX, 0, 0 ) );
1744     actors.push_back(actor);
1745     application.GetScene().Add(actor);
1746
1747     if( actorIndex == 0 || actorIndex == NUM_ENTRIES-1 )
1748     {
1749       KeyFrames keyframes = KeyFrames::New();
1750       keyframes.Add( testData[actorIndex].startTime, Vector3(testData[actorIndex].startX, 0, 0));
1751       keyframes.Add( testData[actorIndex].endTime, Vector3(testData[actorIndex].endX, 0, 0));
1752       animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1753     }
1754     else
1755     {
1756       animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( testData[actorIndex].endX, 0, 0 ), TimePeriod( testData[actorIndex].startTime, testData[actorIndex].endTime - testData[actorIndex].startTime) );
1757     }
1758   }
1759
1760   tet_printf("Test half speed factor. Animation will take twice the duration\n");
1761   tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1762   tet_printf("SetSpeedFactor(0.5f)\n");
1763   animation.SetSpeedFactor( 0.5f );
1764   animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1765   animation.SetLooping(true);
1766
1767   // Start the animation
1768   animation.Play();
1769   application.SendNotification();
1770   application.Render(0);   // Frame 0 tests initial values
1771
1772   for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1773   {
1774     unsigned int actorIndex = 0u;
1775     for( actorIndex = 0u; actorIndex < NUM_ENTRIES; ++actorIndex )
1776     {
1777       DALI_TEST_EQUALS( actors[actorIndex].GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, testData[actorIndex].expected[frame], 0.001, TEST_LOCATION );
1778       if( ! Equals(actors[actorIndex].GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, testData[actorIndex].expected[frame]) )
1779       {
1780         tet_printf("Failed at frame %u, actorIndex %u\n", frame, actorIndex );
1781       }
1782     }
1783
1784     if( frame == 8 )
1785     {
1786       tet_printf("Reverse direction of animation whilst playing after frame 8\n");
1787       tet_printf("SetSpeedFactor(-0.5f)\n");
1788       animation.SetSpeedFactor(-0.5f);
1789       application.SendNotification();
1790     }
1791     application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1792
1793     // We didn't expect the animation to finish yet
1794     application.SendNotification();
1795     finishCheck.CheckSignalNotReceived();
1796   }
1797
1798   END_TEST;
1799 }
1800
1801 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount01(void)
1802 {
1803   TestApplication application;
1804
1805   const unsigned int NUM_FRAMES(15);
1806
1807   struct TestData
1808   {
1809     float startTime;
1810     float endTime;
1811     float startX;
1812     float endX;
1813     float expected[NUM_FRAMES];
1814   };
1815
1816   TestData testData =
1817     // ACTOR 0
1818     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1819     /*                       |----------PlayRange---------------|                 */
1820     { 0.0f,                                                                  1.0f, // TimePeriod
1821       0.0f,                                                                100.0f, // POS
1822       {/**/                 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,  /* Loop */
1823        /**/                 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,
1824        /**/                 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,
1825        /**/
1826       }
1827     };
1828
1829
1830   // Build the animation
1831   float durationSeconds(1.0f);
1832   Animation animation = Animation::New(durationSeconds);
1833   bool signalReceived(false);
1834   AnimationFinishCheck finishCheck(signalReceived);
1835   animation.FinishedSignal().Connect(&application, finishCheck);
1836
1837   std::vector<Dali::Actor> actors;
1838
1839   Actor actor = Actor::New();
1840   actor.SetProperty( Actor::Property::POSITION, Vector3( testData.startX, 0, 0 ) );
1841   actors.push_back(actor);
1842   application.GetScene().Add(actor);
1843
1844   KeyFrames keyframes = KeyFrames::New();
1845   keyframes.Add( testData.startTime, Vector3(testData.startX, 0, 0));
1846   keyframes.Add( testData.endTime, Vector3(testData.endX, 0, 0));
1847   animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1848
1849   tet_printf("Test half speed factor. Animation will take twice the duration\n");
1850   tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1851   tet_printf("SetSpeedFactor(0.5f)\n");
1852   tet_printf("SetLoopCount(3)\n");
1853   animation.SetSpeedFactor( 0.5f );
1854   animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1855   animation.SetLoopCount(3);
1856
1857   // Start the animation
1858   animation.Play();
1859   application.SendNotification();
1860   application.Render(0);   // Frame 0 tests initial values
1861
1862   for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1863   {
1864     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, testData.expected[frame], 0.001, TEST_LOCATION );
1865
1866     application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1867
1868     if( frame < NUM_FRAMES-1 )
1869     {
1870       // We didn't expect the animation to finish yet
1871       application.SendNotification();
1872       finishCheck.CheckSignalNotReceived();
1873     }
1874   }
1875
1876   // We did expect the animation to finish
1877   application.SendNotification();
1878   finishCheck.CheckSignalReceived();
1879   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, 80.0f, 0.001, TEST_LOCATION );
1880
1881   END_TEST;
1882 }
1883
1884 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount02(void)
1885 {
1886   TestApplication application;
1887
1888   const unsigned int NUM_FRAMES(15);
1889
1890   struct TestData
1891   {
1892     float startTime;
1893     float endTime;
1894     float startX;
1895     float endX;
1896     float expected[NUM_FRAMES];
1897   };
1898
1899   TestData testData =
1900     // ACTOR 0
1901     /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
1902     /*                       |----------PlayRange---------------|                 */
1903     { 0.0f,                                                                  1.0f, // TimePeriod
1904       0.0f,                                                                100.0f, // POS
1905       {/**/                 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1906        /**/                 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1907        /**/                 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1908       }
1909     };
1910
1911
1912   // Build the animation
1913   float durationSeconds(1.0f);
1914   Animation animation = Animation::New(durationSeconds);
1915   bool signalReceived(false);
1916   AnimationFinishCheck finishCheck(signalReceived);
1917   animation.FinishedSignal().Connect(&application, finishCheck);
1918
1919   std::vector<Dali::Actor> actors;
1920
1921   Actor actor = Actor::New();
1922   actor.SetProperty( Actor::Property::POSITION, Vector3( testData.startX, 0, 0 ) );
1923   actors.push_back(actor);
1924   application.GetScene().Add(actor);
1925
1926   KeyFrames keyframes = KeyFrames::New();
1927   keyframes.Add( testData.startTime, Vector3(testData.startX, 0, 0));
1928   keyframes.Add( testData.endTime, Vector3(testData.endX, 0, 0));
1929   animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1930
1931   tet_printf("Test reverse half speed factor. Animation will take twice the duration\n");
1932   tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1933   tet_printf("SetSpeedFactor(-0.5f)\n");
1934   tet_printf("SetLoopCount(3)\n");
1935   animation.SetSpeedFactor( -0.5f );
1936   animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1937   animation.SetLoopCount(3);
1938
1939   // Start the animation
1940   animation.Play();
1941   application.SendNotification();
1942   application.Render(0);   // Frame 0 tests initial values
1943
1944   for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1945   {
1946     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, testData.expected[frame], 0.001, TEST_LOCATION );
1947
1948     application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1949
1950     if( frame < NUM_FRAMES-1 )
1951     {
1952       // We didn't expect the animation to finish yet
1953       application.SendNotification();
1954       finishCheck.CheckSignalNotReceived();
1955     }
1956   }
1957
1958   // We did expect the animation to finish
1959   application.SendNotification();
1960   finishCheck.CheckSignalReceived();
1961   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, 30.0f, 0.001, TEST_LOCATION );
1962
1963   END_TEST;
1964 }
1965
1966
1967 int UtcDaliAnimationGetSpeedFactorP(void)
1968 {
1969   TestApplication application;
1970
1971   Animation animation = Animation::New(1.0f);
1972   animation.SetSpeedFactor(0.5f);
1973   DALI_TEST_EQUALS(animation.GetSpeedFactor(), 0.5f, TEST_LOCATION);
1974
1975   animation.SetSpeedFactor(-2.5f);
1976   DALI_TEST_EQUALS(animation.GetSpeedFactor(), -2.5f, TEST_LOCATION);
1977   END_TEST;
1978 }
1979
1980 int UtcDaliAnimationSetPlayRangeP(void)
1981 {
1982   TestApplication application;
1983
1984   Actor actor = Actor::New();
1985   application.GetScene().Add( actor );
1986
1987   // Build the animation
1988   float durationSeconds( 1.0f );
1989   Animation animation = Animation::New( durationSeconds );
1990
1991   bool signalReceived( false );
1992   AnimationFinishCheck finishCheck( signalReceived );
1993   animation.FinishedSignal().Connect( &application, finishCheck );
1994   application.SendNotification();
1995
1996   // Set range between 0.4 and 0.8
1997   animation.SetPlayRange( Vector2( 0.4f, 0.9f ) );
1998   application.SendNotification();
1999   DALI_TEST_EQUALS( Vector2( 0.4f, 0.9f ), animation.GetPlayRange(), TEST_LOCATION );
2000
2001   Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
2002   animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR );
2003
2004   // Start the animation from 40% progress
2005   animation.Play();
2006
2007   application.SendNotification();
2008   application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 60% progress */ );
2009
2010   // We didn't expect the animation to finish yet
2011   application.SendNotification();
2012   finishCheck.CheckSignalNotReceived();
2013   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.6f ), TEST_LOCATION );
2014
2015   application.SendNotification();
2016   application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 80% progress */ );
2017
2018   application.SendNotification();
2019   finishCheck.CheckSignalNotReceived();
2020   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.8f ), TEST_LOCATION );
2021
2022   application.SendNotification();
2023   application.Render( static_cast< unsigned int >( durationSeconds*100.0f ) + 1u/*just beyond the animation duration*/ );
2024
2025   // We did expect the animation to finish
2026   application.SendNotification();
2027   finishCheck.CheckSignalReceived();
2028   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.9f ), TEST_LOCATION );
2029   END_TEST;
2030 }
2031
2032 int UtcDaliAnimationSetPlayRangeN(void)
2033 {
2034   TestApplication application;
2035
2036   Actor actor = Actor::New();
2037   application.GetScene().Add(actor);
2038
2039   // Build the animation
2040   Animation animation = Animation::New(0);
2041   application.SendNotification();
2042
2043   //PlayRange out of bounds
2044   animation.SetPlayRange( Vector2(-1.0f,1.0f) );
2045   application.SendNotification();
2046   DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
2047   animation.SetPlayRange( Vector2(0.0f,2.0f) );
2048   application.SendNotification();
2049   DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
2050
2051   //If playRange is not in the correct order it has to be ordered
2052   animation.SetPlayRange( Vector2(0.8f,0.2f) );
2053   application.SendNotification();
2054   DALI_TEST_EQUALS( Vector2(0.2f,0.8f), animation.GetPlayRange(), TEST_LOCATION );
2055
2056   END_TEST;
2057 }
2058
2059 int UtcDaliAnimationGetPlayRangeP(void)
2060 {
2061   TestApplication application;
2062
2063   Actor actor = Actor::New();
2064   application.GetScene().Add( actor );
2065
2066   // Build the animation
2067   Animation animation = Animation::New( 1.0f );
2068   application.SendNotification();
2069
2070   //If PlayRange not specified it should be 0.0-1.0 by default
2071   DALI_TEST_EQUALS( Vector2( 0.0f,1.0f ), animation.GetPlayRange(), TEST_LOCATION );
2072
2073   // Set range between 0.4 and 0.8
2074   animation.SetPlayRange( Vector2( 0.4f, 0.8f ) );
2075   application.SendNotification();
2076   DALI_TEST_EQUALS( Vector2( 0.4f, 0.8f ), animation.GetPlayRange(), TEST_LOCATION );
2077
2078   END_TEST;
2079 }
2080
2081 int UtcDaliAnimationPlayP(void)
2082 {
2083   TestApplication application;
2084
2085   Actor actor = Actor::New();
2086   application.GetScene().Add(actor);
2087
2088   // Build the animation
2089   float durationSeconds(1.0f);
2090   Animation animation = Animation::New(durationSeconds);
2091   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2092   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2093
2094   // Start the animation
2095   animation.Play();
2096
2097   bool signalReceived(false);
2098   AnimationFinishCheck finishCheck(signalReceived);
2099   animation.FinishedSignal().Connect(&application, finishCheck);
2100
2101   application.SendNotification();
2102   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2103
2104   // We didn't expect the animation to finish yet
2105   application.SendNotification();
2106   finishCheck.CheckSignalNotReceived();
2107   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
2108
2109   animation.Play(); // Test that calling play has no effect, when animation is already playing
2110   application.SendNotification();
2111   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2112
2113   // We didn't expect the animation to finish yet
2114   application.SendNotification();
2115   finishCheck.CheckSignalNotReceived();
2116   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.4f), TEST_LOCATION );
2117
2118   animation.Play(); // Test that calling play has no effect, when animation is already playing
2119   application.SendNotification();
2120   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2121
2122   // We didn't expect the animation to finish yet
2123   application.SendNotification();
2124   finishCheck.CheckSignalNotReceived();
2125   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.6f), TEST_LOCATION );
2126
2127   animation.Play(); // Test that calling play has no effect, when animation is already playing
2128   application.SendNotification();
2129   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2130
2131   // We didn't expect the animation to finish yet
2132   application.SendNotification();
2133   finishCheck.CheckSignalNotReceived();
2134   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.8f), TEST_LOCATION );
2135
2136   animation.Play(); // Test that calling play has no effect, when animation is already playing
2137   application.SendNotification();
2138   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2139
2140   // We did expect the animation to finish
2141   application.SendNotification();
2142   finishCheck.CheckSignalReceived();
2143   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
2144
2145   // Check that nothing has changed after a couple of buffer swaps
2146   application.Render(0);
2147   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2148   application.Render(0);
2149   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2150   END_TEST;
2151 }
2152
2153 int UtcDaliAnimationPlayOffSceneDiscardP(void)
2154 {
2155   // Test that an animation can be played, when the actor is off-stage.
2156   // When the actor is added to the stage, it should appear at the current position
2157   // i.e. where it would have been anyway, if on-stage from the beginning.
2158
2159   TestApplication application;
2160
2161   Actor actor = Actor::New();
2162   Vector3 basePosition(Vector3::ZERO);
2163   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), basePosition, TEST_LOCATION );
2164   // Not added to the stage yet!
2165
2166   // Build the animation
2167   float durationSeconds(1.0f);
2168   Animation animation = Animation::New(durationSeconds);
2169   animation.SetDisconnectAction( Animation::Discard );
2170   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2171   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2172
2173   // Start the animation
2174   animation.Play();
2175
2176   bool signalReceived(false);
2177   AnimationFinishCheck finishCheck(signalReceived);
2178   animation.FinishedSignal().Connect(&application, finishCheck);
2179
2180   application.SendNotification();
2181   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2182
2183   // We didn't expect the animation to finish yet
2184   application.SendNotification();
2185   finishCheck.CheckSignalNotReceived();
2186   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(20,20,20), TEST_LOCATION );
2187
2188   // Add to the stage
2189   application.GetScene().Add(actor);
2190
2191   application.SendNotification();
2192   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2193
2194   // We didn't expect the animation to finish yet
2195   application.SendNotification();
2196   finishCheck.CheckSignalNotReceived();
2197   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(40,40,40)/*on-stage*/, TEST_LOCATION );
2198
2199   // Remove from the stage
2200   application.GetScene().Remove(actor);
2201
2202   application.SendNotification();
2203   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2204
2205   // We didn't expect the animation to finish yet
2206   application.SendNotification();
2207   finishCheck.CheckSignalNotReceived();
2208   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO/*back to start position as disconnect behaviour is discard*/, TEST_LOCATION );
2209   // Check that nothing has changed after a couple of buffer swaps
2210   application.Render(0);
2211   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
2212   application.Render(0);
2213   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
2214   application.Render(0);
2215   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
2216
2217   // Add to the stage
2218   application.GetScene().Add(actor);
2219
2220   application.SendNotification();
2221   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2222
2223   // We didn't expect the animation to finish yet
2224   application.SendNotification();
2225   finishCheck.CheckSignalNotReceived();
2226   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(80,80,80), TEST_LOCATION );
2227
2228   application.SendNotification();
2229   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2230
2231   // We did expect the animation to finish
2232   application.SendNotification();
2233   finishCheck.CheckSignalReceived();
2234   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
2235
2236   // Check that nothing has changed after a couple of buffer swaps
2237   application.Render(0);
2238   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2239
2240
2241   application.Render(0);
2242   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2243   END_TEST;
2244 }
2245
2246 int UtcDaliAnimationPlayOffSceneBakeFinalP(void)
2247 {
2248   // Test that an animation can be played, when the actor is off-stage.
2249   // When the actor is added to the stage, it should appear at the current position
2250   // i.e. where it would have been anyway, if on-stage from the beginning.
2251
2252   TestApplication application;
2253
2254   Actor actor = Actor::New();
2255   Vector3 basePosition(Vector3::ZERO);
2256   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), basePosition, TEST_LOCATION );
2257   // Not added to the stage!
2258
2259   // Build the animation
2260   float durationSeconds(1.0f);
2261   Animation animation = Animation::New(durationSeconds);
2262   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2263   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2264
2265   // Start the animation
2266   animation.Play();
2267
2268   bool signalReceived(false);
2269   AnimationFinishCheck finishCheck(signalReceived);
2270   animation.FinishedSignal().Connect(&application, finishCheck);
2271
2272   application.SendNotification();
2273   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2274
2275   // We didn't expect the animation to finish yet
2276   application.SendNotification();
2277   finishCheck.CheckSignalNotReceived();
2278   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(20,20,20), TEST_LOCATION );
2279
2280   // Add to the stage
2281   application.GetScene().Add(actor);
2282
2283   application.SendNotification();
2284   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2285
2286   // We didn't expect the animation to finish yet
2287   application.SendNotification();
2288   finishCheck.CheckSignalNotReceived();
2289   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(40,40,40)/*on-stage*/, TEST_LOCATION );
2290
2291   // Remove from the stage
2292   application.GetScene().Remove(actor);
2293
2294   application.SendNotification();
2295   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2296
2297   // We didn't expect the animation to finish yet
2298   application.SendNotification();
2299   finishCheck.CheckSignalNotReceived();
2300   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition /*bake final*/, TEST_LOCATION );
2301
2302   // Add to the stage
2303   application.GetScene().Add(actor);
2304
2305   application.SendNotification();
2306   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2307
2308   // We didn't expect the animation to finish yet
2309   application.SendNotification();
2310   finishCheck.CheckSignalNotReceived();
2311   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition /*bake final removed the */, TEST_LOCATION );
2312
2313   application.SendNotification();
2314   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2315
2316   // We did expect the animation to finish
2317   application.SendNotification();
2318   finishCheck.CheckSignalReceived();
2319   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
2320
2321   // Check that nothing has changed after a couple of buffer swaps
2322   application.Render(0);
2323   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2324
2325   application.Render(0);
2326   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2327   END_TEST;
2328 }
2329
2330 int UtcDaliAnimationPlayOffSceneBakeP(void)
2331 {
2332   // Test that an animation can be played, when the actor is off-stage.
2333   // When the actor is added to the stage, it should appear at the current position
2334   // i.e. where it would have been anyway, if on-stage from the beginning.
2335
2336   TestApplication application;
2337
2338   Actor actor = Actor::New();
2339   Vector3 basePosition(Vector3::ZERO);
2340   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), basePosition, TEST_LOCATION );
2341   // Not added to the stage!
2342
2343   // Build the animation
2344   float durationSeconds(1.0f);
2345   Animation animation = Animation::New(durationSeconds);
2346   animation.SetDisconnectAction( Animation::Bake );
2347   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2348   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2349
2350   // Start the animation
2351   animation.Play();
2352
2353   bool signalReceived(false);
2354   AnimationFinishCheck finishCheck(signalReceived);
2355   animation.FinishedSignal().Connect(&application, finishCheck);
2356
2357   application.SendNotification();
2358   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2359
2360   // We didn't expect the animation to finish yet
2361   application.SendNotification();
2362   finishCheck.CheckSignalNotReceived();
2363   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(20,20,20), TEST_LOCATION );
2364
2365   // Add to the stage
2366   application.GetScene().Add(actor);
2367
2368   application.SendNotification();
2369   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2370
2371   // We didn't expect the animation to finish yet
2372   application.SendNotification();
2373   finishCheck.CheckSignalNotReceived();
2374   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(40,40,40)/*on-stage*/, TEST_LOCATION );
2375
2376   // Remove from the stage
2377   application.GetScene().Remove(actor); // baked here
2378
2379   application.SendNotification();
2380   // this render is a no-op in this case as animator is disabled while off stage
2381   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2382   // We didn't expect the animation to finish yet
2383   application.SendNotification();
2384   finishCheck.CheckSignalNotReceived();
2385   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(40,40,40) /*baked value*/, TEST_LOCATION );
2386
2387   // Add back to the stage
2388   application.GetScene().Add(actor);
2389
2390   application.SendNotification();
2391   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2392   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(88,88,88) /* animation restarted at 40,40,40 + 80%*60 */, TEST_LOCATION );
2393   application.Render(static_cast<unsigned int>(0.0f) );
2394   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
2395   application.Render(static_cast<unsigned int>(0.0f) );
2396   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
2397
2398   // Remove from the stage
2399   application.GetScene().Remove(actor); // baked here
2400
2401   application.SendNotification();
2402   // this render is a no-op in this case as animator is disabled while off stage
2403   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 100% progress */);
2404   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
2405   application.Render(static_cast<unsigned int>(0.0f) );
2406   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
2407   application.Render(static_cast<unsigned int>(0.0f) );
2408   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
2409
2410   // Add back to the stage
2411   application.GetScene().Add(actor);
2412
2413   // We didn't expect the animation to finish yet
2414   application.SendNotification();
2415   finishCheck.CheckSignalNotReceived();
2416   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(88,88,88) , TEST_LOCATION );
2417
2418   application.SendNotification();
2419   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2420
2421   // We did expect the animation to finish
2422   application.SendNotification();
2423   finishCheck.CheckSignalReceived();
2424   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
2425
2426   // Check that nothing has changed after a couple of buffer swaps
2427   application.Render(0);
2428   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2429
2430   application.Render(0);
2431   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2432   END_TEST;
2433 }
2434
2435 int UtcDaliAnimationPlayDiscardHandleP(void)
2436 {
2437   TestApplication application;
2438
2439   Actor actor = Actor::New();
2440   application.GetScene().Add(actor);
2441
2442   // Build the animation
2443   float durationSeconds(1.0f);
2444   Animation animation = Animation::New(durationSeconds);
2445   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2446   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2447
2448   bool signalReceived(false);
2449   AnimationFinishCheck finishCheck(signalReceived);
2450   animation.FinishedSignal().Connect(&application, finishCheck);
2451
2452   // Start the animation
2453   animation.Play();
2454
2455   // This is a test of the "Fire and Forget" behaviour
2456   // Discard the animation handle!
2457   animation.Reset();
2458   DALI_TEST_CHECK( !animation );
2459
2460   application.SendNotification();
2461   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2462
2463   // We didn't expect the animation to finish yet
2464   application.SendNotification();
2465   finishCheck.CheckSignalNotReceived();
2466   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
2467
2468   application.SendNotification();
2469   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2470
2471   // We didn't expect the animation to finish yet
2472   application.SendNotification();
2473   finishCheck.CheckSignalNotReceived();
2474   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.4f), TEST_LOCATION );
2475
2476   application.SendNotification();
2477   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2478
2479   // We didn't expect the animation to finish yet
2480   application.SendNotification();
2481   finishCheck.CheckSignalNotReceived();
2482   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.6f), TEST_LOCATION );
2483
2484   application.SendNotification();
2485   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2486
2487   // We didn't expect the animation to finish yet
2488   application.SendNotification();
2489   finishCheck.CheckSignalNotReceived();
2490   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.8f), TEST_LOCATION );
2491
2492   application.SendNotification();
2493   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2494
2495   // We did expect the animation to finish
2496   application.SendNotification();
2497   finishCheck.CheckSignalReceived();
2498   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
2499
2500   // Check that nothing has changed after a couple of buffer swaps
2501   application.Render(0);
2502   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2503   application.Render(0);
2504   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2505   END_TEST;
2506 }
2507
2508 int UtcDaliAnimationPlayStopDiscardHandleP(void)
2509 {
2510   TestApplication application;
2511
2512   Actor actor = Actor::New();
2513   application.GetScene().Add(actor);
2514
2515   // Build the animation
2516   float durationSeconds(1.0f);
2517   Animation animation = Animation::New(durationSeconds);
2518   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2519   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2520
2521   // Start the animation
2522   animation.Play();
2523
2524   bool signalReceived(false);
2525   AnimationFinishCheck finishCheck(signalReceived);
2526   animation.FinishedSignal().Connect(&application, finishCheck);
2527
2528   application.SendNotification();
2529   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2530
2531   // We didn't expect the animation to finish yet
2532   application.SendNotification();
2533   finishCheck.CheckSignalNotReceived();
2534   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
2535
2536   // This is a test of the "Fire and Forget" behaviour
2537   // Stop the animation, and Discard the animation handle!
2538   animation.Stop();
2539   animation.Reset();
2540   DALI_TEST_CHECK( !animation );
2541
2542   application.SendNotification();
2543   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2544
2545   // We expect the animation to finish at 20% progress
2546   application.SendNotification();
2547   finishCheck.CheckSignalReceived();
2548   finishCheck.Reset();
2549   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
2550
2551   application.SendNotification();
2552   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2553
2554   // Check that nothing has changed
2555   application.SendNotification();
2556   finishCheck.CheckSignalNotReceived();
2557   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
2558
2559   application.SendNotification();
2560   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2561
2562   // Check that nothing has changed
2563   application.SendNotification();
2564   finishCheck.CheckSignalNotReceived();
2565   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
2566
2567   application.SendNotification();
2568   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 100% progress */);
2569
2570   // Check that nothing has changed
2571   application.SendNotification();
2572   finishCheck.CheckSignalNotReceived();
2573   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
2574   END_TEST;
2575 }
2576
2577 int UtcDaliAnimationPlayRangeP(void)
2578 {
2579   TestApplication application;
2580
2581   Actor actor = Actor::New();
2582   application.GetScene().Add(actor);
2583
2584   // Build the animation
2585   float durationSeconds(1.0f);
2586   Animation animation = Animation::New(durationSeconds);
2587   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2588   KeyFrames keyframes = KeyFrames::New();
2589   keyframes.Add( 0.0f , Vector3(0.0f,0.0f,0.0f ) );
2590   keyframes.Add( 1.0f , Vector3(100.0f,100.0f,100.0f ) );
2591
2592   animation.AnimateBetween( Property( actor, Actor::Property::POSITION), keyframes );
2593
2594   // Set range between 0.4 and 0.8
2595   animation.SetPlayRange( Vector2(0.4f,0.8f) );
2596   animation.Play();
2597
2598   bool signalReceived(false);
2599   AnimationFinishCheck finishCheck(signalReceived);
2600   animation.FinishedSignal().Connect(&application, finishCheck);
2601
2602   //Test that setting progress outside the range doesn't work
2603   animation.SetCurrentProgress( 0.9f );
2604   application.SendNotification();
2605   application.Render(0);
2606   DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
2607   animation.SetCurrentProgress( 0.2f );
2608   application.SendNotification();
2609   application.Render(0);
2610   DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
2611
2612   application.SendNotification();
2613   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2614
2615   // We didn't expect the animation to finish yet
2616   application.SendNotification();
2617   finishCheck.CheckSignalNotReceived();
2618   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.6f), TEST_LOCATION );
2619
2620   animation.Play(); // Test that calling play has no effect, when animation is already playing
2621   application.SendNotification();
2622   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/* 80% progress */);
2623
2624   // We did expect the animation to finish
2625   application.SendNotification();
2626   finishCheck.CheckSignalReceived();
2627   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.8f), TEST_LOCATION );
2628
2629   // Check that nothing has changed after a couple of buffer swaps
2630   application.Render(0);
2631   DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2632   application.Render(0);
2633   DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2634
2635
2636   //Loop inside the range
2637   finishCheck.Reset();
2638   animation.SetLooping( true );
2639   animation.Play();
2640   application.SendNotification();
2641   float intervalSeconds = 0.1f;
2642   float progress = 0.4f;
2643   for (int iterations = 0; iterations < 10; ++iterations )
2644   {
2645     application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
2646
2647     progress += intervalSeconds;
2648     if (progress > 0.8f)
2649     {
2650       progress = progress - 0.4f;
2651     }
2652
2653     DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), 0.001f, TEST_LOCATION );
2654   }
2655
2656   // We didn't expect the animation to finish yet
2657   application.SendNotification();
2658   finishCheck.CheckSignalNotReceived();
2659
2660
2661   //Test change range on the fly
2662   animation.SetPlayRange( Vector2( 0.2f, 0.9f ) );
2663   application.SendNotification();
2664
2665   for (int iterations = 0; iterations < 10; ++iterations )
2666   {
2667     application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
2668
2669     progress += intervalSeconds;
2670     if (progress > 0.9f)
2671     {
2672       progress = progress - 0.7f;
2673     }
2674
2675     DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), 0.001f, TEST_LOCATION );
2676   }
2677
2678   END_TEST;
2679 }
2680
2681 int UtcDaliAnimationPlayFromP(void)
2682 {
2683   TestApplication application;
2684
2685   Actor actor = Actor::New();
2686   application.GetScene().Add(actor);
2687
2688   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
2689
2690   // Build the animation
2691   float durationSeconds(1.0f);
2692   Animation animation = Animation::New(durationSeconds);
2693   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2694   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2695
2696   // Start the animation from 40% progress
2697   animation.PlayFrom( 0.4f );
2698
2699   // Target value should be updated straight away
2700   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
2701
2702   bool signalReceived(false);
2703   AnimationFinishCheck finishCheck(signalReceived);
2704   animation.FinishedSignal().Connect(&application, finishCheck);
2705
2706   application.SendNotification();
2707   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2708
2709   // We didn't expect the animation to finish yet
2710   application.SendNotification();
2711   finishCheck.CheckSignalNotReceived();
2712   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.6f), TEST_LOCATION );
2713
2714   animation.Play(); // Test that calling play has no effect, when animation is already playing
2715   application.SendNotification();
2716   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2717
2718   // We didn't expect the animation to finish yet
2719   application.SendNotification();
2720   finishCheck.CheckSignalNotReceived();
2721   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.8f), TEST_LOCATION );
2722
2723   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2724   // We did expect the animation to finish
2725   application.SendNotification();
2726   finishCheck.CheckSignalReceived();
2727   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
2728
2729   // Check that nothing has changed after a couple of buffer swaps
2730   application.Render(0);
2731   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2732   application.Render(0);
2733   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2734   END_TEST;
2735 }
2736
2737 int UtcDaliAnimationPlayFromN(void)
2738 {
2739   TestApplication application;
2740
2741   Actor actor = Actor::New();
2742   application.GetScene().Add(actor);
2743
2744   // Build the animation
2745   float durationSeconds(1.0f);
2746   Animation animation = Animation::New(durationSeconds);
2747   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2748   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2749
2750   //PlayFrom with an argument outside the range [0..1] will be ignored
2751   animation.PlayFrom(-1.0f);
2752   application.SendNotification();
2753   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
2754
2755   animation.PlayFrom(100.0f);
2756   application.SendNotification();
2757   DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
2758   END_TEST;
2759 }
2760
2761 int UtcDaliAnimationPauseP(void)
2762 {
2763   TestApplication application;
2764
2765   Actor actor = Actor::New();
2766   application.GetScene().Add(actor);
2767
2768   // Build the animation
2769   float durationSeconds(1.0f);
2770   Animation animation = Animation::New(durationSeconds);
2771   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2772   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2773
2774   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2775
2776   // Start the animation
2777   animation.Play();
2778
2779   bool signalReceived(false);
2780   AnimationFinishCheck finishCheck(signalReceived);
2781   animation.FinishedSignal().Connect(&application, finishCheck);
2782
2783   application.SendNotification();
2784   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2785
2786   // We didn't expect the animation to finish yet
2787   application.SendNotification();
2788   finishCheck.CheckSignalNotReceived();
2789   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress, TEST_LOCATION );
2790
2791   // Pause the animation
2792   animation.Pause();
2793   application.SendNotification();
2794
2795   // Loop 5 times
2796   for (int i=0; i<5; ++i)
2797   {
2798     application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2799
2800     // We didn't expect the animation to finish yet
2801     application.SendNotification();
2802     finishCheck.CheckSignalNotReceived();
2803     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
2804   }
2805
2806   // Keep going
2807   animation.Play();
2808   application.SendNotification();
2809   application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2810
2811   // We didn't expect the animation to finish yet
2812   application.SendNotification();
2813   finishCheck.CheckSignalNotReceived();
2814
2815   application.SendNotification();
2816   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2817
2818   // We did expect the animation to finish
2819   application.SendNotification();
2820   finishCheck.CheckSignalReceived();
2821   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
2822
2823   // Check that nothing has changed after a couple of buffer swaps
2824   application.Render(0);
2825   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2826   application.Render(0);
2827   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2828   END_TEST;
2829 }
2830
2831
2832 int UtcDaliAnimationGetStateP(void)
2833 {
2834   TestApplication application;
2835
2836   Actor actor = Actor::New();
2837   application.GetScene().Add(actor);
2838
2839   // Build the animation
2840   float durationSeconds(1.0f);
2841   Animation animation = Animation::New(durationSeconds);
2842   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2843   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2844   DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2845
2846   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2847
2848   // Start the animation
2849   animation.Play();
2850
2851   DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2852
2853   bool signalReceived(false);
2854   AnimationFinishCheck finishCheck(signalReceived);
2855   animation.FinishedSignal().Connect(&application, finishCheck);
2856
2857   application.SendNotification();
2858   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2859
2860   // We didn't expect the animation to finish yet
2861   application.SendNotification();
2862   finishCheck.CheckSignalNotReceived();
2863   DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2864   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress, TEST_LOCATION );
2865
2866   // Pause the animation
2867   animation.Pause();
2868   DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
2869   application.SendNotification();
2870   application.Render(0.f);
2871
2872   // Loop 5 times
2873   for (int i=0; i<5; ++i)
2874   {
2875     application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2876
2877     // We didn't expect the animation to finish yet
2878     application.SendNotification();
2879     finishCheck.CheckSignalNotReceived();
2880     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
2881     DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
2882   }
2883
2884   // Keep going
2885   finishCheck.Reset();
2886   animation.Play();
2887   DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2888   application.SendNotification();
2889   application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2890   // We didn't expect the animation to finish yet
2891   application.SendNotification();
2892   finishCheck.CheckSignalNotReceived();
2893   DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2894
2895   application.SendNotification();
2896   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2897
2898   // We did expect the animation to finish
2899   application.SendNotification();
2900   finishCheck.CheckSignalReceived();
2901   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
2902   DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2903
2904   // Check that nothing has changed after a couple of buffer swaps
2905   application.Render(0);
2906   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2907   application.Render(0);
2908   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2909   DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2910
2911   // re-play
2912   finishCheck.Reset();
2913   animation.Play();
2914   DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2915   application.SendNotification();
2916   application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2917   application.SendNotification();
2918   finishCheck.CheckSignalNotReceived();
2919   DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2920
2921
2922   END_TEST;
2923 }
2924
2925 int UtcDaliAnimationStopP(void)
2926 {
2927   TestApplication application;
2928
2929   Actor actor = Actor::New();
2930   application.GetScene().Add(actor);
2931
2932   // Build the animation
2933   float durationSeconds(1.0f);
2934   Animation animation = Animation::New(durationSeconds);
2935   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2936   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2937
2938   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2939
2940   // Start the animation
2941   animation.Play();
2942
2943   bool signalReceived(false);
2944   AnimationFinishCheck finishCheck(signalReceived);
2945   animation.FinishedSignal().Connect(&application, finishCheck);
2946
2947   application.SendNotification();
2948   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2949
2950   // We didn't expect the animation to finish yet
2951   application.SendNotification();
2952   finishCheck.CheckSignalNotReceived();
2953   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress, TEST_LOCATION );
2954
2955   // Stop the animation
2956   animation.Stop();
2957   application.SendNotification();
2958
2959   // Loop 5 times
2960   for (int i=0; i<5; ++i)
2961   {
2962     application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2963
2964     // We did expect the animation to finish
2965     application.SendNotification();
2966     finishCheck.CheckSignalReceived();
2967     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress/* Still 50% progress when stopped */, TEST_LOCATION );
2968   }
2969   END_TEST;
2970 }
2971
2972 int UtcDaliAnimationStopSetPositionP(void)
2973 {
2974   // Test that Animation::Stop & Actor::SetPosition can be used in conjunction
2975   // i.e. to check that the animation does not interfere with the position set.
2976
2977   TestApplication application;
2978
2979   Actor actor = Actor::New();
2980   application.GetScene().Add(actor);
2981
2982   // Build the animation
2983   float durationSeconds(1.0f);
2984   Animation animation = Animation::New(durationSeconds);
2985   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2986   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2987
2988   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2989
2990   // Start the animation
2991   animation.Play();
2992
2993   bool signalReceived(false);
2994   AnimationFinishCheck finishCheck(signalReceived);
2995   animation.FinishedSignal().Connect(&application, finishCheck);
2996
2997   application.SendNotification();
2998   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2999
3000   // We didn't expect the animation to finish yet
3001   application.SendNotification();
3002   finishCheck.CheckSignalNotReceived();
3003   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress, TEST_LOCATION );
3004
3005   // Stop the animation
3006   animation.Stop();
3007   Vector3 positionSet(2.0f, 3.0f, 4.0f);
3008   actor.SetProperty( Actor::Property::POSITION, positionSet );
3009   application.SendNotification();
3010
3011   // Loop 5 times
3012   for (int i=0; i<5; ++i)
3013   {
3014     application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
3015
3016     // We did expect the animation to finish
3017     application.SendNotification();
3018     finishCheck.CheckSignalReceived();
3019     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), positionSet/*Animation should not interfere with this*/, TEST_LOCATION );
3020   }
3021   END_TEST;
3022 }
3023
3024 int UtcDaliAnimationClearP(void)
3025 {
3026   TestApplication application;
3027
3028   Actor actor = Actor::New();
3029   application.GetScene().Add(actor);
3030
3031   // Build the animation
3032   float durationSeconds(1.0f);
3033   Animation animation = Animation::New(durationSeconds);
3034   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
3035   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
3036
3037   Vector3 fiftyPercentProgress(targetPosition * 0.5f);
3038
3039   // Start the animation
3040   animation.Play();
3041
3042   bool signalReceived(false);
3043   AnimationFinishCheck finishCheck(signalReceived);
3044   animation.FinishedSignal().Connect(&application, finishCheck);
3045
3046   application.SendNotification();
3047   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
3048
3049   // We didn't expect the animation to finish yet
3050   application.SendNotification();
3051   finishCheck.CheckSignalNotReceived();
3052   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress, TEST_LOCATION );
3053
3054   // Clear the animation
3055   animation.Clear();
3056   application.SendNotification();
3057
3058   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
3059
3060   // We don't expect the animation to finish now
3061   application.SendNotification();
3062   finishCheck.CheckSignalNotReceived();
3063   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress/* Still 50% progress since the animator was destroyed */, TEST_LOCATION );
3064
3065   // Restart as a scale animation; this should not move the actor's position
3066   finishCheck.Reset();
3067   actor.SetProperty( Actor::Property::POSITION, Vector3::ZERO );
3068   Vector3 targetScale(3.0f, 3.0f, 3.0f);
3069   animation.AnimateTo( Property( actor, Actor::Property::SCALE ), targetScale, AlphaFunction::LINEAR );
3070   animation.Play();
3071
3072   application.SendNotification();
3073   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
3074
3075   // We didn't expect the animation to finish yet
3076   application.SendNotification();
3077   finishCheck.CheckSignalNotReceived();
3078   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
3079   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION );
3080
3081   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
3082
3083   // We did expect the animation to finish
3084   application.SendNotification();
3085   finishCheck.CheckSignalReceived();
3086   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
3087   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
3088   END_TEST;
3089 }
3090
3091 int UtcDaliAnimationFinishedSignalP(void)
3092 {
3093   TestApplication application;
3094
3095   // Start the empty animation
3096   float durationSeconds(1.0f);
3097   Animation animation = Animation::New(durationSeconds);
3098   animation.Play();
3099
3100   bool signalReceived(false);
3101   AnimationFinishCheck finishCheck(signalReceived);
3102   animation.FinishedSignal().Connect(&application, finishCheck);
3103
3104   application.SendNotification();
3105   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*beyond the animation duration*/);
3106
3107   // We did expect the animation to finish
3108   application.SendNotification();
3109   finishCheck.CheckSignalReceived();
3110   END_TEST;
3111 }
3112
3113 int UtcDaliAnimationAnimateByBooleanP(void)
3114 {
3115   TestApplication application;
3116
3117   Actor actor = Actor::New();
3118
3119   // Register a boolean property
3120   bool startValue(false);
3121   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3122   application.GetScene().Add(actor);
3123   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3124   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3125
3126   // Build the animation
3127   float durationSeconds(2.0f);
3128   Animation animation = Animation::New(durationSeconds);
3129   const bool relativeValue(true);
3130   const bool finalValue( false || relativeValue );
3131   animation.AnimateBy(Property(actor, index), relativeValue);
3132
3133   // Start the animation
3134   animation.Play();
3135
3136   // Target value should be retrievable straight away
3137   DALI_TEST_EQUALS( actor.GetProperty< bool >( index ), finalValue, TEST_LOCATION );
3138
3139   bool signalReceived(false);
3140   AnimationFinishCheck finishCheck(signalReceived);
3141   animation.FinishedSignal().Connect(&application, finishCheck);
3142
3143   application.SendNotification();
3144   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3145
3146   // We didn't expect the animation to finish yet
3147   application.SendNotification();
3148   finishCheck.CheckSignalNotReceived();
3149   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3150
3151   application.SendNotification();
3152   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3153
3154   // We did expect the animation to finish
3155   application.SendNotification();
3156   finishCheck.CheckSignalReceived();
3157   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3158
3159   // Check that nothing has changed after a couple of buffer swaps
3160   application.Render(0);
3161   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3162   application.Render(0);
3163   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3164
3165   // Repeat with relative value "false" - this should be an NOOP
3166   animation = Animation::New(durationSeconds);
3167   bool noOpValue(false);
3168   animation.AnimateBy(Property(actor, index), noOpValue);
3169
3170   // Start the animation
3171   animation.Play();
3172
3173   finishCheck.Reset();
3174   animation.FinishedSignal().Connect(&application, finishCheck);
3175
3176   application.SendNotification();
3177   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3178
3179   // We didn't expect the animation to finish yet
3180   application.SendNotification();
3181   finishCheck.CheckSignalNotReceived();
3182   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3183
3184   application.SendNotification();
3185   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3186
3187   // We did expect the animation to finish
3188   application.SendNotification();
3189   finishCheck.CheckSignalReceived();
3190   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3191
3192   // Check that nothing has changed after a couple of buffer swaps
3193   application.Render(0);
3194   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3195   application.Render(0);
3196   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3197   END_TEST;
3198 }
3199
3200 int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void)
3201 {
3202   TestApplication application;
3203
3204   Actor actor = Actor::New();
3205
3206   // Register a boolean property
3207   bool startValue(false);
3208   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3209   application.GetScene().Add(actor);
3210   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3211   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3212
3213   // Build the animation
3214   float durationSeconds(2.0f);
3215   Animation animation = Animation::New(durationSeconds);
3216   bool relativeValue(true);
3217   bool finalValue( false || relativeValue );
3218   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN);
3219
3220   // Start the animation
3221   animation.Play();
3222
3223   bool signalReceived(false);
3224   AnimationFinishCheck finishCheck(signalReceived);
3225   animation.FinishedSignal().Connect(&application, finishCheck);
3226
3227   application.SendNotification();
3228   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3229
3230   // We didn't expect the animation to finish yet
3231   application.SendNotification();
3232   finishCheck.CheckSignalNotReceived();
3233   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3234
3235   application.SendNotification();
3236   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3237
3238   // We did expect the animation to finish
3239   application.SendNotification();
3240   finishCheck.CheckSignalReceived();
3241   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3242
3243   // Check that nothing has changed after a couple of buffer swaps
3244   application.Render(0);
3245   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3246   application.Render(0);
3247   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3248
3249   // Repeat with relative value "false" - this should be an NOOP
3250   animation = Animation::New(durationSeconds);
3251   bool noOpValue(false);
3252   animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunction::EASE_IN);
3253
3254   // Start the animation
3255   animation.Play();
3256
3257   finishCheck.Reset();
3258   animation.FinishedSignal().Connect(&application, finishCheck);
3259
3260   application.SendNotification();
3261   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3262
3263   // We didn't expect the animation to finish yet
3264   application.SendNotification();
3265   finishCheck.CheckSignalNotReceived();
3266   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3267
3268   application.SendNotification();
3269   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3270
3271   // We did expect the animation to finish
3272   application.SendNotification();
3273   finishCheck.CheckSignalReceived();
3274   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3275   END_TEST;
3276 }
3277
3278 int UtcDaliAnimationAnimateByBooleanTimePeriodP(void)
3279 {
3280   TestApplication application;
3281
3282   Actor actor = Actor::New();
3283
3284   // Register a boolean property
3285   bool startValue(false);
3286   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3287   application.GetScene().Add(actor);
3288   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3289   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3290
3291   // Build the animation
3292   float durationSeconds(2.0f);
3293   Animation animation = Animation::New(durationSeconds);
3294   bool relativeValue(true);
3295   bool finalValue( false || relativeValue );
3296   float animatorDurationSeconds(durationSeconds * 0.5f);
3297   animation.AnimateBy( Property(actor, index),
3298                        relativeValue,
3299                        TimePeriod( animatorDurationSeconds ) );
3300
3301   // Start the animation
3302   animation.Play();
3303
3304   bool signalReceived(false);
3305   AnimationFinishCheck finishCheck(signalReceived);
3306   animation.FinishedSignal().Connect(&application, finishCheck);
3307
3308   application.SendNotification();
3309   application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
3310
3311   // We didn't expect the animation to finish yet
3312   application.SendNotification();
3313   finishCheck.CheckSignalNotReceived();
3314   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3315
3316   application.SendNotification();
3317   application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
3318
3319   // We didn't expect the animation to finish yet...
3320   application.SendNotification();
3321   finishCheck.CheckSignalNotReceived();
3322
3323   // ...however we should have reached the final value
3324   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3325
3326   application.SendNotification();
3327   application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
3328
3329   // We did expect the animation to finish
3330   application.SendNotification();
3331   finishCheck.CheckSignalReceived();
3332   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3333
3334   // Check that nothing has changed after a couple of buffer swaps
3335   application.Render(0);
3336   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3337   application.Render(0);
3338   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3339   END_TEST;
3340 }
3341
3342 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void)
3343 {
3344   TestApplication application;
3345
3346   Actor actor = Actor::New();
3347
3348   // Register a boolean property
3349   bool startValue(false);
3350   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3351   application.GetScene().Add(actor);
3352   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3353   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3354
3355   // Build the animation
3356   float durationSeconds(2.0f);
3357   Animation animation = Animation::New(durationSeconds);
3358   bool relativeValue(true);
3359   bool finalValue( false || relativeValue );
3360   float animatorDurationSeconds(durationSeconds * 0.5f);
3361   animation.AnimateBy( Property(actor, index),
3362                        relativeValue,
3363                        AlphaFunction::EASE_IN_OUT,
3364                        TimePeriod( animatorDurationSeconds ) );
3365
3366   // Start the animation
3367   animation.Play();
3368
3369   bool signalReceived(false);
3370   AnimationFinishCheck finishCheck(signalReceived);
3371   animation.FinishedSignal().Connect(&application, finishCheck);
3372
3373   application.SendNotification();
3374   application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
3375
3376   // We didn't expect the animation to finish yet
3377   application.SendNotification();
3378   finishCheck.CheckSignalNotReceived();
3379   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3380
3381   application.SendNotification();
3382   application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
3383
3384   // We didn't expect the animation to finish yet...
3385   application.SendNotification();
3386   finishCheck.CheckSignalNotReceived();
3387
3388   // ...however we should have reached the final value
3389   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3390
3391   application.SendNotification();
3392   application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
3393
3394   // We did expect the animation to finish
3395   application.SendNotification();
3396   finishCheck.CheckSignalReceived();
3397   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3398
3399   // Check that nothing has changed after a couple of buffer swaps
3400   application.Render(0);
3401   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3402   application.Render(0);
3403   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3404   END_TEST;
3405 }
3406
3407 int UtcDaliAnimationAnimateByFloatP(void)
3408 {
3409   TestApplication application;
3410
3411   Actor actor = Actor::New();
3412
3413   // Register a float property
3414   float startValue(10.0f);
3415   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3416   application.GetScene().Add(actor);
3417   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3418   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3419
3420   // Build the animation
3421   float durationSeconds(2.0f);
3422   Animation animation = Animation::New(durationSeconds);
3423   float targetValue(50.0f);
3424   float relativeValue(targetValue - startValue);
3425   animation.AnimateBy(Property(actor, index), relativeValue);
3426
3427   float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3428
3429   // Start the animation
3430   animation.Play();
3431
3432   // Target value should be retrievable straight away
3433   DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
3434
3435   bool signalReceived(false);
3436   AnimationFinishCheck finishCheck(signalReceived);
3437   animation.FinishedSignal().Connect(&application, finishCheck);
3438
3439   application.SendNotification();
3440   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3441
3442   // We didn't expect the animation to finish yet
3443   application.SendNotification();
3444   finishCheck.CheckSignalNotReceived();
3445   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3446
3447   application.SendNotification();
3448   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3449
3450   // We did expect the animation to finish
3451   application.SendNotification();
3452   finishCheck.CheckSignalReceived();
3453   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3454
3455   // Check that nothing has changed after a couple of buffer swaps
3456   application.Render(0);
3457   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3458   application.Render(0);
3459   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3460   END_TEST;
3461 }
3462
3463 int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void)
3464 {
3465   TestApplication application;
3466
3467   Actor actor = Actor::New();
3468
3469   // Register a float property
3470   float startValue(10.0f);
3471   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3472   application.GetScene().Add(actor);
3473   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3474   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3475
3476   // Build the animation
3477   float durationSeconds(1.0f);
3478   Animation animation = Animation::New(durationSeconds);
3479   float targetValue(90.0f);
3480   float relativeValue(targetValue - startValue);
3481   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3482
3483   float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3484
3485   // Start the animation
3486   animation.Play();
3487
3488   bool signalReceived(false);
3489   AnimationFinishCheck finishCheck(signalReceived);
3490   animation.FinishedSignal().Connect(&application, finishCheck);
3491
3492   application.SendNotification();
3493   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3494
3495   // We didn't expect the animation to finish yet
3496   application.SendNotification();
3497   finishCheck.CheckSignalNotReceived();
3498
3499   // The position should have moved more, than with a linear alpha function
3500   float current( actor.GetCurrentProperty< float >( index ) );
3501   DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3502
3503   application.SendNotification();
3504   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3505
3506   // We did expect the animation to finish
3507   application.SendNotification();
3508   finishCheck.CheckSignalReceived();
3509   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3510
3511   // Check that nothing has changed after a couple of buffer swaps
3512   application.Render(0);
3513   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3514   application.Render(0);
3515   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3516   END_TEST;
3517 }
3518
3519 int UtcDaliAnimationAnimateByFloatTimePeriodP(void)
3520 {
3521   TestApplication application;
3522
3523   Actor actor = Actor::New();
3524
3525   // Register a float property
3526   float startValue(10.0f);
3527   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3528   application.GetScene().Add(actor);
3529   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3530   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3531
3532   // Build the animation
3533   float durationSeconds(1.0f);
3534   Animation animation = Animation::New(durationSeconds);
3535   float targetValue(30.0f);
3536   float relativeValue(targetValue - startValue);
3537   float delay = 0.5f;
3538   animation.AnimateBy(Property(actor, index),
3539                       relativeValue,
3540                       TimePeriod(delay, durationSeconds - delay));
3541
3542   // Start the animation
3543   animation.Play();
3544
3545   bool signalReceived(false);
3546   AnimationFinishCheck finishCheck(signalReceived);
3547   animation.FinishedSignal().Connect(&application, finishCheck);
3548
3549   application.SendNotification();
3550   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3551
3552   // We didn't expect the animation to finish yet
3553   application.SendNotification();
3554   finishCheck.CheckSignalNotReceived();
3555   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3556
3557   application.SendNotification();
3558   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3559
3560   // We didn't expect the animation to finish yet
3561   application.SendNotification();
3562   finishCheck.CheckSignalNotReceived();
3563   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3564
3565   application.SendNotification();
3566   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3567
3568   // We did expect the animation to finish
3569   application.SendNotification();
3570   finishCheck.CheckSignalReceived();
3571   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3572
3573   // Check that nothing has changed after a couple of buffer swaps
3574   application.Render(0);
3575   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3576   application.Render(0);
3577   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3578   END_TEST;
3579 }
3580
3581 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void)
3582 {
3583   TestApplication application;
3584
3585   Actor actor = Actor::New();
3586
3587   // Register a float property
3588   float startValue(10.0f);
3589   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3590   application.GetScene().Add(actor);
3591   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3592   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3593
3594   // Build the animation
3595   float durationSeconds(1.0f);
3596   Animation animation = Animation::New(durationSeconds);
3597   float targetValue(30.0f);
3598   float relativeValue(targetValue - startValue);
3599   float delay = 0.5f;
3600   animation.AnimateBy(Property(actor, index),
3601                       relativeValue,
3602                       AlphaFunction::LINEAR,
3603                       TimePeriod(delay, durationSeconds - delay));
3604
3605   // Start the animation
3606   animation.Play();
3607
3608   bool signalReceived(false);
3609   AnimationFinishCheck finishCheck(signalReceived);
3610   animation.FinishedSignal().Connect(&application, finishCheck);
3611
3612   application.SendNotification();
3613   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3614
3615   // We didn't expect the animation to finish yet
3616   application.SendNotification();
3617   finishCheck.CheckSignalNotReceived();
3618   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3619
3620   application.SendNotification();
3621   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3622
3623   // We didn't expect the animation to finish yet
3624   application.SendNotification();
3625   finishCheck.CheckSignalNotReceived();
3626   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3627
3628   application.SendNotification();
3629   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3630
3631   // We did expect the animation to finish
3632   application.SendNotification();
3633   finishCheck.CheckSignalReceived();
3634   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3635
3636   // Check that nothing has changed after a couple of buffer swaps
3637   application.Render(0);
3638   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3639   application.Render(0);
3640   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3641   END_TEST;
3642 }
3643
3644 int UtcDaliAnimationAnimateByIntegerP(void)
3645 {
3646   TestApplication application;
3647
3648   Actor actor = Actor::New();
3649
3650   // Register an integer property
3651   int startValue(1);
3652   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3653   application.GetScene().Add(actor);
3654   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3655   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3656
3657   // Build the animation
3658   float durationSeconds(2.0f);
3659   Animation animation = Animation::New(durationSeconds);
3660   int targetValue(50);
3661   int relativeValue(targetValue - startValue);
3662   animation.AnimateBy(Property(actor, index), relativeValue);
3663
3664   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3665
3666   // Start the animation
3667   animation.Play();
3668
3669   // Target value should be retrievable straight away
3670   DALI_TEST_EQUALS( actor.GetProperty< int >( index ), targetValue, TEST_LOCATION );
3671
3672   bool signalReceived(false);
3673   AnimationFinishCheck finishCheck(signalReceived);
3674   animation.FinishedSignal().Connect(&application, finishCheck);
3675
3676   application.SendNotification();
3677   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3678
3679   // We didn't expect the animation to finish yet
3680   application.SendNotification();
3681   finishCheck.CheckSignalNotReceived();
3682   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3683
3684   application.SendNotification();
3685   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3686
3687   // We did expect the animation to finish
3688   application.SendNotification();
3689   finishCheck.CheckSignalReceived();
3690   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3691
3692   // Check that nothing has changed after a couple of buffer swaps
3693   application.Render(0);
3694   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3695   application.Render(0);
3696   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3697   END_TEST;
3698 }
3699
3700 int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void)
3701 {
3702   TestApplication application;
3703
3704   Actor actor = Actor::New();
3705
3706   // Register an integer property
3707   int startValue(1);
3708   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3709   application.GetScene().Add(actor);
3710   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3711   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3712
3713   // Build the animation
3714   float durationSeconds(1.0f);
3715   Animation animation = Animation::New(durationSeconds);
3716   int targetValue(90);
3717   int relativeValue(targetValue - startValue);
3718   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3719
3720   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3721
3722   // Start the animation
3723   animation.Play();
3724
3725   bool signalReceived(false);
3726   AnimationFinishCheck finishCheck(signalReceived);
3727   animation.FinishedSignal().Connect(&application, finishCheck);
3728
3729   application.SendNotification();
3730   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3731
3732   // We didn't expect the animation to finish yet
3733   application.SendNotification();
3734   finishCheck.CheckSignalNotReceived();
3735
3736   // The position should have moved more, than with a linear alpha function
3737   int current( actor.GetCurrentProperty< int >( index ) );
3738   DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3739
3740   application.SendNotification();
3741   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3742
3743   // We did expect the animation to finish
3744   application.SendNotification();
3745   finishCheck.CheckSignalReceived();
3746   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3747
3748   // Check that nothing has changed after a couple of buffer swaps
3749   application.Render(0);
3750   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3751   application.Render(0);
3752   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3753   END_TEST;
3754 }
3755
3756 int UtcDaliAnimationAnimateByIntegerTimePeriodP(void)
3757 {
3758   TestApplication application;
3759
3760   Actor actor = Actor::New();
3761
3762   // Register an integer property
3763   int startValue(10);
3764   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3765   application.GetScene().Add(actor);
3766   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3767   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3768
3769   // Build the animation
3770   float durationSeconds(1.0f);
3771   Animation animation = Animation::New(durationSeconds);
3772   int targetValue(30);
3773   int relativeValue(targetValue - startValue);
3774   float delay = 0.5f;
3775   animation.AnimateBy(Property(actor, index),
3776                       relativeValue,
3777                       TimePeriod(delay, durationSeconds - delay));
3778
3779   // Start the animation
3780   animation.Play();
3781
3782   bool signalReceived(false);
3783   AnimationFinishCheck finishCheck(signalReceived);
3784   animation.FinishedSignal().Connect(&application, finishCheck);
3785
3786   application.SendNotification();
3787   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3788
3789   // We didn't expect the animation to finish yet
3790   application.SendNotification();
3791   finishCheck.CheckSignalNotReceived();
3792   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3793
3794   application.SendNotification();
3795   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3796
3797   // We didn't expect the animation to finish yet
3798   application.SendNotification();
3799   finishCheck.CheckSignalNotReceived();
3800   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3801
3802   application.SendNotification();
3803   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3804
3805   // We did expect the animation to finish
3806   application.SendNotification();
3807   finishCheck.CheckSignalReceived();
3808   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3809
3810   // Check that nothing has changed after a couple of buffer swaps
3811   application.Render(0);
3812   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3813   application.Render(0);
3814   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3815   END_TEST;
3816 }
3817
3818 int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void)
3819 {
3820   TestApplication application;
3821
3822   Actor actor = Actor::New();
3823
3824   // Register an integer property
3825   int startValue(10);
3826   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3827   application.GetScene().Add(actor);
3828   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3829   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3830
3831   // Build the animation
3832   float durationSeconds(1.0f);
3833   Animation animation = Animation::New(durationSeconds);
3834   int targetValue(30);
3835   int relativeValue(targetValue - startValue);
3836   float delay = 0.5f;
3837   animation.AnimateBy(Property(actor, index),
3838                       relativeValue,
3839                       AlphaFunction::LINEAR,
3840                       TimePeriod(delay, durationSeconds - delay));
3841
3842   // Start the animation
3843   animation.Play();
3844
3845   bool signalReceived(false);
3846   AnimationFinishCheck finishCheck(signalReceived);
3847   animation.FinishedSignal().Connect(&application, finishCheck);
3848
3849   application.SendNotification();
3850   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3851
3852   // We didn't expect the animation to finish yet
3853   application.SendNotification();
3854   finishCheck.CheckSignalNotReceived();
3855   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3856
3857   application.SendNotification();
3858   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3859
3860   // We didn't expect the animation to finish yet
3861   application.SendNotification();
3862   finishCheck.CheckSignalNotReceived();
3863   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3864
3865   application.SendNotification();
3866   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3867
3868   // We did expect the animation to finish
3869   application.SendNotification();
3870   finishCheck.CheckSignalReceived();
3871   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3872
3873   // Check that nothing has changed after a couple of buffer swaps
3874   application.Render(0);
3875   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3876   application.Render(0);
3877   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3878   END_TEST;
3879 }
3880
3881 int UtcDaliAnimationAnimateByQuaternionP(void)
3882 {
3883   TestApplication application;
3884
3885   Actor actor = Actor::New();
3886
3887   // Register a quaternion property
3888   const Quaternion startValue( Degree( 90 ), Vector3::XAXIS );
3889   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3890   application.GetScene().Add(actor);
3891   DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == startValue );
3892   DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == startValue );
3893
3894   // Build the animation
3895   float durationSeconds(2.0f);
3896   Animation animation = Animation::New(durationSeconds);
3897   const Quaternion relativeValue( Degree( 90 ), Vector3::ZAXIS );
3898   const Quaternion finalValue( startValue * relativeValue );
3899   animation.AnimateBy(Property(actor, index), relativeValue);
3900
3901   DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == startValue );
3902   DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == startValue );
3903
3904   // Start the animation
3905   animation.Play();
3906
3907   // Target value should be retrievable straight away
3908   DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == finalValue );
3909
3910   application.SendNotification();
3911   application.Render( 2000 ); // animation complete
3912
3913   DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == finalValue );
3914   DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == finalValue );
3915
3916   END_TEST;
3917 }
3918
3919 int UtcDaliAnimationAnimateByVector2P(void)
3920 {
3921   TestApplication application;
3922
3923   Actor actor = Actor::New();
3924
3925   // Register a Vector2 property
3926   Vector2 startValue(10.0f, 10.0f);
3927   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3928   application.GetScene().Add(actor);
3929   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3930   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3931
3932   // Build the animation
3933   float durationSeconds(2.0f);
3934   Animation animation = Animation::New(durationSeconds);
3935   Vector2 targetValue(60.0f, 60.0f);
3936   Vector2 relativeValue(targetValue - startValue);
3937   animation.AnimateBy(Property(actor, index), relativeValue);
3938
3939   Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3940
3941   // Start the animation
3942   animation.Play();
3943
3944   // Target value should be retrievable straight away
3945   DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3946
3947   bool signalReceived(false);
3948   AnimationFinishCheck finishCheck(signalReceived);
3949   animation.FinishedSignal().Connect(&application, finishCheck);
3950
3951   application.SendNotification();
3952   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3953
3954   // We didn't expect the animation to finish yet
3955   application.SendNotification();
3956   finishCheck.CheckSignalNotReceived();
3957   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3958
3959   application.SendNotification();
3960   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3961
3962   // We did expect the animation to finish
3963   application.SendNotification();
3964   finishCheck.CheckSignalReceived();
3965   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3966
3967   // Check that nothing has changed after a couple of buffer swaps
3968   application.Render(0);
3969   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3970   application.Render(0);
3971   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3972   END_TEST;
3973 }
3974
3975 int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void)
3976 {
3977   TestApplication application;
3978
3979   Actor actor = Actor::New();
3980
3981   // Register a Vector2 property
3982   Vector2 startValue(100.0f, 100.0f);
3983   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
3984   application.GetScene().Add(actor);
3985   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3986   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3987
3988   // Build the animation
3989   float durationSeconds(1.0f);
3990   Animation animation = Animation::New(durationSeconds);
3991   Vector2 targetValue(20.0f, 20.0f);
3992   Vector2 relativeValue(targetValue - startValue);
3993   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3994
3995   Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3996
3997   // Start the animation
3998   animation.Play();
3999
4000   bool signalReceived(false);
4001   AnimationFinishCheck finishCheck(signalReceived);
4002   animation.FinishedSignal().Connect(&application, finishCheck);
4003
4004   application.SendNotification();
4005   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4006
4007   // We didn't expect the animation to finish yet
4008   application.SendNotification();
4009   finishCheck.CheckSignalNotReceived();
4010
4011   // The position should have moved more, than with a linear alpha function
4012   Vector2 current( actor.GetCurrentProperty< Vector2 >( index ) );
4013   DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
4014   DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
4015
4016   application.SendNotification();
4017   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4018
4019   // We did expect the animation to finish
4020   application.SendNotification();
4021   finishCheck.CheckSignalReceived();
4022   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4023
4024   // Check that nothing has changed after a couple of buffer swaps
4025   application.Render(0);
4026   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4027   application.Render(0);
4028   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4029   END_TEST;
4030 }
4031
4032 int UtcDaliAnimationAnimateByVector2TimePeriodP(void)
4033 {
4034   TestApplication application;
4035
4036   Actor actor = Actor::New();
4037
4038   // Register a Vector2 property
4039   Vector2 startValue(10.0f, 10.0f);
4040   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4041   application.GetScene().Add(actor);
4042   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
4043   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
4044
4045   // Build the animation
4046   float durationSeconds(1.0f);
4047   Animation animation = Animation::New(durationSeconds);
4048   Vector2 targetValue(30.0f, 30.0f);
4049   Vector2 relativeValue(targetValue - startValue);
4050   float delay = 0.5f;
4051   animation.AnimateBy(Property(actor, index),
4052                       relativeValue,
4053                       TimePeriod(delay, durationSeconds - delay));
4054
4055   // Start the animation
4056   animation.Play();
4057
4058   bool signalReceived(false);
4059   AnimationFinishCheck finishCheck(signalReceived);
4060   animation.FinishedSignal().Connect(&application, finishCheck);
4061
4062   application.SendNotification();
4063   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4064
4065   // We didn't expect the animation to finish yet
4066   application.SendNotification();
4067   finishCheck.CheckSignalNotReceived();
4068   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
4069
4070   application.SendNotification();
4071   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4072
4073   // We didn't expect the animation to finish yet
4074   application.SendNotification();
4075   finishCheck.CheckSignalNotReceived();
4076   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4077
4078   application.SendNotification();
4079   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4080
4081   // We did expect the animation to finish
4082   application.SendNotification();
4083   finishCheck.CheckSignalReceived();
4084   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4085
4086   // Check that nothing has changed after a couple of buffer swaps
4087   application.Render(0);
4088   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4089   application.Render(0);
4090   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4091   END_TEST;
4092 }
4093
4094 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void)
4095 {
4096   TestApplication application;
4097
4098   Actor actor = Actor::New();
4099
4100   // Register a Vector2 property
4101   Vector2 startValue(5.0f, 5.0f);
4102   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4103   application.GetScene().Add(actor);
4104   DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
4105   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
4106
4107   // Build the animation
4108   float durationSeconds(1.0f);
4109   Animation animation = Animation::New(durationSeconds);
4110   Vector2 targetValue(10.0f, 10.0f);
4111   Vector2 relativeValue(targetValue - startValue);
4112   float delay = 0.5f;
4113   animation.AnimateBy(Property(actor, index),
4114                       relativeValue,
4115                       AlphaFunction::LINEAR,
4116                       TimePeriod(delay, durationSeconds - delay));
4117
4118   // Start the animation
4119   animation.Play();
4120
4121   bool signalReceived(false);
4122   AnimationFinishCheck finishCheck(signalReceived);
4123   animation.FinishedSignal().Connect(&application, finishCheck);
4124
4125   application.SendNotification();
4126   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4127
4128   // We didn't expect the animation to finish yet
4129   application.SendNotification();
4130   finishCheck.CheckSignalNotReceived();
4131   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
4132
4133   application.SendNotification();
4134   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4135
4136   // We didn't expect the animation to finish yet
4137   application.SendNotification();
4138   finishCheck.CheckSignalNotReceived();
4139   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4140
4141   application.SendNotification();
4142   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4143
4144   // We did expect the animation to finish
4145   application.SendNotification();
4146   finishCheck.CheckSignalReceived();
4147   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4148
4149   // Check that nothing has changed after a couple of buffer swaps
4150   application.Render(0);
4151   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4152   application.Render(0);
4153   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4154   END_TEST;
4155 }
4156
4157 int UtcDaliAnimationAnimateByVector3P(void)
4158 {
4159   TestApplication application;
4160
4161   Actor actor = Actor::New();
4162
4163   // Register a Vector3 property
4164   Vector3 startValue(10.0f, 10.0f, 10.0f);
4165   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4166   application.GetScene().Add(actor);
4167   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4168   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4169
4170   // Build the animation
4171   float durationSeconds(2.0f);
4172   Animation animation = Animation::New(durationSeconds);
4173   Vector3 targetValue(60.0f, 60.0f, 60.0f);
4174   Vector3 relativeValue(targetValue - startValue);
4175   animation.AnimateBy(Property(actor, index), relativeValue);
4176
4177   Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4178
4179   // Start the animation
4180   animation.Play();
4181
4182   // Target value should be retrievable straight away
4183   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4184
4185   bool signalReceived(false);
4186   AnimationFinishCheck finishCheck(signalReceived);
4187   animation.FinishedSignal().Connect(&application, finishCheck);
4188
4189   application.SendNotification();
4190   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4191
4192   // We didn't expect the animation to finish yet
4193   application.SendNotification();
4194   finishCheck.CheckSignalNotReceived();
4195   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
4196
4197   application.SendNotification();
4198   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4199
4200   // We did expect the animation to finish
4201   application.SendNotification();
4202   finishCheck.CheckSignalReceived();
4203   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4204
4205   // Check that nothing has changed after a couple of buffer swaps
4206   application.Render(0);
4207   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4208   application.Render(0);
4209   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4210   END_TEST;
4211 }
4212
4213 int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void)
4214 {
4215   TestApplication application;
4216
4217   Actor actor = Actor::New();
4218
4219   // Register a Vector3 property
4220   Vector3 startValue(100.0f, 100.0f, 100.0f);
4221   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4222   application.GetScene().Add(actor);
4223   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4224   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4225
4226   // Build the animation
4227   float durationSeconds(1.0f);
4228   Animation animation = Animation::New(durationSeconds);
4229   Vector3 targetValue(20.0f, 20.0f, 20.0f);
4230   Vector3 relativeValue(targetValue - startValue);
4231   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4232
4233   Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4234
4235   // Start the animation
4236   animation.Play();
4237
4238   bool signalReceived(false);
4239   AnimationFinishCheck finishCheck(signalReceived);
4240   animation.FinishedSignal().Connect(&application, finishCheck);
4241
4242   application.SendNotification();
4243   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4244
4245   // We didn't expect the animation to finish yet
4246   application.SendNotification();
4247   finishCheck.CheckSignalNotReceived();
4248
4249   // The position should have moved more, than with a linear alpha function
4250   Vector3 current(actor.GetCurrentProperty< Vector3 >( index ));
4251   DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
4252   DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
4253   DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
4254
4255   application.SendNotification();
4256   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4257
4258   // We did expect the animation to finish
4259   application.SendNotification();
4260   finishCheck.CheckSignalReceived();
4261   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4262
4263   // Check that nothing has changed after a couple of buffer swaps
4264   application.Render(0);
4265   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4266   application.Render(0);
4267   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4268   END_TEST;
4269 }
4270
4271 int UtcDaliAnimationAnimateByVector3TimePeriodP(void)
4272 {
4273   TestApplication application;
4274
4275   Actor actor = Actor::New();
4276
4277   // Register a Vector3 property
4278   Vector3 startValue(10.0f, 10.0f, 10.0f);
4279   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4280   application.GetScene().Add(actor);
4281   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4282   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4283
4284   // Build the animation
4285   float durationSeconds(1.0f);
4286   Animation animation = Animation::New(durationSeconds);
4287   Vector3 targetValue(30.0f, 30.0f, 30.0f);
4288   Vector3 relativeValue(targetValue - startValue);
4289   float delay = 0.5f;
4290   animation.AnimateBy(Property(actor, index),
4291                       relativeValue,
4292                       TimePeriod(delay, durationSeconds - delay));
4293
4294   // Start the animation
4295   animation.Play();
4296
4297   bool signalReceived(false);
4298   AnimationFinishCheck finishCheck(signalReceived);
4299   animation.FinishedSignal().Connect(&application, finishCheck);
4300
4301   application.SendNotification();
4302   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4303
4304   // We didn't expect the animation to finish yet
4305   application.SendNotification();
4306   finishCheck.CheckSignalNotReceived();
4307   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4308
4309   application.SendNotification();
4310   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4311
4312   // We didn't expect the animation to finish yet
4313   application.SendNotification();
4314   finishCheck.CheckSignalNotReceived();
4315   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4316
4317   application.SendNotification();
4318   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4319
4320   // We did expect the animation to finish
4321   application.SendNotification();
4322   finishCheck.CheckSignalReceived();
4323   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4324
4325   // Check that nothing has changed after a couple of buffer swaps
4326   application.Render(0);
4327   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4328   application.Render(0);
4329   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4330   END_TEST;
4331 }
4332
4333 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void)
4334 {
4335   TestApplication application;
4336
4337   Actor actor = Actor::New();
4338
4339   // Register a Vector3 property
4340   Vector3 startValue(5.0f, 5.0f, 5.0f);
4341   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4342   application.GetScene().Add(actor);
4343   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4344   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4345
4346   // Build the animation
4347   float durationSeconds(1.0f);
4348   Animation animation = Animation::New(durationSeconds);
4349   Vector3 targetValue(10.0f, 10.0f, 10.0f);
4350   Vector3 relativeValue(targetValue - startValue);
4351   float delay = 0.5f;
4352   animation.AnimateBy(Property(actor, index),
4353                       relativeValue,
4354                       AlphaFunction::LINEAR,
4355                       TimePeriod(delay, durationSeconds - delay));
4356
4357   // Start the animation
4358   animation.Play();
4359
4360   bool signalReceived(false);
4361   AnimationFinishCheck finishCheck(signalReceived);
4362   animation.FinishedSignal().Connect(&application, finishCheck);
4363
4364   application.SendNotification();
4365   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4366
4367   // We didn't expect the animation to finish yet
4368   application.SendNotification();
4369   finishCheck.CheckSignalNotReceived();
4370   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4371
4372   application.SendNotification();
4373   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4374
4375   // We didn't expect the animation to finish yet
4376   application.SendNotification();
4377   finishCheck.CheckSignalNotReceived();
4378   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4379
4380   application.SendNotification();
4381   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4382
4383   // We did expect the animation to finish
4384   application.SendNotification();
4385   finishCheck.CheckSignalReceived();
4386   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4387
4388   // Check that nothing has changed after a couple of buffer swaps
4389   application.Render(0);
4390   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4391   application.Render(0);
4392   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4393   END_TEST;
4394 }
4395
4396 int UtcDaliAnimationAnimateByVector4P(void)
4397 {
4398   TestApplication application;
4399
4400   Actor actor = Actor::New();
4401
4402   // Register a Vector4 property
4403   Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4404   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4405   application.GetScene().Add(actor);
4406   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4407   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4408
4409   // Build the animation
4410   float durationSeconds(2.0f);
4411   Animation animation = Animation::New(durationSeconds);
4412   Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f);
4413   Vector4 relativeValue(targetValue - startValue);
4414   animation.AnimateBy(Property(actor, index), relativeValue);
4415
4416   Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4417
4418   // Start the animation
4419   animation.Play();
4420
4421   // Target value should be retrievable straight away
4422   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4423
4424   bool signalReceived(false);
4425   AnimationFinishCheck finishCheck(signalReceived);
4426   animation.FinishedSignal().Connect(&application, finishCheck);
4427
4428   application.SendNotification();
4429   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4430
4431   // We didn't expect the animation to finish yet
4432   application.SendNotification();
4433   finishCheck.CheckSignalNotReceived();
4434   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
4435
4436   application.SendNotification();
4437   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4438
4439   // We did expect the animation to finish
4440   application.SendNotification();
4441   finishCheck.CheckSignalReceived();
4442   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4443
4444   // Check that nothing has changed after a couple of buffer swaps
4445   application.Render(0);
4446   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4447   application.Render(0);
4448   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4449   END_TEST;
4450 }
4451
4452 int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void)
4453 {
4454   TestApplication application;
4455
4456   Actor actor = Actor::New();
4457
4458   // Register a Vector4 property
4459   Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f);
4460   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4461   application.GetScene().Add(actor);
4462   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4463   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4464
4465   // Build the animation
4466   float durationSeconds(1.0f);
4467   Animation animation = Animation::New(durationSeconds);
4468   Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
4469   Vector4 relativeValue(targetValue - startValue);
4470   animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4471
4472   Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4473
4474   // Start the animation
4475   animation.Play();
4476
4477   bool signalReceived(false);
4478   AnimationFinishCheck finishCheck(signalReceived);
4479   animation.FinishedSignal().Connect(&application, finishCheck);
4480
4481   application.SendNotification();
4482   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4483
4484   // We didn't expect the animation to finish yet
4485   application.SendNotification();
4486   finishCheck.CheckSignalNotReceived();
4487
4488   // The position should have moved more, than with a linear alpha function
4489   Vector4 current( actor.GetCurrentProperty< Vector4 >( index ) );
4490   DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
4491   DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
4492   DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
4493   DALI_TEST_CHECK( current.w < ninetyFivePercentProgress.w );
4494
4495   application.SendNotification();
4496   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4497
4498   // We did expect the animation to finish
4499   application.SendNotification();
4500   finishCheck.CheckSignalReceived();
4501   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4502
4503   // Check that nothing has changed after a couple of buffer swaps
4504   application.Render(0);
4505   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4506   application.Render(0);
4507   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4508   END_TEST;
4509 }
4510
4511 int UtcDaliAnimationAnimateByVector4TimePeriodP(void)
4512 {
4513   TestApplication application;
4514
4515   Actor actor = Actor::New();
4516
4517   // Register a Vector4 property
4518   Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4519   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4520   application.GetScene().Add(actor);
4521   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4522   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4523
4524   // Build the animation
4525   float durationSeconds(1.0f);
4526   Animation animation = Animation::New(durationSeconds);
4527   Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
4528   Vector4 relativeValue(targetValue - startValue);
4529   float delay = 0.5f;
4530   animation.AnimateBy(Property(actor, index),
4531                       relativeValue,
4532                       TimePeriod(delay, durationSeconds - delay));
4533
4534   // Start the animation
4535   animation.Play();
4536
4537   bool signalReceived(false);
4538   AnimationFinishCheck finishCheck(signalReceived);
4539   animation.FinishedSignal().Connect(&application, finishCheck);
4540
4541   application.SendNotification();
4542   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4543
4544   // We didn't expect the animation to finish yet
4545   application.SendNotification();
4546   finishCheck.CheckSignalNotReceived();
4547   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4548
4549   application.SendNotification();
4550   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4551
4552   // We didn't expect the animation to finish yet
4553   application.SendNotification();
4554   finishCheck.CheckSignalNotReceived();
4555   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4556
4557   application.SendNotification();
4558   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4559
4560   // We did expect the animation to finish
4561   application.SendNotification();
4562   finishCheck.CheckSignalReceived();
4563   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4564
4565   // Check that nothing has changed after a couple of buffer swaps
4566   application.Render(0);
4567   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4568   application.Render(0);
4569   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4570   END_TEST;
4571 }
4572
4573 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void)
4574 {
4575   TestApplication application;
4576
4577   Actor actor = Actor::New();
4578
4579   // Register a Vector4 property
4580   Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f);
4581   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
4582   application.GetScene().Add(actor);
4583   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4584   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4585
4586   // Build the animation
4587   float durationSeconds(1.0f);
4588   Animation animation = Animation::New(durationSeconds);
4589   Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f);
4590   Vector4 relativeValue(targetValue - startValue);
4591   float delay = 0.5f;
4592   animation.AnimateBy(Property(actor, index),
4593                       relativeValue,
4594                       AlphaFunction::LINEAR,
4595                       TimePeriod(delay, durationSeconds - delay));
4596
4597   // Start the animation
4598   animation.Play();
4599
4600   bool signalReceived(false);
4601   AnimationFinishCheck finishCheck(signalReceived);
4602   animation.FinishedSignal().Connect(&application, finishCheck);
4603
4604   application.SendNotification();
4605   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4606
4607   // We didn't expect the animation to finish yet
4608   application.SendNotification();
4609   finishCheck.CheckSignalNotReceived();
4610   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4611
4612   application.SendNotification();
4613   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4614
4615   // We didn't expect the animation to finish yet
4616   application.SendNotification();
4617   finishCheck.CheckSignalNotReceived();
4618   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4619
4620   application.SendNotification();
4621   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4622
4623   // We did expect the animation to finish
4624   application.SendNotification();
4625   finishCheck.CheckSignalReceived();
4626   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4627
4628   // Check that nothing has changed after a couple of buffer swaps
4629   application.Render(0);
4630   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4631   application.Render(0);
4632   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4633   END_TEST;
4634 }
4635
4636 int UtcDaliAnimationAnimateByActorPositionP(void)
4637 {
4638   TestApplication application;
4639
4640   Actor actor = Actor::New();
4641   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4642   actor.SetProperty( Actor::Property::POSITION, startPosition );
4643   application.GetScene().Add(actor);
4644   application.SendNotification();
4645   application.Render(0);
4646   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), startPosition, TEST_LOCATION );
4647
4648   // Build the animation
4649   float durationSeconds(1.0f);
4650   Animation animation = Animation::New(durationSeconds);
4651   Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4652   Vector3 relativePosition(targetPosition - startPosition);
4653   animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition);
4654
4655   Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4656
4657   // Start the animation
4658   animation.Play();
4659
4660   // Target value should be retrievable straight away
4661   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4662
4663   bool signalReceived(false);
4664   AnimationFinishCheck finishCheck(signalReceived);
4665   animation.FinishedSignal().Connect(&application, finishCheck);
4666
4667   application.SendNotification();
4668   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4669
4670   // We didn't expect the animation to finish yet
4671   application.SendNotification();
4672   finishCheck.CheckSignalNotReceived();
4673   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ninetyFivePercentProgress, TEST_LOCATION );
4674
4675   application.SendNotification();
4676   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4677
4678   // We did expect the animation to finish
4679   application.SendNotification();
4680   finishCheck.CheckSignalReceived();
4681   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4682
4683   // Check that nothing has changed after a couple of buffer swaps
4684   application.Render(0);
4685   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4686   application.Render(0);
4687   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4688   END_TEST;
4689 }
4690
4691 int UtcDaliAnimationAnimateByActorPositionComponentsP(void)
4692 {
4693   TestApplication application;
4694
4695   Actor actor = Actor::New();
4696   application.GetScene().Add(actor);
4697   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
4698
4699   // Build the animation
4700   float durationSeconds(1.0f);
4701   Animation animation = Animation::New(durationSeconds);
4702   Vector3 targetPosition(200.0f, 300.0f, 400.0f);
4703   Vector3 relativePosition(targetPosition - Vector3::ZERO);
4704   animation.AnimateBy( Property( actor, Actor::Property::POSITION_X ), relativePosition.x );
4705   animation.AnimateBy( Property( actor, Actor::Property::POSITION_Y ), relativePosition.y );
4706   animation.AnimateBy( Property( actor, Actor::Property::POSITION_Z ), relativePosition.z );
4707
4708   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
4709   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
4710
4711   // Start the animation
4712   animation.Play();
4713
4714   // Target value should be retrievable straight away
4715   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4716   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetPosition.x, TEST_LOCATION );
4717   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetPosition.y, TEST_LOCATION );
4718   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetPosition.z, TEST_LOCATION );
4719
4720   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); // Not changed yet
4721
4722   application.SendNotification();
4723   application.Render( 1000 ); // 1 second progress
4724
4725   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4726
4727   END_TEST;
4728 }
4729
4730 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
4731 {
4732   TestApplication application;
4733
4734   Actor actor = Actor::New();
4735   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4736   actor.SetProperty( Actor::Property::POSITION, startPosition );
4737   application.GetScene().Add(actor);
4738   application.SendNotification();
4739   application.Render(0);
4740   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), startPosition, TEST_LOCATION );
4741
4742   // Build the animation
4743   float durationSeconds(1.0f);
4744   Animation animation = Animation::New(durationSeconds);
4745   Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4746   Vector3 relativePosition(targetPosition - startPosition);
4747   animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
4748
4749   Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4750
4751   // Start the animation
4752   animation.Play();
4753
4754   bool signalReceived(false);
4755   AnimationFinishCheck finishCheck(signalReceived);
4756   animation.FinishedSignal().Connect(&application, finishCheck);
4757
4758   application.SendNotification();
4759   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4760
4761   // We didn't expect the animation to finish yet
4762   application.SendNotification();
4763   finishCheck.CheckSignalNotReceived();
4764
4765   // The position should have moved more, than with a linear alpha function
4766   Vector3 current(actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
4767   DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
4768   DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
4769   DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
4770
4771   application.SendNotification();
4772   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4773
4774   // We did expect the animation to finish
4775   application.SendNotification();
4776   finishCheck.CheckSignalReceived();
4777   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4778
4779   // Check that nothing has changed after a couple of buffer swaps
4780   application.Render(0);
4781   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4782   application.Render(0);
4783   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4784   END_TEST;
4785 }
4786
4787 int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void)
4788 {
4789   TestApplication application;
4790
4791   Actor actor = Actor::New();
4792   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4793   actor.SetProperty( Actor::Property::POSITION, startPosition );
4794   application.GetScene().Add(actor);
4795   application.SendNotification();
4796   application.Render(0);
4797   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), startPosition, TEST_LOCATION );
4798
4799   // Build the animation
4800   float durationSeconds(1.0f);
4801   Animation animation = Animation::New(durationSeconds);
4802   Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4803   Vector3 relativePosition(targetPosition - startPosition);
4804   float delay = 0.5f;
4805   animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4806                       relativePosition,
4807                       TimePeriod(delay, durationSeconds - delay));
4808
4809   Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4810
4811   // Start the animation
4812   animation.Play();
4813
4814   bool signalReceived(false);
4815   AnimationFinishCheck finishCheck(signalReceived);
4816   animation.FinishedSignal().Connect(&application, finishCheck);
4817
4818   application.SendNotification();
4819   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4820
4821   // We didn't expect the animation to finish yet
4822   application.SendNotification();
4823   finishCheck.CheckSignalNotReceived();
4824   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), startPosition, TEST_LOCATION );
4825
4826   application.SendNotification();
4827   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4828
4829   // We did expect the animation to finish
4830   application.SendNotification();
4831   finishCheck.CheckSignalReceived();
4832   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4833
4834   // Check that nothing has changed after a couple of buffer swaps
4835   application.Render(0);
4836   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4837   application.Render(0);
4838   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4839   END_TEST;
4840 }
4841
4842 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void)
4843 {
4844   TestApplication application;
4845
4846   Actor actor = Actor::New();
4847   Vector3 startPosition(10.0f, 10.0f, 10.0f);
4848   actor.SetProperty( Actor::Property::POSITION, startPosition );
4849   application.GetScene().Add(actor);
4850   application.SendNotification();
4851   application.Render(0);
4852   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), startPosition, TEST_LOCATION );
4853
4854   // Build the animation
4855   float durationSeconds(1.0f);
4856   Animation animation = Animation::New(durationSeconds);
4857   Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4858   Vector3 relativePosition(targetPosition - startPosition);
4859   float delay = 0.5f;
4860   animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4861                       relativePosition,
4862                       AlphaFunction::LINEAR,
4863                       TimePeriod(delay, durationSeconds - delay));
4864
4865   Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4866
4867   // Start the animation
4868   animation.Play();
4869
4870   bool signalReceived(false);
4871   AnimationFinishCheck finishCheck(signalReceived);
4872   animation.FinishedSignal().Connect(&application, finishCheck);
4873
4874   application.SendNotification();
4875   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4876
4877   // We didn't expect the animation to finish yet
4878   application.SendNotification();
4879   finishCheck.CheckSignalNotReceived();
4880   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), startPosition, TEST_LOCATION );
4881
4882   application.SendNotification();
4883   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4884
4885   // We did expect the animation to finish
4886   application.SendNotification();
4887   finishCheck.CheckSignalReceived();
4888   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4889
4890   // Check that nothing has changed after a couple of buffer swaps
4891   application.Render(0);
4892   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4893   application.Render(0);
4894   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4895   END_TEST;
4896 }
4897
4898 int UtcDaliAnimationAnimateByActorOrientationP1(void)
4899 {
4900   TestApplication application;
4901
4902   Actor actor = Actor::New();
4903   actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4904   application.GetScene().Add(actor);
4905   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4906
4907   // Build the animation
4908   float durationSeconds(1.0f);
4909   Animation animation = Animation::New(durationSeconds);
4910   Degree relativeRotationDegrees(360.0f);
4911   Radian relativeRotationRadians(relativeRotationDegrees);
4912   animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ) );
4913
4914   // Start the animation
4915   animation.Play();
4916
4917   // Target value should be retrievable straight away
4918   DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::YAXIS), TEST_LOCATION );
4919
4920   bool signalReceived(false);
4921   AnimationFinishCheck finishCheck(signalReceived);
4922   animation.FinishedSignal().Connect(&application, finishCheck);
4923
4924   application.SendNotification();
4925   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4926
4927   // We didn't expect the animation to finish yet
4928   application.SendNotification();
4929   finishCheck.CheckSignalNotReceived();
4930   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4931
4932   application.SendNotification();
4933   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4934
4935   // We didn't expect the animation to finish yet
4936   application.SendNotification();
4937   finishCheck.CheckSignalNotReceived();
4938   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4939
4940   application.SendNotification();
4941   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4942
4943   // We didn't expect the animation to finish yet
4944   application.SendNotification();
4945   finishCheck.CheckSignalNotReceived();
4946   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4947
4948   application.SendNotification();
4949   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4950
4951   // We did expect the animation to finish
4952   application.SendNotification();
4953   finishCheck.CheckSignalReceived();
4954   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4955   END_TEST;
4956 }
4957
4958 int UtcDaliAnimationAnimateByActorOrientationP2(void)
4959 {
4960   TestApplication application;
4961
4962   tet_printf("Testing that rotation angle > 360 performs full rotations\n");
4963
4964   Actor actor = Actor::New();
4965   actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
4966   application.GetScene().Add(actor);
4967   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4968
4969   // Build the animation
4970   float durationSeconds(1.0f);
4971   Animation animation = Animation::New(durationSeconds);
4972   Degree relativeRotationDegrees(710.0f);
4973   Radian relativeRotationRadians(relativeRotationDegrees);
4974
4975   animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), AngleAxis( relativeRotationRadians, Vector3::ZAXIS ) );
4976
4977   // Start the animation
4978   animation.Play();
4979
4980   bool signalReceived(false);
4981   AnimationFinishCheck finishCheck(signalReceived);
4982   animation.FinishedSignal().Connect(&application, finishCheck);
4983
4984   application.SendNotification();
4985   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4986
4987   // We didn't expect the animation to finish yet
4988   application.SendNotification();
4989   finishCheck.CheckSignalNotReceived();
4990   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4991
4992   application.SendNotification();
4993   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4994
4995   // We didn't expect the animation to finish yet
4996   application.SendNotification();
4997   finishCheck.CheckSignalNotReceived();
4998   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4999
5000   application.SendNotification();
5001   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
5002
5003   // We didn't expect the animation to finish yet
5004   application.SendNotification();
5005   finishCheck.CheckSignalNotReceived();
5006   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
5007
5008   application.SendNotification();
5009   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5010
5011   // We did expect the animation to finish
5012   application.SendNotification();
5013   finishCheck.CheckSignalReceived();
5014   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
5015   END_TEST;
5016 }
5017
5018
5019 int UtcDaliAnimationAnimateByActorOrientationP3(void)
5020 {
5021   TestApplication application;
5022
5023   tet_printf("Testing that rotation angle > 360 performs partial rotations when cast to Quaternion\n");
5024
5025   Actor actor = Actor::New();
5026   actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
5027   application.GetScene().Add(actor);
5028   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
5029
5030   // Build the animation
5031   float durationSeconds(1.0f);
5032   Animation animation = Animation::New(durationSeconds);
5033   Degree relativeRotationDegrees(730.0f);
5034   Radian relativeRotationRadians(relativeRotationDegrees);
5035
5036   Radian actualRotationRadians( Degree(10.0f) );
5037
5038   animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::ZAXIS ) );
5039
5040   // Start the animation
5041   animation.Play();
5042
5043   bool signalReceived(false);
5044   AnimationFinishCheck finishCheck(signalReceived);
5045   animation.FinishedSignal().Connect(&application, finishCheck);
5046
5047   application.SendNotification();
5048   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
5049
5050   // We didn't expect the animation to finish yet
5051   application.SendNotification();
5052   finishCheck.CheckSignalNotReceived();
5053   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(actualRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
5054
5055   application.SendNotification();
5056   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
5057
5058   // We didn't expect the animation to finish yet
5059   application.SendNotification();
5060   finishCheck.CheckSignalNotReceived();
5061   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(actualRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
5062
5063   application.SendNotification();
5064   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
5065
5066   // We didn't expect the animation to finish yet
5067   application.SendNotification();
5068   finishCheck.CheckSignalNotReceived();
5069   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(actualRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
5070
5071   application.SendNotification();
5072   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5073
5074   // We did expect the animation to finish
5075   application.SendNotification();
5076   finishCheck.CheckSignalReceived();
5077   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(actualRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
5078   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
5079   END_TEST;
5080 }
5081
5082
5083 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
5084 {
5085   TestApplication application;
5086
5087   Actor actor = Actor::New();
5088   actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
5089   application.GetScene().Add(actor);
5090   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
5091
5092   // Build the animation
5093   float durationSeconds(1.0f);
5094   Animation animation = Animation::New(durationSeconds);
5095   Degree relativeRotationDegrees(360.0f);
5096   Radian relativeRotationRadians(relativeRotationDegrees);
5097   animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ), AlphaFunction::EASE_IN );
5098
5099   // Start the animation
5100   animation.Play();
5101
5102   bool signalReceived(false);
5103   AnimationFinishCheck finishCheck(signalReceived);
5104   animation.FinishedSignal().Connect(&application, finishCheck);
5105
5106   application.SendNotification();
5107   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
5108
5109   // We didn't expect the animation to finish yet
5110   application.SendNotification();
5111   finishCheck.CheckSignalNotReceived();
5112   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5113
5114   application.SendNotification();
5115   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
5116
5117   // We didn't expect the animation to finish yet
5118   application.SendNotification();
5119   finishCheck.CheckSignalNotReceived();
5120   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5121
5122   application.SendNotification();
5123   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
5124
5125   // We didn't expect the animation to finish yet
5126   application.SendNotification();
5127   finishCheck.CheckSignalNotReceived();
5128   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5129
5130   application.SendNotification();
5131   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5132
5133   // We did expect the animation to finish
5134   application.SendNotification();
5135   finishCheck.CheckSignalReceived();
5136   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5137   END_TEST;
5138 }
5139
5140 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void)
5141 {
5142   TestApplication application;
5143
5144   Actor actor = Actor::New();
5145   actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
5146   application.GetScene().Add(actor);
5147   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
5148
5149   // Build the animation
5150   float durationSeconds(1.0f);
5151   Animation animation = Animation::New(durationSeconds);
5152   Degree relativeRotationDegrees(360.0f);
5153   Radian relativeRotationRadians(relativeRotationDegrees);
5154   float delay = 0.3f;
5155   animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ),
5156                        AlphaFunction::EASE_IN, TimePeriod( delay, durationSeconds - delay ) );
5157
5158   // Start the animation
5159   animation.Play();
5160
5161   bool signalReceived(false);
5162   AnimationFinishCheck finishCheck(signalReceived);
5163   animation.FinishedSignal().Connect(&application, finishCheck);
5164
5165   application.SendNotification();
5166   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
5167
5168   // We didn't expect the animation to finish yet
5169   application.SendNotification();
5170   finishCheck.CheckSignalNotReceived();
5171   float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
5172   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5173
5174   application.SendNotification();
5175   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
5176
5177   // We didn't expect the animation to finish yet
5178   application.SendNotification();
5179   finishCheck.CheckSignalNotReceived();
5180   progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
5181   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5182
5183   application.SendNotification();
5184   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
5185
5186   // We didn't expect the animation to finish yet
5187   application.SendNotification();
5188   finishCheck.CheckSignalNotReceived();
5189   progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
5190   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5191
5192   application.SendNotification();
5193   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5194
5195   // We did expect the animation to finish
5196   application.SendNotification();
5197   finishCheck.CheckSignalReceived();
5198   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5199   END_TEST;
5200 }
5201
5202 int UtcDaliAnimationAnimateByActorScaleP(void)
5203 {
5204   TestApplication application;
5205
5206   Actor actor = Actor::New();
5207   application.GetScene().Add(actor);
5208   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
5209
5210   // Build the animation
5211   float durationSeconds(1.0f);
5212   Animation animation = Animation::New(durationSeconds);
5213   Vector3 targetScale(2.0f, 2.0f, 2.0f);
5214   Vector3 relativeScale(targetScale - Vector3::ONE);
5215   animation.AnimateBy( Property( actor, Actor::Property::SCALE ), Vector3( relativeScale.x, relativeScale.y, relativeScale.z ) );
5216
5217   Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale*0.99f);
5218
5219   // Start the animation
5220   animation.Play();
5221
5222   // Target value should be retrievable straight away
5223   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
5224
5225   bool signalReceived(false);
5226   AnimationFinishCheck finishCheck(signalReceived);
5227   animation.FinishedSignal().Connect(&application, finishCheck);
5228
5229   application.SendNotification();
5230   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
5231
5232   // We didn't expect the animation to finish yet
5233   application.SendNotification();
5234   finishCheck.CheckSignalNotReceived();
5235   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), ninetyNinePercentProgress, TEST_LOCATION );
5236
5237   application.SendNotification();
5238   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
5239
5240   // We did expect the animation to finish
5241   application.SendNotification();
5242   finishCheck.CheckSignalReceived();
5243   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
5244
5245   // Reset everything
5246   finishCheck.Reset();
5247   actor.SetProperty( Actor::Property::SCALE,Vector3::ONE);
5248   application.SendNotification();
5249   application.Render(0);
5250   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
5251
5252   // Repeat with a different (ease-in) alpha function
5253   animation = Animation::New(durationSeconds);
5254   animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::EASE_IN );
5255   animation.FinishedSignal().Connect(&application, finishCheck);
5256   animation.Play();
5257
5258   application.SendNotification();
5259   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
5260
5261   // We didn't expect the animation to finish yet
5262   application.SendNotification();
5263   finishCheck.CheckSignalNotReceived();
5264
5265   // The scale should have grown less, than with a linear alpha function
5266   Vector3 current(actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ));
5267   DALI_TEST_CHECK( current.x > 1.0f );
5268   DALI_TEST_CHECK( current.y > 1.0f );
5269   DALI_TEST_CHECK( current.z > 1.0f );
5270   DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
5271   DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
5272   DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
5273
5274   application.SendNotification();
5275   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
5276
5277   // We did expect the animation to finish
5278   application.SendNotification();
5279   finishCheck.CheckSignalReceived();
5280   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
5281
5282   // Reset everything
5283   finishCheck.Reset();
5284   actor.SetProperty( Actor::Property::SCALE,Vector3::ONE);
5285   application.SendNotification();
5286   application.Render(0);
5287   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
5288
5289   // Repeat with a delay
5290   float delay = 0.5f;
5291   animation = Animation::New(durationSeconds);
5292   animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
5293   animation.FinishedSignal().Connect(&application, finishCheck);
5294   animation.Play();
5295
5296   application.SendNotification();
5297   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5298
5299   // We didn't expect the animation to finish yet
5300   application.SendNotification();
5301   finishCheck.CheckSignalNotReceived();
5302   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
5303
5304   application.SendNotification();
5305   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5306
5307   // We did expect the animation to finish
5308   application.SendNotification();
5309   finishCheck.CheckSignalReceived();
5310   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
5311   END_TEST;
5312 }
5313
5314 int UtcDaliAnimationAnimateByActorScaleComponentsP(void)
5315 {
5316   TestApplication application;
5317
5318   Actor actor = Actor::New();
5319   application.GetScene().Add(actor);
5320   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
5321
5322   // Build the animation
5323   float durationSeconds(1.0f);
5324   Animation animation = Animation::New(durationSeconds);
5325   Vector3 targetScale(2.0f, 3.0f, 4.0f);
5326   Vector3 relativeScale(targetScale - Vector3::ONE);
5327   animation.AnimateBy( Property( actor, Actor::Property::SCALE_X ), relativeScale.x );
5328   animation.AnimateBy( Property( actor, Actor::Property::SCALE_Y ), relativeScale.y );
5329   animation.AnimateBy( Property( actor, Actor::Property::SCALE_Z ), relativeScale.z );
5330
5331   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
5332   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
5333
5334   // Start the animation
5335   animation.Play();
5336
5337   // Target value should be retrievable straight away
5338   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
5339   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetScale.x, TEST_LOCATION );
5340   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetScale.y, TEST_LOCATION );
5341   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetScale.z, TEST_LOCATION );
5342
5343   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION ); // Not changed yet
5344
5345   application.SendNotification();
5346   application.Render( 1000 ); // 1 second progress
5347
5348   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
5349
5350   END_TEST;
5351 }
5352
5353 int UtcDaliAnimationAnimateByActorColorP(void)
5354 {
5355   TestApplication application;
5356
5357   Actor actor = Actor::New();
5358   application.GetScene().Add(actor);
5359   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
5360
5361   // Build the animation
5362   float durationSeconds(1.0f);
5363   Animation animation = Animation::New(durationSeconds);
5364   Vector4 targetColor( 0.5f, 0.75f, 0.8f, 0.1f );
5365   Vector4 relativeColor( targetColor - Color::WHITE );
5366   animation.AnimateBy( Property( actor, Actor::Property::COLOR ), relativeColor );
5367
5368   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
5369   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
5370
5371   // Start the animation
5372   animation.Play();
5373
5374   // Target value should be retrievable straight away
5375   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
5376   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
5377   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
5378   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
5379   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
5380
5381   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION ); // Not changed yet
5382
5383   application.SendNotification();
5384   application.Render( 1000 ); // 1 second progress
5385
5386   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
5387
5388   END_TEST;
5389 }
5390
5391 int UtcDaliAnimationAnimateByActorColorComponentsP(void)
5392 {
5393   TestApplication application;
5394
5395   Actor actor = Actor::New();
5396   application.GetScene().Add(actor);
5397   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
5398
5399   // Build the animation
5400   float durationSeconds(1.0f);
5401   Animation animation = Animation::New(durationSeconds);
5402   Vector4 targetColor( 0.5f, 0.75f, 0.8f, 0.1f );
5403   Vector4 relativeColor( targetColor - Color::WHITE );
5404   animation.AnimateBy( Property( actor, Actor::Property::COLOR_RED ), relativeColor.r );
5405   animation.AnimateBy( Property( actor, Actor::Property::COLOR_GREEN ), relativeColor.g );
5406   animation.AnimateBy( Property( actor, Actor::Property::COLOR_BLUE ), relativeColor.b );
5407   animation.AnimateBy( Property( actor, Actor::Property::COLOR_ALPHA ), relativeColor.a );
5408
5409   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
5410   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
5411
5412   // Start the animation
5413   animation.Play();
5414
5415   // Target value should be retrievable straight away
5416   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
5417   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
5418   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
5419   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
5420   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
5421
5422   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION ); // Not changed yet
5423
5424   application.SendNotification();
5425   application.Render( 1000 ); // 1 second progress
5426
5427   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
5428
5429   END_TEST;
5430 }
5431
5432 int UtcDaliAnimationAnimateByActorSizeP(void)
5433 {
5434   TestApplication application;
5435
5436   Actor actor = Actor::New();
5437   application.GetScene().Add(actor);
5438   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
5439
5440   // Build the animation
5441   float durationSeconds(1.0f);
5442   Animation animation = Animation::New(durationSeconds);
5443   Vector3 targetSize( 100.0f, 200.0f, 300.0f );
5444   Vector3 relativeSize( targetSize - Vector3::ZERO );
5445   animation.AnimateBy( Property( actor, Actor::Property::SIZE ), relativeSize );
5446
5447   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
5448   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
5449
5450   // Start the animation
5451   animation.Play();
5452
5453   // Target value should be retrievable straight away
5454   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
5455   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
5456   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
5457   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
5458
5459   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); // Not changed yet
5460
5461   application.SendNotification();
5462   application.Render( 1000 ); // 1 second progress
5463
5464   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
5465
5466   END_TEST;
5467 }
5468
5469 int UtcDaliAnimationAnimateByActorSizeComponentsP(void)
5470 {
5471   TestApplication application;
5472
5473   Actor actor = Actor::New();
5474   application.GetScene().Add(actor);
5475   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
5476
5477   // Build the animation
5478   float durationSeconds(1.0f);
5479   Animation animation = Animation::New(durationSeconds);
5480   Vector3 targetSize( 100.0f, 200.0f, 300.0f );
5481   Vector3 relativeSize( targetSize - Vector3::ZERO );
5482   animation.AnimateBy( Property( actor, Actor::Property::SIZE_WIDTH ), relativeSize.width );
5483   animation.AnimateBy( Property( actor, Actor::Property::SIZE_HEIGHT ), relativeSize.height );
5484   animation.AnimateBy( Property( actor, Actor::Property::SIZE_DEPTH ), relativeSize.depth );
5485
5486   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
5487   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
5488
5489   // Start the animation
5490   animation.Play();
5491
5492   // Target value should be retrievable straight away
5493   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
5494   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
5495   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
5496   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
5497
5498   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); // Not changed yet
5499
5500   application.SendNotification();
5501   application.Render( 1000 ); // 1 second progress
5502
5503   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
5504
5505   END_TEST;
5506 }
5507
5508 int UtcDaliAnimationAnimateByActorVisibilityP(void)
5509 {
5510   TestApplication application;
5511
5512   Actor actor = Actor::New();
5513   application.GetScene().Add(actor);
5514   DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
5515
5516   actor.SetProperty( Actor::Property::VISIBLE, false );
5517
5518   application.SendNotification();
5519   application.Render();
5520
5521   DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION );
5522
5523   // Build the animation
5524   float durationSeconds(1.0f);
5525   Animation animation = Animation::New(durationSeconds);
5526   bool targetVisibility( true );
5527   bool relativeVisibility( targetVisibility );
5528   animation.AnimateBy( Property( actor, Actor::Property::VISIBLE ), relativeVisibility );
5529
5530   DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION );
5531
5532   // Start the animation
5533   animation.Play();
5534
5535   // Target value should be retrievable straight away
5536   DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), targetVisibility, TEST_LOCATION );
5537   DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION ); // Not changed yet
5538
5539   application.SendNotification();
5540   application.Render( 1000 ); // 1 second progress
5541
5542   DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
5543
5544   END_TEST;
5545 }
5546
5547 int UtcDaliAnimationAnimateToBooleanP(void)
5548 {
5549   TestApplication application;
5550
5551   Actor actor = Actor::New();
5552
5553   // Register a boolean property
5554   const bool startValue(false);
5555   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5556   application.GetScene().Add(actor);
5557   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5558   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5559
5560   // Build the animation
5561   float durationSeconds(2.0f);
5562   Animation animation = Animation::New(durationSeconds);
5563   const bool targetValue( !startValue );
5564   animation.AnimateTo(Property(actor, index), targetValue);
5565
5566   // Start the animation
5567   animation.Play();
5568
5569   bool signalReceived(false);
5570   AnimationFinishCheck finishCheck(signalReceived);
5571   animation.FinishedSignal().Connect(&application, finishCheck);
5572
5573   application.SendNotification();
5574   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5575
5576   // We didn't expect the animation to finish yet
5577   application.SendNotification();
5578   finishCheck.CheckSignalNotReceived();
5579   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5580
5581   application.SendNotification();
5582   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5583
5584   // We did expect the animation to finish
5585   application.SendNotification();
5586   finishCheck.CheckSignalReceived();
5587   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5588
5589   // Check that nothing has changed after a couple of buffer swaps
5590   application.Render(0);
5591   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5592   application.Render(0);
5593   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5594
5595   // Repeat with target value "false"
5596   animation = Animation::New(durationSeconds);
5597   const bool finalValue( !targetValue );
5598   animation.AnimateTo(Property(actor, index), finalValue);
5599
5600   // Start the animation
5601   animation.Play();
5602
5603   finishCheck.Reset();
5604   animation.FinishedSignal().Connect(&application, finishCheck);
5605
5606   application.SendNotification();
5607   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5608
5609   // We didn't expect the animation to finish yet
5610   application.SendNotification();
5611   finishCheck.CheckSignalNotReceived();
5612   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5613
5614   application.SendNotification();
5615   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5616
5617   // We did expect the animation to finish
5618   application.SendNotification();
5619   finishCheck.CheckSignalReceived();
5620   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5621
5622   // Check that nothing has changed after a couple of buffer swaps
5623   application.Render(0);
5624   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5625   application.Render(0);
5626   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5627   END_TEST;
5628 }
5629
5630 int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void)
5631 {
5632   TestApplication application;
5633
5634   Actor actor = Actor::New();
5635
5636   // Register a boolean property
5637   const bool startValue(false);
5638   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5639   application.GetScene().Add(actor);
5640   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5641   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5642
5643   // Build the animation
5644   float durationSeconds(2.0f);
5645   Animation animation = Animation::New(durationSeconds);
5646   const bool targetValue( !startValue );
5647   animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
5648
5649   // Start the animation
5650   animation.Play();
5651
5652   bool signalReceived(false);
5653   AnimationFinishCheck finishCheck(signalReceived);
5654   animation.FinishedSignal().Connect(&application, finishCheck);
5655
5656   application.SendNotification();
5657   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5658
5659   // We didn't expect the animation to finish yet
5660   application.SendNotification();
5661   finishCheck.CheckSignalNotReceived();
5662   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5663
5664   application.SendNotification();
5665   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5666
5667   // We did expect the animation to finish
5668   application.SendNotification();
5669   finishCheck.CheckSignalReceived();
5670   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5671
5672   // Check that nothing has changed after a couple of buffer swaps
5673   application.Render(0);
5674   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5675   application.Render(0);
5676   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5677
5678   // Repeat with target value "false"
5679   animation = Animation::New(durationSeconds);
5680   const bool finalValue( !targetValue );
5681   animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
5682
5683   // Start the animation
5684   animation.Play();
5685
5686   finishCheck.Reset();
5687   animation.FinishedSignal().Connect(&application, finishCheck);
5688
5689   application.SendNotification();
5690   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5691
5692   // We didn't expect the animation to finish yet
5693   application.SendNotification();
5694   finishCheck.CheckSignalNotReceived();
5695   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5696
5697   application.SendNotification();
5698   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5699
5700   // We did expect the animation to finish
5701   application.SendNotification();
5702   finishCheck.CheckSignalReceived();
5703   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5704
5705   // Check that nothing has changed after a couple of buffer swaps
5706   application.Render(0);
5707   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5708   application.Render(0);
5709   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5710   END_TEST;
5711 }
5712
5713 int UtcDaliAnimationAnimateToBooleanTimePeriodP(void)
5714 {
5715   TestApplication application;
5716
5717   Actor actor = Actor::New();
5718
5719   // Register a boolean property
5720   bool startValue(false);
5721   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5722   application.GetScene().Add(actor);
5723   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5724   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5725
5726   // Build the animation
5727   float durationSeconds(2.0f);
5728   Animation animation = Animation::New(durationSeconds);
5729   bool finalValue( !startValue );
5730   float animatorDurationSeconds(durationSeconds * 0.5f);
5731   animation.AnimateTo( Property(actor, index),
5732                        finalValue,
5733                        TimePeriod( animatorDurationSeconds ) );
5734
5735   // Start the animation
5736   animation.Play();
5737
5738   bool signalReceived(false);
5739   AnimationFinishCheck finishCheck(signalReceived);
5740   animation.FinishedSignal().Connect(&application, finishCheck);
5741
5742   application.SendNotification();
5743   application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5744
5745   // We didn't expect the animation to finish yet
5746   application.SendNotification();
5747   finishCheck.CheckSignalNotReceived();
5748   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5749
5750   application.SendNotification();
5751   application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5752
5753   // We didn't expect the animation to finish yet...
5754   application.SendNotification();
5755   finishCheck.CheckSignalNotReceived();
5756
5757   // ...however we should have reached the final value
5758   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5759
5760   application.SendNotification();
5761   application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5762
5763   // We did expect the animation to finish
5764   application.SendNotification();
5765   finishCheck.CheckSignalReceived();
5766   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5767
5768   // Check that nothing has changed after a couple of buffer swaps
5769   application.Render(0);
5770   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5771   application.Render(0);
5772   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5773   END_TEST;
5774 }
5775
5776 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void)
5777 {
5778   TestApplication application;
5779
5780   Actor actor = Actor::New();
5781
5782   // Register a boolean property
5783   bool startValue(false);
5784   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5785   application.GetScene().Add(actor);
5786   DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5787   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5788
5789   // Build the animation
5790   float durationSeconds(2.0f);
5791   Animation animation = Animation::New(durationSeconds);
5792   bool finalValue( !startValue );
5793   float animatorDurationSeconds(durationSeconds * 0.5f);
5794   animation.AnimateTo( Property(actor, index),
5795                        finalValue,
5796                        AlphaFunction::LINEAR,
5797                        TimePeriod( animatorDurationSeconds ) );
5798
5799   // Start the animation
5800   animation.Play();
5801
5802   bool signalReceived(false);
5803   AnimationFinishCheck finishCheck(signalReceived);
5804   animation.FinishedSignal().Connect(&application, finishCheck);
5805
5806   application.SendNotification();
5807   application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5808
5809   // We didn't expect the animation to finish yet
5810   application.SendNotification();
5811   finishCheck.CheckSignalNotReceived();
5812   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5813
5814   application.SendNotification();
5815   application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5816
5817   // We didn't expect the animation to finish yet...
5818   application.SendNotification();
5819   finishCheck.CheckSignalNotReceived();
5820
5821   // ...however we should have reached the final value
5822   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5823
5824   application.SendNotification();
5825   application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5826
5827   // We did expect the animation to finish
5828   application.SendNotification();
5829   finishCheck.CheckSignalReceived();
5830   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5831
5832   // Check that nothing has changed after a couple of buffer swaps
5833   application.Render(0);
5834   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5835   application.Render(0);
5836   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5837   END_TEST;
5838 }
5839
5840 int UtcDaliAnimationAnimateToFloatP(void)
5841 {
5842   TestApplication application;
5843
5844   Actor actor = Actor::New();
5845
5846   // Register a float property
5847   float startValue(10.0f);
5848   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5849   application.GetScene().Add(actor);
5850   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5851   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5852
5853   // Build the animation
5854   float durationSeconds(2.0f);
5855   Animation animation = Animation::New(durationSeconds);
5856   float targetValue(50.0f);
5857   float relativeValue(targetValue - startValue);
5858   animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5859
5860   float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5861
5862   // Start the animation
5863   animation.Play();
5864
5865   bool signalReceived(false);
5866   AnimationFinishCheck finishCheck(signalReceived);
5867   animation.FinishedSignal().Connect(&application, finishCheck);
5868
5869   application.SendNotification();
5870   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5871
5872   // We didn't expect the animation to finish yet
5873   application.SendNotification();
5874   finishCheck.CheckSignalNotReceived();
5875   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), ninetyFivePercentProgress, TEST_LOCATION );
5876
5877   application.SendNotification();
5878   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5879
5880   // We did expect the animation to finish
5881   application.SendNotification();
5882   finishCheck.CheckSignalReceived();
5883   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5884   END_TEST;
5885 }
5886
5887 int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void)
5888 {
5889   TestApplication application;
5890
5891   Actor actor = Actor::New();
5892
5893   // Register a float property
5894   float startValue(10.0f);
5895   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5896   application.GetScene().Add(actor);
5897   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5898   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5899
5900   // Build the animation
5901   float durationSeconds(1.0f);
5902   Animation animation = Animation::New(durationSeconds);
5903   float targetValue(90.0f);
5904   float relativeValue(targetValue - startValue);
5905   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5906
5907   float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5908
5909   // Start the animation
5910   animation.Play();
5911
5912   bool signalReceived(false);
5913   AnimationFinishCheck finishCheck(signalReceived);
5914   animation.FinishedSignal().Connect(&application, finishCheck);
5915
5916   application.SendNotification();
5917   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5918
5919   // We didn't expect the animation to finish yet
5920   application.SendNotification();
5921   finishCheck.CheckSignalNotReceived();
5922
5923   // The position should have moved more, than with a linear alpha function
5924   float current( actor.GetCurrentProperty< float >( index ) );
5925   DALI_TEST_CHECK( current > ninetyFivePercentProgress );
5926
5927   application.SendNotification();
5928   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5929
5930   // We did expect the animation to finish
5931   application.SendNotification();
5932   finishCheck.CheckSignalReceived();
5933   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5934   END_TEST;
5935 }
5936
5937 int UtcDaliAnimationAnimateToFloatTimePeriodP(void)
5938 {
5939   TestApplication application;
5940
5941   Actor actor = Actor::New();
5942
5943   // Register a float property
5944   float startValue(10.0f);
5945   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
5946   application.GetScene().Add(actor);
5947   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5948   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5949
5950   // Build the animation
5951   float durationSeconds(1.0f);
5952   Animation animation = Animation::New(durationSeconds);
5953   float targetValue(30.0f);
5954   float relativeValue(targetValue - startValue);
5955   float delay = 0.5f;
5956   animation.AnimateTo(Property(actor, index),
5957                       targetValue,
5958                       TimePeriod(delay, durationSeconds - delay));
5959
5960   // Start the animation
5961   animation.Play();
5962
5963   bool signalReceived(false);
5964   AnimationFinishCheck finishCheck(signalReceived);
5965   animation.FinishedSignal().Connect(&application, finishCheck);
5966
5967   application.SendNotification();
5968   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5969
5970   // We didn't expect the animation to finish yet
5971   application.SendNotification();
5972   finishCheck.CheckSignalNotReceived();
5973   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5974
5975   application.SendNotification();
5976   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5977
5978   // We didn't expect the animation to finish yet
5979   application.SendNotification();
5980   finishCheck.CheckSignalNotReceived();
5981   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5982
5983   application.SendNotification();
5984   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5985
5986   // We did expect the animation to finish
5987   application.SendNotification();
5988   finishCheck.CheckSignalReceived();
5989   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5990   END_TEST;
5991 }
5992
5993 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void)
5994 {
5995   TestApplication application;
5996
5997   Actor actor = Actor::New();
5998
5999   // Register a float property
6000   float startValue(10.0f);
6001   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6002   application.GetScene().Add(actor);
6003   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
6004   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
6005
6006   // Build the animation
6007   float durationSeconds(1.0f);
6008   Animation animation = Animation::New(durationSeconds);
6009   float targetValue(30.0f);
6010   float relativeValue(targetValue - startValue);
6011   float delay = 0.5f;
6012   animation.AnimateTo(Property(actor, index),
6013                       targetValue,
6014                       AlphaFunction::LINEAR,
6015                       TimePeriod(delay, durationSeconds - delay));
6016
6017   // Start the animation
6018   animation.Play();
6019
6020   bool signalReceived(false);
6021   AnimationFinishCheck finishCheck(signalReceived);
6022   animation.FinishedSignal().Connect(&application, finishCheck);
6023
6024   application.SendNotification();
6025   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6026
6027   // We didn't expect the animation to finish yet
6028   application.SendNotification();
6029   finishCheck.CheckSignalNotReceived();
6030   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
6031
6032   application.SendNotification();
6033   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6034
6035   // We didn't expect the animation to finish yet
6036   application.SendNotification();
6037   finishCheck.CheckSignalNotReceived();
6038   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6039
6040   application.SendNotification();
6041   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6042
6043   // We did expect the animation to finish
6044   application.SendNotification();
6045   finishCheck.CheckSignalReceived();
6046   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
6047   END_TEST;
6048 }
6049
6050 int UtcDaliAnimationAnimateToIntegerP(void)
6051 {
6052   TestApplication application;
6053
6054   Actor actor = Actor::New();
6055
6056   // Register an integer property
6057   int startValue(10);
6058   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6059   application.GetScene().Add(actor);
6060   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
6061   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
6062
6063   // Build the animation
6064   float durationSeconds(2.0f);
6065   Animation animation = Animation::New(durationSeconds);
6066   int targetValue(50);
6067   int relativeValue(targetValue - startValue);
6068   animation.AnimateTo(Property(actor, "testProperty"), targetValue);
6069
6070   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
6071
6072   // Start the animation
6073   animation.Play();
6074
6075   bool signalReceived(false);
6076   AnimationFinishCheck finishCheck(signalReceived);
6077   animation.FinishedSignal().Connect(&application, finishCheck);
6078
6079   application.SendNotification();
6080   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6081
6082   // We didn't expect the animation to finish yet
6083   application.SendNotification();
6084   finishCheck.CheckSignalNotReceived();
6085   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), ninetyFivePercentProgress, TEST_LOCATION );
6086
6087   application.SendNotification();
6088   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6089
6090   // We did expect the animation to finish
6091   application.SendNotification();
6092   finishCheck.CheckSignalReceived();
6093   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
6094   END_TEST;
6095 }
6096
6097 int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void)
6098 {
6099   TestApplication application;
6100
6101   Actor actor = Actor::New();
6102
6103   // Register an integer property
6104   int startValue(10);
6105   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6106   application.GetScene().Add(actor);
6107   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
6108   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
6109
6110   // Build the animation
6111   float durationSeconds(1.0f);
6112   Animation animation = Animation::New(durationSeconds);
6113   int targetValue(90);
6114   int relativeValue(targetValue - startValue);
6115   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6116
6117   int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
6118
6119   // Start the animation
6120   animation.Play();
6121
6122   bool signalReceived(false);
6123   AnimationFinishCheck finishCheck(signalReceived);
6124   animation.FinishedSignal().Connect(&application, finishCheck);
6125
6126   application.SendNotification();
6127   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6128
6129   // We didn't expect the animation to finish yet
6130   application.SendNotification();
6131   finishCheck.CheckSignalNotReceived();
6132
6133   // The position should have moved more, than with a linear alpha function
6134   int current( actor.GetCurrentProperty< int >( index ) );
6135   DALI_TEST_CHECK( current > ninetyFivePercentProgress );
6136
6137   application.SendNotification();
6138   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6139
6140   // We did expect the animation to finish
6141   application.SendNotification();
6142   finishCheck.CheckSignalReceived();
6143   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
6144   END_TEST;
6145 }
6146
6147 int UtcDaliAnimationAnimateToIntegerTimePeriodP(void)
6148 {
6149   TestApplication application;
6150
6151   Actor actor = Actor::New();
6152
6153   // Register an integer property
6154   int startValue(10);
6155   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6156   application.GetScene().Add(actor);
6157   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
6158   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
6159
6160   // Build the animation
6161   float durationSeconds(1.0f);
6162   Animation animation = Animation::New(durationSeconds);
6163   int targetValue(30);
6164   int relativeValue(targetValue - startValue);
6165   float delay = 0.5f;
6166   animation.AnimateTo(Property(actor, index),
6167                       targetValue,
6168                       TimePeriod(delay, durationSeconds - delay));
6169
6170   // Start the animation
6171   animation.Play();
6172
6173   bool signalReceived(false);
6174   AnimationFinishCheck finishCheck(signalReceived);
6175   animation.FinishedSignal().Connect(&application, finishCheck);
6176
6177   application.SendNotification();
6178   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6179
6180   // We didn't expect the animation to finish yet
6181   application.SendNotification();
6182   finishCheck.CheckSignalNotReceived();
6183   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
6184
6185   application.SendNotification();
6186   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6187
6188   // We didn't expect the animation to finish yet
6189   application.SendNotification();
6190   finishCheck.CheckSignalNotReceived();
6191   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
6192
6193   application.SendNotification();
6194   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6195
6196   // We did expect the animation to finish
6197   application.SendNotification();
6198   finishCheck.CheckSignalReceived();
6199   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
6200   END_TEST;
6201 }
6202
6203 int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void)
6204 {
6205   TestApplication application;
6206
6207   Actor actor = Actor::New();
6208
6209   // Register an integer property
6210   int startValue(10);
6211   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6212   application.GetScene().Add(actor);
6213   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
6214   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
6215
6216   // Build the animation
6217   float durationSeconds(1.0f);
6218   Animation animation = Animation::New(durationSeconds);
6219   int targetValue(30);
6220   int relativeValue(targetValue - startValue);
6221   float delay = 0.5f;
6222   animation.AnimateTo(Property(actor, index),
6223                       targetValue,
6224                       AlphaFunction::LINEAR,
6225                       TimePeriod(delay, durationSeconds - delay));
6226
6227   // Start the animation
6228   animation.Play();
6229
6230   bool signalReceived(false);
6231   AnimationFinishCheck finishCheck(signalReceived);
6232   animation.FinishedSignal().Connect(&application, finishCheck);
6233
6234   application.SendNotification();
6235   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6236
6237   // We didn't expect the animation to finish yet
6238   application.SendNotification();
6239   finishCheck.CheckSignalNotReceived();
6240   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
6241
6242   application.SendNotification();
6243   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6244
6245   // We didn't expect the animation to finish yet
6246   application.SendNotification();
6247   finishCheck.CheckSignalNotReceived();
6248   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
6249
6250   application.SendNotification();
6251   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6252
6253   // We did expect the animation to finish
6254   application.SendNotification();
6255   finishCheck.CheckSignalReceived();
6256   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
6257   END_TEST;
6258 }
6259
6260 int UtcDaliAnimationAnimateToVector2P(void)
6261 {
6262   TestApplication application;
6263
6264   Actor actor = Actor::New();
6265
6266   // Register a Vector2 property
6267   Vector2 startValue(-50.0f, -50.0f);
6268   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6269   application.GetScene().Add(actor);
6270   DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6271   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6272
6273   // Build the animation
6274   float durationSeconds(2.0f);
6275   Animation animation = Animation::New(durationSeconds);
6276   Vector2 targetValue(50.0f, 50.0f);
6277   Vector2 relativeValue(targetValue - startValue);
6278   animation.AnimateTo(Property(actor, index), targetValue);
6279
6280   Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6281
6282   // Start the animation
6283   animation.Play();
6284
6285   bool signalReceived(false);
6286   AnimationFinishCheck finishCheck(signalReceived);
6287   animation.FinishedSignal().Connect(&application, finishCheck);
6288
6289   application.SendNotification();
6290   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6291
6292   // We didn't expect the animation to finish yet
6293   application.SendNotification();
6294   finishCheck.CheckSignalNotReceived();
6295   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
6296
6297   application.SendNotification();
6298   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6299
6300   // We did expect the animation to finish
6301   application.SendNotification();
6302   finishCheck.CheckSignalReceived();
6303   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6304   END_TEST;
6305 }
6306
6307 int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void)
6308 {
6309   TestApplication application;
6310
6311   Actor actor = Actor::New();
6312
6313   // Register a Vector2 property
6314   Vector2 startValue(1000.0f, 1000.0f);
6315   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6316   application.GetScene().Add(actor);
6317   DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6318   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6319
6320   // Build the animation
6321   float durationSeconds(1.0f);
6322   Animation animation = Animation::New(durationSeconds);
6323   Vector2 targetValue(9000.0f, 9000.0f);
6324   Vector2 relativeValue(targetValue - startValue);
6325   animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
6326
6327   Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6328
6329   // Start the animation
6330   animation.Play();
6331
6332   bool signalReceived(false);
6333   AnimationFinishCheck finishCheck(signalReceived);
6334   animation.FinishedSignal().Connect(&application, finishCheck);
6335
6336   application.SendNotification();
6337   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6338
6339   // We didn't expect the animation to finish yet
6340   application.SendNotification();
6341   finishCheck.CheckSignalNotReceived();
6342
6343   // The position should have moved more, than with a linear alpha function
6344   Vector2 current( actor.GetCurrentProperty< Vector2 >( index ) );
6345   DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6346   DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6347
6348   application.SendNotification();
6349   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6350
6351   // We did expect the animation to finish
6352   application.SendNotification();
6353   finishCheck.CheckSignalReceived();
6354   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6355   END_TEST;
6356 }
6357
6358 int UtcDaliAnimationAnimateToVector2TimePeriodP(void)
6359 {
6360   TestApplication application;
6361
6362   Actor actor = Actor::New();
6363
6364   // Register a Vector2 property
6365   Vector2 startValue(10.0f, 10.0f);
6366   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6367   application.GetScene().Add(actor);
6368   DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6369   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6370
6371   // Build the animation
6372   float durationSeconds(1.0f);
6373   Animation animation = Animation::New(durationSeconds);
6374   Vector2 targetValue(-10.0f, 20.0f);
6375   Vector2 relativeValue(targetValue - startValue);
6376   float delay = 0.5f;
6377   animation.AnimateTo(Property(actor, index),
6378                       targetValue,
6379                       TimePeriod(delay, durationSeconds - delay));
6380
6381   // Start the animation
6382   animation.Play();
6383
6384   bool signalReceived(false);
6385   AnimationFinishCheck finishCheck(signalReceived);
6386   animation.FinishedSignal().Connect(&application, finishCheck);
6387
6388   application.SendNotification();
6389   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6390
6391   // We didn't expect the animation to finish yet
6392   application.SendNotification();
6393   finishCheck.CheckSignalNotReceived();
6394   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6395
6396   application.SendNotification();
6397   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6398
6399   // We didn't expect the animation to finish yet
6400   application.SendNotification();
6401   finishCheck.CheckSignalNotReceived();
6402   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6403
6404   application.SendNotification();
6405   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6406
6407   // We did expect the animation to finish
6408   application.SendNotification();
6409   finishCheck.CheckSignalReceived();
6410   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6411   END_TEST;
6412 }
6413
6414 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void)
6415 {
6416   TestApplication application;
6417
6418   Actor actor = Actor::New();
6419
6420   // Register a Vector2 property
6421   Vector2 startValue(10.0f, 10.0f);
6422   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6423   application.GetScene().Add(actor);
6424   DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6425   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6426
6427   // Build the animation
6428   float durationSeconds(1.0f);
6429   Animation animation = Animation::New(durationSeconds);
6430   Vector2 targetValue(30.0f, 30.0f);
6431   Vector2 relativeValue(targetValue - startValue);
6432   float delay = 0.5f;
6433   animation.AnimateTo(Property(actor, index),
6434                       targetValue,
6435                       AlphaFunction::LINEAR,
6436                       TimePeriod(delay, durationSeconds - delay));
6437
6438   // Start the animation
6439   animation.Play();
6440
6441   bool signalReceived(false);
6442   AnimationFinishCheck finishCheck(signalReceived);
6443   animation.FinishedSignal().Connect(&application, finishCheck);
6444
6445   application.SendNotification();
6446   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6447
6448   // We didn't expect the animation to finish yet, but cached value should be the final one
6449   application.SendNotification();
6450   finishCheck.CheckSignalNotReceived();
6451   DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6452   DALI_TEST_EQUALS( actor.GetCurrentProperty<Vector2>( index ), startValue, TEST_LOCATION );
6453
6454   application.SendNotification();
6455   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6456
6457   // We didn't expect the animation to finish yet
6458   application.SendNotification();
6459   finishCheck.CheckSignalNotReceived();
6460   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6461
6462   application.SendNotification();
6463   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6464
6465   // We did expect the animation to finish
6466   application.SendNotification();
6467   finishCheck.CheckSignalReceived();
6468   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6469   DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6470   END_TEST;
6471 }
6472
6473 int UtcDaliAnimationAnimateToVector3P(void)
6474 {
6475   TestApplication application;
6476
6477   Actor actor = Actor::New();
6478
6479   // Register a Vector3 property
6480   Vector3 startValue(-50.0f, -50.0f, -50.0f);
6481   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6482   application.GetScene().Add(actor);
6483   DALI_TEST_EQUALS( actor.GetProperty<Vector3>( index ), startValue, TEST_LOCATION );
6484   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6485
6486   // Build the animation
6487   float durationSeconds(2.0f);
6488   Animation animation = Animation::New(durationSeconds);
6489   Vector3 targetValue(50.0f, 50.0f, 50.0f);
6490   Vector3 relativeValue(targetValue - startValue);
6491   animation.AnimateTo(Property(actor, index), targetValue);
6492
6493   Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6494
6495   // Start the animation
6496   animation.Play();
6497
6498   bool signalReceived(false);
6499   AnimationFinishCheck finishCheck(signalReceived);
6500   animation.FinishedSignal().Connect(&application, finishCheck);
6501
6502   application.SendNotification();
6503   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6504
6505   // We didn't expect the animation to finish yet
6506   application.SendNotification();
6507   finishCheck.CheckSignalNotReceived();
6508   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
6509
6510   application.SendNotification();
6511   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6512
6513   // We did expect the animation to finish
6514   application.SendNotification();
6515   finishCheck.CheckSignalReceived();
6516   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6517   END_TEST;
6518 }
6519
6520 int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void)
6521 {
6522   TestApplication application;
6523
6524   Actor actor = Actor::New();
6525
6526   // Register a Vector3 property
6527   Vector3 startValue(1000.0f, 1000.0f, 1000.0f);
6528   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6529   application.GetScene().Add(actor);
6530   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6531   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6532
6533   // Build the animation
6534   float durationSeconds(1.0f);
6535   Animation animation = Animation::New(durationSeconds);
6536   Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
6537   Vector3 relativeValue(targetValue - startValue);
6538   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6539
6540   Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6541
6542   // Start the animation
6543   animation.Play();
6544
6545   bool signalReceived(false);
6546   AnimationFinishCheck finishCheck(signalReceived);
6547   animation.FinishedSignal().Connect(&application, finishCheck);
6548
6549   application.SendNotification();
6550   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6551
6552   // We didn't expect the animation to finish yet
6553   application.SendNotification();
6554   finishCheck.CheckSignalNotReceived();
6555
6556   // The position should have moved more, than with a linear alpha function
6557   Vector3 current( actor.GetCurrentProperty< Vector3 >( index ) );
6558   DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6559   DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6560   DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
6561
6562   application.SendNotification();
6563   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6564
6565   // We did expect the animation to finish
6566   application.SendNotification();
6567   finishCheck.CheckSignalReceived();
6568   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6569   END_TEST;
6570 }
6571
6572 int UtcDaliAnimationAnimateToVector3TimePeriodP(void)
6573 {
6574   TestApplication application;
6575
6576   Actor actor = Actor::New();
6577
6578   // Register a Vector3 property
6579   Vector3 startValue(10.0f, 10.0f, 10.0f);
6580   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6581   application.GetScene().Add(actor);
6582   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6583   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6584
6585   // Build the animation
6586   float durationSeconds(1.0f);
6587   Animation animation = Animation::New(durationSeconds);
6588   Vector3 targetValue(-10.0f, 20.0f, 100.0f);
6589   Vector3 relativeValue(targetValue - startValue);
6590   float delay = 0.5f;
6591   animation.AnimateTo(Property(actor, index),
6592                       targetValue,
6593                       TimePeriod(delay, durationSeconds - delay));
6594
6595   // Start the animation
6596   animation.Play();
6597
6598   bool signalReceived(false);
6599   AnimationFinishCheck finishCheck(signalReceived);
6600   animation.FinishedSignal().Connect(&application, finishCheck);
6601
6602   application.SendNotification();
6603   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6604
6605   // We didn't expect the animation to finish yet
6606   application.SendNotification();
6607   finishCheck.CheckSignalNotReceived();
6608   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6609
6610   application.SendNotification();
6611   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6612
6613   // We didn't expect the animation to finish yet
6614   application.SendNotification();
6615   finishCheck.CheckSignalNotReceived();
6616   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6617
6618   application.SendNotification();
6619   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6620
6621   // We did expect the animation to finish
6622   application.SendNotification();
6623   finishCheck.CheckSignalReceived();
6624   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6625   END_TEST;
6626 }
6627
6628 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void)
6629 {
6630   TestApplication application;
6631
6632   Actor actor = Actor::New();
6633
6634   // Register a Vector3 property
6635   Vector3 startValue(10.0f, 10.0f, 10.0f);
6636   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6637   application.GetScene().Add(actor);
6638   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6639   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6640
6641   // Build the animation
6642   float durationSeconds(1.0f);
6643   Animation animation = Animation::New(durationSeconds);
6644   Vector3 targetValue(30.0f, 30.0f, 30.0f);
6645   Vector3 relativeValue(targetValue - startValue);
6646   float delay = 0.5f;
6647   animation.AnimateTo(Property(actor, "testProperty"),
6648                       targetValue,
6649                       AlphaFunction::LINEAR,
6650                       TimePeriod(delay, durationSeconds - delay));
6651
6652   // Start the animation
6653   animation.Play();
6654
6655   bool signalReceived(false);
6656   AnimationFinishCheck finishCheck(signalReceived);
6657   animation.FinishedSignal().Connect(&application, finishCheck);
6658
6659   application.SendNotification();
6660   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6661
6662   // We didn't expect the animation to finish yet
6663   application.SendNotification();
6664   finishCheck.CheckSignalNotReceived();
6665   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6666
6667   application.SendNotification();
6668   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6669
6670   // We didn't expect the animation to finish yet
6671   application.SendNotification();
6672   finishCheck.CheckSignalNotReceived();
6673   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6674
6675   application.SendNotification();
6676   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6677
6678   // We did expect the animation to finish
6679   application.SendNotification();
6680   finishCheck.CheckSignalReceived();
6681   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6682   END_TEST;
6683 }
6684
6685 int UtcDaliAnimationAnimateToVector3ComponentP(void)
6686 {
6687   TestApplication application;
6688
6689   Actor actor = Actor::New();
6690
6691   // Register a Vector3 property
6692   Vector3 startValue(10.0f, 10.0f, 10.0f);
6693   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6694   application.GetScene().Add(actor);
6695   DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6696   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6697
6698   // Build the animation
6699   float durationSeconds(1.0f);
6700   Animation animation = Animation::New(durationSeconds);
6701   Vector3 targetValue(30.0f, 30.0f, 10.0f);
6702   Vector3 relativeValue(targetValue - startValue);
6703   float delay = 0.5f;
6704   animation.AnimateTo(Property(actor, "testProperty",  0),
6705                       30.0f,
6706                       AlphaFunction::LINEAR,
6707                       TimePeriod(delay, durationSeconds - delay));
6708   animation.AnimateTo(Property(actor, index, 1),
6709                       30.0f,
6710                       AlphaFunction::LINEAR,
6711                       TimePeriod(delay, durationSeconds - delay));
6712
6713   // Start the animation
6714   animation.Play();
6715
6716   bool signalReceived(false);
6717   AnimationFinishCheck finishCheck(signalReceived);
6718   animation.FinishedSignal().Connect(&application, finishCheck);
6719
6720   application.SendNotification();
6721   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6722
6723   // We didn't expect the animation to finish yet
6724   application.SendNotification();
6725   finishCheck.CheckSignalNotReceived();
6726   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6727
6728   application.SendNotification();
6729   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6730
6731   // We didn't expect the animation to finish yet
6732   application.SendNotification();
6733   finishCheck.CheckSignalNotReceived();
6734   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6735
6736   application.SendNotification();
6737   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6738
6739   // We did expect the animation to finish
6740   application.SendNotification();
6741   finishCheck.CheckSignalReceived();
6742   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6743   END_TEST;
6744 }
6745
6746 int UtcDaliAnimationAnimateToVector4P(void)
6747 {
6748   TestApplication application;
6749
6750   Actor actor = Actor::New();
6751
6752   // Register a Vector4 property
6753   Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f);
6754   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6755   application.GetScene().Add(actor);
6756   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6757   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6758
6759   // Build the animation
6760   float durationSeconds(2.0f);
6761   Animation animation = Animation::New(durationSeconds);
6762   Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f);
6763   Vector4 relativeValue(targetValue - startValue);
6764   animation.AnimateTo(Property(actor, index), targetValue);
6765
6766   Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6767
6768   // Start the animation
6769   animation.Play();
6770
6771   bool signalReceived(false);
6772   AnimationFinishCheck finishCheck(signalReceived);
6773   animation.FinishedSignal().Connect(&application, finishCheck);
6774
6775   application.SendNotification();
6776   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6777
6778   // We didn't expect the animation to finish yet
6779   application.SendNotification();
6780   finishCheck.CheckSignalNotReceived();
6781   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
6782
6783   application.SendNotification();
6784   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6785
6786   // We did expect the animation to finish
6787   application.SendNotification();
6788   finishCheck.CheckSignalReceived();
6789   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
6790   END_TEST;
6791 }
6792
6793 int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void)
6794 {
6795   TestApplication application;
6796
6797   Actor actor = Actor::New();
6798
6799   // Register a Vector4 property
6800   Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
6801   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6802   application.GetScene().Add(actor);
6803   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6804   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6805
6806   // Build the animation
6807   float durationSeconds(1.0f);
6808   Animation animation = Animation::New(durationSeconds);
6809   Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
6810   Vector4 relativeValue(targetValue - startValue);
6811   animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6812
6813   Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6814
6815   // Start the animation
6816   animation.Play();
6817
6818   bool signalReceived(false);
6819   AnimationFinishCheck finishCheck(signalReceived);
6820   animation.FinishedSignal().Connect(&application, finishCheck);
6821
6822   application.SendNotification();
6823   application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6824
6825   // We didn't expect the animation to finish yet
6826   application.SendNotification();
6827   finishCheck.CheckSignalNotReceived();
6828
6829   // The position should have moved more, than with a linear alpha function
6830   Vector4 current( actor.GetCurrentProperty< Vector4 >( index ) );
6831   DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6832   DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6833   DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
6834   DALI_TEST_CHECK( current.w > ninetyFivePercentProgress.w );
6835
6836   application.SendNotification();
6837   application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6838
6839   // We did expect the animation to finish
6840   application.SendNotification();
6841   finishCheck.CheckSignalReceived();
6842   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
6843   END_TEST;
6844 }
6845
6846 int UtcDaliAnimationAnimateToVector4TimePeriodP(void)
6847 {
6848   TestApplication application;
6849
6850   Actor actor = Actor::New();
6851
6852   // Register a Vector4 property
6853   Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6854   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6855   application.GetScene().Add(actor);
6856   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6857   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6858
6859   // Build the animation
6860   float durationSeconds(1.0f);
6861   Animation animation = Animation::New(durationSeconds);
6862   Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
6863   Vector4 relativeValue(targetValue - startValue);
6864   float delay = 0.5f;
6865   animation.AnimateTo(Property(actor, index),
6866                       targetValue,
6867                       TimePeriod(delay, durationSeconds - delay));
6868
6869   // Start the animation
6870   animation.Play();
6871
6872   bool signalReceived(false);
6873   AnimationFinishCheck finishCheck(signalReceived);
6874   animation.FinishedSignal().Connect(&application, finishCheck);
6875
6876   application.SendNotification();
6877   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6878
6879   // We didn't expect the animation to finish yet
6880   application.SendNotification();
6881   finishCheck.CheckSignalNotReceived();
6882   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6883
6884   application.SendNotification();
6885   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6886
6887   // We didn't expect the animation to finish yet
6888   application.SendNotification();
6889   finishCheck.CheckSignalNotReceived();
6890   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), VECTOR4_EPSILON, TEST_LOCATION );
6891
6892   application.SendNotification();
6893   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6894
6895   // We did expect the animation to finish
6896   application.SendNotification();
6897   finishCheck.CheckSignalReceived();
6898   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, VECTOR4_EPSILON, TEST_LOCATION );
6899   END_TEST;
6900 }
6901
6902 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void)
6903 {
6904   TestApplication application;
6905
6906   Actor actor = Actor::New();
6907
6908   // Register a Vector4 property
6909   Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6910   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
6911   application.GetScene().Add(actor);
6912   DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6913   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6914
6915   // Build the animation
6916   float durationSeconds(1.0f);
6917   Animation animation = Animation::New(durationSeconds);
6918   Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
6919   Vector4 relativeValue(targetValue - startValue);
6920   float delay = 0.5f;
6921   animation.AnimateTo(Property(actor, index),
6922                       targetValue,
6923                       AlphaFunction::LINEAR,
6924                       TimePeriod(delay, durationSeconds - delay));
6925
6926   // Start the animation
6927   animation.Play();
6928
6929   bool signalReceived(false);
6930   AnimationFinishCheck finishCheck(signalReceived);
6931   animation.FinishedSignal().Connect(&application, finishCheck);
6932
6933   application.SendNotification();
6934   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6935
6936   // We didn't expect the animation to finish yet
6937   application.SendNotification();
6938   finishCheck.CheckSignalNotReceived();
6939   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6940
6941   application.SendNotification();
6942   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6943
6944   // We didn't expect the animation to finish yet
6945   application.SendNotification();
6946   finishCheck.CheckSignalNotReceived();
6947   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6948
6949   application.SendNotification();
6950   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6951
6952   // We did expect the animation to finish
6953   application.SendNotification();
6954   finishCheck.CheckSignalReceived();
6955   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
6956   END_TEST;
6957 }
6958
6959 int UtcDaliAnimationAnimateToActorParentOriginP(void)
6960 {
6961   TestApplication application;
6962
6963   Actor actor = Actor::New();
6964   application.GetScene().Add(actor);
6965   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::TOP_LEFT, TEST_LOCATION );
6966
6967   // Build the animation
6968   float durationSeconds(1.0f);
6969   Animation animation = Animation::New(durationSeconds);
6970   Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
6971
6972   DALI_TEST_ASSERTION(
6973   {
6974     animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin );
6975   }, "Property is not animatable" );
6976
6977   END_TEST;
6978 }
6979
6980 int UtcDaliAnimationAnimateToActorParentOriginXN(void)
6981 {
6982   TestApplication application;
6983
6984   Actor actor = Actor::New();
6985   application.GetScene().Add(actor);
6986   float startValue(0.0f);
6987   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ).x, startValue, TEST_LOCATION );
6988   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION );
6989
6990   // Build the animation
6991   float durationSeconds(1.0f);
6992   Animation animation = Animation::New(durationSeconds);
6993   float targetX(1.0f);
6994
6995   DALI_TEST_ASSERTION(
6996   {
6997     animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX );
6998   }, "Property is not animatable" );
6999
7000   END_TEST;
7001 }
7002
7003 int UtcDaliAnimationAnimateToActorParentOriginYN(void)
7004 {
7005   TestApplication application;
7006
7007   Actor actor = Actor::New();
7008   application.GetScene().Add(actor);
7009   float startValue(0.0f);
7010   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ).y, startValue, TEST_LOCATION );
7011   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION );
7012
7013   // Build the animation
7014   float durationSeconds(1.0f);
7015   Animation animation = Animation::New(durationSeconds);
7016   float targetY(1.0f);
7017
7018   DALI_TEST_ASSERTION(
7019   {
7020     animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY );
7021   }, "Property is not animatable" );
7022
7023   END_TEST;
7024 }
7025
7026 int UtcDaliAnimationAnimateToActorParentOriginZN(void)
7027 {
7028   TestApplication application;
7029
7030   Actor actor = Actor::New();
7031   application.GetScene().Add(actor);
7032   float startValue(0.5f);
7033   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ).z, startValue, TEST_LOCATION );
7034   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION );
7035
7036   // Build the animation
7037   float durationSeconds(1.0f);
7038   Animation animation = Animation::New(durationSeconds);
7039   float targetZ(1.0f);
7040
7041   DALI_TEST_ASSERTION(
7042   {
7043     animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ );
7044   }, "Property is not animatable" );
7045
7046   END_TEST;
7047 }
7048
7049 int UtcDaliAnimationAnimateToActorAnchorPointN(void)
7050 {
7051   TestApplication application;
7052
7053   Actor actor = Actor::New();
7054   application.GetScene().Add(actor);
7055   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), AnchorPoint::CENTER, TEST_LOCATION );
7056
7057   // Build the animation
7058   float durationSeconds(1.0f);
7059   Animation animation = Animation::New(durationSeconds);
7060   Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT);
7061
7062   DALI_TEST_ASSERTION(
7063   {
7064     animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
7065   }, "Property is not animatable" );
7066
7067   END_TEST;
7068 }
7069
7070 int UtcDaliAnimationAnimateToActorAnchorPointXN(void)
7071 {
7072   TestApplication application;
7073
7074   Actor actor = Actor::New();
7075   application.GetScene().Add(actor);
7076   float startValue(0.5f);
7077   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ).x, startValue, TEST_LOCATION );
7078   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION );
7079
7080   // Build the animation
7081   float durationSeconds(1.0f);
7082   Animation animation = Animation::New(durationSeconds);
7083   float targetX(1.0f);
7084
7085   DALI_TEST_ASSERTION(
7086   {
7087     animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_X), targetX );
7088   }, "Property is not animatable" );
7089
7090   END_TEST;
7091 }
7092
7093 int UtcDaliAnimationAnimateToActorAnchorPointYN(void)
7094 {
7095   TestApplication application;
7096
7097   Actor actor = Actor::New();
7098   application.GetScene().Add(actor);
7099   float startValue(0.5f);
7100   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ).y, startValue, TEST_LOCATION );
7101   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION );
7102
7103   // Build the animation
7104   float durationSeconds(1.0f);
7105   Animation animation = Animation::New(durationSeconds);
7106   float targetY(0.0f);
7107
7108   DALI_TEST_ASSERTION(
7109   {
7110     animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY );
7111   }, "Property is not animatable" );
7112
7113   END_TEST;
7114 }
7115
7116 int UtcDaliAnimationAnimateToActorAnchorPointZN(void)
7117 {
7118   TestApplication application;
7119
7120   Actor actor = Actor::New();
7121   application.GetScene().Add(actor);
7122   float startValue(0.5f);
7123   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ).z, startValue, TEST_LOCATION );
7124   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION );
7125
7126   // Build the animation
7127   float durationSeconds(1.0f);
7128   Animation animation = Animation::New(durationSeconds);
7129   float targetZ(100.0f);
7130
7131   DALI_TEST_ASSERTION(
7132   {
7133     animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ );
7134   }, "Property is not animatable" );
7135
7136   END_TEST;
7137 }
7138
7139 int UtcDaliAnimationAnimateToActorSizeP(void)
7140 {
7141   TestApplication application;
7142
7143   Actor actor = Actor::New();
7144   application.GetScene().Add(actor);
7145   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7146
7147   // Build the animation
7148   float durationSeconds(1.0f);
7149   Animation animation = Animation::New(durationSeconds);
7150   Vector3 targetSize(100.0f, 100.0f, 100.0f);
7151   animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize );
7152
7153   Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7154
7155   // Should return the initial properties before play
7156   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7157   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), 0.0f, TEST_LOCATION );
7158   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), 0.0f, TEST_LOCATION );
7159   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), 0.0f, TEST_LOCATION );
7160
7161   // Start the animation
7162   animation.Play();
7163
7164   // Should return the target property after play
7165   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
7166   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
7167   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
7168   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
7169
7170   bool signalReceived(false);
7171   AnimationFinishCheck finishCheck(signalReceived);
7172   animation.FinishedSignal().Connect(&application, finishCheck);
7173
7174   application.SendNotification();
7175   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7176
7177   // We didn't expect the animation to finish yet
7178   application.SendNotification();
7179   finishCheck.CheckSignalNotReceived();
7180   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), ninetyNinePercentProgress, TEST_LOCATION );
7181
7182   application.SendNotification();
7183   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7184
7185   // We did expect the animation to finish
7186   application.SendNotification();
7187   finishCheck.CheckSignalReceived();
7188   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
7189
7190   // Reset everything
7191   finishCheck.Reset();
7192   actor.SetProperty( Actor::Property::SIZE,Vector3::ZERO);
7193   application.SendNotification();
7194   application.Render(0);
7195   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7196
7197   // Repeat with a different (ease-in) alpha function
7198   animation = Animation::New(durationSeconds);
7199   animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
7200   animation.FinishedSignal().Connect(&application, finishCheck);
7201   animation.Play();
7202
7203   application.SendNotification();
7204   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7205
7206   // We didn't expect the animation to finish yet
7207   application.SendNotification();
7208   finishCheck.CheckSignalNotReceived();
7209
7210   // The size should have travelled less, than with a linear alpha function
7211   Vector3 current(actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
7212   DALI_TEST_CHECK( current.x > 0.0f );
7213   DALI_TEST_CHECK( current.y > 0.0f );
7214   DALI_TEST_CHECK( current.z > 0.0f );
7215   DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
7216   DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
7217   DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
7218
7219   application.SendNotification();
7220   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7221
7222   // We did expect the animation to finish
7223   application.SendNotification();
7224   finishCheck.CheckSignalReceived();
7225   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
7226
7227   // Reset everything
7228   finishCheck.Reset();
7229   actor.SetProperty( Actor::Property::SIZE,Vector3::ZERO);
7230   application.SendNotification();
7231   application.Render(0);
7232   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7233
7234   // Repeat with a delay
7235   float delay = 0.5f;
7236   animation = Animation::New(durationSeconds);
7237   animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7238   animation.FinishedSignal().Connect(&application, finishCheck);
7239   animation.Play();
7240
7241   application.SendNotification();
7242   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7243
7244   // We didn't expect the animation to finish yet
7245   application.SendNotification();
7246   finishCheck.CheckSignalNotReceived();
7247   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7248
7249   application.SendNotification();
7250   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7251
7252   // We did expect the animation to finish
7253   application.SendNotification();
7254   finishCheck.CheckSignalReceived();
7255   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
7256   END_TEST;
7257 }
7258
7259 int UtcDaliAnimationAnimateToActorSizeWidthP(void)
7260 {
7261   TestApplication application;
7262
7263   Actor actor = Actor::New();
7264   application.GetScene().Add(actor);
7265   float startValue(0.0f);
7266   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).width, startValue, TEST_LOCATION );
7267   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION );
7268
7269   // Build the animation
7270   float durationSeconds(1.0f);
7271   Animation animation = Animation::New(durationSeconds);
7272   float targetWidth(10.0f);
7273   animation.AnimateTo( Property(actor, Actor::Property::SIZE_WIDTH), targetWidth );
7274
7275   float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f);
7276
7277   // Should return the initial properties before play
7278   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7279   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), startValue, TEST_LOCATION );
7280
7281   // Start the animation
7282   animation.Play();
7283
7284   // Should return the target property after play
7285   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( targetWidth, 0.0f, 0.0f ), TEST_LOCATION );
7286   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetWidth, TEST_LOCATION );
7287
7288   bool signalReceived(false);
7289   AnimationFinishCheck finishCheck(signalReceived);
7290   animation.FinishedSignal().Connect(&application, finishCheck);
7291
7292   application.SendNotification();
7293   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7294
7295   // We didn't expect the animation to finish yet
7296   application.SendNotification();
7297   finishCheck.CheckSignalNotReceived();
7298   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).width, fiftyPercentProgress, TEST_LOCATION );
7299
7300   application.SendNotification();
7301   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7302
7303   // We did expect the animation to finish
7304   application.SendNotification();
7305   finishCheck.CheckSignalReceived();
7306   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).width, targetWidth, TEST_LOCATION );
7307   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION );
7308   END_TEST;
7309 }
7310
7311 int UtcDaliAnimationAnimateToActorSizeHeightP(void)
7312 {
7313   TestApplication application;
7314
7315   Actor actor = Actor::New();
7316   application.GetScene().Add(actor);
7317   float startValue(0.0f);
7318   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).height, startValue, TEST_LOCATION );
7319   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION );
7320
7321   // Build the animation
7322   float durationSeconds(1.0f);
7323   Animation animation = Animation::New(durationSeconds);
7324   float targetHeight(-10.0f);
7325   animation.AnimateTo( Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight );
7326
7327   float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f);
7328
7329   // Should return the initial properties before play
7330   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7331   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), startValue, TEST_LOCATION );
7332
7333   // Start the animation
7334   animation.Play();
7335
7336   // Should return the target property after play
7337   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, targetHeight, 0.0f ), TEST_LOCATION );
7338   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetHeight, TEST_LOCATION );
7339
7340   bool signalReceived(false);
7341   AnimationFinishCheck finishCheck(signalReceived);
7342   animation.FinishedSignal().Connect(&application, finishCheck);
7343
7344   application.SendNotification();
7345   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7346
7347   // We didn't expect the animation to finish yet
7348   application.SendNotification();
7349   finishCheck.CheckSignalNotReceived();
7350   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).height, fiftyPercentProgress, TEST_LOCATION );
7351
7352   application.SendNotification();
7353   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7354
7355   // We did expect the animation to finish
7356   application.SendNotification();
7357   finishCheck.CheckSignalReceived();
7358   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).height, targetHeight, TEST_LOCATION );
7359   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION );
7360   END_TEST;
7361 }
7362
7363 int UtcDaliAnimationAnimateToActorSizeDepthP(void)
7364 {
7365   TestApplication application;
7366
7367   Actor actor = Actor::New();
7368   application.GetScene().Add(actor);
7369   float startValue(0.0f);
7370   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).depth, startValue, TEST_LOCATION );
7371   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION );
7372
7373   // Build the animation
7374   float durationSeconds(1.0f);
7375   Animation animation = Animation::New(durationSeconds);
7376   float targetDepth(-10.0f);
7377   animation.AnimateTo( Property(actor, Actor::Property::SIZE_DEPTH), targetDepth );
7378
7379   float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f);
7380
7381   // Should return the initial properties before play
7382   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7383   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), startValue, TEST_LOCATION );
7384
7385   // Start the animation
7386   animation.Play();
7387
7388   // Should return the target property after play
7389   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, 0.0f, targetDepth ), TEST_LOCATION );
7390   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetDepth, TEST_LOCATION );
7391
7392   bool signalReceived(false);
7393   AnimationFinishCheck finishCheck(signalReceived);
7394   animation.FinishedSignal().Connect(&application, finishCheck);
7395
7396   application.SendNotification();
7397   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7398
7399   // We didn't expect the animation to finish yet
7400   application.SendNotification();
7401   finishCheck.CheckSignalNotReceived();
7402   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).depth, fiftyPercentProgress, TEST_LOCATION );
7403
7404   application.SendNotification();
7405   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7406
7407   // We did expect the animation to finish
7408   application.SendNotification();
7409   finishCheck.CheckSignalReceived();
7410   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).depth, targetDepth, TEST_LOCATION );
7411   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION );
7412   END_TEST;
7413 }
7414
7415 int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void)
7416 {
7417   TestApplication application;
7418
7419   Actor actor = Actor::New();
7420   application.GetScene().Add(actor);
7421   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7422
7423   // Build the animation
7424   float durationSeconds(1.0f);
7425   Animation animation = Animation::New(durationSeconds);
7426   Vector3 targetSize(100.0f, 100.0f, 100.0f);
7427   animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetSize );
7428
7429   Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7430
7431   // Start the animation
7432   animation.Play();
7433
7434   bool signalReceived(false);
7435   AnimationFinishCheck finishCheck(signalReceived);
7436   animation.FinishedSignal().Connect(&application, finishCheck);
7437
7438   application.SendNotification();
7439   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7440
7441   // We didn't expect the animation to finish yet
7442   application.SendNotification();
7443   finishCheck.CheckSignalNotReceived();
7444   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), ninetyNinePercentProgress, TEST_LOCATION );
7445
7446   application.SendNotification();
7447   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7448
7449   // We did expect the animation to finish
7450   application.SendNotification();
7451   finishCheck.CheckSignalReceived();
7452   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
7453
7454   // Reset everything
7455   finishCheck.Reset();
7456   actor.SetProperty( Actor::Property::SIZE,Vector3::ZERO);
7457   application.SendNotification();
7458   application.Render(0);
7459   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7460
7461   // Repeat with a different (ease-in) alpha function
7462   animation = Animation::New(durationSeconds);
7463   animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::EASE_IN );
7464   animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::EASE_IN );
7465   animation.FinishedSignal().Connect(&application, finishCheck);
7466   animation.Play();
7467
7468   application.SendNotification();
7469   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7470
7471   // We didn't expect the animation to finish yet
7472   application.SendNotification();
7473   finishCheck.CheckSignalNotReceived();
7474
7475   // The size should have travelled less, than with a linear alpha function
7476   Vector3 current(actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
7477   DALI_TEST_CHECK( current.x > 0.0f );
7478   DALI_TEST_CHECK( current.y > 0.0f );
7479   DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
7480   DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
7481
7482   application.SendNotification();
7483   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7484
7485   // We did expect the animation to finish
7486   application.SendNotification();
7487   finishCheck.CheckSignalReceived();
7488   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).x, targetSize.x, TEST_LOCATION );
7489   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).y, targetSize.y, TEST_LOCATION );
7490
7491   // Reset everything
7492   finishCheck.Reset();
7493   actor.SetProperty( Actor::Property::SIZE,Vector3::ZERO);
7494   application.SendNotification();
7495   application.Render(0);
7496   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7497
7498   // Repeat with a delay
7499   float delay = 0.5f;
7500   animation = Animation::New(durationSeconds);
7501   animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
7502   animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
7503   animation.FinishedSignal().Connect(&application, finishCheck);
7504   animation.Play();
7505
7506   application.SendNotification();
7507   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7508
7509   // We didn't expect the animation to finish yet
7510   application.SendNotification();
7511   finishCheck.CheckSignalNotReceived();
7512   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7513
7514   application.SendNotification();
7515   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7516
7517   // We did expect the animation to finish
7518   application.SendNotification();
7519   finishCheck.CheckSignalReceived();
7520   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).x, targetSize.x, TEST_LOCATION );
7521   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).y, targetSize.y, TEST_LOCATION );
7522   END_TEST;
7523 }
7524
7525 int UtcDaliAnimationAnimateToActorPositionP(void)
7526 {
7527   TestApplication application;
7528
7529   Actor actor = Actor::New();
7530   application.GetScene().Add(actor);
7531   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7532
7533   // Build the animation
7534   float durationSeconds(1.0f);
7535   Animation animation = Animation::New(durationSeconds);
7536   Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7537   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
7538
7539   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7540
7541   // Should return the initial properties before play
7542   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7543   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
7544   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), 0.0f, TEST_LOCATION );
7545   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), 0.0f, TEST_LOCATION );
7546
7547   // Start the animation
7548   animation.Play();
7549
7550   // Should return the target property after play
7551   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
7552   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetPosition.x, TEST_LOCATION );
7553   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetPosition.y, TEST_LOCATION );
7554   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetPosition.z, TEST_LOCATION );
7555
7556   bool signalReceived(false);
7557   AnimationFinishCheck finishCheck(signalReceived);
7558   animation.FinishedSignal().Connect(&application, finishCheck);
7559
7560   application.SendNotification();
7561   application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
7562
7563   // We didn't expect the animation to finish yet
7564   application.SendNotification();
7565   finishCheck.CheckSignalNotReceived();
7566   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), seventyFivePercentProgress, TEST_LOCATION );
7567
7568   application.SendNotification();
7569   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7570
7571   // We did expect the animation to finish
7572   application.SendNotification();
7573   finishCheck.CheckSignalReceived();
7574   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
7575   END_TEST;
7576 }
7577
7578 int UtcDaliAnimationAnimateToActorPositionXP(void)
7579 {
7580   TestApplication application;
7581
7582   Actor actor = Actor::New();
7583   application.GetScene().Add(actor);
7584   float startValue(0.0f);
7585   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, startValue, TEST_LOCATION );
7586   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7587   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7588   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7589
7590   // Build the animation
7591   float durationSeconds(1.0f);
7592   Animation animation = Animation::New(durationSeconds);
7593   float targetX(1.0f);
7594   animation.AnimateTo( Property(actor, Actor::Property::POSITION_X), targetX );
7595
7596   float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
7597
7598   // Should return the initial properties before play
7599   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7600   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), startValue, TEST_LOCATION );
7601
7602   // Start the animation
7603   animation.Play();
7604
7605   // Should return the target property after play
7606   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( targetX, 0.0f, 0.0f ), TEST_LOCATION );
7607   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetX, TEST_LOCATION );
7608
7609   bool signalReceived(false);
7610   AnimationFinishCheck finishCheck(signalReceived);
7611   animation.FinishedSignal().Connect(&application, finishCheck);
7612
7613   application.SendNotification();
7614   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7615
7616   // We didn't expect the animation to finish yet
7617   application.SendNotification();
7618   finishCheck.CheckSignalNotReceived();
7619   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, fiftyPercentProgress, TEST_LOCATION );
7620
7621   application.SendNotification();
7622   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7623
7624   // We did expect the animation to finish
7625   application.SendNotification();
7626   finishCheck.CheckSignalReceived();
7627   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, targetX, TEST_LOCATION );
7628   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION );
7629   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7630   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7631   END_TEST;
7632 }
7633
7634 int UtcDaliAnimationAnimateToActorPositionYP(void)
7635 {
7636   TestApplication application;
7637
7638   Actor actor = Actor::New();
7639   application.GetScene().Add(actor);
7640   float startValue(0.0f);
7641   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).y, startValue, TEST_LOCATION );
7642   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7643   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7644   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7645
7646   // Build the animation
7647   float durationSeconds(1.0f);
7648   Animation animation = Animation::New(durationSeconds);
7649   float targetY(10.0f);
7650   animation.AnimateTo( Property(actor, Actor::Property::POSITION_Y), targetY );
7651
7652   float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
7653
7654   // Should return the initial properties before play
7655   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7656   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), startValue, TEST_LOCATION );
7657
7658   // Start the animation
7659   animation.Play();
7660
7661   // Should return the target property after play
7662   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, targetY, 0.0f ), TEST_LOCATION );
7663   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetY, TEST_LOCATION );
7664
7665   bool signalReceived(false);
7666   AnimationFinishCheck finishCheck(signalReceived);
7667   animation.FinishedSignal().Connect(&application, finishCheck);
7668
7669   application.SendNotification();
7670   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7671
7672   // We didn't expect the animation to finish yet
7673   application.SendNotification();
7674   finishCheck.CheckSignalNotReceived();
7675   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).y, fiftyPercentProgress, TEST_LOCATION );
7676
7677   application.SendNotification();
7678   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7679
7680   // We did expect the animation to finish
7681   application.SendNotification();
7682   finishCheck.CheckSignalReceived();
7683   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).y, targetY, TEST_LOCATION );
7684   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7685   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION );
7686   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7687   END_TEST;
7688 }
7689
7690 int UtcDaliAnimationAnimateToActorPositionZP(void)
7691 {
7692   TestApplication application;
7693
7694   Actor actor = Actor::New();
7695   application.GetScene().Add(actor);
7696   float startValue(0.0f);
7697   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).z, startValue, TEST_LOCATION );
7698   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7699   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7700   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7701
7702   // Build the animation
7703   float durationSeconds(1.0f);
7704   Animation animation = Animation::New(durationSeconds);
7705   float targetZ(-5.0f);
7706   animation.AnimateTo( Property(actor, Actor::Property::POSITION_Z), targetZ );
7707
7708   float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
7709
7710   // Should return the initial properties before play
7711   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7712   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), startValue, TEST_LOCATION );
7713
7714   // Start the animation
7715   animation.Play();
7716
7717   // Should return the target property after play
7718   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, targetZ ), TEST_LOCATION );
7719   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetZ, TEST_LOCATION );
7720
7721   bool signalReceived(false);
7722   AnimationFinishCheck finishCheck(signalReceived);
7723   animation.FinishedSignal().Connect(&application, finishCheck);
7724
7725   application.SendNotification();
7726   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7727
7728   // We didn't expect the animation to finish yet
7729   application.SendNotification();
7730   finishCheck.CheckSignalNotReceived();
7731   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).z, fiftyPercentProgress, TEST_LOCATION );
7732
7733   application.SendNotification();
7734   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7735
7736   // We did expect the animation to finish
7737   application.SendNotification();
7738   finishCheck.CheckSignalReceived();
7739   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).z, targetZ, TEST_LOCATION );
7740   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7741   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7742   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION );
7743   END_TEST;
7744 }
7745
7746 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void)
7747 {
7748   TestApplication application;
7749
7750   Actor actor = Actor::New();
7751   application.GetScene().Add(actor);
7752   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7753
7754   // Build the animation
7755   float durationSeconds(1.0f);
7756   Animation animation = Animation::New(durationSeconds);
7757   Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7758   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
7759
7760   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7761
7762   // Start the animation
7763   animation.Play();
7764
7765   bool signalReceived(false);
7766   AnimationFinishCheck finishCheck(signalReceived);
7767   animation.FinishedSignal().Connect(&application, finishCheck);
7768
7769   application.SendNotification();
7770   application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
7771
7772   // We didn't expect the animation to finish yet
7773   application.SendNotification();
7774   finishCheck.CheckSignalNotReceived();
7775
7776   // The position should have moved less, than with a linear alpha function
7777   Vector3 current(actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
7778   DALI_TEST_CHECK( current.x > Vector3::ZERO.x );
7779   DALI_TEST_CHECK( current.y > Vector3::ZERO.y );
7780   DALI_TEST_CHECK( current.z > Vector3::ZERO.z );
7781   DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x );
7782   DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y );
7783   DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z );
7784
7785   application.SendNotification();
7786   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7787
7788   // We did expect the animation to finish
7789   application.SendNotification();
7790   finishCheck.CheckSignalReceived();
7791   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
7792   END_TEST;
7793 }
7794
7795 int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void)
7796 {
7797   TestApplication application;
7798
7799   Actor actor = Actor::New();
7800   application.GetScene().Add(actor);
7801   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7802
7803   // Build the animation
7804   float durationSeconds(1.0f);
7805   Animation animation = Animation::New(durationSeconds);
7806   Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7807   float delay = 0.5f;
7808   animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7809                        targetPosition,
7810                        TimePeriod( delay, durationSeconds - delay ) );
7811
7812   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7813
7814   // Start the animation
7815   animation.Play();
7816
7817   bool signalReceived(false);
7818   AnimationFinishCheck finishCheck(signalReceived);
7819   animation.FinishedSignal().Connect(&application, finishCheck);
7820
7821   application.SendNotification();
7822   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7823
7824   // We didn't expect the animation to finish yet
7825   application.SendNotification();
7826   finishCheck.CheckSignalNotReceived();
7827   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7828
7829   application.SendNotification();
7830   application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7831
7832   // We didn't expect the animation to finish yet
7833   application.SendNotification();
7834   finishCheck.CheckSignalNotReceived();
7835   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), seventyFivePercentProgress, TEST_LOCATION );
7836
7837   application.SendNotification();
7838   application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7839
7840   // We did expect the animation to finish
7841   application.SendNotification();
7842   finishCheck.CheckSignalReceived();
7843   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
7844   END_TEST;
7845 }
7846
7847 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void)
7848 {
7849   TestApplication application;
7850
7851   Actor actor = Actor::New();
7852   application.GetScene().Add(actor);
7853   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7854
7855   // Build the animation
7856   float durationSeconds(1.0f);
7857   Animation animation = Animation::New(durationSeconds);
7858   Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7859   float delay = 0.5f;
7860   animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7861                        targetPosition,
7862                        AlphaFunction::LINEAR,
7863                        TimePeriod( delay, durationSeconds - delay ) );
7864
7865   Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7866
7867   // Start the animation
7868   animation.Play();
7869
7870   bool signalReceived(false);
7871   AnimationFinishCheck finishCheck(signalReceived);
7872   animation.FinishedSignal().Connect(&application, finishCheck);
7873
7874   application.SendNotification();
7875   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7876
7877   // We didn't expect the animation to finish yet
7878   application.SendNotification();
7879   finishCheck.CheckSignalNotReceived();
7880   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7881
7882   application.SendNotification();
7883   application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7884
7885   // We didn't expect the animation to finish yet
7886   application.SendNotification();
7887   finishCheck.CheckSignalNotReceived();
7888   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), seventyFivePercentProgress, TEST_LOCATION );
7889
7890   application.SendNotification();
7891   application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7892
7893   // We did expect the animation to finish
7894   application.SendNotification();
7895   finishCheck.CheckSignalReceived();
7896   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
7897   END_TEST;
7898 }
7899
7900 int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void)
7901 {
7902   TestApplication application;
7903
7904   Actor actor = Actor::New();
7905   actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7906   application.GetScene().Add(actor);
7907   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7908
7909   // Build the animation
7910   float durationSeconds(1.0f);
7911   Animation animation = Animation::New(durationSeconds);
7912   Degree targetRotationDegrees(90.0f);
7913   Radian targetRotationRadians(targetRotationDegrees);
7914   animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS) );
7915
7916   // Start the animation
7917   animation.Play();
7918
7919   // Target value should be retrievable straight away
7920   DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7921
7922   bool signalReceived(false);
7923   AnimationFinishCheck finishCheck(signalReceived);
7924   animation.FinishedSignal().Connect(&application, finishCheck);
7925
7926   application.SendNotification();
7927   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7928
7929   // We didn't expect the animation to finish yet
7930   application.SendNotification();
7931   finishCheck.CheckSignalNotReceived();
7932   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7933
7934   application.SendNotification();
7935   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7936
7937   // We didn't expect the animation to finish yet
7938   application.SendNotification();
7939   finishCheck.CheckSignalNotReceived();
7940   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7941
7942   application.SendNotification();
7943   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7944
7945   // We didn't expect the animation to finish yet
7946   application.SendNotification();
7947   finishCheck.CheckSignalNotReceived();
7948   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7949
7950   application.SendNotification();
7951   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7952
7953   // We did expect the animation to finish
7954   application.SendNotification();
7955   finishCheck.CheckSignalReceived();
7956   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7957   END_TEST;
7958 }
7959
7960 int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void)
7961 {
7962   TestApplication application;
7963
7964   Actor actor = Actor::New();
7965   actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7966   application.GetScene().Add(actor);
7967   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7968
7969   // Build the animation
7970   float durationSeconds(1.0f);
7971   Animation animation = Animation::New(durationSeconds);
7972   Degree targetRotationDegrees(90.0f);
7973   Radian targetRotationRadians(targetRotationDegrees);
7974   Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
7975   animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), targetRotation );
7976
7977   // Start the animation
7978   animation.Play();
7979
7980   bool signalReceived(false);
7981   AnimationFinishCheck finishCheck(signalReceived);
7982   animation.FinishedSignal().Connect(&application, finishCheck);
7983
7984   application.SendNotification();
7985   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7986
7987   // We didn't expect the animation to finish yet
7988   application.SendNotification();
7989   finishCheck.CheckSignalNotReceived();
7990   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7991
7992   application.SendNotification();
7993   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7994
7995   // We didn't expect the animation to finish yet
7996   application.SendNotification();
7997   finishCheck.CheckSignalNotReceived();
7998   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7999
8000   application.SendNotification();
8001   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8002
8003   // We didn't expect the animation to finish yet
8004   application.SendNotification();
8005   finishCheck.CheckSignalNotReceived();
8006   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8007
8008   application.SendNotification();
8009   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8010
8011   // We did expect the animation to finish
8012   application.SendNotification();
8013   finishCheck.CheckSignalReceived();
8014   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8015   END_TEST;
8016 }
8017
8018 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void)
8019 {
8020   TestApplication application;
8021
8022   Actor actor = Actor::New();
8023   actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
8024   application.GetScene().Add(actor);
8025   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8026
8027   // Build the animation
8028   float durationSeconds(1.0f);
8029   Animation animation = Animation::New(durationSeconds);
8030   Degree targetRotationDegrees(90.0f);
8031   Radian targetRotationRadians(targetRotationDegrees);
8032   animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
8033
8034   // Start the animation
8035   animation.Play();
8036
8037   bool signalReceived(false);
8038   AnimationFinishCheck finishCheck(signalReceived);
8039   animation.FinishedSignal().Connect(&application, finishCheck);
8040
8041   application.SendNotification();
8042   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8043
8044   // We didn't expect the animation to finish yet
8045   application.SendNotification();
8046   finishCheck.CheckSignalNotReceived();
8047   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8048
8049   application.SendNotification();
8050   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8051
8052   // We didn't expect the animation to finish yet
8053   application.SendNotification();
8054   finishCheck.CheckSignalNotReceived();
8055   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8056
8057   application.SendNotification();
8058   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8059
8060   // We didn't expect the animation to finish yet
8061   application.SendNotification();
8062   finishCheck.CheckSignalNotReceived();
8063   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8064
8065   application.SendNotification();
8066   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8067
8068   // We did expect the animation to finish
8069   application.SendNotification();
8070   finishCheck.CheckSignalReceived();
8071   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8072   END_TEST;
8073 }
8074
8075 int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void)
8076 {
8077   TestApplication application;
8078
8079   Actor actor = Actor::New();
8080   actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
8081   application.GetScene().Add(actor);
8082   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
8083
8084   // Build the animation
8085   float durationSeconds(1.0f);
8086   Animation animation = Animation::New(durationSeconds);
8087   Degree targetRotationDegrees(90.0f);
8088   Radian targetRotationRadians(targetRotationDegrees);
8089   float delay(0.1f);
8090   animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
8091
8092   // Start the animation
8093   animation.Play();
8094
8095   bool signalReceived(false);
8096   AnimationFinishCheck finishCheck(signalReceived);
8097   animation.FinishedSignal().Connect(&application, finishCheck);
8098
8099   application.SendNotification();
8100   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8101
8102   // We didn't expect the animation to finish yet
8103   application.SendNotification();
8104   finishCheck.CheckSignalNotReceived();
8105   float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
8106   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8107
8108   application.SendNotification();
8109   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8110
8111   // We didn't expect the animation to finish yet
8112   application.SendNotification();
8113   finishCheck.CheckSignalNotReceived();
8114   progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
8115   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8116
8117   application.SendNotification();
8118   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8119
8120   // We didn't expect the animation to finish yet
8121   application.SendNotification();
8122   finishCheck.CheckSignalNotReceived();
8123   progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
8124   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8125
8126   application.SendNotification();
8127   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8128
8129   // We did expect the animation to finish
8130   application.SendNotification();
8131   finishCheck.CheckSignalReceived();
8132   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8133   END_TEST;
8134 }
8135
8136 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void)
8137 {
8138   TestApplication application;
8139
8140   Actor actor = Actor::New();
8141   actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
8142   application.GetScene().Add(actor);
8143   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
8144
8145   // Build the animation
8146   float durationSeconds(1.0f);
8147   Animation animation = Animation::New(durationSeconds);
8148   Degree targetRotationDegrees(90.0f);
8149   Radian targetRotationRadians(targetRotationDegrees);
8150   float delay(0.1f);
8151   animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
8152
8153   // Start the animation
8154   animation.Play();
8155
8156   bool signalReceived(false);
8157   AnimationFinishCheck finishCheck(signalReceived);
8158   animation.FinishedSignal().Connect(&application, finishCheck);
8159
8160   application.SendNotification();
8161   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8162
8163   // We didn't expect the animation to finish yet
8164   application.SendNotification();
8165   finishCheck.CheckSignalNotReceived();
8166   float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
8167   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8168
8169   application.SendNotification();
8170   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8171
8172   // We didn't expect the animation to finish yet
8173   application.SendNotification();
8174   finishCheck.CheckSignalNotReceived();
8175   progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
8176   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8177
8178   application.SendNotification();
8179   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8180
8181   // We didn't expect the animation to finish yet
8182   application.SendNotification();
8183   finishCheck.CheckSignalNotReceived();
8184   progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
8185   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8186
8187   application.SendNotification();
8188   application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8189
8190   // We did expect the animation to finish
8191   application.SendNotification();
8192   finishCheck.CheckSignalReceived();
8193   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8194   END_TEST;
8195 }
8196
8197 int UtcDaliAnimationAnimateToActorScaleP(void)
8198 {
8199   TestApplication application;
8200
8201   Actor actor = Actor::New();
8202   application.GetScene().Add(actor);
8203   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
8204
8205   // Build the animation
8206   float durationSeconds(1.0f);
8207   Animation animation = Animation::New(durationSeconds);
8208   Vector3 targetScale(2.0f, 2.0f, 2.0f);
8209   animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale );
8210
8211   Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f);
8212
8213   // Start the animation
8214   animation.Play();
8215
8216   // Target value should be retrievable straight away
8217   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
8218   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetScale.x, TEST_LOCATION );
8219   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetScale.y, TEST_LOCATION );
8220   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetScale.z, TEST_LOCATION );
8221
8222   bool signalReceived(false);
8223   AnimationFinishCheck finishCheck(signalReceived);
8224   animation.FinishedSignal().Connect(&application, finishCheck);
8225
8226   application.SendNotification();
8227   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8228
8229   // We didn't expect the animation to finish yet
8230   application.SendNotification();
8231   finishCheck.CheckSignalNotReceived();
8232   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), ninetyNinePercentProgress, TEST_LOCATION );
8233
8234   application.SendNotification();
8235   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8236
8237   // We did expect the animation to finish
8238   application.SendNotification();
8239   finishCheck.CheckSignalReceived();
8240   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
8241
8242   // Reset everything
8243   finishCheck.Reset();
8244   actor.SetProperty( Actor::Property::SCALE,Vector3::ONE);
8245   application.SendNotification();
8246   application.Render(0);
8247   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
8248
8249   // Repeat with a different (ease-in) alpha function
8250   animation = Animation::New(durationSeconds);
8251   animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
8252   animation.FinishedSignal().Connect(&application, finishCheck);
8253   animation.Play();
8254
8255   application.SendNotification();
8256   application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8257
8258   // We didn't expect the animation to finish yet
8259   application.SendNotification();
8260   finishCheck.CheckSignalNotReceived();
8261
8262   // The scale should have grown less, than with a linear alpha function
8263   Vector3 current(actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ));
8264   DALI_TEST_CHECK( current.x > 1.0f );
8265   DALI_TEST_CHECK( current.y > 1.0f );
8266   DALI_TEST_CHECK( current.z > 1.0f );
8267   DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
8268   DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
8269   DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
8270
8271   application.SendNotification();
8272   application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8273
8274   // We did expect the animation to finish
8275   application.SendNotification();
8276   finishCheck.CheckSignalReceived();
8277   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
8278
8279   // Reset everything
8280   finishCheck.Reset();
8281   actor.SetProperty( Actor::Property::SCALE,Vector3::ONE);
8282   application.SendNotification();
8283   application.Render(0);
8284   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
8285
8286   // Repeat with a delay
8287   float delay = 0.5f;
8288   animation = Animation::New(durationSeconds);
8289   animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
8290   animation.FinishedSignal().Connect(&application, finishCheck);
8291   animation.Play();
8292
8293   application.SendNotification();
8294   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
8295
8296   // We didn't expect the animation to finish yet
8297   application.SendNotification();
8298   finishCheck.CheckSignalNotReceived();
8299   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
8300
8301   application.SendNotification();
8302   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8303
8304   // We did expect the animation to finish
8305   application.SendNotification();
8306   finishCheck.CheckSignalReceived();
8307   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
8308   END_TEST;
8309 }
8310
8311 int UtcDaliAnimationAnimateToActorScaleXP(void)
8312 {
8313   TestApplication application;
8314
8315   Actor actor = Actor::New();
8316   application.GetScene().Add(actor);
8317   float startValue(1.0f);
8318   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).x, startValue, TEST_LOCATION );
8319   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
8320   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
8321   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
8322   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8323   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8324   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8325
8326   // Build the animation
8327   float durationSeconds(1.0f);
8328   Animation animation = Animation::New(durationSeconds);
8329   float targetX(10.0f);
8330   animation.AnimateTo( Property(actor, Actor::Property::SCALE_X), targetX );
8331
8332   float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
8333
8334   // Start the animation
8335   animation.Play();
8336
8337   // Target value should be retrievable straight away
8338   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( targetX, startValue, startValue ), TEST_LOCATION );
8339   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetX, TEST_LOCATION );
8340
8341   bool signalReceived(false);
8342   AnimationFinishCheck finishCheck(signalReceived);
8343   animation.FinishedSignal().Connect(&application, finishCheck);
8344
8345   application.SendNotification();
8346   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8347
8348   // We didn't expect the animation to finish yet
8349   application.SendNotification();
8350   finishCheck.CheckSignalNotReceived();
8351   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).x, fiftyPercentProgress, TEST_LOCATION );
8352   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), fiftyPercentProgress, TEST_LOCATION );
8353   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8354   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8355
8356   application.SendNotification();
8357   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8358
8359   // We did expect the animation to finish
8360   application.SendNotification();
8361   finishCheck.CheckSignalReceived();
8362   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).x, targetX, TEST_LOCATION );
8363   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), targetX, TEST_LOCATION );
8364   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8365   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8366   END_TEST;
8367 }
8368
8369 int UtcDaliAnimationAnimateToActorScaleYP(void)
8370 {
8371   TestApplication application;
8372
8373   Actor actor = Actor::New();
8374   application.GetScene().Add(actor);
8375   float startValue(1.0f);
8376   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).y, startValue, TEST_LOCATION );
8377   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
8378   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
8379   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
8380   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8381   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8382   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8383
8384   // Build the animation
8385   float durationSeconds(1.0f);
8386   Animation animation = Animation::New(durationSeconds);
8387   float targetY(1000.0f);
8388   animation.AnimateTo( Property(actor, Actor::Property::SCALE_Y), targetY );
8389
8390   float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
8391
8392   // Start the animation
8393   animation.Play();
8394
8395   // Target value should be retrievable straight away
8396   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, targetY, startValue ), TEST_LOCATION );
8397   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetY, TEST_LOCATION );
8398
8399   bool signalReceived(false);
8400   AnimationFinishCheck finishCheck(signalReceived);
8401   animation.FinishedSignal().Connect(&application, finishCheck);
8402
8403   application.SendNotification();
8404   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8405
8406   // We didn't expect the animation to finish yet
8407   application.SendNotification();
8408   finishCheck.CheckSignalNotReceived();
8409   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).y, fiftyPercentProgress, TEST_LOCATION );
8410   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8411   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), fiftyPercentProgress, TEST_LOCATION );
8412   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8413
8414   application.SendNotification();
8415   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8416
8417   // We did expect the animation to finish
8418   application.SendNotification();
8419   finishCheck.CheckSignalReceived();
8420   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).y, targetY, TEST_LOCATION );
8421   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8422   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), targetY, TEST_LOCATION );
8423   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8424   END_TEST;
8425 }
8426
8427 int UtcDaliAnimationAnimateToActorScaleZP(void)
8428 {
8429   TestApplication application;
8430
8431   Actor actor = Actor::New();
8432   application.GetScene().Add(actor);
8433   float startValue(1.0f);
8434   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).z, startValue, TEST_LOCATION );
8435   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
8436   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
8437   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
8438   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8439   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8440   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8441
8442   // Build the animation
8443   float durationSeconds(1.0f);
8444   Animation animation = Animation::New(durationSeconds);
8445   float targetZ(-1000.0f);
8446   animation.AnimateTo( Property(actor, Actor::Property::SCALE_Z), targetZ );
8447
8448   float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
8449
8450   // Start the animation
8451   animation.Play();
8452
8453   // Target value should be retrievable straight away
8454   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, startValue, targetZ ), TEST_LOCATION );
8455   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION );
8456
8457   bool signalReceived(false);
8458   AnimationFinishCheck finishCheck(signalReceived);
8459   animation.FinishedSignal().Connect(&application, finishCheck);
8460
8461   application.SendNotification();
8462   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8463
8464   // We didn't expect the animation to finish yet
8465   application.SendNotification();
8466   finishCheck.CheckSignalNotReceived();
8467   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).z, fiftyPercentProgress, TEST_LOCATION );
8468   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8469   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8470   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), fiftyPercentProgress, TEST_LOCATION );
8471
8472   application.SendNotification();
8473   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8474
8475   // We did expect the animation to finish
8476   application.SendNotification();
8477   finishCheck.CheckSignalReceived();
8478   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).z, targetZ, TEST_LOCATION );
8479   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8480   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8481   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION );
8482   END_TEST;
8483 }
8484
8485 int UtcDaliAnimationAnimateToActorColorP(void)
8486 {
8487   TestApplication application;
8488
8489   Actor actor = Actor::New();
8490   application.GetScene().Add(actor);
8491   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
8492
8493   // Build the animation
8494   float durationSeconds(1.0f);
8495   Animation animation = Animation::New(durationSeconds);
8496   Vector4 targetColor(Color::RED);
8497   animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor );
8498
8499   Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
8500   Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
8501
8502   // Start the animation
8503   animation.Play();
8504
8505   // Target value should be retrievable straight away
8506   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
8507   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
8508   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
8509   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
8510   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
8511   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::OPACITY ), targetColor.a, TEST_LOCATION );
8512
8513   bool signalReceived(false);
8514   AnimationFinishCheck finishCheck(signalReceived);
8515   animation.FinishedSignal().Connect(&application, finishCheck);
8516
8517   application.SendNotification();
8518   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8519
8520   // We didn't expect the animation to finish yet
8521   application.SendNotification();
8522   finishCheck.CheckSignalNotReceived();
8523   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), tenPercentProgress, TEST_LOCATION );
8524
8525   application.SendNotification();
8526   application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
8527
8528   // We did expect the animation to finish
8529   application.SendNotification();
8530   finishCheck.CheckSignalReceived();
8531   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
8532
8533   // Reset everything
8534   finishCheck.Reset();
8535   actor.SetProperty( Actor::Property::COLOR,Color::WHITE);
8536   application.SendNotification();
8537   application.Render(0);
8538   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
8539
8540   // Repeat with a different (ease-in) alpha function
8541   animation = Animation::New(durationSeconds);
8542   animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
8543   animation.FinishedSignal().Connect(&application, finishCheck);
8544   animation.Play();
8545
8546   application.SendNotification();
8547   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8548
8549   // We didn't expect the animation to finish yet
8550   application.SendNotification();
8551   finishCheck.CheckSignalNotReceived();
8552
8553   // The color should have changed less, than with a linear alpha function
8554   Vector4 current(actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ));
8555   DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change
8556   DALI_TEST_CHECK( current.y < 1.0f );
8557   DALI_TEST_CHECK( current.y > tenPercentProgress.y );
8558   DALI_TEST_CHECK( current.z  < 1.0f );
8559   DALI_TEST_CHECK( current.z  > tenPercentProgress.z );
8560   DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
8561
8562   application.SendNotification();
8563   application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
8564
8565   // We did expect the animation to finish
8566   application.SendNotification();
8567   finishCheck.CheckSignalReceived();
8568   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
8569
8570   // Reset everything
8571   finishCheck.Reset();
8572   actor.SetProperty( Actor::Property::COLOR,Color::WHITE);
8573   application.SendNotification();
8574   application.Render(0);
8575   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
8576
8577   // Repeat with a shorter animator duration
8578   float animatorDuration = 0.5f;
8579   animation = Animation::New(durationSeconds);
8580   animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
8581   animation.FinishedSignal().Connect(&application, finishCheck);
8582   animation.Play();
8583
8584   application.SendNotification();
8585   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
8586
8587   // We didn't expect the animation to finish yet
8588   application.SendNotification();
8589   finishCheck.CheckSignalNotReceived();
8590   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), twentyPercentProgress, TEST_LOCATION );
8591
8592   application.SendNotification();
8593   application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
8594
8595   // We didn't expect the animation to finish yet
8596   application.SendNotification();
8597   finishCheck.CheckSignalNotReceived();
8598   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
8599
8600   application.SendNotification();
8601   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8602
8603   // We did expect the animation to finish
8604   application.SendNotification();
8605   finishCheck.CheckSignalReceived();
8606   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
8607   END_TEST;
8608 }
8609
8610 int UtcDaliAnimationAnimateToActorColorRedP(void)
8611 {
8612   TestApplication application;
8613
8614   Actor actor = Actor::New();
8615   application.GetScene().Add(actor);
8616   float startValue(1.0f);
8617   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).r, startValue, TEST_LOCATION );
8618   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8619   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8620   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8621   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8622   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8623   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8624   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8625   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8626
8627   // Build the animation
8628   float durationSeconds(1.0f);
8629   Animation animation = Animation::New(durationSeconds);
8630   float targetRed(0.5f);
8631   animation.AnimateTo( Property(actor, Actor::Property::COLOR_RED), targetRed );
8632
8633   float fiftyPercentProgress(startValue + (targetRed - startValue)*0.5f);
8634
8635   // Start the animation
8636   animation.Play();
8637
8638   // Target value should be retrievable straight away
8639   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( targetRed, startValue, startValue, startValue ), TEST_LOCATION );
8640   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetRed, TEST_LOCATION );
8641
8642   bool signalReceived(false);
8643   AnimationFinishCheck finishCheck(signalReceived);
8644   animation.FinishedSignal().Connect(&application, finishCheck);
8645
8646   application.SendNotification();
8647   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8648
8649   // We didn't expect the animation to finish yet
8650   application.SendNotification();
8651   finishCheck.CheckSignalNotReceived();
8652   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).r, fiftyPercentProgress, TEST_LOCATION );
8653   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED),   fiftyPercentProgress, TEST_LOCATION );
8654   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue,           TEST_LOCATION );
8655   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE),  startValue,           TEST_LOCATION );
8656   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue,           TEST_LOCATION );
8657
8658   application.SendNotification();
8659   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8660
8661   // We did expect the animation to finish
8662   application.SendNotification();
8663   finishCheck.CheckSignalReceived();
8664   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).r, targetRed, TEST_LOCATION );
8665   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED),   targetRed,  TEST_LOCATION );
8666   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8667   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8668   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8669   END_TEST;
8670 }
8671
8672 int UtcDaliAnimationAnimateToActorColorGreenP(void)
8673 {
8674   TestApplication application;
8675
8676   Actor actor = Actor::New();
8677   application.GetScene().Add(actor);
8678   float startValue(1.0f);
8679   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).g, startValue, TEST_LOCATION );
8680   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8681   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8682   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8683   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8684   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8685   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8686   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8687   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8688
8689   // Build the animation
8690   float durationSeconds(1.0f);
8691   Animation animation = Animation::New(durationSeconds);
8692   float targetGreen(0.5f);
8693   animation.AnimateTo( Property(actor, Actor::Property::COLOR_GREEN), targetGreen );
8694
8695   float fiftyPercentProgress(startValue + (targetGreen - startValue)*0.5f);
8696
8697   // Start the animation
8698   animation.Play();
8699
8700   // Target value should be retrievable straight away
8701   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, targetGreen, startValue, startValue ), TEST_LOCATION );
8702   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetGreen, TEST_LOCATION );
8703
8704   bool signalReceived(false);
8705   AnimationFinishCheck finishCheck(signalReceived);
8706   animation.FinishedSignal().Connect(&application, finishCheck);
8707
8708   application.SendNotification();
8709   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8710
8711   // We didn't expect the animation to finish yet
8712   application.SendNotification();
8713   finishCheck.CheckSignalNotReceived();
8714   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).g, fiftyPercentProgress, TEST_LOCATION );
8715   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED),   startValue,           TEST_LOCATION );
8716   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION );
8717   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE),  startValue,           TEST_LOCATION );
8718   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue,           TEST_LOCATION );
8719
8720   application.SendNotification();
8721   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8722
8723   // We did expect the animation to finish
8724   application.SendNotification();
8725   finishCheck.CheckSignalReceived();
8726   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).g, targetGreen, TEST_LOCATION );
8727   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED),   startValue,  TEST_LOCATION );
8728   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION );
8729   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE),  startValue,  TEST_LOCATION );
8730   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue,  TEST_LOCATION );
8731   END_TEST;
8732 }
8733
8734 int UtcDaliAnimationAnimateToActorColorBlueP(void)
8735 {
8736   TestApplication application;
8737
8738   Actor actor = Actor::New();
8739   application.GetScene().Add(actor);
8740   float startValue(1.0f);
8741   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).b, startValue, TEST_LOCATION );
8742   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8743   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8744   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8745   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8746   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8747   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8748   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8749   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8750
8751   // Build the animation
8752   float durationSeconds(1.0f);
8753   Animation animation = Animation::New(durationSeconds);
8754   float targetBlue(0.5f);
8755   animation.AnimateTo( Property(actor, Actor::Property::COLOR_BLUE), targetBlue );
8756
8757   float fiftyPercentProgress(startValue + (targetBlue - startValue)*0.5f);
8758
8759   // Start the animation
8760   animation.Play();
8761
8762   // Target value should be retrievable straight away
8763   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, targetBlue, startValue ), TEST_LOCATION );
8764   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetBlue, TEST_LOCATION );
8765
8766   bool signalReceived(false);
8767   AnimationFinishCheck finishCheck(signalReceived);
8768   animation.FinishedSignal().Connect(&application, finishCheck);
8769
8770   application.SendNotification();
8771   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8772
8773   // We didn't expect the animation to finish yet
8774   application.SendNotification();
8775   finishCheck.CheckSignalNotReceived();
8776   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).b, fiftyPercentProgress, TEST_LOCATION );
8777   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue,           TEST_LOCATION );
8778   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue,           TEST_LOCATION );
8779   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  fiftyPercentProgress, TEST_LOCATION );
8780   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue,           TEST_LOCATION );
8781
8782   application.SendNotification();
8783   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8784
8785   // We did expect the animation to finish
8786   application.SendNotification();
8787   finishCheck.CheckSignalReceived();
8788   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).b, targetBlue, TEST_LOCATION );
8789   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8790   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8791   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  targetBlue, TEST_LOCATION );
8792   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8793   END_TEST;
8794 }
8795
8796 int UtcDaliAnimationAnimateToActorColorAlphaP(void)
8797 {
8798   TestApplication application;
8799
8800   Actor actor = Actor::New();
8801   application.GetScene().Add(actor);
8802   float startValue(1.0f);
8803   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
8804   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
8805   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8806   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
8807   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8808   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
8809   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8810   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
8811   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8812
8813   // Build the animation
8814   float durationSeconds(1.0f);
8815   Animation animation = Animation::New(durationSeconds);
8816   float targetAlpha(0.5f);
8817   animation.AnimateTo( Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha );
8818
8819   float fiftyPercentProgress(startValue + (targetAlpha - startValue)*0.5f);
8820
8821   // Start the animation
8822   animation.Play();
8823
8824   // Target value should be retrievable straight away
8825   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, startValue, targetAlpha ), TEST_LOCATION );
8826   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
8827   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::OPACITY ), targetAlpha, TEST_LOCATION );
8828
8829   bool signalReceived(false);
8830   AnimationFinishCheck finishCheck(signalReceived);
8831   animation.FinishedSignal().Connect(&application, finishCheck);
8832
8833   application.SendNotification();
8834   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8835
8836   // We didn't expect the animation to finish yet
8837   application.SendNotification();
8838   finishCheck.CheckSignalNotReceived();
8839   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, fiftyPercentProgress, TEST_LOCATION );
8840   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue,           TEST_LOCATION );
8841   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue,           TEST_LOCATION );
8842   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue,           TEST_LOCATION );
8843   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), fiftyPercentProgress, TEST_LOCATION );
8844
8845   application.SendNotification();
8846   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8847
8848   // We did expect the animation to finish
8849   application.SendNotification();
8850   finishCheck.CheckSignalReceived();
8851   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, targetAlpha, TEST_LOCATION );
8852   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue,  TEST_LOCATION );
8853   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue,  TEST_LOCATION );
8854   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue,  TEST_LOCATION );
8855   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
8856   END_TEST;
8857 }
8858
8859 int UtcDaliAnimationKeyFrames01P(void)
8860 {
8861   TestApplication application;
8862
8863   KeyFrames keyFrames = KeyFrames::New();
8864   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8865
8866   keyFrames.Add(0.0f, 0.1f);
8867
8868   DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8869
8870   KeyFrames keyFrames2( keyFrames);
8871   DALI_TEST_CHECK( keyFrames2 );
8872   DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
8873
8874   KeyFrames keyFrames3 = KeyFrames::New();
8875   keyFrames3.Add(0.6f, true);
8876   DALI_TEST_CHECK( keyFrames3 );
8877   DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
8878
8879   keyFrames3 = keyFrames;
8880   DALI_TEST_CHECK( keyFrames3 );
8881   DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
8882
8883   END_TEST;
8884 }
8885
8886 int UtcDaliAnimationKeyFrames02N(void)
8887 {
8888   TestApplication application;
8889
8890   KeyFrames keyFrames = KeyFrames::New();
8891   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8892
8893   keyFrames.Add(0.0f, 0.1f);
8894   keyFrames.Add(0.2f, 0.5f);
8895   keyFrames.Add(0.4f, 0.0f);
8896   keyFrames.Add(0.6f, 1.0f);
8897   keyFrames.Add(0.8f, 0.7f);
8898   keyFrames.Add(1.0f, 0.9f);
8899
8900   DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8901
8902   DALI_TEST_ASSERTION(
8903   {
8904     keyFrames.Add(1.9f, false);
8905   }, "mType == value.GetType()" );
8906
8907   END_TEST;
8908 }
8909
8910 int UtcDaliAnimationKeyFrames03N(void)
8911 {
8912   TestApplication application;
8913
8914   KeyFrames keyFrames = KeyFrames::New();
8915   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8916
8917   keyFrames.Add(0.0f, true);
8918   keyFrames.Add(0.2f, false);
8919   keyFrames.Add(0.4f, false);
8920   keyFrames.Add(0.6f, true);
8921   keyFrames.Add(0.8f, true);
8922   keyFrames.Add(1.0f, false);
8923
8924   DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
8925
8926   DALI_TEST_ASSERTION(
8927   {
8928     keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8929   }, "mType == value.GetType()" );
8930
8931   END_TEST;
8932 }
8933
8934 int UtcDaliAnimationKeyFrames04N(void)
8935 {
8936   TestApplication application;
8937
8938   KeyFrames keyFrames = KeyFrames::New();
8939   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8940
8941   keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
8942   keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
8943   keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
8944   keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
8945   keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
8946   keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
8947
8948   DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
8949
8950   DALI_TEST_ASSERTION(
8951   {
8952     keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8953   }, "mType == value.GetType()" );
8954
8955   END_TEST;
8956 }
8957
8958 int UtcDaliAnimationKeyFrames05N(void)
8959 {
8960   TestApplication application;
8961
8962   KeyFrames keyFrames = KeyFrames::New();
8963   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8964
8965   keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
8966   keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
8967   keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
8968   keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
8969   keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
8970   keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
8971
8972   DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
8973
8974   DALI_TEST_ASSERTION(
8975   {
8976     keyFrames.Add(0.7f, 1.0f);
8977   }, "mType == value.GetType()" );
8978
8979   END_TEST;
8980 }
8981
8982 int UtcDaliAnimationKeyFrames06N(void)
8983 {
8984   TestApplication application;
8985
8986   KeyFrames keyFrames = KeyFrames::New();
8987   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8988
8989   keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
8990   keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8991   keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
8992   keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
8993   keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
8994   keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
8995
8996   DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
8997
8998   DALI_TEST_ASSERTION(
8999   {
9000     keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
9001   }, "mType == value.GetType()" );
9002
9003   END_TEST;
9004 }
9005
9006 int UtcDaliAnimationKeyFrames07N(void)
9007 {
9008   TestApplication application;
9009
9010   KeyFrames keyFrames = KeyFrames::New();
9011   DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9012
9013   keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
9014   keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
9015   keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
9016   keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
9017   keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
9018   keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
9019
9020   DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
9021
9022   DALI_TEST_ASSERTION(
9023   {
9024     keyFrames.Add(0.7f, 1.1f);
9025   }, "mType == value.GetType()" );
9026
9027   END_TEST;
9028 }
9029
9030 int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
9031 {
9032   TestApplication application;
9033
9034   float startValue(1.0f);
9035   Actor actor = Actor::New();
9036   actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue));
9037   application.GetScene().Add(actor);
9038
9039   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
9040   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9041   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9042   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9043   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9044   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9045   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9046   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9047   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9048
9049   // Build the animation
9050   float durationSeconds(1.0f);
9051   Animation animation = Animation::New(durationSeconds);
9052
9053   KeyFrames keyFrames = KeyFrames::New();
9054   keyFrames.Add(0.0f, 0.1f);
9055   keyFrames.Add(0.2f, 0.5f);
9056   keyFrames.Add(0.4f, 0.0f);
9057   keyFrames.Add(0.6f, 1.0f);
9058   keyFrames.Add(0.8f, 0.7f);
9059   keyFrames.Add(1.0f, 0.9f);
9060
9061   animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames );
9062
9063   // Start the animation
9064   animation.Play();
9065
9066   // Final key frame value should be retrievable straight away
9067   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), 0.9f, TEST_LOCATION );
9068
9069   bool signalReceived(false);
9070   AnimationFinishCheck finishCheck(signalReceived);
9071   animation.FinishedSignal().Connect(&application, finishCheck);
9072   application.SendNotification();
9073   application.Render(0);
9074   application.SendNotification();
9075   finishCheck.CheckSignalNotReceived();
9076   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.1f, TEST_LOCATION );
9077
9078   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
9079   application.SendNotification();
9080   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9081   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9082   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9083   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION );
9084   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.3f, 0.01f, TEST_LOCATION );
9085
9086   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
9087   application.SendNotification();
9088   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9089   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9090   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9091   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION );
9092   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.25f, 0.01f, TEST_LOCATION );
9093
9094   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
9095   application.SendNotification();
9096   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9097   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9098   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9099   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
9100   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.0f, 0.01f, TEST_LOCATION );
9101
9102   application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
9103   application.SendNotification();
9104   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9105   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9106   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9107   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
9108   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.7f, 0.01f, TEST_LOCATION );
9109
9110   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
9111   application.SendNotification();
9112   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9113   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9114   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9115   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION );
9116   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.8f, 0.01f, TEST_LOCATION );
9117
9118   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
9119   application.SendNotification();
9120   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9121   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9122   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9123   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
9124   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.9f, 0.01f, TEST_LOCATION );
9125
9126   // We did expect the animation to finish
9127
9128   finishCheck.CheckSignalReceived();
9129   END_TEST;
9130 }
9131
9132 int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
9133 {
9134   TestApplication application;
9135
9136   float startValue(1.0f);
9137   Actor actor = Actor::New();
9138   actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue));
9139   application.GetScene().Add(actor);
9140
9141   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
9142   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9143   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9144   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9145   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9146   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9147   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9148   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9149   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9150
9151   // Build the animation
9152   float durationSeconds(1.0f);
9153   Animation animation = Animation::New(durationSeconds);
9154
9155   KeyFrames keyFrames = KeyFrames::New();
9156   keyFrames.Add(0.0f, 0.1f);
9157   keyFrames.Add(0.2f, 0.5f);
9158   keyFrames.Add(0.4f, 0.0f);
9159   keyFrames.Add(0.6f, 1.0f);
9160   keyFrames.Add(0.8f, 0.7f);
9161   keyFrames.Add(1.0f, 0.9f);
9162
9163   animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::Cubic );
9164
9165   // Start the animation
9166   animation.Play();
9167
9168   bool signalReceived(false);
9169   AnimationFinishCheck finishCheck(signalReceived);
9170   animation.FinishedSignal().Connect(&application, finishCheck);
9171   application.SendNotification();
9172   application.Render(0);
9173   application.SendNotification();
9174   finishCheck.CheckSignalNotReceived();
9175   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.1f, TEST_LOCATION );
9176
9177   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
9178   application.SendNotification();
9179   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9180   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9181   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9182   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.36f, 0.01f, TEST_LOCATION );
9183   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.36f, 0.01f, TEST_LOCATION );
9184
9185   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
9186   application.SendNotification();
9187   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9188   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9189   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9190   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.21f, 0.01f, TEST_LOCATION );
9191   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.21f, 0.01f, TEST_LOCATION );
9192
9193   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
9194   application.SendNotification();
9195   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9196   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9197   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9198   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.0f, 0.01f, TEST_LOCATION );
9199   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.0f, 0.01f, TEST_LOCATION );
9200
9201   application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
9202   application.SendNotification();
9203   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9204   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9205   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9206   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7f, 0.01f, TEST_LOCATION );
9207   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.7f, 0.01f, TEST_LOCATION );
9208
9209   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
9210   application.SendNotification();
9211   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9212   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9213   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9214   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.76f, 0.01f, TEST_LOCATION );
9215   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.76f, 0.01f, TEST_LOCATION );
9216
9217   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
9218   application.SendNotification();
9219   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9220   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9221   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9222   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.9f, 0.01f, TEST_LOCATION );
9223   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.9f, 0.01f, TEST_LOCATION );
9224
9225   // We did expect the animation to finish
9226
9227   finishCheck.CheckSignalReceived();
9228   END_TEST;
9229 }
9230
9231 int UtcDaliAnimationAnimateBetweenActorColorP(void)
9232 {
9233   TestApplication application;
9234
9235   float startValue(1.0f);
9236   Actor actor = Actor::New();
9237   actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue));
9238   application.GetScene().Add(actor);
9239
9240   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
9241   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9242   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9243   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9244   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9245   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9246   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9247   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9248   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9249
9250   // Build the animation
9251   float durationSeconds(1.0f);
9252   Animation animation = Animation::New(durationSeconds);
9253
9254   KeyFrames keyFrames = KeyFrames::New();
9255   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9256   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9257   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9258
9259   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames );
9260
9261   // Start the animation
9262   animation.Play();
9263
9264   bool signalReceived(false);
9265   AnimationFinishCheck finishCheck(signalReceived);
9266   animation.FinishedSignal().Connect(&application, finishCheck);
9267   application.SendNotification();
9268   application.Render(0);
9269   application.SendNotification();
9270   finishCheck.CheckSignalNotReceived();
9271   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
9272   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9273   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
9274   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9275
9276   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9277   application.SendNotification();
9278   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.5f, 0.01f, TEST_LOCATION );
9279   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9280   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.5f, 0.01f, TEST_LOCATION );
9281   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9282
9283   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9284   application.SendNotification();
9285   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
9286   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9287   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
9288   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9289
9290   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9291   application.SendNotification();
9292   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.95f, 0.01f, TEST_LOCATION );
9293   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9294   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.85f, 0.01f, TEST_LOCATION );
9295   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9296
9297   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9298   application.SendNotification();
9299   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
9300   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9301   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
9302   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9303
9304   // We did expect the animation to finish
9305
9306   finishCheck.CheckSignalReceived();
9307   END_TEST;
9308 }
9309
9310 int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
9311 {
9312   TestApplication application;
9313
9314   float startValue(1.0f);
9315   Actor actor = Actor::New();
9316   actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue));
9317   application.GetScene().Add(actor);
9318
9319   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
9320   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9321   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9322   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9323   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9324   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9325   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9326   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9327   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9328
9329   // Build the animation
9330   float durationSeconds(1.0f);
9331   Animation animation = Animation::New(durationSeconds);
9332
9333   KeyFrames keyFrames = KeyFrames::New();
9334   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9335   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9336   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9337
9338   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, Animation::Cubic );
9339
9340   // Start the animation
9341   animation.Play();
9342
9343   bool signalReceived(false);
9344   AnimationFinishCheck finishCheck(signalReceived);
9345   animation.FinishedSignal().Connect(&application, finishCheck);
9346   application.SendNotification();
9347   application.Render(0);
9348   application.SendNotification();
9349   finishCheck.CheckSignalNotReceived();
9350   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
9351   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9352   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
9353   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9354
9355   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9356   application.SendNotification();
9357   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.55f, 0.01f, TEST_LOCATION );
9358   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9359   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.506f, 0.01f, TEST_LOCATION );
9360   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9361
9362   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9363   application.SendNotification();
9364   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
9365   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9366   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
9367   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9368
9369   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9370   application.SendNotification();
9371   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.99375f, 0.01f, TEST_LOCATION );
9372   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9373   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.85625f, 0.01f, TEST_LOCATION );
9374   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9375
9376   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9377   application.SendNotification();
9378   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
9379   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9380   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
9381   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9382
9383   // We did expect the animation to finish
9384
9385   finishCheck.CheckSignalReceived();
9386   END_TEST;
9387 }
9388
9389 int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
9390 {
9391   TestApplication application;
9392
9393   Actor actor = Actor::New();
9394   AngleAxis aa(Degree(90), Vector3::XAXIS);
9395   actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis) );
9396   application.GetScene().Add(actor);
9397
9398   application.SendNotification();
9399   application.Render(0);
9400
9401   DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
9402
9403   // Build the animation
9404   float durationSeconds(1.0f);
9405   Animation animation = Animation::New(durationSeconds);
9406
9407   KeyFrames keyFrames = KeyFrames::New();
9408   keyFrames.Add(0.0f, false);
9409   keyFrames.Add(0.2f, true);
9410   keyFrames.Add(0.4f, true);
9411   keyFrames.Add(0.8f, false);
9412   keyFrames.Add(1.0f, true);
9413
9414   animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames );
9415
9416   // Start the animation
9417   animation.Play();
9418
9419   // Final key frame value should be retrievable straight away
9420   DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
9421
9422   bool signalReceived(false);
9423   AnimationFinishCheck finishCheck(signalReceived);
9424   animation.FinishedSignal().Connect(&application, finishCheck);
9425   application.SendNotification();
9426   application.SendNotification();
9427   application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9428   application.SendNotification();
9429   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9430   application.SendNotification();
9431
9432   DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION);
9433   finishCheck.CheckSignalReceived();
9434   END_TEST;
9435 }
9436
9437 int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
9438 {
9439   TestApplication application;
9440
9441   Actor actor = Actor::New();
9442   AngleAxis aa(Degree(90), Vector3::XAXIS);
9443   actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis) );
9444   application.GetScene().Add(actor);
9445
9446   application.SendNotification();
9447   application.Render(0);
9448
9449   DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
9450
9451   // Build the animation
9452   float durationSeconds(1.0f);
9453   Animation animation = Animation::New(durationSeconds);
9454
9455   KeyFrames keyFrames = KeyFrames::New();
9456   keyFrames.Add(0.0f, false);
9457   keyFrames.Add(0.2f, true);
9458   keyFrames.Add(0.4f, true);
9459   keyFrames.Add(0.8f, false);
9460   keyFrames.Add(1.0f, true);
9461
9462   //Cubic interpolation for boolean values should be ignored
9463   animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::Cubic );
9464
9465   // Start the animation
9466   animation.Play();
9467
9468   bool signalReceived(false);
9469   AnimationFinishCheck finishCheck(signalReceived);
9470   animation.FinishedSignal().Connect(&application, finishCheck);
9471   application.SendNotification();
9472   application.SendNotification();
9473   application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9474   application.SendNotification();
9475   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9476   application.SendNotification();
9477
9478   DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION);
9479   finishCheck.CheckSignalReceived();
9480   END_TEST;
9481 }
9482
9483 int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
9484 {
9485   TestApplication application;
9486
9487   Actor actor = Actor::New();
9488   AngleAxis aa(Degree(90), Vector3::XAXIS);
9489   actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis) );
9490   application.GetScene().Add(actor);
9491
9492   application.SendNotification();
9493   application.Render(0);
9494   Quaternion start(Radian(aa.angle), aa.axis);
9495   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), start, 0.001f, TEST_LOCATION );
9496
9497   // Build the animation
9498   float durationSeconds(1.0f);
9499   Animation animation = Animation::New(durationSeconds);
9500
9501   KeyFrames keyFrames = KeyFrames::New();
9502   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9503
9504   animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
9505
9506   // Start the animation
9507   animation.Play();
9508
9509   // Final key frame value should be retrievable straight away
9510   DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Degree( 60 ), Vector3::ZAXIS ), TEST_LOCATION );
9511
9512   bool signalReceived(false);
9513   AnimationFinishCheck finishCheck(signalReceived);
9514   animation.FinishedSignal().Connect(&application, finishCheck);
9515   application.SendNotification();
9516   application.SendNotification();
9517   application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9518   application.SendNotification();
9519   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9520   application.SendNotification();
9521
9522   Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
9523
9524   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
9525   finishCheck.CheckSignalReceived();
9526   END_TEST;
9527 }
9528
9529 int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
9530 {
9531   TestApplication application;
9532
9533   Actor actor = Actor::New();
9534   AngleAxis aa(Degree(90), Vector3::XAXIS);
9535   actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis) );
9536   application.SendNotification();
9537   application.Render(0);
9538   application.GetScene().Add(actor);
9539
9540   Quaternion start(Radian(aa.angle), aa.axis);
9541   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), start, 0.001f, TEST_LOCATION );
9542
9543   // Build the animation
9544   float durationSeconds(1.0f);
9545   Animation animation = Animation::New(durationSeconds);
9546
9547   KeyFrames keyFrames = KeyFrames::New();
9548   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9549   keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9550   keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9551
9552   animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
9553
9554   // Start the animation
9555   animation.Play();
9556
9557   bool signalReceived(false);
9558   AnimationFinishCheck finishCheck(signalReceived);
9559   animation.FinishedSignal().Connect(&application, finishCheck);
9560   application.SendNotification();
9561   application.Render(0);
9562   application.SendNotification();
9563   finishCheck.CheckSignalNotReceived();
9564
9565   Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9566   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
9567
9568   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9569   application.SendNotification();
9570   check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
9571   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
9572
9573   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9574   application.SendNotification();
9575   check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
9576   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
9577
9578   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9579   application.SendNotification();
9580   check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f) );
9581   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
9582
9583   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9584   application.SendNotification();
9585   check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
9586   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
9587
9588   // We did expect the animation to finish
9589
9590   finishCheck.CheckSignalReceived();
9591   END_TEST;
9592 }
9593
9594 int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
9595 {
9596   TestApplication application;
9597
9598   Actor actor = Actor::New();
9599   AngleAxis aa(Degree(90), Vector3::XAXIS);
9600   actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis) );
9601   application.GetScene().Add(actor);
9602
9603   application.SendNotification();
9604   application.Render(0);
9605   Quaternion start(Radian(aa.angle), aa.axis);
9606   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), start, 0.001f, TEST_LOCATION );
9607
9608   // Build the animation
9609   float durationSeconds(1.0f);
9610   Animation animation = Animation::New(durationSeconds);
9611
9612   KeyFrames keyFrames = KeyFrames::New();
9613   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9614
9615   //Cubic interpolation should be ignored for quaternions
9616   animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
9617
9618   // Start the animation
9619   animation.Play();
9620
9621   bool signalReceived(false);
9622   AnimationFinishCheck finishCheck(signalReceived);
9623   animation.FinishedSignal().Connect(&application, finishCheck);
9624   application.SendNotification();
9625   application.SendNotification();
9626   application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9627   application.SendNotification();
9628   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9629   application.SendNotification();
9630
9631   Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
9632
9633   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
9634   finishCheck.CheckSignalReceived();
9635   END_TEST;
9636 }
9637
9638 int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
9639 {
9640   TestApplication application;
9641
9642   Actor actor = Actor::New();
9643   AngleAxis aa(Degree(90), Vector3::XAXIS);
9644   actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis) );
9645   application.SendNotification();
9646   application.Render(0);
9647   application.GetScene().Add(actor);
9648
9649   Quaternion start(Radian(aa.angle), aa.axis);
9650   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), start, 0.001f, TEST_LOCATION );
9651
9652   // Build the animation
9653   float durationSeconds(1.0f);
9654   Animation animation = Animation::New(durationSeconds);
9655
9656   KeyFrames keyFrames = KeyFrames::New();
9657   keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9658   keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9659   keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9660
9661   //Cubic interpolation should be ignored for quaternions
9662   animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
9663
9664   // Start the animation
9665   animation.Play();
9666
9667   bool signalReceived(false);
9668   AnimationFinishCheck finishCheck(signalReceived);
9669   animation.FinishedSignal().Connect(&application, finishCheck);
9670   application.SendNotification();
9671   application.Render(0);
9672   application.SendNotification();
9673   finishCheck.CheckSignalNotReceived();
9674
9675   Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9676   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
9677
9678   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9679   application.SendNotification();
9680   check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
9681   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
9682
9683   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9684   application.SendNotification();
9685   check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
9686   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
9687
9688   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9689   application.SendNotification();
9690   check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f ) );
9691   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
9692
9693   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9694   application.SendNotification();
9695   check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
9696   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
9697
9698   // We did expect the animation to finish
9699
9700   finishCheck.CheckSignalReceived();
9701   END_TEST;
9702 }
9703
9704 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
9705 {
9706   TestApplication application;
9707
9708   float startValue(1.0f);
9709   Actor actor = Actor::New();
9710   actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue));
9711   application.GetScene().Add(actor);
9712
9713   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
9714   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9715   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9716   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9717   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9718   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9719   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9720   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9721   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9722
9723   // Build the animation
9724   float durationSeconds(1.0f);
9725   Animation animation = Animation::New(durationSeconds);
9726
9727   KeyFrames keyFrames = KeyFrames::New();
9728   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9729   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9730   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9731
9732   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR );
9733
9734   // Start the animation
9735   animation.Play();
9736
9737   bool signalReceived(false);
9738   AnimationFinishCheck finishCheck(signalReceived);
9739   animation.FinishedSignal().Connect(&application, finishCheck);
9740   application.SendNotification();
9741   application.Render(0);
9742   application.SendNotification();
9743   finishCheck.CheckSignalNotReceived();
9744   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
9745   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9746   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
9747   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9748
9749   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9750   application.SendNotification();
9751   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.5f, 0.01f, TEST_LOCATION );
9752   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9753   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.5f, 0.01f, TEST_LOCATION );
9754   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9755
9756   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9757   application.SendNotification();
9758   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
9759   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9760   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
9761   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9762
9763   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9764   application.SendNotification();
9765   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.95f, 0.01f, TEST_LOCATION );
9766   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9767   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.85f, 0.01f, TEST_LOCATION );
9768   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9769
9770   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9771   application.SendNotification();
9772   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
9773   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9774   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
9775   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9776
9777   // We did expect the animation to finish
9778
9779   finishCheck.CheckSignalReceived();
9780   END_TEST;
9781 }
9782
9783 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
9784 {
9785   TestApplication application;
9786
9787   float startValue(1.0f);
9788   Actor actor = Actor::New();
9789   actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue));
9790   application.GetScene().Add(actor);
9791
9792   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
9793   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9794   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9795   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9796   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9797   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9798   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9799   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9800   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9801
9802   // Build the animation
9803   float durationSeconds(1.0f);
9804   Animation animation = Animation::New(durationSeconds);
9805
9806   KeyFrames keyFrames = KeyFrames::New();
9807   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9808   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9809   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9810
9811   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::Cubic );
9812
9813   // Start the animation
9814   animation.Play();
9815
9816   bool signalReceived(false);
9817   AnimationFinishCheck finishCheck(signalReceived);
9818   animation.FinishedSignal().Connect(&application, finishCheck);
9819   application.SendNotification();
9820   application.Render(0);
9821   application.SendNotification();
9822   finishCheck.CheckSignalNotReceived();
9823   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
9824   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9825   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
9826   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9827
9828   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9829   application.SendNotification();
9830   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.55f, 0.01f, TEST_LOCATION );
9831   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9832   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.506f, 0.01f, TEST_LOCATION );
9833   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9834
9835   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9836   application.SendNotification();
9837   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
9838   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9839   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
9840   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9841
9842   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9843   application.SendNotification();
9844   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.99375f, 0.01f, TEST_LOCATION );
9845   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9846   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.85625f, 0.01f, TEST_LOCATION );
9847   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9848
9849   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9850   application.SendNotification();
9851   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
9852   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9853   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
9854   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9855
9856   // We did expect the animation to finish
9857
9858   finishCheck.CheckSignalReceived();
9859   END_TEST;
9860 }
9861
9862 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void)
9863 {
9864   TestApplication application;
9865
9866   float startValue(1.0f);
9867   Actor actor = Actor::New();
9868   actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue));
9869   application.GetScene().Add(actor);
9870
9871   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
9872   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9873   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9874   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9875   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9876   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9877   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9878   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9879   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9880
9881   // Build the animation
9882   float durationSeconds(1.0f);
9883   float delay = 0.5f;
9884   Animation animation = Animation::New(durationSeconds);
9885
9886   KeyFrames keyFrames = KeyFrames::New();
9887   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9888   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9889   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9890
9891   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ) );
9892
9893   // Start the animation
9894   animation.Play();
9895
9896   bool signalReceived(false);
9897   AnimationFinishCheck finishCheck(signalReceived);
9898   animation.FinishedSignal().Connect(&application, finishCheck);
9899   application.SendNotification();
9900
9901   application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9902   application.SendNotification();
9903   finishCheck.CheckSignalNotReceived();
9904   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
9905   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9906   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
9907   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9908
9909   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9910   application.SendNotification();
9911   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.5f, 0.01f, TEST_LOCATION );
9912   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9913   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.5f, 0.01f, TEST_LOCATION );
9914   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9915
9916   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9917   application.SendNotification();
9918   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
9919   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9920   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
9921   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9922
9923   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9924   application.SendNotification();
9925   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.95f, 0.01f, TEST_LOCATION );
9926   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9927   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.85f, 0.01f, TEST_LOCATION );
9928   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9929
9930   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9931   application.SendNotification();
9932   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
9933   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9934   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
9935   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9936
9937   // We did expect the animation to finish
9938
9939   finishCheck.CheckSignalReceived();
9940   END_TEST;
9941 }
9942
9943 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
9944 {
9945   TestApplication application;
9946
9947   float startValue(1.0f);
9948   Actor actor = Actor::New();
9949   actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue));
9950   application.GetScene().Add(actor);
9951
9952   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
9953   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
9954   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9955   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
9956   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9957   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
9958   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9959   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
9960   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9961
9962   // Build the animation
9963   float durationSeconds(1.0f);
9964   float delay = 0.5f;
9965   Animation animation = Animation::New(durationSeconds);
9966
9967   KeyFrames keyFrames = KeyFrames::New();
9968   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9969   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9970   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9971
9972   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
9973
9974   // Start the animation
9975   animation.Play();
9976
9977   bool signalReceived(false);
9978   AnimationFinishCheck finishCheck(signalReceived);
9979   animation.FinishedSignal().Connect(&application, finishCheck);
9980   application.SendNotification();
9981
9982   application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9983   application.SendNotification();
9984   finishCheck.CheckSignalNotReceived();
9985   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
9986   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9987   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
9988   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9989
9990   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9991   application.SendNotification();
9992   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.55f, 0.01f, TEST_LOCATION );
9993   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9994   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.506f, 0.01f, TEST_LOCATION );
9995   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9996
9997   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9998   application.SendNotification();
9999   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
10000   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
10001   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
10002   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
10003
10004   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
10005   application.SendNotification();
10006   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.99375f, 0.01f, TEST_LOCATION );
10007   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
10008   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.85625f, 0.01f, TEST_LOCATION );
10009   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
10010
10011   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
10012   application.SendNotification();
10013   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
10014   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
10015   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
10016   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
10017
10018   // We did expect the animation to finish
10019
10020   finishCheck.CheckSignalReceived();
10021   END_TEST;
10022 }
10023
10024 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
10025 {
10026   TestApplication application;
10027
10028   float startValue(1.0f);
10029   float delay = 0.5f;
10030   Actor actor = Actor::New();
10031   actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue));
10032   application.GetScene().Add(actor);
10033
10034   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
10035   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
10036   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
10037   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
10038   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
10039   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
10040   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
10041   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
10042   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
10043
10044   // Build the animation
10045   float durationSeconds(1.0f);
10046   Animation animation = Animation::New(durationSeconds);
10047
10048   KeyFrames keyFrames = KeyFrames::New();
10049   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10050   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10051   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10052
10053   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
10054
10055   // Start the animation
10056   animation.Play();
10057
10058   bool signalReceived(false);
10059   AnimationFinishCheck finishCheck(signalReceived);
10060   animation.FinishedSignal().Connect(&application, finishCheck);
10061   application.SendNotification();
10062
10063   application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
10064   application.SendNotification();
10065   finishCheck.CheckSignalNotReceived();
10066   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
10067   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
10068   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
10069   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
10070
10071   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
10072   application.SendNotification();
10073   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.5f, 0.01f, TEST_LOCATION );
10074   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
10075   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.5f, 0.01f, TEST_LOCATION );
10076   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
10077
10078   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
10079   application.SendNotification();
10080   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
10081   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
10082   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
10083   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
10084
10085   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
10086   application.SendNotification();
10087   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.95f, 0.01f, TEST_LOCATION );
10088   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
10089   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.85f, 0.01f, TEST_LOCATION );
10090   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
10091
10092   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
10093   application.SendNotification();
10094   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
10095   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
10096   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
10097   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
10098
10099   // We did expect the animation to finish
10100
10101   finishCheck.CheckSignalReceived();
10102   END_TEST;
10103 }
10104
10105 int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void)
10106 {
10107   TestApplication application;
10108
10109   float startValue(1.0f);
10110   Actor actor = Actor::New();
10111   actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue));
10112   application.GetScene().Add(actor);
10113
10114   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
10115   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED),   startValue, TEST_LOCATION );
10116   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
10117   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE),  startValue, TEST_LOCATION );
10118   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
10119   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   startValue, TEST_LOCATION );
10120   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
10121   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  startValue, TEST_LOCATION );
10122   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
10123
10124
10125   // Build the animation
10126   float durationSeconds(1.0f);
10127   float delay = 0.5f;
10128   Animation animation = Animation::New(durationSeconds);
10129
10130   KeyFrames keyFrames = KeyFrames::New();
10131   keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10132   keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10133   keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10134
10135   animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
10136
10137   // Start the animation
10138   animation.Play();
10139
10140   bool signalReceived(false);
10141   AnimationFinishCheck finishCheck(signalReceived);
10142   animation.FinishedSignal().Connect(&application, finishCheck);
10143   application.SendNotification();
10144
10145   application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
10146   application.SendNotification();
10147   finishCheck.CheckSignalNotReceived();
10148   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.1f, 0.01f, TEST_LOCATION );
10149   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
10150   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.3f, 0.01f, TEST_LOCATION );
10151   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
10152
10153   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
10154   application.SendNotification();
10155   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.55f, 0.01f, TEST_LOCATION );
10156   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
10157   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.506f, 0.01f, TEST_LOCATION );
10158   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
10159
10160   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
10161   application.SendNotification();
10162   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.9f, 0.01f, TEST_LOCATION );
10163   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
10164   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.7f, 0.01f, TEST_LOCATION );
10165   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
10166
10167   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
10168   application.SendNotification();
10169   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   0.99375f, 0.01f, TEST_LOCATION );
10170   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
10171   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  0.85625f, 0.01f, TEST_LOCATION );
10172   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
10173
10174   application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
10175   application.SendNotification();
10176   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ),   1.0f, 0.01f, TEST_LOCATION );
10177   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
10178   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ),  1.0f, 0.01f, TEST_LOCATION );
10179   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
10180
10181   // We did expect the animation to finish
10182
10183   finishCheck.CheckSignalReceived();
10184   END_TEST;
10185 }
10186
10187 int UtcDaliAnimationAnimateP(void)
10188 {
10189   TestApplication application;
10190
10191   Actor actor = Actor::New();
10192   application.GetScene().Add(actor);
10193
10194   //Build the path
10195   Vector3 position0( 30.0,  80.0,  0.0);
10196   Vector3 position1( 70.0,  120.0, 0.0);
10197   Vector3 position2( 100.0, 100.0, 0.0);
10198
10199   Dali::Path path = Dali::Path::New();
10200   path.AddPoint(position0);
10201   path.AddPoint(position1);
10202   path.AddPoint(position2);
10203
10204   //Control points for first segment
10205   path.AddControlPoint( Vector3( 39.0,  90.0, 0.0) );
10206   path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
10207
10208   //Control points for second segment
10209   path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
10210   path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
10211
10212   // Build the animation
10213   float durationSeconds( 1.0f );
10214   Animation animation = Animation::New(durationSeconds);
10215   animation.Animate(actor, path, Vector3::XAXIS);
10216
10217   // Start the animation
10218   animation.Play();
10219
10220   bool signalReceived(false);
10221   AnimationFinishCheck finishCheck(signalReceived);
10222   animation.FinishedSignal().Connect(&application, finishCheck);
10223   application.SendNotification();
10224   application.Render(0);
10225   application.SendNotification();
10226   finishCheck.CheckSignalNotReceived();
10227   Vector3 position, tangent;
10228   Quaternion rotation;
10229   path.Sample( 0.0f, position, tangent );
10230   rotation = Quaternion( Vector3::XAXIS, tangent );
10231   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10232   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10233
10234   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
10235   application.SendNotification();
10236   path.Sample( 0.25f, position, tangent );
10237   rotation = Quaternion( Vector3::XAXIS, tangent );
10238   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10239   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10240
10241   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
10242   application.SendNotification();
10243   path.Sample( 0.5f, position, tangent );
10244   rotation = Quaternion( Vector3::XAXIS, tangent );
10245   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10246   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10247
10248   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
10249   application.SendNotification();
10250   path.Sample( 0.75f, position, tangent );
10251   rotation = Quaternion( Vector3::XAXIS, tangent );
10252   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10253   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10254
10255   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
10256   application.SendNotification();
10257   path.Sample( 1.0f, position, tangent );
10258   rotation = Quaternion( Vector3::XAXIS, tangent );
10259   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10260   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10261
10262   finishCheck.CheckSignalReceived();
10263   END_TEST;
10264 }
10265
10266 int UtcDaliAnimationAnimateAlphaFunctionP(void)
10267 {
10268   TestApplication application;
10269
10270   Actor actor = Actor::New();
10271   application.GetScene().Add(actor);
10272
10273   //Build the path
10274   Vector3 position0( 30.0,  80.0,  0.0);
10275   Vector3 position1( 70.0,  120.0, 0.0);
10276   Vector3 position2( 100.0, 100.0, 0.0);
10277
10278   Dali::Path path = Dali::Path::New();
10279   path.AddPoint(position0);
10280   path.AddPoint(position1);
10281   path.AddPoint(position2);
10282
10283   //Control points for first segment
10284   path.AddControlPoint( Vector3( 39.0,  90.0, 0.0) );
10285   path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
10286
10287   //Control points for second segment
10288   path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
10289   path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
10290
10291   // Build the animation
10292   float durationSeconds( 1.0f );
10293   Animation animation = Animation::New(durationSeconds);
10294   animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
10295
10296   // Start the animation
10297   animation.Play();
10298
10299   bool signalReceived(false);
10300   AnimationFinishCheck finishCheck(signalReceived);
10301   animation.FinishedSignal().Connect(&application, finishCheck);
10302   application.SendNotification();
10303   application.Render(0);
10304   application.SendNotification();
10305   finishCheck.CheckSignalNotReceived();
10306   Vector3 position, tangent;
10307   Quaternion rotation;
10308   path.Sample( 0.0f, position, tangent );
10309   rotation = Quaternion( Vector3::XAXIS, tangent );
10310   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10311   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10312
10313   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
10314   application.SendNotification();
10315   path.Sample( 0.25f, position, tangent );
10316   rotation = Quaternion( Vector3::XAXIS, tangent );
10317   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10318   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10319
10320   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
10321   application.SendNotification();
10322   path.Sample( 0.5f, position, tangent );
10323   rotation = Quaternion( Vector3::XAXIS, tangent );
10324   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10325   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10326
10327   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
10328   application.SendNotification();
10329   path.Sample( 0.75f, position, tangent );
10330   rotation = Quaternion( Vector3::XAXIS, tangent );
10331   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10332   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10333
10334   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
10335   application.SendNotification();
10336   path.Sample( 1.0f, position, tangent );
10337   rotation = Quaternion( Vector3::XAXIS, tangent );
10338   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10339   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10340
10341   finishCheck.CheckSignalReceived();
10342   END_TEST;
10343 }
10344
10345 int UtcDaliAnimationAnimateTimePeriodP(void)
10346 {
10347   TestApplication application;
10348
10349   Actor actor = Actor::New();
10350   application.GetScene().Add(actor);
10351
10352   //Build the path
10353   Vector3 position0( 30.0,  80.0,  0.0);
10354   Vector3 position1( 70.0,  120.0, 0.0);
10355   Vector3 position2( 100.0, 100.0, 0.0);
10356
10357   Dali::Path path = Dali::Path::New();
10358   path.AddPoint(position0);
10359   path.AddPoint(position1);
10360   path.AddPoint(position2);
10361
10362   //Control points for first segment
10363   path.AddControlPoint( Vector3( 39.0,  90.0, 0.0) );
10364   path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
10365
10366   //Control points for second segment
10367   path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
10368   path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
10369
10370   // Build the animation
10371   float durationSeconds( 1.0f );
10372   Animation animation = Animation::New(durationSeconds);
10373   animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
10374
10375   // Start the animation
10376   animation.Play();
10377
10378   bool signalReceived(false);
10379   AnimationFinishCheck finishCheck(signalReceived);
10380   animation.FinishedSignal().Connect(&application, finishCheck);
10381   application.SendNotification();
10382   application.Render(0);
10383   application.SendNotification();
10384   finishCheck.CheckSignalNotReceived();
10385   Vector3 position, tangent;
10386   Quaternion rotation;
10387   path.Sample( 0.0f, position, tangent );
10388   rotation = Quaternion( Vector3::XAXIS, tangent );
10389   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10390   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10391
10392   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
10393   application.SendNotification();
10394   path.Sample( 0.25f, position, tangent );
10395   rotation = Quaternion( Vector3::XAXIS, tangent );
10396   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10397   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10398
10399   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
10400   application.SendNotification();
10401   path.Sample( 0.5f, position, tangent );
10402   rotation = Quaternion( Vector3::XAXIS, tangent );
10403   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10404   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10405
10406   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
10407   application.SendNotification();
10408   path.Sample( 0.75f, position, tangent );
10409   rotation = Quaternion( Vector3::XAXIS, tangent );
10410   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10411   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10412
10413   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
10414   application.SendNotification();
10415   path.Sample( 1.0f, position, tangent );
10416   rotation = Quaternion( Vector3::XAXIS, tangent );
10417   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10418   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10419
10420   finishCheck.CheckSignalReceived();
10421   END_TEST;
10422 }
10423
10424 int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
10425 {
10426   TestApplication application;
10427
10428   Actor actor = Actor::New();
10429   application.GetScene().Add(actor);
10430
10431   //Build the path
10432   Vector3 position0( 30.0,  80.0,  0.0);
10433   Vector3 position1( 70.0,  120.0, 0.0);
10434   Vector3 position2( 100.0, 100.0, 0.0);
10435
10436   Dali::Path path = Dali::Path::New();
10437   path.AddPoint(position0);
10438   path.AddPoint(position1);
10439   path.AddPoint(position2);
10440
10441   //Control points for first segment
10442   path.AddControlPoint( Vector3( 39.0,  90.0, 0.0) );
10443   path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
10444
10445   //Control points for second segment
10446   path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
10447   path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
10448
10449   // Build the animation
10450   float durationSeconds( 1.0f );
10451   Animation animation = Animation::New(durationSeconds);
10452   animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
10453
10454   // Start the animation
10455   animation.Play();
10456
10457   bool signalReceived(false);
10458   AnimationFinishCheck finishCheck(signalReceived);
10459   animation.FinishedSignal().Connect(&application, finishCheck);
10460   application.SendNotification();
10461   application.Render(0);
10462   application.SendNotification();
10463   finishCheck.CheckSignalNotReceived();
10464   Vector3 position, tangent;
10465   Quaternion rotation;
10466   path.Sample( 0.0f, position, tangent );
10467   rotation = Quaternion( Vector3::XAXIS, tangent );
10468   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10469   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10470
10471   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
10472   application.SendNotification();
10473   path.Sample( 0.25f, position, tangent );
10474   rotation = Quaternion( Vector3::XAXIS, tangent );
10475   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10476   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10477
10478   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
10479   application.SendNotification();
10480   path.Sample( 0.5f, position, tangent );
10481   rotation = Quaternion( Vector3::XAXIS, tangent );
10482   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10483   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10484
10485   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
10486   application.SendNotification();
10487   path.Sample( 0.75f, position, tangent );
10488   rotation = Quaternion( Vector3::XAXIS, tangent );
10489   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10490   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10491
10492   application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
10493   application.SendNotification();
10494   path.Sample( 1.0f, position, tangent );
10495   rotation = Quaternion( Vector3::XAXIS, tangent );
10496   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10497   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10498
10499   finishCheck.CheckSignalReceived();
10500   END_TEST;
10501 }
10502
10503 int UtcDaliAnimationShowP(void)
10504 {
10505   TestApplication application;
10506
10507   Actor actor = Actor::New();
10508   actor.SetProperty( Actor::Property::VISIBLE,false);
10509   application.SendNotification();
10510   application.Render(0);
10511   DALI_TEST_CHECK( !actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
10512   application.GetScene().Add(actor);
10513
10514   // Start the animation
10515   float durationSeconds(10.0f);
10516   Animation animation = Animation::New(durationSeconds);
10517   animation.Show(actor, durationSeconds*0.5f);
10518   animation.Play();
10519
10520   bool signalReceived(false);
10521   AnimationFinishCheck finishCheck(signalReceived);
10522   animation.FinishedSignal().Connect(&application, finishCheck);
10523
10524   application.SendNotification();
10525   application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
10526
10527   // We didn't expect the animation to finish yet
10528   application.SendNotification();
10529   finishCheck.CheckSignalNotReceived();
10530   DALI_TEST_CHECK( !actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
10531
10532   application.SendNotification();
10533   application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be shown now*/);
10534
10535   // We didn't expect the animation to finish yet
10536   application.SendNotification();
10537   finishCheck.CheckSignalNotReceived();
10538   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
10539
10540   application.SendNotification();
10541   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10542
10543   // We did expect the animation to finish
10544   application.SendNotification();
10545   finishCheck.CheckSignalReceived();
10546   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
10547   END_TEST;
10548 }
10549
10550 int UtcDaliAnimationHideP(void)
10551 {
10552   TestApplication application;
10553
10554   Actor actor = Actor::New();
10555   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
10556   application.GetScene().Add(actor);
10557
10558   // Start the animation
10559   float durationSeconds(10.0f);
10560   Animation animation = Animation::New(durationSeconds);
10561   animation.Hide(actor, durationSeconds*0.5f);
10562   animation.Play();
10563
10564   bool signalReceived(false);
10565   AnimationFinishCheck finishCheck(signalReceived);
10566   animation.FinishedSignal().Connect(&application, finishCheck);
10567
10568   application.SendNotification();
10569   application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
10570
10571   // We didn't expect the animation to finish yet
10572   application.SendNotification();
10573   finishCheck.CheckSignalNotReceived();
10574   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
10575
10576   application.SendNotification();
10577   application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be hidden now*/);
10578
10579   // We didn't expect the animation to finish yet
10580   application.SendNotification();
10581   finishCheck.CheckSignalNotReceived();
10582   DALI_TEST_CHECK( !actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
10583
10584   application.SendNotification();
10585   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10586
10587   // We did expect the animation to finish
10588   application.SendNotification();
10589   finishCheck.CheckSignalReceived();
10590   DALI_TEST_CHECK( !actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
10591   END_TEST;
10592 }
10593
10594 int UtcDaliAnimationShowHideAtEndP(void)
10595 {
10596   // Test that show/hide delay can be the same as animation duration
10597   // i.e. to show/hide at the end of the animation
10598
10599   TestApplication application;
10600
10601   Actor actor = Actor::New();
10602   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
10603   application.GetScene().Add(actor);
10604
10605   // Start Hide animation
10606   float durationSeconds(10.0f);
10607   Animation animation = Animation::New(durationSeconds);
10608   animation.Hide(actor, durationSeconds/*Hide at end*/);
10609   animation.Play();
10610
10611   bool signalReceived(false);
10612   AnimationFinishCheck finishCheck(signalReceived);
10613   animation.FinishedSignal().Connect(&application, finishCheck);
10614
10615   application.SendNotification();
10616   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
10617
10618   // We did expect the animation to finish
10619   application.SendNotification();
10620   finishCheck.CheckSignalReceived();
10621   DALI_TEST_CHECK( !actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
10622
10623   // Start Show animation
10624   animation = Animation::New(durationSeconds);
10625   animation.Show(actor, durationSeconds/*Show at end*/);
10626   animation.FinishedSignal().Connect(&application, finishCheck);
10627   animation.Play();
10628
10629   application.SendNotification();
10630   application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
10631
10632   // We did expect the animation to finish
10633   application.SendNotification();
10634   finishCheck.CheckSignalReceived();
10635   DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
10636   END_TEST;
10637 }
10638
10639 int UtcDaliKeyFramesCreateDestroyP(void)
10640 {
10641   tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
10642
10643   KeyFrames* keyFrames = new KeyFrames;
10644   delete keyFrames;
10645   DALI_TEST_CHECK( true );
10646   END_TEST;
10647 }
10648
10649 int UtcDaliKeyFramesDownCastP(void)
10650 {
10651   TestApplication application;
10652   tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
10653
10654   KeyFrames keyFrames = KeyFrames::New();
10655   BaseHandle object(keyFrames);
10656
10657   KeyFrames keyFrames2 = KeyFrames::DownCast(object);
10658   DALI_TEST_CHECK(keyFrames2);
10659
10660   KeyFrames keyFrames3 = DownCast< KeyFrames >(object);
10661   DALI_TEST_CHECK(keyFrames3);
10662
10663   BaseHandle unInitializedObject;
10664   KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
10665   DALI_TEST_CHECK(!keyFrames4);
10666
10667   KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject);
10668   DALI_TEST_CHECK(!keyFrames5);
10669   END_TEST;
10670 }
10671
10672 int UtcDaliAnimationCreateDestroyP(void)
10673 {
10674   TestApplication application;
10675   Animation* animation = new Animation;
10676   DALI_TEST_CHECK( animation );
10677   delete animation;
10678   END_TEST;
10679 }
10680
10681 struct UpdateManagerTestConstraint
10682 {
10683   UpdateManagerTestConstraint(TestApplication& application)
10684   : mApplication(application)
10685   {
10686   }
10687
10688   void operator()( Vector3& current, const PropertyInputContainer& /* inputs */)
10689   {
10690     mApplication.SendNotification();  // Process events
10691   }
10692
10693   TestApplication& mApplication;
10694 };
10695
10696 int UtcDaliAnimationUpdateManagerP(void)
10697 {
10698   TestApplication application;
10699
10700   Actor actor = Actor::New();
10701   application.GetScene().Add( actor );
10702
10703   // Build the animation
10704   Animation animation = Animation::New( 0.0f );
10705
10706   bool signalReceived = false;
10707   AnimationFinishCheck finishCheck( signalReceived );
10708   animation.FinishedSignal().Connect( &application, finishCheck );
10709
10710   Vector3 startValue(1.0f, 1.0f, 1.0f);
10711   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
10712   Constraint constraint = Constraint::New<Vector3>( actor, index, UpdateManagerTestConstraint( application ) );
10713   constraint.Apply();
10714
10715   // Apply animation to actor
10716   animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunction::LINEAR );
10717   animation.AnimateTo( Property(actor, Actor::Property::OPACITY), 0.3f, AlphaFunction::LINEAR );
10718
10719   animation.Play();
10720
10721   application.SendNotification();
10722   application.UpdateOnly( 16 );
10723
10724   finishCheck.CheckSignalNotReceived();
10725
10726   application.SendNotification();   // Process events
10727
10728   finishCheck.CheckSignalReceived();
10729
10730   END_TEST;
10731 }
10732
10733 int UtcDaliAnimationSignalOrderP(void)
10734 {
10735   TestApplication application;
10736
10737   Actor actor = Actor::New();
10738   application.GetScene().Add( actor );
10739
10740   // Build the animations
10741   Animation animation1 = Animation::New( 0.0f ); // finishes first frame
10742   Animation animation2 = Animation::New( 0.02f ); // finishes in 20 ms
10743
10744   bool signal1Received = false;
10745   animation1.FinishedSignal().Connect( &application, AnimationFinishCheck( signal1Received ) );
10746
10747   bool signal2Received = false;
10748   animation2.FinishedSignal().Connect( &application, AnimationFinishCheck( signal2Received ) );
10749
10750   // Apply animations to actor
10751   animation1.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 3.0f, 2.0f, 1.0f ), AlphaFunction::LINEAR );
10752   animation1.Play();
10753   animation2.AnimateTo( Property(actor, Actor::Property::SIZE ), Vector3( 10.0f, 20.0f, 30.0f ), AlphaFunction::LINEAR );
10754   animation2.Play();
10755
10756   DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10757   DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10758
10759   application.SendNotification();
10760   application.UpdateOnly( 10 ); // 10ms progress
10761
10762   // no notifications yet
10763   DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10764   DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10765
10766   application.SendNotification();
10767
10768   // first completed
10769   DALI_TEST_EQUALS( signal1Received, true, TEST_LOCATION );
10770   DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10771   signal1Received = false;
10772
10773   // 1st animation is complete now, do another update with no ProcessEvents in between
10774   application.UpdateOnly( 20 ); // 20ms progress
10775
10776   // ProcessEvents
10777   application.SendNotification();
10778
10779   // 2nd should complete now
10780   DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10781   DALI_TEST_EQUALS( signal2Received, true, TEST_LOCATION );
10782
10783   END_TEST;
10784 }
10785
10786 int UtcDaliAnimationExtendDurationP(void)
10787 {
10788   TestApplication application;
10789
10790   Actor actor = Actor::New();
10791
10792   // Register a float property
10793   float startValue(10.0f);
10794   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
10795   application.GetScene().Add(actor);
10796   DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
10797   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
10798
10799   // Build the animation
10800   float initialDurationSeconds(1.0f);
10801   float animatorDelay = 5.0f;
10802   float animatorDurationSeconds(5.0f);
10803   float extendedDurationSeconds(animatorDelay+animatorDurationSeconds);
10804   Animation animation = Animation::New(initialDurationSeconds);
10805   float targetValue(30.0f);
10806   float relativeValue(targetValue - startValue);
10807
10808   animation.AnimateTo(Property(actor, index),
10809                       targetValue,
10810                       TimePeriod(animatorDelay, animatorDurationSeconds));
10811
10812   // The duration should have been extended
10813   DALI_TEST_EQUALS( animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION );
10814
10815   // Start the animation
10816   animation.Play();
10817
10818   bool signalReceived(false);
10819   AnimationFinishCheck finishCheck(signalReceived);
10820   animation.FinishedSignal().Connect(&application, finishCheck);
10821
10822   application.SendNotification();
10823   application.Render(static_cast<unsigned int>(extendedDurationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
10824
10825   // We didn't expect the animation to finish yet, but cached value should be the final one
10826   application.SendNotification();
10827   finishCheck.CheckSignalNotReceived();
10828   DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
10829   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
10830
10831   application.SendNotification();
10832   application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
10833
10834   // We didn't expect the animation to finish yet
10835   application.SendNotification();
10836   finishCheck.CheckSignalNotReceived();
10837   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
10838
10839   application.SendNotification();
10840   application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
10841
10842   // We did expect the animation to finish
10843   application.SendNotification();
10844   finishCheck.CheckSignalReceived();
10845   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
10846   DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
10847   END_TEST;
10848 }
10849
10850 int UtcDaliAnimationCustomIntProperty(void)
10851 {
10852   TestApplication application;
10853
10854   Actor actor = Actor::New();
10855   application.GetScene().Add(actor);
10856   int startValue(0u);
10857
10858   Property::Index index = actor.RegisterProperty("anIndex",  startValue);
10859   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
10860   DALI_TEST_EQUALS( actor.GetProperty< int >( index ), startValue, TEST_LOCATION );
10861
10862   // Build the animation
10863   float durationSeconds(1.0f);
10864   Animation animation = Animation::New(durationSeconds);
10865   animation.AnimateTo( Property(actor, index), 20 );
10866
10867   // Start the animation
10868   animation.Play();
10869
10870   // Target value should be retrievable straight away
10871   DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION );
10872
10873   bool signalReceived(false);
10874   AnimationFinishCheck finishCheck(signalReceived);
10875   animation.FinishedSignal().Connect(&application, finishCheck);
10876
10877   application.SendNotification();
10878   application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
10879
10880   // We didn't expect the animation to finish yet
10881   application.SendNotification();
10882   finishCheck.CheckSignalNotReceived();
10883   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), 10, TEST_LOCATION );
10884
10885   application.SendNotification();
10886   application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10887
10888   // We did expect the animation to finish
10889   application.SendNotification();
10890   finishCheck.CheckSignalReceived();
10891   DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), 20, TEST_LOCATION );
10892   DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION );
10893   END_TEST;
10894 }
10895
10896 int UtcDaliAnimationDuration(void)
10897 {
10898   TestApplication application;
10899
10900   Actor actor = Actor::New();
10901   application.GetScene().Add(actor);
10902
10903   Animation animation = Animation::New( 0.0f );
10904   DALI_TEST_EQUALS( 0.0f, animation.GetDuration(), TEST_LOCATION );
10905
10906   // The animation duration should automatically increase depending on the animator time period
10907
10908   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 0.0f, 1.0f ) );
10909   DALI_TEST_EQUALS( 1.0f, animation.GetDuration(), TEST_LOCATION );
10910
10911   animation.AnimateTo( Property( actor, Actor::Property::POSITION_Y ), 200.0f, TimePeriod( 10.0f, 1.0f ) );
10912   DALI_TEST_EQUALS( 11.0f, animation.GetDuration(), TEST_LOCATION );
10913
10914   END_TEST;
10915 }
10916
10917 int UtcDaliAnimationAnimateByNonAnimateableTypeN(void)
10918 {
10919   TestApplication application;
10920
10921   Actor actor = Actor::New();
10922
10923   // Register an integer property
10924   int startValue(1);
10925   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
10926   application.GetScene().Add(actor);
10927   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10928
10929   DALI_TEST_ASSERTION(
10930   {
10931     // Build the animation
10932     Animation animation = Animation::New( 2.0f );
10933     std::string relativeValue = "relative string";
10934     animation.AnimateBy( Property(actor, index), relativeValue );
10935     tet_result(TET_FAIL);
10936   }, "Target value is not animatable" );
10937
10938   END_TEST;
10939 }
10940
10941
10942 int UtcDaliAnimationAnimateToNonAnimateableTypeN(void)
10943 {
10944   TestApplication application;
10945
10946   Actor actor = Actor::New();
10947
10948   // Register an integer property
10949   int startValue(1);
10950   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
10951   application.GetScene().Add(actor);
10952   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10953
10954   DALI_TEST_ASSERTION(
10955   {
10956     // Build the animation
10957     Animation animation = Animation::New( 2.0f );
10958     std::string relativeValue = "relative string";
10959     animation.AnimateTo( Property(actor, index), relativeValue );
10960   }, "Target value is not animatable" );
10961
10962   END_TEST;
10963 }
10964
10965 int UtcDaliAnimationAnimateBetweenNonAnimateableTypeN(void)
10966 {
10967   TestApplication application;
10968
10969   Actor actor = Actor::New();
10970
10971   // Register an integer property
10972   int startValue(1);
10973   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
10974   application.GetScene().Add(actor);
10975   DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10976
10977   DALI_TEST_ASSERTION(
10978   {
10979     // Build the animation
10980     KeyFrames keyFrames = KeyFrames::New();
10981     keyFrames.Add( 0.0f, std::string("relative string1") );
10982     keyFrames.Add( 1.0f, std::string("relative string2") );
10983     // no need to really create the animation as keyframes do the check
10984   }, "Property type is not animatable" );
10985
10986   END_TEST;
10987 }
10988
10989 int UtcDaliAnimationSetAndGetTargetBeforePlayP(void)
10990 {
10991   tet_infoline("Setting up an animation should not effect it's position property until the animation plays");
10992
10993   TestApplication application;
10994
10995   tet_infoline("Set initial position and set up animation to re-position actor");
10996
10997   Actor actor = Actor::New();
10998   application.GetScene().Add(actor);
10999   Vector3 initialPosition(0.0f, 0.0f, 0.0f);
11000   actor.SetProperty( Actor::Property::POSITION, initialPosition );
11001
11002   // Build the animation
11003   Animation animation = Animation::New(2.0f);
11004
11005   //Test GetCurrentProgress return 0.0 as the duration is 0.0
11006   DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
11007   DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
11008
11009   tet_infoline("Set target position in animation without intiating play");
11010
11011   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11012   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
11013
11014   application.SendNotification();
11015   application.Render();
11016
11017   tet_infoline("Ensure position of actor is still at intial value");
11018
11019   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
11020   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
11021   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
11022
11023   tet_infoline("Play animation and ensure actor position is now target");
11024
11025   animation.Play();
11026   application.SendNotification();
11027   application.Render(1000u);
11028
11029   tet_infoline("Ensure position of actor is at target value when aninmation half way");
11030
11031   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
11032   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
11033   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
11034
11035   tet_printf( "x position at half way point(%f)\n", actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x );
11036
11037   application.Render(2000u);
11038
11039   tet_infoline("Ensure position of actor is still at target value when aninmation complete");
11040
11041   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
11042   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
11043   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
11044
11045   END_TEST;
11046 }
11047
11048 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsPositionP(void)
11049 {
11050   tet_infoline("Setting up an animation should not effect it's position property until the animation plays even with mulitple animators");
11051
11052   TestApplication application;
11053
11054   std::vector<Vector3> targetPositions;
11055
11056   targetPositions.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
11057   targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
11058   targetPositions.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
11059
11060   tet_infoline("Set initial position and set up animation to re-position actor");
11061
11062   Actor actor = Actor::New();
11063   application.GetScene().Add(actor);
11064   Vector3 initialPosition(0.0f, 0.0f, 0.0f);
11065   actor.SetProperty( Actor::Property::POSITION, initialPosition );
11066
11067   // Build the animation
11068   Animation animation = Animation::New(2.0f);
11069
11070   //Test GetCurrentProgress return 0.0 as the duration is 0.0
11071   DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
11072   DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
11073
11074   tet_infoline("Set target position in animation without intiating play");
11075
11076   for ( unsigned int i = 0; i < targetPositions.size(); i++ )
11077   {
11078     animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[i], AlphaFunction::LINEAR);
11079   }
11080
11081   application.SendNotification();
11082   application.Render();
11083
11084   tet_infoline("Ensure position of actor is still at intial value");
11085
11086   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
11087   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
11088   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
11089
11090   tet_infoline("Play animation and ensure actor position is now target");
11091
11092   animation.Play();
11093   application.SendNotification();
11094   application.Render(1000u);
11095
11096   tet_infoline("Ensure position of actor is at target value when aninmation half way");
11097
11098   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
11099   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
11100   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
11101
11102   tet_printf( "x position at half way point(%f)\n", actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x );
11103
11104   application.Render(2000u);
11105
11106   tet_infoline("Ensure position of actor is still at target value when aninmation complete");
11107
11108   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
11109   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
11110   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
11111
11112   END_TEST;
11113 }
11114
11115 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionP(void)
11116 {
11117   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");
11118
11119   TestApplication application;
11120
11121   std::vector<Vector3> targetSizes;
11122   std::vector<Vector3> targetPositions;
11123
11124   targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
11125   targetSizes.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
11126
11127   targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
11128
11129   tet_infoline("Set initial position and set up animation to re-position actor");
11130
11131   Actor actor = Actor::New();
11132   application.GetScene().Add(actor);
11133   Vector3 initialSize( 10.0f, 10.0f, 10.0f);
11134   Vector3 initialPosition(10.0f, 10.0f, 10.0f);
11135
11136   actor.SetProperty( Actor::Property::SIZE, initialSize );
11137   actor.SetProperty( Actor::Property::POSITION, initialPosition );
11138
11139   // Build the animation
11140   Animation animation = Animation::New(2.0f);
11141
11142   tet_infoline("Set target size in animation without intiating play");
11143   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
11144   tet_infoline("Set target position in animation without intiating play");
11145   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[0], AlphaFunction::LINEAR);
11146   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
11147
11148   application.SendNotification();
11149   application.Render();
11150
11151   tet_infoline("Ensure position of actor is still at intial size and position");
11152
11153   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
11154   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
11155   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
11156
11157   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialPosition.x, TEST_LOCATION );
11158   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialPosition.y, TEST_LOCATION );
11159   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialPosition.z, TEST_LOCATION );
11160
11161   tet_infoline("Play animation and ensure actor position and size is now matches targets");
11162
11163   animation.Play();
11164   application.SendNotification();
11165   application.Render(2000u);
11166
11167   tet_infoline("Ensure position and size of actor is at target value when aninmation playing");
11168
11169   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
11170   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
11171   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
11172
11173   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[0].x, TEST_LOCATION );
11174   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[0].y, TEST_LOCATION );
11175   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[0].z, TEST_LOCATION );
11176
11177   END_TEST;
11178 }
11179
11180 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionColourP(void)
11181 {
11182   tet_infoline("Setting up an animation should not effect it's size property until the animation plays even if other Properties animated");
11183
11184   TestApplication application;
11185
11186   std::vector<Vector3> targetSizes;
11187   std::vector<float> targetColors;
11188
11189   targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
11190   targetSizes.push_back( Vector3( 50.0f, 10.0f, 150.0f ) );
11191
11192   targetColors.push_back( 1.0f );
11193
11194   tet_infoline("Set initial position and set up animation to re-position actor");
11195
11196   Actor actor = Actor::New();
11197   application.GetScene().Add(actor);
11198   Vector3 initialSize( 10.0f, 5.0f, 10.0f);
11199
11200   actor.SetProperty( Actor::Property::SIZE, initialSize );
11201
11202   // Build the animation
11203   Animation animation = Animation::New(2.0f);
11204
11205   tet_infoline("Set target size in animation without initiating play");
11206   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
11207   tet_infoline("Set target position in animation without intiating play");
11208   animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetColors[0], AlphaFunction::LINEAR);
11209   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
11210
11211   application.SendNotification();
11212   application.Render();
11213
11214   tet_infoline("Ensure position of actor is still at initial size and position");
11215
11216   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
11217   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
11218   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
11219
11220   tet_infoline("Play animation and ensure actor position and size is now matches targets");
11221
11222   animation.Play();
11223   application.SendNotification();
11224   application.Render(2000u);
11225
11226   tet_infoline("Ensure position and size of actor is at target value when animation playing");
11227
11228   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
11229   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
11230   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
11231
11232   DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColors[0], TEST_LOCATION );
11233
11234   END_TEST;
11235 }
11236
11237 int UtcDaliAnimationTimePeriodOrder(void)
11238 {
11239   tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place" );
11240
11241   TestApplication application;
11242
11243   Actor actor = Actor::New();
11244   application.GetScene().Add( actor );
11245
11246   application.SendNotification();
11247   application.Render();
11248
11249   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11250   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11251   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11252   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11253   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11254
11255   //////////////////////////////////////////////////////////////////////////////////
11256
11257   tet_infoline( "With two AnimateTo calls" );
11258
11259   Animation animation = Animation::New( 0.0f );
11260   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
11261   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
11262   animation.Play();
11263
11264   tet_infoline( "The target position should change instantly" );
11265   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11266   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11267
11268   application.SendNotification();
11269   application.Render(5000); // After the animation is complete
11270
11271   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11272   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11273   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11274
11275   //////////////////////////////////////////////////////////////////////////////////
11276
11277   tet_infoline( "Same animation again but in a different order - should yield the same result" );
11278
11279   actor.SetProperty( Actor::Property::POSITION_X,  0.0f );
11280   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11281   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11282
11283   application.SendNotification();
11284   application.Render();
11285
11286   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11287   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11288   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11289
11290   animation = Animation::New( 0.0f );
11291   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
11292   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
11293   animation.Play();
11294
11295   tet_infoline( "The target position should change instantly" );
11296   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11297   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11298
11299   application.SendNotification();
11300   application.Render(5000); // After the animation is complete
11301
11302   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11303   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11304   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11305
11306   END_TEST;
11307 }
11308
11309 int UtcDaliAnimationTimePeriodOrderSeveralAnimateToCalls(void)
11310 {
11311   tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place with several AnimateTo calls" );
11312
11313   TestApplication application;
11314
11315   Actor actor = Actor::New();
11316   application.GetScene().Add( actor );
11317
11318   application.SendNotification();
11319   application.Render();
11320
11321   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11322   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11323   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11324   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11325   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11326
11327   //////////////////////////////////////////////////////////////////////////////////
11328
11329   tet_infoline( "" );
11330
11331   Animation animation = Animation::New( 0.0f );
11332   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
11333   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
11334   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
11335   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) );
11336   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) );
11337   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
11338   animation.Play();
11339
11340   tet_infoline( "The target position should change instantly" );
11341   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11342   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
11343
11344   application.SendNotification();
11345   application.Render(14000); // After the animation is complete
11346
11347   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11348   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11349   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
11350
11351   //////////////////////////////////////////////////////////////////////////////////
11352
11353   tet_infoline( "Same animation again but in a different order - should end up at the same point" );
11354
11355   actor.SetProperty( Actor::Property::POSITION_X,  0.0f );
11356
11357   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11358   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11359
11360   application.SendNotification();
11361   application.Render();
11362
11363   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11364   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11365   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11366
11367   animation = Animation::New( 0.0f );
11368   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) );
11369   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
11370   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
11371   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
11372   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) );
11373   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
11374   animation.Play();
11375
11376   tet_infoline( "The target position should change instantly" );
11377   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11378   DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
11379
11380   application.SendNotification();
11381   application.Render(14000); // After the animation is complete
11382
11383   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11384   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11385   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
11386
11387   END_TEST;
11388 }
11389
11390 int UtcDaliAnimationAnimateBetweenIntegerP(void)
11391 {
11392   TestApplication application;
11393
11394   int startValue(1);
11395   Actor actor = Actor::New();
11396   const Property::Index index = actor.RegisterProperty("customProperty", startValue );
11397   application.GetScene().Add(actor);
11398
11399   application.Render();
11400   application.SendNotification();
11401
11402   DALI_TEST_EQUALS( actor.GetProperty< int >( index ), startValue, TEST_LOCATION );
11403
11404   // Build the animation
11405   float durationSeconds(1.0f);
11406   Animation animation = Animation::New(durationSeconds);
11407
11408   KeyFrames keyFrames = KeyFrames::New();
11409   keyFrames.Add(0.0f, 10);
11410   keyFrames.Add(0.2f, 20);
11411   keyFrames.Add(0.4f, 30);
11412   keyFrames.Add(0.6f, 40);
11413   keyFrames.Add(0.8f, 50);
11414   keyFrames.Add(1.0f, 60);
11415
11416   animation.AnimateBetween( Property(actor, index ), keyFrames );
11417
11418   // Start the animation
11419   animation.Play();
11420
11421   // Target value should change to the last key-frame's value straight away
11422   DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 60, TEST_LOCATION );
11423
11424   END_TEST;
11425 }
11426
11427 int UtcDaliAnimationAnimateBetweenVector2P(void)
11428 {
11429   TestApplication application;
11430
11431   Vector2 startValue( 10.0f, 20.0f );
11432   Actor actor = Actor::New();
11433   const Property::Index index = actor.RegisterProperty("customProperty", startValue );
11434   application.GetScene().Add(actor);
11435
11436   application.Render();
11437   application.SendNotification();
11438
11439   DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
11440
11441   // Build the animation
11442   float durationSeconds(1.0f);
11443   Animation animation = Animation::New(durationSeconds);
11444
11445   KeyFrames keyFrames = KeyFrames::New();
11446   keyFrames.Add( 0.0f, Vector2( 0.0f, 5.0f ) );
11447   keyFrames.Add( 0.2f, Vector2( 30.0f, 25.0f ) );
11448   keyFrames.Add( 0.4f, Vector2( 40.0f, 35.0f ) );
11449   keyFrames.Add( 0.6f, Vector2( 50.0f, 45.0f ) );
11450   keyFrames.Add( 0.8f, Vector2( 60.0f, 55.0f ) );
11451   keyFrames.Add( 1.0f, Vector2( 70.0f, 65.0f ) );
11452
11453   animation.AnimateBetween( Property(actor, index ), keyFrames );
11454
11455   // Start the animation
11456   animation.Play();
11457
11458   // Target value should change to the last key-frame's value straight away
11459   DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), Vector2( 70.0f, 65.0f ), TEST_LOCATION );
11460
11461   END_TEST;
11462 }
11463
11464 int UtcDaliAnimationProgressCallbackP(void)
11465 {
11466   TestApplication application;
11467
11468   Actor actor = Actor::New();
11469   application.GetScene().Add(actor);
11470
11471   // Build the animation
11472   Animation animation = Animation::New(0.0f);
11473
11474   //Set duration
11475   float durationSeconds(1.0f);
11476   animation.SetDuration(durationSeconds);
11477
11478   bool finishedSignalReceived(false);
11479   bool progressSignalReceived(false);
11480
11481   AnimationFinishCheck finishCheck(finishedSignalReceived);
11482   animation.FinishedSignal().Connect(&application, finishCheck);
11483
11484   AnimationProgressCheck progressCheck(progressSignalReceived);
11485   DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
11486   application.SendNotification();
11487
11488   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11489   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
11490
11491   tet_infoline( "Animation Progress notification set to 30%" );
11492   DevelAnimation::SetProgressNotification( animation, 0.3f );
11493
11494   application.SendNotification();
11495   application.Render( );
11496
11497   DALI_TEST_EQUALS( 0.3f, DevelAnimation::GetProgressNotification( animation ), TEST_LOCATION );
11498
11499   progressCheck.CheckSignalNotReceived();
11500
11501   // Start the animation from 10% progress
11502   animation.SetCurrentProgress( 0.1f );
11503   animation.Play();
11504
11505   tet_infoline( "Animation Playing from 10%" );
11506
11507   application.SendNotification();
11508   application.Render(0); // start animation
11509   application.Render(durationSeconds*100.0f ); // 20% progress
11510
11511   tet_infoline( "Animation at 20%" );
11512
11513   progressCheck.CheckSignalNotReceived();
11514
11515   application.SendNotification();
11516   application.Render(durationSeconds*200.0f ); // 40% progress
11517   application.SendNotification();
11518   tet_infoline( "Animation at 40%" );
11519   DALI_TEST_EQUALS( 0.4f, animation.GetCurrentProgress(), TEST_LOCATION );
11520
11521   progressCheck.CheckSignalReceived();
11522
11523   tet_infoline( "Progress check reset" );
11524   progressCheck.Reset();
11525
11526   application.Render(durationSeconds*100.0f ); // 50% progress
11527   tet_infoline( "Animation at 50%" );
11528   application.SendNotification();
11529
11530   DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
11531
11532   progressCheck.CheckSignalNotReceived();
11533
11534   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 60% progress */);
11535   application.SendNotification();
11536
11537   tet_infoline( "Animation at 60%" );
11538
11539   finishCheck.CheckSignalNotReceived();
11540
11541   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
11542   application.SendNotification();
11543   DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
11544   tet_infoline( "Animation at 80%" );
11545
11546   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
11547   // We did expect the animation to finish
11548   application.SendNotification();
11549   finishCheck.CheckSignalReceived();
11550   tet_infoline( "Animation finished" );
11551   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
11552
11553   END_TEST;
11554 }
11555
11556 int UtcDaliAnimationPlayAfterP(void)
11557 {
11558   TestApplication application;
11559
11560   tet_printf("Testing that playing after 2 seconds\n");
11561
11562   {
11563     Actor actor = Actor::New();
11564     application.GetScene().Add(actor);
11565
11566     // Build the animation
11567     float durationSeconds(1.0f);
11568     Animation animation = Animation::New(durationSeconds);
11569
11570     bool signalReceived( false );
11571     AnimationFinishCheck finishCheck( signalReceived );
11572     animation.FinishedSignal().Connect( &application, finishCheck );
11573     application.SendNotification();
11574
11575     Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
11576     animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
11577
11578     // Play animation after the initial delay time
11579     animation.PlayAfter( 0.2f );
11580     application.SendNotification();
11581     application.Render(0); // start animation
11582
11583     application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter
11584     application.SendNotification();
11585     finishCheck.CheckSignalNotReceived();
11586     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move
11587
11588     application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% animation progress, 0% animator progress */ );
11589
11590     // We didn't expect the animation to finish yet
11591     application.SendNotification();
11592     finishCheck.CheckSignalNotReceived();
11593     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
11594
11595     application.SendNotification();
11596     application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 75% animation progress, 50% animator progress */ );
11597
11598     application.SendNotification();
11599     finishCheck.CheckSignalNotReceived();
11600     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.5f ), TEST_LOCATION );
11601
11602     application.SendNotification();
11603     application.Render( static_cast< unsigned int >( durationSeconds * 250.0f ) + 1u/*just beyond the animation duration*/ );
11604
11605     // We did expect the animation to finish
11606     application.SendNotification();
11607     finishCheck.CheckSignalReceived();
11608     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
11609
11610     // Check that nothing has changed after a couple of buffer swaps
11611     application.Render(0);
11612     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
11613   }
11614
11615   tet_printf("Testing that playing after 2 seconds with negative speedfactor\n");
11616   // SpeedFactor < 0
11617   {
11618     Actor actor = Actor::New();
11619     application.GetScene().Add(actor);
11620
11621     // Build the animation
11622     float durationSeconds(1.0f);
11623     Animation animation = Animation::New(durationSeconds);
11624     animation.SetSpeedFactor( -1.0f ); // Set SpeedFactor as < 0
11625
11626     bool signalReceived( false );
11627     AnimationFinishCheck finishCheck( signalReceived );
11628     animation.FinishedSignal().Connect( &application, finishCheck );
11629     application.SendNotification();
11630
11631     Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
11632     animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
11633
11634     // Play animation after the initial delay time
11635     animation.PlayAfter( 0.2f );
11636     application.SendNotification();
11637     application.Render(0); // start animation
11638
11639     application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter
11640     application.SendNotification();
11641     finishCheck.CheckSignalNotReceived();
11642     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 1.0f ), TEST_LOCATION ); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
11643
11644     application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 25% animation progress, 50% animator progress */ );
11645
11646     // We didn't expect the animation to finish yet
11647     application.SendNotification();
11648     finishCheck.CheckSignalNotReceived();
11649     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.5f ), TEST_LOCATION );
11650
11651     application.SendNotification();
11652     application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 50% animation progress, 100% animator progress */ );
11653
11654     application.SendNotification();
11655     finishCheck.CheckSignalNotReceived();
11656     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION );
11657
11658     application.SendNotification();
11659     application.Render( static_cast< unsigned int >( durationSeconds * 500.0f ) + 1u/*just beyond the animation duration*/ );
11660
11661     // We did expect the animation to finish
11662     application.SendNotification();
11663     finishCheck.CheckSignalReceived();
11664     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of Timeperiod in seconds
11665
11666     // Check that nothing has changed after a couple of buffer swaps
11667     application.Render(0);
11668     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(0.0, 0.0, 0.0), TEST_LOCATION );
11669   }
11670
11671   END_TEST;
11672 }
11673
11674 int UtcDaliAnimationPlayAfterP2(void)
11675 {
11676   TestApplication application;
11677
11678   tet_printf("Testing that playing after 2 seconds before looping\n");
11679
11680   {
11681     Actor actor = Actor::New();
11682     application.GetScene().Add(actor);
11683
11684     // Build the animation
11685     float durationSeconds(1.0f);
11686     Animation animation = Animation::New(durationSeconds);
11687     animation.SetLooping( true );
11688
11689     bool signalReceived( false );
11690     AnimationFinishCheck finishCheck( signalReceived );
11691     animation.FinishedSignal().Connect( &application, finishCheck );
11692     application.SendNotification();
11693
11694     Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
11695     animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
11696
11697     // Play animation after the initial delay time
11698     animation.PlayAfter( 0.2f );
11699     application.SendNotification();
11700     application.Render(0); // start animation
11701
11702     for( int iterations = 0; iterations < 3; ++iterations )
11703     {
11704       // The initial delay time of PlayAfter() applies only once in looping mode.
11705       if( iterations == 0 )
11706       {
11707         application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter
11708         application.SendNotification();
11709         finishCheck.CheckSignalNotReceived();
11710         DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move
11711       }
11712
11713       application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% animation progress, 0% animator progress */ );
11714
11715       // We didn't expect the animation to finish yet
11716       application.SendNotification();
11717       finishCheck.CheckSignalNotReceived();
11718       DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
11719
11720       application.SendNotification();
11721       application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 75% animation progress, 50% animator progress */ );
11722
11723       application.SendNotification();
11724       finishCheck.CheckSignalNotReceived();
11725       DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.5f ), TEST_LOCATION );
11726
11727       application.SendNotification();
11728       application.Render( static_cast< unsigned int >( durationSeconds * 250.0f ) /* 100% progress */ );
11729
11730       // We did expect the animation to finish
11731       application.SendNotification();
11732       finishCheck.CheckSignalNotReceived();
11733       DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
11734     }
11735
11736     animation.SetLooping(false);
11737     application.SendNotification();
11738     application.Render( static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/ );
11739
11740     application.SendNotification();
11741     finishCheck.CheckSignalReceived();
11742     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
11743   }
11744
11745   tet_printf("Testing that playing after 2 seconds before looping with negative speedfactor\n");
11746   // SpeedFactor < 0
11747   {
11748     Actor actor = Actor::New();
11749     application.GetScene().Add(actor);
11750
11751     // Build the animation
11752     float durationSeconds(1.0f);
11753     Animation animation = Animation::New(durationSeconds);
11754     animation.SetLooping( true );
11755     animation.SetSpeedFactor( -1.0f ); //Set SpeedFactor as < 0
11756
11757     bool signalReceived( false );
11758     AnimationFinishCheck finishCheck( signalReceived );
11759     animation.FinishedSignal().Connect( &application, finishCheck );
11760     application.SendNotification();
11761
11762     Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
11763     animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
11764
11765     // Play animation after the initial delay time
11766     animation.PlayAfter( 0.2f );
11767     application.SendNotification();
11768     application.Render(0); // start animation
11769
11770     for( int iterations = 0; iterations < 3; ++iterations )
11771     {
11772       // The initial delay time of PlayAfter() applies only once in looping mode.
11773       if( iterations == 0 )
11774       {
11775         application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter
11776         application.SendNotification();
11777         finishCheck.CheckSignalNotReceived();
11778         DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 1.0f ), TEST_LOCATION ); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
11779       }
11780
11781       application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 25% animation progress, 50% animator progress */ );
11782
11783       // We didn't expect the animation to finish yet
11784       application.SendNotification();
11785       finishCheck.CheckSignalNotReceived();
11786       DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.5f ), TEST_LOCATION );
11787
11788       application.SendNotification();
11789       application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 50% animation progress, 100% animator progress */ );
11790
11791       application.SendNotification();
11792       finishCheck.CheckSignalNotReceived();
11793       DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION );
11794
11795       application.SendNotification();
11796       application.Render( static_cast< unsigned int >( durationSeconds * 500.0f ) /* 100% progress */ );
11797
11798       // We did expect the animation to finish
11799       application.SendNotification();
11800       finishCheck.CheckSignalNotReceived();
11801       DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ),  ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in second
11802     }
11803
11804     animation.SetLooping(false);
11805     application.SendNotification();
11806     application.Render( static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/ );
11807
11808     application.SendNotification();
11809     finishCheck.CheckSignalReceived();
11810     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(0.0, 0.0, 0.0), TEST_LOCATION );
11811   }
11812
11813   END_TEST;
11814 }
11815
11816 int UtcDaliAnimationPlayAfterP3(void)
11817 {
11818   TestApplication application;
11819
11820   tet_printf("Testing that PlayAfter with the negative delay seconds\n");
11821
11822   Actor actor = Actor::New();
11823   application.GetScene().Add(actor);
11824
11825   // Build the animation
11826   float durationSeconds(1.0f);
11827   Animation animation = Animation::New(durationSeconds);
11828
11829   bool signalReceived( false );
11830   AnimationFinishCheck finishCheck( signalReceived );
11831   animation.FinishedSignal().Connect( &application, finishCheck );
11832   application.SendNotification();
11833
11834   Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
11835   animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
11836
11837   // When the delay time is negative value, it would treat as play immediately.
11838   animation.PlayAfter( -2.0f );
11839   application.SendNotification();
11840   application.Render(0); // start animation
11841
11842   application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% animation progress, 0% animator progress */ );
11843
11844   // We didn't expect the animation to finish yet
11845   application.SendNotification();
11846   finishCheck.CheckSignalNotReceived();
11847   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
11848
11849   application.SendNotification();
11850   application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 75% animation progress, 50% animator progress */ );
11851
11852   application.SendNotification();
11853   finishCheck.CheckSignalNotReceived();
11854   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.5f ), TEST_LOCATION );
11855
11856   application.SendNotification();
11857   application.Render( static_cast< unsigned int >( durationSeconds * 250.0f ) + 1u/*just beyond the animation duration*/ );
11858
11859   // We did expect the animation to finish
11860   application.SendNotification();
11861   finishCheck.CheckSignalReceived();
11862   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
11863
11864   // Check that nothing has changed after a couple of buffer swaps
11865   application.Render(0);
11866   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
11867   END_TEST;
11868 }
11869
11870 int UtcDaliAnimationPlayAfterP4(void)
11871 {
11872   TestApplication application;
11873
11874   tet_printf("Testing that PlayAfter with progress value\n");
11875
11876   Actor actor = Actor::New();
11877   application.GetScene().Add(actor);
11878
11879   // Build the animation
11880   float durationSeconds(1.0f);
11881   Animation animation = Animation::New(durationSeconds);
11882
11883   bool signalReceived( false );
11884   AnimationFinishCheck finishCheck( signalReceived );
11885   animation.FinishedSignal().Connect( &application, finishCheck );
11886   application.SendNotification();
11887
11888   Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
11889   animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
11890
11891   // Delay time is 0.3s. So after duration times, progress must be 70%. animation will finished at 1.3s.
11892   animation.PlayAfter( durationSeconds * 0.3f );
11893   application.SendNotification();
11894   application.Render(0); // start animation
11895
11896   application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 5/6 delay progress, 0% animation progress, 0% animator progress */ );
11897
11898   // We didn't expect the animation to finish yet
11899   application.SendNotification();
11900   finishCheck.CheckSignalNotReceived();
11901   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of PlayAfter
11902
11903   application.SendNotification();
11904   application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 20% animation progress, 0% animator progress */ );
11905
11906   application.SendNotification();
11907   finishCheck.CheckSignalNotReceived();
11908   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
11909
11910   application.SendNotification();
11911   application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 45% animation progress, 0% animator progress */ );
11912
11913   application.SendNotification();
11914   finishCheck.CheckSignalNotReceived();
11915   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
11916
11917   application.SendNotification();
11918   application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 70% animation progress, 40% animator progress */ );
11919
11920   application.SendNotification();
11921   finishCheck.CheckSignalNotReceived();
11922   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.4f ), TEST_LOCATION ); // 40% of animator progress
11923
11924   application.SendNotification();
11925   application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 95% animation progress, 90% animator progress */ );
11926
11927   application.SendNotification();
11928   finishCheck.CheckSignalNotReceived();
11929   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.9f ), TEST_LOCATION ); // 90% of animator progress
11930
11931   application.SendNotification();
11932   application.Render( static_cast< unsigned int >( durationSeconds * 50.0f ) + 1u/*just beyond the animation duration*/ );
11933
11934   // We did expect the animation to finish
11935   application.SendNotification();
11936   finishCheck.CheckSignalReceived();
11937   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
11938
11939   // Check that nothing has changed after a couple of buffer swaps
11940   application.Render(0);
11941   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
11942   END_TEST;
11943 }
11944
11945 int UtcDaliAnimationSetLoopingModeP(void)
11946 {
11947   // Test Loop forever and Loop mode being set
11948   TestApplication application;
11949   Integration::Scene stage( application.GetScene() );
11950
11951   // Default: LoopingMode::RESTART
11952   {
11953     Actor actor = Actor::New();
11954     stage.Add( actor );
11955
11956     float durationSeconds( 1.0f );
11957     Animation animation = Animation::New( durationSeconds );
11958     DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::RESTART );
11959
11960     Vector3 targetPosition(10.0f, 10.0f, 10.0f);
11961     animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
11962
11963     // Start the animation
11964     animation.Play();
11965     application.SendNotification();
11966     application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
11967
11968     actor.Unparent();
11969
11970     application.SendNotification();
11971     application.Render();
11972     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
11973   }
11974
11975   // LoopingMode::AUTO_REVERSE
11976   {
11977     Actor actor = Actor::New();
11978     stage.Add( actor );
11979
11980     float durationSeconds( 1.0f );
11981     Animation animation = Animation::New( durationSeconds );
11982     animation.SetLooping( true );
11983
11984     bool signalReceived( false );
11985     AnimationFinishCheck finishCheck( signalReceived );
11986     animation.FinishedSignal().Connect( &application, finishCheck );
11987     application.SendNotification();
11988
11989     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11990     animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
11991
11992     animation.SetLoopingMode( Animation::LoopingMode::AUTO_REVERSE );
11993     DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
11994
11995     // Start the animation
11996     animation.Play();
11997     application.SendNotification();
11998     application.Render(0);
11999
12000     for( int iterations = 0; iterations < 3; ++iterations )
12001     {
12002       application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% time progress */ );
12003       application.SendNotification();
12004       finishCheck.CheckSignalNotReceived();
12005
12006       // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12007       // and arrives at the beginning.
12008       DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
12009
12010       application.SendNotification();
12011       application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 100% time progress */ );
12012
12013       // We did expect the animation to finish
12014       application.SendNotification();
12015       finishCheck.CheckSignalNotReceived();
12016       DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
12017     }
12018
12019     animation.SetLooping( false );
12020     application.SendNotification();
12021     application.Render(static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/);
12022
12023     application.SendNotification();
12024     finishCheck.CheckSignalReceived();
12025
12026     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
12027   }
12028
12029   // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12030   {
12031     Actor actor = Actor::New();
12032     stage.Add( actor );
12033
12034     float durationSeconds( 1.0f );
12035     Animation animation = Animation::New( durationSeconds );
12036     animation.SetLooping( true );
12037
12038     bool signalReceived( false );
12039     AnimationFinishCheck finishCheck( signalReceived );
12040     animation.FinishedSignal().Connect( &application, finishCheck );
12041     application.SendNotification();
12042
12043     // Specify a negative multiplier to play the animation in reverse
12044     animation.SetSpeedFactor( -1.0f );
12045
12046     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12047     animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
12048
12049     animation.SetLoopingMode( Animation::AUTO_REVERSE );
12050     DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
12051
12052     // Start the animation
12053     animation.Play();
12054     application.SendNotification();
12055     application.Render(0);
12056
12057     for( int iterations = 0; iterations < 3; ++iterations )
12058     {
12059       application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% time progress */ );
12060       application.SendNotification();
12061       finishCheck.CheckSignalNotReceived();
12062
12063       // Setting a negative speed factor is to play the animation in reverse.
12064       // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12065       // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12066       DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
12067
12068       application.SendNotification();
12069       application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 100% time progress */ );
12070
12071       // We did expect the animation to finish
12072       application.SendNotification();
12073       finishCheck.CheckSignalNotReceived();
12074       DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
12075     }
12076
12077     animation.SetLooping( false );
12078     application.SendNotification();
12079     application.Render(static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/);
12080
12081     application.SendNotification();
12082     finishCheck.CheckSignalReceived();
12083
12084     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
12085   }
12086
12087   END_TEST;
12088 }
12089
12090 int UtcDaliAnimationSetLoopingModeP2(void)
12091 {
12092   // Test Loop Count and Loop mode being set
12093   TestApplication application;
12094   Integration::Scene stage( application.GetScene() );
12095
12096   // LoopingMode::AUTO_REVERSE
12097   {
12098     Actor actor = Actor::New();
12099     stage.Add( actor );
12100
12101     float durationSeconds( 1.0f );
12102     Animation animation = Animation::New( durationSeconds );
12103     animation.SetLoopCount(3);
12104     DALI_TEST_CHECK(animation.IsLooping());
12105
12106     bool signalReceived( false );
12107     AnimationFinishCheck finishCheck( signalReceived );
12108     animation.FinishedSignal().Connect( &application, finishCheck );
12109     application.SendNotification();
12110
12111     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12112     animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
12113
12114     animation.SetLoopingMode( Animation::AUTO_REVERSE );
12115     DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
12116
12117     // Start the animation
12118     animation.Play();
12119
12120     application.Render(0);
12121     application.SendNotification();
12122     application.Render(0);
12123     application.SendNotification();
12124     application.Render(0);
12125     application.SendNotification();
12126     application.Render(0);
12127     application.SendNotification();
12128
12129     // Loop
12130     float intervalSeconds = 3.0f;
12131
12132     application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
12133     // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12134     // and arrives at the beginning.
12135     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
12136
12137     application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
12138
12139     application.Render(0);
12140     application.SendNotification();
12141     application.Render(0);
12142     application.SendNotification();
12143     application.Render(0);
12144     application.SendNotification();
12145     application.Render(0);
12146     application.SendNotification();
12147     finishCheck.CheckSignalNotReceived();
12148
12149     application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
12150
12151     application.SendNotification();
12152     finishCheck.CheckSignalReceived();
12153     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
12154
12155     finishCheck.Reset();
12156   }
12157
12158   // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12159   {
12160     Actor actor = Actor::New();
12161     stage.Add( actor );
12162
12163     float durationSeconds( 1.0f );
12164     Animation animation = Animation::New( durationSeconds );
12165     animation.SetLoopCount(3);
12166     DALI_TEST_CHECK(animation.IsLooping());
12167
12168     bool signalReceived( false );
12169     AnimationFinishCheck finishCheck( signalReceived );
12170     animation.FinishedSignal().Connect( &application, finishCheck );
12171     application.SendNotification();
12172
12173     // Specify a negative multiplier to play the animation in reverse
12174     animation.SetSpeedFactor( -1.0f );
12175
12176     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12177     animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
12178
12179     animation.SetLoopingMode( Animation::AUTO_REVERSE );
12180     DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
12181
12182     // Start the animation
12183     animation.Play();
12184
12185     application.Render(0);
12186     application.SendNotification();
12187     application.Render(0);
12188     application.SendNotification();
12189     application.Render(0);
12190     application.SendNotification();
12191     application.Render(0);
12192     application.SendNotification();
12193
12194     // Loop
12195     float intervalSeconds = 3.0f;
12196
12197     application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
12198     // Setting a negative speed factor is to play the animation in reverse.
12199     // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12200     // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12201     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
12202
12203     application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
12204
12205     application.Render(0);
12206     application.SendNotification();
12207     application.Render(0);
12208     application.SendNotification();
12209     application.Render(0);
12210     application.SendNotification();
12211     application.Render(0);
12212     application.SendNotification();
12213     finishCheck.CheckSignalNotReceived();
12214
12215     application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
12216
12217     application.SendNotification();
12218     finishCheck.CheckSignalReceived();
12219     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
12220
12221     finishCheck.Reset();
12222   }
12223
12224   END_TEST;
12225 }
12226
12227 int UtcDaliAnimationSetLoopingModeP3(void)
12228 {
12229   // Test Loop Count is 1 (== default) and Loop mode being set
12230   TestApplication application;
12231   Integration::Scene stage( application.GetScene() );
12232
12233   // LoopingMode::AUTO_REVERSE
12234   {
12235     Actor actor = Actor::New();
12236     stage.Add( actor );
12237
12238     float durationSeconds( 1.0f );
12239     Animation animation = Animation::New( durationSeconds );
12240     DALI_TEST_CHECK(1 == animation.GetLoopCount());
12241
12242     bool signalReceived( false );
12243     AnimationFinishCheck finishCheck( signalReceived );
12244     animation.FinishedSignal().Connect( &application, finishCheck );
12245     application.SendNotification();
12246
12247     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12248     animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
12249
12250     animation.SetLoopingMode( Animation::AUTO_REVERSE );
12251     DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
12252
12253     // Start the animation
12254     animation.Play();
12255     application.Render(0);
12256     application.SendNotification();
12257
12258     application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 50% time progress */ );
12259     application.SendNotification();
12260     finishCheck.CheckSignalNotReceived();
12261
12262     // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12263     // and arrives at the beginning.
12264     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
12265
12266     application.SendNotification();
12267     application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 100% time progress */ );
12268
12269     application.SendNotification();
12270     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
12271
12272     application.SendNotification();
12273     application.Render( static_cast< unsigned int >( durationSeconds * 1.0f * 1000.0f ) + 1u /*just beyond the animation duration*/ );
12274
12275     application.SendNotification();
12276     application.Render(0);
12277     application.SendNotification();
12278     finishCheck.CheckSignalReceived();
12279
12280     // After all animation finished, arrives at the beginning.
12281     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
12282
12283     finishCheck.Reset();
12284   }
12285
12286   // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12287   {
12288     Actor actor = Actor::New();
12289     stage.Add( actor );
12290
12291     float durationSeconds( 1.0f );
12292     Animation animation = Animation::New( durationSeconds );
12293     DALI_TEST_CHECK(1 == animation.GetLoopCount());
12294
12295     bool signalReceived( false );
12296     AnimationFinishCheck finishCheck( signalReceived );
12297     animation.FinishedSignal().Connect( &application, finishCheck );
12298     application.SendNotification();
12299
12300     // Specify a negative multiplier to play the animation in reverse
12301     animation.SetSpeedFactor( -1.0f );
12302
12303     Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12304     animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
12305
12306     animation.SetLoopingMode( Animation::AUTO_REVERSE );
12307     DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
12308
12309     // Start the animation
12310     animation.Play();
12311     application.Render(0);
12312     application.SendNotification();
12313
12314     application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 50% time progress */ );
12315     application.SendNotification();
12316     finishCheck.CheckSignalNotReceived();
12317
12318     // Setting a negative speed factor is to play the animation in reverse.
12319     // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12320     // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12321     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
12322
12323     application.SendNotification();
12324     application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 100% time progress */ );
12325
12326     application.SendNotification();
12327     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
12328
12329     application.SendNotification();
12330     application.Render( static_cast< unsigned int >( durationSeconds * 1.0f * 1000.0f ) + 1u /*just beyond the animation duration*/ );
12331
12332     application.SendNotification();
12333     application.Render(0);
12334     application.SendNotification();
12335     finishCheck.CheckSignalReceived();
12336
12337     // After all animation finished, arrives at the target.
12338     DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
12339
12340     finishCheck.Reset();
12341   }
12342
12343   END_TEST;
12344 }
12345
12346 int UtcDaliAnimationGetLoopingModeP(void)
12347 {
12348   TestApplication application;
12349
12350   Animation animation = Animation::New(1.0f);
12351
12352   // default mode
12353   DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::RESTART );
12354
12355   animation.SetLoopingMode( Animation::AUTO_REVERSE );
12356   DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
12357
12358   END_TEST;
12359 }
12360
12361 int UtcDaliAnimationProgressSignalConnectionWithoutProgressMarkerP(void)
12362 {
12363   TestApplication application;
12364
12365   tet_infoline( "Connect to ProgressReachedSignal but do not set a required Progress marker" );
12366
12367   Actor actor = Actor::New();
12368   application.GetScene().Add(actor);
12369
12370   // Build the animation
12371   Animation animation = Animation::New(0.0f);
12372
12373   //Set duration
12374   float durationSeconds(1.0f);
12375   animation.SetDuration(durationSeconds);
12376
12377   bool finishedSignalReceived(false);
12378   bool progressSignalReceived(false);
12379
12380   AnimationFinishCheck finishCheck(finishedSignalReceived);
12381   animation.FinishedSignal().Connect(&application, finishCheck);
12382
12383   AnimationProgressCheck progressCheck( progressSignalReceived );
12384   DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
12385   application.SendNotification();
12386
12387   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12388   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12389
12390   progressCheck.CheckSignalNotReceived();
12391
12392   animation.Play();
12393
12394   application.SendNotification();
12395   application.Render(0); // start animation
12396   application.Render(durationSeconds*100.0f ); // 10% progress
12397   application.SendNotification();
12398
12399   tet_infoline( "Ensure after animation has started playing that ProgressReachedSignal not emitted" );
12400   progressCheck.CheckSignalNotReceived();
12401
12402   application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
12403
12404   application.SendNotification();
12405   finishCheck.CheckSignalReceived();
12406   tet_infoline( "Animation finished" );
12407   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
12408
12409   END_TEST;
12410 }
12411
12412 int UtcDaliAnimationMultipleProgressSignalsP(void)
12413 {
12414   tet_infoline( "Multiple animations with different progress markers" );
12415
12416   TestApplication application;
12417
12418   Actor actor = Actor::New();
12419   application.GetScene().Add(actor);
12420
12421   // Build the animation
12422   Animation animationAlpha = Animation::New(0.0f);
12423   Animation animationBeta = Animation::New(0.0f);
12424
12425   //Set duration
12426   float durationSeconds(1.0f);
12427   animationAlpha.SetDuration(durationSeconds);
12428   animationBeta.SetDuration(durationSeconds);
12429
12430   bool progressSignalReceivedAlpha(false);
12431   bool progressSignalReceivedBeta(false);
12432
12433   AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12434   AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta" );
12435
12436   DevelAnimation::ProgressReachedSignal( animationAlpha ).Connect( &application, progressCheckAlpha );
12437   DevelAnimation::ProgressReachedSignal( animationBeta ).Connect( &application, progressCheckBeta);
12438   application.SendNotification();
12439
12440   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12441   animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12442   animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12443
12444   tet_infoline( "AnimationAlpha Progress notification set to 30%" );
12445   DevelAnimation::SetProgressNotification( animationAlpha, 0.3f );
12446
12447   tet_infoline( "AnimationBeta Progress notification set to 50%" );
12448   DevelAnimation::SetProgressNotification( animationBeta, 0.5f );
12449
12450   application.SendNotification();
12451   application.Render( );
12452
12453   progressCheckAlpha.CheckSignalNotReceived();
12454   progressCheckBeta.CheckSignalNotReceived();
12455
12456   // Start the animations from 10% progress
12457   animationAlpha.SetCurrentProgress( 0.1f );
12458   animationBeta.SetCurrentProgress( 0.1f );
12459   animationAlpha.Play();
12460   animationBeta.Play();
12461
12462   tet_infoline( "Animation Playing from 10%" );
12463
12464   application.SendNotification();
12465   application.Render(0); // start animation
12466   application.Render(durationSeconds*100.0f ); // 20% progress
12467
12468   tet_infoline( "Animation at 20% - No signals to be received" );
12469
12470   progressCheckAlpha.CheckSignalNotReceived();
12471   progressCheckBeta.CheckSignalNotReceived();
12472
12473   application.SendNotification();
12474   application.Render(durationSeconds*200.0f ); // 40% progress
12475   application.SendNotification();
12476   tet_infoline( "Animation at 40% - Alpha signal should be received" );
12477   DALI_TEST_EQUALS( 0.4f, animationAlpha.GetCurrentProgress(), TEST_LOCATION );
12478
12479   progressCheckAlpha.CheckSignalReceived();
12480   progressCheckBeta.CheckSignalNotReceived();
12481
12482   tet_infoline( "Progress check reset" );
12483   progressCheckAlpha.Reset();
12484   progressCheckBeta.Reset();
12485
12486   application.Render(durationSeconds*100.0f ); // 50% progress
12487   tet_infoline( "Animation at 50% - Beta should receive signal, Alpha should not" );
12488   application.SendNotification();
12489
12490   DALI_TEST_EQUALS( 0.5f, animationBeta.GetCurrentProgress(), TEST_LOCATION );
12491
12492   progressCheckAlpha.CheckSignalNotReceived();
12493   progressCheckBeta.CheckSignalReceived();
12494   tet_infoline( "Progress check reset" );
12495   progressCheckAlpha.Reset();
12496   progressCheckBeta.Reset();
12497
12498   application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 60% progress */);
12499   application.SendNotification();
12500
12501   tet_infoline( "Animation at 60%" );
12502
12503   progressCheckAlpha.CheckSignalNotReceived();
12504   progressCheckBeta.CheckSignalNotReceived();
12505
12506   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
12507   application.SendNotification();
12508   tet_infoline( "Animation at 80%" );
12509
12510   progressCheckAlpha.CheckSignalNotReceived();
12511   progressCheckBeta.CheckSignalNotReceived();
12512
12513   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
12514   // We did expect the animation to finish
12515   tet_infoline( "Animation finished" );
12516
12517   END_TEST;
12518 }
12519
12520 int UtcDaliAnimationMultipleProgressSignalsP2(void)
12521 {
12522   tet_infoline( "Multiple animations with different progress markers and big step time" );
12523
12524   TestApplication application;
12525
12526   Actor actor = Actor::New();
12527   application.GetScene().Add(actor);
12528
12529   // Build the animation
12530   Animation animationAlpha = Animation::New(0.0f);
12531   Animation animationBeta = Animation::New(0.0f);
12532
12533   //Set duration
12534   const float durationSeconds(1.0f);
12535   animationAlpha.SetDuration(durationSeconds);
12536   animationBeta.SetDuration(durationSeconds);
12537
12538   bool progressSignalReceivedAlpha(false);
12539   bool progressSignalReceivedBeta(false);
12540
12541   AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12542   AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta" );
12543
12544   DevelAnimation::ProgressReachedSignal( animationAlpha ).Connect( &application, progressCheckAlpha );
12545   DevelAnimation::ProgressReachedSignal( animationBeta ).Connect( &application, progressCheckBeta);
12546   application.SendNotification();
12547
12548   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12549   animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12550   animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12551
12552   tet_infoline( "AnimationAlpha Progress notification set to 1%" );
12553   DevelAnimation::SetProgressNotification( animationAlpha, 0.01f );
12554
12555   tet_infoline( "AnimationBeta Progress notification set to 99%" );
12556   DevelAnimation::SetProgressNotification( animationBeta, 0.99f );
12557
12558   application.SendNotification();
12559   application.Render( );
12560
12561   progressCheckAlpha.CheckSignalNotReceived();
12562   progressCheckBeta.CheckSignalNotReceived();
12563
12564   // Start the animations unlimited looping
12565   animationAlpha.SetLooping( true );
12566   animationBeta.SetLooping( true );
12567   animationAlpha.Play();
12568   animationBeta.Play();
12569
12570   application.SendNotification();
12571   application.Render(0); // start animation
12572   application.Render(durationSeconds*20.0f ); // 2% progress
12573   application.SendNotification();
12574   DALI_TEST_EQUALS( 0.02f, animationAlpha.GetCurrentProgress(), TEST_LOCATION );
12575
12576   tet_infoline( "Animation at 2% - Alpha signals should be received, Beta should not." );
12577
12578   progressCheckAlpha.CheckSignalReceived();
12579   progressCheckBeta.CheckSignalNotReceived();
12580
12581   tet_infoline( "Progress check reset" );
12582   progressCheckAlpha.Reset();
12583   progressCheckBeta.Reset();
12584
12585   application.SendNotification();
12586   application.Render(durationSeconds*960.0f ); // 98% progress
12587   application.SendNotification();
12588   tet_infoline( "Animation at 98% - No signal received" );
12589   DALI_TEST_EQUALS( 0.98f, animationAlpha.GetCurrentProgress(), TEST_LOCATION );
12590
12591   progressCheckAlpha.CheckSignalNotReceived();
12592   progressCheckBeta.CheckSignalNotReceived();
12593
12594   application.SendNotification();
12595   application.Render(durationSeconds*40.0f ); // 2% progress
12596   application.SendNotification();
12597   tet_infoline( "Animation loop once and now 2% - Alpha and Beta should receive signal" );
12598   application.SendNotification();
12599
12600   DALI_TEST_EQUALS( 0.02f, animationBeta.GetCurrentProgress(), TEST_LOCATION );
12601
12602   progressCheckAlpha.CheckSignalReceived();
12603   progressCheckBeta.CheckSignalReceived();
12604
12605   tet_infoline( "Progress check reset" );
12606   progressCheckAlpha.Reset();
12607   progressCheckBeta.Reset();
12608
12609   application.SendNotification();
12610   application.Render(durationSeconds*980.0f ); // 100% progress
12611   application.SendNotification();
12612   tet_infoline( "Animation loop one more time. and now 100% - Beta should receive signal, Alhpa sholud not" );
12613   application.SendNotification();
12614
12615   progressCheckAlpha.CheckSignalNotReceived();
12616   progressCheckBeta.CheckSignalReceived();
12617
12618   tet_infoline( "Progress check reset" );
12619   progressCheckAlpha.Reset();
12620   progressCheckBeta.Reset();
12621
12622   animationAlpha.SetLooping( false );
12623   animationBeta.SetLooping( false );
12624
12625   application.SendNotification();
12626   application.Render(static_cast<unsigned int>(durationSeconds*2000.0f) + 1u/*just beyond the animation duration*/);
12627   application.SendNotification();
12628
12629   // We did expect the animation to finish
12630   tet_infoline( "Animation finished" );
12631
12632   END_TEST;
12633 }
12634
12635 int UtcDaliAnimationProgressSignalWithPlayAfterP(void)
12636 {
12637   tet_infoline( "Multiple animations with different progress markers" );
12638
12639   TestApplication application;
12640
12641   Actor actor = Actor::New();
12642   application.GetScene().Add(actor);
12643
12644   // Build the animation
12645   Animation animationAlpha = Animation::New(0.0f);
12646   Animation animationBeta = Animation::New(0.0f);
12647
12648   //Set duration
12649   float durationSeconds(1.0f);
12650   float delaySeconds(0.5f);
12651   animationAlpha.SetDuration(durationSeconds);
12652   animationBeta.SetDuration(durationSeconds);
12653
12654   bool progressSignalReceivedAlpha(false);
12655   bool progressSignalReceivedBeta(false);
12656
12657   AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12658   AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta" );
12659
12660   DevelAnimation::ProgressReachedSignal( animationAlpha ).Connect( &application, progressCheckAlpha );
12661   DevelAnimation::ProgressReachedSignal( animationBeta ).Connect( &application, progressCheckBeta);
12662   application.SendNotification();
12663
12664   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12665   animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12666   animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12667
12668   tet_infoline( "AnimationAlpha Progress notification set to 30%" );
12669   DevelAnimation::SetProgressNotification( animationAlpha, 0.3f );
12670
12671   tet_infoline( "AnimationBeta Progress notification set to ~0% (==Notify when delay is done)" );
12672   DevelAnimation::SetProgressNotification( animationBeta, Math::MACHINE_EPSILON_1 );
12673
12674   application.SendNotification();
12675   application.Render( );
12676
12677   progressCheckAlpha.CheckSignalNotReceived();
12678   progressCheckBeta.CheckSignalNotReceived();
12679
12680   // Start the animations from 10% progress
12681   animationAlpha.PlayAfter(delaySeconds);
12682   animationBeta.PlayAfter(delaySeconds);
12683
12684   application.SendNotification();
12685   application.Render(0); // start animation
12686   application.Render(delaySeconds * 500.0f ); // 50% wait progress
12687
12688   tet_infoline( "Delay at 50% - No signals to be received" );
12689
12690   progressCheckAlpha.CheckSignalNotReceived();
12691   progressCheckBeta.CheckSignalNotReceived();
12692
12693   application.SendNotification();
12694   application.Render(delaySeconds * 500.0f + durationSeconds * 50.0f ); // 100% wait, 5% progress
12695   application.SendNotification();
12696   tet_infoline( "Delay at 100%, Animation at 5% - Beta signal should be received" );
12697   DALI_TEST_EQUALS( 0.05f, animationBeta.GetCurrentProgress(), TEST_LOCATION );
12698
12699   progressCheckBeta.CheckSignalReceived();
12700   progressCheckAlpha.CheckSignalNotReceived();
12701
12702   tet_infoline( "Progress check reset" );
12703   progressCheckAlpha.Reset();
12704   progressCheckBeta.Reset();
12705
12706   application.Render(durationSeconds * 200.0f ); // 25% progress
12707   tet_infoline( "Animation at 25% - No signals to be received" );
12708   application.SendNotification();
12709
12710   progressCheckAlpha.CheckSignalNotReceived();
12711   progressCheckBeta.CheckSignalNotReceived();
12712
12713   application.Render(durationSeconds * 200.0f ); // 45% progress
12714   tet_infoline( "Animation at 45% - Alpha should receive signal, Beta should not" );
12715   application.SendNotification();
12716
12717   DALI_TEST_EQUALS( 0.45f, animationAlpha.GetCurrentProgress(), TEST_LOCATION );
12718
12719   progressCheckAlpha.CheckSignalReceived();
12720   progressCheckBeta.CheckSignalNotReceived();
12721
12722   tet_infoline( "Progress check reset" );
12723   progressCheckAlpha.Reset();
12724   progressCheckBeta.Reset();
12725
12726   application.Render(static_cast<unsigned int>(durationSeconds*150.0f)/* 60% progress */);
12727   application.SendNotification();
12728
12729   tet_infoline( "Animation at 60%" );
12730
12731   progressCheckAlpha.CheckSignalNotReceived();
12732   progressCheckBeta.CheckSignalNotReceived();
12733
12734   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
12735   application.SendNotification();
12736   tet_infoline( "Animation at 80%" );
12737
12738   progressCheckAlpha.CheckSignalNotReceived();
12739   progressCheckBeta.CheckSignalNotReceived();
12740
12741   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
12742   // We did expect the animation to finish
12743   tet_infoline( "Animation finished" );
12744
12745   END_TEST;
12746 }
12747
12748 int UtcDaliAnimationProgressCallbackWithLoopingP(void)
12749 {
12750   TestApplication application;
12751
12752   Actor actor = Actor::New();
12753   application.GetScene().Add(actor);
12754
12755   // Build the animation
12756   Animation animation = Animation::New(0.0f);
12757
12758   //Set duration
12759   const float durationSeconds(1.0f);
12760   animation.SetDuration(durationSeconds);
12761
12762   // Set Looping Count
12763   const int loopCount( 4 );
12764   animation.SetLoopCount( loopCount );
12765
12766   bool finishedSignalReceived(false);
12767   bool progressSignalReceived(false);
12768
12769   AnimationFinishCheck finishCheck(finishedSignalReceived);
12770   animation.FinishedSignal().Connect(&application, finishCheck);
12771
12772   AnimationProgressCheck progressCheck(progressSignalReceived);
12773   DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
12774   application.SendNotification();
12775
12776   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12777   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12778
12779   tet_infoline( "Animation Progress notification set to 50% with looping count 4" );
12780   DevelAnimation::SetProgressNotification( animation, 0.5f );
12781
12782   application.SendNotification();
12783   application.Render( );
12784
12785   progressCheck.CheckSignalNotReceived();
12786
12787   animation.Play();
12788
12789   for(int count = 0; count < loopCount; count++)
12790   {
12791     application.SendNotification();
12792     application.Render(0); // start animation
12793     application.Render(durationSeconds*0.25*1000.0f ); // 25% progress
12794     DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
12795
12796     tet_infoline( "Animation at 25%" );
12797
12798     progressCheck.CheckSignalNotReceived();
12799
12800     application.SendNotification();
12801     application.Render(durationSeconds*0.25*1000.0f ); // 50% progress
12802     application.SendNotification();
12803     tet_infoline( "Animation at 50%" );
12804     DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
12805
12806     progressCheck.CheckSignalReceived();
12807
12808     tet_infoline( "Progress check reset" );
12809     progressCheck.Reset();
12810
12811     application.Render(durationSeconds*0.25*1000.0f ); // 75% progress
12812     tet_infoline( "Animation at 75%" );
12813     application.SendNotification();
12814
12815     DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
12816
12817     progressCheck.CheckSignalNotReceived();
12818
12819     application.Render(durationSeconds*0.25*1000.0f ); // 100% progress
12820     tet_infoline( "Animation at 100%" );
12821     application.SendNotification();
12822
12823     //Nothing check at 100% progress. cause It can be both 100% and 0%.
12824     application.SendNotification();
12825   }
12826   application.Render(10u);
12827   application.SendNotification();
12828   application.Render(0u);
12829   application.SendNotification();
12830
12831   finishCheck.CheckSignalReceived();
12832
12833   END_TEST;
12834 }
12835
12836 int UtcDaliAnimationProgressCallbackWithLoopingP2(void)
12837 {
12838   TestApplication application;
12839
12840   Actor actor = Actor::New();
12841   application.GetScene().Add(actor);
12842
12843   // Build the animation
12844   Animation animation = Animation::New(0.0f);
12845
12846   //Set duration
12847   const float durationSeconds(1.0f);
12848   animation.SetDuration(durationSeconds);
12849
12850   // Set Looping Unlmited
12851   animation.SetLooping( true );
12852
12853   bool finishedSignalReceived(false);
12854   bool progressSignalReceived(false);
12855
12856   AnimationFinishCheck finishCheck(finishedSignalReceived);
12857   animation.FinishedSignal().Connect(&application, finishCheck);
12858
12859   AnimationProgressCheck progressCheck(progressSignalReceived);
12860   DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
12861   application.SendNotification();
12862
12863   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12864   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12865
12866   tet_infoline( "Animation Progress notification set to 50% with unlimited looping" );
12867   DevelAnimation::SetProgressNotification( animation, 0.5f );
12868
12869   application.SendNotification();
12870   application.Render( );
12871
12872   progressCheck.CheckSignalNotReceived();
12873
12874   animation.Play();
12875
12876   for(int count = 0; count < 4; count++)
12877   {
12878     application.SendNotification();
12879     application.Render(0); // start animation
12880     application.Render(durationSeconds*0.25*1000.0f ); // 25% progress
12881     DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
12882
12883     tet_infoline( "Animation at 25%" );
12884
12885     progressCheck.CheckSignalNotReceived();
12886
12887     application.SendNotification();
12888     application.Render(durationSeconds*0.25*1000.0f ); // 50% progress
12889     application.SendNotification();
12890     tet_infoline( "Animation at 50%" );
12891     DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
12892
12893     progressCheck.CheckSignalReceived();
12894
12895     tet_infoline( "Progress check reset" );
12896     progressCheck.Reset();
12897
12898     application.Render(durationSeconds*0.25*1000.0f ); // 75% progress
12899     tet_infoline( "Animation at 75%" );
12900     application.SendNotification();
12901
12902     DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
12903
12904     progressCheck.CheckSignalNotReceived();
12905
12906     application.Render(durationSeconds*0.25*1000.0f ); // 100% progress
12907     tet_infoline( "Animation at 100%" );
12908     application.SendNotification();
12909
12910     //Nothing check at 100% progress. cause It can be both 100% and 0%.
12911     finishCheck.CheckSignalNotReceived();
12912     application.SendNotification();
12913   }
12914   finishCheck.CheckSignalNotReceived();
12915
12916   animation.SetLooping( false );
12917   application.Render(0u);
12918   application.SendNotification();
12919   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 10u);
12920   application.SendNotification();
12921   application.Render(0u);
12922   application.SendNotification();
12923
12924   finishCheck.CheckSignalReceived();
12925
12926   END_TEST;
12927 }
12928
12929 int UtcDaliAnimationProgressCallbackNegativeSpeed(void)
12930 {
12931   TestApplication application;
12932
12933   Actor actor = Actor::New();
12934   application.GetScene().Add(actor);
12935
12936   // Build the animation
12937   Animation animation = Animation::New(0.0f);
12938
12939   //Set duration
12940   const float durationSeconds(1.0f);
12941   animation.SetDuration(durationSeconds);
12942
12943   //Set speed negative
12944   animation.SetSpeedFactor( -1.0f );
12945
12946   // Set Looping Unlmited
12947   animation.SetLooping( true );
12948
12949   bool finishedSignalReceived(false);
12950   bool progressSignalReceived(false);
12951
12952   AnimationFinishCheck finishCheck(finishedSignalReceived);
12953   animation.FinishedSignal().Connect(&application, finishCheck);
12954
12955   AnimationProgressCheck progressCheck(progressSignalReceived);
12956   DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
12957   application.SendNotification();
12958
12959   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12960   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12961
12962   tet_infoline( "Animation Progress notification set to 50%" );
12963   DevelAnimation::SetProgressNotification( animation, 0.5f );
12964
12965   application.SendNotification();
12966   application.Render( );
12967
12968   progressCheck.CheckSignalNotReceived();
12969
12970   animation.Play();
12971
12972   for(int count = 0; count < 4; count++)
12973   {
12974     application.SendNotification();
12975     application.Render(0); // start animation
12976     progressCheck.CheckSignalNotReceived();
12977
12978     application.SendNotification();
12979     application.Render(durationSeconds*0.25*1000.0f ); // 25% progress
12980     DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
12981
12982     tet_infoline( "Animation at 25%" );
12983
12984     progressCheck.CheckSignalNotReceived();
12985
12986     application.SendNotification();
12987     application.Render(durationSeconds*0.25*1000.0f ); // 50% progress
12988     application.SendNotification();
12989     tet_infoline( "Animation at 50%" );
12990     DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
12991
12992     progressCheck.CheckSignalReceived();
12993
12994     tet_infoline( "Progress check reset" );
12995     progressCheck.Reset();
12996
12997     application.Render(durationSeconds*0.25*1000.0f ); // 75% progress
12998     tet_infoline( "Animation at 75%" );
12999     application.SendNotification();
13000
13001     DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
13002
13003     progressCheck.CheckSignalNotReceived();
13004
13005     application.Render(durationSeconds*0.25*1000.0f ); // 100% progress
13006     tet_infoline( "Animation at 100%" );
13007     application.SendNotification();
13008
13009     //Nothing check at 100% progress. cause It can be both 100% and 0%.
13010     finishCheck.CheckSignalNotReceived();
13011     application.SendNotification();
13012   }
13013   finishCheck.CheckSignalNotReceived();
13014
13015   animation.Stop();
13016   animation.SetLooping( false );
13017   animation.SetLoopCount( 4 );
13018   animation.Play();
13019   application.Render(0u);
13020   application.SendNotification();
13021
13022   for(int count = 0; count < 4; count++)
13023   {
13024     application.SendNotification();
13025     application.Render(0); // start animation
13026     progressCheck.CheckSignalNotReceived();
13027
13028     application.SendNotification();
13029     application.Render(durationSeconds*0.25*1000.0f ); // 25% progress
13030     DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
13031
13032     tet_infoline( "Animation at 25%" );
13033
13034     progressCheck.CheckSignalNotReceived();
13035
13036     application.SendNotification();
13037     application.Render(durationSeconds*0.25*1000.0f ); // 50% progress
13038     application.SendNotification();
13039     tet_infoline( "Animation at 50%" );
13040     DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
13041
13042     progressCheck.CheckSignalReceived();
13043
13044     tet_infoline( "Progress check reset" );
13045     progressCheck.Reset();
13046
13047     application.Render(durationSeconds*0.25*1000.0f ); // 75% progress
13048     tet_infoline( "Animation at 75%" );
13049     application.SendNotification();
13050
13051     DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
13052
13053     progressCheck.CheckSignalNotReceived();
13054
13055     application.Render(durationSeconds*0.25*1000.0f ); // 100% progress
13056     tet_infoline( "Animation at 100%" );
13057     application.SendNotification();
13058
13059     //Nothing check at 100% progress. cause It can be both 100% and 0%.
13060     application.SendNotification();
13061   }
13062   application.Render(10u);
13063   application.SendNotification();
13064   application.Render(0u);
13065   application.SendNotification();
13066
13067   finishCheck.CheckSignalReceived();
13068
13069   END_TEST;
13070 }
13071
13072 int UtcDaliAnimationProgressCallbackInvalidSignalN(void)
13073 {
13074   TestApplication application;
13075
13076   Actor actor = Actor::New();
13077   application.GetScene().Add(actor);
13078
13079   // Build the animation
13080   Animation animation = Animation::New(0.0f);
13081
13082   //Set duration
13083   const float durationSeconds(1.0f);
13084   animation.SetDuration(durationSeconds);
13085
13086   bool finishedSignalReceived(false);
13087   bool progressSignalReceived(false);
13088
13089   AnimationFinishCheck finishCheck(finishedSignalReceived);
13090   animation.FinishedSignal().Connect(&application, finishCheck);
13091
13092   AnimationProgressCheck progressCheck(progressSignalReceived);
13093   DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
13094   application.SendNotification();
13095
13096   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13097   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13098
13099   tet_infoline( "Animation Progress PlayRange as 10% ~ 90%" );
13100   animation.SetPlayRange( Vector2( 0.1f, 0.9f ) );
13101
13102   tet_infoline( "Animation Progress notification set to >90% that never can notificated" );
13103   DevelAnimation::SetProgressNotification( animation, 0.9f + Math::MACHINE_EPSILON_1 );
13104
13105   application.SendNotification();
13106   application.Render( );
13107
13108   progressCheck.CheckSignalNotReceived();
13109
13110   animation.Play();
13111
13112   application.SendNotification();
13113   application.Render(0); // start animation
13114   application.Render(durationSeconds*0.25*1000.0f ); // 35% progress
13115   DALI_TEST_EQUALS( 0.35f, animation.GetCurrentProgress(), TEST_LOCATION );
13116
13117   tet_infoline( "Animation at 35%" );
13118
13119   progressCheck.CheckSignalNotReceived();
13120
13121   application.SendNotification();
13122   application.Render(durationSeconds*0.25*1000.0f ); // 60% progress
13123   application.SendNotification();
13124   DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
13125
13126   tet_infoline( "Animation at 60%" );
13127
13128   progressCheck.CheckSignalNotReceived();
13129
13130   application.Render(durationSeconds*0.25*1000.0f ); // 85% progress
13131   tet_infoline( "Animation at 85%" );
13132   application.SendNotification();
13133   DALI_TEST_EQUALS( 0.85f, animation.GetCurrentProgress(), TEST_LOCATION );
13134
13135   progressCheck.CheckSignalNotReceived();
13136
13137   application.Render(durationSeconds*0.25*1000.0f ); // 90% progress
13138   tet_infoline( "Animation over 90%" );
13139   application.SendNotification();
13140
13141   // progress never signaled because playrange is 90%
13142   progressCheck.CheckSignalNotReceived();
13143
13144   END_TEST;
13145 }
13146
13147 int UtcDaliAnimationProgressCallbackLongDurationP(void)
13148 {
13149   TestApplication application;
13150
13151   Actor actor = Actor::New();
13152   application.GetScene().Add(actor);
13153
13154   // Build the animation
13155   Animation animation = Animation::New(0.0f);
13156
13157   //Set duration
13158   float durationSeconds(5.0f);
13159   animation.SetDuration(durationSeconds);
13160
13161   bool finishedSignalReceived(false);
13162   bool progressSignalReceived(false);
13163
13164   AnimationFinishCheck finishCheck(finishedSignalReceived);
13165   animation.FinishedSignal().Connect(&application, finishCheck);
13166
13167   AnimationProgressCheck progressCheck(progressSignalReceived);
13168   DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
13169   application.SendNotification();
13170
13171   Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13172   animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13173
13174   tet_infoline( "Animation Progress notification set to 50%" );
13175   DevelAnimation::SetProgressNotification( animation, 0.5f );
13176
13177   application.SendNotification();
13178   application.Render( );
13179
13180   progressCheck.CheckSignalNotReceived();
13181
13182   animation.Play();
13183
13184   application.SendNotification();
13185   application.Render(0); // start animation
13186   application.Render(durationSeconds*0.25*1000.0f ); // 25% progress
13187   DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
13188
13189   tet_infoline( "Animation at 25%" );
13190
13191   progressCheck.CheckSignalNotReceived();
13192
13193   application.SendNotification();
13194   application.Render(durationSeconds*0.25*1000.0f ); // 50% progress
13195   application.SendNotification();
13196   tet_infoline( "Animation at 50%" );
13197   DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
13198
13199   progressCheck.CheckSignalReceived();
13200
13201   tet_infoline( "Progress check reset" );
13202   progressCheck.Reset();
13203
13204   application.Render(durationSeconds*0.25*1000.0f ); // 75% progress
13205   tet_infoline( "Animation at 75%" );
13206   application.SendNotification();
13207
13208   DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
13209
13210   progressCheck.CheckSignalNotReceived();
13211
13212   END_TEST;
13213 }
13214
13215 int UtcDaliAnimationAnimateByInvalidParameters(void)
13216 {
13217   TestApplication application;
13218
13219   Actor actor = Actor::New();
13220   application.GetScene().Add(actor);
13221
13222   // Create the animation
13223   Animation animation = Animation::New(1.0f);
13224
13225   DALI_TEST_ASSERTION(
13226   {
13227     // non animateable property (STRING)
13228     animation.AnimateBy( Property( actor, Actor::Property::LAYOUT_DIRECTION ), Property::Value( "new direction" ) );
13229   }, "Property type is not animatable" );
13230
13231   DALI_TEST_ASSERTION(
13232   {
13233     // non animateable property (MATRIX)
13234     Property::Index index = actor.RegisterProperty( "Foobar", Property::Value( Dali::Matrix() ), Property::ANIMATABLE );
13235     animation.AnimateBy( Property( actor, index ), Property::Value( Property::MATRIX ) );
13236   }, "Property type is not animatable" );
13237
13238   // AnimateBy
13239   DALI_TEST_ASSERTION(
13240   {
13241     // non animateable target (NONE)
13242     animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value() );
13243   }, "Target value is not animatable" );
13244
13245   DALI_TEST_ASSERTION(
13246   {
13247     // non animateable target (STRING)
13248     animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value("foo") );
13249   }, "Target value is not animatable" );
13250
13251   DALI_TEST_ASSERTION(
13252   {
13253     // not mathing properties (VECTOR3, FLOAT)
13254     animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value( 10.f ) );
13255   }, "Property and target types don't match" );
13256
13257   DALI_TEST_ASSERTION(
13258   {
13259     // not mathing properties (VECTOR3.A, VECTOR2)
13260     animation.AnimateBy( Property( actor, Actor::Property::COLOR_ALPHA ), Property::Value( Property::VECTOR2 ) );
13261   }, "Property and target types don't match" );
13262
13263   DALI_TEST_ASSERTION(
13264   {
13265     // negative duration
13266     animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value( Vector3(1,2,3) ), TimePeriod(-1) );
13267   }, "Duration must be >=0" );
13268
13269   END_TEST;
13270 }
13271
13272 int UtcDaliAnimationAnimateToInvalidParameters(void)
13273 {
13274   TestApplication application;
13275
13276   Actor actor = Actor::New();
13277   application.GetScene().Add(actor);
13278
13279   // Create the animation
13280   Animation animation = Animation::New(1.0f);
13281
13282   // AnimateTo
13283   DALI_TEST_ASSERTION(
13284   {
13285     // non animateable property (MAP)
13286     Property::Index index = actor.RegisterProperty( "Foobar", Property::Value( Property::MAP ), Property::ANIMATABLE );
13287     animation.AnimateTo( Property( actor, index ), Property::Value( Property::MAP ) );
13288   }, "Property type is not animatable" );
13289
13290   DALI_TEST_ASSERTION(
13291   {
13292     // non animateable target (NONE)
13293     animation.AnimateTo( Property( actor, Actor::Property::CLIPPING_MODE ), Property::Value() );
13294   }, "Property type is not animatable" );
13295
13296   DALI_TEST_ASSERTION(
13297   {
13298     // non animateable target (ARRAY)
13299     animation.AnimateTo( Property( actor, Actor::Property::POSITION ), Property::Value( Property::ARRAY ) );
13300   }, "Target value is not animatable" );
13301
13302   DALI_TEST_ASSERTION(
13303   {
13304     // non animateable target (RECTANGLE)
13305     animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value( Rect<int32_t>() ) );
13306   }, "Target value is not animatable" );
13307
13308   DALI_TEST_ASSERTION(
13309   {
13310     // not mathing properties (FLOAT, INT)
13311     animation.AnimateTo( Property( actor, Actor::Property::SCALE_Y ), Property::Value(10) );
13312   }, "Property and target types don't match" );
13313
13314   DALI_TEST_ASSERTION(
13315   {
13316     // not mathing properties (VECTOR3, VECTOR2)
13317     animation.AnimateTo( Property( actor, Actor::Property::COLOR ), Property::Value( Property::VECTOR2 ) );
13318   }, "Property and target types don't match" );
13319
13320   DALI_TEST_ASSERTION(
13321   {
13322     // negative duration
13323     animation.AnimateTo( Property( actor, Actor::Property::POSITION ), Property::Value( Vector3(1,2,3) ), TimePeriod(-1) );
13324   }, "Duration must be >=0" );
13325
13326   END_TEST;
13327 }
13328
13329 int UtcDaliAnimationAnimateBetweenInvalidParameters(void)
13330 {
13331   TestApplication application;
13332
13333   Actor actor = Actor::New();
13334   application.GetScene().Add(actor);
13335
13336   // Create the animation
13337   Animation animation = Animation::New(1.0f);
13338
13339   // AnimateBetween
13340   DALI_TEST_ASSERTION(
13341   {
13342     // non animateable property (ARRAY)
13343     Property::Index index = actor.RegisterProperty( "Foobar", Property::Value( Property::ARRAY ), Property::ANIMATABLE );
13344     KeyFrames keyframes = KeyFrames::New();
13345     keyframes.Add( 0.5f, Property::Value( Property::ARRAY ) );
13346     animation.AnimateBetween( Property( actor, index ), keyframes );
13347   }, "Property type is not animatable" );
13348
13349   DALI_TEST_ASSERTION(
13350   {
13351     // non animateable target (NONE)
13352     KeyFrames keyframes = KeyFrames::New();
13353     keyframes.Add( 0.5f, Property::Value() );
13354     animation.AnimateBetween( Property( actor, Actor::Property::CLIPPING_MODE ), keyframes );
13355   }, "Property type is not animatable" );
13356
13357   DALI_TEST_ASSERTION(
13358   {
13359     // non animateable target (EXTENTS)
13360     KeyFrames keyframes = KeyFrames::New();
13361     keyframes.Add( 0.5f, Property::Value( Property::EXTENTS ) ); // throws
13362     animation.AnimateBetween( Property( actor, Actor::Property::POSITION ), keyframes );
13363   }, "Property type is not animatable" );
13364
13365   DALI_TEST_ASSERTION(
13366   {
13367     // non animateable target (RECTANGLE)
13368     KeyFrames keyframes = KeyFrames::New();
13369     keyframes.Add( 0.5f, Property::Value( Property::MAP ) ); // throws
13370     animation.AnimateBetween( Property( actor, Actor::Property::POSITION ), keyframes );
13371   }, "Property type is not animatable" );
13372
13373   DALI_TEST_ASSERTION(
13374   {
13375     // not mathing properties (VECTOR2, VECTOR4)
13376     KeyFrames keyframes = KeyFrames::New();
13377     keyframes.Add( 0.5f, Property::Value( Vector4( 1, 2, 3, 4 ) ) );
13378     animation.AnimateBetween( Property( actor, Actor::Property::MAXIMUM_SIZE ), keyframes );
13379   }, "Property and target types don't match" );
13380
13381   DALI_TEST_ASSERTION(
13382   {
13383     // negative duration
13384     KeyFrames keyframes = KeyFrames::New();
13385     keyframes.Add( 0.5f, Property::Value(Vector3( 1, 2, 3 ) ) );
13386     animation.AnimateBetween( Property( actor, Actor::Property::POSITION ), keyframes, TimePeriod(-1) );
13387   }, "Duration must be >=0" );
13388
13389   END_TEST;
13390 }
13391
13392 namespace // Purposefully left this in the middle as the values in this namespace are only used for the subsequent two test cases
13393 {
13394 enum TestFunction
13395 {
13396   STOP,
13397   CLEAR
13398 };
13399
13400 void CheckPropertyValuesWhenCallingAnimationMethod( TestFunction functionToTest, const char * testName )
13401 {
13402   tet_printf( "Testing %s\n", testName );
13403
13404   // When an Animation::Stop() or Animation::Clear() is called, the event-side property needs to be updated appropriately
13405   // This test checks that that is being done
13406
13407   const float durationSeconds( 1.0f );
13408   unsigned int halfAnimationDuration( static_cast< unsigned int >( durationSeconds * 1000.0f * 0.5f ) );
13409   const Vector3 originalPosition( Vector3::ZERO );
13410   const Vector3 targetPosition( 10.0f, 10.0f, 10.0f );
13411   const Vector3 halfWayToTarget( targetPosition * 0.5f );
13412
13413   struct ExpectedValue
13414   {
13415     Animation::EndAction endAction;
13416     Vector3 expectedGetPropertyValue;
13417   };
13418
13419   ExpectedValue expectedValueTable[] =
13420   {
13421    { Animation::Bake,      halfWayToTarget  }, // When baking, the current value is the final value.
13422    { Animation::BakeFinal, targetPosition   }, // When BakeFinal, we should jump to the final value when clearing or stopping.
13423    { Animation::Discard,   originalPosition }, // When discarding, we should jump back to the original value when clearing or stopping.
13424   };
13425   const auto expectedValueTableCount = sizeof( expectedValueTable ) / sizeof( ExpectedValue );
13426
13427   for( auto i = 0u; i < expectedValueTableCount; ++i  )
13428   {
13429     TestApplication application;
13430
13431     Actor actor = Actor::New();
13432     application.GetScene().Add(actor);
13433
13434     // Build the animation
13435     Animation animation = Animation::New( durationSeconds );
13436     animation.SetEndAction( expectedValueTable[ i ].endAction );
13437     animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR );
13438
13439     // Start the animation
13440     animation.Play();
13441
13442     application.SendNotification();
13443     application.Render( halfAnimationDuration );
13444
13445     // Stop or Clear the animation early, both have the same effect
13446     if( functionToTest == TestFunction::STOP )
13447     {
13448       animation.Stop();
13449     }
13450     else
13451     {
13452       animation.Clear();
13453     }
13454
13455     // The event side property should be set the expected value immediately, the update side property will still only be halfway as we haven't run an update yet
13456     DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ).Get< Vector3 >(), expectedValueTable[ i ].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION );
13457     DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::POSITION ).Get< Vector3 >(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION );
13458
13459     // After one frame, both values should match regardless of the End Action
13460     application.SendNotification();
13461     application.Render();
13462
13463     DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ).Get< Vector3 >(), expectedValueTable[ i ].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION );
13464     DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::POSITION ).Get< Vector3 >(), expectedValueTable[ i ].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION );
13465   }
13466 }
13467 } // unnamed namespace
13468
13469 int UtcDaliAnimationStopPropertyValue(void)
13470 {
13471   CheckPropertyValuesWhenCallingAnimationMethod( TestFunction::STOP, "UtcDaliAnimationStopPropertyValue" );
13472   END_TEST;
13473 }
13474
13475 int UtcDaliAnimationClearPropertyValue(void)
13476 {
13477   CheckPropertyValuesWhenCallingAnimationMethod( TestFunction::CLEAR, "UtcDaliAnimationStopPropertyValue" );
13478   END_TEST;
13479 }
13480
13481 int UtcDaliAnimationPausePropertyValue(void)
13482 {
13483   const float durationSeconds( 1.0f );
13484   unsigned int halfAnimationDuration( static_cast< unsigned int >( durationSeconds * 1000.0f * 0.5f ) );
13485   const Vector3 originalPosition( Vector3::ZERO );
13486   const Vector3 targetPosition( 10.0f, 10.0f, 10.0f );
13487   const Vector3 halfWayToTarget( targetPosition * 0.5f );
13488
13489   Animation::EndAction endActions[] =
13490   {
13491    Animation::Bake,
13492    Animation::BakeFinal,
13493    Animation::Discard,
13494   };
13495   const auto endActionCount = sizeof( endActions ) / sizeof( endActions[0] );
13496
13497   // For all end actions, when pausing, we stay at the current value
13498   for( auto i = 0u; i < endActionCount; ++i  )
13499   {
13500     TestApplication application;
13501
13502     Actor actor = Actor::New();
13503     application.GetScene().Add(actor);
13504
13505     // Build the animation
13506     Animation animation = Animation::New( durationSeconds );
13507     animation.SetEndAction( endActions[ i ] );
13508     animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR );
13509
13510     // Start the animation
13511     animation.Play();
13512
13513     application.SendNotification();
13514     application.Render( halfAnimationDuration );
13515
13516     // Puase the animation early
13517     animation.Pause();
13518
13519     // The event side property should be set the current value immediately, the update side property will still only be halfway
13520     DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ).Get< Vector3 >(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION );
13521     DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::POSITION ).Get< Vector3 >(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION );
13522
13523     // After one frame, both values should match regardless of the End Action
13524     application.SendNotification();
13525     application.Render();
13526
13527     DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ).Get< Vector3 >(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION );
13528     DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::POSITION ).Get< Vector3 >(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION );
13529   }
13530
13531   END_TEST;
13532 }
13533
13534 int UtcDaliAnimationPlayFromWithLoopCount(void)
13535 {
13536   TestApplication application;
13537
13538   auto actor = Actor::New();
13539   application.GetScene().Add( actor );
13540
13541   auto animation = Animation::New( 1.0f );
13542   animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f );
13543   animation.SetLoopCount( 2 );
13544   animation.Play();
13545
13546   application.SendNotification();
13547   application.Render( 1001 );
13548
13549   // One loop completed
13550
13551   application.Render( 2005 );
13552   application.SendNotification();
13553
13554   // 2 loops should have completed
13555   DALI_TEST_EQUALS( animation.GetCurrentLoop(), 2u, TEST_LOCATION );
13556
13557   // Another render needs to occur after all the loops end
13558   application.SendNotification();
13559   application.Render( 1000 );
13560
13561   // Stop the animation and use PlayFrom, previously we got an Assert here
13562   animation.Stop();
13563   animation.PlayFrom( 0.5f );
13564
13565   application.SendNotification();
13566   application.Render( 1000 );
13567
13568   DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
13569
13570   END_TEST;
13571 }
13572
13573 int UtcDaliAnimationCombineToAndByWithStop(void)
13574 {
13575   tet_infoline( "Ensure the Y Position is not modified when animating the X position using AnimateTo and AnimateBy");
13576
13577   TestApplication application;
13578
13579   auto actor = Actor::New();
13580   actor.SetProperty( Actor::Property::POSITION, Vector2( 100.0f, 100.0f ));
13581   application.GetScene().Add( actor );
13582
13583   auto animation = Animation::New( 1.0f );
13584   const float origY = actor.GetProperty( Actor::Property::POSITION_Y ).Get< float >();
13585   animation.AnimateTo( Property( actor, Actor::Property::POSITION ), Vector3( 150.0f, origY, 0.0f ), TimePeriod( 1.0f ) );
13586   animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Vector3( -30.0f, 0.0f, 0.0f ), TimePeriod( 1.0f, 1.0f ) );
13587   animation.Play();
13588
13589   application.SendNotification();
13590   application.Render( 500 );
13591
13592   application.SendNotification();
13593   application.Render( 500 );
13594
13595   application.SendNotification();
13596   application.Render( 500 );
13597
13598   // Stop and clear the animation using the current values
13599   animation.Stop();
13600   animation.Clear();
13601
13602   // Check the y position, it should be the same as before
13603   DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION_Y).Get< float >(), origY, TEST_LOCATION );
13604
13605   END_TEST;
13606 }
13607
13608 int UtcDaliAnimationCountAndGetAnimationAt(void)
13609 {
13610   tet_infoline( "UtcDaliAnimationCountAndGetAnimationAt");
13611
13612   TestApplication application;
13613
13614   auto actor = Actor::New();
13615   actor.SetProperty( Actor::Property::POSITION, Vector2( 100.0f, 100.0f ));
13616   application.GetScene().Add( actor );
13617
13618   auto animation = Animation::New( 1.0f );
13619   const float origY = actor.GetProperty( Actor::Property::POSITION_Y ).Get< float >();
13620   animation.AnimateTo( Property( actor, Actor::Property::POSITION ), Vector3( 150.0f, origY, 0.0f ), TimePeriod( 1.0f ) );
13621   animation.Play();
13622
13623   application.SendNotification();
13624   application.Render( 500 );
13625
13626   uint32_t animationCount = Dali::DevelAnimation::GetAnimationCount();
13627   DALI_TEST_EQUALS( animationCount, 1, TEST_LOCATION );
13628
13629   DALI_TEST_CHECK( !Dali::DevelAnimation::GetAnimationAt( 5 ) );
13630
13631   Dali::Animation animationReturned = Dali::DevelAnimation::GetAnimationAt( 0 );
13632   DALI_TEST_EQUALS( animationReturned.GetState(), Dali::Animation::State::PLAYING, TEST_LOCATION );
13633
13634   DALI_TEST_EQUALS( animation.GetDuration(), animationReturned.GetDuration(), TEST_LOCATION );
13635   DALI_TEST_EQUALS( animation.GetLoopCount(), animationReturned.GetLoopCount(), TEST_LOCATION );
13636   DALI_TEST_EQUALS( animation.IsLooping(), animationReturned.IsLooping(), TEST_LOCATION );
13637   DALI_TEST_EQUALS( animation.GetEndAction(), animationReturned.GetEndAction(), TEST_LOCATION );
13638   DALI_TEST_EQUALS( animation.GetState(), animationReturned.GetState(), TEST_LOCATION );
13639
13640   // Stop and clear the animation using the current values
13641   animation.Stop();
13642   animation.Clear();
13643
13644   END_TEST;
13645 }
13646
13647 int UtcDaliAnimationSetLoopingNegative(void)
13648 {
13649   TestApplication application;
13650   Dali::Animation instance;
13651   try
13652   {
13653     bool arg1(false);
13654     instance.SetLooping(arg1);
13655     DALI_TEST_CHECK(false); // Should not get here
13656   }
13657   catch(...)
13658   {
13659     DALI_TEST_CHECK(true); // We expect an assert
13660   }
13661   END_TEST;
13662 }
13663
13664 int UtcDaliAnimationSetDurationNegative(void)
13665 {
13666   TestApplication application;
13667   Dali::Animation instance;
13668   try
13669   {
13670     float arg1(0.0f);
13671     instance.SetDuration(arg1);
13672     DALI_TEST_CHECK(false); // Should not get here
13673   }
13674   catch(...)
13675   {
13676     DALI_TEST_CHECK(true); // We expect an assert
13677   }
13678   END_TEST;
13679 }
13680
13681 int UtcDaliAnimationGetLoopCountNegative(void)
13682 {
13683   TestApplication application;
13684   Dali::Animation instance;
13685   try
13686   {
13687     instance.GetLoopCount();
13688     DALI_TEST_CHECK(false); // Should not get here
13689   }
13690   catch(...)
13691   {
13692     DALI_TEST_CHECK(true); // We expect an assert
13693   }
13694   END_TEST;
13695 }
13696
13697 int UtcDaliAnimationSetEndActionNegative(void)
13698 {
13699   TestApplication application;
13700   Dali::Animation instance;
13701   try
13702   {
13703     Dali::Animation::EndAction arg1(Animation::Bake);
13704     instance.SetEndAction(arg1);
13705     DALI_TEST_CHECK(false); // Should not get here
13706   }
13707   catch(...)
13708   {
13709     DALI_TEST_CHECK(true); // We expect an assert
13710   }
13711   END_TEST;
13712 }
13713
13714 int UtcDaliAnimationSetLoopCountNegative(void)
13715 {
13716   TestApplication application;
13717   Dali::Animation instance;
13718   try
13719   {
13720     int arg1(0);
13721     instance.SetLoopCount(arg1);
13722     DALI_TEST_CHECK(false); // Should not get here
13723   }
13724   catch(...)
13725   {
13726     DALI_TEST_CHECK(true); // We expect an assert
13727   }
13728   END_TEST;
13729 }
13730
13731 int UtcDaliAnimationSetPlayRangeNegative(void)
13732 {
13733   TestApplication application;
13734   Dali::Animation instance;
13735   try
13736   {
13737     Dali::Vector2 arg1;
13738     instance.SetPlayRange(arg1);
13739     DALI_TEST_CHECK(false); // Should not get here
13740   }
13741   catch(...)
13742   {
13743     DALI_TEST_CHECK(true); // We expect an assert
13744   }
13745   END_TEST;
13746 }
13747
13748 int UtcDaliAnimationAnimateBetweenNegative01(void)
13749 {
13750   TestApplication application;
13751   Dali::Animation instance;
13752   Dali::Actor actor;
13753   try
13754   {
13755     Dali::Property arg1(actor, Actor::Property::POSITION);
13756     Dali::KeyFrames arg2;
13757     instance.AnimateBetween(arg1,arg2);
13758     DALI_TEST_CHECK(false); // Should not get here
13759   }
13760   catch(...)
13761   {
13762     DALI_TEST_CHECK(true); // We expect an assert
13763   }
13764   END_TEST;
13765 }
13766
13767 int UtcDaliAnimationAnimateBetweenNegative02(void)
13768 {
13769   TestApplication application;
13770   Dali::Animation instance;
13771   Dali::Actor actor;
13772   try
13773   {
13774     Dali::Property arg1(actor, Actor::Property::POSITION);
13775     Dali::KeyFrames arg2;
13776     Dali::Animation::Interpolation arg3(Animation::Linear);
13777     instance.AnimateBetween(arg1,arg2,arg3);
13778     DALI_TEST_CHECK(false); // Should not get here
13779   }
13780   catch(...)
13781   {
13782     DALI_TEST_CHECK(true); // We expect an assert
13783   }
13784   END_TEST;
13785 }
13786
13787 int UtcDaliAnimationAnimateBetweenNegative03(void)
13788 {
13789   TestApplication application;
13790   Dali::Animation instance;
13791   Dali::Actor actor;
13792   try
13793   {
13794     Dali::Property arg1(actor, Actor::Property::POSITION);
13795     Dali::KeyFrames arg2;
13796     Dali::TimePeriod arg3(1.0f);
13797     instance.AnimateBetween(arg1,arg2,arg3);
13798     DALI_TEST_CHECK(false); // Should not get here
13799   }
13800   catch(...)
13801   {
13802     DALI_TEST_CHECK(true); // We expect an assert
13803   }
13804   END_TEST;
13805 }
13806
13807 int UtcDaliAnimationAnimateBetweenNegative04(void)
13808 {
13809   TestApplication application;
13810   Dali::Animation instance;
13811   Dali::Actor actor;
13812   try
13813   {
13814     Dali::Property arg1(actor, Actor::Property::POSITION);
13815     Dali::KeyFrames arg2;
13816     Dali::TimePeriod arg3(1.0f);
13817     Dali::Animation::Interpolation arg4(Animation::Linear);
13818     instance.AnimateBetween(arg1,arg2,arg3,arg4);
13819     DALI_TEST_CHECK(false); // Should not get here
13820   }
13821   catch(...)
13822   {
13823     DALI_TEST_CHECK(true); // We expect an assert
13824   }
13825   END_TEST;
13826 }
13827
13828 int UtcDaliAnimationAnimateBetweenNegative05(void)
13829 {
13830   TestApplication application;
13831   Dali::Animation instance;
13832   Dali::Actor actor;
13833   try
13834   {
13835     Dali::Property arg1(actor, Actor::Property::POSITION);
13836     Dali::KeyFrames arg2;
13837     Dali::AlphaFunction arg3;
13838     instance.AnimateBetween(arg1,arg2,arg3);
13839     DALI_TEST_CHECK(false); // Should not get here
13840   }
13841   catch(...)
13842   {
13843     DALI_TEST_CHECK(true); // We expect an assert
13844   }
13845   END_TEST;
13846 }
13847
13848 int UtcDaliAnimationAnimateBetweenNegative06(void)
13849 {
13850   TestApplication application;
13851   Dali::Animation instance;
13852   Dali::Actor actor;
13853   try
13854   {
13855     Dali::Property arg1(actor, Actor::Property::POSITION);
13856     Dali::KeyFrames arg2;
13857     Dali::AlphaFunction arg3;
13858     Dali::Animation::Interpolation arg4(Animation::Linear);
13859     instance.AnimateBetween(arg1,arg2,arg3,arg4);
13860     DALI_TEST_CHECK(false); // Should not get here
13861   }
13862   catch(...)
13863   {
13864     DALI_TEST_CHECK(true); // We expect an assert
13865   }
13866   END_TEST;
13867 }
13868
13869 int UtcDaliAnimationAnimateBetweenNegative07(void)
13870 {
13871   TestApplication application;
13872   Dali::Animation instance;
13873   Dali::Actor actor;
13874   try
13875   {
13876     Dali::Property arg1(actor, Actor::Property::POSITION);
13877     Dali::KeyFrames arg2;
13878     Dali::AlphaFunction arg3;
13879     Dali::TimePeriod arg4(1.0f);
13880     instance.AnimateBetween(arg1,arg2,arg3,arg4);
13881     DALI_TEST_CHECK(false); // Should not get here
13882   }
13883   catch(...)
13884   {
13885     DALI_TEST_CHECK(true); // We expect an assert
13886   }
13887   END_TEST;
13888 }
13889
13890 int UtcDaliAnimationAnimateBetweenNegative08(void)
13891 {
13892   TestApplication application;
13893   Dali::Animation instance;
13894   Dali::Actor actor;
13895   try
13896   {
13897     Dali::Property arg1(actor, Actor::Property::POSITION);
13898     Dali::KeyFrames arg2;
13899     Dali::AlphaFunction arg3;
13900     Dali::TimePeriod arg4(1.0f);
13901     Dali::Animation::Interpolation arg5(Animation::Linear);
13902     instance.AnimateBetween(arg1,arg2,arg3,arg4,arg5);
13903     DALI_TEST_CHECK(false); // Should not get here
13904   }
13905   catch(...)
13906   {
13907     DALI_TEST_CHECK(true); // We expect an assert
13908   }
13909   END_TEST;
13910 }
13911
13912 int UtcDaliAnimationFinishedSignalNegative(void)
13913 {
13914   TestApplication application;
13915   Dali::Animation instance;
13916   try
13917   {
13918     instance.FinishedSignal();
13919     DALI_TEST_CHECK(false); // Should not get here
13920   }
13921   catch(...)
13922   {
13923     DALI_TEST_CHECK(true); // We expect an assert
13924   }
13925   END_TEST;
13926 }
13927
13928 int UtcDaliAnimationGetCurrentLoopNegative(void)
13929 {
13930   TestApplication application;
13931   Dali::Animation instance;
13932   try
13933   {
13934     instance.GetCurrentLoop();
13935     DALI_TEST_CHECK(false); // Should not get here
13936   }
13937   catch(...)
13938   {
13939     DALI_TEST_CHECK(true); // We expect an assert
13940   }
13941   END_TEST;
13942 }
13943
13944 int UtcDaliAnimationSetLoopingModeNegative(void)
13945 {
13946   TestApplication application;
13947   Dali::Animation instance;
13948   try
13949   {
13950     Dali::Animation::LoopingMode arg1(Animation::RESTART);
13951     instance.SetLoopingMode(arg1);
13952     DALI_TEST_CHECK(false); // Should not get here
13953   }
13954   catch(...)
13955   {
13956     DALI_TEST_CHECK(true); // We expect an assert
13957   }
13958   END_TEST;
13959 }
13960
13961 int UtcDaliAnimationSetSpeedFactorNegative(void)
13962 {
13963   TestApplication application;
13964   Dali::Animation instance;
13965   try
13966   {
13967     float arg1(0.0f);
13968     instance.SetSpeedFactor(arg1);
13969     DALI_TEST_CHECK(false); // Should not get here
13970   }
13971   catch(...)
13972   {
13973     DALI_TEST_CHECK(true); // We expect an assert
13974   }
13975   END_TEST;
13976 }
13977
13978 int UtcDaliAnimationGetCurrentProgressNegative(void)
13979 {
13980   TestApplication application;
13981   Dali::Animation instance;
13982   try
13983   {
13984     instance.GetCurrentProgress();
13985     DALI_TEST_CHECK(false); // Should not get here
13986   }
13987   catch(...)
13988   {
13989     DALI_TEST_CHECK(true); // We expect an assert
13990   }
13991   END_TEST;
13992 }
13993
13994 int UtcDaliAnimationSetCurrentProgressNegative(void)
13995 {
13996   TestApplication application;
13997   Dali::Animation instance;
13998   try
13999   {
14000     float arg1(0.0f);
14001     instance.SetCurrentProgress(arg1);
14002     DALI_TEST_CHECK(false); // Should not get here
14003   }
14004   catch(...)
14005   {
14006     DALI_TEST_CHECK(true); // We expect an assert
14007   }
14008   END_TEST;
14009 }
14010
14011 int UtcDaliAnimationSetDisconnectActionNegative(void)
14012 {
14013   TestApplication application;
14014   Dali::Animation instance;
14015   try
14016   {
14017     Dali::Animation::EndAction arg1(Animation::Bake);
14018     instance.SetDisconnectAction(arg1);
14019     DALI_TEST_CHECK(false); // Should not get here
14020   }
14021   catch(...)
14022   {
14023     DALI_TEST_CHECK(true); // We expect an assert
14024   }
14025   END_TEST;
14026 }
14027
14028 int UtcDaliAnimationSetDefaultAlphaFunctionNegative(void)
14029 {
14030   TestApplication application;
14031   Dali::Animation instance;
14032   try
14033   {
14034     Dali::AlphaFunction arg1;
14035     instance.SetDefaultAlphaFunction(arg1);
14036     DALI_TEST_CHECK(false); // Should not get here
14037   }
14038   catch(...)
14039   {
14040     DALI_TEST_CHECK(true); // We expect an assert
14041   }
14042   END_TEST;
14043 }
14044
14045 int UtcDaliAnimationHideNegative(void)
14046 {
14047   TestApplication application;
14048   Dali::Animation instance;
14049   try
14050   {
14051     Dali::Actor arg1;
14052     float arg2(0.0f);
14053     instance.Hide(arg1,arg2);
14054     DALI_TEST_CHECK(false); // Should not get here
14055   }
14056   catch(...)
14057   {
14058     DALI_TEST_CHECK(true); // We expect an assert
14059   }
14060   END_TEST;
14061 }
14062
14063 int UtcDaliAnimationPlayNegative(void)
14064 {
14065   TestApplication application;
14066   Dali::Animation instance;
14067   try
14068   {
14069     instance.Play();
14070     DALI_TEST_CHECK(false); // Should not get here
14071   }
14072   catch(...)
14073   {
14074     DALI_TEST_CHECK(true); // We expect an assert
14075   }
14076   END_TEST;
14077 }
14078
14079 int UtcDaliAnimationShowNegative(void)
14080 {
14081   TestApplication application;
14082   Dali::Animation instance;
14083   try
14084   {
14085     Dali::Actor arg1;
14086     float arg2(0.0f);
14087     instance.Show(arg1,arg2);
14088     DALI_TEST_CHECK(false); // Should not get here
14089   }
14090   catch(...)
14091   {
14092     DALI_TEST_CHECK(true); // We expect an assert
14093   }
14094   END_TEST;
14095 }
14096
14097 int UtcDaliAnimationStopNegative(void)
14098 {
14099   TestApplication application;
14100   Dali::Animation instance;
14101   try
14102   {
14103     instance.Stop();
14104     DALI_TEST_CHECK(false); // Should not get here
14105   }
14106   catch(...)
14107   {
14108     DALI_TEST_CHECK(true); // We expect an assert
14109   }
14110   END_TEST;
14111 }
14112
14113 int UtcDaliAnimationClearNegative(void)
14114 {
14115   TestApplication application;
14116   Dali::Animation instance;
14117   try
14118   {
14119     instance.Clear();
14120     DALI_TEST_CHECK(false); // Should not get here
14121   }
14122   catch(...)
14123   {
14124     DALI_TEST_CHECK(true); // We expect an assert
14125   }
14126   END_TEST;
14127 }
14128
14129 int UtcDaliAnimationPauseNegative(void)
14130 {
14131   TestApplication application;
14132   Dali::Animation instance;
14133   try
14134   {
14135     instance.Pause();
14136     DALI_TEST_CHECK(false); // Should not get here
14137   }
14138   catch(...)
14139   {
14140     DALI_TEST_CHECK(true); // We expect an assert
14141   }
14142   END_TEST;
14143 }
14144
14145 int UtcDaliAnimationAnimateNegative01(void)
14146 {
14147   TestApplication application;
14148   Dali::Animation instance;
14149   try
14150   {
14151     Dali::Actor arg1;
14152     Dali::Path arg2;
14153     Dali::Vector3 arg3;
14154     instance.Animate(arg1,arg2,arg3);
14155     DALI_TEST_CHECK(false); // Should not get here
14156   }
14157   catch(...)
14158   {
14159     DALI_TEST_CHECK(true); // We expect an assert
14160   }
14161   END_TEST;
14162 }
14163
14164 int UtcDaliAnimationAnimateNegative02(void)
14165 {
14166   TestApplication application;
14167   Dali::Animation instance;
14168   try
14169   {
14170     Dali::Actor arg1;
14171     Dali::Path arg2;
14172     Dali::Vector3 arg3;
14173     Dali::TimePeriod arg4(1.0f);
14174     instance.Animate(arg1,arg2,arg3,arg4);
14175     DALI_TEST_CHECK(false); // Should not get here
14176   }
14177   catch(...)
14178   {
14179     DALI_TEST_CHECK(true); // We expect an assert
14180   }
14181   END_TEST;
14182 }
14183
14184 int UtcDaliAnimationAnimateNegative03(void)
14185 {
14186   TestApplication application;
14187   Dali::Animation instance;
14188   try
14189   {
14190     Dali::Actor arg1;
14191     Dali::Path arg2;
14192     Dali::Vector3 arg3;
14193     Dali::AlphaFunction arg4;
14194     instance.Animate(arg1,arg2,arg3,arg4);
14195     DALI_TEST_CHECK(false); // Should not get here
14196   }
14197   catch(...)
14198   {
14199     DALI_TEST_CHECK(true); // We expect an assert
14200   }
14201   END_TEST;
14202 }
14203
14204 int UtcDaliAnimationAnimateNegative04(void)
14205 {
14206   TestApplication application;
14207   Dali::Animation instance;
14208   try
14209   {
14210     Dali::Actor arg1;
14211     Dali::Path arg2;
14212     Dali::Vector3 arg3;
14213     Dali::AlphaFunction arg4;
14214     Dali::TimePeriod arg5(1.0f);
14215     instance.Animate(arg1,arg2,arg3,arg4,arg5);
14216     DALI_TEST_CHECK(false); // Should not get here
14217   }
14218   catch(...)
14219   {
14220     DALI_TEST_CHECK(true); // We expect an assert
14221   }
14222   END_TEST;
14223 }
14224
14225 int UtcDaliAnimationPlayFromNegative(void)
14226 {
14227   TestApplication application;
14228   Dali::Animation instance;
14229   try
14230   {
14231     float arg1(0.0f);
14232     instance.PlayFrom(arg1);
14233     DALI_TEST_CHECK(false); // Should not get here
14234   }
14235   catch(...)
14236   {
14237     DALI_TEST_CHECK(true); // We expect an assert
14238   }
14239   END_TEST;
14240 }
14241
14242 int UtcDaliAnimationAnimateByNegative01(void)
14243 {
14244   TestApplication application;
14245   Dali::Animation instance;
14246   Dali::Actor actor;
14247   try
14248   {
14249     Dali::Property arg1(actor, Actor::Property::POSITION);
14250     Dali::Property::Value arg2;
14251     instance.AnimateBy(arg1,arg2);
14252     DALI_TEST_CHECK(false); // Should not get here
14253   }
14254   catch(...)
14255   {
14256     DALI_TEST_CHECK(true); // We expect an assert
14257   }
14258   END_TEST;
14259 }
14260
14261 int UtcDaliAnimationAnimateByNegative02(void)
14262 {
14263   TestApplication application;
14264   Dali::Animation instance;
14265   Dali::Actor actor;
14266   try
14267   {
14268     Dali::Property arg1(actor, Actor::Property::POSITION);
14269     Dali::Property::Value arg2;
14270     Dali::TimePeriod arg3(1.0f);
14271     instance.AnimateBy(arg1,arg2,arg3);
14272     DALI_TEST_CHECK(false); // Should not get here
14273   }
14274   catch(...)
14275   {
14276     DALI_TEST_CHECK(true); // We expect an assert
14277   }
14278   END_TEST;
14279 }
14280
14281 int UtcDaliAnimationAnimateByNegative03(void)
14282 {
14283   TestApplication application;
14284   Dali::Animation instance;
14285   Dali::Actor actor;
14286   try
14287   {
14288     Dali::Property arg1(actor, Actor::Property::POSITION);
14289     Dali::Property::Value arg2;
14290     Dali::AlphaFunction arg3;
14291     instance.AnimateBy(arg1,arg2,arg3);
14292     DALI_TEST_CHECK(false); // Should not get here
14293   }
14294   catch(...)
14295   {
14296     DALI_TEST_CHECK(true); // We expect an assert
14297   }
14298   END_TEST;
14299 }
14300
14301 int UtcDaliAnimationAnimateByNegative04(void)
14302 {
14303   TestApplication application;
14304   Dali::Animation instance;
14305   Dali::Actor actor;
14306   try
14307   {
14308     Dali::Property arg1(actor, Actor::Property::POSITION);
14309     Dali::Property::Value arg2;
14310     Dali::AlphaFunction arg3;
14311     Dali::TimePeriod arg4(1.0f);
14312     instance.AnimateBy(arg1,arg2,arg3,arg4);
14313     DALI_TEST_CHECK(false); // Should not get here
14314   }
14315   catch(...)
14316   {
14317     DALI_TEST_CHECK(true); // We expect an assert
14318   }
14319   END_TEST;
14320 }
14321
14322 int UtcDaliAnimationAnimateToNegative01(void)
14323 {
14324   TestApplication application;
14325   Dali::Actor actor;
14326   Dali::Animation instance;
14327   try
14328   {
14329     Dali::Property arg1(actor, Actor::Property::POSITION);
14330     Dali::Property::Value arg2;
14331     instance.AnimateTo(arg1,arg2);
14332     DALI_TEST_CHECK(false); // Should not get here
14333   }
14334   catch(...)
14335   {
14336     DALI_TEST_CHECK(true); // We expect an assert
14337   }
14338   END_TEST;
14339 }
14340
14341 int UtcDaliAnimationAnimateToNegative02(void)
14342 {
14343   TestApplication application;
14344   Dali::Animation instance;
14345   Dali::Actor actor;
14346   try
14347   {
14348     Dali::Property arg1(actor, Actor::Property::POSITION);
14349     Dali::Property::Value arg2;
14350     Dali::TimePeriod arg3(1.0f);
14351     instance.AnimateTo(arg1,arg2,arg3);
14352     DALI_TEST_CHECK(false); // Should not get here
14353   }
14354   catch(...)
14355   {
14356     DALI_TEST_CHECK(true); // We expect an assert
14357   }
14358   END_TEST;
14359 }
14360
14361 int UtcDaliAnimationAnimateToNegative03(void)
14362 {
14363   TestApplication application;
14364   Dali::Animation instance;
14365   Dali::Actor actor;
14366   try
14367   {
14368     Dali::Property arg1(actor, Actor::Property::POSITION);
14369     Dali::Property::Value arg2;
14370     Dali::AlphaFunction arg3;
14371     instance.AnimateTo(arg1,arg2,arg3);
14372     DALI_TEST_CHECK(false); // Should not get here
14373   }
14374   catch(...)
14375   {
14376     DALI_TEST_CHECK(true); // We expect an assert
14377   }
14378   END_TEST;
14379 }
14380
14381 int UtcDaliAnimationAnimateToNegative04(void)
14382 {
14383   TestApplication application;
14384   Dali::Animation instance;
14385   Dali::Actor actor;
14386   try
14387   {
14388     Dali::Property arg1(actor, Actor::Property::POSITION);
14389     Dali::Property::Value arg2;
14390     Dali::AlphaFunction arg3;
14391     Dali::TimePeriod arg4(1.0f);
14392     instance.AnimateTo(arg1,arg2,arg3,arg4);
14393     DALI_TEST_CHECK(false); // Should not get here
14394   }
14395   catch(...)
14396   {
14397     DALI_TEST_CHECK(true); // We expect an assert
14398   }
14399   END_TEST;
14400 }
14401
14402 int UtcDaliAnimationPlayAfterNegative(void)
14403 {
14404   TestApplication application;
14405   Dali::Animation instance;
14406   try
14407   {
14408     float arg1(0.0f);
14409     instance.PlayAfter(arg1);
14410     DALI_TEST_CHECK(false); // Should not get here
14411   }
14412   catch(...)
14413   {
14414     DALI_TEST_CHECK(true); // We expect an assert
14415   }
14416   END_TEST;
14417 }
14418
14419 int UtcDaliAnimationGetDurationNegative(void)
14420 {
14421   TestApplication application;
14422   Dali::Animation instance;
14423   try
14424   {
14425     instance.GetDuration();
14426     DALI_TEST_CHECK(false); // Should not get here
14427   }
14428   catch(...)
14429   {
14430     DALI_TEST_CHECK(true); // We expect an assert
14431   }
14432   END_TEST;
14433 }
14434
14435 int UtcDaliAnimationGetEndActionNegative(void)
14436 {
14437   TestApplication application;
14438   Dali::Animation instance;
14439   try
14440   {
14441     instance.GetEndAction();
14442     DALI_TEST_CHECK(false); // Should not get here
14443   }
14444   catch(...)
14445   {
14446     DALI_TEST_CHECK(true); // We expect an assert
14447   }
14448   END_TEST;
14449 }
14450
14451 int UtcDaliAnimationGetPlayRangeNegative(void)
14452 {
14453   TestApplication application;
14454   Dali::Animation instance;
14455   try
14456   {
14457     instance.GetPlayRange();
14458     DALI_TEST_CHECK(false); // Should not get here
14459   }
14460   catch(...)
14461   {
14462     DALI_TEST_CHECK(true); // We expect an assert
14463   }
14464   END_TEST;
14465 }
14466
14467 int UtcDaliAnimationGetLoopingModeNegative(void)
14468 {
14469   TestApplication application;
14470   Dali::Animation instance;
14471   try
14472   {
14473     instance.GetLoopingMode();
14474     DALI_TEST_CHECK(false); // Should not get here
14475   }
14476   catch(...)
14477   {
14478     DALI_TEST_CHECK(true); // We expect an assert
14479   }
14480   END_TEST;
14481 }
14482
14483 int UtcDaliAnimationGetSpeedFactorNegative(void)
14484 {
14485   TestApplication application;
14486   Dali::Animation instance;
14487   try
14488   {
14489     instance.GetSpeedFactor();
14490     DALI_TEST_CHECK(false); // Should not get here
14491   }
14492   catch(...)
14493   {
14494     DALI_TEST_CHECK(true); // We expect an assert
14495   }
14496   END_TEST;
14497 }
14498
14499 int UtcDaliAnimationGetDisconnectActionNegative(void)
14500 {
14501   TestApplication application;
14502   Dali::Animation instance;
14503   try
14504   {
14505     instance.GetDisconnectAction();
14506     DALI_TEST_CHECK(false); // Should not get here
14507   }
14508   catch(...)
14509   {
14510     DALI_TEST_CHECK(true); // We expect an assert
14511   }
14512   END_TEST;
14513 }
14514
14515 int UtcDaliAnimationGetDefaultAlphaFunctionNegative(void)
14516 {
14517   TestApplication application;
14518   Dali::Animation instance;
14519   try
14520   {
14521     instance.GetDefaultAlphaFunction();
14522     DALI_TEST_CHECK(false); // Should not get here
14523   }
14524   catch(...)
14525   {
14526     DALI_TEST_CHECK(true); // We expect an assert
14527   }
14528   END_TEST;
14529 }
14530
14531 int UtcDaliAnimationGetStateNegative(void)
14532 {
14533   TestApplication application;
14534   Dali::Animation instance;
14535   try
14536   {
14537     instance.GetState();
14538     DALI_TEST_CHECK(false); // Should not get here
14539   }
14540   catch(...)
14541   {
14542     DALI_TEST_CHECK(true); // We expect an assert
14543   }
14544   END_TEST;
14545 }
14546
14547 int UtcDaliAnimationIsLoopingNegative(void)
14548 {
14549   TestApplication application;
14550   Dali::Animation instance;
14551   try
14552   {
14553     instance.IsLooping();
14554     DALI_TEST_CHECK(false); // Should not get here
14555   }
14556   catch(...)
14557   {
14558     DALI_TEST_CHECK(true); // We expect an assert
14559   }
14560   END_TEST;
14561 }
14562
14563 int UtcDaliKeyFramesAddNegative01(void)
14564 {
14565   TestApplication application;
14566   Dali::KeyFrames instance;
14567   try
14568   {
14569     float arg1(0.0f);
14570     Dali::Property::Value arg2;
14571     instance.Add(arg1,arg2);
14572     DALI_TEST_CHECK(false); // Should not get here
14573   }
14574   catch(...)
14575   {
14576     DALI_TEST_CHECK(true); // We expect an assert
14577   }
14578   END_TEST;
14579 }
14580
14581 int UtcDaliKeyFramesAddNegative02(void)
14582 {
14583   TestApplication application;
14584   Dali::KeyFrames instance;
14585   try
14586   {
14587     float arg1(0.0f);
14588     Dali::Property::Value arg2;
14589     Dali::AlphaFunction arg3;
14590     instance.Add(arg1,arg2,arg3);
14591     DALI_TEST_CHECK(false); // Should not get here
14592   }
14593   catch(...)
14594   {
14595     DALI_TEST_CHECK(true); // We expect an assert
14596   }
14597   END_TEST;
14598 }
14599
14600 int UtcDaliKeyFramesGetTypeNegative(void)
14601 {
14602   TestApplication application;
14603   Dali::KeyFrames instance;
14604   try
14605   {
14606     instance.GetType();
14607     DALI_TEST_CHECK(false); // Should not get here
14608   }
14609   catch(...)
14610   {
14611     DALI_TEST_CHECK(true); // We expect an assert
14612   }
14613   END_TEST;
14614 }