Merge branch 'devel/master' into tizen
authorhuiyu.eun <huiyu.eun@samsung.com>
Mon, 29 Nov 2021 07:51:55 +0000 (16:51 +0900)
committerhuiyu.eun <huiyu.eun@samsung.com>
Mon, 29 Nov 2021 07:51:55 +0000 (16:51 +0900)
Change-Id: I115e366d41f91543676549da2abce9525913762e

automated-tests/src/dali-internal/utc-Dali-Internal-ActorRelayout.cpp
automated-tests/src/dali/utc-Dali-CustomActor.cpp
dali/internal/event/actors/actor-impl.h
dali/internal/event/actors/actor-relayouter.cpp
dali/internal/event/actors/actor-relayouter.h
dali/internal/event/actors/actor-sizer.cpp
dali/public-api/dali-core-version.cpp
packaging/dali.spec

index 2e77750..1df40f0 100644 (file)
@@ -49,7 +49,12 @@ int UtcDaliActorSizer_CalculateSize(void)
   auto& actorImpl     = GetImplementation(actor);
 
   DALI_TEST_EQUALS(testActorImpl.IsRelayoutEnabled(), false, TEST_LOCATION);
-  DALI_TEST_CHECK(true);
+
+  // With no relayouting, there are no default dependencies
+  DALI_TEST_EQUALS(actorImpl.RelayoutDependentOnParent(Dimension::ALL_DIMENSIONS), false, TEST_LOCATION);
+
+  // But, current broken behaviour is to depend on children. Retain this behaviour for now.
+  DALI_TEST_EQUALS(testActorImpl.RelayoutDependentOnChildren(Dimension::ALL_DIMENSIONS), true, TEST_LOCATION);
 
   actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
   actor[Dali::Actor::Property::SIZE] = Vector2(150.0f, 100.0f); // Should automatically set preferred size
index a51242d..e33a738 100644 (file)
@@ -1183,18 +1183,56 @@ int UtcDaliCustomActorImplCalculateChildSizeBase(void)
 int UtcDaliCustomActorImplRelayoutDependentOnChildrenBase(void)
 {
   TestApplication       application;
-  Test::TestCustomActor custom = Test::TestCustomActor::NewNegoSize();
-  custom.SetResizePolicy(Dali::ResizePolicy::FIT_TO_CHILDREN, Dali::Dimension::ALL_DIMENSIONS);
+  Test::TestCustomActor customNego    = Test::TestCustomActor::NewNegoSize();
+  Test::TestCustomActor customNotNego = Test::TestCustomActor::New();
+
+  // A custom actor with default flags has relayouting enabled on initialization,
+  // and the default resize policy is USE_NATURAL_SIZE.
+  bool v = customNego.TestRelayoutDependentOnChildrenBase(Dali::Dimension::ALL_DIMENSIONS);
+  DALI_TEST_CHECK(v == true);
 
-  bool v = custom.TestRelayoutDependentOnChildrenBase(Dali::Dimension::ALL_DIMENSIONS);
+  // A custom actor with size negotiation explicitly switched off has no relayouting,
+  // and will not have any relayout dependencies. However, default resize policy when
+  // there is no relayouting is to return USE_NATURAL_SIZE, so this will actually return true,
+  // and is consistent.
+  v = customNotNego.TestRelayoutDependentOnChildrenBase(Dali::Dimension::ALL_DIMENSIONS);
   DALI_TEST_CHECK(v == true);
 
+  customNego.SetResizePolicy(Dali::ResizePolicy::FIT_TO_CHILDREN, Dali::Dimension::ALL_DIMENSIONS);
+  customNotNego.SetResizePolicy(Dali::ResizePolicy::FIT_TO_CHILDREN, Dali::Dimension::ALL_DIMENSIONS);
+
+  v = customNego.TestRelayoutDependentOnChildrenBase(Dali::Dimension::ALL_DIMENSIONS);
+  DALI_TEST_CHECK(v == true);
+  v = customNotNego.TestRelayoutDependentOnChildrenBase(Dali::Dimension::ALL_DIMENSIONS);
+  DALI_TEST_CHECK(v == true);
+
+  application.SendNotification();
+  application.Render();
+
+  customNego.SetResizePolicy(Dali::ResizePolicy::FIXED, Dali::Dimension::ALL_DIMENSIONS);
+  customNotNego.SetResizePolicy(Dali::ResizePolicy::FIXED, Dali::Dimension::ALL_DIMENSIONS);
+  v = customNego.TestRelayoutDependentOnChildrenBase(Dali::Dimension::WIDTH);
+  DALI_TEST_CHECK(v == false);
+  v = customNego.TestRelayoutDependentOnChildrenBase(Dali::Dimension::HEIGHT);
+  DALI_TEST_CHECK(v == false);
+  v = customNotNego.TestRelayoutDependentOnChildrenBase(Dali::Dimension::WIDTH);
+  DALI_TEST_CHECK(v == false);
+  v = customNotNego.TestRelayoutDependentOnChildrenBase(Dali::Dimension::HEIGHT);
+  DALI_TEST_CHECK(v == false);
+
   application.SendNotification();
   application.Render();
 
-  custom.SetResizePolicy(Dali::ResizePolicy::FIXED, Dali::Dimension::ALL_DIMENSIONS);
-  v = custom.TestRelayoutDependentOnChildrenBase(Dali::Dimension::WIDTH);
+  customNego.SetResizePolicy(Dali::ResizePolicy::USE_NATURAL_SIZE, Dali::Dimension::WIDTH);
+  customNotNego.SetResizePolicy(Dali::ResizePolicy::USE_NATURAL_SIZE, Dali::Dimension::HEIGHT);
+  v = customNego.TestRelayoutDependentOnChildrenBase(Dali::Dimension::WIDTH);
+  DALI_TEST_CHECK(v == true);
+  v = customNego.TestRelayoutDependentOnChildrenBase(Dali::Dimension::HEIGHT);
   DALI_TEST_CHECK(v == false);
+  v = customNotNego.TestRelayoutDependentOnChildrenBase(Dali::Dimension::WIDTH);
+  DALI_TEST_CHECK(v == false);
+  v = customNotNego.TestRelayoutDependentOnChildrenBase(Dali::Dimension::HEIGHT);
+  DALI_TEST_CHECK(v == true);
 
   END_TEST;
 }
index 8f72b23..8ab4be7 100644 (file)
@@ -1850,7 +1850,6 @@ protected:
   bool                     mKeyboardFocusableChildren : 1; ///< Whether the children of this actor can be focusable by keyboard navigation.
   bool                     mTouchFocusable : 1;            ///< Whether the actor should be focusable by touch
   bool                     mOnSceneSignalled : 1;          ///< Set to true before OnSceneConnection signal is emitted, and false before OnSceneDisconnection
-  bool                     mInsideOnSizeSet : 1;           ///< Whether we are inside OnSizeSet
   bool                     mInheritPosition : 1;           ///< Cached: Whether the parent's position should be inherited.
   bool                     mInheritOrientation : 1;        ///< Cached: Whether the parent's orientation should be inherited.
   bool                     mInheritScale : 1;              ///< Cached: Whether the parent's scale should be inherited.
index cfebf86..696232d 100644 (file)
@@ -287,42 +287,6 @@ void ActorSizer::Relayouter::SetResizePolicy(ResizePolicy::Type policy, Dimensio
   }
 }
 
-bool ActorSizer::Relayouter::GetRelayoutDependentOnParent(Dimension::Type dimension)
-{
-  // Check if actor is dependent on parent
-  for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
-  {
-    if((dimension & (1 << i)))
-    {
-      const ResizePolicy::Type resizePolicy = GetResizePolicy(static_cast<Dimension::Type>(1 << i));
-      if(resizePolicy == ResizePolicy::FILL_TO_PARENT || resizePolicy == ResizePolicy::SIZE_RELATIVE_TO_PARENT || resizePolicy == ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT)
-      {
-        return true;
-      }
-    }
-  }
-  return false;
-}
-
-bool ActorSizer::Relayouter::GetRelayoutDependentOnChildren(Dimension::Type dimension)
-{
-  // Check if actor is dependent on children
-  for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
-  {
-    if((dimension & (1 << i)))
-    {
-      const ResizePolicy::Type resizePolicy = GetResizePolicy(static_cast<Dimension::Type>(1 << i));
-      if(resizePolicy == ResizePolicy::FIT_TO_CHILDREN || resizePolicy == ResizePolicy::USE_NATURAL_SIZE)
-      {
-        return true;
-      }
-      break;
-    }
-  }
-
-  return false;
-}
-
 bool ActorSizer::Relayouter::GetRelayoutDependentOnDimension(Dimension::Type dimension, Dimension::Type dependency)
 {
   // Check each possible dimension and see if it is dependent on the input one
index f1ade33..73b1f55 100644 (file)
@@ -72,12 +72,6 @@ struct ActorSizer::Relayouter
   /// @copydoc Actor::SetResizePolicy
   void SetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension, Vector3& targetSize);
 
-  /// @copydoc Actor::GetRelayoutDependentOnParent
-  bool GetRelayoutDependentOnParent(Dimension::Type dimension);
-
-  /// @copydoc Actor::GetRelayoutDependentOnChildren
-  bool GetRelayoutDependentOnChildren(Dimension::Type dimension);
-
   /// @copydoc Actor::GetRelayoutDependentOnDimension
   bool GetRelayoutDependentOnDimension(Dimension::Type dimension, Dimension::Type dependency);
 
index d5c00ea..95c6de8 100644 (file)
@@ -62,6 +62,7 @@ constexpr float GetDimensionValue(const Dali::Vector2& values, const Dali::Dimen
   }
   return 0.0f;
 }
+
 } // namespace
 
 namespace Dali::Internal
@@ -322,12 +323,54 @@ ActorSizer::Relayouter& ActorSizer::EnsureRelayouter()
 
 bool ActorSizer::RelayoutDependentOnParent(Dimension::Type dimension)
 {
-  return mRelayoutData && mRelayoutData->GetRelayoutDependentOnParent(dimension);
+  // If there is no relayouting, GetResizePolicy returns Default, which is USE_NATURAL_SIZE. This
+  // will keep the existing behaviour, and return false.
+
+  // Check if actor is dependent on parent
+  for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
+  {
+    if((dimension & (1 << i)))
+    {
+      const ResizePolicy::Type resizePolicy = GetResizePolicy(static_cast<Dimension::Type>(1 << i));
+      if(resizePolicy == ResizePolicy::FILL_TO_PARENT || resizePolicy == ResizePolicy::SIZE_RELATIVE_TO_PARENT || resizePolicy == ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT)
+      {
+        return true;
+      }
+    }
+  }
+
+  return false;
 }
 
 bool ActorSizer::RelayoutDependentOnChildrenBase(Dimension::Type dimension)
 {
-  return mRelayoutData && mRelayoutData->GetRelayoutDependentOnChildren(dimension);
+  // If there is no relayouting, GetResizePolicy returns Default, which is USE_NATURAL_SIZE.
+  // This means this will return true when there is no relayouting, but that seems
+  // counter-intuitive. Will keep current behaviour for now, as it is consistent.
+
+  // Check if actor is dependent on children
+  for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
+  {
+    if((dimension & (1 << i)))
+    {
+      const ResizePolicy::Type resizePolicy = GetResizePolicy(static_cast<Dimension::Type>(1 << i));
+      switch(resizePolicy)
+      {
+        case ResizePolicy::FIT_TO_CHILDREN:
+        case ResizePolicy::USE_NATURAL_SIZE: // i.e. For things that calculate their size based on children
+        {
+          return true;
+        }
+
+        default:
+        {
+          break;
+        }
+      }
+    }
+  }
+
+  return false;
 }
 
 bool ActorSizer::RelayoutDependentOnDimension(Dimension::Type dimension, Dimension::Type dependentDimension)
index 02fbe67..58bf1f4 100644 (file)
@@ -26,8 +26,8 @@
 namespace Dali
 {
 const uint32_t    CORE_MAJOR_VERSION = 2;
-const uint32_t    CORE_MINOR_VERSION = 0;
-const uint32_t    CORE_MICRO_VERSION = 53;
+const uint32_t    CORE_MINOR_VERSION = 1;
+const uint32_t    CORE_MICRO_VERSION = 0;
 const char* const CORE_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index 00074c8..b409e1c 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali2
 Summary:    DALi 3D Engine
-Version:    2.0.53
+Version:    2.1.0
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-3-Clause and MIT