Changes after Set/Get synchronous behaviour of registered animatable & custom properties
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-TransitionData.cpp
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #include <iostream>
18 #include <stdlib.h>
19 #include <dali-toolkit-test-suite-utils.h>
20 #include <dali.h>
21 #include <dali/devel-api/object/handle-devel.h>
22 #include <dali-toolkit/dali-toolkit.h>
23 #include <dali-toolkit/devel-api/visual-factory/transition-data.h>
24 #include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
25 #include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
26 #include "dummy-control.h"
27
28 using namespace Dali;
29 using namespace Toolkit;
30
31
32 void utc_dali_toolkit_transition_data_startup(void)
33 {
34   test_return_value = TET_UNDEF;
35 }
36
37 void utc_dali_toolkit_transition_data_cleanup(void)
38 {
39   test_return_value = TET_PASS;
40 }
41
42 Property::Map CreateMap()
43 {
44   Property::Map map;
45
46   map["target"] = "Actor1";
47   map["property"] = "color";
48   map["initialValue"] = Color::MAGENTA;
49   map["targetValue"] = Color::RED;
50   map["animator"] = Property::Map()
51     .Add("alphaFunction", "EASE_IN_OUT_BACK")
52     .Add("timePeriod", Property::Map()
53          .Add("delay", 0.5f)
54          .Add("duration", 1.0f));
55   return map;
56 }
57
58 void CHECK_ARRAY_EQUALS( Property::Array test, Property::Value result )
59 {
60   if( result.GetType() == Property::ARRAY )
61   {
62     // Compare arrays
63     Property::Array *resultArray = result.GetArray();
64     DALI_TEST_EQUALS( test.Count(), resultArray->Count(), TEST_LOCATION );
65     for( size_t i=0; i < std::min(test.Count(), resultArray->Count()); ++i )
66     {
67       Property::Value a = test.GetElementAt(i);
68       Property::Value b = resultArray->GetElementAt(i);
69       DALI_TEST_EQUALS( a.GetType(), b.GetType(), TEST_LOCATION );
70       DALI_TEST_EQUALS( a, b, 0.001, TEST_LOCATION );
71     }
72   }
73   else if( result.GetType() == Property::VECTOR4 )
74   {
75     Vector4 value = result.Get<Vector4>();
76     DALI_TEST_CHECK( test.Count() >= 4 );
77     for( size_t i=0; i < 4; ++i )
78     {
79       Property::Value a = test.GetElementAt(i);
80       DALI_TEST_EQUALS( a.GetType(), Property::FLOAT, TEST_LOCATION );
81       DALI_TEST_EQUALS( a.Get<float>(), value[i], 0.001, TEST_LOCATION );
82     }
83   }
84   else
85   {
86     DALI_TEST_CHECK( 0 );
87   }
88 }
89
90 void CHECK_MAP_EQUALS( Property::Map test, Property::Map result )
91 {
92   DALI_TEST_EQUALS(test.Count(), result.Count(), TEST_LOCATION);
93
94   for( unsigned int i=0; i< test.Count(); ++i )
95   {
96     KeyValuePair keyValue = test.GetKeyValue(i);
97     Property::Value* value;
98
99     if( keyValue.first.type == Property::Key::STRING )
100     {
101       value = result.Find(keyValue.first.stringKey);
102     }
103     else
104     {
105       value = result.Find(keyValue.first.indexKey);
106     }
107
108     DALI_TEST_CHECK( value != NULL );
109     if( value != NULL )
110     {
111       if( keyValue.second.GetType() == Property::MAP )
112       {
113         DALI_TEST_EQUALS( keyValue.second.GetType(), value->GetType(), TEST_LOCATION );
114         CHECK_MAP_EQUALS( *(keyValue.second.GetMap()), *(value->GetMap()) );
115       }
116       else if( keyValue.second.GetType() == Property::ARRAY )
117       {
118         CHECK_ARRAY_EQUALS( *(keyValue.second.GetArray()), *value );
119       }
120       else if( keyValue.second.GetType() == Property::STRING )
121       {
122         DALI_TEST_EQUALS( keyValue.second.GetType(), value->GetType(), TEST_LOCATION );
123         std::string str;
124         value->Get(str);
125         DALI_TEST_EQUALS( keyValue.second, str.c_str(), TEST_LOCATION );
126       }
127       else
128       {
129         DALI_TEST_EQUALS( keyValue.second.GetType(), value->GetType(), TEST_LOCATION );
130         DALI_TEST_EQUALS( keyValue.second, *value, 0.001f, TEST_LOCATION );
131       }
132     }
133   }
134 }
135
136
137 int UtcDaliTransitionDataNew(void)
138 {
139   TestApplication application;
140
141   Property::Map map = CreateMap();
142   Dali::Toolkit::TransitionData transition = TransitionData::New( map );
143   DALI_TEST_CHECK( transition );
144
145   END_TEST;
146 }
147
148 int UtcDaliTransitionDataDownCast(void)
149 {
150   TestApplication application;
151
152   Property::Map map = CreateMap();
153
154   BaseHandle handle = TransitionData::New( map );
155   DALI_TEST_CHECK( handle );
156
157   TransitionData transitionData = TransitionData::DownCast( handle );
158   DALI_TEST_CHECK( transitionData );
159   END_TEST;
160 }
161
162 int UtcDaliTransitionDataCopyConstructor(void)
163 {
164   TestApplication application;
165
166   Property::Map map = CreateMap();
167
168   TransitionData transitionData = TransitionData::New( map );
169   DALI_TEST_CHECK( transitionData );
170
171   TransitionData td2( transitionData );
172   DALI_TEST_CHECK( td2 );
173   DALI_TEST_EQUALS( td2.Count(), 1, TEST_LOCATION );
174   END_TEST;
175 }
176
177 int UtcDaliTransitionDataAssignmentOperator(void)
178 {
179   TestApplication application;
180
181   Property::Map map = CreateMap();
182
183   TransitionData transitionData = TransitionData::New( map );
184   DALI_TEST_CHECK( transitionData );
185
186   TransitionData td2;
187   DALI_TEST_CHECK( !td2 );
188
189   td2 = transitionData;
190   DALI_TEST_CHECK( td2 );
191
192   DALI_TEST_EQUALS( td2.Count(), 1, TEST_LOCATION );
193   END_TEST;
194 }
195
196 int UtcDaliTransitionDataCount(void)
197 {
198   TestApplication application;
199
200   Property::Map map = CreateMap();
201   TransitionData transitionData = TransitionData::New( map );
202   DALI_TEST_CHECK( transitionData );
203   DALI_TEST_EQUALS( transitionData.Count(), 1, TEST_LOCATION );
204
205   Property::Array array;
206   array.PushBack( map );
207   array.PushBack( map );
208   array.PushBack( map );
209
210   TransitionData transitionData2 = TransitionData::New( array );
211   DALI_TEST_CHECK( transitionData2 );
212   DALI_TEST_EQUALS( transitionData2.Count(), 3, TEST_LOCATION );
213
214   END_TEST;
215 }
216
217 int UtcDaliTransitionDataMap1P(void)
218 {
219   TestApplication application;
220
221   tet_printf("Testing animation of a visual property using stylesheet equivalent maps\n");
222
223   Property::Map map;
224   map["target"] = "visual1";
225   map["property"] = "mixColor";
226   map["initialValue"] = Color::MAGENTA;
227   map["targetValue"] = Color::RED;
228   map["animator"] = Property::Map()
229     .Add("alphaFunction", "EASE_IN_OUT")
230     .Add("timePeriod", Property::Map()
231          .Add("delay", 0.5f)
232          .Add("duration", 1.0f));
233
234   Dali::Toolkit::TransitionData transition = TransitionData::New( map );
235
236   DummyControl actor = DummyControl::New();
237   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
238   actor.SetName("Actor1");
239   actor.SetColor(Color::CYAN);
240   Stage::GetCurrent().Add(actor);
241
242   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
243
244   Property::Map visualMap;
245   visualMap[Visual::Property::TYPE] = Visual::COLOR;
246   visualMap[ColorVisual::Property::MIX_COLOR] = Color::MAGENTA;
247   Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap );
248   visual.SetName( "visual1" );
249
250   Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
251   dummyImpl.RegisterVisual( visualIndex, visual );
252
253   Animation anim = dummyImpl.CreateTransition( transition );
254   DALI_TEST_CHECK( anim );
255
256   Renderer renderer = actor.GetRendererAt(0);
257   Property::Index mixColorIndex = DevelHandle::GetPropertyIndex( renderer, ColorVisual::Property::MIX_COLOR );
258   Property::Index opacityIndex = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::OPACITY );
259   application.SendNotification();
260   application.Render(0);
261
262   DALI_TEST_EQUALS( renderer.GetProperty<Vector3>(mixColorIndex), Vector3(Color::MAGENTA), TEST_LOCATION);
263   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( renderer, mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION );
264   DALI_TEST_EQUALS( renderer.GetProperty<float>(opacityIndex), 1.0f, 0.001f, TEST_LOCATION );
265   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( renderer, opacityIndex ), 1.0f, 0.001f, TEST_LOCATION );
266
267   anim.Play();
268
269   application.SendNotification();
270   application.Render(500); // Start animation
271   application.Render(500); // Halfway thru anim
272   application.SendNotification();
273   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( renderer, mixColorIndex ), Vector3(Color::MAGENTA+Color::RED)*0.5f, TEST_LOCATION);
274   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( renderer, opacityIndex ), 1.0f, 0.001f, TEST_LOCATION );
275
276   application.Render(500); // End of anim
277   application.SendNotification();
278   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( renderer, mixColorIndex ), Vector3(Color::RED), TEST_LOCATION );
279   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( renderer, opacityIndex ), 1.0f, 0.001f, TEST_LOCATION );
280
281   END_TEST;
282 }
283
284
285
286 int UtcDaliTransitionDataMap2P(void)
287 {
288   TestApplication application;
289
290   tet_printf("Testing animation of a visual property using programmatic maps\n");
291
292   Property::Map map;
293   map["target"] = "visual1";
294   map["property"] = ColorVisual::Property::MIX_COLOR;
295   map["initialValue"] = Color::MAGENTA;
296   map["targetValue"] = Color::RED;
297   map["animator"] = Property::Map()
298     .Add("alphaFunction", "LINEAR")
299     .Add("timePeriod", Property::Map()
300          .Add("delay", 0.5f)
301          .Add("duration", 1.0f));
302
303   Dali::Toolkit::TransitionData transition = TransitionData::New( map );
304
305   DummyControl actor = DummyControl::New();
306   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
307   actor.SetName("Actor1");
308   actor.SetColor(Color::CYAN);
309   Stage::GetCurrent().Add(actor);
310
311   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
312
313   Property::Map visualMap;
314   visualMap[Visual::Property::TYPE] = Visual::COLOR;
315   visualMap[ColorVisual::Property::MIX_COLOR] = Color::MAGENTA;
316   Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap );
317   visual.SetName( "visual1" );
318
319   Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
320   dummyImpl.RegisterVisual( visualIndex, visual );
321
322   Animation anim = dummyImpl.CreateTransition( transition );
323   DALI_TEST_CHECK( anim );
324
325   Renderer renderer = actor.GetRendererAt(0);
326   Property::Index mixColorIndex = DevelHandle::GetPropertyIndex( renderer, ColorVisual::Property::MIX_COLOR );
327   Property::Index opacityIndex = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::OPACITY );
328   application.SendNotification();
329   application.Render(0);
330
331   DALI_TEST_EQUALS( renderer.GetProperty<Vector3>(mixColorIndex), Vector3(Color::MAGENTA), TEST_LOCATION);
332   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( renderer, mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION );
333   DALI_TEST_EQUALS( renderer.GetProperty<float>(opacityIndex), 1.0f, 0.001f, TEST_LOCATION );
334   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( renderer, opacityIndex ), 1.0f, 0.001f, TEST_LOCATION );
335
336   anim.Play();
337
338   application.SendNotification();
339   application.Render(0);
340   application.Render(500); // Start animation
341   application.Render(500); // Halfway thru anim
342   application.SendNotification();
343   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( renderer, mixColorIndex ), Vector3(Color::MAGENTA+Color::RED)*0.5f, TEST_LOCATION);
344   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( renderer, opacityIndex ), 1.0f, 0.001f, TEST_LOCATION);
345
346   application.Render(500); // End of anim
347   application.SendNotification();
348   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( renderer, mixColorIndex ), Vector3(Color::RED), TEST_LOCATION );
349   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( renderer, opacityIndex ), 1.0f, 0.001f, TEST_LOCATION);
350
351   END_TEST;
352 }
353
354
355 int UtcDaliTransitionDataMap2Pb(void)
356 {
357   TestApplication application;
358
359   tet_printf("Testing animation of a visual property using programmatic maps\n");
360
361   Property::Map map;
362   map["target"] = "visual1";
363   map["property"] = PrimitiveVisual::Property::MIX_COLOR;
364   map["initialValue"] = Color::MAGENTA;
365   map["targetValue"] = Color::RED;
366   map["animator"] = Property::Map()
367     .Add("alphaFunction", "LINEAR")
368     .Add("timePeriod", Property::Map()
369          .Add("delay", 0.5f)
370          .Add("duration", 1.0f));
371
372   Dali::Toolkit::TransitionData transition = TransitionData::New( map );
373
374   DummyControl actor = DummyControl::New();
375   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
376   actor.SetName("Actor1");
377   actor.SetColor(Color::CYAN);
378   Stage::GetCurrent().Add(actor);
379
380   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
381
382   Property::Map visualMap;
383   visualMap[Visual::Property::TYPE] = Visual::PRIMITIVE;
384   visualMap[PrimitiveVisual::Property::MIX_COLOR] = Color::MAGENTA;
385   visualMap[ PrimitiveVisual::Property::SHAPE  ] = PrimitiveVisual::Shape::SPHERE;
386   visualMap[ PrimitiveVisual::Property::SLICES ] = 10;
387   visualMap[ PrimitiveVisual::Property::STACKS ] = 10;
388
389   Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap );
390   visual.SetName( "visual1" );
391
392   Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
393   dummyImpl.RegisterVisual( visualIndex, visual );
394
395   Animation anim = dummyImpl.CreateTransition( transition );
396   DALI_TEST_CHECK( anim );
397
398   Renderer renderer = actor.GetRendererAt(0);
399   Property::Index mixColorIndex = DevelHandle::GetPropertyIndex( renderer, PrimitiveVisual::Property::MIX_COLOR );
400   Property::Index opacityIndex = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::OPACITY );
401   application.SendNotification();
402   application.Render(0);
403
404   DALI_TEST_EQUALS( renderer.GetProperty<Vector3>(mixColorIndex), Vector3(Color::MAGENTA), TEST_LOCATION);
405   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( renderer, mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION );
406   DALI_TEST_EQUALS( renderer.GetProperty<float>(opacityIndex), 1.0f, 0.001f, TEST_LOCATION );
407   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( renderer, opacityIndex ), 1.0f, 0.001f, TEST_LOCATION );
408
409   anim.Play();
410
411   application.SendNotification();
412   application.Render(0);
413   application.Render(500); // Start animation
414   application.Render(500); // Halfway thru anim
415   application.SendNotification();
416   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( renderer, mixColorIndex ), Vector3(Color::MAGENTA+Color::RED)*0.5f, TEST_LOCATION);
417   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( renderer, opacityIndex ), 1.0f, 0.001f, TEST_LOCATION);
418
419   application.Render(500); // End of anim
420   application.SendNotification();
421   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( renderer, mixColorIndex ), Vector3(Color::RED), TEST_LOCATION );
422   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( renderer, opacityIndex ), 1.0f, 0.001f, TEST_LOCATION);
423
424   END_TEST;
425 }
426
427
428 int UtcDaliTransitionDataMap3P(void)
429 {
430   TestApplication application;
431
432   tet_printf("Testing animation of an actor's position property using bezier curve\n");
433
434   Property::Map map;
435   map["target"] = "Actor1";
436   map["property"] = "position";
437   map["initialValue"] = Vector3(0, 0, 0);
438   map["targetValue"] = Vector3(100, 100, 0);
439   map["animator"] = Property::Map()
440     .Add("alphaFunction", Vector4(0.71, -0.57, 0.42, 1.38) )
441     .Add("timePeriod", Property::Map()
442          .Add("delay", 0.0f)
443          .Add("duration", 1.0f));
444
445   Dali::Toolkit::TransitionData transition = TransitionData::New( map );
446
447   DummyControl actor = DummyControl::New();
448   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
449   actor.SetName("Actor1");
450   Stage::GetCurrent().Add(actor);
451
452   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
453   Animation anim = dummyImpl.CreateTransition( transition );
454   DALI_TEST_CHECK( anim );
455
456   application.SendNotification();
457   application.Render(0);
458   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(0,0,0), 0.001f, TEST_LOCATION);
459
460   anim.Play();
461
462   application.SendNotification();
463   application.Render(0);
464
465   application.Render(250); // 25%
466   application.SendNotification();
467   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(-10,-10,0), 1.0, TEST_LOCATION); // High epsilon as we don't have exact figure for bezier curve at 50%
468
469   application.Render(250); // Halfway thru map1 anim
470   application.SendNotification();
471   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(24,24,0), 1.0, TEST_LOCATION); // High epsilon as we don't have exact figure for bezier curve at 50%
472
473   application.Render(250); // End of map1 anim
474   application.SendNotification();
475   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(100,100,0), 1.0, TEST_LOCATION); // High epsilon as we don't have exact figure for bezier curve
476
477   application.Render(250); // End of map1 anim
478   application.SendNotification();
479   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(100,100,0), TEST_LOCATION );
480   END_TEST;
481 }
482
483
484 int UtcDaliTransitionDataMap4P(void)
485 {
486   TestApplication application;
487
488   tet_printf("Testing animation of a visual's transform property using programmatic maps\n");
489
490   Property::Map map1;
491   map1["target"] = "testVisual";
492   map1["property"] = "offset";
493   map1["initialValue"] = Vector2(0.0f, 0.0f);
494   map1["targetValue"] = Vector2(100.0f, 100.0f);
495   map1["animator"] = Property::Map()
496     .Add("alphaFunction", "LINEAR")
497     .Add("timePeriod", Property::Map()
498          .Add("delay", 0.5f)
499          .Add("duration", 1.0f));
500
501   Property::Map map2;
502   map2["target"] = "testVisual";
503   map2["property"] = "size";
504   map2["initialValue"] = Vector2(10.0f, 10.0f);
505   map2["targetValue"] = Vector2(110.0f, 110.0f);
506   map2["animator"] = Property::Map()
507     .Add("alphaFunction", "LINEAR")
508     .Add("timePeriod", Property::Map()
509          .Add("delay", 0.5f)
510          .Add("duration", 1.0f));
511
512   Dali::Toolkit::TransitionData transition = TransitionData::New( Property::Array().Add(map1).Add(map2) );
513
514   DummyControl actor = DummyControl::New();
515   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
516   actor.SetName("Actor1");
517   Stage::GetCurrent().Add(actor);
518
519   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
520
521   Property::Map visualMap;
522   visualMap[Visual::Property::TYPE] = Visual::COLOR;
523   visualMap[ColorVisual::Property::MIX_COLOR] = Color::MAGENTA;
524   Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap );
525
526   visual.SetName( "testVisual" );
527   dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
528
529   Animation anim = dummyImpl.CreateTransition( transition );
530   DALI_TEST_CHECK( anim );
531
532   Renderer renderer = actor.GetRendererAt(0);
533   Property::Index sizeIndex = renderer.GetPropertyIndex( "size" );
534   application.SendNotification();
535   application.Render(0);
536
537   DALI_TEST_EQUALS( renderer.GetProperty<Vector2>(sizeIndex), Vector2(10.0f, 10.0f), TEST_LOCATION);
538   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( renderer, sizeIndex ), Vector2(10.0f, 10.0f), TEST_LOCATION);
539
540   anim.Play();
541
542   application.SendNotification();
543   application.Render(0);
544   application.Render(500); // Start animation
545   application.Render(500); // Halfway thru anim
546   application.SendNotification();
547   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( renderer, sizeIndex ), Vector2(60.0f, 60.0f), TEST_LOCATION);
548
549   application.Render(500); // End of anim
550   application.SendNotification();
551   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( renderer, sizeIndex ), Vector2(110.0f, 110.0f), TEST_LOCATION );
552
553   END_TEST;
554 }
555
556 int UtcDaliTransitionDataMap5P(void)
557 {
558   TestApplication application;
559
560   tet_printf("Testing animation visual opacity using stylesheet equivalent maps\n");
561
562   Property::Map map;
563   map["target"] = "visual1";
564   map["property"] = "opacity";
565   map["initialValue"] = 0.0f;
566   map["targetValue"] = 1.0f;
567   map["animator"] = Property::Map()
568     .Add("alphaFunction", "EASE_IN_OUT")
569     .Add("timePeriod", Property::Map()
570          .Add("delay", 0.5f)
571          .Add("duration", 1.0f));
572
573   Dali::Toolkit::TransitionData transition = TransitionData::New( map );
574
575   DummyControl actor = DummyControl::New();
576   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
577   actor.SetName("Actor1");
578   actor.SetColor(Color::CYAN);
579   Stage::GetCurrent().Add(actor);
580
581   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
582
583   Property::Map visualMap;
584   visualMap[Visual::Property::TYPE] = Visual::COLOR;
585   visualMap[ColorVisual::Property::MIX_COLOR] = Color::MAGENTA;
586   Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap );
587   visual.SetName( "visual1" );
588
589   Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
590   dummyImpl.RegisterVisual( visualIndex, visual );
591
592   Animation anim = dummyImpl.CreateTransition( transition );
593   DALI_TEST_CHECK( anim );
594
595   Renderer renderer = actor.GetRendererAt(0);
596   Property::Index mixColorIndex = DevelHandle::GetPropertyIndex( renderer, ColorVisual::Property::MIX_COLOR );
597   Property::Index opacityIndex = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::OPACITY );
598   application.SendNotification();
599   application.Render(0);
600
601   DALI_TEST_EQUALS( renderer.GetProperty<Vector3>(mixColorIndex), Vector3(Color::MAGENTA), TEST_LOCATION);
602   DALI_TEST_EQUALS( renderer.GetProperty<float>(opacityIndex), 0.0f, 0.001f, TEST_LOCATION );
603   DALI_TEST_EQUALS( renderer.GetProperty<int>(Renderer::Property::BLEND_MODE), (int)BlendMode::ON, TEST_LOCATION );
604
605   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( renderer, mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION);
606   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( renderer, opacityIndex ), 0.0f, 0.001f, TEST_LOCATION );
607   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( renderer, Renderer::Property::BLEND_MODE ), (int)BlendMode::ON, TEST_LOCATION );
608
609   anim.Play();
610
611   application.SendNotification();
612   application.Render(500); // Start animation
613   application.Render(500); // Halfway thru anim
614   application.SendNotification();
615   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( renderer, mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION);
616   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( renderer, opacityIndex ), 0.5f, 0.001f, TEST_LOCATION );
617   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( renderer, Renderer::Property::BLEND_MODE ), (int)BlendMode::ON, TEST_LOCATION );
618
619   application.Render(501); // End of anim
620   application.SendNotification();
621   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( renderer, mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION );
622   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( renderer, opacityIndex ), 1.0f, 0.001f, TEST_LOCATION );
623   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( renderer, Renderer::Property::BLEND_MODE ), (int)BlendMode::AUTO, TEST_LOCATION );
624
625   END_TEST;
626 }
627
628
629 int UtcDaliTransitionDataMap6P(void)
630 {
631   TestApplication application;
632
633   tet_printf("Testing animation visual opacity using stylesheet equivalent maps\n");
634
635   Property::Map map;
636   map["target"] = "visual1";
637   map["property"] = "opacity";
638   map["targetValue"] = 0.0f;
639   map["animator"] = Property::Map()
640     .Add("alphaFunction", "EASE_IN_OUT")
641     .Add("timePeriod", Property::Map()
642          .Add("delay", 0.5f)
643          .Add("duration", 1.0f));
644
645   Dali::Toolkit::TransitionData transition = TransitionData::New( map );
646
647   DummyControl actor = DummyControl::New();
648   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
649   actor.SetName("Actor1");
650   actor.SetColor(Color::CYAN);
651   Stage::GetCurrent().Add(actor);
652
653   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
654
655   Property::Map visualMap;
656   visualMap[Visual::Property::TYPE] = Visual::COLOR;
657   visualMap[ColorVisual::Property::MIX_COLOR] = Color::MAGENTA;
658   Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap );
659   visual.SetName( "visual1" );
660
661   Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
662   dummyImpl.RegisterVisual( visualIndex, visual );
663
664   Animation anim = dummyImpl.CreateTransition( transition );
665   DALI_TEST_CHECK( anim );
666
667   Renderer renderer = actor.GetRendererAt(0);
668   Property::Index mixColorIndex = DevelHandle::GetPropertyIndex( renderer, ColorVisual::Property::MIX_COLOR );
669   Property::Index opacityIndex = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::OPACITY );
670   application.SendNotification();
671   application.Render(0);
672
673   DALI_TEST_EQUALS( renderer.GetProperty<Vector3>(mixColorIndex), Vector3(Color::MAGENTA), TEST_LOCATION);
674   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( renderer, mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION);
675   DALI_TEST_EQUALS( renderer.GetProperty<float>(opacityIndex), 1.0f, 0.001f, TEST_LOCATION );
676   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( renderer, opacityIndex ), 1.0f, 0.001f, TEST_LOCATION );
677
678   // Note, This should be testing for AUTO
679   // this is the same problem as C# target value being set before Play is called.
680   // @todo How was this solved?
681   DALI_TEST_EQUALS( renderer.GetProperty<int>(Renderer::Property::BLEND_MODE), (int)BlendMode::ON, TEST_LOCATION );
682   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( renderer, Renderer::Property::BLEND_MODE ), (int)BlendMode::ON, TEST_LOCATION );
683
684   anim.Play();
685
686   application.SendNotification();
687   application.Render(500); // Start animation
688   application.Render(500); // Halfway thru anim
689   application.SendNotification();
690   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( renderer, mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION);
691   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( renderer, opacityIndex ), 0.5f, 0.001f, TEST_LOCATION );
692   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( renderer, Renderer::Property::BLEND_MODE ), (int)BlendMode::ON, TEST_LOCATION );
693
694   application.Render(500); // End of anim
695   application.SendNotification();
696   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( renderer, mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION );
697   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( renderer, opacityIndex ), 0.0f, 0.001f, TEST_LOCATION );
698   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( renderer, Renderer::Property::BLEND_MODE ), (int)BlendMode::ON, TEST_LOCATION );
699
700   END_TEST;
701 }
702
703
704 int UtcDaliTransitionDataMap1N(void)
705 {
706   TestApplication application;
707
708   Property::Map map;
709   map["target"] = "Actor1";
710   map["property"] = "randomProperty";
711   map["initialValue"] = Color::MAGENTA;
712   map["targetValue"] = Color::RED;
713   map["animator"] = Property::Map()
714     .Add("alphaFunction", "EASE_OUT")
715     .Add("timePeriod", Property::Map()
716          .Add("delay", 0.5f)
717          .Add("duration", 1.0f));
718
719   Dali::Toolkit::TransitionData transition = TransitionData::New( map );
720
721   DummyControl actor = DummyControl::New();
722   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
723   actor.SetName("Actor1");
724   actor.SetColor(Color::CYAN);
725   Stage::GetCurrent().Add(actor);
726
727   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
728   Animation anim = dummyImpl.CreateTransition( transition );
729   DALI_TEST_CHECK( ! anim );
730
731   CHECK_MAP_EQUALS( map, transition.GetAnimatorAt(0) );
732   END_TEST;
733 }
734
735
736 int UtcDaliTransitionDataMapN3(void)
737 {
738   TestApplication application;
739
740   tet_printf("Testing visual lookup with no renderers\n");
741
742   Property::Map map;
743   map["target"] = "visual1";
744   map["property"] = "mixColor";
745   map["initialValue"] = Vector3(Color::MAGENTA);
746   map["targetValue"] = Vector3(Color::RED);
747   map["animator"] = Property::Map()
748     .Add("alphaFunction", "EASE_OUT_BACK")
749     .Add("timePeriod", Property::Map()
750          .Add("delay", 0.5f)
751          .Add("duration", 1.0f));
752
753   Dali::Toolkit::TransitionData transition = TransitionData::New( map );
754   CHECK_MAP_EQUALS( map, transition.GetAnimatorAt(0) );
755
756   DummyControl actor = DummyControl::New();
757   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
758   actor.SetName("Actor1");
759   actor.SetColor(Color::CYAN);
760   // Don't stage actor
761
762   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
763   Property::Map visualMap;
764   visualMap[Visual::Property::TYPE] = Visual::COLOR;
765   visualMap[ColorVisual::Property::MIX_COLOR] = Vector3(Color::MAGENTA);
766   Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap );
767   visual.SetName( "visual1" );
768
769   Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
770   dummyImpl.RegisterVisual( visualIndex, visual );
771
772   Animation anim = dummyImpl.CreateTransition( transition );
773   DALI_TEST_CHECK( !anim );
774   END_TEST;
775 }
776
777
778 int UtcDaliTransitionDataMapN4(void)
779 {
780   TestApplication application;
781
782   tet_printf("Testing visual doesn't animate with duff bezier data \n");
783
784   Property::Map map;
785   map["target"] = "visual1";
786   map["property"] = "mixColor";
787   map["initialValue"] = Vector3(Color::MAGENTA);
788   map["targetValue"] = Vector3(Color::RED);
789   map["animator"] = Property::Map()
790     .Add("alphaFunction", Vector3(.1f,1.0f,0.5f))
791     .Add("timePeriod", Property::Map()
792          .Add("delay", 0.5f)
793          .Add("duration", 1.0f));
794
795   Dali::Toolkit::TransitionData transition = TransitionData::New( map );
796
797   DummyControl actor = DummyControl::New();
798   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
799   actor.SetName("Actor1");
800   actor.SetColor(Color::CYAN);
801   Stage::GetCurrent().Add(actor);
802
803   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
804   Property::Map visualMap;
805   visualMap[Visual::Property::TYPE] = Visual::COLOR;
806   visualMap[ColorVisual::Property::MIX_COLOR] = Color::MAGENTA;
807   Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap );
808   visual.SetName( "visual1" );
809
810   Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
811   dummyImpl.RegisterVisual( visualIndex, visual );
812
813   Animation anim = dummyImpl.CreateTransition( transition );
814   DALI_TEST_CHECK( !anim );
815
816   application.SendNotification();
817   application.Render(0);
818   application.SendNotification();
819
820   Renderer renderer = actor.GetRendererAt(0);
821   Property::Index mixColorIdx = DevelHandle::GetPropertyIndex( renderer, ColorVisual::Property::MIX_COLOR );
822   Property::Index opacityIdx = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::OPACITY );
823
824   tet_printf( "Test that the property has been set to target value\n");
825   DALI_TEST_EQUALS(renderer.GetProperty<Vector3>(mixColorIdx), Vector3(Color::RED), 0.001, TEST_LOCATION);
826   DALI_TEST_EQUALS(renderer.GetProperty<float>(opacityIdx), 1.0f, 0.001, TEST_LOCATION);
827
828   END_TEST;
829 }
830
831 int UtcDaliTransitionDataMapN5(void)
832 {
833   TestApplication application;
834
835   tet_printf("Testing visual doesn't animate with duff bezier data \n");
836
837   Property::Map map;
838   map["target"] = "visual1";
839   map["property"] = "mixColor";
840   map["initialValue"] = Color::MAGENTA;
841   map["targetValue"] = Color::RED;
842   map["animator"] = Property::Map()
843     .Add("alphaFunction", Property::Array().Add(.1f).Add(1.0f).Add(0.5f))
844     .Add("timePeriod", Property::Map()
845          .Add("delay", 0.5f)
846          .Add("duration", 1.0f));
847
848   Dali::Toolkit::TransitionData transition = TransitionData::New( map );
849
850   DummyControl actor = DummyControl::New();
851   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
852   actor.SetName("Actor1");
853   actor.SetColor(Color::CYAN);
854   Stage::GetCurrent().Add(actor);
855
856   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
857   Property::Map visualMap;
858   visualMap[Visual::Property::TYPE] = Visual::COLOR;
859   visualMap[ColorVisual::Property::MIX_COLOR] = Color::MAGENTA;
860   Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap );
861   visual.SetName( "visual1" );
862
863   Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
864   dummyImpl.RegisterVisual( visualIndex, visual );
865
866   Animation anim = dummyImpl.CreateTransition( transition );
867   DALI_TEST_CHECK( !anim );
868
869   application.SendNotification();
870   application.Render(0);
871   application.SendNotification();
872
873   Renderer renderer = actor.GetRendererAt(0);
874   Property::Index mixColorIdx = DevelHandle::GetPropertyIndex( renderer, ColorVisual::Property::MIX_COLOR );
875
876   tet_printf( "Test that the property has been set to target value\n");
877   DALI_TEST_EQUALS(renderer.GetProperty<Vector3>(mixColorIdx), Vector3(Color::RED), 0.001, TEST_LOCATION);
878
879   END_TEST;
880 }
881
882 int UtcDaliTransitionDataMapN6(void)
883 {
884   TestApplication application;
885
886   tet_printf("Testing visual doesn't animate with duff bezier data \n");
887
888   Property::Map map;
889   map["target"] = "visual1";
890   map["property"] = "mixColor";
891   map["initialValue"] = Color::MAGENTA;
892   map["targetValue"] = Color::RED;
893   map["animator"] = Property::Map()
894     .Add("alphaFunction", Property::Array().Add("1").Add("Two").Add("3").Add("4"))
895     .Add("timePeriod", Property::Map()
896          .Add("delay", 0.5f)
897          .Add("duration", 1.0f));
898
899   Dali::Toolkit::TransitionData transition = TransitionData::New( map );
900
901   DummyControl actor = DummyControl::New();
902   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
903   actor.SetName("Actor1");
904   actor.SetColor(Color::CYAN);
905   Stage::GetCurrent().Add(actor);
906
907   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
908   Property::Map visualMap;
909   visualMap[Visual::Property::TYPE] = Visual::COLOR;
910   visualMap[ColorVisual::Property::MIX_COLOR] = Color::MAGENTA;
911   Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap );
912   visual.SetName( "visual1" );
913
914   Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
915   dummyImpl.RegisterVisual( visualIndex, visual );
916
917   Animation anim = dummyImpl.CreateTransition( transition );
918   DALI_TEST_CHECK( !anim );
919
920   application.SendNotification();
921   application.Render(0);
922   application.SendNotification();
923
924   Renderer renderer = actor.GetRendererAt(0);
925   Property::Index mixColorIdx = DevelHandle::GetPropertyIndex( renderer, ColorVisual::Property::MIX_COLOR );
926   Property::Index opacityIdx = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::OPACITY );
927
928   tet_printf( "Test that the property has been set to target value\n");
929   DALI_TEST_EQUALS(renderer.GetProperty<Vector3>(mixColorIdx), Vector3(Color::RED), 0.001, TEST_LOCATION);
930   DALI_TEST_EQUALS(renderer.GetProperty<float>(opacityIdx), 1.0f, 0.001, TEST_LOCATION);
931
932   END_TEST;
933 }
934
935
936 int UtcDaliTransitionDataArrayP(void)
937 {
938   TestApplication application;
939
940   Property::Map map1;
941   map1["target"] = "Actor1";
942   map1["property"] = "color";
943   map1["initialValue"] = Color::MAGENTA;
944   map1["targetValue"] = Color::RED;
945   map1["animator"] = Property::Map()
946     .Add("alphaFunction", "EASE_IN_OUT")
947     .Add("timePeriod", Property::Map()
948          .Add("delay", 0.5f)
949          .Add("duration", 1.0f));
950
951   Property::Map map2;
952   map2["target"] = "Actor1";
953   map2["property"] = "position";
954   map2["initialValue"] = Vector3(100,0,0);
955   map2["targetValue"] = Vector3(0,100,0);
956   map2["animator"] = Property::Map()
957     .Add("alphaFunction", "EASE_IN_OUT")
958     .Add("timePeriod", Property::Map()
959          .Add("delay", 0.0f)
960          .Add("duration", 1.0f));
961
962   Property::Map map3;
963   map3["target"] = "Actor1";
964   map3["property"] = "orientation";
965   map3["targetValue"] = Quaternion( Radian(Math::PI_2), Vector3::ZAXIS );
966
967   Property::Array array;
968   array.PushBack(map1);
969   array.PushBack(map2);
970   array.PushBack(map3);
971
972   Dali::Toolkit::TransitionData transition = TransitionData::New( array );
973
974   DummyControl actor = DummyControl::New();
975   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
976   actor.SetName("Actor1");
977   actor.SetColor(Color::CYAN);
978   Stage::GetCurrent().Add(actor);
979   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(Radian(0), Vector3::ZAXIS), TEST_LOCATION);
980
981   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
982   Animation anim = dummyImpl.CreateTransition( transition );
983   DALI_TEST_CHECK( anim );
984   application.SendNotification();
985   application.Render(0);
986   DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::MAGENTA, TEST_LOCATION);
987   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(Radian(Math::PI_2), Vector3::ZAXIS), TEST_LOCATION);
988   anim.Play();
989
990   application.SendNotification();
991   application.Render(0);   // start map2 anim
992   application.SendNotification();
993   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(100,0,0), TEST_LOCATION);
994
995   application.Render(500); // Start map1 animation, halfway thru map2 anim
996   application.SendNotification();
997   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(50,50,0), TEST_LOCATION);
998
999   application.Render(500); // Halfway thru map1 anim, end of map2 anim
1000   application.SendNotification();
1001   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(0,100,0), TEST_LOCATION);
1002   DALI_TEST_EQUALS( actor.GetCurrentColor(), (Color::MAGENTA+Color::RED)*0.5f, TEST_LOCATION);
1003
1004   application.Render(500); // End of map1 anim
1005   application.SendNotification();
1006   DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::RED, TEST_LOCATION );
1007
1008   END_TEST;
1009 }
1010
1011
1012 int UtcDaliTransitionDataGetAnimatorP(void)
1013 {
1014   TestApplication application;
1015
1016   Property::Map map1;
1017   map1["target"] = "Actor1";
1018   map1["property"] = "color";
1019   map1["initialValue"] = Color::MAGENTA;
1020   map1["targetValue"] = Color::RED;
1021   map1["animator"] = Property::Map()
1022     .Add("alphaFunction", "EASE_IN_SQUARE")
1023     .Add("timePeriod", Property::Map()
1024          .Add("delay", 0.5f)
1025          .Add("duration", 0.5f));
1026
1027   Property::Map map2;
1028   map2["target"] = "Actor1";
1029   map2["property"] = "position";
1030   map2["initialValue"] = Vector3(100,0,0);
1031   map2["targetValue"] = Vector3(0,100,0);
1032   map2["animator"] = Property::Map()
1033     .Add("alphaFunction", "EASE_OUT_SQUARE")
1034     .Add("timePeriod", Property::Map()
1035          .Add("delay", 0.2f)
1036          .Add("duration", 2.0f));
1037
1038   Property::Map map3;
1039   map3["target"] = "Actor1";
1040   map3["property"] = "size";
1041   map3["initialValue"] = Vector2(10,10);
1042   map3["targetValue"] = Vector2(100,100);
1043   map3["animator"] = Property::Map()
1044     .Add("alphaFunction", "EASE_OUT_SINE")
1045     .Add("timePeriod", Property::Map()
1046          .Add("delay", 0.4f)
1047          .Add("duration", 3.0f));
1048
1049   Property::Map map4;
1050   map4["target"] = "Actor2";
1051   map4["property"] = "color";
1052   map4["initialValue"] = Color::BLACK;
1053   map4["targetValue"] = Color::GREEN;
1054   map4["animator"] = Property::Map()
1055     .Add("alphaFunction", "EASE_IN_OUT_SINE")
1056     .Add("timePeriod", Property::Map()
1057          .Add("delay", 0.5f)
1058          .Add("duration", 0.5f));
1059
1060   Property::Map map5;
1061   map5["target"] = "Actor2";
1062   map5["property"] = "position";
1063   map5["initialValue"] = Vector3(100,0,0);
1064   map5["targetValue"] = Vector3(0,100,0);
1065   map5["animator"] = Property::Map()
1066     .Add("alphaFunction", "BOUNCE")
1067     .Add("timePeriod", Property::Map()
1068          .Add("delay", 0.2f)
1069          .Add("duration", 2.0f));
1070
1071   Property::Map map6;
1072   map6["target"] = "Actor2";
1073   map6["property"] = "size";
1074   map6["initialValue"] = Vector2(10,10);
1075   map6["targetValue"] = Vector2(100,100);
1076   map6["animator"] = Property::Map()
1077     .Add("alphaFunction", "SIN")
1078     .Add("timePeriod", Property::Map()
1079          .Add("delay", 0.4f)
1080          .Add("duration", 3.0f));
1081
1082   Property::Map map7;
1083   map7["target"] = "Actor4";
1084   map7["property"] = "sizeModeFactor";
1085   map7["initialValue"] = Vector3(1,1,1);
1086   map7["targetValue"] = Vector3(2,2,2);
1087   map7["animator"] = Property::Map()
1088     .Add("alphaFunction", "EASE_IN_SINE")
1089     .Add("timePeriod", Property::Map()
1090          .Add("delay", 0.0f)
1091          .Add("duration", 1.0f));
1092
1093   Property::Map map8;
1094   map8["target"] = "Visual1";
1095   map8["property"] = "opacity";
1096   map8["initialValue"] = 0.0f;
1097   map8["targetValue"] = 1.0f;
1098   map8["animator"] = Property::Map()
1099     .Add("alphaFunction", "EASE_IN")
1100     .Add("timePeriod", Property::Map()
1101          .Add("delay", 0.3f)
1102          .Add("duration", 9.0f));
1103
1104   Property::Map map9;
1105   map9["target"] = "Actor2";
1106   map9["property"] = "scale";
1107   map9["initialValue"] = Vector3(0,0,0);
1108   map9["targetValue"] = Vector3(1,1,1);
1109   map9["animator"] = Property::Map()
1110     .Add("alphaFunction", "REVERSE")
1111     .Add("timePeriod", Property::Map()
1112          .Add("delay", 0.0f)
1113          .Add("duration", 1.0f));
1114
1115   Property::Map map10;
1116   map10["target"] = "Actor2";
1117   map10["property"] = "scale";
1118   map10["initialValue"] = Vector3(0,0,0);
1119   map10["targetValue"] = Vector3(1,1,1);
1120   map10["animator"] = Property::Map()
1121     .Add("alphaFunction", Vector4(.23,.4,.8,1.2))
1122     .Add("timePeriod", Property::Map()
1123          .Add("delay", 0.0f)
1124          .Add("duration", 1.0f));
1125
1126   Property::Map map11;
1127   map11["target"] = "Actor2";
1128   map11["property"] = "scale";
1129   map11["initialValue"] = Vector3(0,0,0);
1130   map11["targetValue"] = Vector3(1,1,1);
1131   map11["animator"] = Property::Map()
1132     .Add("alphaFunction", Property::Array().Add(.23f).Add(.4f).Add(.8f).Add(.2f))
1133     .Add("timePeriod", Property::Map()
1134          .Add("delay", 0.0f)
1135          .Add("duration", 1.0f));
1136
1137   Property::Map map12;
1138   map12["target"] = "Actor1";
1139   map12["property"] = "orientation";
1140   map12["targetValue"] = Quaternion( Radian(Math::PI_2), Vector3::ZAXIS );
1141
1142   Property::Array array;
1143   array.PushBack(map1);
1144   array.PushBack(map2);
1145   array.PushBack(map3);
1146   array.PushBack(map4);
1147   array.PushBack(map5);
1148   array.PushBack(map6);
1149   array.PushBack(map7);
1150   array.PushBack(map8);
1151   array.PushBack(map9);
1152   array.PushBack(map10);
1153   array.PushBack(map11);
1154   array.PushBack(map12);
1155
1156   Dali::Toolkit::TransitionData transition = TransitionData::New( array );
1157
1158   DALI_TEST_EQUALS( transition.Count(), array.Count(), TEST_LOCATION );
1159
1160   for( unsigned int i=0; i < array.Count(); ++i )
1161   {
1162     Property::Map animatorMap = transition.GetAnimatorAt(i);
1163     Property::Value& value = array.GetElementAt(i);
1164     Property::Map* inputMap = value.GetMap();
1165     DALI_TEST_CHECK( inputMap );
1166     CHECK_MAP_EQUALS( *inputMap, animatorMap );
1167   }
1168
1169   END_TEST;
1170 }