X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-LayoutingNesting.cpp;h=cbfb6ed6c81ad3a6ca87b256da17768cfc65cbc5;hp=155b54a01c25d77644be2035c4f0df5ee0afb43f;hb=c669b77c3ed3a677855e2320be85f91c4571445f;hpb=a0424ec129d3799ee0dab4a46600d167b2b7c71c diff --git a/automated-tests/src/dali-toolkit/utc-Dali-LayoutingNesting.cpp b/automated-tests/src/dali-toolkit/utc-Dali-LayoutingNesting.cpp old mode 100644 new mode 100755 index 155b54a..cbfb6ed --- a/automated-tests/src/dali-toolkit/utc-Dali-LayoutingNesting.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-LayoutingNesting.cpp @@ -71,9 +71,7 @@ int UtcDaliLayoutingNesting_01(void) | Control (LinearLayout Horizontal) | - Control (LayoutingRequired) - | - Control (LinearLayout Horizontal) + Control (LinearLayout Vertical) | LeafControl @@ -82,8 +80,6 @@ int UtcDaliLayoutingNesting_01(void) ToolkitTestApplication application; tet_infoline("UtcDaliLayoutingNesting_01 - Nesting a LinearLayout (MATCH_PARENT) containing a leaf control within a LinearLayout"); - Stage stage = Stage::GetCurrent(); - auto rootControl = Control::New(); SetupRootLayoutControl( rootControl ); @@ -110,7 +106,7 @@ int UtcDaliLayoutingNesting_01(void) for( auto&& iter : controls ) { - hbox.Add( iter ); + vbox.Add( iter ); } rootControl.Add( hbox ); @@ -134,10 +130,8 @@ int UtcDaliLayoutingNesting_02(void) Root | Control (LinearLayout Horizontal) - | - Control (LayoutingRequired) - | - Control (LinearLayout Horizontal) + | | + Control (LinearLayout Vertical) | | LeafControl @@ -147,8 +141,6 @@ int UtcDaliLayoutingNesting_02(void) tet_infoline("UtcDaliLayoutingNesting_02 - Nesting a LinearLayout (MATCH_PARENT) containing a leaf control within a LinearLayout"); tet_infoline("Then change the parent's size and test child responded correctly"); - Stage stage = Stage::GetCurrent(); - auto rootControl = Control::New(); SetupRootLayoutControl( rootControl ); @@ -175,7 +167,7 @@ int UtcDaliLayoutingNesting_02(void) for( auto&& iter : controls ) { - hbox.Add( iter ); + vbox.Add( iter ); } rootControl.Add( hbox ); @@ -200,4 +192,63 @@ int UtcDaliLayoutingNesting_02(void) DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION ); END_TEST; -} \ No newline at end of file +} + +int UtcDaliLayoutingNesting_LeafSizeChange(void) +{ + /* + Root + | + Control (LayoutingRequired) + | + Control (LinearLayout Horizontal) (WRAP_CONTENT) + | | + TextLabel + */ + + ToolkitTestApplication application; + tet_infoline("UtcDaliLayoutingNesting_LeafSizeChange - Nesting a TextLabel within a layout that is parented to a control"); + tet_infoline("Then change the TextLabels size and test the parent resized to wrap the new size"); + + auto rootControl = Control::New(); + SetupRootLayoutControl( rootControl ); + + auto control = Control::New(); + DevelControl::SetLayoutingRequired( control, true ); + control.SetName( "control" ); + + auto hbox = Control::New(); + auto hboxLayout = LinearLayout::New(); + hboxLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL ); + DevelControl::SetLayout( hbox, hboxLayout ); + hbox.SetName( "hBox" ); + hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT ); + hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT ); + + control.Add( hbox ); + + TextLabel textLabel = CreateTextLabel("SmallText" ); + + hbox.Add( textLabel ); + + rootControl.Add( control ); + + // Ensure layouting happens + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( hbox.GetProperty( Actor::Property::SIZE ), Vector3( 254.0f, 64.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( textLabel.GetProperty( Actor::Property::SIZE ), Vector3( 254.0f, 64.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + + tet_infoline("Changing to longer text"); + textLabel.SetProperty( TextLabel::Property::TEXT, "muchlongerText" ); + + // Ensure layouting happens + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( hbox.GetProperty( Actor::Property::SIZE ), Vector3( 426.0f, 64.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( textLabel.GetProperty( Actor::Property::SIZE ), Vector3( 426.0f, 64.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + + END_TEST; +}