Merge "(Vector) Fix occasional tc failure" into devel/master
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 13 Jul 2022 10:41:13 +0000 (10:41 +0000)
committerGerrit Code Review <gerrit@review>
Wed, 13 Jul 2022 10:41:13 +0000 (10:41 +0000)
automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/dbus-wrapper.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-compare-types.h
dali-toolkit/internal/text/text-controller-text-updater.cpp

index e44aa56..d3f4e25 100644 (file)
@@ -125,6 +125,8 @@ struct DBusWrapper
   virtual ObjectPtr eldbus_object_get_impl( const ConnectionPtr &conn, const std::string &bus, const std::string &path ) = 0;
   virtual ProxyPtr eldbus_proxy_get_impl( const ObjectPtr &obj, const std::string &interface ) = 0;
   virtual ProxyPtr eldbus_proxy_copy_impl( const ProxyPtr &ptr) = 0;
+  virtual void eldbus_name_request_impl(const ConnectionPtr&, const std::string&) {} // no-op
+  virtual void eldbus_name_release_impl(const ConnectionPtr&, const std::string&) {} // no-op
 
   class StringStorage
   {
index d917107..fcadd6f 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TEST_COMPARE_TYPES_H
 
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -111,109 +111,4 @@ inline bool CompareType<Extents>(Extents extents1, Extents extents2, float epsil
          (extents1.bottom == extents2.bottom);
 }
 
-template<>
-inline bool CompareType<Property::Value>(Property::Value q1, Property::Value q2, float epsilon)
-{
-  Property::Type type = q1.GetType();
-  if(type != q2.GetType())
-  {
-    return false;
-  }
-
-  bool result = false;
-  switch(type)
-  {
-    case Property::BOOLEAN:
-    {
-      bool a, b;
-      q1.Get(a);
-      q2.Get(b);
-      result = a == b;
-      break;
-    }
-    case Property::INTEGER:
-    {
-      int a, b;
-      q1.Get(a);
-      q2.Get(b);
-      result = a == b;
-      break;
-    }
-    case Property::FLOAT:
-    {
-      float a, b;
-      q1.Get(a);
-      q2.Get(b);
-      result = CompareType<float>(a, b, epsilon);
-      break;
-    }
-    case Property::VECTOR2:
-    {
-      Vector2 a, b;
-      q1.Get(a);
-      q2.Get(b);
-      result = CompareType<Vector2>(a, b, epsilon);
-      break;
-    }
-    case Property::VECTOR3:
-    {
-      Vector3 a, b;
-      q1.Get(a);
-      q2.Get(b);
-      result = CompareType<Vector3>(a, b, epsilon);
-      break;
-    }
-    case Property::RECTANGLE:
-    case Property::VECTOR4:
-    {
-      Vector4 a, b;
-      q1.Get(a);
-      q2.Get(b);
-      result = CompareType<Vector4>(a, b, epsilon);
-      break;
-    }
-    case Property::ROTATION:
-    {
-      Quaternion a, b;
-      q1.Get(a);
-      q2.Get(b);
-      result = CompareType<Quaternion>(a, b, epsilon);
-      break;
-    }
-    case Property::STRING:
-    {
-      std::string a, b;
-      q1.Get(a);
-      q2.Get(b);
-      result = (a.compare(b) == 0);
-      break;
-    }
-    case Property::MATRIX:
-    case Property::MATRIX3:
-    case Property::ARRAY:
-    case Property::MAP:
-    {
-      //TODO: Implement this?
-      DALI_ASSERT_ALWAYS(0 && "Not implemented");
-      result = false;
-      break;
-    }
-    case Property::EXTENTS:
-    {
-      Extents a, b;
-      q1.Get(a);
-      q2.Get(b);
-      result = CompareType<Extents>(a, b, epsilon);
-      break;
-    }
-    case Property::NONE:
-    {
-      result = false;
-      break;
-    }
-  }
-
-  return result;
-}
-
 #endif
index 35408da..4d0ba8f 100644 (file)
@@ -473,6 +473,7 @@ bool Controller::TextUpdater::RemoveText(
   UpdateInputStyleType type)
 {
   bool removed = false;
+  bool removeAll = false;
 
   Controller::Impl& impl      = *controller.mImpl;
   EventData*&       eventData = impl.mEventData;
@@ -526,9 +527,14 @@ bool Controller::TextUpdater::RemoveText(
       numberOfCharacters = currentText.Count() - cursorIndex;
     }
 
+    if((cursorIndex == 0) && (currentText.Count() - numberOfCharacters == 0))
+    {
+      removeAll = true;
+    }
+
     TextUpdateInfo& textUpdateInfo = impl.mTextUpdateInfo;
 
-    if(eventData->mPreEditFlag || // If the preedit flag is enabled, it means two (or more) of them came together i.e. when two keys have been pressed at the same time.
+    if(eventData->mPreEditFlag || removeAll || // If the preedit flag is enabled, it means two (or more) of them came together i.e. when two keys have been pressed at the same time.
        ((cursorIndex + numberOfCharacters) <= textUpdateInfo.mPreviousNumberOfCharacters))
     {
       // Mark the paragraphs to be updated.
@@ -574,7 +580,7 @@ bool Controller::TextUpdater::RemoveText(
 
       // If the number of current text and the number of characters to be deleted are same,
       // it means all texts should be removed and all Preedit variables should be initialized.
-      if((currentText.Count() - numberOfCharacters == 0) && (cursorIndex == 0))
+      if(removeAll)
       {
         impl.ClearPreEditFlag();
         textUpdateInfo.mNumberOfCharactersToAdd = 0;
@@ -617,6 +623,7 @@ bool Controller::TextUpdater::RemoveText(
       }
 
       DALI_LOG_INFO(gLogFilter, Debug::General, "Controller::RemoveText %p removed %d\n", &controller, numberOfCharacters);
+      removeAll = false;
       removed = true;
     }
   }