[Scene3D] Let we allow to release PixelData memory after upload for 3D cache
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / test-compare-types.h
index d917107..a31f162 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TEST_COMPARE_TYPES_H
 
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -27,9 +27,9 @@ inline bool CompareType(Type value1, Type value2, float epsilon)
 }
 
 /**
- * A helper for fuzzy-comparing Vector2 objects
- * @param[in] vector1 the first object
- * @param[in] vector2 the second object
+ * A helper for matching floats
+ * @param[in] value1 the first object
+ * @param[in] value2 the second object
  * @param[in] epsilon difference threshold
  * @returns true if difference is smaller than epsilon threshold, false otherwise
  */
@@ -40,6 +40,19 @@ inline bool CompareType<float>(float value1, float value2, float epsilon)
 }
 
 /**
+ * A helper for matching doubles
+ * @param[in] value1 the first object
+ * @param[in] value2 the second object
+ * @param[in] epsilon difference threshold
+ * @returns true if difference is smaller than epsilon threshold, false otherwise
+ */
+template<>
+inline bool CompareType<double>(double value1, double value2, float epsilon)
+{
+  return fabs(value1 - value2) < double(epsilon);
+}
+
+/**
  * A helper for fuzzy-comparing Vector2 objects
  * @param[in] vector1 the first object
  * @param[in] vector2 the second object
@@ -111,109 +124,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