Revert "Remove dali-core dependency of GLES version."
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-LayoutingAnimation.cpp
1 /*
2  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 #include <iostream>
19 #include <stdlib.h>
20 #include <dali-toolkit-test-suite-utils.h>
21 #include <toolkit-event-thread-callback.h>
22
23 #include <dali-toolkit/dali-toolkit.h>
24 #include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
25 #include <dali-toolkit/devel-api/controls/control-devel.h>
26 #include <dali-toolkit/devel-api/layouting/absolute-layout.h>
27 #include <dali-toolkit/devel-api/layouting/grid.h>
28 #include <dali-toolkit/devel-api/layouting/linear-layout.h>
29 #include <dali-toolkit/devel-api/layouting/layout-item-impl.h>
30 #include <dali-toolkit/devel-api/layouting/layout-group-impl.h>
31
32 #include <../custom-layout.h>
33 #include <dummy-control.h>
34
35 #include <layout-utils.h>
36
37 using namespace Dali;
38 using namespace Toolkit;
39
40 void utc_dali_toolkit_layouting_animation_startup(void)
41 {
42   test_return_value = TET_UNDEF;
43 }
44
45 void utc_dali_toolkit_layouting_animation_cleanup(void)
46 {
47   test_return_value = TET_PASS;
48 }
49
50 namespace
51 {
52
53 // Functor to test whether a Finish signal is emitted
54 struct LayoutTransitionFinishCheck
55 {
56   LayoutTransitionFinishCheck( bool& signalReceived )
57   : mSignalReceived( signalReceived )
58   {
59   }
60
61   void operator()( LayoutTransitionData::Type type, LayoutTransitionData& layoutTransitionData )
62   {
63     mSignalReceived = true;
64   }
65
66   void Reset()
67   {
68     mSignalReceived = false;
69   }
70
71   void CheckSignalReceived()
72   {
73     if (!mSignalReceived)
74     {
75       tet_printf("Expected Finish signal was not received\n");
76       tet_result(TET_FAIL);
77     }
78     else
79     {
80       tet_result(TET_PASS);
81     }
82   }
83
84   void CheckSignalNotReceived()
85   {
86     if (mSignalReceived)
87     {
88       tet_printf("Unexpected Finish signal was received\n");
89       tet_result(TET_FAIL);
90     }
91     else
92     {
93       tet_result(TET_PASS);
94     }
95   }
96
97   bool& mSignalReceived; // owned by individual tests
98 };
99
100 } // anon namespace
101
102 int UtcDaliLayouting_LayoutTransitionDataConstructorP(void)
103 {
104   TestApplication application;
105
106   LayoutTransitionData layoutTransitionData;
107
108   DALI_TEST_CHECK( !layoutTransitionData );
109   END_TEST;
110 }
111
112 int UtcDaliLayouting_LayoutTransitionDataNewP(void)
113 {
114   TestApplication application;
115
116   LayoutTransitionData layoutTransitionData = LayoutTransitionData::New();
117
118   DALI_TEST_CHECK(layoutTransitionData);
119   END_TEST;
120 }
121
122 int UtcDaliLayouting_LayoutTransitionDataDownCastP(void)
123 {
124   TestApplication application;
125
126   LayoutTransitionData layoutTransitionData = LayoutTransitionData::New();
127   BaseHandle object(layoutTransitionData);
128
129   LayoutTransitionData layoutTransitionData2 = LayoutTransitionData::DownCast(object);
130   DALI_TEST_CHECK(layoutTransitionData2);
131
132   LayoutTransitionData layoutTransitionData3 = DownCast< LayoutTransitionData >(object);
133   DALI_TEST_CHECK(layoutTransitionData2);
134   END_TEST;
135 }
136
137 int UtcDaliLayouting_LayoutTransitionDataDownCastN(void)
138 {
139   TestApplication application;
140
141   BaseHandle unInitializedObject;
142
143   LayoutTransitionData layoutTransitionData1 = LayoutTransitionData::DownCast( unInitializedObject );
144   DALI_TEST_CHECK( !layoutTransitionData1 );
145
146   LayoutTransitionData layoutTransitionData2 = DownCast< LayoutTransitionData >( unInitializedObject );
147   DALI_TEST_CHECK( !layoutTransitionData2 );
148   END_TEST;
149 }
150
151 int UtcDaliLayouting_LayoutTransitionDataSetGetTransition(void)
152 {
153   TestApplication application;
154
155   auto layout = LinearLayout::New();
156   auto layoutTransitionData = LayoutTransitionData::New();
157
158   layout.SetTransitionData( LayoutTransitionData::ON_CHILD_ADD, layoutTransitionData );
159   DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_ADD ) == layoutTransitionData );
160   DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_REMOVE ) == LayoutTransitionData() );
161   DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS ) == LayoutTransitionData() );
162   DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_OWNER_SET ) == LayoutTransitionData() );
163   DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_LAYOUT_CHANGE ) == LayoutTransitionData() );
164
165   layout.SetTransitionData( LayoutTransitionData::ON_CHILD_ADD, LayoutTransitionData() );
166   layout.SetTransitionData( LayoutTransitionData::ON_CHILD_REMOVE, layoutTransitionData );
167   DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_ADD ) == LayoutTransitionData() );
168   DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_REMOVE ) == layoutTransitionData );
169   DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS ) == LayoutTransitionData() );
170   DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_OWNER_SET ) == LayoutTransitionData() );
171   DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_LAYOUT_CHANGE ) == LayoutTransitionData() );
172
173   layout.SetTransitionData( LayoutTransitionData::ON_CHILD_REMOVE, LayoutTransitionData() );
174   layout.SetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS, layoutTransitionData );
175   DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_ADD ) == LayoutTransitionData() );
176   DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_REMOVE ) == LayoutTransitionData() );
177   DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS ) == layoutTransitionData );
178   DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_OWNER_SET ) == LayoutTransitionData() );
179   DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_LAYOUT_CHANGE ) == LayoutTransitionData() );
180
181   layout.SetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS, LayoutTransitionData() );
182   layout.SetTransitionData( LayoutTransitionData::ON_OWNER_SET, layoutTransitionData );
183   DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_ADD ) == LayoutTransitionData() );
184   DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_REMOVE ) == LayoutTransitionData() );
185   DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS ) == LayoutTransitionData() );
186   DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_OWNER_SET ) == layoutTransitionData );
187   DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_LAYOUT_CHANGE ) == LayoutTransitionData() );
188
189   layout.SetTransitionData( LayoutTransitionData::ON_OWNER_SET, LayoutTransitionData() );
190   layout.SetTransitionData( LayoutTransitionData::ON_LAYOUT_CHANGE, layoutTransitionData );
191   DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_ADD ) == LayoutTransitionData() );
192   DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_REMOVE ) == LayoutTransitionData() );
193   DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS ) == LayoutTransitionData() );
194   DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_OWNER_SET ) == LayoutTransitionData() );
195   DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_LAYOUT_CHANGE ) == layoutTransitionData );
196
197   END_TEST;
198 }
199
200 int UtcDaliLayouting_SetLayoutTransition01(void)
201 {
202   ToolkitTestApplication application;
203   tet_infoline(" UtcDaliLayouting_SetLayoutTransition01" );
204
205   Stage stage = Stage::GetCurrent();
206   auto container = Control::New();
207   auto horizontalLayout = LinearLayout::New();
208   horizontalLayout.SetAnimateLayout( false );
209   horizontalLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
210
211   auto verticalLayout = LinearLayout::New();
212   verticalLayout.SetAnimateLayout( false );
213   verticalLayout.SetOrientation( LinearLayout::Orientation::VERTICAL );
214
215   DevelControl::SetLayout( container, horizontalLayout );
216   container.SetName( "Container");
217
218   std::vector< Control > controls;
219   controls.push_back( CreateLeafControl( 100, 100 ) );
220   controls.push_back( CreateLeafControl( 100, 100 ) );
221   for( auto&& iter : controls )
222   {
223     container.Add( iter );
224   }
225   stage.Add( container );
226
227   auto layoutTransitionData = LayoutTransitionData::New();
228   {
229     // Instant resize for parent
230     Property::Map map;
231     map["property"] = "size";
232     map["targetValue"] = Property::Value(); // capture from layout update
233     map["animator"] = Property::Map()
234       .Add("alphaFunction", "LINEAR")
235       .Add("timePeriod", Property::Map()
236         .Add("delay", 0.0f)
237         .Add("duration", 0.0f));
238     layoutTransitionData.AddPropertyAnimator( container, map );
239   }
240   {
241     Property::Map map;
242     map["property"] = "opacity";
243     map["initialValue"] = 0.0f;
244     map["targetValue"] = 1.0f;
245     map["animator"] = Property::Map()
246       .Add("alphaFunction", "LINEAR")
247       .Add("timePeriod", Property::Map()
248         .Add("delay", 0.0f)
249         .Add("duration", 0.5f));
250     layoutTransitionData.AddPropertyAnimator( container, map );
251   }
252   {
253     // Instant position for children
254     Property::Map map;
255     map["property"] = "position";
256     map["animator"] = Property::Map()
257        .Add("alphaFunction", "LINEAR")
258        .Add("timePeriod", Property::Map()
259          .Add("delay", 0.0f)
260          .Add("duration", 0.0f));
261     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
262   }
263   {
264     // Grow children from (0,0) size to full size (captured)
265     Property::Map map;
266     map["property"] = "size";
267     map["initialValue"] = Vector3( 0.0f, 0.0f, 0 );
268     map["animator"] = Property::Map()
269       .Add("alphaFunction", "LINEAR")
270       .Add("timePeriod", Property::Map()
271         .Add("delay", 0.0f)
272         .Add("duration", 0.5f));
273     layoutTransitionData.AddPropertyAnimator( Actor(), map );
274   }
275
276   // Ensure layouting happens
277   application.SendNotification();
278   application.Render();
279
280   // First round, no animation
281   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
282   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
283   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
284
285   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
286   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
287   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
288
289   bool signalReceived(false);
290   LayoutTransitionFinishCheck finishCheck(signalReceived);
291   layoutTransitionData.FinishedSignal().Connect(&application, finishCheck);
292
293   horizontalLayout.SetAnimateLayout( true );
294   verticalLayout.SetAnimateLayout( true );
295
296   // Change a layout, start transition
297   verticalLayout.SetTransitionData( LayoutTransitionData::ON_OWNER_SET, layoutTransitionData );
298   DevelControl::SetLayout( container, verticalLayout );
299
300   application.SendNotification();
301   application.Render( 1u /*just very beginning of the animation*/ );
302
303   finishCheck.CheckSignalNotReceived();
304   // Second round, animation just started
305   DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
306   DALI_TEST_EQUALS( container.GetCurrentOpacity(), 0.0f, 0.1f, TEST_LOCATION );
307   DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 300.0f, 0.0f ), 0.0001f, TEST_LOCATION );
308   DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 0.0f, 400.0f, 0.0f ), 0.0001f, TEST_LOCATION );
309
310   DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
311   DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 0.0f, 0.0f, 0.0f ), 1.0f, TEST_LOCATION );
312   DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 0.0f, 0.0f, 0.0f ), 1.0f, TEST_LOCATION );
313
314   application.SendNotification();
315   application.Render(static_cast<unsigned int>( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ );
316
317   // Third round, animation just finished
318   DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
319   DALI_TEST_EQUALS( container.GetCurrentOpacity(), 1.0f, 0.0001f, TEST_LOCATION );
320   DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 300.0f, 0.0f ), 0.0001f, TEST_LOCATION );
321   DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 0.0f, 400.0f, 0.0f ), 0.0001f, TEST_LOCATION );
322
323   DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
324   DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
325   DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
326
327   application.SendNotification();
328   application.Render( 10u /* wait a bit more for a signal */ );
329
330   finishCheck.CheckSignalReceived();
331
332   // Now sizes and positions are finally set
333   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
334   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 300.0f, 0.0f ), 0.0001f, TEST_LOCATION );
335   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 400.0f, 0.0f ), 0.0001f, TEST_LOCATION );
336
337   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
338   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
339   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
340
341   // Transition back now with default transition
342   DevelControl::SetLayout( container, horizontalLayout );
343
344   application.SendNotification();
345   application.Render( 1u /*just very beginning of the animation*/ );
346
347   DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
348   DALI_TEST_EQUALS( container.GetCurrentOpacity(), 1.0f, 0.0001f, TEST_LOCATION );
349   DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 300.0f, 0.0f ), 1.0f, TEST_LOCATION );
350   DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 0.0f, 400.0f, 0.0f ), 1.0f, TEST_LOCATION );
351
352   DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
353   DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
354   DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
355
356   application.SendNotification();
357   application.Render(static_cast<unsigned int>( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ );
358
359   DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
360   DALI_TEST_EQUALS( container.GetCurrentOpacity(), 1.0f, 0.0001f, TEST_LOCATION );
361   DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
362   DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
363
364   DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
365   DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
366   DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
367
368   application.SendNotification();
369   application.Render( 10u /* wait a bit more for complete default animation */ );
370
371   // Now sizes and positions are finally set
372   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
373   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
374   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
375
376   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
377   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
378   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
379
380   END_TEST;
381 }
382
383 int UtcDaliLayouting_AddChildLayoutTransition01(void)
384 {
385   ToolkitTestApplication application;
386   tet_infoline(" UtcDaliLayouting_AddChildLayoutTransition01" );
387
388   Stage stage = Stage::GetCurrent();
389   auto container = Control::New();
390   auto horizontalLayout = LinearLayout::New();
391   horizontalLayout.SetAnimateLayout( true );
392   horizontalLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
393
394   DevelControl::SetLayout( container, horizontalLayout );
395   container.SetName( "Container");
396
397   std::vector< Control > controls;
398   controls.push_back( CreateLeafControl( 100, 100 ) );
399   stage.Add( container );
400
401   auto layoutTransitionData = LayoutTransitionData::New();
402   {
403     // Instant resize for parent
404     Property::Map map;
405     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = "size";
406     map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update
407     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
408       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR" )
409       .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
410         .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
411         .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
412     layoutTransitionData.AddPropertyAnimator( container, map );
413   }
414   {
415     // Instant position for a child
416     Property::Map map;
417     map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::NONE;
418     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = "position";
419     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
420        .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR")
421        .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
422          .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
423          .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
424     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
425   }
426   {
427     // Grow a child from (0,0) size to full size (captured)
428     Property::Map map;
429     map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_ADD;
430     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = "size";
431     map[ LayoutTransitionData::AnimatorKey::INITIAL_VALUE ] = Vector3( 0.0f, 0.0f, 0 );
432     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
433       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR")
434       .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
435         .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
436         .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
437     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to an added child
438   }
439
440   horizontalLayout.SetTransitionData( LayoutTransitionData::ON_CHILD_ADD, layoutTransitionData );
441   container.Add( controls[0] );
442
443   bool signalReceived(false);
444   LayoutTransitionFinishCheck finishCheck(signalReceived);
445   layoutTransitionData.FinishedSignal().Connect(&application, finishCheck);
446
447   application.SendNotification();
448   application.Render( 1u /*just very beginning of the animation*/ );
449
450   finishCheck.CheckSignalNotReceived();
451   // The animation just started
452   DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
453   DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
454
455   application.SendNotification();
456   application.Render(static_cast<unsigned int>( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ );
457
458   // The animation just finished
459   DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
460   DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
461
462   DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
463   DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
464
465   application.SendNotification();
466   application.Render( 10u /* wait a bit more for a signal */ );
467
468   // Now sizes and positions are finally set
469   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
470   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
471
472   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
473   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
474
475   finishCheck.CheckSignalReceived();
476
477   END_TEST;
478 }
479
480 int UtcDaliLayouting_RemoveChildLayoutTransition01(void)
481 {
482   ToolkitTestApplication application;
483   tet_infoline(" UtcDaliLayouting_RemoveChildLayoutTransition01" );
484
485   Stage stage = Stage::GetCurrent();
486   auto container = Control::New();
487   auto horizontalLayout = LinearLayout::New();
488   horizontalLayout.SetAnimateLayout( false );
489   horizontalLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
490
491   DevelControl::SetLayout( container, horizontalLayout );
492   container.SetName( "Container" );
493
494   std::vector< Control > controls;
495   controls.push_back( CreateLeafControl( 100, 100 ) );
496   controls.push_back( CreateLeafControl( 100, 100 ) );
497
498   stage.Add( container );
499   container.Add( controls[0] );
500   container.Add( controls[1] );
501
502   // Initial rendering done
503   application.SendNotification();
504   application.Render();
505
506   horizontalLayout.SetAnimateLayout( true );
507
508   auto layoutTransitionData = LayoutTransitionData::New();
509   {
510     // Instant resize for parent width
511     Property::Map map;
512     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE_WIDTH;
513     map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update
514     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
515       .Add( LayoutTransitionData::AnimatorKey::TYPE, "ANIMATE_TO" )
516       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR" )
517       .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
518         .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
519         .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
520     layoutTransitionData.AddPropertyAnimator( container, map );
521   }
522   {
523     // Instant resize for parent height
524     Property::Map map;
525     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE_HEIGHT;
526     map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update
527     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
528       .Add( LayoutTransitionData::AnimatorKey::TYPE, "ANIMATE_TO" )
529       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR" )
530       .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
531         .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
532         .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
533     layoutTransitionData.AddPropertyAnimator( container, map );
534   }
535   {
536     // Instant position for parent X position
537     Property::Map map;
538     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION_X;
539     map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update
540     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
541       .Add( LayoutTransitionData::AnimatorKey::TYPE, "ANIMATE_TO" )
542       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR" )
543       .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
544         .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
545         .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
546     layoutTransitionData.AddPropertyAnimator( container, map );
547   }
548   {
549     // Instant position for parent Y position
550     Property::Map map;
551     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION_Y;
552     map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update
553     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
554       .Add( LayoutTransitionData::AnimatorKey::TYPE, "ANIMATE_TO" )
555       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR" )
556       .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
557         .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
558         .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
559     layoutTransitionData.AddPropertyAnimator( container, map );
560   }
561   {
562     // Shrink the children
563     Property::Map map;
564     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE_WIDTH;
565     map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = 0.0f;
566     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
567       .Add( LayoutTransitionData::AnimatorKey::TYPE, "ANIMATE_TO" )
568       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR")
569       .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
570         .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
571         .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
572     layoutTransitionData.AddPropertyAnimator( Actor(), map );
573   }
574   {
575     // Shrink the children
576     Property::Map map;
577     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE_HEIGHT;
578     map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = 0.0f;
579     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
580       .Add( LayoutTransitionData::AnimatorKey::TYPE, "ANIMATE_TO" )
581       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR")
582       .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
583         .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
584         .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
585     layoutTransitionData.AddPropertyAnimator( Actor(), map );
586   }
587   {
588     // Shrink the removed child
589     Property::Map map;
590     map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_REMOVE;
591     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE;
592     map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Size( 0.0f, 0.0f );
593     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
594       .Add( LayoutTransitionData::AnimatorKey::TYPE, "ANIMATE_TO" )
595       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR")
596       .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
597         .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
598         .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
599     layoutTransitionData.AddPropertyAnimator( Actor(), map );
600   }
601   {
602     // Instant position for children
603     Property::Map map;
604     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION_X;
605     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
606       .Add( LayoutTransitionData::AnimatorKey::TYPE, "ANIMATE_TO" )
607       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR")
608       .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
609         .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
610         .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
611     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
612   }
613   {
614     // Instant position for children
615     Property::Map map;
616     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION_Y;
617     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
618       .Add( LayoutTransitionData::AnimatorKey::TYPE, "ANIMATE_TO" )
619       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR")
620       .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
621         .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
622         .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
623     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
624   }
625
626   horizontalLayout.SetTransitionData( LayoutTransitionData::ON_CHILD_REMOVE, layoutTransitionData );
627   container.Remove( controls[1] );
628
629   bool signalReceived(false);
630   LayoutTransitionFinishCheck finishCheck(signalReceived);
631   layoutTransitionData.FinishedSignal().Connect(&application, finishCheck);
632
633   application.SendNotification();
634   application.Render( 1u /*just very beginning of the animation*/ );
635
636   finishCheck.CheckSignalNotReceived();
637   // Animation just started
638   DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
639   DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
640   DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
641
642   DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
643   DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION );
644   // this control is already removed from the tree.
645   DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
646
647   application.SendNotification();
648   application.Render(static_cast<unsigned int>( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ );
649
650   // Animation just finished
651   DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
652   DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
653   // this control is already removed from the tree.
654   DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 100.0f, 350.0f, 0.0f ), 1.0f, TEST_LOCATION );
655
656   DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
657   DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 0.0f, 0.0f, 0.0f ), 1.0f, TEST_LOCATION );
658   // this control is already removed from the tree.
659   DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
660
661   application.SendNotification();
662   application.Render( 10u /* wait a bit more for a signal */ );
663
664   // Now sizes and positions are finally set
665   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
666   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
667   // this control is already removed from the tree.
668   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 350.0f, 0.0f ), 1.0f, TEST_LOCATION );
669
670   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
671   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
672   // this control is already removed from the tree.
673   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION );
674
675   finishCheck.CheckSignalReceived();
676
677   END_TEST;
678 }
679
680 int UtcDaliLayouting_FocusChildLayoutTransition01(void)
681 {
682   ToolkitTestApplication application;
683   tet_infoline(" UtcDaliLayouting_FocusChildLayoutTransition01" );
684
685   Stage stage = Stage::GetCurrent();
686   auto container = Control::New();
687   auto horizontalLayout = LinearLayout::New();
688   horizontalLayout.SetAnimateLayout( false );
689   horizontalLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
690
691   DevelControl::SetLayout( container, horizontalLayout );
692   container.SetName( "Container" );
693
694   std::vector< Control > controls;
695   controls.push_back( CreateLeafControl( 100, 100 ) );
696   controls.push_back( CreateLeafControl( 100, 100 ) );
697
698   stage.Add( container );
699   container.Add( controls[0] );
700   container.Add( controls[1] );
701
702   KeyInputFocusManager manager = KeyInputFocusManager::Get();
703   manager.SetFocus( controls[0] );
704
705   // Initial rendering done
706   application.SendNotification();
707   application.Render();
708
709   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
710   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
711   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
712
713   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
714   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
715   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
716
717   horizontalLayout.SetAnimateLayout( true );
718
719   auto layoutTransitionData = LayoutTransitionData::New();
720   {
721     // Instant resize for parent
722     Property::Map map;
723     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE;
724     map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update
725     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
726       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR" )
727       .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
728         .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
729         .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
730     layoutTransitionData.AddPropertyAnimator( container, map );
731   }
732   {
733     // Instant position for parent
734     Property::Map map;
735     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION;
736     map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update
737     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
738        .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR" )
739        .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
740          .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
741          .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
742     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
743   }
744   {
745     // Shrink the lost focus child
746     Property::Map map;
747     map[ "affectsSiblings" ] = false;
748     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE;
749     map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_FOCUS_LOST;
750     map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Vector3( 80.0f, 80.0f, 0 );
751     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
752          .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR" )
753          .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
754            .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
755            .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
756     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to on focus lost child
757   }
758   {
759     // Grow the gained focus child
760     Property::Map map;
761     map[ "affectsSiblings" ] = false;
762     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE;
763     map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_FOCUS_GAINED;
764     map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Vector3( 120.0f, 120.0f, 0 );
765     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
766          .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR")
767          .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
768            .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
769            .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
770     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to on focus gained child
771   }
772
773   horizontalLayout.SetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS, layoutTransitionData );
774
775   bool signalReceived(false);
776   LayoutTransitionFinishCheck finishCheck(signalReceived);
777   layoutTransitionData.FinishedSignal().Connect(&application, finishCheck);
778   manager.SetFocus( controls[1] );
779
780   application.SendNotification();
781   application.Render( 1u /*just very beginning of the animation*/ );
782
783   finishCheck.CheckSignalNotReceived();
784   // Animation just started
785   DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
786   DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
787   DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
788
789   DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
790   DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION );
791   DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION );
792
793   application.SendNotification();
794   application.Render(static_cast<unsigned int>( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ );
795
796   // Animation just finished
797   DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
798   DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
799   DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
800
801   DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
802   DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 80.0f, 80.0f, 0.0f ), 1.0f, TEST_LOCATION );
803   DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 120.0f, 120.0f, 0.0f ), 1.0f, TEST_LOCATION );
804
805   application.SendNotification();
806   application.Render( 10u /* wait a bit more for a signal */ );
807
808   // Now sizes and positions are finally set
809   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
810   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
811   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
812
813   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
814   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION );
815   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 120.0f, 120.0f, 0.0f ), 0.0001f, TEST_LOCATION );
816
817   finishCheck.CheckSignalReceived();
818
819   END_TEST;
820 }
821
822 int UtcDaliLayouting_FocusChildLayoutTransition02(void)
823 {
824   ToolkitTestApplication application;
825   tet_infoline(" UtcDaliLayouting_FocusChildLayoutTransition02" );
826
827   Stage stage = Stage::GetCurrent();
828   auto container = Control::New();
829   auto horizontalLayout = LinearLayout::New();
830   horizontalLayout.SetAnimateLayout( false );
831   horizontalLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
832
833   DevelControl::SetLayout( container, horizontalLayout );
834   container.SetName( "Container" );
835
836   std::vector< Control > controls;
837   controls.push_back( CreateLeafControl( 100, 100 ) );
838   controls.push_back( CreateLeafControl( 100, 100 ) );
839
840   stage.Add( container );
841   container.Add( controls[0] );
842   container.Add( controls[1] );
843
844   KeyInputFocusManager manager = KeyInputFocusManager::Get();
845   manager.SetFocus( controls[0] );
846
847   // Initial rendering done
848   application.SendNotification();
849   application.Render();
850
851   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
852   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
853   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
854
855   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
856   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
857   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
858
859   horizontalLayout.SetAnimateLayout( true );
860
861   auto layoutTransitionData = LayoutTransitionData::New();
862   {
863     // Shrink the lost focus child width
864     Property::Map map;
865     map[ LayoutTransitionData::AnimatorKey::AFFECTS_SIBLINGS ] = false;
866     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION;
867     map[ LayoutTransitionData::AnimatorKey::TYPE ] = LayoutTransitionData::Animator::ANIMATE_TO;
868     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
869          .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR )
870          .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
871            .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
872            .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
873     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // move all children
874   }
875   {
876     // Shrink the lost focus child width
877     Property::Map map;
878     map[ LayoutTransitionData::AnimatorKey::AFFECTS_SIBLINGS ] = true;
879     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE_WIDTH;
880     map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_FOCUS_LOST;
881     map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = 80.0f;
882     map[ LayoutTransitionData::AnimatorKey::TYPE ] = LayoutTransitionData::Animator::ANIMATE_TO;
883     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
884          .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR )
885          .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
886            .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
887            .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
888     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to on focus lost child
889   }
890   {
891     // Shrink the lost focus child height
892     Property::Map map;
893     map[ LayoutTransitionData::AnimatorKey::AFFECTS_SIBLINGS ] = true;
894     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE_HEIGHT;
895     map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_FOCUS_LOST;
896     map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = 80.0f;
897     map[ LayoutTransitionData::AnimatorKey::TYPE ] = LayoutTransitionData::Animator::ANIMATE_TO;
898     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
899          .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR )
900          .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
901            .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
902            .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
903     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to on focus lost child
904   }
905   {
906     // Grow the gained focus child
907     Property::Map map;
908     map[ LayoutTransitionData::AnimatorKey::AFFECTS_SIBLINGS ] = true;
909     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE;
910     map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_FOCUS_GAINED;
911     map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Vector3( 120.0f, 120.0f, 0 );
912     map[ LayoutTransitionData::AnimatorKey::TYPE ] = LayoutTransitionData::Animator::ANIMATE_TO;
913     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
914          .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR )
915          .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
916            .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
917            .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
918     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to on focus gained child
919   }
920
921   horizontalLayout.SetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS, layoutTransitionData );
922
923   bool signalReceived(false);
924   LayoutTransitionFinishCheck finishCheck(signalReceived);
925   layoutTransitionData.FinishedSignal().Connect(&application, finishCheck);
926   manager.SetFocus( controls[1] );
927
928   application.SendNotification();
929   application.Render( 1u /*just very beginning of the animation*/ );
930
931   finishCheck.CheckSignalNotReceived();
932   // Animation just started
933   DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
934   DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 1.0f, TEST_LOCATION );
935   DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 100.0f, 350.0f, 0.0f ), 1.0f, TEST_LOCATION );
936
937   DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
938   DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION );
939   DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION );
940
941   application.SendNotification();
942   application.Render(static_cast<unsigned int>( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ );
943
944   // Animation just finished
945   DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
946   DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 360.0f, 0.0f ), 0.0001f, TEST_LOCATION );
947   DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 80.0f, 340.0f, 0.0f ), 0.0001f, TEST_LOCATION );
948
949   DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
950   DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 80.0f, 80.0f, 0.0f ), 1.0f, TEST_LOCATION );
951   DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 120.0f, 120.0f, 0.0f ), 1.0f, TEST_LOCATION );
952
953   application.SendNotification();
954   application.Render( 10u /* wait a bit more for a signal */ );
955
956   // Now sizes and positions are finally set
957   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
958   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 360.0f, 0.0f ), 0.0001f, TEST_LOCATION );
959   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 80.0f, 340.0f, 0.0f ), 0.0001f, TEST_LOCATION );
960
961   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
962   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION );
963   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 120.0f, 120.0f, 0.0f ), 0.0001f, TEST_LOCATION );
964
965   finishCheck.CheckSignalReceived();
966
967   END_TEST;
968 }
969
970 int UtcDaliLayouting_FocusChildLayoutTransition03(void)
971 {
972   ToolkitTestApplication application;
973   tet_infoline(" UtcDaliLayouting_FocusChildLayoutTransition03" );
974
975   Stage stage = Stage::GetCurrent();
976   auto container = Control::New();
977   auto horizontalLayout = LinearLayout::New();
978   horizontalLayout.SetAnimateLayout( false );
979   horizontalLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
980
981   DevelControl::SetLayout( container, horizontalLayout );
982   container.SetName( "Container" );
983
984   std::vector< Control > controls;
985   controls.push_back( CreateLeafControl( 100, 100 ) );
986   controls.push_back( CreateLeafControl( 100, 100 ) );
987
988   stage.Add( container );
989   container.Add( controls[0] );
990   container.Add( controls[1] );
991
992   KeyInputFocusManager manager = KeyInputFocusManager::Get();
993   manager.SetFocus( controls[0] );
994
995   // Initial rendering done
996   application.SendNotification();
997   application.Render();
998
999   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1000   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1001   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1002
1003   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1004   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1005   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1006
1007   horizontalLayout.SetAnimateLayout( true );
1008
1009   auto layoutTransitionData = LayoutTransitionData::New();
1010   {
1011     // Shrink the lost focus child width
1012     Property::Map map;
1013     map[ LayoutTransitionData::AnimatorKey::AFFECTS_SIBLINGS ] = false;
1014     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION;
1015     map[ LayoutTransitionData::AnimatorKey::TYPE ] = LayoutTransitionData::Animator::ANIMATE_TO;
1016     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1017          .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR )
1018          .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
1019            .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
1020            .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
1021     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // move all children
1022   }
1023   {
1024     // Shrink the lost focus child width
1025     Property::Map map;
1026     map[ LayoutTransitionData::AnimatorKey::AFFECTS_SIBLINGS ] = true;
1027     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SCALE_X;
1028     map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_FOCUS_LOST;
1029     map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = 0.8f;
1030     map[ LayoutTransitionData::AnimatorKey::TYPE ] = LayoutTransitionData::Animator::ANIMATE_TO;
1031     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1032          .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR )
1033          .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
1034            .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
1035            .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
1036     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to on focus lost child
1037   }
1038   {
1039     // Shrink the lost focus child height
1040     Property::Map map;
1041     map[ LayoutTransitionData::AnimatorKey::AFFECTS_SIBLINGS ] = true;
1042     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SCALE_Y;
1043     map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_FOCUS_LOST;
1044     map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = 0.8f;
1045     map[ LayoutTransitionData::AnimatorKey::TYPE ] = LayoutTransitionData::Animator::ANIMATE_TO;
1046     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1047          .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR )
1048          .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
1049            .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
1050            .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
1051     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to on focus lost child
1052   }
1053   {
1054     // Grow the gained focus child
1055     Property::Map map;
1056     map[ LayoutTransitionData::AnimatorKey::AFFECTS_SIBLINGS ] = true;
1057     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SCALE;
1058     map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_FOCUS_GAINED;
1059     map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Vector3( 1.2f, 1.2f, 1.0f );
1060     map[ LayoutTransitionData::AnimatorKey::TYPE ] = LayoutTransitionData::Animator::ANIMATE_TO;
1061     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1062          .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR )
1063          .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
1064            .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
1065            .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
1066     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to on focus gained child
1067   }
1068
1069   horizontalLayout.SetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS, layoutTransitionData );
1070
1071   bool signalReceived(false);
1072   LayoutTransitionFinishCheck finishCheck(signalReceived);
1073   layoutTransitionData.FinishedSignal().Connect(&application, finishCheck);
1074   manager.SetFocus( controls[1] );
1075
1076   application.SendNotification();
1077   application.Render( 1u /*just very beginning of the animation*/ );
1078
1079   finishCheck.CheckSignalNotReceived();
1080   // Animation just started
1081   DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1082   DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 1.0f, TEST_LOCATION );
1083   DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 100.0f, 350.0f, 0.0f ), 1.0f, TEST_LOCATION );
1084
1085   DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1086   DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION );
1087   DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION );
1088
1089   application.SendNotification();
1090   application.Render(static_cast<unsigned int>( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ );
1091
1092   // Animation just finished
1093   DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1094   DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( -10.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1095   DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 90.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1096
1097   DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1098   DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1099   DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1100   DALI_TEST_EQUALS( controls[0].GetCurrentSize() * controls[0].GetCurrentScale(), Vector3( 80.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1101   DALI_TEST_EQUALS( controls[1].GetCurrentSize() * controls[1].GetCurrentScale(), Vector3( 120.0f, 120.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1102
1103   application.SendNotification();
1104   application.Render( 10u /* wait a bit more for a signal */ );
1105
1106   // Now sizes and positions are finally set
1107   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1108   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( -10.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1109   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 90.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1110
1111   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1112   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1113   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1114   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ) * controls[0].GetProperty<Vector3>( Actor::Property::SCALE ), Vector3( 80.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1115   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ) * controls[1].GetProperty<Vector3>( Actor::Property::SCALE ), Vector3( 120.0f, 120.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1116
1117   finishCheck.CheckSignalReceived();
1118
1119   END_TEST;
1120 }
1121
1122 int UtcDaliLayouting_AddChildLayoutTransition02_KeyFrames(void)
1123 {
1124   ToolkitTestApplication application;
1125   tet_infoline(" UtcDaliLayouting_AddChildLayoutTransition02_KeyFrames" );
1126
1127   Stage stage = Stage::GetCurrent();
1128   auto container = Control::New();
1129   auto horizontalLayout = LinearLayout::New();
1130   horizontalLayout.SetAnimateLayout( true );
1131   horizontalLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
1132
1133   DevelControl::SetLayout( container, horizontalLayout );
1134   container.SetName( "Container");
1135
1136   std::vector< Control > controls;
1137   controls.push_back( CreateLeafControl( 100, 100 ) );
1138   stage.Add( container );
1139
1140   auto layoutTransitionData = LayoutTransitionData::New();
1141   {
1142     // Instant resize for parent
1143     Property::Map map;
1144     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE;
1145     map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update
1146     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1147       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR" )
1148       .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
1149         .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
1150         .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
1151     layoutTransitionData.AddPropertyAnimator( container, map );
1152   }
1153   {
1154     // Instant position for a child
1155     Property::Map map;
1156     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION;
1157     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1158        .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR")
1159        .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
1160          .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
1161          .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
1162     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
1163   }
1164   {
1165     // Grow a child from (0,0) size to full size with key frames
1166     KeyFrames keyFrames = KeyFrames::New();
1167     keyFrames.Add( 0.0f, Vector3( 0.0f, 0.0f, 0 ) );
1168     keyFrames.Add( 0.5f, Vector3( 100.0f, 100.0f, 0 ) );
1169
1170     Property::Map map;
1171     map[ "property" ] = Actor::Property::SIZE;
1172     map[ "condition" ] = LayoutTransitionData::Condition::ON_ADD;
1173     map[ "animator" ] = Property::Map()
1174       .Add( "type", "ANIMATE_BETWEEN")
1175       .Add( "alphaFunction", "LINEAR")
1176       .Add( "timePeriod", Property::Map()
1177         .Add( "delay", 0.0f)
1178         .Add( "duration", 0.5f));
1179     layoutTransitionData.AddPropertyAnimator( Actor(), map, keyFrames, Animation::Interpolation::Linear );
1180   }
1181
1182   horizontalLayout.SetTransitionData( LayoutTransitionData::ON_CHILD_ADD, layoutTransitionData );
1183   container.Add( controls[0] );
1184
1185   bool signalReceived(false);
1186   LayoutTransitionFinishCheck finishCheck(signalReceived);
1187   layoutTransitionData.FinishedSignal().Connect(&application, finishCheck);
1188
1189   application.SendNotification();
1190   application.Render( 1u /*just very beginning of the animation*/ );
1191
1192   finishCheck.CheckSignalNotReceived();
1193   // The animation just started
1194   DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1195   DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1196
1197   application.SendNotification();
1198   application.Render(static_cast<unsigned int>( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ );
1199
1200   // The animation just finished
1201   DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1202   DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1203
1204   DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1205   DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1206
1207   application.SendNotification();
1208   application.Render( 10u /* wait a bit more for a signal */ );
1209
1210   // Now sizes and positions are finally set
1211   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1212   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1213
1214   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1215   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1216
1217   finishCheck.CheckSignalReceived();
1218
1219   END_TEST;
1220 }
1221
1222 int UtcDaliLayouting_AddChildLayoutTransition03_Path(void)
1223 {
1224   ToolkitTestApplication application;
1225   tet_infoline(" UtcDaliLayouting_AddChildLayoutTransition03_Path" );
1226
1227   Stage stage = Stage::GetCurrent();
1228   auto container = Control::New();
1229   auto horizontalLayout = LinearLayout::New();
1230   horizontalLayout.SetAnimateLayout( true );
1231   horizontalLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
1232
1233   DevelControl::SetLayout( container, horizontalLayout );
1234   container.SetName( "Container");
1235
1236   std::vector< Control > controls;
1237   controls.push_back( CreateLeafControl( 100, 100 ) );
1238   stage.Add( container );
1239
1240   auto layoutTransitionData = LayoutTransitionData::New();
1241   {
1242     // Instant resize for parent
1243     Property::Map map;
1244     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE;
1245     map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update
1246     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1247       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR" )
1248       .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
1249         .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
1250         .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
1251     layoutTransitionData.AddPropertyAnimator( container, map );
1252   }
1253
1254   Dali::Path path = Dali::Path::New();
1255   {
1256     // Curve position for a child
1257     Property::Map map;
1258     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION;
1259     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1260        .Add( LayoutTransitionData::AnimatorKey::TYPE, "ANIMATE_PATH")
1261        .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR")
1262        .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
1263          .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
1264          .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f ) );
1265
1266     // Build the path
1267     Vector3 position0( 30.0,  80.0,  0.0 );
1268     Vector3 position1( 70.0,  120.0, 0.0 );
1269     Vector3 position2( 0.0, 350.0, 0.0 );
1270
1271     //Dali::Path path = Dali::Path::New();
1272     path.AddPoint( position0 );
1273     path.AddPoint( position1 );
1274     path.AddPoint( position2 );
1275
1276     // Control points for first segment
1277     path.AddControlPoint( Vector3( 39.0,  90.0, 0.0 ) );
1278     path.AddControlPoint( Vector3( 56.0, 119.0, 0.0 ) );
1279
1280     // Control points for second segment
1281     path.AddControlPoint( Vector3( 78.0, 120.0, 0.0 ) );
1282     path.AddControlPoint( Vector3( 93.0, 104.0, 0.0 ) );
1283
1284     layoutTransitionData.AddPropertyAnimator( controls[0], map, path, Vector3::XAXIS );
1285   }
1286   {
1287     // Grow a child from (0,0) size to full size (captured)
1288     Property::Map map;
1289     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = "size";
1290     map[ LayoutTransitionData::AnimatorKey::INITIAL_VALUE ] = Vector3( 0.0f, 0.0f, 0 );
1291     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1292       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR")
1293       .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
1294         .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
1295         .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
1296     layoutTransitionData.AddPropertyAnimator( controls[0], map );
1297   }
1298
1299   horizontalLayout.SetTransitionData( LayoutTransitionData::ON_CHILD_ADD, layoutTransitionData );
1300   container.Add( controls[0] );
1301
1302   bool signalReceived(false);
1303   LayoutTransitionFinishCheck finishCheck(signalReceived);
1304   layoutTransitionData.FinishedSignal().Connect(&application, finishCheck);
1305
1306   application.SendNotification();
1307   application.Render( 0 );
1308
1309   finishCheck.CheckSignalNotReceived();
1310   // The animation just started
1311   DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1312
1313   Vector3 position, tangent;
1314   Quaternion rotation;
1315   path.Sample( 0.0f, position, tangent );
1316   rotation = Quaternion( Vector3::XAXIS, tangent );
1317   DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), position,  0.0001f, TEST_LOCATION );
1318   DALI_TEST_EQUALS( controls[0].GetCurrentOrientation(), rotation, 0.0001f, TEST_LOCATION );
1319
1320   application.SendNotification();
1321   application.Render(static_cast<unsigned int>( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ );
1322
1323   path.Sample( 1.0f, position, tangent );
1324   rotation = Quaternion( Vector3::XAXIS, tangent );
1325   DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), position, 0.0001f, TEST_LOCATION );
1326   DALI_TEST_EQUALS( controls[0].GetCurrentOrientation(), rotation, 0.0001f, TEST_LOCATION );
1327
1328   // The animation just finished
1329   DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1330   DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1331
1332   DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1333   DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1334
1335   application.SendNotification();
1336   application.Render( 10u /* wait a bit more for a signal */ );
1337
1338   // Now sizes and positions are finally set
1339   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1340   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1341
1342   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1343   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1344
1345   finishCheck.CheckSignalReceived();
1346
1347   END_TEST;
1348 }
1349
1350 int UtcDaliLayouting_AddChildLayoutTransition04_AnimateBy(void)
1351 {
1352   ToolkitTestApplication application;
1353   tet_infoline(" UtcDaliLayouting_AddChildLayoutTransition04_AnimateBy" );
1354
1355   Stage stage = Stage::GetCurrent();
1356   auto container = Control::New();
1357   auto horizontalLayout = LinearLayout::New();
1358   horizontalLayout.SetAnimateLayout( true );
1359   horizontalLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
1360
1361   DevelControl::SetLayout( container, horizontalLayout );
1362   container.SetName( "Container");
1363
1364   std::vector< Control > controls;
1365   controls.push_back( CreateLeafControl( 100, 100 ) );
1366   stage.Add( container );
1367
1368   auto layoutTransitionData = LayoutTransitionData::New();
1369   {
1370     // Instant resize for parent
1371     Property::Map map;
1372     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE;
1373     map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update
1374     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1375       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR" )
1376       .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
1377         .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
1378         .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
1379     layoutTransitionData.AddPropertyAnimator( container, map );
1380   }
1381   {
1382     // Instant position for a child
1383     Property::Map map;
1384     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION;
1385     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1386        .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR")
1387        .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
1388          .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
1389          .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
1390     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
1391   }
1392   {
1393     Property::Map map;
1394     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE;
1395     map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Vector3( 10.0f, 10.0f, 0 );
1396     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1397       .Add( LayoutTransitionData::AnimatorKey::TYPE, "ANIMATE_BY")
1398       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR")
1399       .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
1400         .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
1401         .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
1402     layoutTransitionData.AddPropertyAnimator( controls[0], map );
1403   }
1404
1405   horizontalLayout.SetTransitionData( LayoutTransitionData::ON_CHILD_ADD, layoutTransitionData );
1406   container.Add( controls[0] );
1407
1408   bool signalReceived(false);
1409   LayoutTransitionFinishCheck finishCheck(signalReceived);
1410   layoutTransitionData.FinishedSignal().Connect(&application, finishCheck);
1411
1412   application.SendNotification();
1413   application.Render( 1u /*just very beginning of the animation*/ );
1414
1415   finishCheck.CheckSignalNotReceived();
1416   // The animation just started
1417   DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1418   DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1419
1420   application.SendNotification();
1421   application.Render( static_cast<unsigned int>( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ );
1422
1423   // The animation just finished
1424   DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1425   DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1426
1427   DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1428   DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 110.0f, 110.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1429
1430   application.SendNotification();
1431   application.Render( 10u /* wait a bit more for a signal */ );
1432
1433   // Now sizes and positions are finally set
1434   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1435   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1436
1437   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1438   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 110.0f, 110.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1439
1440   finishCheck.CheckSignalReceived();
1441
1442   END_TEST;
1443 }
1444
1445 int UtcDaliLayouting_AddChildLayoutTransition05(void)
1446 {
1447   ToolkitTestApplication application;
1448   tet_infoline(" UtcDaliLayouting_AddChildLayoutTransition05" );
1449
1450   Stage stage = Stage::GetCurrent();
1451   auto container = Control::New();
1452   auto horizontalLayout = LinearLayout::New();
1453   horizontalLayout.SetAnimateLayout( true );
1454   horizontalLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
1455
1456   DevelControl::SetLayout( container, horizontalLayout );
1457   container.SetName( "Container");
1458
1459   std::vector< Control > controls;
1460   controls.push_back( CreateLeafControl( 100, 100 ) );
1461   stage.Add( container );
1462
1463   auto layoutTransitionData = LayoutTransitionData::New();
1464   {
1465     // Instant resize for parent
1466     Property::Map map;
1467     map[ "property" ] = Actor::Property::SIZE;
1468     map[ "targetValue" ] = Property::Value(); // capture from layout update
1469     map[ "animator" ] = Property::Map()
1470       .Add( "name", "InstantAnimator" )
1471       .Add( "type", "ANIMATE_TO")
1472       .Add( "alphaFunction", "LINEAR" )
1473       .Add( "timePeriod", Property::Map()
1474         .Add( "delay", 0.0f )
1475         .Add( "duration", 0.0f ) );
1476     layoutTransitionData.AddPropertyAnimator( container, map );
1477   }
1478   {
1479     // Instant position for a child
1480     Property::Map map;
1481     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::COLOR_ALPHA;
1482     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = "InstantAnimator";
1483     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
1484   }
1485   {
1486     // Grow a child from (0,0) size to full size (captured)
1487     Property::Map map;
1488     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE;
1489     map[ LayoutTransitionData::AnimatorKey::INITIAL_VALUE ] = Vector3( 0.0f, 0.0f, 0 );
1490     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = std::string();
1491     layoutTransitionData.AddPropertyAnimator( controls[0], map );
1492   }
1493   {
1494     // Instant opacity for a child, for testing
1495     Property::Map map;
1496     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION;
1497     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = "InstantAnimator";
1498     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
1499   }
1500
1501   // Just throw all other alpha functions in
1502   { // no property, not going to be used, but going to be parsed
1503     Property::Map map;
1504     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1505       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "WRONG" );
1506     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
1507   }
1508   { // no property, not going to be used, but going to be parsed
1509     Property::Map map;
1510     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1511       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR" );
1512     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
1513   }
1514   { // no property, not going to be used, but going to be parsed
1515     Property::Map map;
1516     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1517       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "REVERSE" );
1518     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
1519   }
1520   { // no property, not going to be used, but going to be parsed
1521     Property::Map map;
1522     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1523       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "EASE_IN_SQUARE" );
1524     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
1525   }
1526   { // no property, not going to be used, but going to be parsed
1527     Property::Map map;
1528     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1529       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "EASE_OUT_SQUARE" );
1530     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
1531   }
1532   { // no property, not going to be used, but going to be parsed
1533     Property::Map map;
1534     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1535       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "EASE_IN" );
1536     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
1537   }
1538   { // no property, not going to be used, but going to be parsed
1539     Property::Map map;
1540     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1541       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "EASE_IN" );
1542     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
1543   }
1544   { // no property, not going to be used, but going to be parsed
1545     Property::Map map;
1546     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1547       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "EASE_OUT" );
1548     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
1549   }
1550   { // no property, not going to be used, but going to be parsed
1551     Property::Map map;
1552     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1553       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "EASE_IN_OUT" );
1554     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
1555   }
1556   { // no property, not going to be used, but going to be parsed
1557     Property::Map map;
1558     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1559       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "EASE_IN_OUT_SINE" );
1560     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
1561   }
1562   { // no property, not going to be used, but going to be parsed
1563     Property::Map map;
1564     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1565       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "EASE_IN_SINE" );
1566     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
1567   }
1568   { // no property, not going to be used, but going to be parsed
1569     Property::Map map;
1570     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1571       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "EASE_OUT_SINE" );
1572     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
1573   }
1574   { // no property, not going to be used, but going to be parsed
1575     Property::Map map;
1576     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1577       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "BOUNCE" );
1578     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
1579   }
1580   { // no property, not going to be used, but going to be parsed
1581     Property::Map map;
1582     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1583       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "SIN" );
1584     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
1585   }
1586   { // no property, not going to be used, but going to be parsed
1587     Property::Map map;
1588     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1589       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "EASE_OUT_BACK" );
1590     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
1591   }
1592   { // no property, not going to be used, but going to be parsed
1593     Property::Map map;
1594     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1595       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, Vector4( 0.0f, 1.0f, 2.0f, 3.0f ) );
1596     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
1597   }
1598   { // no property, not going to be used, but going to be parsed
1599     Property::Map map;
1600     // valid
1601     Property::Array array;
1602     array.Reserve( 4 );
1603     array.PushBack( 0.0f );
1604     array.PushBack( 1.0f );
1605     array.PushBack( 2.0f );
1606     array.PushBack( 3.0f );
1607     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1608       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, array );
1609     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
1610   }
1611   { // no property, not going to be used, but going to be parsed
1612     Property::Map map;
1613     // invalid
1614     Property::Array array;
1615     array.Reserve( 3 );
1616     array.PushBack( 0.0f );
1617     array.PushBack( 1.0f );
1618     array.PushBack( 2.0f );
1619     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1620       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, array );
1621     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
1622   }
1623   { // no property, not going to be used, but going to be parsed
1624     Property::Map map;
1625     // invalid
1626     Property::Array array;
1627     array.Reserve( 4 );
1628     array.PushBack( 0.0f );
1629     array.PushBack( 10 );
1630     array.PushBack( 2.0f );
1631     array.PushBack( 3.0f );
1632     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1633       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, array );
1634     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
1635   }
1636   { // no property, not going to be used, but going to be parsed
1637     Property::Map map;
1638     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = 0; // invalid
1639     layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
1640   }
1641
1642   horizontalLayout.SetTransitionData( LayoutTransitionData::ON_CHILD_ADD, layoutTransitionData );
1643   container.Add( controls[0] );
1644
1645   bool signalReceived(false);
1646   LayoutTransitionFinishCheck finishCheck(signalReceived);
1647   layoutTransitionData.FinishedSignal().Connect(&application, finishCheck);
1648
1649   application.SendNotification();
1650   application.Render( 1u /*just very beginning of the animation*/ );
1651
1652   finishCheck.CheckSignalNotReceived();
1653   // The animation just started
1654   DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1655   DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1656
1657   DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 1.0f, TEST_LOCATION );
1658   DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 0.0f, 0.0f, 0.0f ), 1.0f, TEST_LOCATION );
1659
1660   application.SendNotification();
1661   application.Render(static_cast<unsigned int>( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ );
1662
1663   // The animation just finished
1664   DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1665   DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1666
1667   DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1668   DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1669
1670   application.SendNotification();
1671   application.Render( 10u /* wait a bit more for a signal */ );
1672
1673   // Now sizes and positions are finally set
1674   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1675   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1676
1677   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1678   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1679
1680   finishCheck.CheckSignalReceived();
1681
1682   END_TEST;
1683 }
1684
1685 int UtcDaliLayouting_DefaultTransition01(void)
1686 {
1687   ToolkitTestApplication application;
1688   tet_infoline(" UtcDaliLayouting_DefaultTransition01" );
1689
1690   Stage stage = Stage::GetCurrent();
1691   auto container = Control::New();
1692   auto horizontalLayout = LinearLayout::New();
1693   horizontalLayout.SetAnimateLayout( false );
1694   horizontalLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
1695
1696   DevelControl::SetLayout( container, horizontalLayout );
1697   container.SetName( "Container" );
1698
1699   std::vector< Control > controls;
1700   controls.push_back( CreateLeafControl( 100, 100 ) );
1701   controls.push_back( CreateLeafControl( 100, 100 ) );
1702
1703   stage.Add( container );
1704   container.Add( controls[0] );
1705   container.Add( controls[1] );
1706
1707   // Initial rendering done
1708   application.SendNotification();
1709   application.Render();
1710
1711   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1712   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1713   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1714
1715   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1716   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1717   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1718
1719   horizontalLayout.SetAnimateLayout( true );
1720
1721   auto layoutTransitionData0 = LayoutTransitionData::New();
1722   {
1723     // Default instant resize
1724     Property::Map map;
1725     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE;
1726     map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update
1727     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1728       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR )
1729       .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
1730         .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
1731         .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
1732     layoutTransitionData0.AddPropertyAnimator( controls[0], map );
1733   }
1734   {
1735     // Instant instant position
1736     Property::Map map;
1737     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION;
1738     map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update
1739     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1740        .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR )
1741        .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
1742          .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
1743          .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
1744     layoutTransitionData0.AddPropertyAnimator( controls[0], map );
1745   }
1746   DevelControl::GetLayout( controls[0] ).SetTransitionData( LayoutTransitionData::Type::ON_LAYOUT_CHANGE, layoutTransitionData0 );
1747
1748   auto layoutTransitionData1 = LayoutTransitionData::New();
1749   {
1750     // Default instant resize
1751     Property::Map map;
1752     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE;
1753     map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update
1754     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1755       .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR )
1756       .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
1757         .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
1758         .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
1759     layoutTransitionData1.AddPropertyAnimator( controls[1], map );
1760   }
1761   {
1762     // Instant instant position
1763     Property::Map map;
1764     map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION;
1765     map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update
1766     map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
1767        .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR )
1768        .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
1769          .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
1770          .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
1771     layoutTransitionData1.AddPropertyAnimator( controls[1], map );
1772   }
1773   DevelControl::GetLayout( controls[1] ).SetTransitionData( LayoutTransitionData::Type::ON_LAYOUT_CHANGE, layoutTransitionData1 );
1774
1775   horizontalLayout.SetOrientation( LinearLayout::Orientation::VERTICAL );
1776
1777   application.SendNotification();
1778   application.Render( 10u /*just very beginning of the animation*/ );
1779
1780   // Animation just finished
1781   DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1782   DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 300.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1783   DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 0.0f, 400.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1784
1785   DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1786   DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION );
1787   DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION );
1788
1789   // Now sizes and positions are set
1790   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1791   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 300.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1792   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 400.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1793
1794   DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1795   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1796   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1797
1798   END_TEST;
1799 }
1800
1801 int UtcDaliLayouting_CheckResourceLeak01(void)
1802 {
1803   ToolkitTestApplication application;
1804   tet_infoline(" UtcDaliLayouting_CheckResourceLeak01 - Remove animating layout and add child to stage" );
1805
1806   Dali::Toolkit::Impl::DummyControl::constructorCount = 0;
1807   Dali::Toolkit::Impl::DummyControl::destructorCount = 0;
1808
1809   Stage stage = Stage::GetCurrent();
1810   auto container = Control::New();
1811   auto linearLayout = LinearLayout::New();
1812   linearLayout.SetAnimateLayout( true );
1813
1814   DevelControl::SetLayout( container, linearLayout );
1815   container.SetName( "Container" );
1816
1817   stage.Add( container );
1818
1819   DummyControl control = DummyControl::New( true );
1820   control.SetName( "DummyControl01" );
1821   control.SetSize( 100, 100 );
1822   container.Add( control );
1823
1824   control = DummyControl::New( true );
1825   control.SetName( "DummyControl02" );
1826   control.SetSize( 100, 100 );
1827   container.Add( control );
1828
1829   linearLayout.SetAnimateLayout( true );
1830
1831   DALI_TEST_EQUALS( Dali::Toolkit::Impl::DummyControl::constructorCount, 2, TEST_LOCATION );
1832   DALI_TEST_EQUALS( Dali::Toolkit::Impl::DummyControl::destructorCount, 0, TEST_LOCATION );
1833
1834   // Initial rendering done
1835   application.SendNotification();
1836   application.Render(static_cast<unsigned int>( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ );
1837
1838   DALI_TEST_EQUALS( Dali::Toolkit::Impl::DummyControl::constructorCount, 2, TEST_LOCATION );
1839   DALI_TEST_EQUALS( Dali::Toolkit::Impl::DummyControl::destructorCount, 0, TEST_LOCATION );
1840
1841   stage.Remove( container );
1842   container.Reset();
1843
1844   application.SendNotification();
1845   application.Render(static_cast<unsigned int>( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ );
1846
1847   DALI_TEST_EQUALS( Dali::Toolkit::Impl::DummyControl::constructorCount, 2, TEST_LOCATION );
1848   DALI_TEST_EQUALS( Dali::Toolkit::Impl::DummyControl::destructorCount, 1, TEST_LOCATION );
1849
1850   Stage::GetCurrent().Add( control );
1851
1852   application.SendNotification();
1853   application.Render(static_cast<unsigned int>( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ );
1854
1855   DALI_TEST_EQUALS( Dali::Toolkit::Impl::DummyControl::constructorCount, 2, TEST_LOCATION );
1856   DALI_TEST_EQUALS( Dali::Toolkit::Impl::DummyControl::destructorCount, 1, TEST_LOCATION );
1857
1858   stage.Remove( control );
1859   control.Reset();
1860
1861   application.SendNotification();
1862   application.Render(static_cast<unsigned int>( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ );
1863
1864   DALI_TEST_EQUALS( Dali::Toolkit::Impl::DummyControl::constructorCount, 2, TEST_LOCATION );
1865   DALI_TEST_EQUALS( Dali::Toolkit::Impl::DummyControl::destructorCount, 2, TEST_LOCATION );
1866
1867   END_TEST;
1868 }
1869