From: Agnelo Vaz Date: Mon, 2 Jul 2018 10:53:00 +0000 (+0100) Subject: Added test to show Order of SetLayout is not important X-Git-Tag: dali_1.3.31~3 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=403b699ba702756b7ab5e0893f6d58e27259059e Added test to show Order of SetLayout is not important Change-Id: If80f4ce350504c22fa6bae70df1e519cffe98d1c --- diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Layouting.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Layouting.cpp index f31b2e6..a7d622c 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-Layouting.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-Layouting.cpp @@ -1638,3 +1638,44 @@ int UtcDaliLayouting_LayoutChildren04(void) END_TEST; } + +int UtcDaliLayouting_SetLayoutOrder(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliLayouting_SetLayoutOrder - Call SetLayout after adding the control to the root layout"); + + Stage stage = Stage::GetCurrent(); + + auto rootControl = Control::New(); + auto absoluteLayout = AbsoluteLayout::New(); + DevelControl::SetLayout( rootControl, absoluteLayout ); + rootControl.SetName( "AbsoluteLayout" ); + stage.Add( rootControl ); + + tet_infoline(" UtcDaliLayouting_SetLayoutOrder - Creating control"); + auto hbox = Control::New(); + auto hboxLayout = LinearLayout::New(); + hbox.SetName( "HBox"); + + tet_infoline(" UtcDaliLayouting_SetLayoutOrder - Add control to root layout"); + rootControl.Add( hbox ); + + tet_infoline(" UtcDaliLayouting_SetLayoutOrder - Set layout to control AFTER control added to root"); + DevelControl::SetLayout( hbox, hboxLayout ); + + // Add a Child control + std::vector< Control > controls; + controls.push_back( CreateLeafControl( 100, 100 ) ); // Single control + for( auto&& iter : controls ) + { + hbox.Add( iter ); + } + + // Ensure layouting happens + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + + END_TEST; +}