4246d16ff063efd062d77e416ff1fa463d8514a7
[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
22 #include <dali-toolkit/dali-toolkit.h>
23 #include <dali-toolkit/devel-api/controls/control-devel.h>
24 #include <dali-toolkit/devel-api/layouting/absolute-layout.h>
25 #include <dali-toolkit/devel-api/layouting/linear-layout.h>
26
27 #include <layout-utils.h>
28
29 using namespace Dali;
30 using namespace Toolkit;
31
32 void utc_dali_toolkit_layouting_startup(void)
33 {
34   test_return_value = TET_UNDEF;
35 }
36
37 void utc_dali_toolkit_layouting_cleanup(void)
38 {
39   test_return_value = TET_PASS;
40 }
41
42 int UtcDaliLayouting_HboxLayout01(void)
43 {
44   ToolkitTestApplication application;
45   tet_infoline(" UtcDaliLayouting_HboxLayout01");
46
47   Stage stage = Stage::GetCurrent();
48   auto hbox = Control::New();
49   auto hboxLayout = LinearLayout::New();
50   hboxLayout.SetCellPadding( LayoutSize( 10, 0 ) );
51   DevelControl::SetLayout( hbox, hboxLayout );
52   hbox.SetName( "HBox");
53
54   std::vector< Control > controls;
55   controls.push_back( CreateLeafControl( 40, 40 ) );
56   controls.push_back( CreateLeafControl( 60, 40 ) );
57   controls.push_back( CreateLeafControl( 80, 40 ) );
58   controls.push_back( CreateLeafControl( 100, 40 ) );
59
60   for( auto&& iter : controls )
61   {
62     hbox.Add( iter );
63   }
64   hbox.SetParentOrigin( ParentOrigin::CENTER );
65   hbox.SetAnchorPoint( AnchorPoint::CENTER );
66   stage.Add( hbox );
67
68   // Ensure layouting happens
69   application.SendNotification();
70   application.Render();
71
72   // hbox centers elements vertically, it fills test harness stage, which is 480x800.
73   // hbox left justifies elements
74   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
75   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 50.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
76   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 120.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
77   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 210.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
78
79   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
80   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
81   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
82   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
83
84   // Change a layout
85   auto newHBoxLayout = LinearLayout::New();
86   newHBoxLayout.SetCellPadding( LayoutSize( 10, 0 ) );
87   DevelControl::SetLayout( hbox, newHBoxLayout );
88
89   application.SendNotification();
90   application.Render();
91
92   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
93   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 50.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
94   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 120.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
95   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 210.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
96
97   END_TEST;
98 }
99
100 int UtcDaliLayouting_HboxLayout02(void)
101 {
102   ToolkitTestApplication application;
103   tet_infoline(" UtcDaliLayouting_HboxLayout02 Test nested hboxes with default spec of WRAP_CONTENT");
104
105   Stage stage = Stage::GetCurrent();
106
107   auto hbox1 = Control::New();
108   auto hboxLayout1 = LinearLayout::New();
109   DevelControl::SetLayout( hbox1, hboxLayout1 );
110
111   auto hbox2 = Control::New();
112   auto hboxLayout2 = LinearLayout::New();
113   DevelControl::SetLayout( hbox2, hboxLayout2 );
114
115   hbox1.SetName( "HBox1");
116   hbox2.SetName( "HBox2");
117
118   std::vector< Control > controls;
119   controls.push_back( CreateLeafControl( 20, 40 ) );
120   controls.push_back( CreateLeafControl( 30, 50 ) );
121   controls.push_back( CreateLeafControl( 40, 60 ) );
122   controls.push_back( CreateLeafControl( 50, 70 ) );
123
124   controls.push_back( CreateLeafControl( 25, 40 ) );
125   controls.push_back( CreateLeafControl( 35, 50 ) );
126   controls.push_back( CreateLeafControl( 45, 60 ) );
127   controls.push_back( CreateLeafControl( 55, 70 ) );
128
129   int counter=0;
130   for( auto&& iter : controls )
131   {
132     if( counter < 4 )
133     {
134       hbox1.Add( iter );
135     }
136     else
137     {
138       hbox2.Add( iter );
139     }
140     ++counter;
141   }
142   hbox1.SetParentOrigin( ParentOrigin::CENTER );
143   hbox1.SetAnchorPoint( AnchorPoint::CENTER );
144   hbox2.SetParentOrigin( ParentOrigin::CENTER );
145   hbox2.SetAnchorPoint( AnchorPoint::CENTER );
146
147   auto hbox3 = Control::New();
148   auto hboxLayout3 = LinearLayout::New();
149   DevelControl::SetLayout( hbox3, hboxLayout3 );
150
151   hbox3.SetParentOrigin( ParentOrigin::CENTER );
152   hbox3.SetName( "HBox3");
153   hbox3.Add( hbox1 );
154   hbox3.Add( hbox2 );
155
156   stage.Add( hbox3 );
157
158   // Ensure layouting happens
159   application.SendNotification();
160   application.Render();
161
162
163   // hbox centers elements vertically, it fills test harness stage, which is 480x800.
164   // hbox left justifies elements
165   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3(  0.0f, 15.0f, 0.0f ), 0.0001f, TEST_LOCATION );
166   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 20.0f, 10.0f, 0.0f ), 0.0001f, TEST_LOCATION );
167   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 50.0f,  5.0f, 0.0f ), 0.0001f, TEST_LOCATION );
168   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 90.0f,  0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
169
170   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 20.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
171   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 30.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
172   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
173   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 50.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
174
175
176   DALI_TEST_EQUALS( controls[4].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3(  0.0f, 15.0f, 0.0f ), 0.0001f, TEST_LOCATION );
177   DALI_TEST_EQUALS( controls[5].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 25.0f, 10.0f, 0.0f ), 0.0001f, TEST_LOCATION );
178   DALI_TEST_EQUALS( controls[6].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 60.0f,  5.0f, 0.0f ), 0.0001f, TEST_LOCATION );
179   DALI_TEST_EQUALS( controls[7].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 105.0f,  0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
180
181   DALI_TEST_EQUALS( controls[4].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 25.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
182   DALI_TEST_EQUALS( controls[5].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 35.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
183   DALI_TEST_EQUALS( controls[6].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 45.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
184   DALI_TEST_EQUALS( controls[7].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 55.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
185
186   // Test hbox1 and 2 are sized to wrap their content
187   DALI_TEST_EQUALS( hbox1.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 140.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
188   DALI_TEST_EQUALS( hbox2.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 160.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
189   DALI_TEST_EQUALS( hbox1.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 365.0f, 0.0f ), 0.0001f, TEST_LOCATION );
190   DALI_TEST_EQUALS( hbox2.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 140.0f, 365.0f, 0.0f ), 0.0001f, TEST_LOCATION );
191
192   // Test hbox3 matches parent (root layer)
193   DALI_TEST_EQUALS( hbox3.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
194   DALI_TEST_EQUALS( hbox3.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
195
196   END_TEST;
197 }
198
199
200 int UtcDaliLayouting_HboxLayout03(void)
201 {
202   ToolkitTestApplication application;
203   tet_infoline(" UtcDaliLayouting_HboxLayout03 Test nested hboxes with MATCH_PARENT");
204
205   Stage stage = Stage::GetCurrent();
206
207   auto hbox1 = Control::New();
208   auto hboxLayout1 = LinearLayout::New();
209   DevelControl::SetLayout( hbox1, hboxLayout1 );
210
211   auto hbox2 = Control::New();
212   auto hboxLayout2 = LinearLayout::New();
213   DevelControl::SetLayout( hbox2, hboxLayout2 );
214
215   hbox1.SetName( "HBox1");
216   hbox2.SetName( "HBox2");
217   hbox1.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
218   hbox1.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
219   hbox2.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
220   hbox2.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
221
222   std::vector< Control > controls;
223   controls.push_back( CreateLeafControl( 20, 40 ) );
224   controls.push_back( CreateLeafControl( 30, 50 ) );
225   controls.push_back( CreateLeafControl( 40, 60 ) );
226   controls.push_back( CreateLeafControl( 50, 70 ) );
227
228   controls.push_back( CreateLeafControl( 25, 40 ) );
229   controls.push_back( CreateLeafControl( 35, 50 ) );
230   controls.push_back( CreateLeafControl( 45, 60 ) );
231   controls.push_back( CreateLeafControl( 55, 70 ) );
232
233   int counter=0;
234   for( auto&& iter : controls )
235   {
236     if( counter < 4 )
237     {
238       hbox1.Add( iter );
239     }
240     else
241     {
242       hbox2.Add( iter );
243     }
244     ++counter;
245   }
246   hbox1.SetParentOrigin( ParentOrigin::CENTER );
247   hbox1.SetAnchorPoint( AnchorPoint::CENTER );
248   hbox2.SetParentOrigin( ParentOrigin::CENTER );
249   hbox2.SetAnchorPoint( AnchorPoint::CENTER );
250
251   auto hbox3 = Control::New();
252   auto hboxLayout3 = LinearLayout::New();
253   DevelControl::SetLayout( hbox3, hboxLayout3);
254
255   hbox3.SetParentOrigin( ParentOrigin::CENTER );
256   hbox3.SetName( "HBox3");
257   hbox3.Add( hbox1 );
258   hbox3.Add( hbox2 );
259
260   stage.Add( hbox3 );
261
262   //std::ostringstream oss;
263   //DumpControlHierarchy( oss, Stage::GetCurrent().GetRootLayer() );
264   //printf("Control hierarchy: \n%s\n", oss.str().c_str() );
265
266   // Ensure layouting happens
267   application.SendNotification();
268   application.Render();
269
270
271   // hbox centers elements vertically, it fills test harness stage, which is 480x800.
272   // hbox left justifies elements
273   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
274   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 20.0f,375.0f, 0.0f ), 0.0001f, TEST_LOCATION );
275   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 50.0f,370.0f, 0.0f ), 0.0001f, TEST_LOCATION );
276   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 90.0f,365.0f, 0.0f ), 0.0001f, TEST_LOCATION );
277
278   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 20.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
279   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 30.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
280   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
281   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 50.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
282
283   DALI_TEST_EQUALS( controls[4].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3(  0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
284   DALI_TEST_EQUALS( controls[5].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 25.0f, 375.0f, 0.0f ), 0.0001f, TEST_LOCATION );
285   DALI_TEST_EQUALS( controls[6].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 60.0f, 370.0f, 0.0f ), 0.0001f, TEST_LOCATION );
286   DALI_TEST_EQUALS( controls[7].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 105.0f,365.0f, 0.0f ), 0.0001f, TEST_LOCATION );
287
288   DALI_TEST_EQUALS( controls[4].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 25.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
289   DALI_TEST_EQUALS( controls[5].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 35.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
290   DALI_TEST_EQUALS( controls[6].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 45.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
291   DALI_TEST_EQUALS( controls[7].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 55.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
292
293   DALI_TEST_EQUALS( hbox1.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
294   DALI_TEST_EQUALS( hbox2.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
295   DALI_TEST_EQUALS( hbox1.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
296   DALI_TEST_EQUALS( hbox2.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 480.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
297
298   // Test hbox3 matches parent (root layer)
299   DALI_TEST_EQUALS( hbox3.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
300   DALI_TEST_EQUALS( hbox3.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
301
302   END_TEST;
303 }
304
305 int UtcDaliLayouting_HboxLayout04(void)
306 {
307   ToolkitTestApplication application;
308   tet_infoline(" UtcDaliLayouting_HboxLayout04 Test nested hboxes with explicit WRAP_CONTENT");
309
310   Stage stage = Stage::GetCurrent();
311
312   auto hbox1 = Control::New();
313   auto hboxLayout1 = LinearLayout::New();
314   DevelControl::SetLayout( hbox1, hboxLayout1 );
315
316   auto hbox2 = Control::New();
317   auto hboxLayout2 = LinearLayout::New();
318   DevelControl::SetLayout( hbox2, hboxLayout2 );
319
320   hbox1.SetName( "HBox1"); // Default spec is to wrap content
321   hbox2.SetName( "HBox2");
322   hbox1.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
323   hbox1.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
324   hbox2.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
325   hbox2.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
326
327   std::vector< Control > controls;
328   controls.push_back( CreateLeafControl( 80, 40 ) );
329   controls.push_back( CreateLeafControl( 80, 50 ) );
330   controls.push_back( CreateLeafControl( 80, 60 ) );
331   controls.push_back( CreateLeafControl( 80, 70 ) );
332
333   controls.push_back( CreateLeafControl( 80, 40 ) );
334   controls.push_back( CreateLeafControl( 80, 50 ) );
335   controls.push_back( CreateLeafControl( 80, 60 ) );
336   controls.push_back( CreateLeafControl( 80, 70 ) );
337
338   int counter=0;
339   for( auto&& iter : controls )
340   {
341     if( counter < 4 )
342     {
343       hbox1.Add( iter );
344     }
345     else
346     {
347       hbox2.Add( iter );
348     }
349     ++counter;
350   }
351
352   controls[6].SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
353   auto hbox3 = Control::New();
354   auto hboxLayout3 = LinearLayout::New();
355   DevelControl::SetLayout( hbox3, hboxLayout3 );
356
357   hbox3.SetParentOrigin( ParentOrigin::CENTER );
358   hbox3.SetName( "HBox3");
359   hbox3.Add( hbox1 );
360   hbox3.Add( hbox2 );
361   stage.Add( hbox3 );
362
363   //std::ostringstream oss;
364   //DumpControlHierarchy( oss, Stage::GetCurrent().GetRootLayer() );
365   //printf("Control hierarchy: \n%s\n", oss.str().c_str() );
366
367   // Ensure layouting happens
368   application.SendNotification();
369   application.Render();
370
371
372   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 15.0f, 0.0f ), 0.0001f, TEST_LOCATION );
373   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 80.0f,10.0f, 0.0f ), 0.0001f, TEST_LOCATION );
374   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 160.0f, 5.0f, 0.0f ), 0.0001f, TEST_LOCATION );
375   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 240.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
376
377   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
378   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
379   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
380   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
381
382   DALI_TEST_EQUALS( controls[4].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3(  0.0f, 15.0f, 0.0f ), 0.0001f, TEST_LOCATION );
383   DALI_TEST_EQUALS( controls[5].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 80.0f, 10.0f, 0.0f ), 0.0001f, TEST_LOCATION );
384   DALI_TEST_EQUALS( controls[6].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 160.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
385   DALI_TEST_EQUALS( controls[7].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 240.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
386
387   DALI_TEST_EQUALS( controls[4].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
388   DALI_TEST_EQUALS( controls[5].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
389   DALI_TEST_EQUALS( controls[6].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
390   DALI_TEST_EQUALS( controls[7].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
391
392   DALI_TEST_EQUALS( hbox1.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 320.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
393   DALI_TEST_EQUALS( hbox2.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 320.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
394   DALI_TEST_EQUALS( hbox1.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 365.0f, 0.0f ), 0.0001f, TEST_LOCATION );
395   DALI_TEST_EQUALS( hbox2.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 320.0f, 365.0f, 0.0f ), 0.0001f, TEST_LOCATION );
396
397
398   // Test hbox3 matches parent (root layer)
399   DALI_TEST_EQUALS( hbox3.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
400   DALI_TEST_EQUALS( hbox3.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
401
402   END_TEST;
403 }
404
405 int UtcDaliLayouting_HboxLayout05(void)
406 {
407   ToolkitTestApplication application;
408   tet_infoline(" UtcDaliLayouting_HboxLayout05 - Set children size explicitly via width & height specification");
409
410   Stage stage = Stage::GetCurrent();
411   auto hbox = Control::New();
412   auto hboxLayout = LinearLayout::New();
413   hboxLayout.SetCellPadding( LayoutSize( 10, 0 ) );
414   DevelControl::SetLayout( hbox, hboxLayout );
415   hbox.SetName( "HBox");
416
417   std::vector< Control > controls;
418   controls.push_back( CreateLeafControl( 40, 40 ) );
419   controls.push_back( CreateLeafControl( 60, 40 ) );
420   controls.push_back( CreateLeafControl( 80, 40 ) );
421   controls.push_back( CreateLeafControl( 100, 40 ) );
422
423   for( auto&& iter : controls )
424   {
425     hbox.Add( iter );
426     iter.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 100 );
427     iter.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, 50 );
428   }
429
430   hbox.SetParentOrigin( ParentOrigin::CENTER );
431   hbox.SetAnchorPoint( AnchorPoint::CENTER );
432   stage.Add( hbox );
433
434   // Ensure layouting happens
435   application.SendNotification();
436   application.Render();
437
438   // hbox centers elements vertically, it fills test harness stage, which is 480x800.
439   // hbox left justifies elements
440   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 375.0f, 0.0f ), 0.0001f, TEST_LOCATION );
441   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 110.0f, 375.0f, 0.0f ), 0.0001f, TEST_LOCATION );
442   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 220.0f, 375.0f, 0.0f ), 0.0001f, TEST_LOCATION );
443   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 330.0f, 375.0f, 0.0f ), 0.0001f, TEST_LOCATION );
444
445   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
446   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
447   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
448   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
449
450   END_TEST;
451 }
452
453 int UtcDaliLayouting_HboxLayout06(void)
454 {
455   ToolkitTestApplication application;
456   tet_infoline(" UtcDaliLayouting_HboxLayout06 - Test nested layouts");
457
458   Stage stage = Stage::GetCurrent();
459
460   auto rootControl = Control::New();
461   auto absoluteLayout = AbsoluteLayout::New();
462   DevelControl::SetLayout( rootControl, absoluteLayout );
463   rootControl.SetName( "AbsoluteLayout" );
464   stage.Add( rootControl );
465
466   auto hbox = Control::New();
467   auto hboxLayout = LinearLayout::New();
468   hboxLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
469   DevelControl::SetLayout( hbox, hboxLayout );
470   hbox.SetName( "HBox" );
471
472   std::vector< Control > controls;
473   controls.push_back( CreateLeafControl( 40, 40 ) );
474   controls.push_back( CreateLeafControl( 60, 40 ) );
475
476   for( auto&& iter : controls )
477   {
478     hbox.Add( iter );
479   }
480   hbox.SetParentOrigin( ParentOrigin::CENTER );
481   hbox.SetAnchorPoint( AnchorPoint::CENTER );
482   rootControl.Add( hbox );
483
484   // Ensure layouting happens
485   application.SendNotification();
486   application.Render();
487
488   // hbox centers elements vertically, it fills test harness stage, which is 480x800.
489   // hbox left justifies elements
490   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
491   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 40.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
492
493   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
494   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
495
496   DALI_TEST_EQUALS( hbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
497
498   // Change a layout
499   auto newHBoxLayout = LinearLayout::New();
500   newHBoxLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
501   DevelControl::SetLayout( hbox, newHBoxLayout );
502
503   hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
504   hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
505
506   application.SendNotification();
507   application.Render();
508
509   DALI_TEST_EQUALS( hbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
510
511   // Change size specification
512   hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
513   hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
514
515   application.SendNotification();
516   application.Render();
517
518   DALI_TEST_EQUALS( hbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
519
520   // Use WRAP_CONTENT again
521   hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
522   hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
523
524   application.SendNotification();
525   application.Render();
526
527   DALI_TEST_EQUALS( hbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
528
529   END_TEST;
530 }
531
532
533 int UtcDaliLayouting_HboxLayout07(void)
534 {
535   ToolkitTestApplication application;
536   tet_infoline(" UtcDaliLayouting_HboxLayout07 - Set LTR/RTL direction");
537
538   Stage stage = Stage::GetCurrent();
539   auto hbox = Control::New();
540   auto hboxLayout = LinearLayout::New();
541   hboxLayout.SetCellPadding( LayoutSize( 10, 0 ) );
542   DevelControl::SetLayout( hbox, hboxLayout );
543   hbox.SetName( "HBox");
544
545   std::vector< Control > controls;
546   controls.push_back( CreateLeafControl( 40, 40 ) );
547   controls.push_back( CreateLeafControl( 60, 40 ) );
548   controls.push_back( CreateLeafControl( 80, 40 ) );
549   controls.push_back( CreateLeafControl( 100, 40 ) );
550
551   for( auto&& iter : controls )
552   {
553     hbox.Add( iter );
554   }
555   hbox.SetParentOrigin( ParentOrigin::CENTER );
556   hbox.SetAnchorPoint( AnchorPoint::CENTER );
557   stage.Add( hbox );
558
559   hbox.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT );
560
561   // Ensure layouting happens
562   application.SendNotification();
563   application.Render();
564
565   // hbox centers elements vertically, it fills test harness stage, which is 480x800 from left to right.
566   // hbox left justifies elements
567   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
568   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 50.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
569   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 120.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
570   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 210.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
571
572   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
573   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
574   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
575   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
576
577   hbox.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT );
578
579   // Ensure layouting happens
580   application.SendNotification();
581   application.Render();
582
583   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 470.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
584   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 400.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
585   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 310.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
586   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 200.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
587
588   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
589   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
590   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
591   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
592
593   END_TEST;
594 }
595
596 int UtcDaliLayouting_HboxLayout08(void)
597 {
598   ToolkitTestApplication application;
599   tet_infoline(" UtcDaliLayouting_HboxLayout08 - Test layout animation");
600
601   Stage stage = Stage::GetCurrent();
602
603   auto rootControl = Control::New();
604   auto absoluteLayout = AbsoluteLayout::New();
605   absoluteLayout.SetAnimateLayout( true );
606   DevelControl::SetLayout( rootControl, absoluteLayout );
607   rootControl.SetName( "AbsoluteLayout" );
608   stage.Add( rootControl );
609
610   Control control1 = CreateLeafControl( 40, 40 );
611   rootControl.Add( control1 );
612
613   auto hbox = Control::New();
614   auto hboxLayout = LinearLayout::New();
615   hboxLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
616   DevelControl::SetLayout( hbox, hboxLayout );
617   hbox.SetName( "HBox" );
618
619   Control control2 = CreateLeafControl( 40, 40 );
620   hbox.Add( control2 );
621
622   hbox.SetParentOrigin( ParentOrigin::CENTER );
623   hbox.SetAnchorPoint( AnchorPoint::CENTER );
624   rootControl.Add( hbox );
625
626   DALI_TEST_EQUALS( absoluteLayout.IsLayoutAnimated(), true, TEST_LOCATION );
627   DALI_TEST_EQUALS( DevelControl::GetLayout( control1 ).IsLayoutAnimated(), true, TEST_LOCATION );
628   DALI_TEST_EQUALS( hboxLayout.IsLayoutAnimated(), false, TEST_LOCATION );
629   DALI_TEST_EQUALS( DevelControl::GetLayout( control2 ).IsLayoutAnimated(), false, TEST_LOCATION );
630
631   hboxLayout.SetAnimateLayout( true );
632   absoluteLayout.SetAnimateLayout( false );
633
634   DALI_TEST_EQUALS( absoluteLayout.IsLayoutAnimated(), false, TEST_LOCATION );
635   DALI_TEST_EQUALS( DevelControl::GetLayout( control1 ).IsLayoutAnimated(), false, TEST_LOCATION );
636   DALI_TEST_EQUALS( hboxLayout.IsLayoutAnimated(), true, TEST_LOCATION );
637   DALI_TEST_EQUALS( DevelControl::GetLayout( control2 ).IsLayoutAnimated(), true, TEST_LOCATION );
638
639   END_TEST;
640 }
641
642 // Padding tests
643
644 int UtcDaliLayouting_HboxLayout_Padding01(void)
645 {
646   ToolkitTestApplication application;
647   tet_infoline("UtcDaliLayouting_HboxLayout_Padding01 - Adding Padding to a single child");
648
649   Stage stage = Stage::GetCurrent();
650   auto hbox = Control::New();
651   auto hboxLayout = LinearLayout::New();
652   DevelControl::SetLayout( hbox, hboxLayout );
653   hbox.SetName( "HBox");
654
655   std::vector< Control > controls;
656   controls.push_back( CreateLeafControl( 40, 40 ) );
657   controls.push_back( CreateLeafControl( 60, 40 ) );
658   controls.push_back( CreateLeafControl( 80, 40 ) );
659   controls.push_back( CreateLeafControl( 100, 40 ) );
660
661   const Extents CONTROL_PADDING = Extents(5, 10, 20, 2 );
662   tet_printf( "\nAdding Padding to control at index %u \n", 1 );
663   controls[1].SetProperty(Toolkit::Control::Property::PADDING, CONTROL_PADDING );
664
665   for( auto&& iter : controls )
666   {
667     hbox.Add( iter );
668   }
669   hbox.SetParentOrigin( ParentOrigin::CENTER );
670   hbox.SetAnchorPoint( AnchorPoint::CENTER );
671   stage.Add( hbox );
672
673   // Ensure layouting happens
674   application.SendNotification();
675   application.Render();
676
677   // hbox centers elements vertically, it fills test harness stage, which is 480x800.
678   // hbox left justifies elements
679   tet_infoline("Test Child Actor Position");
680   float xPositionOfControlBeingTested = 0.0f;
681   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
682                                                                                             380.0f,
683                                                                                             0.0f ), 0.0001f, TEST_LOCATION );
684   xPositionOfControlBeingTested += 40.0f;
685
686   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
687                                                                                             380.0f - ( ( CONTROL_PADDING.top + CONTROL_PADDING.bottom) * 0.5f ),                                                                                            0.0f ),
688                                                                                             0.0001f, TEST_LOCATION );
689
690   xPositionOfControlBeingTested += 60.0f + CONTROL_PADDING.start + CONTROL_PADDING.end;
691   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
692
693   xPositionOfControlBeingTested += 80.0f;
694   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
695
696   tet_infoline("Test Child Actor Size");
697   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
698
699   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f + CONTROL_PADDING.start + CONTROL_PADDING.end,
700                                                                                         40.0f + CONTROL_PADDING.top + CONTROL_PADDING.bottom , 0.0f ),
701                                                                                         0.0001f, TEST_LOCATION );
702
703   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
704   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
705
706   END_TEST;
707 }
708
709 int UtcDaliLayouting_HboxLayout_Padding02(void)
710 {
711   ToolkitTestApplication application;
712   tet_infoline("UtcDaliLayouting_HboxLayout_Padding02 - Adding Padding to a all children");
713
714   Stage stage = Stage::GetCurrent();
715   auto hbox = Control::New();
716   auto hboxLayout = LinearLayout::New();
717   DevelControl::SetLayout( hbox, hboxLayout );
718   hbox.SetName( "HBox");
719
720   std::vector< Control > controls;
721   controls.push_back( CreateLeafControl( 40, 40 ) );
722   controls.push_back( CreateLeafControl( 60, 40 ) );
723   controls.push_back( CreateLeafControl( 80, 40 ) );
724   controls.push_back( CreateLeafControl( 100, 40 ) );
725
726   const Extents CONTROL_PADDING = Extents(5, 10, 20, 2 );
727
728   for( auto&& iter : controls )
729   {
730     iter.SetProperty(Toolkit::Control::Property::PADDING, CONTROL_PADDING );
731     hbox.Add( iter );
732   }
733   hbox.SetParentOrigin( ParentOrigin::CENTER );
734   hbox.SetAnchorPoint( AnchorPoint::CENTER );
735   stage.Add( hbox );
736
737   // Ensure layouting happens
738   application.SendNotification();
739   application.Render();
740
741   // hbox centers elements vertically, it fills test harness stage, which is 480x800.
742   // hbox left justifies elements
743   tet_infoline("Test Child Actor Position");
744   float xPositionOfControlBeingTested = 0.0f;
745   float yPositionOfControlBeingTested = ( 800.0f * 0.5) - ( 0.5 * ( 40.0f + CONTROL_PADDING.top + CONTROL_PADDING.bottom ) );
746
747   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
748                                                                                             yPositionOfControlBeingTested,
749                                                                                             0.0f ), 0.0001f, TEST_LOCATION );
750   xPositionOfControlBeingTested += 40.0f + CONTROL_PADDING.start + CONTROL_PADDING.end;
751
752   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
753                                                                                             yPositionOfControlBeingTested,
754                                                                                             0.0f ),
755                                                                                             0.0001f, TEST_LOCATION );
756
757   xPositionOfControlBeingTested += 60.0f + CONTROL_PADDING.start + CONTROL_PADDING.end;
758   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
759                                                                                             yPositionOfControlBeingTested,
760                                                                                             0.0f ), 0.0001f, TEST_LOCATION );
761
762   xPositionOfControlBeingTested += 80.0f + CONTROL_PADDING.start + CONTROL_PADDING.end;
763   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
764                                                                                             yPositionOfControlBeingTested,
765                                                                                             0.0f ), 0.0001f, TEST_LOCATION );
766
767   tet_infoline("Test Child Actor Size");
768   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f + CONTROL_PADDING.start + CONTROL_PADDING.end,
769                                                                                         40.0f + CONTROL_PADDING.top + CONTROL_PADDING.bottom,
770                                                                                         0.0f ), 0.0001f, TEST_LOCATION );
771
772   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f + CONTROL_PADDING.start + CONTROL_PADDING.end,
773                                                                                         40.0f + CONTROL_PADDING.top + CONTROL_PADDING.bottom,
774                                                                                         0.0f ), 0.0001f, TEST_LOCATION );
775
776   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f + CONTROL_PADDING.start + CONTROL_PADDING.end ,
777                                                                                         40.0f + CONTROL_PADDING.top + CONTROL_PADDING.bottom,
778                                                                                         0.0f ), 0.0001f, TEST_LOCATION );
779
780   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f + CONTROL_PADDING.start + CONTROL_PADDING.end,
781                                                                                         40.0f + CONTROL_PADDING.top + CONTROL_PADDING.bottom,
782                                                                                         0.0f ), 0.0001f, TEST_LOCATION );
783
784   END_TEST;
785 }
786
787
788 int UtcDaliLayouting_HboxLayout_Padding03(void)
789 {
790   ToolkitTestApplication application;
791   tet_infoline("UtcDaliLayouting_HboxLayout_Padding03 - Adding Changing padding on a single child");
792
793   Stage stage = Stage::GetCurrent();
794   auto hbox = Control::New();
795   auto hboxLayout = LinearLayout::New();
796   DevelControl::SetLayout( hbox, hboxLayout );
797   hbox.SetName( "HBox");
798
799   std::vector< Control > controls;
800   controls.push_back( CreateLeafControl( 40, 40 ) );
801   controls.push_back( CreateLeafControl( 40, 40 ) );
802   controls.push_back( CreateLeafControl( 40, 40 ) );
803
804   const Extents CONTROL_PADDING = Extents(5, 10, 20, 2 );
805   tet_printf( "\nAdding Padding to control at index 1 \n" );
806   controls[1].SetProperty(Toolkit::Control::Property::PADDING, CONTROL_PADDING );
807
808   for( auto&& iter : controls )
809   {
810     hbox.Add( iter );
811   }
812   hbox.SetParentOrigin( ParentOrigin::CENTER );
813   hbox.SetAnchorPoint( AnchorPoint::CENTER );
814   stage.Add( hbox );
815
816   // Ensure layouting happens
817   application.SendNotification();
818   application.Render();
819
820   // hbox centers elements vertically, it fills test harness stage, which is 480x800.
821   // hbox left justifies elements
822   tet_infoline("Test Child Actor Position");
823   float xPositionOfControlBeingTested = 0.0f;
824   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
825                                                                                             380.0f,
826                                                                                             0.0f ), 0.0001f, TEST_LOCATION );
827   xPositionOfControlBeingTested += 40.0f;
828
829   DALI_TEST_EQUALS( controls[ 1 ].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
830                                                                                             380.0f - ( ( CONTROL_PADDING.top + CONTROL_PADDING.bottom) * 0.5f ),                                                                                            0.0f ),
831                                                                                             0.0001f, TEST_LOCATION );
832
833   xPositionOfControlBeingTested += 40.0f + CONTROL_PADDING.start + CONTROL_PADDING.end;
834   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
835
836   const Extents NEW_CONTROL_PADDING = Extents(10, 10, 20, 2 );
837   tet_printf( "\nChanging Padding to control at index 1 \n" );
838   controls[1].SetProperty(Toolkit::Control::Property::PADDING, NEW_CONTROL_PADDING );
839
840   // Ensure layouting happens
841   application.SendNotification();
842   application.Render();
843
844   xPositionOfControlBeingTested = 0.0f; // reset
845
846   tet_infoline("Test Child Actor Position");
847   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
848                                                                                             380.0f,
849                                                                                             0.0f ), 0.0001f, TEST_LOCATION );
850   xPositionOfControlBeingTested += 40.0f;
851
852   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
853                                                                                             380.0f - ( ( NEW_CONTROL_PADDING.top + NEW_CONTROL_PADDING.bottom) * 0.5f ),                                                                                            0.0f ),
854                                                                                             0.0001f, TEST_LOCATION );
855
856   xPositionOfControlBeingTested += 40.0f + NEW_CONTROL_PADDING.start + NEW_CONTROL_PADDING.end;
857   tet_printf( "\nIf x position %u then change has not been processed \n", 40 + 40 + CONTROL_PADDING.start + CONTROL_PADDING.end );
858   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
859
860   tet_infoline("Test Child Actor Size");
861   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ) , Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
862
863   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ) , Vector3( 40.0f + NEW_CONTROL_PADDING.start + NEW_CONTROL_PADDING.end,
864                                                                                         40.0f + NEW_CONTROL_PADDING.top + NEW_CONTROL_PADDING.bottom , 0.0f ),
865                                                                                         0.0001f, TEST_LOCATION );
866
867   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ) , Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
868
869   END_TEST;
870 }
871
872 // Margin Tests
873
874 int UtcDaliLayouting_HboxLayout_Margin01(void)
875 {
876   ToolkitTestApplication application;
877   tet_infoline("UtcDaliLayouting_HboxLayout_Margin01 - Adding a margin to a single child");
878
879   Stage stage = Stage::GetCurrent();
880   auto hbox = Control::New();
881   auto hboxLayout = LinearLayout::New();
882   DevelControl::SetLayout( hbox, hboxLayout );
883   hbox.SetName( "HBox");
884
885   std::vector< Control > controls;
886   controls.push_back( CreateLeafControl( 40, 40 ) );
887   controls.push_back( CreateLeafControl( 60, 40 ) );
888   controls.push_back( CreateLeafControl( 80, 40 ) );
889   controls.push_back( CreateLeafControl( 100, 40 ) );
890
891   const Extents CONTROL_MARGIN = Extents(5, 10, 20, 0 );
892   tet_printf( "\nAdding Margin to control at index 1 \n" );
893   controls[1].SetProperty(Toolkit::Control::Property::MARGIN, CONTROL_MARGIN );
894
895   for( auto&& iter : controls )
896   {
897     hbox.Add( iter );
898   }
899   hbox.SetParentOrigin( ParentOrigin::CENTER );
900   hbox.SetAnchorPoint( AnchorPoint::CENTER );
901   stage.Add( hbox );
902
903   // Ensure layouting happens
904   application.SendNotification();
905   application.Render();
906
907   // hbox centers elements vertically, it fills test harness stage, which is 480x800.
908   // hbox left justifies elements
909   tet_infoline("Test Child Actor Position");
910   auto xPositionOfControlBeingTested = 0.0f;
911   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
912                                                                                             380.0f,
913                                                                                             0.0f ), 0.0001f, TEST_LOCATION );
914   xPositionOfControlBeingTested += 40.0f + CONTROL_MARGIN.start;
915
916   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
917                                                                                             380.0f + CONTROL_MARGIN.top, 0.0f ),
918                                                                                             0.0001f, TEST_LOCATION );
919
920   xPositionOfControlBeingTested += 60.0f + CONTROL_MARGIN.end;
921   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
922
923   xPositionOfControlBeingTested += 80.0f;
924   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
925
926   tet_infoline("Test Child Actor Size is the same after Margin added");
927   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
928   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 40.0f , 0.0f ), 0.0001f, TEST_LOCATION );
929   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
930   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
931
932   END_TEST;
933 }
934
935
936 int UtcDaliLayouting_VboxLayout01(void)
937 {
938   ToolkitTestApplication application;
939   tet_infoline(" UtcDaliLayouting_VboxLayout01");
940
941   Stage stage = Stage::GetCurrent();
942   auto vbox = Control::New();
943   auto vboxLayout = LinearLayout::New();
944   vboxLayout.SetOrientation( LinearLayout::Orientation::VERTICAL );
945   DevelControl::SetLayout( vbox, vboxLayout );
946   vbox.SetName( "Vbox");
947
948   std::vector< Control > controls;
949   controls.push_back( CreateLeafControl( 40, 40 ) );
950   controls.push_back( CreateLeafControl( 60, 60 ) );
951   controls.push_back( CreateLeafControl( 80, 80 ) );
952   controls.push_back( CreateLeafControl( 100, 100 ) );
953
954   for( auto&& iter : controls )
955   {
956     vbox.Add( iter );
957   }
958   vbox.SetParentOrigin( ParentOrigin::CENTER );
959   vbox.SetAnchorPoint( AnchorPoint::CENTER );
960   stage.Add( vbox );
961
962   controls[2].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
963
964   // Check it.
965   DALI_TEST_EQUALS( controls[2].GetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION ), Property::Value( ChildLayoutData::MATCH_PARENT ), TEST_LOCATION );
966
967   // Ensure layouting happens
968   application.SendNotification();
969   application.Render();
970
971   // vbox centers elements horizontally, it fills test harness stage, which is 480x800.
972   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 220.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
973   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 210.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
974   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
975   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 190.0f, 180.0f, 0.0f ), 0.0001f, TEST_LOCATION );
976
977   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
978   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
979   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION );
980   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
981
982   END_TEST;
983 }
984
985 int UtcDaliLayouting_VboxLayout02(void)
986 {
987   ToolkitTestApplication application;
988   tet_infoline(" UtcDaliLayouting_VboxLayout01");
989
990   Stage stage = Stage::GetCurrent();
991
992   // @todo Can't set specification properties on root control. Really need to make LayoutController a root
993   // LayoutGroup for this to happen automatically.
994   //
995   // For this test, add an hbox instead
996   auto rootControl = Control::New();
997   auto absoluteLayout = AbsoluteLayout::New();
998   DevelControl::SetLayout( rootControl, absoluteLayout );
999   rootControl.SetName( "AbsoluteLayout");
1000   stage.Add( rootControl );
1001
1002   auto vbox = Control::New();
1003   auto vboxLayout = LinearLayout::New();
1004   vboxLayout.SetOrientation( LinearLayout::Orientation::VERTICAL );
1005   DevelControl::SetLayout( vbox, vboxLayout );
1006   vbox.SetName( "Vbox");
1007   rootControl.Add( vbox );
1008
1009   vbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
1010   vbox.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
1011
1012   std::vector< Control > controls;
1013   controls.push_back( CreateLeafControl( 40, 40 ) );
1014   controls.push_back( CreateLeafControl( 60, 60 ) );
1015   controls.push_back( CreateLeafControl( 80, 80 ) );
1016   controls.push_back( CreateLeafControl( 100, 100 ) );
1017
1018   for( auto&& iter : controls )
1019   {
1020     vbox.Add( iter );
1021   }
1022   vbox.SetParentOrigin( ParentOrigin::CENTER );
1023   vbox.SetAnchorPoint( AnchorPoint::CENTER );
1024
1025   controls[2].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
1026
1027   // Check it.
1028   DALI_TEST_EQUALS( controls[2].GetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION ), Property::Value( ChildLayoutData::MATCH_PARENT ), TEST_LOCATION );
1029
1030   // Ensure layouting happens
1031   application.SendNotification();
1032   application.Render();
1033
1034   DALI_TEST_EQUALS( rootControl.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(0,0,0),TEST_LOCATION);
1035   DALI_TEST_EQUALS( rootControl.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(480,800,0),TEST_LOCATION);
1036
1037   // vbox centers elements horizontally, it should wrap it's content horizontally, i.e. it should take the width of the largest element (100)
1038   DALI_TEST_EQUALS( vbox.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1039   DALI_TEST_EQUALS( vbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1040
1041   // 3rd control is set to match parent - this should also be 100 wide
1042   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 30.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1043   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 20.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1044   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1045   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 180.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1046
1047   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1048   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1049   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1050   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1051
1052   END_TEST;
1053 }
1054
1055
1056 int UtcDaliLayouting_VboxLayout03(void)
1057 {
1058   ToolkitTestApplication application;
1059   tet_infoline(" UtcDaliLayouting_VboxLayout03 test with cell padding set");
1060
1061   Stage stage = Stage::GetCurrent();
1062
1063   // @todo Can't set specification properties on root control. Really need to make LayoutController a root
1064   // LayoutGroup for this to happen automatically.
1065   //
1066   // For this test, add an hbox instead
1067   auto hbox = Control::New();
1068   auto hboxLayout = LinearLayout::New();
1069   DevelControl::SetLayout( hbox, hboxLayout );
1070   hbox.SetName( "Hbox");
1071   stage.Add( hbox );
1072
1073   auto vbox = Control::New();
1074   auto vboxLayout = LinearLayout::New();
1075   vboxLayout.SetCellPadding( LayoutSize( 0, 10 ) );
1076   vboxLayout.SetOrientation( LinearLayout::Orientation::VERTICAL );
1077
1078   DALI_TEST_EQUALS( vboxLayout.GetCellPadding(), LayoutSize( 0, 10 ), TEST_LOCATION );
1079
1080   DevelControl::SetLayout( vbox, vboxLayout );
1081   vbox.SetName( "Vbox");
1082   hbox.Add( vbox );
1083
1084   vbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
1085   vbox.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
1086
1087   std::vector< Control > controls;
1088   controls.push_back( CreateLeafControl( 40, 40 ) );
1089   controls.push_back( CreateLeafControl( 60, 60 ) );
1090   controls.push_back( CreateLeafControl( 80, 80 ) );
1091   controls.push_back( CreateLeafControl( 100, 100 ) );
1092
1093   for( auto&& iter : controls )
1094   {
1095     vbox.Add( iter );
1096   }
1097   vbox.SetParentOrigin( ParentOrigin::CENTER );
1098   vbox.SetAnchorPoint( AnchorPoint::CENTER );
1099
1100   controls[2].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
1101
1102   // Check it.
1103   DALI_TEST_EQUALS( controls[2].GetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION ), Property::Value( ChildLayoutData::MATCH_PARENT ), TEST_LOCATION );
1104
1105   // Ensure layouting happens
1106   application.SendNotification();
1107   application.Render();
1108
1109   DALI_TEST_EQUALS( hbox.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(0,0,0),TEST_LOCATION);
1110   DALI_TEST_EQUALS( hbox.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(480,800,0),TEST_LOCATION);
1111
1112   // vbox centers elements horizontally, it should wrap it's content horizontally, i.e. it should take the width of the largest element (100)
1113   DALI_TEST_EQUALS( vbox.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1114   DALI_TEST_EQUALS( vbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1115
1116   // 3rd control is set to match parent - this should also be 100 wide
1117   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 30.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1118   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 20.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1119   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 120.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1120   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 210.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1121
1122   DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1123   DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1124   DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1125   DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
1126
1127   END_TEST;
1128 }