All tests now output results to xml files
[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   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
592   glAbstraction.EnableEnableDisableCallTrace( true );
593   TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
594   std::ostringstream blendStr;
595   blendStr << GL_BLEND;
596
597   Renderer renderer = actor.GetRendererAt(0);
598   Property::Index mixColorIndex = renderer.GetPropertyIndex( ColorVisual::Property::MIX_COLOR );
599   application.SendNotification();
600   application.Render(0);
601
602   DALI_TEST_EQUALS( renderer.GetProperty<Vector3>(mixColorIndex), Vector3(Color::MAGENTA), TEST_LOCATION);
603   DALI_TEST_EQUALS( renderer.GetProperty<float>( DevelRenderer::Property::OPACITY ), 0.0f, 0.001f, TEST_LOCATION );
604
605   DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION);
606   DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( DevelRenderer::Property::OPACITY ), 0.0f, 0.001f, TEST_LOCATION );
607
608   // The Renderer is transparent. So rendering is skipped. The state should not be changed.
609   DALI_TEST_CHECK( !glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
610   DALI_TEST_CHECK( !glEnableStack.FindMethodAndParams( "Disable", blendStr.str().c_str() ) );
611
612   anim.Play();
613
614   glEnableStack.Reset();
615
616   application.SendNotification();
617   application.Render(500); // Start animation
618   application.Render(500); // Halfway thru anim
619   application.SendNotification();
620   DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION);
621   DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( DevelRenderer::Property::OPACITY ), 0.5f, 0.001f, TEST_LOCATION );
622
623   // Should not be changed
624   DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
625
626   glEnableStack.Reset();
627
628   application.Render(501); // End of anim
629   application.SendNotification();
630   application.Render();
631   DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION );
632   DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( DevelRenderer::Property::OPACITY ), 1.0f, 0.001f, TEST_LOCATION );
633
634   DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Disable", blendStr.str().c_str() ) );
635
636   END_TEST;
637 }
638
639
640 int UtcDaliTransitionDataMap6P(void)
641 {
642   ToolkitTestApplication application;
643
644   tet_printf("Testing animation visual opacity using stylesheet equivalent maps\n");
645
646   Property::Map map;
647   map["target"] = "visual1";
648   map["property"] = "opacity";
649   map["targetValue"] = 0.0f;
650   map["animator"] = Property::Map()
651     .Add("alphaFunction", "EASE_IN_OUT")
652     .Add("timePeriod", Property::Map()
653          .Add("delay", 0.5f)
654          .Add("duration", 1.0f));
655
656   Dali::Toolkit::TransitionData transition = TransitionData::New( map );
657
658   DummyControl actor = DummyControl::New();
659   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
660   actor.SetProperty( Dali::Actor::Property::NAME,"Actor1");
661   actor.SetProperty( Actor::Property::COLOR,Color::CYAN);
662   application.GetScene().Add(actor);
663
664   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
665
666   Property::Map visualMap;
667   visualMap[Visual::Property::TYPE] = Visual::COLOR;
668   visualMap[ColorVisual::Property::MIX_COLOR] = Color::MAGENTA;
669   Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap );
670   visual.SetName( "visual1" );
671
672   Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
673   dummyImpl.RegisterVisual( visualIndex, visual );
674
675   Animation anim = dummyImpl.CreateTransition( transition );
676   DALI_TEST_CHECK( anim );
677
678   Renderer renderer = actor.GetRendererAt(0);
679   Property::Index mixColorIndex = renderer.GetPropertyIndex( ColorVisual::Property::MIX_COLOR );
680
681   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
682   glAbstraction.EnableEnableDisableCallTrace( true );
683   TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
684   std::ostringstream blendStr;
685   blendStr << GL_BLEND;
686
687   application.SendNotification();
688   application.Render(0);
689
690   DALI_TEST_EQUALS( renderer.GetProperty<Vector3>(mixColorIndex), Vector3(Color::MAGENTA), TEST_LOCATION);
691   DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION);
692   DALI_TEST_EQUALS( renderer.GetProperty<float>( DevelRenderer::Property::OPACITY ), 1.0f, 0.001f, TEST_LOCATION );
693   DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( DevelRenderer::Property::OPACITY ), 1.0f, 0.001f, TEST_LOCATION );
694
695   // Default state is disabled. So test if "Enabled" is not called.
696   DALI_TEST_CHECK( !glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
697
698   anim.Play();
699
700   glEnableStack.Reset();
701
702   application.SendNotification();
703   application.Render(500); // Start animation
704   application.Render(500); // Halfway thru anim
705   application.SendNotification();
706
707   DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION);
708   DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( DevelRenderer::Property::OPACITY ), 0.5f, 0.001f, TEST_LOCATION );
709
710   DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
711
712   glEnableStack.Reset();
713
714   application.Render(500); // End of anim
715   application.SendNotification();
716
717   DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION );
718   DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( DevelRenderer::Property::OPACITY ), 0.0f, 0.001f, TEST_LOCATION );
719
720   // GL_BLEND should not be changed: Keep enabled
721   DALI_TEST_CHECK( !glEnableStack.FindMethodAndParams( "Disable", blendStr.str().c_str() ) );
722
723   END_TEST;
724 }
725
726
727 int UtcDaliTransitionDataMap1N(void)
728 {
729   ToolkitTestApplication application;
730
731   Property::Map map;
732   map["target"] = "Actor1";
733   map["property"] = "randomProperty";
734   map["initialValue"] = Color::MAGENTA;
735   map["targetValue"] = Color::RED;
736   map["animator"] = Property::Map()
737     .Add("alphaFunction", "EASE_OUT")
738     .Add("timePeriod", Property::Map()
739          .Add("delay", 0.5f)
740          .Add("duration", 1.0f));
741
742   Dali::Toolkit::TransitionData transition = TransitionData::New( map );
743
744   DummyControl actor = DummyControl::New();
745   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
746   actor.SetProperty( Dali::Actor::Property::NAME,"Actor1");
747   actor.SetProperty( Actor::Property::COLOR,Color::CYAN);
748   application.GetScene().Add(actor);
749
750   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
751   Animation anim = dummyImpl.CreateTransition( transition );
752   DALI_TEST_CHECK( ! anim );
753
754   CHECK_MAP_EQUALS( map, transition.GetAnimatorAt(0) );
755   END_TEST;
756 }
757
758
759 int UtcDaliTransitionDataMapN3(void)
760 {
761   ToolkitTestApplication application;
762
763   tet_printf("Testing visual lookup with no renderers\n");
764
765   Property::Map map;
766   map["target"] = "visual1";
767   map["property"] = "mixColor";
768   map["initialValue"] = Vector3(Color::MAGENTA);
769   map["targetValue"] = Vector3(Color::RED);
770   map["animator"] = Property::Map()
771     .Add("alphaFunction", "EASE_OUT_BACK")
772     .Add("timePeriod", Property::Map()
773          .Add("delay", 0.5f)
774          .Add("duration", 1.0f));
775
776   Dali::Toolkit::TransitionData transition = TransitionData::New( map );
777   CHECK_MAP_EQUALS( map, transition.GetAnimatorAt(0) );
778
779   DummyControl actor = DummyControl::New();
780   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
781   actor.SetProperty( Dali::Actor::Property::NAME,"Actor1");
782   actor.SetProperty( Actor::Property::COLOR,Color::CYAN);
783   // Don't stage actor
784
785   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
786   Property::Map visualMap;
787   visualMap[Visual::Property::TYPE] = Visual::COLOR;
788   visualMap[ColorVisual::Property::MIX_COLOR] = Vector3(Color::MAGENTA);
789   Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap );
790   visual.SetName( "visual1" );
791
792   Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
793   dummyImpl.RegisterVisual( visualIndex, visual );
794
795   Animation anim = dummyImpl.CreateTransition( transition );
796   DALI_TEST_CHECK( !anim );
797   END_TEST;
798 }
799
800
801 int UtcDaliTransitionDataMapN4(void)
802 {
803   ToolkitTestApplication application;
804
805   tet_printf("Testing visual doesn't animate with duff bezier data \n");
806
807   Property::Map map;
808   map["target"] = "visual1";
809   map["property"] = "mixColor";
810   map["initialValue"] = Vector3(Color::MAGENTA);
811   map["targetValue"] = Vector3(Color::RED);
812   map["animator"] = Property::Map()
813     .Add("alphaFunction", Vector3(.1f,1.0f,0.5f))
814     .Add("timePeriod", Property::Map()
815          .Add("delay", 0.5f)
816          .Add("duration", 1.0f));
817
818   Dali::Toolkit::TransitionData transition = TransitionData::New( map );
819
820   DummyControl actor = DummyControl::New();
821   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
822   actor.SetProperty( Dali::Actor::Property::NAME,"Actor1");
823   actor.SetProperty( Actor::Property::COLOR,Color::CYAN);
824   application.GetScene().Add(actor);
825
826   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
827   Property::Map visualMap;
828   visualMap[Visual::Property::TYPE] = Visual::COLOR;
829   visualMap[ColorVisual::Property::MIX_COLOR] = Color::MAGENTA;
830   Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap );
831   visual.SetName( "visual1" );
832
833   Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
834   dummyImpl.RegisterVisual( visualIndex, visual );
835
836   Animation anim = dummyImpl.CreateTransition( transition );
837   DALI_TEST_CHECK( !anim );
838
839   application.SendNotification();
840   application.Render(0);
841   application.SendNotification();
842
843   Renderer renderer = actor.GetRendererAt(0);
844   Property::Index mixColorIdx = renderer.GetPropertyIndex( ColorVisual::Property::MIX_COLOR );
845
846   tet_printf( "Test that the property has been set to target value\n");
847   DALI_TEST_EQUALS(renderer.GetProperty<Vector3>(mixColorIdx), Vector3(Color::RED), 0.001, TEST_LOCATION);
848   DALI_TEST_EQUALS(renderer.GetProperty<float>( DevelRenderer::Property::OPACITY ), 1.0f, 0.001, TEST_LOCATION);
849
850   END_TEST;
851 }
852
853 int UtcDaliTransitionDataMapN5(void)
854 {
855   ToolkitTestApplication application;
856
857   tet_printf("Testing visual doesn't animate with duff bezier data \n");
858
859   Property::Map map;
860   map["target"] = "visual1";
861   map["property"] = "mixColor";
862   map["initialValue"] = Color::MAGENTA;
863   map["targetValue"] = Color::RED;
864   map["animator"] = Property::Map()
865     .Add("alphaFunction", Property::Array().Add(.1f).Add(1.0f).Add(0.5f))
866     .Add("timePeriod", Property::Map()
867          .Add("delay", 0.5f)
868          .Add("duration", 1.0f));
869
870   Dali::Toolkit::TransitionData transition = TransitionData::New( map );
871
872   DummyControl actor = DummyControl::New();
873   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
874   actor.SetProperty( Dali::Actor::Property::NAME,"Actor1");
875   actor.SetProperty( Actor::Property::COLOR,Color::CYAN);
876   application.GetScene().Add(actor);
877
878   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
879   Property::Map visualMap;
880   visualMap[Visual::Property::TYPE] = Visual::COLOR;
881   visualMap[ColorVisual::Property::MIX_COLOR] = Color::MAGENTA;
882   Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap );
883   visual.SetName( "visual1" );
884
885   Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
886   dummyImpl.RegisterVisual( visualIndex, visual );
887
888   Animation anim = dummyImpl.CreateTransition( transition );
889   DALI_TEST_CHECK( !anim );
890
891   application.SendNotification();
892   application.Render(0);
893   application.SendNotification();
894
895   Renderer renderer = actor.GetRendererAt(0);
896   Property::Index mixColorIdx = renderer.GetPropertyIndex( ColorVisual::Property::MIX_COLOR );
897
898   tet_printf( "Test that the property has been set to target value\n");
899   DALI_TEST_EQUALS(renderer.GetProperty<Vector3>(mixColorIdx), Vector3(Color::RED), 0.001, TEST_LOCATION);
900
901   END_TEST;
902 }
903
904 int UtcDaliTransitionDataMapN6(void)
905 {
906   ToolkitTestApplication application;
907
908   tet_printf("Testing visual doesn't animate with duff bezier data \n");
909
910   Property::Map map;
911   map["target"] = "visual1";
912   map["property"] = "mixColor";
913   map["initialValue"] = Color::MAGENTA;
914   map["targetValue"] = Color::RED;
915   map["animator"] = Property::Map()
916     .Add("alphaFunction", Property::Array().Add("1").Add("Two").Add("3").Add("4"))
917     .Add("timePeriod", Property::Map()
918          .Add("delay", 0.5f)
919          .Add("duration", 1.0f));
920
921   Dali::Toolkit::TransitionData transition = TransitionData::New( map );
922
923   DummyControl actor = DummyControl::New();
924   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
925   actor.SetProperty( Dali::Actor::Property::NAME,"Actor1");
926   actor.SetProperty( Actor::Property::COLOR,Color::CYAN);
927   application.GetScene().Add(actor);
928
929   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
930   Property::Map visualMap;
931   visualMap[Visual::Property::TYPE] = Visual::COLOR;
932   visualMap[ColorVisual::Property::MIX_COLOR] = Color::MAGENTA;
933   Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap );
934   visual.SetName( "visual1" );
935
936   Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
937   dummyImpl.RegisterVisual( visualIndex, visual );
938
939   Animation anim = dummyImpl.CreateTransition( transition );
940   DALI_TEST_CHECK( !anim );
941
942   application.SendNotification();
943   application.Render(0);
944   application.SendNotification();
945
946   Renderer renderer = actor.GetRendererAt(0);
947   Property::Index mixColorIdx = renderer.GetPropertyIndex( ColorVisual::Property::MIX_COLOR );
948
949   tet_printf( "Test that the property has been set to target value\n");
950   DALI_TEST_EQUALS(renderer.GetProperty<Vector3>(mixColorIdx), Vector3(Color::RED), 0.001, TEST_LOCATION);
951   DALI_TEST_EQUALS(renderer.GetProperty<float>( DevelRenderer::Property::OPACITY ), 1.0f, 0.001, TEST_LOCATION);
952
953   END_TEST;
954 }
955
956
957 int UtcDaliTransitionDataArrayP(void)
958 {
959   ToolkitTestApplication application;
960
961   Property::Map map1;
962   map1["target"] = "Actor1";
963   map1["property"] = "color";
964   map1["initialValue"] = Color::MAGENTA;
965   map1["targetValue"] = Color::RED;
966   map1["animator"] = Property::Map()
967     .Add("alphaFunction", "EASE_IN_OUT")
968     .Add("timePeriod", Property::Map()
969          .Add("delay", 0.5f)
970          .Add("duration", 1.0f));
971
972   Property::Map map2;
973   map2["target"] = "Actor1";
974   map2["property"] = "position";
975   map2["initialValue"] = Vector3(100,0,0);
976   map2["targetValue"] = Vector3(0,100,0);
977   map2["animator"] = Property::Map()
978     .Add("alphaFunction", "EASE_IN_OUT")
979     .Add("timePeriod", Property::Map()
980          .Add("delay", 0.0f)
981          .Add("duration", 1.0f));
982
983   Property::Map map3;
984   map3["target"] = "Actor1";
985   map3["property"] = "orientation";
986   map3["targetValue"] = Quaternion( Radian(Math::PI_2), Vector3::ZAXIS );
987
988   Property::Array array;
989   array.PushBack(map1);
990   array.PushBack(map2);
991   array.PushBack(map3);
992
993   Dali::Toolkit::TransitionData transition = TransitionData::New( array );
994
995   DummyControl actor = DummyControl::New();
996   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
997   actor.SetProperty( Dali::Actor::Property::NAME,"Actor1");
998   actor.SetProperty( Actor::Property::COLOR,Color::CYAN);
999   application.GetScene().Add(actor);
1000   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(Radian(0), Vector3::ZAXIS), TEST_LOCATION);
1001
1002   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
1003   Animation anim = dummyImpl.CreateTransition( transition );
1004   DALI_TEST_CHECK( anim );
1005   application.SendNotification();
1006   application.Render(0);
1007   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::MAGENTA, TEST_LOCATION);
1008   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(Radian(Math::PI_2), Vector3::ZAXIS), TEST_LOCATION);
1009   anim.Play();
1010
1011   application.SendNotification();
1012   application.Render(0);   // start map2 anim
1013   application.SendNotification();
1014   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(100,0,0), TEST_LOCATION);
1015
1016   application.Render(500); // Start map1 animation, halfway thru map2 anim
1017   application.SendNotification();
1018   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(50,50,0), TEST_LOCATION);
1019
1020   application.Render(500); // Halfway thru map1 anim, end of map2 anim
1021   application.SendNotification();
1022   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(0,100,0), TEST_LOCATION);
1023   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), (Color::MAGENTA+Color::RED)*0.5f, TEST_LOCATION);
1024
1025   application.Render(500); // End of map1 anim
1026   application.SendNotification();
1027   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::RED, TEST_LOCATION );
1028
1029   END_TEST;
1030 }
1031
1032
1033 int UtcDaliTransitionDataGetAnimatorP(void)
1034 {
1035   ToolkitTestApplication application;
1036
1037   Property::Map map1;
1038   map1["target"] = "Actor1";
1039   map1["property"] = "color";
1040   map1["initialValue"] = Color::MAGENTA;
1041   map1["targetValue"] = Color::RED;
1042   map1["animator"] = Property::Map()
1043     .Add("alphaFunction", "EASE_IN_SQUARE")
1044     .Add("timePeriod", Property::Map()
1045          .Add("delay", 0.5f)
1046          .Add("duration", 0.5f));
1047
1048   Property::Map map2;
1049   map2["target"] = "Actor1";
1050   map2["property"] = "position";
1051   map2["initialValue"] = Vector3(100,0,0);
1052   map2["targetValue"] = Vector3(0,100,0);
1053   map2["animator"] = Property::Map()
1054     .Add("alphaFunction", "EASE_OUT_SQUARE")
1055     .Add("timePeriod", Property::Map()
1056          .Add("delay", 0.2f)
1057          .Add("duration", 2.0f));
1058
1059   Property::Map map3;
1060   map3["target"] = "Actor1";
1061   map3["property"] = "size";
1062   map3["initialValue"] = Vector2(10,10);
1063   map3["targetValue"] = Vector2(100,100);
1064   map3["animator"] = Property::Map()
1065     .Add("alphaFunction", "EASE_OUT_SINE")
1066     .Add("timePeriod", Property::Map()
1067          .Add("delay", 0.4f)
1068          .Add("duration", 3.0f));
1069
1070   Property::Map map4;
1071   map4["target"] = "Actor2";
1072   map4["property"] = "color";
1073   map4["initialValue"] = Color::BLACK;
1074   map4["targetValue"] = Color::GREEN;
1075   map4["animator"] = Property::Map()
1076     .Add("alphaFunction", "EASE_IN_OUT_SINE")
1077     .Add("timePeriod", Property::Map()
1078          .Add("delay", 0.5f)
1079          .Add("duration", 0.5f));
1080
1081   Property::Map map5;
1082   map5["target"] = "Actor2";
1083   map5["property"] = "position";
1084   map5["initialValue"] = Vector3(100,0,0);
1085   map5["targetValue"] = Vector3(0,100,0);
1086   map5["animator"] = Property::Map()
1087     .Add("alphaFunction", "BOUNCE")
1088     .Add("timePeriod", Property::Map()
1089          .Add("delay", 0.2f)
1090          .Add("duration", 2.0f));
1091
1092   Property::Map map6;
1093   map6["target"] = "Actor2";
1094   map6["property"] = "size";
1095   map6["initialValue"] = Vector2(10,10);
1096   map6["targetValue"] = Vector2(100,100);
1097   map6["animator"] = Property::Map()
1098     .Add("alphaFunction", "SIN")
1099     .Add("timePeriod", Property::Map()
1100          .Add("delay", 0.4f)
1101          .Add("duration", 3.0f));
1102
1103   Property::Map map7;
1104   map7["target"] = "Actor4";
1105   map7["property"] = "sizeModeFactor";
1106   map7["initialValue"] = Vector3(1,1,1);
1107   map7["targetValue"] = Vector3(2,2,2);
1108   map7["animator"] = Property::Map()
1109     .Add("alphaFunction", "EASE_IN_SINE")
1110     .Add("timePeriod", Property::Map()
1111          .Add("delay", 0.0f)
1112          .Add("duration", 1.0f));
1113
1114   Property::Map map8;
1115   map8["target"] = "Visual1";
1116   map8["property"] = "opacity";
1117   map8["initialValue"] = 0.0f;
1118   map8["targetValue"] = 1.0f;
1119   map8["animator"] = Property::Map()
1120     .Add("alphaFunction", "EASE_IN")
1121     .Add("timePeriod", Property::Map()
1122          .Add("delay", 0.3f)
1123          .Add("duration", 9.0f));
1124
1125   Property::Map map9;
1126   map9["target"] = "Actor2";
1127   map9["property"] = "scale";
1128   map9["initialValue"] = Vector3(0,0,0);
1129   map9["targetValue"] = Vector3(1,1,1);
1130   map9["animator"] = Property::Map()
1131     .Add("alphaFunction", "REVERSE")
1132     .Add("timePeriod", Property::Map()
1133          .Add("delay", 0.0f)
1134          .Add("duration", 1.0f));
1135
1136   Property::Map map10;
1137   map10["target"] = "Actor2";
1138   map10["property"] = "scale";
1139   map10["initialValue"] = Vector3(0,0,0);
1140   map10["targetValue"] = Vector3(1,1,1);
1141   map10["animator"] = Property::Map()
1142     .Add("alphaFunction", Vector4(.23,.4,.8,1.2))
1143     .Add("timePeriod", Property::Map()
1144          .Add("delay", 0.0f)
1145          .Add("duration", 1.0f));
1146
1147   Property::Map map11;
1148   map11["target"] = "Actor2";
1149   map11["property"] = "scale";
1150   map11["initialValue"] = Vector3(0,0,0);
1151   map11["targetValue"] = Vector3(1,1,1);
1152   map11["animator"] = Property::Map()
1153     .Add("alphaFunction", Property::Array().Add(.23f).Add(.4f).Add(.8f).Add(.2f))
1154     .Add("timePeriod", Property::Map()
1155          .Add("delay", 0.0f)
1156          .Add("duration", 1.0f));
1157
1158   Property::Map map12;
1159   map12["target"] = "Actor1";
1160   map12["property"] = "orientation";
1161   map12["targetValue"] = Quaternion( Radian(Math::PI_2), Vector3::ZAXIS );
1162
1163   Property::Array array;
1164   array.PushBack(map1);
1165   array.PushBack(map2);
1166   array.PushBack(map3);
1167   array.PushBack(map4);
1168   array.PushBack(map5);
1169   array.PushBack(map6);
1170   array.PushBack(map7);
1171   array.PushBack(map8);
1172   array.PushBack(map9);
1173   array.PushBack(map10);
1174   array.PushBack(map11);
1175   array.PushBack(map12);
1176
1177   Dali::Toolkit::TransitionData transition = TransitionData::New( array );
1178
1179   DALI_TEST_EQUALS( transition.Count(), array.Count(), TEST_LOCATION );
1180
1181   for( unsigned int i=0; i < array.Count(); ++i )
1182   {
1183     Property::Map animatorMap = transition.GetAnimatorAt(i);
1184     Property::Value& value = array.GetElementAt(i);
1185     Property::Map* inputMap = value.GetMap();
1186     DALI_TEST_CHECK( inputMap );
1187     CHECK_MAP_EQUALS( *inputMap, animatorMap );
1188   }
1189
1190   END_TEST;
1191 }