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