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