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