0c1b9ef66e86ffbb759a473a107378ae3f74250e
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-Layouting.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/controls/control-devel.h>
25 #include <dali-toolkit/devel-api/layouting/absolute-layout.h>
26 #include <dali-toolkit/devel-api/layouting/linear-layout.h>
27 #include <dali-toolkit/devel-api/layouting/layout-item-impl.h>
28 #include <dali-toolkit/devel-api/layouting/layout-group-impl.h>
29 #include <dali/devel-api/actors/actor-devel.h>
30
31 #include <../custom-layout.h>
32
33 #include <layout-utils.h>
34
35 using namespace Dali;
36 using namespace Toolkit;
37
38 void TestLayoutItemOrder( std::vector< Control >& controls, LayoutGroup& layoutGroup )
39 {
40   for( auto&& iter : controls )
41   {
42     unsigned int siblingOrder = static_cast< unsigned int>( iter.GetProperty< int >( DevelActor::Property::SIBLING_ORDER ) );
43     DALI_TEST_EQUALS( layoutGroup.GetChildAt( siblingOrder ), DevelControl::GetLayout( iter ), TEST_LOCATION );
44   }
45 }
46
47 void utc_dali_toolkit_layouting_startup(void)
48 {
49   test_return_value = TET_UNDEF;
50 }
51
52 void utc_dali_toolkit_layouting_cleanup(void)
53 {
54   test_return_value = TET_PASS;
55 }
56
57 int UtcDaliLayouting_HboxLayout01(void)
58 {
59   ToolkitTestApplication application;
60   tet_infoline(" UtcDaliLayouting_HboxLayout01");
61
62   Stage stage = Stage::GetCurrent();
63   auto hbox = Control::New();
64   auto hboxLayout = LinearLayout::New();
65   hboxLayout.SetCellPadding( LayoutSize( 10, 0 ) );
66   DevelControl::SetLayout( hbox, hboxLayout );
67   hbox.SetName( "HBox");
68
69   std::vector< Control > controls;
70   controls.push_back( CreateLeafControl( 40, 40 ) );
71   controls.push_back( CreateLeafControl( 60, 40 ) );
72   controls.push_back( CreateLeafControl( 80, 40 ) );
73   controls.push_back( CreateLeafControl( 100, 40 ) );
74
75   for( auto&& iter : controls )
76   {
77     hbox.Add( iter );
78   }
79
80   hbox.SetParentOrigin( ParentOrigin::CENTER );
81   hbox.SetAnchorPoint( AnchorPoint::CENTER );
82   stage.Add( hbox );
83
84   // Ensure layouting happens
85   application.SendNotification();
86   application.Render();
87
88   // hbox centers elements vertically, it fills test harness stage, which is 480x800.
89   // hbox left justifies elements
90   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
91   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 50.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
92   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 120.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
93   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 210.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
94
95   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
96   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
97   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
98   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
99
100   // Change a layout
101   auto newHBoxLayout = LinearLayout::New();
102   newHBoxLayout.SetCellPadding( LayoutSize( 10, 0 ) );
103   DevelControl::SetLayout( hbox, newHBoxLayout );
104
105   application.SendNotification();
106   application.Render();
107
108   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
109   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 50.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
110   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 120.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
111   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 210.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
112
113   END_TEST;
114 }
115
116 int UtcDaliLayouting_HboxLayout02(void)
117 {
118   ToolkitTestApplication application;
119   tet_infoline(" UtcDaliLayouting_HboxLayout02 Test nested hboxes with default spec of WRAP_CONTENT");
120
121   Stage stage = Stage::GetCurrent();
122
123   auto hbox1 = Control::New();
124   auto hboxLayout1 = LinearLayout::New();
125   DevelControl::SetLayout( hbox1, hboxLayout1 );
126
127   auto hbox2 = Control::New();
128   auto hboxLayout2 = LinearLayout::New();
129   DevelControl::SetLayout( hbox2, hboxLayout2 );
130
131   hbox1.SetName( "HBox1");
132   hbox2.SetName( "HBox2");
133
134   std::vector< Control > controls;
135   controls.push_back( CreateLeafControl( 20, 40 ) );
136   controls.push_back( CreateLeafControl( 30, 50 ) );
137   controls.push_back( CreateLeafControl( 40, 60 ) );
138   controls.push_back( CreateLeafControl( 50, 70 ) );
139
140   controls.push_back( CreateLeafControl( 25, 40 ) );
141   controls.push_back( CreateLeafControl( 35, 50 ) );
142   controls.push_back( CreateLeafControl( 45, 60 ) );
143   controls.push_back( CreateLeafControl( 55, 70 ) );
144
145   int counter=0;
146   for( auto&& iter : controls )
147   {
148     if( counter < 4 )
149     {
150       hbox1.Add( iter );
151     }
152     else
153     {
154       hbox2.Add( iter );
155     }
156     ++counter;
157   }
158   hbox1.SetParentOrigin( ParentOrigin::CENTER );
159   hbox1.SetAnchorPoint( AnchorPoint::CENTER );
160   hbox2.SetParentOrigin( ParentOrigin::CENTER );
161   hbox2.SetAnchorPoint( AnchorPoint::CENTER );
162
163   auto hbox3 = Control::New();
164   auto hboxLayout3 = LinearLayout::New();
165   DevelControl::SetLayout( hbox3, hboxLayout3 );
166
167   hbox3.SetParentOrigin( ParentOrigin::CENTER );
168   hbox3.SetName( "HBox3");
169   hbox3.Add( hbox1 );
170   hbox3.Add( hbox2 );
171
172   stage.Add( hbox3 );
173
174   // Ensure layouting happens
175   application.SendNotification();
176   application.Render();
177
178
179   // hbox centers elements vertically, it fills test harness stage, which is 480x800.
180   // hbox left justifies elements
181   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3(  0.0f, 15.0f, 0.0f ), 0.0001f, TEST_LOCATION );
182   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 20.0f, 10.0f, 0.0f ), 0.0001f, TEST_LOCATION );
183   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 50.0f,  5.0f, 0.0f ), 0.0001f, TEST_LOCATION );
184   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 90.0f,  0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
185
186   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 20.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
187   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 30.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
188   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
189   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 50.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
190
191
192   DALI_TEST_EQUALS( controls[4].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3(  0.0f, 15.0f, 0.0f ), 0.0001f, TEST_LOCATION );
193   DALI_TEST_EQUALS( controls[5].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 25.0f, 10.0f, 0.0f ), 0.0001f, TEST_LOCATION );
194   DALI_TEST_EQUALS( controls[6].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 60.0f,  5.0f, 0.0f ), 0.0001f, TEST_LOCATION );
195   DALI_TEST_EQUALS( controls[7].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 105.0f,  0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
196
197   DALI_TEST_EQUALS( controls[4].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 25.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
198   DALI_TEST_EQUALS( controls[5].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 35.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
199   DALI_TEST_EQUALS( controls[6].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 45.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
200   DALI_TEST_EQUALS( controls[7].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 55.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
201
202   // Test hbox1 and 2 are sized to wrap their content
203   DALI_TEST_EQUALS( hbox1.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 140.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
204   DALI_TEST_EQUALS( hbox2.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 160.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
205   DALI_TEST_EQUALS( hbox1.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 365.0f, 0.0f ), 0.0001f, TEST_LOCATION );
206   DALI_TEST_EQUALS( hbox2.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 140.0f, 365.0f, 0.0f ), 0.0001f, TEST_LOCATION );
207
208   // Test hbox3 matches parent (root layer)
209   DALI_TEST_EQUALS( hbox3.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
210   DALI_TEST_EQUALS( hbox3.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
211
212   END_TEST;
213 }
214
215
216 int UtcDaliLayouting_HboxLayout03(void)
217 {
218   ToolkitTestApplication application;
219   tet_infoline(" UtcDaliLayouting_HboxLayout03 Test nested hboxes with MATCH_PARENT");
220
221   Stage stage = Stage::GetCurrent();
222
223   auto hbox1 = Control::New();
224   auto hboxLayout1 = LinearLayout::New();
225   DevelControl::SetLayout( hbox1, hboxLayout1 );
226
227   auto hbox2 = Control::New();
228   auto hboxLayout2 = LinearLayout::New();
229   DevelControl::SetLayout( hbox2, hboxLayout2 );
230
231   hbox1.SetName( "HBox1");
232   hbox2.SetName( "HBox2");
233   hbox1.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
234   hbox1.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
235   hbox2.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
236   hbox2.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
237
238   std::vector< Control > controls;
239   controls.push_back( CreateLeafControl( 20, 40 ) );
240   controls.push_back( CreateLeafControl( 30, 50 ) );
241   controls.push_back( CreateLeafControl( 40, 60 ) );
242   controls.push_back( CreateLeafControl( 50, 70 ) );
243
244   controls.push_back( CreateLeafControl( 25, 40 ) );
245   controls.push_back( CreateLeafControl( 35, 50 ) );
246   controls.push_back( CreateLeafControl( 45, 60 ) );
247   controls.push_back( CreateLeafControl( 55, 70 ) );
248
249   int counter=0;
250   for( auto&& iter : controls )
251   {
252     if( counter < 4 )
253     {
254       hbox1.Add( iter );
255     }
256     else
257     {
258       hbox2.Add( iter );
259     }
260     ++counter;
261   }
262   hbox1.SetParentOrigin( ParentOrigin::CENTER );
263   hbox1.SetAnchorPoint( AnchorPoint::CENTER );
264   hbox2.SetParentOrigin( ParentOrigin::CENTER );
265   hbox2.SetAnchorPoint( AnchorPoint::CENTER );
266
267   auto hbox3 = Control::New();
268   auto hboxLayout3 = LinearLayout::New();
269   DevelControl::SetLayout( hbox3, hboxLayout3);
270
271   hbox3.SetParentOrigin( ParentOrigin::CENTER );
272   hbox3.SetName( "HBox3");
273   hbox3.Add( hbox1 );
274   hbox3.Add( hbox2 );
275
276   stage.Add( hbox3 );
277
278   //std::ostringstream oss;
279   //DumpControlHierarchy( oss, Stage::GetCurrent().GetRootLayer() );
280   //printf("Control hierarchy: \n%s\n", oss.str().c_str() );
281
282   // Ensure layouting happens
283   application.SendNotification();
284   application.Render();
285
286
287   // hbox centers elements vertically, it fills test harness stage, which is 480x800.
288   // hbox left justifies elements
289   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
290   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 20.0f,375.0f, 0.0f ), 0.0001f, TEST_LOCATION );
291   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 50.0f,370.0f, 0.0f ), 0.0001f, TEST_LOCATION );
292   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 90.0f,365.0f, 0.0f ), 0.0001f, TEST_LOCATION );
293
294   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 20.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
295   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 30.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
296   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
297   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 50.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
298
299   DALI_TEST_EQUALS( controls[4].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3(  0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
300   DALI_TEST_EQUALS( controls[5].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 25.0f, 375.0f, 0.0f ), 0.0001f, TEST_LOCATION );
301   DALI_TEST_EQUALS( controls[6].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 60.0f, 370.0f, 0.0f ), 0.0001f, TEST_LOCATION );
302   DALI_TEST_EQUALS( controls[7].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 105.0f,365.0f, 0.0f ), 0.0001f, TEST_LOCATION );
303
304   DALI_TEST_EQUALS( controls[4].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 25.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
305   DALI_TEST_EQUALS( controls[5].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 35.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
306   DALI_TEST_EQUALS( controls[6].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 45.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
307   DALI_TEST_EQUALS( controls[7].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 55.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
308
309   DALI_TEST_EQUALS( hbox1.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
310   DALI_TEST_EQUALS( hbox2.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
311   DALI_TEST_EQUALS( hbox1.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
312   DALI_TEST_EQUALS( hbox2.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 480.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
313
314   // Test hbox3 matches parent (root layer)
315   DALI_TEST_EQUALS( hbox3.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
316   DALI_TEST_EQUALS( hbox3.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
317
318   END_TEST;
319 }
320
321 int UtcDaliLayouting_HboxLayout04(void)
322 {
323   ToolkitTestApplication application;
324   tet_infoline(" UtcDaliLayouting_HboxLayout04 Test nested hboxes with explicit WRAP_CONTENT");
325
326   Stage stage = Stage::GetCurrent();
327
328   auto hbox1 = Control::New();
329   auto hboxLayout1 = LinearLayout::New();
330   DevelControl::SetLayout( hbox1, hboxLayout1 );
331
332   auto hbox2 = Control::New();
333   auto hboxLayout2 = LinearLayout::New();
334   DevelControl::SetLayout( hbox2, hboxLayout2 );
335
336   hbox1.SetName( "HBox1"); // Default spec is to wrap content
337   hbox2.SetName( "HBox2");
338   hbox1.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
339   hbox1.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
340   hbox2.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
341   hbox2.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
342
343   std::vector< Control > controls;
344   controls.push_back( CreateLeafControl( 80, 40 ) );
345   controls.push_back( CreateLeafControl( 80, 50 ) );
346   controls.push_back( CreateLeafControl( 80, 60 ) );
347   controls.push_back( CreateLeafControl( 80, 70 ) );
348
349   controls.push_back( CreateLeafControl( 80, 40 ) );
350   controls.push_back( CreateLeafControl( 80, 50 ) );
351   controls.push_back( CreateLeafControl( 80, 60 ) );
352   controls.push_back( CreateLeafControl( 80, 70 ) );
353
354   int counter=0;
355   for( auto&& iter : controls )
356   {
357     if( counter < 4 )
358     {
359       hbox1.Add( iter );
360     }
361     else
362     {
363       hbox2.Add( iter );
364     }
365     ++counter;
366   }
367
368   controls[6].SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
369   auto hbox3 = Control::New();
370   auto hboxLayout3 = LinearLayout::New();
371   DevelControl::SetLayout( hbox3, hboxLayout3 );
372
373   hbox3.SetParentOrigin( ParentOrigin::CENTER );
374   hbox3.SetName( "HBox3");
375   hbox3.Add( hbox1 );
376   hbox3.Add( hbox2 );
377   stage.Add( hbox3 );
378
379   //std::ostringstream oss;
380   //DumpControlHierarchy( oss, Stage::GetCurrent().GetRootLayer() );
381   //printf("Control hierarchy: \n%s\n", oss.str().c_str() );
382
383   // Ensure layouting happens
384   application.SendNotification();
385   application.Render();
386
387
388   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 15.0f, 0.0f ), 0.0001f, TEST_LOCATION );
389   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 80.0f,10.0f, 0.0f ), 0.0001f, TEST_LOCATION );
390   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 160.0f, 5.0f, 0.0f ), 0.0001f, TEST_LOCATION );
391   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 240.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
392
393   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
394   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
395   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
396   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
397
398   DALI_TEST_EQUALS( controls[4].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3(  0.0f, 15.0f, 0.0f ), 0.0001f, TEST_LOCATION );
399   DALI_TEST_EQUALS( controls[5].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 80.0f, 10.0f, 0.0f ), 0.0001f, TEST_LOCATION );
400   DALI_TEST_EQUALS( controls[6].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 160.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
401   DALI_TEST_EQUALS( controls[7].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 240.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
402
403   DALI_TEST_EQUALS( controls[4].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
404   DALI_TEST_EQUALS( controls[5].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
405   DALI_TEST_EQUALS( controls[6].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
406   DALI_TEST_EQUALS( controls[7].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
407
408   DALI_TEST_EQUALS( hbox1.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 320.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
409   DALI_TEST_EQUALS( hbox2.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 320.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
410   DALI_TEST_EQUALS( hbox1.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 365.0f, 0.0f ), 0.0001f, TEST_LOCATION );
411   DALI_TEST_EQUALS( hbox2.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 320.0f, 365.0f, 0.0f ), 0.0001f, TEST_LOCATION );
412
413
414   // Test hbox3 matches parent (root layer)
415   DALI_TEST_EQUALS( hbox3.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
416   DALI_TEST_EQUALS( hbox3.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
417
418   END_TEST;
419 }
420
421 int UtcDaliLayouting_HboxLayout05(void)
422 {
423   ToolkitTestApplication application;
424   tet_infoline(" UtcDaliLayouting_HboxLayout05 - Set children size explicitly via width & height specification");
425
426   Stage stage = Stage::GetCurrent();
427   auto hbox = Control::New();
428   auto hboxLayout = LinearLayout::New();
429   hboxLayout.SetCellPadding( LayoutSize( 10, 0 ) );
430   DevelControl::SetLayout( hbox, hboxLayout );
431   hbox.SetName( "HBox");
432
433   std::vector< Control > controls;
434   controls.push_back( CreateLeafControl( 40, 40 ) );
435   controls.push_back( CreateLeafControl( 60, 40 ) );
436   controls.push_back( CreateLeafControl( 80, 40 ) );
437   controls.push_back( CreateLeafControl( 100, 40 ) );
438
439   for( auto&& iter : controls )
440   {
441     hbox.Add( iter );
442     iter.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 100 );
443     iter.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, 50 );
444   }
445
446   hbox.SetParentOrigin( ParentOrigin::CENTER );
447   hbox.SetAnchorPoint( AnchorPoint::CENTER );
448   stage.Add( hbox );
449
450   // Ensure layouting happens
451   application.SendNotification();
452   application.Render();
453
454   // hbox centers elements vertically, it fills test harness stage, which is 480x800.
455   // hbox left justifies elements
456   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 375.0f, 0.0f ), 0.0001f, TEST_LOCATION );
457   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 110.0f, 375.0f, 0.0f ), 0.0001f, TEST_LOCATION );
458   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 220.0f, 375.0f, 0.0f ), 0.0001f, TEST_LOCATION );
459   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 330.0f, 375.0f, 0.0f ), 0.0001f, TEST_LOCATION );
460
461   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
462   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
463   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
464   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
465
466   END_TEST;
467 }
468
469 int UtcDaliLayouting_HboxLayout06(void)
470 {
471   ToolkitTestApplication application;
472   tet_infoline(" UtcDaliLayouting_HboxLayout06 - Test nested layouts");
473
474   Stage stage = Stage::GetCurrent();
475
476   auto rootControl = Control::New();
477   auto absoluteLayout = AbsoluteLayout::New();
478   DevelControl::SetLayout( rootControl, absoluteLayout );
479   rootControl.SetName( "AbsoluteLayout" );
480   stage.Add( rootControl );
481
482   auto hbox = Control::New();
483   auto hboxLayout = LinearLayout::New();
484   hboxLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
485   DevelControl::SetLayout( hbox, hboxLayout );
486   hbox.SetName( "HBox" );
487
488   std::vector< Control > controls;
489   controls.push_back( CreateLeafControl( 40, 40 ) );
490   controls.push_back( CreateLeafControl( 60, 40 ) );
491
492   for( auto&& iter : controls )
493   {
494     hbox.Add( iter );
495   }
496   hbox.SetParentOrigin( ParentOrigin::CENTER );
497   hbox.SetAnchorPoint( AnchorPoint::CENTER );
498   rootControl.Add( hbox );
499
500   // Ensure layouting happens
501   application.SendNotification();
502   application.Render();
503
504   // hbox centers elements vertically, it fills test harness stage, which is 480x800.
505   // hbox left justifies elements
506   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
507   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 40.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
508
509   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
510   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
511
512   DALI_TEST_EQUALS( hbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
513
514   // Change a layout
515   auto newHBoxLayout = LinearLayout::New();
516   newHBoxLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
517   DevelControl::SetLayout( hbox, newHBoxLayout );
518
519   hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
520   hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
521
522   application.SendNotification();
523   application.Render();
524
525   DALI_TEST_EQUALS( hbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
526
527   // Change size specification
528   hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
529   hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
530
531   application.SendNotification();
532   application.Render();
533
534   DALI_TEST_EQUALS( hbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
535
536   // Use WRAP_CONTENT again
537   hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
538   hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
539
540   application.SendNotification();
541   application.Render();
542
543   DALI_TEST_EQUALS( hbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
544
545   END_TEST;
546 }
547
548 int UtcDaliLayouting_HboxLayout07(void)
549 {
550   ToolkitTestApplication application;
551   tet_infoline(" UtcDaliLayouting_HboxLayout07 - Set LTR/RTL direction");
552
553   Stage stage = Stage::GetCurrent();
554   auto hbox = Control::New();
555   auto hboxLayout = LinearLayout::New();
556   hboxLayout.SetCellPadding( LayoutSize( 10, 0 ) );
557   DevelControl::SetLayout( hbox, hboxLayout );
558   hbox.SetName( "HBox");
559
560   std::vector< Control > controls;
561   controls.push_back( CreateLeafControl( 40, 40 ) );
562   controls.push_back( CreateLeafControl( 60, 40 ) );
563   controls.push_back( CreateLeafControl( 80, 40 ) );
564   controls.push_back( CreateLeafControl( 100, 40 ) );
565
566   for( auto&& iter : controls )
567   {
568     hbox.Add( iter );
569   }
570   hbox.SetParentOrigin( ParentOrigin::CENTER );
571   hbox.SetAnchorPoint( AnchorPoint::CENTER );
572   stage.Add( hbox );
573
574   hbox.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT );
575
576   // Ensure layouting happens
577   application.SendNotification();
578   application.Render();
579
580   // hbox centers elements vertically, it fills test harness stage, which is 480x800 from left to right.
581   // hbox left justifies elements
582   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
583   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 50.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
584   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 120.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
585   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 210.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
586
587   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
588   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
589   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
590   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
591
592   hbox.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT );
593
594   // Ensure layouting happens
595   application.SendNotification();
596   application.Render();
597
598   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 470.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
599   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 400.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
600   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 310.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
601   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 200.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
602
603   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
604   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
605   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
606   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
607
608   END_TEST;
609 }
610
611 int UtcDaliLayouting_HboxLayout08(void)
612 {
613   ToolkitTestApplication application;
614   tet_infoline(" UtcDaliLayouting_HboxLayout08 - Test layout animation");
615
616   Stage stage = Stage::GetCurrent();
617
618   auto rootControl = Control::New();
619   auto absoluteLayout = AbsoluteLayout::New();
620   absoluteLayout.SetAnimateLayout( true );
621   DevelControl::SetLayout( rootControl, absoluteLayout );
622   rootControl.SetName( "AbsoluteLayout" );
623   stage.Add( rootControl );
624
625   Control control1 = CreateLeafControl( 40, 40 );
626   rootControl.Add( control1 );
627   auto hbox = Control::New();
628   auto hboxLayout = LinearLayout::New();
629   hboxLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
630   DevelControl::SetLayout( hbox, hboxLayout );
631   hbox.SetName( "HBox" );
632
633   Control control2 = CreateLeafControl( 40, 40 );
634   hbox.Add( control2 );
635
636   hbox.SetParentOrigin( ParentOrigin::CENTER );
637   hbox.SetAnchorPoint( AnchorPoint::CENTER );
638   rootControl.Add( hbox );
639
640   DALI_TEST_EQUALS( absoluteLayout.IsLayoutAnimated(), true, TEST_LOCATION );
641   DALI_TEST_EQUALS( DevelControl::GetLayout( control1 ).IsLayoutAnimated(), true, TEST_LOCATION );
642   DALI_TEST_EQUALS( hboxLayout.IsLayoutAnimated(), false, TEST_LOCATION );
643   DALI_TEST_EQUALS( DevelControl::GetLayout( control2 ).IsLayoutAnimated(), false, TEST_LOCATION );
644
645   hboxLayout.SetAnimateLayout( true );
646   absoluteLayout.SetAnimateLayout( false );
647
648   DALI_TEST_EQUALS( absoluteLayout.IsLayoutAnimated(), false, TEST_LOCATION );
649   DALI_TEST_EQUALS( DevelControl::GetLayout( control1 ).IsLayoutAnimated(), false, TEST_LOCATION );
650   DALI_TEST_EQUALS( hboxLayout.IsLayoutAnimated(), true, TEST_LOCATION );
651   DALI_TEST_EQUALS( DevelControl::GetLayout( control2 ).IsLayoutAnimated(), true, TEST_LOCATION );
652
653   END_TEST;
654 }
655
656 int UtcDaliLayouting_HboxLayout09(void)
657 {
658   ToolkitTestApplication application;
659   tet_infoline(" UtcDaliLayouting_HboxLayout07 - Set alignment");
660
661   Stage stage = Stage::GetCurrent();
662   auto hbox = Control::New();
663   auto hboxLayout = LinearLayout::New();
664   DevelControl::SetLayout( hbox, hboxLayout );
665   hbox.SetName( "HBox");
666
667   std::vector< Control > controls;
668   controls.push_back( CreateLeafControl( 40, 40 ) );
669   controls.push_back( CreateLeafControl( 60, 60 ) );
670
671   for( auto&& iter : controls )
672   {
673     hbox.Add( iter );
674   }
675   hbox.SetParentOrigin( ParentOrigin::CENTER );
676   hbox.SetAnchorPoint( AnchorPoint::CENTER );
677   stage.Add( hbox );
678
679   // Check default orientation
680   DALI_TEST_EQUALS( static_cast<unsigned int>( hboxLayout.GetOrientation() ), static_cast<unsigned int>( LinearLayout::Orientation::HORIZONTAL ), TEST_LOCATION );
681   // Check default alignment
682   DALI_TEST_EQUALS( hboxLayout.GetAlignment(), ( Dali::Toolkit::LinearLayout::Alignment::BEGIN | Dali::Toolkit::LinearLayout::Alignment::CENTER_VERTICAL ), TEST_LOCATION );
683
684   hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::BEGIN );
685
686   // Ensure layouting happens
687   application.SendNotification();
688   application.Render();
689
690   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
691   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 40.0f, 370.0f, 0.0f ), 0.0001f, TEST_LOCATION );
692
693   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
694   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
695
696   hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::END );
697
698   // Ensure layouting happens
699   application.SendNotification();
700   application.Render();
701
702   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 380.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
703   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 420.0f, 370.0f, 0.0f ), 0.0001f, TEST_LOCATION );
704
705   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
706   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
707
708   hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::CENTER_HORIZONTAL );
709
710   // Ensure layouting happens
711   application.SendNotification();
712   application.Render();
713
714   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 190.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
715   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 230.0f, 370.0f, 0.0f ), 0.0001f, TEST_LOCATION );
716
717   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
718   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
719
720   hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::BEGIN | Dali::Toolkit::LinearLayout::Alignment::TOP );
721
722   // Ensure layouting happens
723   application.SendNotification();
724   application.Render();
725
726   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
727   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 40.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
728
729   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
730   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
731
732   hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::END | Dali::Toolkit::LinearLayout::Alignment::TOP );
733
734   // Ensure layouting happens
735   application.SendNotification();
736   application.Render();
737
738   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 380.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
739   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 420.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
740
741   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
742   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
743
744   hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::CENTER_HORIZONTAL | Dali::Toolkit::LinearLayout::Alignment::TOP );
745
746   // Ensure layouting happens
747   application.SendNotification();
748   application.Render();
749
750   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 190.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
751   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 230.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
752
753   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
754   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
755
756   hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::BEGIN | Dali::Toolkit::LinearLayout::Alignment::BOTTOM );
757
758   // Ensure layouting happens
759   application.SendNotification();
760   application.Render();
761
762   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 760.0f, 0.0f ), 0.0001f, TEST_LOCATION );
763   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 40.0f, 740.0f, 0.0f ), 0.0001f, TEST_LOCATION );
764
765   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
766   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
767
768   hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::END | Dali::Toolkit::LinearLayout::Alignment::BOTTOM );
769
770   // Ensure layouting happens
771   application.SendNotification();
772   application.Render();
773
774   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 380.0f, 760.0f, 0.0f ), 0.0001f, TEST_LOCATION );
775   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 420.0f, 740.0f, 0.0f ), 0.0001f, TEST_LOCATION );
776
777   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
778   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
779
780   hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::CENTER_HORIZONTAL | Dali::Toolkit::LinearLayout::Alignment::BOTTOM );
781
782   // Ensure layouting happens
783   application.SendNotification();
784   application.Render();
785
786   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 190.0f, 760.0f, 0.0f ), 0.0001f, TEST_LOCATION );
787   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 230.0f, 740.0f, 0.0f ), 0.0001f, TEST_LOCATION );
788
789   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
790   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
791
792   hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::CENTER_HORIZONTAL | Dali::Toolkit::LinearLayout::Alignment::CENTER_VERTICAL );
793
794   // Ensure layouting happens
795   application.SendNotification();
796   application.Render();
797
798   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 190.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
799   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 230.0f, 370.0f, 0.0f ), 0.0001f, TEST_LOCATION );
800
801   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
802   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
803
804   hboxLayout.SetOrientation( LinearLayout::Orientation::VERTICAL );
805   hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::BEGIN );
806
807   // Ensure layouting happens
808   application.SendNotification();
809   application.Render();
810
811   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
812   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 390.0f, 0.0f ), 0.0001f, TEST_LOCATION );
813
814   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
815   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
816
817   hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::END );
818
819   // Ensure layouting happens
820   application.SendNotification();
821   application.Render();
822
823   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 440.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
824   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 420.0f, 390.0f, 0.0f ), 0.0001f, TEST_LOCATION );
825
826   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
827   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
828
829   hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::CENTER_HORIZONTAL );
830
831   // Ensure layouting happens
832   application.SendNotification();
833   application.Render();
834
835   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 220.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
836   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 210.0f, 390.0f, 0.0f ), 0.0001f, TEST_LOCATION );
837
838   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
839   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
840
841   hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::BEGIN | Dali::Toolkit::LinearLayout::Alignment::TOP );
842
843   // Ensure layouting happens
844   application.SendNotification();
845   application.Render();
846
847   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
848   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
849
850   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
851   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
852
853   hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::END | Dali::Toolkit::LinearLayout::Alignment::TOP );
854
855   // Ensure layouting happens
856   application.SendNotification();
857   application.Render();
858
859   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 440.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
860   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 420.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
861
862   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
863   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
864
865   hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::CENTER_HORIZONTAL | Dali::Toolkit::LinearLayout::Alignment::TOP );
866
867   // Ensure layouting happens
868   application.SendNotification();
869   application.Render();
870
871   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 220.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
872   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 210.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
873
874   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
875   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
876
877   hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::BEGIN | Dali::Toolkit::LinearLayout::Alignment::BOTTOM );
878
879   // Ensure layouting happens
880   application.SendNotification();
881   application.Render();
882
883   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 700.0f, 0.0f ), 0.0001f, TEST_LOCATION );
884   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 740.0f, 0.0f ), 0.0001f, TEST_LOCATION );
885
886   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
887   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
888
889   hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::END | Dali::Toolkit::LinearLayout::Alignment::BOTTOM );
890
891   // Ensure layouting happens
892   application.SendNotification();
893   application.Render();
894
895   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 440.0f, 700.0f, 0.0f ), 0.0001f, TEST_LOCATION );
896   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 420.0f, 740.0f, 0.0f ), 0.0001f, TEST_LOCATION );
897
898   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
899   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
900
901   hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::CENTER_HORIZONTAL | Dali::Toolkit::LinearLayout::Alignment::BOTTOM );
902
903   // Ensure layouting happens
904   application.SendNotification();
905   application.Render();
906
907   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 220.0f, 700.0f, 0.0f ), 0.0001f, TEST_LOCATION );
908   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 210.0f, 740.0f, 0.0f ), 0.0001f, TEST_LOCATION );
909
910   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
911   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
912
913   hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::CENTER_HORIZONTAL | Dali::Toolkit::LinearLayout::Alignment::CENTER_VERTICAL );
914
915   // Ensure layouting happens
916   application.SendNotification();
917   application.Render();
918
919   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 220.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
920   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 210.0f, 390.0f, 0.0f ), 0.0001f, TEST_LOCATION );
921
922   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
923   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
924
925   END_TEST;
926 }
927
928 int UtcDaliLayouting_HboxLayout_Weight(void)
929 {
930   ToolkitTestApplication application;
931   tet_infoline( " UtcDaliLayouting_HboxLayout_Weight - Test LinearLayout weight horizontally" );
932
933   Stage stage = Stage::GetCurrent();
934   auto hbox = Control::New();
935   auto hboxLayout = LinearLayout::New();
936   DevelControl::SetLayout( hbox, hboxLayout );
937   hbox.SetName( "HBox" );
938
939   std::vector<Control> controls;
940   controls.push_back( CreateLeafControl( 40, 40 ) );
941   controls.push_back( CreateLeafControl( 60, 40 ) );
942   controls.push_back( CreateLeafControl( 80, 40 ) );
943   controls.push_back( CreateLeafControl( 100, 40 ) );
944
945   // Set weight for each leaf to use quarter of available space
946   // 480 * 0.25, 480 * 0.25, 480 * 0.25, 480 * 0.25,
947   // width spec has to be set to 0 so not to consume any extra space.
948   for( auto&& iter : controls )
949   {
950     iter.SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.25f );
951     iter.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 0 );
952     iter.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
953     hbox.Add( iter );
954   }
955
956   hbox.SetParentOrigin( ParentOrigin::CENTER );
957   hbox.SetAnchorPoint( AnchorPoint::CENTER );
958   stage.Add( hbox );
959
960   // Ensure layouting happens
961   application.SendNotification();
962   application.Render();
963
964   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
965   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 120.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
966   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 240.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
967   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 360.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
968
969   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 120.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
970   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 120.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
971   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 120.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
972   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 120.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
973
974   // Set weight for 3, 4 leafs to use all remaining available space after 1, 2 content sized leafs.
975   // 40, 60, (480 - 40 - 60) * 0.5, (480 - 40 - 60) * 0.5
976   controls[0].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
977   controls[0].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
978   controls[1].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
979   controls[1].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
980   controls[2].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.5f );
981   controls[3].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.5f );
982
983   // Ensure layouting happens
984   application.SendNotification();
985   application.Render();
986
987   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
988   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 40.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
989   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
990   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 290.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
991
992   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
993   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
994   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 190.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
995   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 190.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
996
997   // Add intrinsic width for 3rd leaf so now we should get
998   // 40, 60, (480 - 40 - 60 - 80) * 0.5 + 80, (480 - 40 - 60 - 80) * 0.5
999   controls[2].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 80 );
1000
1001   // Ensure layouting happens
1002   application.SendNotification();
1003   application.Render();
1004
1005   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1006   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 40.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1007   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1008   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 330.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1009
1010   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1011   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1012   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 230.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1013   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 150.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1014
1015   controls[0].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 0 );
1016   controls[0].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.25f );
1017   controls[1].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 0 );
1018   controls[1].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.5f );
1019   controls[2].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 0 );
1020   controls[2].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.25f );
1021   controls[3].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 40 );
1022   controls[3].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
1023
1024   // Ensure layouting happens
1025   application.SendNotification();
1026   application.Render();
1027
1028   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1029   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 110.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1030   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 330.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1031   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 440.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1032
1033   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 110.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1034   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 220.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1035   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 110.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1036   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1037
1038   // WRAP_CONTENT doesn't affect weight
1039   controls[0].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
1040   controls[0].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
1041   controls[1].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
1042   controls[1].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
1043   controls[2].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
1044   controls[2].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
1045   controls[3].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
1046   controls[3].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 1 );
1047
1048   // Ensure layouting happens
1049   application.SendNotification();
1050   application.Render();
1051
1052   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1053   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 40.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1054   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1055   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 180.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1056
1057   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1058   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1059   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1060   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 300.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1061
1062   // MATCH_PARENT doesn't affect weight
1063   for( auto&& iter : controls )
1064   {
1065     iter.SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.25f );
1066     iter.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
1067     iter.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
1068   }
1069
1070   // Ensure layouting happens
1071   application.SendNotification();
1072   application.Render();
1073
1074   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1075   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 120.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1076   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 240.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1077   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 360.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1078
1079   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 120.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1080   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 120.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1081   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 120.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1082   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 120.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1083
1084   const Extents CONTROL_MARGIN = Extents( 10, 10, 0, 0 );
1085   for( auto&& iter : controls )
1086   {
1087     iter.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
1088     iter.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
1089     iter.SetProperty( Toolkit::Control::Property::MARGIN, CONTROL_MARGIN );
1090   }
1091
1092   controls[0].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
1093   controls[1].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
1094   controls[2].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
1095   controls[3].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 1 );
1096
1097   application.SendNotification();
1098   application.Render();
1099
1100   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 10.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1101   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 70.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1102   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 150.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1103   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 250.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1104
1105   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1106   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1107   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1108   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 220.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1109
1110   END_TEST;
1111 }
1112
1113 int UtcDaliLayouting_VboxLayout_Weight(void)
1114 {
1115   ToolkitTestApplication application;
1116   tet_infoline( " UtcDaliLayouting_VboxLayout_Weight - Test LinearLayout weight vertically" );
1117
1118   Stage stage = Stage::GetCurrent();
1119   auto vbox = Control::New();
1120   auto vboxLayout = LinearLayout::New();
1121   vboxLayout.SetOrientation( Dali::Toolkit::LinearLayout::Orientation::VERTICAL );
1122   DevelControl::SetLayout( vbox, vboxLayout );
1123   vbox.SetName( "VBox" );
1124
1125   std::vector<Control> controls;
1126   controls.push_back( CreateLeafControl( 40, 40 ) );
1127   controls.push_back( CreateLeafControl( 60, 60 ) );
1128   controls.push_back( CreateLeafControl( 80, 80 ) );
1129   controls.push_back( CreateLeafControl( 100, 100 ) );
1130
1131   // Set weight for each leaf to use quarter of available space
1132   // 800 * 0.25, 800 * 0.25, 800 * 0.25, 800 * 0.25,
1133   // width spec has to be set to 0 so not to consume any extra space.
1134   for( auto&& iter : controls )
1135   {
1136     iter.SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.25f );
1137     iter.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
1138     iter.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, 0 );
1139     vbox.Add( iter );
1140   }
1141
1142   vbox.SetParentOrigin( ParentOrigin::CENTER );
1143   vbox.SetAnchorPoint( AnchorPoint::CENTER );
1144   stage.Add( vbox );
1145
1146   // Ensure layouting happens
1147   application.SendNotification();
1148   application.Render();
1149
1150   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1151   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1152   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 400.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1153   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 600.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1154
1155   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1156   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1157   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1158   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1159
1160   // Set weight for 3, 4 leafs to use all remaining available space after 1, 2 content sized leafs.
1161   // 40, 60, (800 - 40 - 60) * 0.5, (800 - 40 - 60) * 0.5
1162   controls[0].SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
1163   controls[0].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
1164   controls[1].SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
1165   controls[1].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
1166   controls[2].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.5f );
1167   controls[3].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.5f );
1168
1169   // Ensure layouting happens
1170   application.SendNotification();
1171   application.Render();
1172
1173   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1174   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1175   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1176   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 450.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1177
1178   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1179   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1180   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1181   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1182
1183   // Add intrinsic width for 3rd leaf so now we should get
1184   // 40, 60, (800 - 40 - 60 - 100) * 0.5 + 100, (800 - 40 - 60 - 100) * 0.5
1185   controls[2].SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, 100 );
1186
1187   // Ensure layouting happens
1188   application.SendNotification();
1189   application.Render();
1190
1191   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1192   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1193   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1194   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 500.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1195
1196   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1197   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1198   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 400.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1199   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 300.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1200
1201   controls[0].SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, 0 );
1202   controls[0].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.25f );
1203   controls[1].SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, 0 );
1204   controls[1].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.5f );
1205   controls[2].SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, 0 );
1206   controls[2].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.25f );
1207   controls[3].SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, 100 );
1208   controls[3].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
1209
1210   // Ensure layouting happens
1211   application.SendNotification();
1212   application.Render();
1213
1214   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1215   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 175.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1216   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 525.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1217   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 700.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1218
1219   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 175.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1220   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1221   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 175.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1222   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1223
1224   // WRAP_CONTENT doesn't affect weight
1225   controls[0].SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
1226   controls[0].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
1227   controls[1].SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
1228   controls[1].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
1229   controls[2].SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
1230   controls[2].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
1231   controls[3].SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
1232   controls[3].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 1 );
1233
1234   // Ensure layouting happens
1235   application.SendNotification();
1236   application.Render();
1237
1238   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1239   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1240   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1241   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 180.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1242
1243   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1244   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1245   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1246   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 620.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1247
1248   // MATCH_PARENT doesn't affect weight
1249   for( auto&& iter : controls )
1250   {
1251     iter.SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.25f );
1252     iter.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
1253     iter.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
1254   }
1255
1256   // Ensure layouting happens
1257   application.SendNotification();
1258   application.Render();
1259
1260   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1261   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1262   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 400.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1263   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 600.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1264
1265   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1266   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1267   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1268   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1269
1270   const Extents CONTROL_MARGIN = Extents( 0, 0, 10, 10 );
1271   for( auto&& iter : controls )
1272   {
1273     iter.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
1274     iter.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
1275     iter.SetProperty( Toolkit::Control::Property::MARGIN, CONTROL_MARGIN );
1276   }
1277
1278   controls[0].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
1279   controls[1].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
1280   controls[2].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
1281   controls[3].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 1 );
1282
1283   application.SendNotification();
1284   application.Render();
1285
1286   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 10.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1287   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1288   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 150.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1289   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 250.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1290
1291   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1292   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1293   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1294   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 540.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1295
1296   END_TEST;
1297 }
1298
1299 int UtcDaliLayouting_NestedLinearLayout_Weight(void)
1300 {
1301   ToolkitTestApplication application;
1302   tet_infoline("UtcDaliLayouting_NestedLinearLayout_Weight - test weighted children with wrapped parent");
1303
1304   Stage stage = Stage::GetCurrent();
1305   auto rootControl = Control::New();
1306   rootControl.SetName( "AbsoluteLayout");
1307   auto rootLayout = AbsoluteLayout::New();
1308   DevelControl::SetLayout( rootControl, rootLayout );
1309   rootControl.SetAnchorPoint( AnchorPoint::CENTER );
1310   rootControl.SetParentOrigin( ParentOrigin::CENTER );
1311   stage.Add( rootControl );
1312
1313   auto hbox = Control::New();
1314   auto hboxLayout = LinearLayout::New();
1315   DevelControl::SetLayout( hbox, hboxLayout );
1316   hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
1317   hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
1318
1319   std::vector< Control > controls;
1320   controls.push_back( CreateLeafControl( 40, 40 ) );
1321   controls.push_back( CreateLeafControl( 60, 60 ) );
1322
1323   // set equal share of wrapped content width (40 + 60 = 100) for both children 100 * 0.5, 100 * 0.5
1324   for( auto&& iter : controls )
1325   {
1326     iter.SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.5f );
1327     iter.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 0 );
1328     iter.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
1329     hbox.Add( iter );
1330   }
1331
1332   hbox.SetParentOrigin( ParentOrigin::CENTER );
1333   hbox.SetAnchorPoint( AnchorPoint::CENTER );
1334   rootControl.Add( hbox );
1335
1336   // Ensure layouting happens
1337   application.SendNotification();
1338   application.Render();
1339
1340   DALI_TEST_EQUALS( hbox.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1341   DALI_TEST_EQUALS( hbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1342
1343   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 10.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1344   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 50.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1345
1346   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 50.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1347   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 50.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1348
1349   hboxLayout.SetOrientation(Dali::Toolkit::LinearLayout::Orientation::VERTICAL);
1350
1351   // set equal share of wrapped content height (40 + 60 = 100) for both children 100 * 0.5, 100 * 0.5
1352   for( auto&& iter : controls )
1353   {
1354     iter.SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.5f );
1355     iter.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
1356     iter.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, 0 );
1357   }
1358
1359   // Ensure layouting happens
1360   application.SendNotification();
1361   application.Render();
1362
1363   DALI_TEST_EQUALS( hbox.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1364   DALI_TEST_EQUALS( hbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1365
1366   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1367   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1368
1369   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1370   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1371
1372   END_TEST;
1373 }
1374
1375
1376 namespace
1377 {
1378 const char* TEST_IMAGE_FILE_NAME =  TEST_RESOURCE_DIR  "/broken.png";
1379 }
1380
1381 int UtcDaliLayouting_HboxLayout_ImageView(void)
1382 {
1383   ToolkitTestApplication application;
1384   tet_infoline(" UtcDaliLayouting_HboxLayout - Use image view for leaf");
1385
1386   Stage stage = Stage::GetCurrent();
1387   auto hbox = Control::New();
1388   auto hboxLayout = LinearLayout::New();
1389   DevelControl::SetLayout( hbox, hboxLayout );
1390   hbox.SetName( "HBox" );
1391
1392   std::string url = CreateImageURL( Vector4( 0, 255, 0, 255), ImageDimensions( 100, 100 ) );
1393   ImageView imageView = CreateImageView( url, ImageDimensions() );
1394
1395   hbox.SetParentOrigin( ParentOrigin::CENTER );
1396   hbox.SetAnchorPoint( AnchorPoint::CENTER );
1397   hbox.Add( imageView );
1398   stage.Add( hbox );
1399
1400   // Ensure layouting happens
1401   application.SendNotification();
1402   application.Render();
1403
1404   DALI_TEST_EQUALS( imageView.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1405   DALI_TEST_EQUALS( imageView.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1406
1407   url = CreateImageURL( Vector4( 0, 255, 0, 255), ImageDimensions( 200, 200 ) );
1408   imageView.SetImage( url );
1409
1410   // Ensure layouting happenss
1411   application.SendNotification();
1412   application.Render();
1413
1414   DALI_TEST_EQUALS( imageView.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 300.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1415   DALI_TEST_EQUALS( imageView.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 200.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1416
1417   imageView.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
1418   imageView.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
1419
1420   // Ensure layouting happenss
1421   application.SendNotification();
1422   application.Render();
1423
1424   DALI_TEST_EQUALS( imageView.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1425   DALI_TEST_EQUALS( imageView.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 200.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1426
1427   imageView.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
1428   imageView.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
1429
1430   // Ensure layouting happenss
1431   application.SendNotification();
1432   application.Render();
1433
1434   DALI_TEST_EQUALS( imageView.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 300.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1435   DALI_TEST_EQUALS( imageView.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1436
1437   imageView.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
1438   imageView.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
1439
1440   Image image = FrameBufferImage::New( 50, 50, Pixel::RGBA8888 );
1441   imageView.SetImage( image );
1442
1443   // Ensure layouting happenss
1444   application.SendNotification();
1445   application.Render();
1446
1447   DALI_TEST_EQUALS( imageView.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 375.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1448   DALI_TEST_EQUALS( imageView.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 50.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1449
1450   Property::Map imagePropertyMap;
1451   imagePropertyMap[ Toolkit::Visual::Property::TYPE ] = Toolkit::Visual::IMAGE;
1452   imagePropertyMap[ ImageVisual::Property::URL ] = TEST_IMAGE_FILE_NAME;
1453   imagePropertyMap[ ImageVisual::Property::DESIRED_WIDTH ] = 150;
1454   imagePropertyMap[ ImageVisual::Property::DESIRED_HEIGHT ] = 150;
1455   imageView.SetProperty( Toolkit::ImageView::Property::IMAGE, imagePropertyMap );
1456
1457   DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
1458   // Ensure layouting happenss
1459   application.SendNotification();
1460   application.Render();
1461
1462   DALI_TEST_EQUALS( imageView.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 325.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1463   DALI_TEST_EQUALS( imageView.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 150.0f, 150.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1464
1465   END_TEST;
1466 }
1467
1468 int UtcDaliLayouting_HboxLayout_TextLabel(void)
1469 {
1470   ToolkitTestApplication application;
1471   tet_infoline(" UtcDaliLayouting_HboxLayout - Use text label for leaf");
1472
1473   Stage stage = Stage::GetCurrent();
1474
1475   auto hbox = Control::New();
1476   auto hboxLayout = LinearLayout::New();
1477   DevelControl::SetLayout( hbox, hboxLayout );
1478   hbox.SetName( "HBox" );
1479   hbox.SetParentOrigin( ParentOrigin::CENTER );
1480   hbox.SetAnchorPoint( AnchorPoint::CENTER );
1481
1482   std::vector< Control > controls;
1483   TextLabel textLabel = CreateTextLabel( "W" );
1484   controls.push_back( textLabel );
1485   hbox.Add( textLabel );
1486   stage.Add( hbox );
1487
1488   // Ensure layouting happens
1489   application.SendNotification();
1490   application.Render();
1491
1492   DALI_TEST_EQUALS( textLabel.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 368.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1493   DALI_TEST_EQUALS( textLabel.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 54.0f, 64.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1494
1495   textLabel.SetProperty( TextLabel::Property::TEXT, "WWWW" );
1496
1497   // Ensure layouting happens
1498   application.SendNotification();
1499   application.Render();
1500
1501   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 368.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1502   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 216.0f, 64.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1503
1504   textLabel.SetProperty( TextLabel::Property::POINT_SIZE, 10.0f );
1505
1506   // Ensure layouting happens
1507   application.SendNotification();
1508   application.Render();
1509
1510   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 382.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1511   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 120.0f, 36.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1512
1513   controls[0].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
1514   controls[0].SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
1515
1516   // Ensure layouting happens
1517   application.SendNotification();
1518   application.Render();
1519
1520   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1521   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 120.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1522
1523   controls[0].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
1524   controls[0].SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
1525
1526   // Ensure layouting happens
1527   application.SendNotification();
1528   application.Render();
1529
1530   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 382.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1531   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 36.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1532
1533   END_TEST;
1534 }
1535
1536 // Padding tests
1537
1538 int UtcDaliLayouting_HboxLayout_Padding01(void)
1539 {
1540   ToolkitTestApplication application;
1541   tet_infoline("UtcDaliLayouting_HboxLayout_Padding01 - Adding Padding to a single child");
1542
1543   Stage stage = Stage::GetCurrent();
1544   auto hbox = Control::New();
1545   auto hboxLayout = LinearLayout::New();
1546   DevelControl::SetLayout( hbox, hboxLayout );
1547   hbox.SetName( "HBox");
1548
1549   std::vector< Control > controls;
1550   controls.push_back( CreateLeafControl( 40, 40 ) );
1551   controls.push_back( CreateLeafControl( 60, 40 ) );
1552   controls.push_back( CreateLeafControl( 80, 40 ) );
1553   controls.push_back( CreateLeafControl( 100, 40 ) );
1554
1555   const Extents CONTROL_PADDING = Extents(5, 10, 20, 2 );
1556   tet_printf( "\nAdding Padding to control at index %u \n", 1 );
1557   controls[1].SetProperty(Toolkit::Control::Property::PADDING, CONTROL_PADDING );
1558
1559   for( auto&& iter : controls )
1560   {
1561     hbox.Add( iter );
1562   }
1563   hbox.SetParentOrigin( ParentOrigin::CENTER );
1564   hbox.SetAnchorPoint( AnchorPoint::CENTER );
1565   stage.Add( hbox );
1566
1567   // Ensure layouting happens
1568   application.SendNotification();
1569   application.Render();
1570
1571   // hbox centers elements vertically, it fills test harness stage, which is 480x800.
1572   // hbox left justifies elements
1573   tet_infoline("Test Child Actor Position");
1574   float xPositionOfControlBeingTested = 0.0f;
1575   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
1576                                                                                             380.0f,
1577                                                                                             0.0f ), 0.0001f, TEST_LOCATION );
1578   xPositionOfControlBeingTested += 40.0f;
1579
1580   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
1581                                                                                             380.0f - ( ( CONTROL_PADDING.top + CONTROL_PADDING.bottom) * 0.5f ),                                                                                            0.0f ),
1582                                                                                             0.0001f, TEST_LOCATION );
1583
1584   xPositionOfControlBeingTested += 60.0f + CONTROL_PADDING.start + CONTROL_PADDING.end;
1585   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1586
1587   xPositionOfControlBeingTested += 80.0f;
1588   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1589
1590   tet_infoline("Test Child Actor Size");
1591   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1592
1593   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f + CONTROL_PADDING.start + CONTROL_PADDING.end,
1594                                                                                         40.0f + CONTROL_PADDING.top + CONTROL_PADDING.bottom , 0.0f ),
1595                                                                                         0.0001f, TEST_LOCATION );
1596
1597   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1598   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1599
1600   END_TEST;
1601 }
1602
1603 int UtcDaliLayouting_HboxLayout_Padding02(void)
1604 {
1605   ToolkitTestApplication application;
1606   tet_infoline("UtcDaliLayouting_HboxLayout_Padding02 - Adding Padding to a all children");
1607
1608   Stage stage = Stage::GetCurrent();
1609   auto hbox = Control::New();
1610   auto hboxLayout = LinearLayout::New();
1611   DevelControl::SetLayout( hbox, hboxLayout );
1612   hbox.SetName( "HBox");
1613
1614   std::vector< Control > controls;
1615   controls.push_back( CreateLeafControl( 40, 40 ) );
1616   controls.push_back( CreateLeafControl( 60, 40 ) );
1617   controls.push_back( CreateLeafControl( 80, 40 ) );
1618   controls.push_back( CreateLeafControl( 100, 40 ) );
1619
1620   const Extents CONTROL_PADDING = Extents(5, 10, 20, 2 );
1621
1622   for( auto&& iter : controls )
1623   {
1624     iter.SetProperty(Toolkit::Control::Property::PADDING, CONTROL_PADDING );
1625     hbox.Add( iter );
1626   }
1627   hbox.SetParentOrigin( ParentOrigin::CENTER );
1628   hbox.SetAnchorPoint( AnchorPoint::CENTER );
1629   stage.Add( hbox );
1630
1631   // Ensure layouting happens
1632   application.SendNotification();
1633   application.Render();
1634
1635   // hbox centers elements vertically, it fills test harness stage, which is 480x800.
1636   // hbox left justifies elements
1637   tet_infoline("Test Child Actor Position");
1638   float xPositionOfControlBeingTested = 0.0f;
1639   float yPositionOfControlBeingTested = ( 800.0f * 0.5) - ( 0.5 * ( 40.0f + CONTROL_PADDING.top + CONTROL_PADDING.bottom ) );
1640
1641   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
1642                                                                                             yPositionOfControlBeingTested,
1643                                                                                             0.0f ), 0.0001f, TEST_LOCATION );
1644   xPositionOfControlBeingTested += 40.0f + CONTROL_PADDING.start + CONTROL_PADDING.end;
1645
1646   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
1647                                                                                             yPositionOfControlBeingTested,
1648                                                                                             0.0f ),
1649                                                                                             0.0001f, TEST_LOCATION );
1650
1651   xPositionOfControlBeingTested += 60.0f + CONTROL_PADDING.start + CONTROL_PADDING.end;
1652   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
1653                                                                                             yPositionOfControlBeingTested,
1654                                                                                             0.0f ), 0.0001f, TEST_LOCATION );
1655
1656   xPositionOfControlBeingTested += 80.0f + CONTROL_PADDING.start + CONTROL_PADDING.end;
1657   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
1658                                                                                             yPositionOfControlBeingTested,
1659                                                                                             0.0f ), 0.0001f, TEST_LOCATION );
1660
1661   tet_infoline("Test Child Actor Size");
1662   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f + CONTROL_PADDING.start + CONTROL_PADDING.end,
1663                                                                                         40.0f + CONTROL_PADDING.top + CONTROL_PADDING.bottom,
1664                                                                                         0.0f ), 0.0001f, TEST_LOCATION );
1665
1666   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f + CONTROL_PADDING.start + CONTROL_PADDING.end,
1667                                                                                         40.0f + CONTROL_PADDING.top + CONTROL_PADDING.bottom,
1668                                                                                         0.0f ), 0.0001f, TEST_LOCATION );
1669
1670   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f + CONTROL_PADDING.start + CONTROL_PADDING.end ,
1671                                                                                         40.0f + CONTROL_PADDING.top + CONTROL_PADDING.bottom,
1672                                                                                         0.0f ), 0.0001f, TEST_LOCATION );
1673
1674   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f + CONTROL_PADDING.start + CONTROL_PADDING.end,
1675                                                                                         40.0f + CONTROL_PADDING.top + CONTROL_PADDING.bottom,
1676                                                                                         0.0f ), 0.0001f, TEST_LOCATION );
1677
1678   END_TEST;
1679 }
1680
1681
1682 int UtcDaliLayouting_HboxLayout_Padding03(void)
1683 {
1684   ToolkitTestApplication application;
1685   tet_infoline("UtcDaliLayouting_HboxLayout_Padding03 - Changing padding on a single child");
1686
1687   Stage stage = Stage::GetCurrent();
1688   auto hbox = Control::New();
1689   auto hboxLayout = LinearLayout::New();
1690   DevelControl::SetLayout( hbox, hboxLayout );
1691   hbox.SetName( "HBox");
1692
1693   std::vector< Control > controls;
1694   controls.push_back( CreateLeafControl( 40, 40 ) );
1695   controls.push_back( CreateLeafControl( 40, 40 ) );
1696   controls.push_back( CreateLeafControl( 40, 40 ) );
1697
1698   const Extents CONTROL_PADDING = Extents(5, 10, 20, 2 );
1699   tet_printf( "\nAdding Padding to control at index 1 \n" );
1700   controls[1].SetProperty(Toolkit::Control::Property::PADDING, CONTROL_PADDING );
1701
1702   for( auto&& iter : controls )
1703   {
1704     hbox.Add( iter );
1705   }
1706   hbox.SetParentOrigin( ParentOrigin::CENTER );
1707   hbox.SetAnchorPoint( AnchorPoint::CENTER );
1708   stage.Add( hbox );
1709
1710   // Ensure layouting happens
1711   application.SendNotification();
1712   application.Render();
1713
1714   // hbox centers elements vertically, it fills test harness stage, which is 480x800.
1715   // hbox left justifies elements
1716   tet_infoline("Test Child Actor Position");
1717   float xPositionOfControlBeingTested = 0.0f;
1718   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
1719                                                                                             380.0f,
1720                                                                                             0.0f ), 0.0001f, TEST_LOCATION );
1721   xPositionOfControlBeingTested += 40.0f;
1722
1723   DALI_TEST_EQUALS( controls[ 1 ].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
1724                                                                                             380.0f - ( ( CONTROL_PADDING.top + CONTROL_PADDING.bottom) * 0.5f ),                                                                                            0.0f ),
1725                                                                                             0.0001f, TEST_LOCATION );
1726
1727   xPositionOfControlBeingTested += 40.0f + CONTROL_PADDING.start + CONTROL_PADDING.end;
1728   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1729
1730   const Extents NEW_CONTROL_PADDING = Extents(10, 10, 20, 2 );
1731   tet_printf( "\nChanging Padding to control at index 1 \n" );
1732   controls[1].SetProperty(Toolkit::Control::Property::PADDING, NEW_CONTROL_PADDING );
1733
1734   // Ensure layouting happens
1735   application.SendNotification();
1736   application.Render();
1737
1738   xPositionOfControlBeingTested = 0.0f; // reset
1739
1740   tet_infoline("Test Child Actor Position");
1741   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
1742                                                                                             380.0f,
1743                                                                                             0.0f ), 0.0001f, TEST_LOCATION );
1744   xPositionOfControlBeingTested += 40.0f;
1745
1746   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
1747                                                                                             380.0f - ( ( NEW_CONTROL_PADDING.top + NEW_CONTROL_PADDING.bottom) * 0.5f ),                                                                                            0.0f ),
1748                                                                                             0.0001f, TEST_LOCATION );
1749
1750   xPositionOfControlBeingTested += 40.0f + NEW_CONTROL_PADDING.start + NEW_CONTROL_PADDING.end;
1751   tet_printf( "\nIf x position %u then change has not been processed \n", 40 + 40 + CONTROL_PADDING.start + CONTROL_PADDING.end );
1752   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1753
1754   tet_infoline("Test Child Actor Size");
1755   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ) , Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1756
1757   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ) , Vector3( 40.0f + NEW_CONTROL_PADDING.start + NEW_CONTROL_PADDING.end,
1758                                                                                         40.0f + NEW_CONTROL_PADDING.top + NEW_CONTROL_PADDING.bottom , 0.0f ),
1759                                                                                         0.0001f, TEST_LOCATION );
1760
1761   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ) , Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1762
1763   END_TEST;
1764 }
1765
1766 int UtcDaliLayouting_HboxLayout_Padding04(void)
1767 {
1768   ToolkitTestApplication application;
1769   tet_infoline("UtcDaliLayouting_HboxLayout_Padding04 - Adding Padding to the hbox");
1770
1771   // Adding padding to the layout should offset the positioning of the children.
1772
1773   const Extents LAYOUT_PADDING = Extents(5, 10, 20, 2 );
1774   const Size CONTROL_SIZE = Size( 40, 40 );
1775
1776   Stage stage = Stage::GetCurrent();
1777   // Create a root layout, ideally Dali would have a default layout in the root layer.
1778   // Without this root layer the LinearLayout (or any other layout) will not
1779   // honour WIDTH_SPECIFICATION or HEIGHT_SPECIFICATION settings.
1780   // It uses the default stage size and ideally should have a layout added to it.
1781   auto rootLayoutControl = Control::New();
1782   rootLayoutControl.SetName( "AbsoluteLayout");
1783   auto rootLayout = AbsoluteLayout::New();
1784   DevelControl::SetLayout( rootLayoutControl, rootLayout );
1785   rootLayoutControl.SetAnchorPoint( AnchorPoint::CENTER );
1786   rootLayoutControl.SetParentOrigin( ParentOrigin::CENTER );
1787   stage.Add( rootLayoutControl );
1788
1789   auto hbox = Control::New();
1790   auto hboxLayout = LinearLayout::New();
1791   hboxLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
1792   DevelControl::SetLayout( hbox, hboxLayout );
1793   hbox.SetName( "HBox");
1794   hbox.SetProperty(Toolkit::Control::Property::PADDING, LAYOUT_PADDING );
1795   hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
1796   hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
1797
1798   std::vector< Control > controls;
1799   controls.push_back( CreateLeafControl( CONTROL_SIZE.width, CONTROL_SIZE.height ) );
1800   controls.push_back( CreateLeafControl( CONTROL_SIZE.width, CONTROL_SIZE.height ) );
1801   controls.push_back( CreateLeafControl( CONTROL_SIZE.width, CONTROL_SIZE.height ) );
1802   controls.push_back( CreateLeafControl( CONTROL_SIZE.width, CONTROL_SIZE.height ) );
1803
1804   for( auto&& iter : controls )
1805   {
1806     hbox.Add( iter );
1807   }
1808
1809   hbox.SetParentOrigin( ParentOrigin::CENTER );
1810   hbox.SetAnchorPoint( AnchorPoint::CENTER );
1811   rootLayoutControl.Add( hbox );
1812
1813   // Ensure layouting happens
1814   application.SendNotification();
1815   application.Render();
1816
1817   // Extra update needed to Relayout one more time. Catches any position updates, false positive without this seen.
1818   application.SendNotification();
1819
1820   // hbox centers elements vertically, it fills test harness stage, which is 480x800.
1821   // hbox left justifies elements
1822   tet_infoline("Test Child Actor Position");
1823
1824   auto controlXPosition=0.0f;
1825
1826   controlXPosition = LAYOUT_PADDING.start;  // First child positioned at offset defined by the padding
1827   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( LAYOUT_PADDING.start,
1828                                                                                             LAYOUT_PADDING.top,
1829                                                                                             0.0f ), 0.0001f, TEST_LOCATION );
1830
1831   controlXPosition+=CONTROL_SIZE.width; // Second child positioned is the position of the first child + the first child's width.
1832   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( controlXPosition,
1833                                                                                             LAYOUT_PADDING.top,
1834                                                                                             0.0f ),
1835                                                                                             0.0001f, TEST_LOCATION );
1836
1837   controlXPosition+=CONTROL_SIZE.width; // Third child positioned adjacent to second
1838   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( controlXPosition,
1839                                                                                             LAYOUT_PADDING.top,
1840                                                                                             0.0f ), 0.0001f, TEST_LOCATION );
1841
1842   controlXPosition+=CONTROL_SIZE.width; // Forth passed adjacent to the third
1843   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( controlXPosition,
1844                                                                                             LAYOUT_PADDING.top,
1845                                                                                             0.0f ), 0.0001f, TEST_LOCATION );
1846
1847   auto totalControlsWidth = CONTROL_SIZE.width * controls.size();
1848   auto totalControlsHeight = CONTROL_SIZE.height;
1849
1850   DALI_TEST_EQUALS( hbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( totalControlsWidth + LAYOUT_PADDING.start + LAYOUT_PADDING.end,
1851                                                                                  totalControlsHeight + LAYOUT_PADDING.top + LAYOUT_PADDING.bottom,
1852                                                                                  0.0f ), 0.0001f, TEST_LOCATION );
1853
1854
1855   END_TEST;
1856 }
1857
1858 int UtcDaliLayouting_HboxLayout_Padding05(void)
1859 {
1860   ToolkitTestApplication application;
1861   tet_infoline("UtcDaliLayouting_HboxLayout_Padding05 - Changing the hbox Padding");
1862
1863   // Adding padding to the layout should offset the positioning of the children.
1864
1865   const Extents LAYOUT_PADDING = Extents(5, 10, 20, 2 );
1866   const Size CONTROL_SIZE = Size( 40, 40 );
1867
1868   Stage stage = Stage::GetCurrent();
1869   // Create a root layout, ideally Dali would have a default layout in the root layer.
1870   // Without this root layer the LinearLayout (or any other layout) will not
1871   // honour WIDTH_SPECIFICATION or HEIGHT_SPECIFICATION settings.
1872   // It uses the default stage size and ideally should have a layout added to it.
1873   auto rootLayoutControl = Control::New();
1874   rootLayoutControl.SetName( "AbsoluteLayout");
1875   auto rootLayout = AbsoluteLayout::New();
1876   DevelControl::SetLayout( rootLayoutControl, rootLayout );
1877   rootLayoutControl.SetAnchorPoint( AnchorPoint::CENTER );
1878   rootLayoutControl.SetParentOrigin( ParentOrigin::CENTER );
1879   stage.Add( rootLayoutControl );
1880
1881   auto hbox = Control::New();
1882   auto hboxLayout = LinearLayout::New();
1883   hboxLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
1884   DevelControl::SetLayout( hbox, hboxLayout );
1885   hbox.SetName( "HBox");
1886   hbox.SetProperty(Toolkit::Control::Property::PADDING, LAYOUT_PADDING );
1887   hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
1888   hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
1889
1890   std::vector< Control > controls;
1891   controls.push_back( CreateLeafControl( CONTROL_SIZE.width, CONTROL_SIZE.height ) );
1892   controls.push_back( CreateLeafControl( CONTROL_SIZE.width, CONTROL_SIZE.height ) );
1893   controls.push_back( CreateLeafControl( CONTROL_SIZE.width, CONTROL_SIZE.height ) );
1894   controls.push_back( CreateLeafControl( CONTROL_SIZE.width, CONTROL_SIZE.height ) );
1895
1896   for( auto&& iter : controls )
1897   {
1898     hbox.Add( iter );
1899   }
1900
1901   hbox.SetParentOrigin( ParentOrigin::CENTER );
1902   hbox.SetAnchorPoint( AnchorPoint::CENTER );
1903   rootLayoutControl.Add( hbox );
1904
1905   // Ensure layouting happens
1906   application.SendNotification();
1907   application.Render();
1908
1909   // Extra update needed to Relayout one more time. Catches any position updates, false positive without this seen.
1910   application.SendNotification();
1911
1912   // hbox centers elements vertically, it fills test harness stage, which is 480x800.
1913   // hbox left justifies elements
1914   tet_infoline("Test Child Actor Position");
1915
1916   auto controlXPosition=0.0f;
1917
1918   controlXPosition = LAYOUT_PADDING.start;  // First child positioned at offset defined by the padding
1919   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( LAYOUT_PADDING.start,
1920                                                                                             LAYOUT_PADDING.top,
1921                                                                                             0.0f ), 0.0001f, TEST_LOCATION );
1922
1923   controlXPosition+=CONTROL_SIZE.width; // Second child positioned is the position of the first child + the first child's width.
1924   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( controlXPosition,
1925                                                                                             LAYOUT_PADDING.top,
1926                                                                                             0.0f ),
1927                                                                                             0.0001f, TEST_LOCATION );
1928
1929   controlXPosition+=CONTROL_SIZE.width; // Third child positioned adjacent to second
1930   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( controlXPosition,
1931                                                                                             LAYOUT_PADDING.top,
1932                                                                                             0.0f ), 0.0001f, TEST_LOCATION );
1933
1934   controlXPosition+=CONTROL_SIZE.width; // Forth passed adjacent to the third
1935   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( controlXPosition,
1936                                                                                             LAYOUT_PADDING.top,
1937                                                                                             0.0f ), 0.0001f, TEST_LOCATION );
1938
1939   auto totalControlsWidth = CONTROL_SIZE.width * controls.size();
1940   auto totalControlsHeight = CONTROL_SIZE.height;
1941
1942   DALI_TEST_EQUALS( hbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( totalControlsWidth + LAYOUT_PADDING.start + LAYOUT_PADDING.end,
1943                                                                                  totalControlsHeight + LAYOUT_PADDING.top + LAYOUT_PADDING.bottom,
1944                                                                                  0.0f ), 0.0001f, TEST_LOCATION );
1945
1946   // Change layout padding
1947   const Extents NEW_LAYOUT_PADDING = Extents(5, 20, 10, 2 );
1948   tet_printf( "\nChanging Padding to control at index 1 \n" );
1949   hbox.SetProperty(Toolkit::Control::Property::PADDING, NEW_LAYOUT_PADDING );
1950
1951   // Ensure layouting happens
1952   application.SendNotification();
1953   application.Render();
1954
1955   // Extra update needed to Relayout one more time. Catches any position updates, false positive without this seen.
1956   application.SendNotification();
1957
1958   controlXPosition = NEW_LAYOUT_PADDING.start;  // First child positioned at offset defined by the padding
1959   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( NEW_LAYOUT_PADDING.start,
1960                                                                                             NEW_LAYOUT_PADDING.top,
1961                                                                                             0.0f ), 0.0001f, TEST_LOCATION );
1962
1963   controlXPosition+=CONTROL_SIZE.width; // Second child positioned is the position of the first child + the first child's width.
1964   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( controlXPosition,
1965                                                                                             NEW_LAYOUT_PADDING.top,
1966                                                                                             0.0f ),
1967                                                                                             0.0001f, TEST_LOCATION );
1968
1969   controlXPosition+=CONTROL_SIZE.width; // Third child positioned adjacent to second
1970   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( controlXPosition,
1971                                                                                             NEW_LAYOUT_PADDING.top,
1972                                                                                             0.0f ), 0.0001f, TEST_LOCATION );
1973
1974   controlXPosition+=CONTROL_SIZE.width; // Forth passed adjacent to the third
1975   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( controlXPosition,
1976                                                                                             NEW_LAYOUT_PADDING.top,
1977                                                                                             0.0f ), 0.0001f, TEST_LOCATION );
1978   totalControlsWidth = CONTROL_SIZE.width * controls.size();
1979   totalControlsHeight = CONTROL_SIZE.height;
1980
1981   DALI_TEST_EQUALS( hbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( totalControlsWidth + NEW_LAYOUT_PADDING.start + NEW_LAYOUT_PADDING.end,
1982                                                                                  totalControlsHeight + NEW_LAYOUT_PADDING.top + NEW_LAYOUT_PADDING.bottom,
1983                                                                                  0.0f ), 0.0001f, TEST_LOCATION );
1984   END_TEST;
1985 }
1986
1987 // Margin Tests
1988
1989 int UtcDaliLayouting_HboxLayout_Margin01(void)
1990 {
1991   ToolkitTestApplication application;
1992   tet_infoline("UtcDaliLayouting_HboxLayout_Margin01 - Adding a margin to a single child");
1993
1994   Stage stage = Stage::GetCurrent();
1995   auto hbox = Control::New();
1996   auto hboxLayout = LinearLayout::New();
1997   DevelControl::SetLayout( hbox, hboxLayout );
1998   hbox.SetName( "HBox");
1999
2000   std::vector< Control > controls;
2001   controls.push_back( CreateLeafControl( 40, 40 ) );
2002   controls.push_back( CreateLeafControl( 60, 40 ) );
2003   controls.push_back( CreateLeafControl( 80, 40 ) );
2004   controls.push_back( CreateLeafControl( 100, 40 ) );
2005
2006   const Extents CONTROL_MARGIN = Extents(5, 10, 20, 0 );
2007   tet_printf( "\nAdding Margin to control at index 1 \n" );
2008   controls[1].SetProperty(Toolkit::Control::Property::MARGIN, CONTROL_MARGIN );
2009
2010   for( auto&& iter : controls )
2011   {
2012     hbox.Add( iter );
2013   }
2014   hbox.SetParentOrigin( ParentOrigin::CENTER );
2015   hbox.SetAnchorPoint( AnchorPoint::CENTER );
2016   stage.Add( hbox );
2017
2018   // Ensure layouting happens
2019   application.SendNotification();
2020   application.Render();
2021
2022   // hbox centers elements vertically, it fills test harness stage, which is 480x800.
2023   // hbox left justifies elements
2024   tet_infoline("Test Child Actor Position");
2025   auto xPositionOfControlBeingTested = 0.0f;
2026   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
2027                                                                                             380.0f,
2028                                                                                             0.0f ), 0.0001f, TEST_LOCATION );
2029   xPositionOfControlBeingTested += 40.0f + CONTROL_MARGIN.start;
2030
2031   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
2032                                                                                             380.0f + CONTROL_MARGIN.top, 0.0f ),
2033                                                                                             0.0001f, TEST_LOCATION );
2034
2035   xPositionOfControlBeingTested += 60.0f + CONTROL_MARGIN.end;
2036   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2037
2038   xPositionOfControlBeingTested += 80.0f;
2039   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2040
2041   tet_infoline("Test Child Actor Size is the same after Margin added");
2042   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2043   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 40.0f , 0.0f ), 0.0001f, TEST_LOCATION );
2044   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2045   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2046
2047   END_TEST;
2048 }
2049
2050
2051 int UtcDaliLayouting_VboxLayout01(void)
2052 {
2053   ToolkitTestApplication application;
2054   tet_infoline(" UtcDaliLayouting_VboxLayout01");
2055
2056   Stage stage = Stage::GetCurrent();
2057   auto vbox = Control::New();
2058   auto vboxLayout = LinearLayout::New();
2059   vboxLayout.SetOrientation( LinearLayout::Orientation::VERTICAL );
2060   vboxLayout.SetAlignment( LinearLayout::Alignment::TOP | LinearLayout::Alignment::CENTER_HORIZONTAL );
2061   DevelControl::SetLayout( vbox, vboxLayout );
2062   vbox.SetName( "Vbox");
2063
2064   std::vector< Control > controls;
2065   controls.push_back( CreateLeafControl( 40, 40 ) );
2066   controls.push_back( CreateLeafControl( 60, 60 ) );
2067   controls.push_back( CreateLeafControl( 80, 80 ) );
2068   controls.push_back( CreateLeafControl( 100, 100 ) );
2069
2070   for( auto&& iter : controls )
2071   {
2072     vbox.Add( iter );
2073   }
2074   vbox.SetParentOrigin( ParentOrigin::CENTER );
2075   vbox.SetAnchorPoint( AnchorPoint::CENTER );
2076   stage.Add( vbox );
2077
2078   controls[2].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
2079
2080   // Check it.
2081   DALI_TEST_EQUALS( controls[2].GetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION ), Property::Value( ChildLayoutData::MATCH_PARENT ), TEST_LOCATION );
2082
2083   // Ensure layouting happens
2084   application.SendNotification();
2085   application.Render();
2086
2087   // vbox centers elements horizontally, it fills test harness stage, which is 480x800.
2088   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 220.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2089   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 210.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2090   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2091   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 190.0f, 180.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2092
2093   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2094   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2095   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2096   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2097
2098   END_TEST;
2099 }
2100
2101 int UtcDaliLayouting_VboxLayout02(void)
2102 {
2103   ToolkitTestApplication application;
2104   tet_infoline(" UtcDaliLayouting_VboxLayout01");
2105
2106   Stage stage = Stage::GetCurrent();
2107
2108   // @todo Can't set specification properties on root control. Really need to make LayoutController a root
2109   // LayoutGroup for this to happen automatically.
2110   //
2111   // For this test, add an hbox instead
2112   auto rootControl = Control::New();
2113   auto absoluteLayout = AbsoluteLayout::New();
2114   DevelControl::SetLayout( rootControl, absoluteLayout );
2115   rootControl.SetName( "AbsoluteLayout");
2116   stage.Add( rootControl );
2117
2118   auto vbox = Control::New();
2119   auto vboxLayout = LinearLayout::New();
2120   vboxLayout.SetOrientation( LinearLayout::Orientation::VERTICAL );
2121   vboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::TOP | Dali::Toolkit::LinearLayout::Alignment::CENTER_HORIZONTAL );
2122   DevelControl::SetLayout( vbox, vboxLayout );
2123   vbox.SetName( "Vbox");
2124   rootControl.Add( vbox );
2125
2126   vbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
2127   vbox.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
2128
2129   std::vector< Control > controls;
2130   controls.push_back( CreateLeafControl( 40, 40 ) );
2131   controls.push_back( CreateLeafControl( 60, 60 ) );
2132   controls.push_back( CreateLeafControl( 80, 80 ) );
2133   controls.push_back( CreateLeafControl( 100, 100 ) );
2134
2135   for( auto&& iter : controls )
2136   {
2137     vbox.Add( iter );
2138   }
2139   vbox.SetParentOrigin( ParentOrigin::CENTER );
2140   vbox.SetAnchorPoint( AnchorPoint::CENTER );
2141
2142   controls[2].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
2143
2144   // Check it.
2145   DALI_TEST_EQUALS( controls[2].GetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION ), Property::Value( ChildLayoutData::MATCH_PARENT ), TEST_LOCATION );
2146
2147   // Ensure layouting happens
2148   application.SendNotification();
2149   application.Render();
2150
2151   DALI_TEST_EQUALS( rootControl.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(0,0,0),TEST_LOCATION);
2152   DALI_TEST_EQUALS( rootControl.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(480,800,0),TEST_LOCATION);
2153
2154   // vbox centers elements horizontally, it should wrap it's content horizontally, i.e. it should take the width of the largest element (100)
2155   DALI_TEST_EQUALS( vbox.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2156   DALI_TEST_EQUALS( vbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2157
2158   // 3rd control is set to match parent - this should also be 100 wide
2159   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 30.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2160   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 20.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2161   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2162   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 180.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2163
2164   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2165   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2166   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2167   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2168
2169   END_TEST;
2170 }
2171
2172
2173 int UtcDaliLayouting_VboxLayout03(void)
2174 {
2175   ToolkitTestApplication application;
2176   tet_infoline(" UtcDaliLayouting_VboxLayout03 test with cell padding set");
2177
2178   Stage stage = Stage::GetCurrent();
2179
2180   // @todo Can't set specification properties on root control. Really need to make LayoutController a root
2181   // LayoutGroup for this to happen automatically.
2182   //
2183   // For this test, add an hbox instead
2184   auto hbox = Control::New();
2185   auto hboxLayout = LinearLayout::New();
2186   DevelControl::SetLayout( hbox, hboxLayout );
2187   hbox.SetName( "Hbox");
2188   stage.Add( hbox );
2189
2190   auto vbox = Control::New();
2191   auto vboxLayout = LinearLayout::New();
2192   vboxLayout.SetCellPadding( LayoutSize( 0, 10 ) );
2193   vboxLayout.SetOrientation( LinearLayout::Orientation::VERTICAL );
2194   vboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::TOP | Dali::Toolkit::LinearLayout::Alignment::CENTER_HORIZONTAL );
2195
2196   DALI_TEST_EQUALS( vboxLayout.GetCellPadding(), LayoutSize( 0, 10 ), TEST_LOCATION );
2197
2198   DevelControl::SetLayout( vbox, vboxLayout );
2199   vbox.SetName( "Vbox");
2200   hbox.Add( vbox );
2201
2202   vbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
2203   vbox.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
2204
2205   std::vector< Control > controls;
2206   controls.push_back( CreateLeafControl( 40, 40 ) );
2207   controls.push_back( CreateLeafControl( 60, 60 ) );
2208   controls.push_back( CreateLeafControl( 80, 80 ) );
2209   controls.push_back( CreateLeafControl( 100, 100 ) );
2210
2211   for( auto&& iter : controls )
2212   {
2213     vbox.Add( iter );
2214   }
2215   vbox.SetParentOrigin( ParentOrigin::CENTER );
2216   vbox.SetAnchorPoint( AnchorPoint::CENTER );
2217
2218   controls[2].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
2219
2220   // Check it.
2221   DALI_TEST_EQUALS( controls[2].GetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION ), Property::Value( ChildLayoutData::MATCH_PARENT ), TEST_LOCATION );
2222
2223   // Ensure layouting happens
2224   application.SendNotification();
2225   application.Render();
2226
2227   DALI_TEST_EQUALS( hbox.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(0,0,0),TEST_LOCATION);
2228   DALI_TEST_EQUALS( hbox.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(480,800,0),TEST_LOCATION);
2229
2230   // vbox centers elements horizontally, it should wrap it's content horizontally, i.e. it should take the width of the largest element (100)
2231   DALI_TEST_EQUALS( vbox.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2232   DALI_TEST_EQUALS( vbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2233
2234   // 3rd control is set to match parent - this should also be 100 wide
2235   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 30.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2236   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 20.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2237   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 120.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2238   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 210.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2239
2240   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2241   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2242   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2243   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2244
2245   END_TEST;
2246 }
2247
2248 int UtcDaliLayouting_VboxLayout_Padding(void)
2249 {
2250   ToolkitTestApplication application;
2251   tet_infoline("UtcDaliLayouting_VboxLayout_Padding - Adding Padding to the vbox");
2252
2253   // Adding padding to the layout should offset the positioning of the children.
2254
2255   const Extents LAYOUT_PADDING = Extents(5, 10, 20, 2 );
2256   const Size CONTROL_SIZE = Size( 40, 40 );
2257
2258   Stage stage = Stage::GetCurrent();
2259   // Create a root layout, ideally Dali would have a default layout in the root layer.
2260   // Without this root layer the LinearLayout (or any other layout) will not
2261   // honour WIDTH_SPECIFICATION or HEIGHT_SPECIFICATION settings.
2262   // It uses the default stage size and ideally should have a layout added to it.
2263   auto rootLayoutControl = Control::New();
2264   rootLayoutControl.SetName( "AbsoluteLayout");
2265   auto rootLayout = AbsoluteLayout::New();
2266   DevelControl::SetLayout( rootLayoutControl, rootLayout );
2267   rootLayoutControl.SetAnchorPoint( AnchorPoint::CENTER );
2268   rootLayoutControl.SetParentOrigin( ParentOrigin::CENTER );
2269   stage.Add( rootLayoutControl );
2270
2271   auto vbox = Control::New();
2272   auto vboxLayout = LinearLayout::New();
2273   vboxLayout.SetOrientation( LinearLayout::Orientation::VERTICAL );
2274   DevelControl::SetLayout( vbox, vboxLayout );
2275   vbox.SetName( "VBox");
2276   vbox.SetProperty( Toolkit::Control::Property::PADDING, LAYOUT_PADDING );
2277   vbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
2278   vbox.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
2279
2280   std::vector< Control > controls;
2281   controls.push_back( CreateLeafControl( CONTROL_SIZE.width, CONTROL_SIZE.height ) );
2282   controls.push_back( CreateLeafControl( CONTROL_SIZE.width, CONTROL_SIZE.height ) );
2283   controls.push_back( CreateLeafControl( CONTROL_SIZE.width, CONTROL_SIZE.height ) );
2284   controls.push_back( CreateLeafControl( CONTROL_SIZE.width, CONTROL_SIZE.height ) );
2285
2286   for( auto&& iter : controls )
2287   {
2288     vbox.Add( iter );
2289   }
2290
2291   vbox.SetParentOrigin( ParentOrigin::CENTER );
2292   vbox.SetAnchorPoint( AnchorPoint::CENTER );
2293   rootLayoutControl.Add( vbox );
2294
2295   // Ensure layouting happens
2296   application.SendNotification();
2297   application.Render();
2298
2299   // Extra update needed to Relayout one more time. Catches any position updates, false positive without this seen.
2300   application.SendNotification();
2301
2302   // vbox centers elements horizontally, it fills test harness stage, which is 480x800.
2303   tet_infoline("Test Child Actor Position");
2304
2305   auto controlYPosition = 0.0f;
2306
2307   controlYPosition = LAYOUT_PADDING.top;  // First child positioned at offset defined by the padding
2308   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( LAYOUT_PADDING.start,
2309                                                                                             LAYOUT_PADDING.top,
2310                                                                                             0.0f ), 0.0001f, TEST_LOCATION );
2311
2312   controlYPosition += CONTROL_SIZE.height; // Second child positioned is the position of the first child + the first child's height.
2313   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( LAYOUT_PADDING.start,
2314                                                                                             controlYPosition,
2315                                                                                             0.0f ),
2316                                                                                             0.0001f, TEST_LOCATION );
2317
2318   controlYPosition += CONTROL_SIZE.height; // Third child positioned adjacent to second
2319   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( LAYOUT_PADDING.start,
2320                                                                                             controlYPosition,
2321                                                                                             0.0f ), 0.0001f, TEST_LOCATION );
2322
2323   controlYPosition += CONTROL_SIZE.height; // Forth passed adjacent to the third
2324   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( LAYOUT_PADDING.start,
2325                                                                                             controlYPosition,
2326                                                                                             0.0f ), 0.0001f, TEST_LOCATION );
2327
2328   auto totalControlsWidth = CONTROL_SIZE.width;
2329   auto totalControlsHeight = CONTROL_SIZE.height * controls.size();
2330
2331   DALI_TEST_EQUALS( vbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( totalControlsWidth + LAYOUT_PADDING.start + LAYOUT_PADDING.end,
2332                                                                                  totalControlsHeight + LAYOUT_PADDING.top + LAYOUT_PADDING.bottom,
2333                                                                                  0.0f ), 0.0001f, TEST_LOCATION );
2334
2335   END_TEST;
2336 }
2337
2338
2339 int UtcDaliLayouting_RelayoutOnChildOrderChanged(void)
2340 {
2341   ToolkitTestApplication application;
2342   tet_infoline(" UtcDaliLayouting_RelayoutOnChildOrderChanged");
2343   tet_infoline(" Test that if the sibling order changes, the container is re-laid out automatically");
2344
2345   Stage stage = Stage::GetCurrent();
2346
2347   auto hbox = Control::New();
2348   auto hboxLayout = Test::CustomLayout::New();
2349   DevelControl::SetLayout( hbox, hboxLayout );
2350   hbox.SetName( "HBox");
2351
2352   std::vector< Control > controls;
2353   controls.push_back( CreateLeafControl( 40, 40 ) );
2354   controls.push_back( CreateLeafControl( 60, 40 ) );
2355   controls.push_back( CreateLeafControl( 80, 40 ) );
2356   controls.push_back( CreateLeafControl( 100, 40 ) );
2357
2358   for( auto&& iter : controls )
2359   {
2360     hbox.Add( iter );
2361   }
2362   hbox.SetParentOrigin( ParentOrigin::CENTER );
2363   hbox.SetAnchorPoint( AnchorPoint::CENTER );
2364   stage.Add( hbox );
2365
2366   // Ensure layouting happens
2367   application.SendNotification();
2368   application.Render();
2369
2370   // hbox centers elements vertically, it fills test harness stage, which is 480x800.
2371   // hbox left justifies elements
2372   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2373   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 40.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2374   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2375   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 180.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2376
2377   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2378   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2379   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2380   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2381
2382   controls[0].RaiseToTop(); // 0->3; 1, 2, 3, 0
2383   controls[2].Lower();      // 2->1; 2, 1, 3, 0
2384
2385   application.SendNotification();
2386   application.Render();
2387
2388   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2389   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 80.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2390   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 140.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2391   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 240.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2392
2393   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2394   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2395   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2396   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2397
2398   END_TEST;
2399 }
2400
2401 int UtcDaliLayouting_HboxLayout_TargetSize(void)
2402 {
2403   ToolkitTestApplication application;
2404   tet_infoline(" UtcDaliLayouting_HboxLayout07 - Set target size on leaf");
2405
2406   Stage stage = Stage::GetCurrent();
2407   auto hbox = Control::New();
2408   auto hboxLayout = LinearLayout::New();
2409   DevelControl::SetLayout( hbox, hboxLayout );
2410   hbox.SetName( "HBox");
2411
2412   std::vector< Control > controls;
2413   controls.push_back( CreateLeafControl( 40, 40 ) );
2414   for( auto&& iter : controls )
2415   {
2416     iter.SetSize( 100, 100 );
2417     hbox.Add( iter );
2418   }
2419   hbox.SetParentOrigin( ParentOrigin::CENTER );
2420   hbox.SetAnchorPoint( AnchorPoint::CENTER );
2421   stage.Add( hbox );
2422
2423   // Ensure layouting happens
2424   application.SendNotification();
2425   application.Render();
2426
2427   // hbox centers elements vertically, it fills test harness stage, which is 480x800 from left to right.
2428   // hbox left justifies elements
2429   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2430   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2431
2432   END_TEST;
2433 }
2434
2435 int UtcDaliLayouting_RemoveLayout01(void)
2436 {
2437   ToolkitTestApplication application;
2438   tet_infoline(" UtcDaliLayouting_RemoveLayout");
2439
2440   Stage stage = Stage::GetCurrent();
2441
2442   auto rootControl = Control::New();
2443   auto absoluteLayout = AbsoluteLayout::New();
2444   DevelControl::SetLayout( rootControl, absoluteLayout );
2445   rootControl.SetName( "AbsoluteLayout" );
2446   stage.Add( rootControl );
2447
2448   auto hbox = Control::New();
2449   auto hboxLayout = LinearLayout::New();
2450   hboxLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
2451   DevelControl::SetLayout( hbox, hboxLayout );
2452   hbox.SetName( "HBox" );
2453
2454   std::vector< Control > controls;
2455   controls.push_back( CreateLeafControl( 40, 40 ) );
2456   controls.push_back( CreateLeafControl( 60, 40 ) );
2457
2458   for( auto&& iter : controls )
2459   {
2460     hbox.Add( iter );
2461   }
2462   hbox.SetParentOrigin( ParentOrigin::CENTER );
2463   hbox.SetAnchorPoint( AnchorPoint::CENTER );
2464   rootControl.Add( hbox );
2465
2466   tet_infoline("Layout as normal");
2467   application.SendNotification();
2468   application.Render();
2469
2470   tet_infoline("Set an empty layout on hbox container");
2471   LinearLayout emptyLayout;
2472   DevelControl::SetLayout( hbox, emptyLayout );
2473
2474   tet_infoline("Run another layout");
2475   application.SendNotification();
2476   application.Render();
2477
2478   tet_infoline("Check leaf controls haven't moved");
2479
2480   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2481   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 40.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2482
2483   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2484   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2485
2486   END_TEST;
2487 }
2488
2489 int UtcDaliLayouting_LayoutChildren01(void)
2490 {
2491   ToolkitTestApplication application;
2492   tet_infoline(" UtcDaliLayouting_LayoutChildren01");
2493
2494   Stage stage = Stage::GetCurrent();
2495
2496   auto rootControl = Control::New();
2497   auto absoluteLayout = AbsoluteLayout::New();
2498   DevelControl::SetLayout( rootControl, absoluteLayout );
2499   stage.Add( rootControl );
2500
2501   auto hbox = Control::New();
2502   auto hboxLayout = LinearLayout::New();
2503   DevelControl::SetLayout( hbox, hboxLayout );
2504   rootControl.Add( hbox );
2505
2506   DALI_TEST_EQUALS( absoluteLayout.GetChildCount(), 1, TEST_LOCATION );
2507
2508   tet_infoline("Test removal by setting empty layout to child container" );
2509   DevelControl::SetLayout( hbox, LayoutItem{} );
2510
2511   DALI_TEST_EQUALS( absoluteLayout.GetChildCount(), 0, TEST_LOCATION );
2512
2513   auto& hboxImpl = GetImplementation( hboxLayout );
2514   Handle empty;
2515   DALI_TEST_EQUALS( hboxLayout.GetOwner(), empty, TEST_LOCATION );
2516   DALI_TEST_EQUALS( (void*)hboxImpl.GetParent(), (void*)nullptr, TEST_LOCATION );
2517
2518   // For coverage
2519   hboxImpl.SetLayoutRequested();
2520
2521   END_TEST;
2522 }
2523
2524 int UtcDaliLayouting_LayoutChildren02(void)
2525 {
2526   ToolkitTestApplication application;
2527   tet_infoline(" UtcDaliLayouting_LayoutChildren02");
2528
2529   Stage stage = Stage::GetCurrent();
2530
2531   auto rootControl = Control::New();
2532   auto absoluteLayout = AbsoluteLayout::New();
2533   DevelControl::SetLayout( rootControl, absoluteLayout );
2534   stage.Add( rootControl );
2535
2536   auto hbox = Control::New();
2537   auto hboxLayout = LinearLayout::New();
2538   DevelControl::SetLayout( hbox, hboxLayout );
2539   rootControl.Add( hbox );
2540
2541   DALI_TEST_EQUALS( absoluteLayout.GetChildCount(), 1, TEST_LOCATION );
2542
2543   tet_infoline("Test removal by removing child actor from parent container" );
2544   hbox.Unparent();
2545
2546   DALI_TEST_EQUALS( absoluteLayout.GetChildCount(), 0, TEST_LOCATION );
2547
2548   auto& hboxImpl = GetImplementation( hboxLayout );
2549   tet_infoline("Test child actor still has hbox layout " );
2550   DALI_TEST_EQUALS( (bool)hboxLayout.GetOwner(), true, TEST_LOCATION );
2551
2552   tet_infoline("Test hbox layout has no parent " );
2553   DALI_TEST_EQUALS( (void*)hboxImpl.GetParent(), (void*)nullptr, TEST_LOCATION );
2554
2555   END_TEST;
2556 }
2557
2558 int UtcDaliLayouting_LayoutChildren03(void)
2559 {
2560   ToolkitTestApplication application;
2561   tet_infoline(" UtcDaliLayouting_LayoutChildren02");
2562
2563   Stage stage = Stage::GetCurrent();
2564
2565   auto rootControl = Control::New();
2566   auto absoluteLayout = AbsoluteLayout::New();
2567   DevelControl::SetLayout( rootControl, absoluteLayout );
2568   stage.Add( rootControl );
2569
2570   auto hbox = Control::New();
2571   auto hboxLayout = LinearLayout::New();
2572   DevelControl::SetLayout( hbox, hboxLayout );
2573   rootControl.Add( hbox );
2574
2575   DALI_TEST_EQUALS( absoluteLayout.GetChildCount(), 1, TEST_LOCATION );
2576
2577   tet_infoline("Test removal by removing child layout from parent layout" );
2578   absoluteLayout.Remove( hboxLayout );
2579
2580   DALI_TEST_EQUALS( absoluteLayout.GetChildCount(), 0, TEST_LOCATION );
2581
2582   auto& hboxImpl = GetImplementation( hboxLayout );
2583
2584   tet_infoline("Check child actor has orphaned layout (Moving child keeps old layout)");
2585   DALI_TEST_EQUALS( hboxLayout.GetOwner(), hbox, TEST_LOCATION );
2586   DALI_TEST_EQUALS( DevelControl::GetLayout(hbox), hboxLayout, TEST_LOCATION );
2587
2588   tet_infoline("Check orphaned layout has no parent");
2589   DALI_TEST_EQUALS( (void*)hboxImpl.GetParent(), (void*)nullptr, TEST_LOCATION );
2590
2591   END_TEST;
2592 }
2593
2594
2595 int UtcDaliLayouting_LayoutChildren04(void)
2596 {
2597   ToolkitTestApplication application;
2598   tet_infoline(" UtcDaliLayouting_LayoutChildren03");
2599
2600   Stage stage = Stage::GetCurrent();
2601
2602   auto rootControl = Control::New();
2603   auto absoluteLayout = AbsoluteLayout::New();
2604   DevelControl::SetLayout( rootControl, absoluteLayout );
2605   stage.Add( rootControl );
2606
2607   auto hbox = Control::New();
2608   tet_infoline("Test unparenting by adding child with no layout to parent (should auto-generate LayoutItem) ");
2609   auto hboxLayout = LinearLayout::New();
2610   rootControl.Add( hbox );
2611
2612   DALI_TEST_EQUALS( absoluteLayout.GetChildCount(), 1, TEST_LOCATION );
2613
2614   tet_infoline("Then setting a layout on the child container");
2615   DevelControl::SetLayout( hbox, hboxLayout );
2616
2617   DALI_TEST_EQUALS( absoluteLayout.GetChildCount(), 1, TEST_LOCATION );
2618
2619   auto& hboxImpl = GetImplementation( hboxLayout );
2620   auto& absImpl = GetImplementation( absoluteLayout );
2621   DALI_TEST_EQUALS( hboxLayout.GetOwner(), Handle(hbox), TEST_LOCATION );
2622   DALI_TEST_EQUALS( hboxImpl.GetParent(), (Dali::Toolkit::Internal::LayoutParent*)&absImpl, TEST_LOCATION );
2623
2624   END_TEST;
2625 }
2626
2627 int UtcDaliLayouting_SetLayoutOrder01(void)
2628 {
2629   ToolkitTestApplication application;
2630   tet_infoline(" UtcDaliLayouting_SetLayoutOrder01 - Call SetLayout after adding the control to the root layout");
2631
2632   Stage stage = Stage::GetCurrent();
2633
2634   auto rootControl = Control::New();
2635   auto absoluteLayout = AbsoluteLayout::New();
2636   DevelControl::SetLayout( rootControl, absoluteLayout );
2637   rootControl.SetName( "AbsoluteLayout" );
2638   stage.Add( rootControl );
2639
2640   tet_infoline(" UtcDaliLayouting_SetLayoutOrder - Creating control");
2641   auto hbox = Control::New();
2642   auto hboxLayout = LinearLayout::New();
2643   hbox.SetName( "HBox");
2644
2645   tet_infoline(" UtcDaliLayouting_SetLayoutOrder - Add control to root layout");
2646   rootControl.Add( hbox );
2647
2648   tet_infoline(" UtcDaliLayouting_SetLayoutOrder - Set layout to control AFTER control added to root");
2649   DevelControl::SetLayout( hbox, hboxLayout );
2650
2651   // Add a Child control
2652   std::vector< Control > controls;
2653   controls.push_back( CreateLeafControl( 100, 100 ) ); // Single control
2654   for( auto&& iter : controls )
2655   {
2656     hbox.Add( iter );
2657   }
2658
2659   // Ensure layouting happens
2660   application.SendNotification();
2661   application.Render();
2662
2663   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
2664
2665   END_TEST;
2666 }
2667
2668 int UtcDaliLayouting_SetLayoutOrder02(void)
2669 {
2670   ToolkitTestApplication application;
2671   tet_infoline(" UtcDaliLayouting_SetLayoutOrder02 - Test the layout item order and the control order");
2672
2673   Stage stage = Stage::GetCurrent();
2674
2675   auto rootControl = Control::New();
2676   auto absoluteLayout = AbsoluteLayout::New();
2677   DevelControl::SetLayout( rootControl, absoluteLayout );
2678   rootControl.SetName( "AbsoluteLayout" );
2679   stage.Add( rootControl );
2680
2681   auto hbox = Control::New();
2682   auto hboxLayout = LinearLayout::New();
2683   hbox.SetName( "HBox");
2684
2685   rootControl.Add( hbox );
2686
2687   DevelControl::SetLayout( hbox, hboxLayout );
2688
2689   // Add child controls
2690   std::vector< Control > controls;
2691   controls.push_back( CreateLeafControl( 100, 100 ) );  // 0
2692   controls.push_back( CreateLeafControl( 100, 100 ) );  // 1
2693   controls.push_back( CreateLeafControl( 100, 100 ) );  // 2
2694
2695   for( auto&& iter : controls )
2696   {
2697     hbox.Add( iter );
2698   }
2699
2700   // Ensure layouting happens
2701   application.SendNotification();
2702   application.Render();
2703
2704   TestLayoutItemOrder( controls, hboxLayout );
2705
2706   tet_infoline("RaiseToTop");
2707
2708   controls[0].RaiseToTop(); // 1 2 0
2709
2710   TestLayoutItemOrder( controls, hboxLayout );
2711
2712   tet_infoline("LowerToBottom");
2713
2714   controls[2].LowerToBottom();  // 2 1 0
2715
2716   TestLayoutItemOrder( controls, hboxLayout );
2717
2718   tet_infoline("Remove / Add");
2719
2720   hbox.Remove( controls[2] );  // 1 0
2721   hbox.Add( controls[2] );     // 1 0 2
2722
2723   TestLayoutItemOrder( controls, hboxLayout );
2724
2725   tet_infoline("SetLayout");
2726
2727   auto vboxLayout = LinearLayout::New();
2728   DevelControl::SetLayout( controls[0], vboxLayout );
2729
2730   TestLayoutItemOrder( controls, hboxLayout );
2731
2732   tet_infoline("Raise");
2733
2734   controls[0].Raise();  // 1 2 0
2735
2736   TestLayoutItemOrder( controls, hboxLayout );
2737
2738   tet_infoline("Lower");
2739
2740   controls[2].Lower();   // 2 1 0
2741
2742   TestLayoutItemOrder( controls, hboxLayout );
2743
2744   tet_infoline("SetLayout again");
2745
2746   auto vboxLayout1 = LinearLayout::New();
2747   DevelControl::SetLayout( controls[2], vboxLayout1 );
2748
2749   TestLayoutItemOrder( controls, hboxLayout );
2750
2751   DevelControl::SetLayout( controls[2], vboxLayout );
2752
2753   END_TEST;
2754 }