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