Remove connecting Layout Child order with Actor child order 17/193617/3
authorSeoyeon Kim <seoyeon2.kim@samsung.com>
Thu, 22 Nov 2018 08:33:56 +0000 (17:33 +0900)
committerSeoyeon Kim <seoyeon2.kim@samsung.com>
Mon, 26 Nov 2018 05:22:13 +0000 (14:22 +0900)
- Layout Child Ordering should be individual as Actor Child ordering.

Change-Id: Id9eff89fb13b5d37e601f07bfc4d079b069b1c0b
Signed-off-by: Seoyeon Kim <seoyeon2.kim@samsung.com>
automated-tests/src/dali-toolkit/utc-Dali-Layouting.cpp
dali-toolkit/devel-api/layouting/layout-group-impl.cpp
dali-toolkit/devel-api/layouting/layout-group-impl.h
dali-toolkit/devel-api/layouting/layout-parent-impl.h

index 23cc93a..e1a1714 100644 (file)
@@ -38,15 +38,6 @@ using namespace Toolkit;
 namespace
 {
 
-void TestLayoutItemOrder( std::vector< Control >& controls, LayoutGroup& layoutGroup )
-{
-  for( auto&& iter : controls )
-  {
-    unsigned int siblingOrder = static_cast< unsigned int>( iter.GetProperty< int >( DevelActor::Property::SIBLING_ORDER ) );
-    DALI_TEST_EQUALS( layoutGroup.GetChildAt( siblingOrder ), DevelControl::GetLayout( iter ), TEST_LOCATION );
-  }
-}
-
 // Turns the given control into a Root layout control and adds it to the stage.
 void SetupRootLayoutControl( Control& rootControl )
 {
@@ -2596,68 +2587,6 @@ int UtcDaliLayouting_VboxLayout_Padding(void)
 }
 
 
-int UtcDaliLayouting_RelayoutOnChildOrderChanged(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline(" UtcDaliLayouting_RelayoutOnChildOrderChanged");
-  tet_infoline(" Test that if the sibling order changes, the container is re-laid out automatically");
-
-  Stage stage = Stage::GetCurrent();
-
-  auto hbox = Control::New();
-  auto hboxLayout = Test::CustomLayout::New();
-  DevelControl::SetLayout( hbox, hboxLayout );
-  hbox.SetName( "HBox");
-
-  std::vector< Control > controls;
-  controls.push_back( CreateLeafControl( 40, 40 ) );
-  controls.push_back( CreateLeafControl( 60, 40 ) );
-  controls.push_back( CreateLeafControl( 80, 40 ) );
-  controls.push_back( CreateLeafControl( 100, 40 ) );
-
-  for( auto&& iter : controls )
-  {
-    hbox.Add( iter );
-  }
-  hbox.SetParentOrigin( ParentOrigin::CENTER );
-  hbox.SetAnchorPoint( AnchorPoint::CENTER );
-  stage.Add( hbox );
-
-  // Ensure layouting happens
-  application.SendNotification();
-  application.Render();
-
-  // hbox centers elements vertically, it fills test harness stage, which is 480x800.
-  // hbox left justifies elements
-  DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-  DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 40.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-  DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-  DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 180.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
-  DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-  DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-  DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-  DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
-  controls[0].RaiseToTop(); // 0->3; 1, 2, 3, 0
-  controls[2].Lower();      // 2->1; 2, 1, 3, 0
-
-  application.SendNotification();
-  application.Render();
-
-  DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-  DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 80.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-  DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 140.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-  DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 240.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
-  DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-  DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-  DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-  DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
-  END_TEST;
-}
-
 int UtcDaliLayouting_HboxLayout_TargetSize(void)
 {
   ToolkitTestApplication application;
@@ -2795,7 +2724,7 @@ int UtcDaliLayouting_LayoutChildren03(void)
   END_TEST;
 }
 
-int UtcDaliLayouting_SetLayoutOrder01(void)
+int UtcDaliLayouting_SetLayoutOrder(void)
 {
   ToolkitTestApplication application;
   tet_infoline(" UtcDaliLayouting_SetLayoutOrder01 - Call SetLayout after adding the control to the root layout");
@@ -2836,110 +2765,6 @@ int UtcDaliLayouting_SetLayoutOrder01(void)
   END_TEST;
 }
 
-int UtcDaliLayouting_SetLayoutOrder02(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline(" UtcDaliLayouting_SetLayoutOrder02 - Test the layout item order and the control order");
-
-  Stage stage = Stage::GetCurrent();
-
-  auto rootControl = Control::New();
-  auto absoluteLayout = AbsoluteLayout::New();
-  DevelControl::SetLayout( rootControl, absoluteLayout );
-  rootControl.SetName( "AbsoluteLayout" );
-  stage.Add( rootControl );
-
-  auto hbox = Control::New();
-  auto hboxLayout = LinearLayout::New();
-  hbox.SetName( "HBox");
-
-  rootControl.Add( hbox );
-
-  DevelControl::SetLayout( hbox, hboxLayout );
-
-  // Add child controls
-  std::vector< Control > controls;
-  controls.push_back( CreateLeafControl( 100, 100 ) );  // 0
-  controls.push_back( CreateLeafControl( 100, 100 ) );  // 1
-  controls.push_back( CreateLeafControl( 100, 100 ) );  // 2
-
-  for( auto&& iter : controls )
-  {
-    hbox.Add( iter );
-  }
-
-  // Ensure layouting happens
-  application.SendNotification();
-  application.Render();
-
-  TestLayoutItemOrder( controls, hboxLayout );
-
-  tet_infoline("RaiseToTop");
-
-  controls[0].RaiseToTop(); // 1 2 0
-
-  TestLayoutItemOrder( controls, hboxLayout );
-
-  tet_infoline("LowerToBottom");
-
-  controls[2].LowerToBottom();  // 2 1 0
-
-  TestLayoutItemOrder( controls, hboxLayout );
-
-  tet_infoline("Remove / Add");
-
-  hbox.Remove( controls[2] );  // 1 0
-  hbox.Add( controls[2] );     // 1 0 2
-
-  TestLayoutItemOrder( controls, hboxLayout );
-
-  tet_infoline("SetLayout");
-
-  auto vboxLayout = LinearLayout::New();
-  DevelControl::SetLayout( controls[0], vboxLayout ); // 1 2 0(vbox)
-
-  TestLayoutItemOrder( controls, hboxLayout );
-
-  tet_infoline("Raise");
-
-  controls[0].Raise();  // 1 2 0(vbox)
-
-  TestLayoutItemOrder( controls, hboxLayout );
-
-  tet_infoline("Lower");
-
-  controls[2].Lower();   // 2 1 0(vbox)
-
-  TestLayoutItemOrder( controls, hboxLayout );
-
-  tet_infoline("SetLayout again");
-
-  auto vboxLayout1 = LinearLayout::New();
-  DevelControl::SetLayout( controls[2], vboxLayout1 );  // 2 1(vbox1) 0(vbox)
-
-  TestLayoutItemOrder( controls, hboxLayout );
-
-  tet_infoline("SetLayout with empty handle");
-
-  DevelControl::SetLayout( controls[0], LayoutItem{} );  // 2 1(vbox1) 0
-
-  TestLayoutItemOrder( controls, hboxLayout );
-
-  tet_infoline("SetLayout to another control");
-
-  DevelControl::SetLayout( controls[2], vboxLayout1 );  // 2(vbox1) 1 0
-
-  TestLayoutItemOrder( controls, hboxLayout );
-
-  tet_infoline("SetLayout to change layout");
-
-  DevelControl::SetLayout( controls[2], vboxLayout1 );  // 2(vbox) 1 0
-
-  TestLayoutItemOrder( controls, hboxLayout );
-
-  END_TEST;
-}
-
 
 int UtcDaliLayouting_LayoutGroup01(void)
 {
index 8ddc819..a8927f9 100644 (file)
@@ -172,61 +172,6 @@ Toolkit::LayoutGroup::LayoutId LayoutGroup::Insert( LayoutItem& target, LayoutIt
   return childLayout.layoutId;
 }
 
-Toolkit::LayoutGroup::LayoutId LayoutGroup::Move( LayoutItem& target, LayoutItem& child )
-{
-  // Remove child from the previous position
-  for( auto iter = mImpl->mChildren.begin() ; iter != mImpl->mChildren.end() ; ++iter )
-  {
-    if( iter->child.Get() == &child )
-    {
-      mImpl->mChildren.erase( iter );
-      break;
-    }
-  }
-
-  // Find target position
-  std::vector< Impl::ChildLayout >::iterator position;
-  for( auto iter = mImpl->mChildren.begin(); iter != mImpl->mChildren.end(); ++iter )
-  {
-    if( iter->child.Get() == &target )
-    {
-      position = iter;
-      break;
-    }
-  }
-
-  Impl::ChildLayout childLayout;
-  childLayout.layoutId = mImpl->mNextLayoutId++;
-  childLayout.child = &child;
-  mImpl->mChildren.insert( position, childLayout );
-
-  RequestLayout();
-
-  return childLayout.layoutId;
-}
-
-Toolkit::LayoutGroup::LayoutId LayoutGroup::MoveBack( LayoutItem& child )
-{
-  // Remove child from the previous position
-  for( auto iter = mImpl->mChildren.begin() ; iter != mImpl->mChildren.end() ; ++iter )
-  {
-    if( iter->child.Get() == &child )
-    {
-      mImpl->mChildren.erase( iter );
-      break;
-    }
-  }
-
-  Impl::ChildLayout childLayout;
-  childLayout.layoutId = mImpl->mNextLayoutId++;
-  childLayout.child = &child;
-  mImpl->mChildren.emplace_back( childLayout );
-
-  RequestLayout();
-
-  return childLayout.layoutId;
-}
-
 void LayoutGroup::RemoveAll()
 {
   for( auto iter = mImpl->mChildren.begin() ; iter != mImpl->mChildren.end() ; )
@@ -512,7 +457,6 @@ void LayoutGroup::OnInitialize()
 
     DevelActor::ChildAddedSignal( control ).Connect( mSlotDelegate, &LayoutGroup::ChildAddedToOwner );
     DevelActor::ChildRemovedSignal( control ).Connect( mSlotDelegate, &LayoutGroup::ChildRemovedFromOwner );
-    DevelActor::ChildOrderChangedSignal( control ).Connect( mSlotDelegate, &LayoutGroup::ChildOrderChanged );
     DevelHandle::PropertySetSignal( control ).Connect( mSlotDelegate, &LayoutGroup::OnOwnerPropertySet );
 
     if( control.GetParent() )
@@ -571,7 +515,6 @@ void LayoutGroup::OnUnparent()
   {
     DevelActor::ChildAddedSignal( control ).Disconnect( mSlotDelegate, &LayoutGroup::ChildAddedToOwner );
     DevelActor::ChildRemovedSignal( control ).Disconnect( mSlotDelegate, &LayoutGroup::ChildRemovedFromOwner );
-    DevelActor::ChildOrderChangedSignal( control ).Disconnect( mSlotDelegate, &LayoutGroup::ChildOrderChanged );
     DevelHandle::PropertySetSignal( control ).Disconnect( mSlotDelegate, &LayoutGroup::OnOwnerPropertySet );
   }
 }
@@ -675,42 +618,6 @@ void LayoutGroup::ChildRemovedFromOwner( Actor child )
   }
 }
 
-void LayoutGroup::ChildOrderChanged( Actor child )
-{
-  Toolkit::Control childControl = Toolkit::Control::DownCast( child );
-  if( childControl )
-  {
-    Internal::Control& childControlImpl = GetImplementation( childControl );
-    Internal::Control::Impl& childControlDataImpl = Internal::Control::Impl::Get( childControlImpl );
-
-    auto childLayout = childControlDataImpl.GetLayout();
-    if( childLayout )
-    {
-      Toolkit::Control control = Toolkit::Control::DownCast( GetOwner() );
-      unsigned int count = control.GetChildCount();
-      unsigned int index = static_cast< unsigned int >( childControl.GetProperty< int >( DevelActor::Property::SIBLING_ORDER ) );
-
-      // Find insertion position
-      while( ++index < count )
-      {
-        auto sibling = Toolkit::Control::DownCast( control.GetChildAt( index ) );
-        if( sibling )
-        {
-          auto siblingLayout = DevelControl::GetLayout( sibling );
-          if( siblingLayout )
-          {
-            Internal::LayoutItem& siblingLayoutImpl = GetImplementation( siblingLayout );
-            Move( siblingLayoutImpl, *childLayout );
-            return;
-          }
-        }
-      }
-
-      MoveBack( *childLayout );
-    }
-  }
-}
-
 void LayoutGroup::OnOwnerPropertySet( Handle& handle, Property::Index index, Property::Value value )
 {
   DALI_LOG_INFO( gLogFilter, Debug::Concise, "LayoutGroup::OnOwnerPropertySet\n");
index 37aa90f..5a2796b 100644 (file)
@@ -111,19 +111,6 @@ public:
   Toolkit::LayoutGroup::LayoutId Insert( LayoutItem& target, LayoutItem& child ) override;
 
   /**
-   * @brief Move a child to another position
-   * @param[in] target The target item
-   * @param[in] child The item to move
-   */
-  Toolkit::LayoutGroup::LayoutId Move( LayoutItem& target, LayoutItem& child ) override;
-
-  /**
-   * @brief Move a child to back
-   * @param[in] child The item to move
-   */
-  Toolkit::LayoutGroup::LayoutId MoveBack( LayoutItem& child ) override;
-
-  /**
    * @brief Remove all layout children.
    *
    * @note This will not unparent owner's children
@@ -304,11 +291,6 @@ private:
   void ChildRemovedFromOwner( Actor child );
 
   /**
-   * Callback when child order is changed
-   */
-  void ChildOrderChanged( Actor child );
-
-  /**
    * Callback when an owner property is set. Triggers a relayout if it's a child property
    */
   void OnOwnerPropertySet( Handle& handle, Property::Index index, Property::Value value );
index 7c9414f..a55c7cb 100644 (file)
@@ -59,18 +59,6 @@ public:
    */
   virtual Toolkit::LayoutGroup::LayoutId Insert( LayoutItem& target, LayoutItem& item ) = 0;
 
-  /**
-   * @brief Move a child to another position
-   * @param[in] target The target item
-   * @param[in] item The item to move
-   */
-  virtual Toolkit::LayoutGroup::LayoutId Move( LayoutItem& target, LayoutItem& item ) = 0;
-
-  /**
-   * @brief Move a child to back
-   * @param[in] item The item to move
-   */
-  virtual Toolkit::LayoutGroup::LayoutId MoveBack( LayoutItem& item ) = 0;
 
 protected:
   virtual ~LayoutParent()