[dali_1.2.60] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-TransitionData.cpp
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #include <iostream>
18 #include <stdlib.h>
19 #include <dali-toolkit-test-suite-utils.h>
20 #include <dali.h>
21 #include <dali/devel-api/object/handle-devel.h>
22 #include <dali-toolkit/dali-toolkit.h>
23 #include <dali-toolkit/devel-api/visual-factory/transition-data.h>
24 #include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
25 #include "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   TestApplication 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   TestApplication 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   TestApplication 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   TestApplication 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   TestApplication 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   TestApplication 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.SetName("Actor1");
238   actor.SetColor(Color::CYAN);
239   Stage::GetCurrent().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 = DevelHandle::GetPropertyIndex( renderer, ColorVisual::Property::MIX_COLOR );
257   Property::Index opacityIndex = DevelHandle::GetPropertyIndex( renderer, Visual::Property::OPACITY );
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>(opacityIndex), 1.0f, 0.001f, TEST_LOCATION );
264   DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( opacityIndex ), 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 >( opacityIndex ), 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 >( opacityIndex ), 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   Property::Index opacityIndex = DevelHandle::GetPropertyIndex( renderer, Visual::Property::OPACITY );
327   application.SendNotification();
328   application.Render(0);
329
330   DALI_TEST_EQUALS( renderer.GetProperty<Vector3>(mixColorIndex), Vector3(Color::MAGENTA), TEST_LOCATION);
331   DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION );
332   DALI_TEST_EQUALS( renderer.GetProperty<float>(opacityIndex), 1.0f, 0.001f, TEST_LOCATION );
333   DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( opacityIndex ), 1.0f, 0.001f, TEST_LOCATION );
334
335   anim.Play();
336
337   application.SendNotification();
338   application.Render(0);
339   application.Render(500); // Start animation
340   application.Render(500); // Halfway thru anim
341   application.SendNotification();
342   DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA+Color::RED)*0.5f, TEST_LOCATION);
343   DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( opacityIndex ), 1.0f, 0.001f, TEST_LOCATION);
344
345   application.Render(500); // End of anim
346   application.SendNotification();
347   DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::RED), TEST_LOCATION );
348   DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( opacityIndex ), 1.0f, 0.001f, TEST_LOCATION);
349
350   END_TEST;
351 }
352
353
354 int UtcDaliTransitionDataMap2Pb(void)
355 {
356   TestApplication application;
357
358   tet_printf("Testing animation of a visual property using programmatic maps\n");
359
360   Property::Map map;
361   map["target"] = "visual1";
362   map["property"] = PrimitiveVisual::Property::MIX_COLOR;
363   map["initialValue"] = Color::MAGENTA;
364   map["targetValue"] = Color::RED;
365   map["animator"] = Property::Map()
366     .Add("alphaFunction", "LINEAR")
367     .Add("timePeriod", Property::Map()
368          .Add("delay", 0.5f)
369          .Add("duration", 1.0f));
370
371   Dali::Toolkit::TransitionData transition = TransitionData::New( map );
372
373   DummyControl actor = DummyControl::New();
374   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
375   actor.SetName("Actor1");
376   actor.SetColor(Color::CYAN);
377   Stage::GetCurrent().Add(actor);
378
379   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
380
381   Property::Map visualMap;
382   visualMap[Visual::Property::TYPE] = Visual::PRIMITIVE;
383   visualMap[PrimitiveVisual::Property::MIX_COLOR] = Color::MAGENTA;
384   visualMap[ PrimitiveVisual::Property::SHAPE  ] = PrimitiveVisual::Shape::SPHERE;
385   visualMap[ PrimitiveVisual::Property::SLICES ] = 10;
386   visualMap[ PrimitiveVisual::Property::STACKS ] = 10;
387
388   Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap );
389   visual.SetName( "visual1" );
390
391   Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
392   dummyImpl.RegisterVisual( visualIndex, visual );
393
394   Animation anim = dummyImpl.CreateTransition( transition );
395   DALI_TEST_CHECK( anim );
396
397   Renderer renderer = actor.GetRendererAt(0);
398   Property::Index mixColorIndex = DevelHandle::GetPropertyIndex( renderer, PrimitiveVisual::Property::MIX_COLOR );
399   Property::Index opacityIndex = DevelHandle::GetPropertyIndex( renderer, Visual::Property::OPACITY );
400   application.SendNotification();
401   application.Render(0);
402
403   DALI_TEST_EQUALS( renderer.GetProperty<Vector3>(mixColorIndex), Vector3(Color::MAGENTA), TEST_LOCATION);
404   DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION );
405   DALI_TEST_EQUALS( renderer.GetProperty<float>(opacityIndex), 1.0f, 0.001f, TEST_LOCATION );
406   DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( opacityIndex ), 1.0f, 0.001f, TEST_LOCATION );
407
408   anim.Play();
409
410   application.SendNotification();
411   application.Render(0);
412   application.Render(500); // Start animation
413   application.Render(500); // Halfway thru anim
414   application.SendNotification();
415   DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA+Color::RED)*0.5f, TEST_LOCATION);
416   DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( opacityIndex ), 1.0f, 0.001f, TEST_LOCATION);
417
418   application.Render(500); // End of anim
419   application.SendNotification();
420   DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::RED), TEST_LOCATION );
421   DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( opacityIndex ), 1.0f, 0.001f, TEST_LOCATION);
422
423   END_TEST;
424 }
425
426
427 int UtcDaliTransitionDataMap3P(void)
428 {
429   TestApplication application;
430
431   tet_printf("Testing animation of an actor's position property using bezier curve\n");
432
433   Property::Map map;
434   map["target"] = "Actor1";
435   map["property"] = "position";
436   map["initialValue"] = Vector3(0, 0, 0);
437   map["targetValue"] = Vector3(100, 100, 0);
438   map["animator"] = Property::Map()
439     .Add("alphaFunction", Vector4(0.71, -0.57, 0.42, 1.38) )
440     .Add("timePeriod", Property::Map()
441          .Add("delay", 0.0f)
442          .Add("duration", 1.0f));
443
444   Dali::Toolkit::TransitionData transition = TransitionData::New( map );
445
446   DummyControl actor = DummyControl::New();
447   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
448   actor.SetName("Actor1");
449   Stage::GetCurrent().Add(actor);
450
451   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
452   Animation anim = dummyImpl.CreateTransition( transition );
453   DALI_TEST_CHECK( anim );
454
455   application.SendNotification();
456   application.Render(0);
457   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(0,0,0), 0.001f, TEST_LOCATION);
458
459   anim.Play();
460
461   application.SendNotification();
462   application.Render(0);
463
464   application.Render(250); // 25%
465   application.SendNotification();
466   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%
467
468   application.Render(250); // Halfway thru map1 anim
469   application.SendNotification();
470   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%
471
472   application.Render(250); // End of map1 anim
473   application.SendNotification();
474   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
475
476   application.Render(250); // End of map1 anim
477   application.SendNotification();
478   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(100,100,0), TEST_LOCATION );
479   END_TEST;
480 }
481
482
483 int UtcDaliTransitionDataMap4P(void)
484 {
485   TestApplication application;
486
487   tet_printf("Testing animation of a visual's transform property using programmatic maps\n");
488
489   Property::Map map1;
490   map1["target"] = "testVisual";
491   map1["property"] = "offset";
492   map1["initialValue"] = Vector2(0.0f, 0.0f);
493   map1["targetValue"] = Vector2(100.0f, 100.0f);
494   map1["animator"] = Property::Map()
495     .Add("alphaFunction", "LINEAR")
496     .Add("timePeriod", Property::Map()
497          .Add("delay", 0.5f)
498          .Add("duration", 1.0f));
499
500   Property::Map map2;
501   map2["target"] = "testVisual";
502   map2["property"] = "size";
503   map2["initialValue"] = Vector2(10.0f, 10.0f);
504   map2["targetValue"] = Vector2(110.0f, 110.0f);
505   map2["animator"] = Property::Map()
506     .Add("alphaFunction", "LINEAR")
507     .Add("timePeriod", Property::Map()
508          .Add("delay", 0.5f)
509          .Add("duration", 1.0f));
510
511   Dali::Toolkit::TransitionData transition = TransitionData::New( Property::Array().Add(map1).Add(map2) );
512
513   DummyControl actor = DummyControl::New();
514   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
515   actor.SetName("Actor1");
516   Stage::GetCurrent().Add(actor);
517
518   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
519
520   Property::Map visualMap;
521   visualMap[Visual::Property::TYPE] = Visual::COLOR;
522   visualMap[ColorVisual::Property::MIX_COLOR] = Color::MAGENTA;
523   Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap );
524
525   visual.SetName( "testVisual" );
526   dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
527
528   Animation anim = dummyImpl.CreateTransition( transition );
529   DALI_TEST_CHECK( anim );
530
531   Renderer renderer = actor.GetRendererAt(0);
532   Property::Index sizeIndex = renderer.GetPropertyIndex( "size" );
533   application.SendNotification();
534   application.Render(0);
535
536   DALI_TEST_EQUALS( renderer.GetProperty<Vector2>(sizeIndex), Vector2(10.0f, 10.0f), TEST_LOCATION);
537   DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector2 >( sizeIndex ), Vector2(10.0f, 10.0f), TEST_LOCATION);
538
539   anim.Play();
540
541   application.SendNotification();
542   application.Render(0);
543   application.Render(500); // Start animation
544   application.Render(500); // Halfway thru anim
545   application.SendNotification();
546   DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector2 >( sizeIndex ), Vector2(60.0f, 60.0f), TEST_LOCATION);
547
548   application.Render(500); // End of anim
549   application.SendNotification();
550   DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector2 >( sizeIndex ), Vector2(110.0f, 110.0f), TEST_LOCATION );
551
552   END_TEST;
553 }
554
555 int UtcDaliTransitionDataMap5P(void)
556 {
557   TestApplication application;
558
559   tet_printf("Testing animation visual opacity using stylesheet equivalent maps\n");
560
561   Property::Map map;
562   map["target"] = "visual1";
563   map["property"] = "opacity";
564   map["initialValue"] = 0.0f;
565   map["targetValue"] = 1.0f;
566   map["animator"] = Property::Map()
567     .Add("alphaFunction", "EASE_IN_OUT")
568     .Add("timePeriod", Property::Map()
569          .Add("delay", 0.5f)
570          .Add("duration", 1.0f));
571
572   Dali::Toolkit::TransitionData transition = TransitionData::New( map );
573
574   DummyControl actor = DummyControl::New();
575   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
576   actor.SetName("Actor1");
577   actor.SetColor(Color::CYAN);
578   Stage::GetCurrent().Add(actor);
579
580   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
581
582   Property::Map visualMap;
583   visualMap[Visual::Property::TYPE] = Visual::COLOR;
584   visualMap[ColorVisual::Property::MIX_COLOR] = Color::MAGENTA;
585   Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap );
586   visual.SetName( "visual1" );
587
588   Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
589   dummyImpl.RegisterVisual( visualIndex, visual );
590
591   Animation anim = dummyImpl.CreateTransition( transition );
592   DALI_TEST_CHECK( anim );
593
594   Renderer renderer = actor.GetRendererAt(0);
595   Property::Index mixColorIndex = DevelHandle::GetPropertyIndex( renderer, ColorVisual::Property::MIX_COLOR );
596   Property::Index opacityIndex = DevelHandle::GetPropertyIndex( renderer, Visual::Property::OPACITY );
597   application.SendNotification();
598   application.Render(0);
599
600   DALI_TEST_EQUALS( renderer.GetProperty<Vector3>(mixColorIndex), Vector3(Color::MAGENTA), TEST_LOCATION);
601   DALI_TEST_EQUALS( renderer.GetProperty<float>(opacityIndex), 0.0f, 0.001f, TEST_LOCATION );
602   DALI_TEST_EQUALS( renderer.GetProperty<int>(Renderer::Property::BLEND_MODE), (int)BlendMode::ON, TEST_LOCATION );
603
604   DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION);
605   DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( opacityIndex ), 0.0f, 0.001f, TEST_LOCATION );
606   DALI_TEST_EQUALS( renderer.GetCurrentProperty< int >( Renderer::Property::BLEND_MODE ), (int)BlendMode::ON, TEST_LOCATION );
607
608   anim.Play();
609
610   application.SendNotification();
611   application.Render(500); // Start animation
612   application.Render(500); // Halfway thru anim
613   application.SendNotification();
614   DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION);
615   DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( opacityIndex ), 0.5f, 0.001f, TEST_LOCATION );
616   DALI_TEST_EQUALS( renderer.GetCurrentProperty< int >( Renderer::Property::BLEND_MODE ), (int)BlendMode::ON, TEST_LOCATION );
617
618   application.Render(501); // End of anim
619   application.SendNotification();
620   DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION );
621   DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( opacityIndex ), 1.0f, 0.001f, TEST_LOCATION );
622   DALI_TEST_EQUALS( renderer.GetCurrentProperty< int >( Renderer::Property::BLEND_MODE ), (int)BlendMode::AUTO, TEST_LOCATION );
623
624   END_TEST;
625 }
626
627
628 int UtcDaliTransitionDataMap6P(void)
629 {
630   TestApplication application;
631
632   tet_printf("Testing animation visual opacity using stylesheet equivalent maps\n");
633
634   Property::Map map;
635   map["target"] = "visual1";
636   map["property"] = "opacity";
637   map["targetValue"] = 0.0f;
638   map["animator"] = Property::Map()
639     .Add("alphaFunction", "EASE_IN_OUT")
640     .Add("timePeriod", Property::Map()
641          .Add("delay", 0.5f)
642          .Add("duration", 1.0f));
643
644   Dali::Toolkit::TransitionData transition = TransitionData::New( map );
645
646   DummyControl actor = DummyControl::New();
647   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
648   actor.SetName("Actor1");
649   actor.SetColor(Color::CYAN);
650   Stage::GetCurrent().Add(actor);
651
652   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
653
654   Property::Map visualMap;
655   visualMap[Visual::Property::TYPE] = Visual::COLOR;
656   visualMap[ColorVisual::Property::MIX_COLOR] = Color::MAGENTA;
657   Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap );
658   visual.SetName( "visual1" );
659
660   Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
661   dummyImpl.RegisterVisual( visualIndex, visual );
662
663   Animation anim = dummyImpl.CreateTransition( transition );
664   DALI_TEST_CHECK( anim );
665
666   Renderer renderer = actor.GetRendererAt(0);
667   Property::Index mixColorIndex = DevelHandle::GetPropertyIndex( renderer, ColorVisual::Property::MIX_COLOR );
668   Property::Index opacityIndex = DevelHandle::GetPropertyIndex( renderer, Visual::Property::OPACITY );
669   application.SendNotification();
670   application.Render(0);
671
672   DALI_TEST_EQUALS( renderer.GetProperty<Vector3>(mixColorIndex), Vector3(Color::MAGENTA), TEST_LOCATION);
673   DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION);
674   DALI_TEST_EQUALS( renderer.GetProperty<float>(opacityIndex), 1.0f, 0.001f, TEST_LOCATION );
675   DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( opacityIndex ), 1.0f, 0.001f, TEST_LOCATION );
676
677   // Note, This should be testing for AUTO
678   // this is the same problem as C# target value being set before Play is called.
679   // @todo How was this solved?
680   DALI_TEST_EQUALS( renderer.GetProperty<int>(Renderer::Property::BLEND_MODE), (int)BlendMode::ON, TEST_LOCATION );
681   DALI_TEST_EQUALS( renderer.GetCurrentProperty< int >( Renderer::Property::BLEND_MODE ), (int)BlendMode::ON, TEST_LOCATION );
682
683   anim.Play();
684
685   application.SendNotification();
686   application.Render(500); // Start animation
687   application.Render(500); // Halfway thru anim
688   application.SendNotification();
689   DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION);
690   DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( opacityIndex ), 0.5f, 0.001f, TEST_LOCATION );
691   DALI_TEST_EQUALS( renderer.GetCurrentProperty< int >( Renderer::Property::BLEND_MODE ), (int)BlendMode::ON, TEST_LOCATION );
692
693   application.Render(500); // End of anim
694   application.SendNotification();
695   DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION );
696   DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( opacityIndex ), 0.0f, 0.001f, TEST_LOCATION );
697   DALI_TEST_EQUALS( renderer.GetCurrentProperty< int >( Renderer::Property::BLEND_MODE ), (int)BlendMode::ON, TEST_LOCATION );
698
699   END_TEST;
700 }
701
702
703 int UtcDaliTransitionDataMap1N(void)
704 {
705   TestApplication application;
706
707   Property::Map map;
708   map["target"] = "Actor1";
709   map["property"] = "randomProperty";
710   map["initialValue"] = Color::MAGENTA;
711   map["targetValue"] = Color::RED;
712   map["animator"] = Property::Map()
713     .Add("alphaFunction", "EASE_OUT")
714     .Add("timePeriod", Property::Map()
715          .Add("delay", 0.5f)
716          .Add("duration", 1.0f));
717
718   Dali::Toolkit::TransitionData transition = TransitionData::New( map );
719
720   DummyControl actor = DummyControl::New();
721   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
722   actor.SetName("Actor1");
723   actor.SetColor(Color::CYAN);
724   Stage::GetCurrent().Add(actor);
725
726   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
727   Animation anim = dummyImpl.CreateTransition( transition );
728   DALI_TEST_CHECK( ! anim );
729
730   CHECK_MAP_EQUALS( map, transition.GetAnimatorAt(0) );
731   END_TEST;
732 }
733
734
735 int UtcDaliTransitionDataMapN3(void)
736 {
737   TestApplication application;
738
739   tet_printf("Testing visual lookup with no renderers\n");
740
741   Property::Map map;
742   map["target"] = "visual1";
743   map["property"] = "mixColor";
744   map["initialValue"] = Vector3(Color::MAGENTA);
745   map["targetValue"] = Vector3(Color::RED);
746   map["animator"] = Property::Map()
747     .Add("alphaFunction", "EASE_OUT_BACK")
748     .Add("timePeriod", Property::Map()
749          .Add("delay", 0.5f)
750          .Add("duration", 1.0f));
751
752   Dali::Toolkit::TransitionData transition = TransitionData::New( map );
753   CHECK_MAP_EQUALS( map, transition.GetAnimatorAt(0) );
754
755   DummyControl actor = DummyControl::New();
756   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
757   actor.SetName("Actor1");
758   actor.SetColor(Color::CYAN);
759   // Don't stage actor
760
761   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
762   Property::Map visualMap;
763   visualMap[Visual::Property::TYPE] = Visual::COLOR;
764   visualMap[ColorVisual::Property::MIX_COLOR] = Vector3(Color::MAGENTA);
765   Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap );
766   visual.SetName( "visual1" );
767
768   Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
769   dummyImpl.RegisterVisual( visualIndex, visual );
770
771   Animation anim = dummyImpl.CreateTransition( transition );
772   DALI_TEST_CHECK( !anim );
773   END_TEST;
774 }
775
776
777 int UtcDaliTransitionDataMapN4(void)
778 {
779   TestApplication application;
780
781   tet_printf("Testing visual doesn't animate with duff bezier data \n");
782
783   Property::Map map;
784   map["target"] = "visual1";
785   map["property"] = "mixColor";
786   map["initialValue"] = Vector3(Color::MAGENTA);
787   map["targetValue"] = Vector3(Color::RED);
788   map["animator"] = Property::Map()
789     .Add("alphaFunction", Vector3(.1f,1.0f,0.5f))
790     .Add("timePeriod", Property::Map()
791          .Add("delay", 0.5f)
792          .Add("duration", 1.0f));
793
794   Dali::Toolkit::TransitionData transition = TransitionData::New( map );
795
796   DummyControl actor = DummyControl::New();
797   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
798   actor.SetName("Actor1");
799   actor.SetColor(Color::CYAN);
800   Stage::GetCurrent().Add(actor);
801
802   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
803   Property::Map visualMap;
804   visualMap[Visual::Property::TYPE] = Visual::COLOR;
805   visualMap[ColorVisual::Property::MIX_COLOR] = Color::MAGENTA;
806   Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap );
807   visual.SetName( "visual1" );
808
809   Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
810   dummyImpl.RegisterVisual( visualIndex, visual );
811
812   Animation anim = dummyImpl.CreateTransition( transition );
813   DALI_TEST_CHECK( !anim );
814
815   application.SendNotification();
816   application.Render(0);
817   application.SendNotification();
818
819   Renderer renderer = actor.GetRendererAt(0);
820   Property::Index mixColorIdx = DevelHandle::GetPropertyIndex( renderer, ColorVisual::Property::MIX_COLOR );
821   Property::Index opacityIdx = DevelHandle::GetPropertyIndex( renderer, Visual::Property::OPACITY );
822
823   tet_printf( "Test that the property has been set to target value\n");
824   DALI_TEST_EQUALS(renderer.GetProperty<Vector3>(mixColorIdx), Vector3(Color::RED), 0.001, TEST_LOCATION);
825   DALI_TEST_EQUALS(renderer.GetProperty<float>(opacityIdx), 1.0f, 0.001, TEST_LOCATION);
826
827   END_TEST;
828 }
829
830 int UtcDaliTransitionDataMapN5(void)
831 {
832   TestApplication application;
833
834   tet_printf("Testing visual doesn't animate with duff bezier data \n");
835
836   Property::Map map;
837   map["target"] = "visual1";
838   map["property"] = "mixColor";
839   map["initialValue"] = Color::MAGENTA;
840   map["targetValue"] = Color::RED;
841   map["animator"] = Property::Map()
842     .Add("alphaFunction", Property::Array().Add(.1f).Add(1.0f).Add(0.5f))
843     .Add("timePeriod", Property::Map()
844          .Add("delay", 0.5f)
845          .Add("duration", 1.0f));
846
847   Dali::Toolkit::TransitionData transition = TransitionData::New( map );
848
849   DummyControl actor = DummyControl::New();
850   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
851   actor.SetName("Actor1");
852   actor.SetColor(Color::CYAN);
853   Stage::GetCurrent().Add(actor);
854
855   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
856   Property::Map visualMap;
857   visualMap[Visual::Property::TYPE] = Visual::COLOR;
858   visualMap[ColorVisual::Property::MIX_COLOR] = Color::MAGENTA;
859   Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap );
860   visual.SetName( "visual1" );
861
862   Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
863   dummyImpl.RegisterVisual( visualIndex, visual );
864
865   Animation anim = dummyImpl.CreateTransition( transition );
866   DALI_TEST_CHECK( !anim );
867
868   application.SendNotification();
869   application.Render(0);
870   application.SendNotification();
871
872   Renderer renderer = actor.GetRendererAt(0);
873   Property::Index mixColorIdx = DevelHandle::GetPropertyIndex( renderer, ColorVisual::Property::MIX_COLOR );
874
875   tet_printf( "Test that the property has been set to target value\n");
876   DALI_TEST_EQUALS(renderer.GetProperty<Vector3>(mixColorIdx), Vector3(Color::RED), 0.001, TEST_LOCATION);
877
878   END_TEST;
879 }
880
881 int UtcDaliTransitionDataMapN6(void)
882 {
883   TestApplication application;
884
885   tet_printf("Testing visual doesn't animate with duff bezier data \n");
886
887   Property::Map map;
888   map["target"] = "visual1";
889   map["property"] = "mixColor";
890   map["initialValue"] = Color::MAGENTA;
891   map["targetValue"] = Color::RED;
892   map["animator"] = Property::Map()
893     .Add("alphaFunction", Property::Array().Add("1").Add("Two").Add("3").Add("4"))
894     .Add("timePeriod", Property::Map()
895          .Add("delay", 0.5f)
896          .Add("duration", 1.0f));
897
898   Dali::Toolkit::TransitionData transition = TransitionData::New( map );
899
900   DummyControl actor = DummyControl::New();
901   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
902   actor.SetName("Actor1");
903   actor.SetColor(Color::CYAN);
904   Stage::GetCurrent().Add(actor);
905
906   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
907   Property::Map visualMap;
908   visualMap[Visual::Property::TYPE] = Visual::COLOR;
909   visualMap[ColorVisual::Property::MIX_COLOR] = Color::MAGENTA;
910   Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap );
911   visual.SetName( "visual1" );
912
913   Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1;
914   dummyImpl.RegisterVisual( visualIndex, visual );
915
916   Animation anim = dummyImpl.CreateTransition( transition );
917   DALI_TEST_CHECK( !anim );
918
919   application.SendNotification();
920   application.Render(0);
921   application.SendNotification();
922
923   Renderer renderer = actor.GetRendererAt(0);
924   Property::Index mixColorIdx = DevelHandle::GetPropertyIndex( renderer, ColorVisual::Property::MIX_COLOR );
925   Property::Index opacityIdx = DevelHandle::GetPropertyIndex( renderer, Visual::Property::OPACITY );
926
927   tet_printf( "Test that the property has been set to target value\n");
928   DALI_TEST_EQUALS(renderer.GetProperty<Vector3>(mixColorIdx), Vector3(Color::RED), 0.001, TEST_LOCATION);
929   DALI_TEST_EQUALS(renderer.GetProperty<float>(opacityIdx), 1.0f, 0.001, TEST_LOCATION);
930
931   END_TEST;
932 }
933
934
935 int UtcDaliTransitionDataArrayP(void)
936 {
937   TestApplication application;
938
939   Property::Map map1;
940   map1["target"] = "Actor1";
941   map1["property"] = "color";
942   map1["initialValue"] = Color::MAGENTA;
943   map1["targetValue"] = Color::RED;
944   map1["animator"] = Property::Map()
945     .Add("alphaFunction", "EASE_IN_OUT")
946     .Add("timePeriod", Property::Map()
947          .Add("delay", 0.5f)
948          .Add("duration", 1.0f));
949
950   Property::Map map2;
951   map2["target"] = "Actor1";
952   map2["property"] = "position";
953   map2["initialValue"] = Vector3(100,0,0);
954   map2["targetValue"] = Vector3(0,100,0);
955   map2["animator"] = Property::Map()
956     .Add("alphaFunction", "EASE_IN_OUT")
957     .Add("timePeriod", Property::Map()
958          .Add("delay", 0.0f)
959          .Add("duration", 1.0f));
960
961   Property::Map map3;
962   map3["target"] = "Actor1";
963   map3["property"] = "orientation";
964   map3["targetValue"] = Quaternion( Radian(Math::PI_2), Vector3::ZAXIS );
965
966   Property::Array array;
967   array.PushBack(map1);
968   array.PushBack(map2);
969   array.PushBack(map3);
970
971   Dali::Toolkit::TransitionData transition = TransitionData::New( array );
972
973   DummyControl actor = DummyControl::New();
974   actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
975   actor.SetName("Actor1");
976   actor.SetColor(Color::CYAN);
977   Stage::GetCurrent().Add(actor);
978   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(Radian(0), Vector3::ZAXIS), TEST_LOCATION);
979
980   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
981   Animation anim = dummyImpl.CreateTransition( transition );
982   DALI_TEST_CHECK( anim );
983   application.SendNotification();
984   application.Render(0);
985   DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::MAGENTA, TEST_LOCATION);
986   DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(Radian(Math::PI_2), Vector3::ZAXIS), TEST_LOCATION);
987   anim.Play();
988
989   application.SendNotification();
990   application.Render(0);   // start map2 anim
991   application.SendNotification();
992   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(100,0,0), TEST_LOCATION);
993
994   application.Render(500); // Start map1 animation, halfway thru map2 anim
995   application.SendNotification();
996   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(50,50,0), TEST_LOCATION);
997
998   application.Render(500); // Halfway thru map1 anim, end of map2 anim
999   application.SendNotification();
1000   DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(0,100,0), TEST_LOCATION);
1001   DALI_TEST_EQUALS( actor.GetCurrentColor(), (Color::MAGENTA+Color::RED)*0.5f, TEST_LOCATION);
1002
1003   application.Render(500); // End of map1 anim
1004   application.SendNotification();
1005   DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::RED, TEST_LOCATION );
1006
1007   END_TEST;
1008 }
1009
1010
1011 int UtcDaliTransitionDataGetAnimatorP(void)
1012 {
1013   TestApplication application;
1014
1015   Property::Map map1;
1016   map1["target"] = "Actor1";
1017   map1["property"] = "color";
1018   map1["initialValue"] = Color::MAGENTA;
1019   map1["targetValue"] = Color::RED;
1020   map1["animator"] = Property::Map()
1021     .Add("alphaFunction", "EASE_IN_SQUARE")
1022     .Add("timePeriod", Property::Map()
1023          .Add("delay", 0.5f)
1024          .Add("duration", 0.5f));
1025
1026   Property::Map map2;
1027   map2["target"] = "Actor1";
1028   map2["property"] = "position";
1029   map2["initialValue"] = Vector3(100,0,0);
1030   map2["targetValue"] = Vector3(0,100,0);
1031   map2["animator"] = Property::Map()
1032     .Add("alphaFunction", "EASE_OUT_SQUARE")
1033     .Add("timePeriod", Property::Map()
1034          .Add("delay", 0.2f)
1035          .Add("duration", 2.0f));
1036
1037   Property::Map map3;
1038   map3["target"] = "Actor1";
1039   map3["property"] = "size";
1040   map3["initialValue"] = Vector2(10,10);
1041   map3["targetValue"] = Vector2(100,100);
1042   map3["animator"] = Property::Map()
1043     .Add("alphaFunction", "EASE_OUT_SINE")
1044     .Add("timePeriod", Property::Map()
1045          .Add("delay", 0.4f)
1046          .Add("duration", 3.0f));
1047
1048   Property::Map map4;
1049   map4["target"] = "Actor2";
1050   map4["property"] = "color";
1051   map4["initialValue"] = Color::BLACK;
1052   map4["targetValue"] = Color::GREEN;
1053   map4["animator"] = Property::Map()
1054     .Add("alphaFunction", "EASE_IN_OUT_SINE")
1055     .Add("timePeriod", Property::Map()
1056          .Add("delay", 0.5f)
1057          .Add("duration", 0.5f));
1058
1059   Property::Map map5;
1060   map5["target"] = "Actor2";
1061   map5["property"] = "position";
1062   map5["initialValue"] = Vector3(100,0,0);
1063   map5["targetValue"] = Vector3(0,100,0);
1064   map5["animator"] = Property::Map()
1065     .Add("alphaFunction", "BOUNCE")
1066     .Add("timePeriod", Property::Map()
1067          .Add("delay", 0.2f)
1068          .Add("duration", 2.0f));
1069
1070   Property::Map map6;
1071   map6["target"] = "Actor2";
1072   map6["property"] = "size";
1073   map6["initialValue"] = Vector2(10,10);
1074   map6["targetValue"] = Vector2(100,100);
1075   map6["animator"] = Property::Map()
1076     .Add("alphaFunction", "SIN")
1077     .Add("timePeriod", Property::Map()
1078          .Add("delay", 0.4f)
1079          .Add("duration", 3.0f));
1080
1081   Property::Map map7;
1082   map7["target"] = "Actor4";
1083   map7["property"] = "sizeModeFactor";
1084   map7["initialValue"] = Vector3(1,1,1);
1085   map7["targetValue"] = Vector3(2,2,2);
1086   map7["animator"] = Property::Map()
1087     .Add("alphaFunction", "EASE_IN_SINE")
1088     .Add("timePeriod", Property::Map()
1089          .Add("delay", 0.0f)
1090          .Add("duration", 1.0f));
1091
1092   Property::Map map8;
1093   map8["target"] = "Visual1";
1094   map8["property"] = "opacity";
1095   map8["initialValue"] = 0.0f;
1096   map8["targetValue"] = 1.0f;
1097   map8["animator"] = Property::Map()
1098     .Add("alphaFunction", "EASE_IN")
1099     .Add("timePeriod", Property::Map()
1100          .Add("delay", 0.3f)
1101          .Add("duration", 9.0f));
1102
1103   Property::Map map9;
1104   map9["target"] = "Actor2";
1105   map9["property"] = "scale";
1106   map9["initialValue"] = Vector3(0,0,0);
1107   map9["targetValue"] = Vector3(1,1,1);
1108   map9["animator"] = Property::Map()
1109     .Add("alphaFunction", "REVERSE")
1110     .Add("timePeriod", Property::Map()
1111          .Add("delay", 0.0f)
1112          .Add("duration", 1.0f));
1113
1114   Property::Map map10;
1115   map10["target"] = "Actor2";
1116   map10["property"] = "scale";
1117   map10["initialValue"] = Vector3(0,0,0);
1118   map10["targetValue"] = Vector3(1,1,1);
1119   map10["animator"] = Property::Map()
1120     .Add("alphaFunction", Vector4(.23,.4,.8,1.2))
1121     .Add("timePeriod", Property::Map()
1122          .Add("delay", 0.0f)
1123          .Add("duration", 1.0f));
1124
1125   Property::Map map11;
1126   map11["target"] = "Actor2";
1127   map11["property"] = "scale";
1128   map11["initialValue"] = Vector3(0,0,0);
1129   map11["targetValue"] = Vector3(1,1,1);
1130   map11["animator"] = Property::Map()
1131     .Add("alphaFunction", Property::Array().Add(.23f).Add(.4f).Add(.8f).Add(.2f))
1132     .Add("timePeriod", Property::Map()
1133          .Add("delay", 0.0f)
1134          .Add("duration", 1.0f));
1135
1136   Property::Map map12;
1137   map12["target"] = "Actor1";
1138   map12["property"] = "orientation";
1139   map12["targetValue"] = Quaternion( Radian(Math::PI_2), Vector3::ZAXIS );
1140
1141   Property::Array array;
1142   array.PushBack(map1);
1143   array.PushBack(map2);
1144   array.PushBack(map3);
1145   array.PushBack(map4);
1146   array.PushBack(map5);
1147   array.PushBack(map6);
1148   array.PushBack(map7);
1149   array.PushBack(map8);
1150   array.PushBack(map9);
1151   array.PushBack(map10);
1152   array.PushBack(map11);
1153   array.PushBack(map12);
1154
1155   Dali::Toolkit::TransitionData transition = TransitionData::New( array );
1156
1157   DALI_TEST_EQUALS( transition.Count(), array.Count(), TEST_LOCATION );
1158
1159   for( unsigned int i=0; i < array.Count(); ++i )
1160   {
1161     Property::Map animatorMap = transition.GetAnimatorAt(i);
1162     Property::Value& value = array.GetElementAt(i);
1163     Property::Map* inputMap = value.GetMap();
1164     DALI_TEST_CHECK( inputMap );
1165     CHECK_MAP_EQUALS( *inputMap, animatorMap );
1166   }
1167
1168   END_TEST;
1169 }