2 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 #include <dali-toolkit-test-suite-utils.h>
21 #include <dali-toolkit/dali-toolkit.h>
22 #include <dali/devel-api/actors/actor-devel.h>
23 #include <dali-toolkit/devel-api/layouting/flex-node.h>
26 using namespace Toolkit;
28 void dali_flexNodeContainer_startup(void)
30 test_return_value = TET_UNDEF;
33 void dali_flexNodeContainer_cleanup(void)
35 test_return_value = TET_PASS;
41 const Flex::SizeTuple ITEM_SIZE = Flex::SizeTuple{ 10.0f, 10.0f };
42 const Flex::SizeTuple ITEM_SIZE_CALLBACK_TEST = Flex::SizeTuple{ 15.0f, 15.0f };
44 Flex::SizeTuple MeasureChild( Actor child, float width, int measureModeWidth, float height, int measureModeHeight)
46 Flex::SizeTuple childSize = ITEM_SIZE;
47 if (child.GetName() == "callbackTest")
49 childSize = ITEM_SIZE_CALLBACK_TEST;
51 tet_printf(" MeasureChild test callback executed (%f,%f)\n", childSize.width, childSize.height );
57 int UtcDaliToolkitFlexNodeConstructorP(void)
59 ToolkitTestApplication application;
60 tet_infoline(" UtcDaliToolkitFlexNodeNewP");
61 Flex::Node* flexNode = new Flex::Node();
62 DALI_TEST_CHECK( flexNode );
66 int UtcDaliToolkitFlexNodeAddChildrenRowP(void)
68 ToolkitTestApplication application;
69 tet_infoline(" UtcDaliToolkitFlexNodeAddChildrenRowP");
70 Flex::Node* flexNode = new Flex::Node();
71 DALI_TEST_CHECK( flexNode );
73 // Position elements as a Row
74 flexNode->SetFlexDirection(Flex::FlexDirection::ROW);
76 // Create two actors and add them to the parent flex node
77 Actor actor1 = Actor::New();
78 Actor actor2 = Actor::New();
79 DALI_TEST_CHECK( actor1 );
80 DALI_TEST_CHECK( actor2 );
82 flexNode->AddChild(actor1, &MeasureChild, 0);
83 flexNode->AddChild(actor2, &MeasureChild, 1);
85 DALI_TEST_EQUALS( (int)flexNode->GetFlexDirection(), (int)Flex::FlexDirection::ROW, TEST_LOCATION );
87 flexNode->CalculateLayout(480, 800, false);
89 Vector4 actor1Frame = flexNode->GetNodeFrame(0);
90 Vector4 actor2Frame = flexNode->GetNodeFrame(1);
92 tet_printf("Actor 1 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor1Frame.x, actor1Frame.y, actor1Frame.z, actor1Frame.w);
93 tet_printf("Actor 2 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor2Frame.x, actor2Frame.y, actor2Frame.z, actor2Frame.w);
95 DALI_TEST_EQUALS( actor1Frame, Vector4( 0.0f, 0.0f, ITEM_SIZE.width, ITEM_SIZE.height ), TEST_LOCATION );
96 DALI_TEST_EQUALS( actor2Frame, Vector4( ITEM_SIZE.width, 0.0f, ITEM_SIZE.width * 2, ITEM_SIZE.height ), TEST_LOCATION );
101 int UtcDaliToolkitFlexNodeAddChildrenColumnP(void)
103 ToolkitTestApplication application;
104 tet_infoline("UtcDaliToolkitFlexNodeAddChildrenColumnP");
105 Flex::Node* flexNode = new Flex::Node();
106 DALI_TEST_CHECK( flexNode );
108 // Position elements in a Column
109 flexNode->SetFlexDirection(Flex::FlexDirection::COLUMN);
111 // Create two actors and add them to the parent flex node
112 Actor actor1 = Actor::New();
113 Actor actor2 = Actor::New();
114 DALI_TEST_CHECK( actor1 );
115 DALI_TEST_CHECK( actor2 );
117 flexNode->AddChild(actor1, &MeasureChild, 0);
118 flexNode->AddChild(actor2, &MeasureChild, 1);
120 flexNode->CalculateLayout(480, 800, false);
122 Vector4 root = flexNode->GetNodeFrame(-1); // -1 is the root
123 Vector4 actor1Frame = flexNode->GetNodeFrame(0); // 0 is first child
124 Vector4 actor2Frame = flexNode->GetNodeFrame(1); // 1 is second child
126 tet_printf("Root frame(left:%f,top:%f,right:%f,bottom:%f)\n", root.x, root.y, root.z, root.w);
128 tet_printf("Actor 1 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor1Frame.x, actor1Frame.y, actor1Frame.z, actor1Frame.w);
129 tet_printf("Actor 2 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor2Frame.x, actor2Frame.y, actor2Frame.z, actor2Frame.w);
131 DALI_TEST_EQUALS( actor1Frame, Vector4( 0.0f, 0.0f, ITEM_SIZE.width, ITEM_SIZE.height ), TEST_LOCATION );
132 DALI_TEST_EQUALS( actor2Frame, Vector4( 0.0f, ITEM_SIZE.height, ITEM_SIZE.width, ITEM_SIZE.height *2 ), TEST_LOCATION );
138 int UtcDaliToolkitFlexNodeAddChildrenColumnJustify(void)
140 ToolkitTestApplication application;
141 tet_infoline("UtcDaliToolkitFlexNodeAddChildrenColumnJustify");
142 Flex::Node* flexNode = new Flex::Node();
143 DALI_TEST_CHECK( flexNode );
145 // Position elements in a Column
146 flexNode->SetFlexDirection(Flex::FlexDirection::COLUMN);
148 tet_infoline("Justify to the Start, align to start");
149 flexNode->SetFlexJustification(Flex::Justification::FLEX_START);
150 flexNode->SetFlexItemsAlignment( Flex::Alignment::FLEX_START );
152 // Create two actors and add them to the parent flex node
153 Actor actor1 = Actor::New();
154 Actor actor2 = Actor::New();
155 DALI_TEST_CHECK( actor1 );
156 DALI_TEST_CHECK( actor2 );
158 DALI_TEST_EQUALS( (int)flexNode->GetFlexJustification(), (int)Flex::Justification::FLEX_START, TEST_LOCATION );
159 DALI_TEST_EQUALS( (int)flexNode->GetFlexItemsAlignment(), (int)Flex::Alignment::FLEX_START, TEST_LOCATION );
161 flexNode->AddChild(actor1, &MeasureChild, 0);
162 flexNode->AddChild(actor2, &MeasureChild, 1);
164 flexNode->CalculateLayout(480, 800, false);
166 Vector4 root = flexNode->GetNodeFrame(-1); // -1 is the root
167 Vector4 actor1Frame = flexNode->GetNodeFrame(0); // 0 is first child
168 Vector4 actor2Frame = flexNode->GetNodeFrame(1); // 1 is second child
170 tet_printf("Root frame(left:%f,top:%f,right:%f,bottom:%f)\n", root.x, root.y, root.z, root.w);
172 tet_printf("Actor 1 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor1Frame.x, actor1Frame.y, actor1Frame.z, actor1Frame.w);
173 tet_printf("Actor 2 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor2Frame.x, actor2Frame.y, actor2Frame.z, actor2Frame.w);
185 DALI_TEST_EQUALS( actor1Frame, Vector4( 0.0f, 0.0f, ITEM_SIZE.width, ITEM_SIZE.height ), TEST_LOCATION );
186 DALI_TEST_EQUALS( actor2Frame, Vector4( 0.0f, ITEM_SIZE.height, ITEM_SIZE.width, ITEM_SIZE.height *2 ), TEST_LOCATION );
188 tet_infoline(" Justify to the End, items should now be displayed at the bottom");
189 flexNode->SetFlexJustification( Flex::Justification::FLEX_END );
190 flexNode->SetFlexItemsAlignment( Flex::Alignment::FLEX_START );
193 flexNode->CalculateLayout(480, 800, false);
195 root = flexNode->GetNodeFrame(-1); // -1 is the root
196 actor1Frame = flexNode->GetNodeFrame(0); // 0 is first child
197 actor2Frame = flexNode->GetNodeFrame(1); // 1 is second child
199 tet_printf("Root frame(left:%f,top:%f,right:%f,bottom:%f)\n", root.x, root.y, root.z, root.w);
201 tet_printf("Actor 1 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor1Frame.x, actor1Frame.y, actor1Frame.z, actor1Frame.w);
202 tet_printf("Actor 2 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor2Frame.x, actor2Frame.y, actor2Frame.z, actor2Frame.w);
214 DALI_TEST_EQUALS( actor1Frame, Vector4( 0.0f, root.w - (ITEM_SIZE.height*2), ITEM_SIZE.width, root.w - ITEM_SIZE.height ), TEST_LOCATION );
215 DALI_TEST_EQUALS( actor2Frame, Vector4( 0.0f, root.w - ITEM_SIZE.height, ITEM_SIZE.width, root.w ), TEST_LOCATION );
217 tet_infoline(" Align to End, items should now be displayed at the bottom and the end");
218 flexNode->SetFlexJustification( Flex::Justification::FLEX_END );
219 flexNode->SetFlexItemsAlignment( Flex::Alignment::FLEX_END );
221 flexNode->CalculateLayout(480, 800, false);
223 root = flexNode->GetNodeFrame(-1); // -1 is the root
224 actor1Frame = flexNode->GetNodeFrame(0); // 0 is first child
225 actor2Frame = flexNode->GetNodeFrame(1); // 1 is second child
227 tet_printf("Actor 1 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor1Frame.x, actor1Frame.y, actor1Frame.z, actor1Frame.w);
228 tet_printf("Actor 2 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor2Frame.x, actor2Frame.y, actor2Frame.z, actor2Frame.w);
240 DALI_TEST_EQUALS( actor1Frame, Vector4( root.z - ITEM_SIZE.width, root.w - (ITEM_SIZE.height*2), root.z, root.w - ITEM_SIZE.height ), TEST_LOCATION );
241 DALI_TEST_EQUALS( actor2Frame, Vector4( root.z - ITEM_SIZE.width, root.w - ITEM_SIZE.height, root.z, root.w ), TEST_LOCATION );
246 int UtcDaliToolkitFlexNodeSizingP(void)
248 ToolkitTestApplication application;
249 tet_infoline(" UtcDaliToolkitFlexNodeSizingP");
250 Flex::Node* flexNode = new Flex::Node();
251 DALI_TEST_CHECK( flexNode );
253 // Create two actors and add them to the parent flex node
254 Actor actor1 = Actor::New();
255 Actor actor2 = Actor::New();
256 DALI_TEST_CHECK( actor1 );
257 DALI_TEST_CHECK( actor2 );
259 flexNode->AddChild(actor1, &MeasureChild, 0);
260 flexNode->AddChild(actor2, &MeasureChild, 1);
262 flexNode->CalculateLayout(480, 800, false);
264 DALI_TEST_EQUALS( flexNode->GetFlexWidth(), 480.0f, TEST_LOCATION );
265 DALI_TEST_EQUALS( flexNode->GetFlexHeight(), 800.0f, TEST_LOCATION );
270 int UtcDaliToolkitFlexNodeWrapModeP(void)
272 ToolkitTestApplication application;
273 tet_infoline("UtcDaliToolkitFlexNodeWrapModeP");
274 Flex::Node* flexNode = new Flex::Node();
275 DALI_TEST_CHECK( flexNode );
277 // Position elements in a Column
278 flexNode->SetFlexDirection( Flex::FlexDirection::ROW );
279 flexNode->SetFlexAlignment( Flex::Alignment::FLEX_START );
280 flexNode->SetFlexWrap( Flex::WrapType::NO_WRAP );
282 // Create two actors and add them to the parent flex node
283 Actor actor1 = Actor::New();
284 Actor actor2 = Actor::New();
285 Actor actor3 = Actor::New();
286 Actor actor4 = Actor::New();
288 DALI_TEST_EQUALS( (int)flexNode->GetFlexJustification(), (int)Flex::Justification::FLEX_START, TEST_LOCATION );
289 DALI_TEST_EQUALS( (int)flexNode->GetFlexItemsAlignment(), (int)Flex::Alignment::FLEX_START, TEST_LOCATION );
290 DALI_TEST_EQUALS( (int)flexNode->GetFlexAlignment(), (int)Flex::Alignment::FLEX_START, TEST_LOCATION );
291 DALI_TEST_EQUALS( (int)flexNode->GetFlexWrap(), (int)Flex::WrapType::NO_WRAP, TEST_LOCATION );
293 flexNode->AddChild( actor1, &MeasureChild, 0 );
294 flexNode->AddChild( actor2, &MeasureChild, 1 );
295 flexNode->AddChild( actor2, &MeasureChild, 2 );
296 flexNode->AddChild( actor2, &MeasureChild, 3 );
298 flexNode->CalculateLayout(30, 800, false);
300 Vector4 root = flexNode->GetNodeFrame(-1); // -1 is the root
301 Vector4 actor1Frame = flexNode->GetNodeFrame(0); // 0 is first child
302 Vector4 actor2Frame = flexNode->GetNodeFrame(1); // 1 is second child
303 Vector4 actor3Frame = flexNode->GetNodeFrame(2); // 2 is first child
304 Vector4 actor4Frame = flexNode->GetNodeFrame(3); // 3 is second child
306 tet_printf("Root frame(left:%f,top:%f,right:%f,bottom:%f)\n", root.x, root.y, root.z, root.w);
307 tet_printf("Actor 1 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor1Frame.x, actor1Frame.y, actor1Frame.z, actor1Frame.w);
308 tet_printf("Actor 2 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor2Frame.x, actor2Frame.y, actor2Frame.z, actor2Frame.w);
309 tet_printf("Actor 3 frame(left:%f,top:%f,right:cdt%f,bottom:%f)\n", actor3Frame.x, actor3Frame.y, actor3Frame.z, actor3Frame.w);
310 tet_printf("Actor 4 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor4Frame.x, actor4Frame.y, actor4Frame.z, actor4Frame.w);
322 DALI_TEST_EQUALS( actor1Frame, Vector4( 0.0f, 0.0f, ITEM_SIZE.width, ITEM_SIZE.height ), TEST_LOCATION );
323 DALI_TEST_EQUALS( actor2Frame, Vector4( ITEM_SIZE.width, 0.0f, ITEM_SIZE.width*2, ITEM_SIZE.height ), TEST_LOCATION );
324 DALI_TEST_EQUALS( actor3Frame, Vector4( ITEM_SIZE.width*2, 0.0f, ITEM_SIZE.width*3, ITEM_SIZE.height ), TEST_LOCATION );
325 DALI_TEST_EQUALS( actor4Frame, Vector4( ITEM_SIZE.width*3, 0.0f, ITEM_SIZE.width*4, ITEM_SIZE.height ), TEST_LOCATION );
327 flexNode->SetFlexWrap( Flex::WrapType::WRAP );
329 flexNode->CalculateLayout( 30, 800, false );
330 root = flexNode->GetNodeFrame(-1); // -1 is the root
332 DALI_TEST_EQUALS( (int)flexNode->GetFlexWrap(), (int)Flex::WrapType::WRAP, TEST_LOCATION );
333 tet_printf("Root frame(left:%f,top:%f,right:%f,bottom:%f)\n", root.x, root.y, root.z, root.w);
335 actor1Frame = flexNode->GetNodeFrame(0); // 0 is first child
336 actor2Frame = flexNode->GetNodeFrame(1); // 1 is second child
337 actor3Frame = flexNode->GetNodeFrame(2); // 2 is first child
338 actor4Frame = flexNode->GetNodeFrame(3); // 3 is second child
340 tet_printf("Actor 1 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor1Frame.x, actor1Frame.y, actor1Frame.z, actor1Frame.w);
341 tet_printf("Actor 2 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor2Frame.x, actor2Frame.y, actor2Frame.z, actor2Frame.w);
342 tet_printf("Actor 3 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor3Frame.x, actor3Frame.y, actor3Frame.z, actor3Frame.w);
343 tet_printf("Actor 4 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor4Frame.x, actor4Frame.y, actor4Frame.z, actor4Frame.w);
355 DALI_TEST_EQUALS( actor1Frame, Vector4( 0.0f, 0.0f, ITEM_SIZE.width, ITEM_SIZE.height ), TEST_LOCATION );
356 DALI_TEST_EQUALS( actor2Frame, Vector4( ITEM_SIZE.width, 0.0f, ITEM_SIZE.width*2, ITEM_SIZE.height ), TEST_LOCATION );
357 DALI_TEST_EQUALS( actor3Frame, Vector4( ITEM_SIZE.width*2, 0.0f, ITEM_SIZE.width*3, ITEM_SIZE.height ), TEST_LOCATION );
358 DALI_TEST_EQUALS( actor4Frame, Vector4( 0.0,ITEM_SIZE.height, ITEM_SIZE.width, ITEM_SIZE.height*2 ), TEST_LOCATION );
364 int UtcDaliToolkitFlexNodeRemoveChildP(void)
366 ToolkitTestApplication application;
367 tet_infoline(" UtcDaliToolkitFlexNodeRemoveChildP");
368 Flex::Node* flexNode = new Flex::Node();
369 DALI_TEST_CHECK( flexNode );
371 // Create two actors and add them to the parent flex node
372 Actor actor1 = Actor::New();
373 Actor actor2 = Actor::New();
374 actor1.SetName("Actor1");
375 actor2.SetName("Actor2");
377 DALI_TEST_CHECK( actor1 );
378 DALI_TEST_CHECK( actor2 );
380 flexNode->AddChild(actor1, &MeasureChild, 0);
381 flexNode->AddChild(actor2, &MeasureChild, 1);
383 flexNode->CalculateLayout(480, 800, false);
385 Vector4 actor1Frame = flexNode->GetNodeFrame(0);
386 Vector4 actor2Frame = flexNode->GetNodeFrame(1);
388 tet_printf("Actor 1 frame(%f,%f,%f,%f)\n", actor1Frame.x, actor1Frame.y, actor1Frame.z, actor1Frame.w);
389 tet_printf("Actor 2 frame(%f,%f,%f,%f)\n", actor2Frame.x, actor2Frame.y, actor2Frame.z, actor2Frame.w);
391 DALI_TEST_EQUALS( actor2Frame, Vector4( 0.0f, ITEM_SIZE.width, ITEM_SIZE.width, ITEM_SIZE.height*2 ), TEST_LOCATION );
393 flexNode->RemoveChild(actor1);
395 flexNode->CalculateLayout(480, 800, false);
397 actor2Frame = flexNode->GetNodeFrame(0);
399 tet_printf("Actor 1 frame(%f,%f,%f,%f)\n", actor1Frame.x, actor1Frame.y, actor1Frame.z, actor1Frame.w);
400 tet_printf("Actor 2 frame(%f,%f,%f,%f)\n", actor2Frame.x, actor2Frame.y, actor2Frame.z, actor2Frame.w);
402 DALI_TEST_EQUALS( actor2Frame, Vector4( 0.0f, 0.0f, ITEM_SIZE.width, ITEM_SIZE.height ), TEST_LOCATION );
407 int UtcDaliToolkitFlexNodeRemoveAllChildrenP(void)
409 ToolkitTestApplication application;
410 tet_infoline(" UtcDaliToolkitFlexNodeRemoveAllChildrenP");
411 Flex::Node* flexNode = new Flex::Node();
412 DALI_TEST_CHECK( flexNode );
414 // Create two actors and add them to the parent flex node
415 Actor actor1 = Actor::New();
416 Actor actor2 = Actor::New();
417 actor1.SetName("Actor1");
418 actor2.SetName("Actor2");
420 DALI_TEST_CHECK( actor1 );
421 DALI_TEST_CHECK( actor2 );
423 flexNode->AddChild(actor1, &MeasureChild, 0);
424 flexNode->AddChild(actor2, &MeasureChild, 1);
426 flexNode->CalculateLayout(480, 800, false);
428 Vector4 actor1Frame = flexNode->GetNodeFrame(0);
429 Vector4 actor2Frame = flexNode->GetNodeFrame(1);
431 tet_printf("Actor 1 frame(%f,%f,%f,%f)\n", actor1Frame.x, actor1Frame.y, actor1Frame.z, actor1Frame.w);
432 tet_printf("Actor 2 frame(%f,%f,%f,%f)\n", actor2Frame.x, actor2Frame.y, actor2Frame.z, actor2Frame.w);
434 flexNode->RemoveChild(actor1);
435 flexNode->RemoveChild(actor2);
437 flexNode->CalculateLayout(480, 800, false);
439 Vector4 actor1FrameRemoved = flexNode->GetNodeFrame(0);
440 Vector4 actor2FrameRemoved = flexNode->GetNodeFrame(1);
442 tet_printf("Actor 1 frame(%f,%f,%f,%f)\n", actor1FrameRemoved.x, actor1FrameRemoved.y, actor1FrameRemoved.z, actor1FrameRemoved.w);
443 tet_printf("Actor 2 frame(%f,%f,%f,%f)\n", actor2FrameRemoved.x, actor2FrameRemoved.y, actor2FrameRemoved.z, actor2FrameRemoved.w);
445 DALI_TEST_NOT_EQUALS( actor1Frame, actor1FrameRemoved, 0.1, TEST_LOCATION );
446 DALI_TEST_NOT_EQUALS( actor2Frame, actor2FrameRemoved, 0.1, TEST_LOCATION );
451 int UtcDaliToolkitFlexNodePaddingMarginP(void)
453 ToolkitTestApplication application;
454 tet_infoline(" UtcDaliToolkitFlexNodePaddingMarginP");
455 Flex::Node* flexNode = new Flex::Node();
456 DALI_TEST_CHECK( flexNode );
457 flexNode->SetFlexDirection( Flex::FlexDirection::ROW );
459 // Create two actors and add them to the parent flex node
460 Actor actor1 = Actor::New();
461 Actor actor2 = Actor::New();
462 DALI_TEST_CHECK( actor1 );
463 DALI_TEST_CHECK( actor2 );
465 flexNode->AddChild(actor1, &MeasureChild, 0);
466 flexNode->AddChild(actor2, &MeasureChild, 1);
468 Extents padding( 5,5,5,5);
469 Extents margin( 5,5,5,5);
471 flexNode->SetPadding( padding );
472 flexNode->SetMargin( margin );
474 flexNode->CalculateLayout(480, 800, false);
476 Vector4 actor1Frame = flexNode->GetNodeFrame(0);
477 Vector4 actor2Frame = flexNode->GetNodeFrame(1);
487 DALI_TEST_EQUALS( actor1Frame, Vector4( 5.0f, 5.0f, ITEM_SIZE.width +5 , ITEM_SIZE.height + 5 ), TEST_LOCATION );
488 DALI_TEST_EQUALS( actor2Frame, Vector4( 5+ ITEM_SIZE.width, 5.0f, (ITEM_SIZE.width*2) +5, ITEM_SIZE.height +5 ), TEST_LOCATION );
493 int UtcDaliToolkitFlexNodeCallbackTestP(void)
495 ToolkitTestApplication application;
496 tet_infoline("UtcDaliToolkitFlexNodeCallbackTestP");
497 Flex::Node* flexNode = new Flex::Node();
498 DALI_TEST_CHECK( flexNode );
500 // Position elements in a Column
501 flexNode->SetFlexDirection(Flex::FlexDirection::COLUMN);
503 // Create two actors and add them to the parent flex node
504 Actor actor1 = Actor::New();
505 Actor actor2 = Actor::New();
507 actor1.SetName("callbackTest");
509 DALI_TEST_CHECK( actor1 );
510 DALI_TEST_CHECK( actor2 );
512 flexNode->AddChild(actor1, &MeasureChild, 0);
513 flexNode->AddChild(actor2, &MeasureChild, 1);
515 flexNode->CalculateLayout(480, 800, false);
517 Vector4 root = flexNode->GetNodeFrame(-1); // -1 is the root
518 Vector4 actor1Frame = flexNode->GetNodeFrame(0); // 0 is first child
519 Vector4 actor2Frame = flexNode->GetNodeFrame(1); // 1 is second child
521 tet_printf("Root frame(left:%f,top:%f,right:%f,bottom:%f)\n", root.x, root.y, root.z, root.w);
523 tet_printf("Actor 1 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor1Frame.x, actor1Frame.y, actor1Frame.z, actor1Frame.w);
524 tet_printf("Actor 2 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor2Frame.x, actor2Frame.y, actor2Frame.z, actor2Frame.w);
526 DALI_TEST_EQUALS( actor1Frame, Vector4( 0.0f, 0.0f, ITEM_SIZE_CALLBACK_TEST.width, ITEM_SIZE_CALLBACK_TEST.height ), TEST_LOCATION );
527 DALI_TEST_EQUALS( actor2Frame, Vector4( 0.0f, ITEM_SIZE_CALLBACK_TEST.height, ITEM_SIZE.width, ITEM_SIZE_CALLBACK_TEST.height + ITEM_SIZE.height ), TEST_LOCATION );