X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Fdali-toolkit-test-utils%2Ftest-compare-types.h;h=d917107aba831aa178199357cb03a628bf9b733f;hb=1a0dc2cc53708bbc32546da6031e996465544f51;hp=5870028a647eb6b4af14e0d188cf730196270a3c;hpb=ce9ca5f372bb0b1880bcec297c4b0482c54145d9;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-compare-types.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-compare-types.h index 5870028..d917107 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-compare-types.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-compare-types.h @@ -2,7 +2,7 @@ #define DALI_TEST_COMPARE_TYPES_H /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -20,8 +20,7 @@ #include using namespace Dali; - -template +template inline bool CompareType(Type value1, Type value2, float epsilon) { return value1 == value2; @@ -34,7 +33,7 @@ inline bool CompareType(Type value1, Type value2, float epsilon) * @param[in] epsilon difference threshold * @returns true if difference is smaller than epsilon threshold, false otherwise */ -template <> +template<> inline bool CompareType(float value1, float value2, float epsilon) { return fabsf(value1 - value2) < epsilon; @@ -47,10 +46,10 @@ inline bool CompareType(float value1, float value2, float epsilon) * @param[in] epsilon difference threshold * @returns true if difference is smaller than epsilon threshold, false otherwise */ -template <> +template<> inline bool CompareType(Vector2 vector1, Vector2 vector2, float epsilon) { - return fabsf(vector1.x - vector2.x)(Vector2 vector1, Vector2 vector2, float epsilon * @param[in] epsilon difference threshold * @returns true if difference is smaller than epsilon threshold, false otherwise */ -template <> +template<> inline bool CompareType(Vector3 vector1, Vector3 vector2, float epsilon) { - return fabsf(vector1.x - vector2.x)(Vector3 vector1, Vector3 vector2, float epsilon * @param[in] epsilon difference threshold * @returns true if difference is smaller than epsilon threshold, false otherwise */ -template <> +template<> inline bool CompareType(Vector4 vector1, Vector4 vector2, float epsilon) { - return fabsf(vector1.x - vector2.x) +template<> inline bool CompareType(Quaternion q1, Quaternion q2, float epsilon) { Quaternion q2N = -q2; // These quaternions represent the same rotation return CompareType(q1.mVector, q2.mVector, epsilon) || CompareType(q1.mVector, q2N.mVector, epsilon); } -template <> +template<> inline bool CompareType(Radian q1, Radian q2, float epsilon) { return CompareType(q1.radian, q2.radian, epsilon); } -template <> +template<> inline bool CompareType(Degree q1, Degree q2, float epsilon) { return CompareType(q1.degree, q2.degree, epsilon); } -template <> +template<> inline bool CompareType(Extents extents1, Extents extents2, float epsilon) { return (extents1.start == extents2.start) && @@ -113,11 +111,11 @@ inline bool CompareType(Extents extents1, Extents extents2, float epsil (extents1.bottom == extents2.bottom); } -template <> +template<> inline bool CompareType(Property::Value q1, Property::Value q2, float epsilon) { Property::Type type = q1.GetType(); - if( type != q2.GetType() ) + if(type != q2.GetType()) { return false; } @@ -130,7 +128,7 @@ inline bool CompareType(Property::Value q1, Property::Value q2, bool a, b; q1.Get(a); q2.Get(b); - result = a == b; + result = a == b; break; } case Property::INTEGER: @@ -138,7 +136,7 @@ inline bool CompareType(Property::Value q1, Property::Value q2, int a, b; q1.Get(a); q2.Get(b); - result = a == b; + result = a == b; break; } case Property::FLOAT: @@ -146,7 +144,7 @@ inline bool CompareType(Property::Value q1, Property::Value q2, float a, b; q1.Get(a); q2.Get(b); - result = CompareType(a, b, epsilon); + result = CompareType(a, b, epsilon); break; } case Property::VECTOR2: @@ -196,7 +194,7 @@ inline bool CompareType(Property::Value q1, Property::Value q2, case Property::MAP: { //TODO: Implement this? - DALI_ASSERT_ALWAYS( 0 && "Not implemented"); + DALI_ASSERT_ALWAYS(0 && "Not implemented"); result = false; break; } @@ -205,7 +203,7 @@ inline bool CompareType(Property::Value q1, Property::Value q2, Extents a, b; q1.Get(a); q2.Get(b); - result = CompareType( a, b, epsilon ); + result = CompareType(a, b, epsilon); break; } case Property::NONE: @@ -218,6 +216,4 @@ inline bool CompareType(Property::Value q1, Property::Value q2, return result; } - - #endif