[dali_2.3.19] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-TransitionData.cpp
1 /*
2  * Copyright (c) 2021 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 << std::hex << 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() ) );
610   DALI_TEST_CHECK( !glEnableStack.FindMethodAndParams( "Disable", blendStr.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() ) );
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() ) );
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 << std::hex << 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() ) );
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() ) );
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() ) );
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 int UtcDaliTransitionDataMapN4(void)
759 {
760   ToolkitTestApplication application;
761
762   tet_printf("Testing visual doesn't animate with duff bezier data \n");
763
764   Property::Map map;
765   map["target"] = "visual1";
766   map["property"] = "mixColor";
767   map["initialValue"] = Vector3(Color::MAGENTA);
768   map["targetValue"] = Vector3(Color::RED);
769   map["animator"] = Property::Map()
770     .Add("alphaFunction", Vector3(.1f,1.0f,0.5f))
771     .Add("timePeriod", Property::Map()
772          .Add("delay", 0.5f)
773          .Add("duration", 1.0f));
774
775   Dali::Toolkit::TransitionData transition = TransitionData::New( map );
776
777   DummyControl actor = DummyControl::New();
778   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
779   actor.SetProperty( Dali::Actor::Property::NAME,"Actor1");
780   actor.SetProperty( Actor::Property::COLOR,Color::CYAN);
781   application.GetScene().Add(actor);
782
783   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
784   Property::Map visualMap;
785   visualMap[Visual::Property::TYPE] = Visual::COLOR;
786   visualMap[ColorVisual::Property::MIX_COLOR] = Color::MAGENTA;
787   Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap );
788   visual.SetName( "visual1" );
789
790   Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
791   dummyImpl.RegisterVisual( visualIndex, visual );
792
793   Animation anim = dummyImpl.CreateTransition( transition );
794   DALI_TEST_CHECK( !anim );
795
796   application.SendNotification();
797   application.Render(0);
798   application.SendNotification();
799
800   Renderer renderer = actor.GetRendererAt(0);
801   Property::Index mixColorIdx = renderer.GetPropertyIndex( ColorVisual::Property::MIX_COLOR );
802
803   tet_printf( "Test that the property has been set to target value\n");
804   DALI_TEST_EQUALS(renderer.GetProperty<Vector3>(mixColorIdx), Vector3(Color::RED), 0.001, TEST_LOCATION);
805   DALI_TEST_EQUALS(renderer.GetProperty<float>( DevelRenderer::Property::OPACITY ), 1.0f, 0.001, TEST_LOCATION);
806
807   END_TEST;
808 }
809
810 int UtcDaliTransitionDataMapN5(void)
811 {
812   ToolkitTestApplication application;
813
814   tet_printf("Testing visual doesn't animate with duff bezier data \n");
815
816   Property::Map map;
817   map["target"] = "visual1";
818   map["property"] = "mixColor";
819   map["initialValue"] = Color::MAGENTA;
820   map["targetValue"] = Color::RED;
821   map["animator"] = Property::Map()
822     .Add("alphaFunction", Property::Array().Add(.1f).Add(1.0f).Add(0.5f))
823     .Add("timePeriod", Property::Map()
824          .Add("delay", 0.5f)
825          .Add("duration", 1.0f));
826
827   Dali::Toolkit::TransitionData transition = TransitionData::New( map );
828
829   DummyControl actor = DummyControl::New();
830   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
831   actor.SetProperty( Dali::Actor::Property::NAME,"Actor1");
832   actor.SetProperty( Actor::Property::COLOR,Color::CYAN);
833   application.GetScene().Add(actor);
834
835   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
836   Property::Map visualMap;
837   visualMap[Visual::Property::TYPE] = Visual::COLOR;
838   visualMap[ColorVisual::Property::MIX_COLOR] = Color::MAGENTA;
839   Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap );
840   visual.SetName( "visual1" );
841
842   Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
843   dummyImpl.RegisterVisual( visualIndex, visual );
844
845   Animation anim = dummyImpl.CreateTransition( transition );
846   DALI_TEST_CHECK( !anim );
847
848   application.SendNotification();
849   application.Render(0);
850   application.SendNotification();
851
852   Renderer renderer = actor.GetRendererAt(0);
853   Property::Index mixColorIdx = renderer.GetPropertyIndex( ColorVisual::Property::MIX_COLOR );
854
855   tet_printf( "Test that the property has been set to target value\n");
856   DALI_TEST_EQUALS(renderer.GetProperty<Vector3>(mixColorIdx), Vector3(Color::RED), 0.001, TEST_LOCATION);
857
858   END_TEST;
859 }
860
861 int UtcDaliTransitionDataMapN6(void)
862 {
863   ToolkitTestApplication application;
864
865   tet_printf("Testing visual doesn't animate with duff bezier data \n");
866
867   Property::Map map;
868   map["target"] = "visual1";
869   map["property"] = "mixColor";
870   map["initialValue"] = Color::MAGENTA;
871   map["targetValue"] = Color::RED;
872   map["animator"] = Property::Map()
873     .Add("alphaFunction", Property::Array().Add("1").Add("Two").Add("3").Add("4"))
874     .Add("timePeriod", Property::Map()
875          .Add("delay", 0.5f)
876          .Add("duration", 1.0f));
877
878   Dali::Toolkit::TransitionData transition = TransitionData::New( map );
879
880   DummyControl actor = DummyControl::New();
881   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
882   actor.SetProperty( Dali::Actor::Property::NAME,"Actor1");
883   actor.SetProperty( Actor::Property::COLOR,Color::CYAN);
884   application.GetScene().Add(actor);
885
886   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
887   Property::Map visualMap;
888   visualMap[Visual::Property::TYPE] = Visual::COLOR;
889   visualMap[ColorVisual::Property::MIX_COLOR] = Color::MAGENTA;
890   Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap );
891   visual.SetName( "visual1" );
892
893   Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
894   dummyImpl.RegisterVisual( visualIndex, visual );
895
896   Animation anim = dummyImpl.CreateTransition( transition );
897   DALI_TEST_CHECK( !anim );
898
899   application.SendNotification();
900   application.Render(0);
901   application.SendNotification();
902
903   Renderer renderer = actor.GetRendererAt(0);
904   Property::Index mixColorIdx = renderer.GetPropertyIndex( ColorVisual::Property::MIX_COLOR );
905
906   tet_printf( "Test that the property has been set to target value\n");
907   DALI_TEST_EQUALS(renderer.GetProperty<Vector3>(mixColorIdx), Vector3(Color::RED), 0.001, TEST_LOCATION);
908   DALI_TEST_EQUALS(renderer.GetProperty<float>( DevelRenderer::Property::OPACITY ), 1.0f, 0.001, TEST_LOCATION);
909
910   END_TEST;
911 }
912
913
914 int UtcDaliTransitionDataArrayP(void)
915 {
916   ToolkitTestApplication application;
917
918   Property::Map map1;
919   map1["target"] = "Actor1";
920   map1["property"] = "color";
921   map1["initialValue"] = Color::MAGENTA;
922   map1["targetValue"] = Color::RED;
923   map1["animator"] = Property::Map()
924     .Add("alphaFunction", "EASE_IN_OUT")
925     .Add("timePeriod", Property::Map()
926          .Add("delay", 0.5f)
927          .Add("duration", 1.0f));
928
929   Property::Map map2;
930   map2["target"] = "Actor1";
931   map2["property"] = "position";
932   map2["initialValue"] = Vector3(100,0,0);
933   map2["targetValue"] = Vector3(0,100,0);
934   map2["animator"] = Property::Map()
935     .Add("alphaFunction", "EASE_IN_OUT")
936     .Add("timePeriod", Property::Map()
937          .Add("delay", 0.0f)
938          .Add("duration", 1.0f));
939
940   Property::Map map3;
941   map3["target"] = "Actor1";
942   map3["property"] = "orientation";
943   map3["targetValue"] = Quaternion( Radian(Math::PI_2), Vector3::ZAXIS );
944
945   Property::Array array;
946   array.PushBack(map1);
947   array.PushBack(map2);
948   array.PushBack(map3);
949
950   Dali::Toolkit::TransitionData transition = TransitionData::New( array );
951
952   DummyControl actor = DummyControl::New();
953   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
954   actor.SetProperty( Dali::Actor::Property::NAME,"Actor1");
955   actor.SetProperty( Actor::Property::COLOR,Color::CYAN);
956   application.GetScene().Add(actor);
957   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(Radian(0), Vector3::ZAXIS), TEST_LOCATION);
958
959   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
960   Animation anim = dummyImpl.CreateTransition( transition );
961   DALI_TEST_CHECK( anim );
962   application.SendNotification();
963   application.Render(0);
964   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::MAGENTA, TEST_LOCATION);
965   DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(Radian(Math::PI_2), Vector3::ZAXIS), TEST_LOCATION);
966   anim.Play();
967
968   application.SendNotification();
969   application.Render(0);   // start map2 anim
970   application.SendNotification();
971   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(100,0,0), TEST_LOCATION);
972
973   application.Render(500); // Start map1 animation, halfway thru map2 anim
974   application.SendNotification();
975   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(50,50,0), TEST_LOCATION);
976
977   application.Render(500); // Halfway thru map1 anim, end of map2 anim
978   application.SendNotification();
979   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(0,100,0), TEST_LOCATION);
980   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), (Color::MAGENTA+Color::RED)*0.5f, TEST_LOCATION);
981
982   application.Render(500); // End of map1 anim
983   application.SendNotification();
984   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::RED, TEST_LOCATION );
985
986   END_TEST;
987 }
988
989
990 int UtcDaliTransitionDataGetAnimatorP(void)
991 {
992   ToolkitTestApplication application;
993
994   Property::Map map1;
995   map1["target"] = "Actor1";
996   map1["property"] = "color";
997   map1["initialValue"] = Color::MAGENTA;
998   map1["targetValue"] = Color::RED;
999   map1["animator"] = Property::Map()
1000     .Add("alphaFunction", "EASE_IN_SQUARE")
1001     .Add("timePeriod", Property::Map()
1002          .Add("delay", 0.5f)
1003          .Add("duration", 0.5f));
1004
1005   Property::Map map2;
1006   map2["target"] = "Actor1";
1007   map2["property"] = "position";
1008   map2["initialValue"] = Vector3(100,0,0);
1009   map2["targetValue"] = Vector3(0,100,0);
1010   map2["animator"] = Property::Map()
1011     .Add("alphaFunction", "EASE_OUT_SQUARE")
1012     .Add("timePeriod", Property::Map()
1013          .Add("delay", 0.2f)
1014          .Add("duration", 2.0f));
1015
1016   Property::Map map3;
1017   map3["target"] = "Actor1";
1018   map3["property"] = "size";
1019   map3["initialValue"] = Vector2(10,10);
1020   map3["targetValue"] = Vector2(100,100);
1021   map3["animator"] = Property::Map()
1022     .Add("alphaFunction", "EASE_OUT_SINE")
1023     .Add("timePeriod", Property::Map()
1024          .Add("delay", 0.4f)
1025          .Add("duration", 3.0f));
1026
1027   Property::Map map4;
1028   map4["target"] = "Actor2";
1029   map4["property"] = "color";
1030   map4["initialValue"] = Color::BLACK;
1031   map4["targetValue"] = Color::GREEN;
1032   map4["animator"] = Property::Map()
1033     .Add("alphaFunction", "EASE_IN_OUT_SINE")
1034     .Add("timePeriod", Property::Map()
1035          .Add("delay", 0.5f)
1036          .Add("duration", 0.5f));
1037
1038   Property::Map map5;
1039   map5["target"] = "Actor2";
1040   map5["property"] = "position";
1041   map5["initialValue"] = Vector3(100,0,0);
1042   map5["targetValue"] = Vector3(0,100,0);
1043   map5["animator"] = Property::Map()
1044     .Add("alphaFunction", "BOUNCE")
1045     .Add("timePeriod", Property::Map()
1046          .Add("delay", 0.2f)
1047          .Add("duration", 2.0f));
1048
1049   Property::Map map6;
1050   map6["target"] = "Actor2";
1051   map6["property"] = "size";
1052   map6["initialValue"] = Vector2(10,10);
1053   map6["targetValue"] = Vector2(100,100);
1054   map6["animator"] = Property::Map()
1055     .Add("alphaFunction", "SIN")
1056     .Add("timePeriod", Property::Map()
1057          .Add("delay", 0.4f)
1058          .Add("duration", 3.0f));
1059
1060   Property::Map map7;
1061   map7["target"] = "Actor4";
1062   map7["property"] = "sizeModeFactor";
1063   map7["initialValue"] = Vector3(1,1,1);
1064   map7["targetValue"] = Vector3(2,2,2);
1065   map7["animator"] = Property::Map()
1066     .Add("alphaFunction", "EASE_IN_SINE")
1067     .Add("timePeriod", Property::Map()
1068          .Add("delay", 0.0f)
1069          .Add("duration", 1.0f));
1070
1071   Property::Map map8;
1072   map8["target"] = "Visual1";
1073   map8["property"] = "opacity";
1074   map8["initialValue"] = 0.0f;
1075   map8["targetValue"] = 1.0f;
1076   map8["animator"] = Property::Map()
1077     .Add("alphaFunction", "EASE_IN")
1078     .Add("timePeriod", Property::Map()
1079          .Add("delay", 0.3f)
1080          .Add("duration", 9.0f));
1081
1082   Property::Map map9;
1083   map9["target"] = "Actor2";
1084   map9["property"] = "scale";
1085   map9["initialValue"] = Vector3(0,0,0);
1086   map9["targetValue"] = Vector3(1,1,1);
1087   map9["animator"] = Property::Map()
1088     .Add("alphaFunction", "REVERSE")
1089     .Add("timePeriod", Property::Map()
1090          .Add("delay", 0.0f)
1091          .Add("duration", 1.0f));
1092
1093   Property::Map map10;
1094   map10["target"] = "Actor2";
1095   map10["property"] = "scale";
1096   map10["initialValue"] = Vector3(0,0,0);
1097   map10["targetValue"] = Vector3(1,1,1);
1098   map10["animator"] = Property::Map()
1099     .Add("alphaFunction", Vector4(.23,.4,.8,1.2))
1100     .Add("timePeriod", Property::Map()
1101          .Add("delay", 0.0f)
1102          .Add("duration", 1.0f));
1103
1104   Property::Map map11;
1105   map11["target"] = "Actor2";
1106   map11["property"] = "scale";
1107   map11["initialValue"] = Vector3(0,0,0);
1108   map11["targetValue"] = Vector3(1,1,1);
1109   map11["animator"] = Property::Map()
1110     .Add("alphaFunction", Property::Array().Add(.23f).Add(.4f).Add(.8f).Add(.2f))
1111     .Add("timePeriod", Property::Map()
1112          .Add("delay", 0.0f)
1113          .Add("duration", 1.0f));
1114
1115   Property::Map map12;
1116   map12["target"] = "Actor1";
1117   map12["property"] = "orientation";
1118   map12["targetValue"] = Quaternion( Radian(Math::PI_2), Vector3::ZAXIS );
1119
1120   Property::Array array;
1121   array.PushBack(map1);
1122   array.PushBack(map2);
1123   array.PushBack(map3);
1124   array.PushBack(map4);
1125   array.PushBack(map5);
1126   array.PushBack(map6);
1127   array.PushBack(map7);
1128   array.PushBack(map8);
1129   array.PushBack(map9);
1130   array.PushBack(map10);
1131   array.PushBack(map11);
1132   array.PushBack(map12);
1133
1134   Dali::Toolkit::TransitionData transition = TransitionData::New( array );
1135
1136   DALI_TEST_EQUALS( transition.Count(), array.Count(), TEST_LOCATION );
1137
1138   for( unsigned int i=0; i < array.Count(); ++i )
1139   {
1140     Property::Map animatorMap = transition.GetAnimatorAt(i);
1141     Property::Value& value = array.GetElementAt(i);
1142     Property::Map* inputMap = value.GetMap();
1143     DALI_TEST_CHECK( inputMap );
1144     CHECK_MAP_EQUALS( *inputMap, animatorMap );
1145   }
1146
1147   END_TEST;
1148 }