X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Fdali-toolkit-test-utils%2Fdali-test-suite-utils.h;h=7f81872e1388101410e950f9cb6b514de80fd00e;hp=c521fbfbc6300d89a9bd35de24bc63af5ff11f9c;hb=9b1791de7d9e29435943464acc7cd896c44015a1;hpb=75fdb5f9730fa6f6723c517691c9778fb646d082 diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.h index c521fbf..7f81872 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.h @@ -29,6 +29,7 @@ void tet_infoline(const char*str); void tet_printf(const char *format, ...); #include "test-application.h" +#include "test-actor-utils.h" using namespace Dali; @@ -152,6 +153,82 @@ inline bool CompareType(Degree q1, Degree q2, float epsilon) return CompareType(q1.degree, q2.degree, epsilon); } +template <> +inline bool CompareType(Property::Value q1, Property::Value q2, float epsilon) +{ + Property::Type type = q1.GetType(); + if( type != q2.GetType() ) + { + return false; + } + + switch(type) + { + case Property::BOOLEAN: + { + bool a, b; + q1.Get(a); + q2.Get(b); + return a == b; + break; + } + case Property::INTEGER: + { + int a, b; + q1.Get(a); + q2.Get(b); + return a == b; + break; + } + case Property::FLOAT: + { + float a, b; + q1.Get(a); + q2.Get(b); + return CompareType(a, b, epsilon); + break; + } + case Property::VECTOR2: + { + Vector2 a, b; + q1.Get(a); + q2.Get(b); + return CompareType(a, b, epsilon); + break; + } + case Property::VECTOR3: + { + Vector3 a, b; + q1.Get(a); + q2.Get(b); + return CompareType(a, b, epsilon); + break; + } + case Property::RECTANGLE: + case Property::VECTOR4: + { + Vector4 a, b; + q1.Get(a); + q2.Get(b); + return CompareType(a, b, epsilon); + break; + } + case Property::ROTATION: + { + Quaternion a, b; + q1.Get(a); + q2.Get(b); + return CompareType(a, b, epsilon); + break; + } + default: + return false; + } + + return false; +} + + bool operator==(TimePeriod a, TimePeriod b); std::ostream& operator<<( std::ostream& ostream, TimePeriod value ); std::ostream& operator<<( std::ostream& ostream, Radian angle ); @@ -195,6 +272,23 @@ inline void DALI_TEST_EQUALS(Type value1, Type value2, float epsilon, const char } } +template +inline void DALI_TEST_NOT_EQUALS(Type value1, Type value2, float epsilon, const char* location) +{ + if( CompareType(value1, value2, epsilon) ) + { + std::ostringstream o; + o << value1 << " != " << value2 << std::endl; + fprintf(stderr, "%s, checking %s", location, o.str().c_str()); + tet_result(TET_FAIL); + } + else + { + tet_result(TET_PASS); + } +} + + /** * Test whether two TimePeriods are within a certain distance of each other. * @param[in] value1 The first value @@ -315,6 +409,14 @@ inline void DALI_TEST_EQUALS( const std::string &str1, const * @param[in] str2 The second string * @param[in] location The TEST_LOCATION macro should be used here */ +void DALI_TEST_EQUALS( Property::Value& str1, const char* str2, const char* location); + +/** + * Test whether two strings are equal. + * @param[in] str1 The first string + * @param[in] str2 The second string + * @param[in] location The TEST_LOCATION macro should be used here + */ void DALI_TEST_EQUALS( const std::string &str1, const char* str2, const char* location); /**