From 239ad8168d2aa2592536f0054e55749c8e388653 Mon Sep 17 00:00:00 2001 From: Adeel Kazmi Date: Mon, 23 Nov 2015 10:04:51 +0000 Subject: [PATCH] (AutomatedTests) Ensure warnings are shown as errors Change-Id: I7a5bc56e8fb61f2020d34c5aa0395a536f90175c --- .../src/dali-adaptor-internal/CMakeLists.txt | 2 +- .../utc-Dali-ImageOperations.cpp | 104 +++++++++--------- .../src/dali-adaptor/CMakeLists.txt | 2 +- .../dali-test-suite-utils.cpp | 53 ++++----- .../dali-test-suite-utils.h | 35 +++++- .../test-gl-abstraction.h | 18 +-- .../test-native-image.cpp | 2 +- .../dali-test-suite-utils/test-native-image.h | 10 +- .../dali-test-suite-utils/test-touch-utils.h | 2 +- .../dali-platform-abstraction/CMakeLists.txt | 2 +- 10 files changed, 132 insertions(+), 98 deletions(-) diff --git a/automated-tests/src/dali-adaptor-internal/CMakeLists.txt b/automated-tests/src/dali-adaptor-internal/CMakeLists.txt index 0b083c3d2..99d4f39f2 100644 --- a/automated-tests/src/dali-adaptor-internal/CMakeLists.txt +++ b/automated-tests/src/dali-adaptor-internal/CMakeLists.txt @@ -34,7 +34,7 @@ PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED ecore ) -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb --coverage -Wall -Werror=return-type" ) +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb --coverage -Wall -Werror" ) # Shouldn't have to do this! # But CMake's new auto-escape quote policy doesn't work right. diff --git a/automated-tests/src/dali-adaptor-internal/utc-Dali-ImageOperations.cpp b/automated-tests/src/dali-adaptor-internal/utc-Dali-ImageOperations.cpp index 37d1a9ee8..de79e0fe4 100644 --- a/automated-tests/src/dali-adaptor-internal/utc-Dali-ImageOperations.cpp +++ b/automated-tests/src/dali-adaptor-internal/utc-Dali-ImageOperations.cpp @@ -420,7 +420,7 @@ int UtcDaliImageOperationsDownscaleInPlacePow2RGB888(void) Dali::Internal::Platform::DownscaleInPlacePow2RGB888(check_4x4, 4, 4, 1, 1, BoxDimensionTestBoth, outWidth, outHeight ); DALI_TEST_EQUALS( outWidth, 1u, TEST_LOCATION ); DALI_TEST_EQUALS( outHeight, 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( check_4x4[0], 0x7f, TEST_LOCATION ); + DALI_TEST_EQUALS( check_4x4[0], (unsigned char)0x7f, TEST_LOCATION ); // Scale down a 16 pixel black image with a single white pixel to a 1/16th grey single pixel: unsigned char single_4x4 [16 * 3] = { @@ -432,7 +432,7 @@ int UtcDaliImageOperationsDownscaleInPlacePow2RGB888(void) Dali::Internal::Platform::DownscaleInPlacePow2RGB888(single_4x4, 4, 4, 1, 1, BoxDimensionTestBoth, outWidth, outHeight ); DALI_TEST_EQUALS( outWidth, 1u, TEST_LOCATION ); DALI_TEST_EQUALS( outHeight, 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( single_4x4[0], 0xf, TEST_LOCATION ); + DALI_TEST_EQUALS( single_4x4[0], (unsigned char)0xf, TEST_LOCATION ); // Scale down a 16 pixel black image with a single white pixel to a 1/16th grey single pixel: // (white pixel at bottom-right of image) @@ -445,7 +445,7 @@ int UtcDaliImageOperationsDownscaleInPlacePow2RGB888(void) Dali::Internal::Platform::DownscaleInPlacePow2RGB888(single_4x4_2, 4, 4, 1, 1, BoxDimensionTestBoth, outWidth, outHeight ); DALI_TEST_EQUALS( outWidth, 1u, TEST_LOCATION ); DALI_TEST_EQUALS( outHeight, 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( single_4x4_2[0], 0xf, TEST_LOCATION ); + DALI_TEST_EQUALS( single_4x4_2[0], (unsigned char)0xf, TEST_LOCATION ); // Build a larger ~600 x ~600 uniform magenta image for tests which only test output dimensions: @@ -854,7 +854,7 @@ int UtcDaliImageOperationsHalveScanlineInPlaceRGBA8888(void) // Test for no beyond-bounds writes: for( size_t i = scanlineLength / 2; i < reference.Capacity(); ++i ) { - DALI_TEST_EQUALS( reference[i], 0xEEEEEEEE, TEST_LOCATION ); + DALI_TEST_EQUALS( reference[i], (uint32_t)0xEEEEEEEE, TEST_LOCATION ); } END_TEST; @@ -884,7 +884,7 @@ int UtcDaliImageOperationsHalveScanlineInPlaceRGB565(void) // Test for no beyond-bounds writes: for( size_t i = scanlineLength / 2; i < reference.Capacity(); ++i ) { - DALI_TEST_EQUALS( reference[i], 0xEEEE, TEST_LOCATION ); + DALI_TEST_EQUALS( reference[i], (uint16_t)0xEEEE, TEST_LOCATION ); } END_TEST; @@ -1084,8 +1084,8 @@ int UtcDaliImageOperationsAverageScanlinesRGB565(void) } // Check for buffer overrun: - DALI_TEST_EQUALS( outputBuffer[arrayLength], 0xDEAD, TEST_LOCATION ); - DALI_TEST_EQUALS( outputBuffer[arrayLength+1], 0xDEAD, TEST_LOCATION ); + DALI_TEST_EQUALS( outputBuffer[arrayLength], (uint16_t)0xDEAD, TEST_LOCATION ); + DALI_TEST_EQUALS( outputBuffer[arrayLength+1], (uint16_t)0xDEAD, TEST_LOCATION ); END_TEST; } @@ -1233,51 +1233,51 @@ int UtcDaliImageOperationsPointSampleCheckerboardRGBA888(void) Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) &image->GetVector()[0], 256, 256, (unsigned char*) outputImage, desiredWidth, desiredHeight ); - DALI_TEST_EQUALS( outputImage[0], 0xff0000ff, TEST_LOCATION ); // < Red corner pixel - DALI_TEST_EQUALS( outputImage[7], 0xff00ff00, TEST_LOCATION ); // < Green corner pixel - DALI_TEST_EQUALS( outputImage[8*8-1], 0xffff0000, TEST_LOCATION ); // < Blue corner pixel + DALI_TEST_EQUALS( outputImage[0], (uint32_t)0xff0000ff, TEST_LOCATION ); // < Red corner pixel + DALI_TEST_EQUALS( outputImage[7], (uint32_t)0xff00ff00, TEST_LOCATION ); // < Green corner pixel + DALI_TEST_EQUALS( outputImage[8*8-1], (uint32_t)0xffff0000, TEST_LOCATION ); // < Blue corner pixel - DALI_TEST_EQUALS( outputImage[1], 0xff000000, TEST_LOCATION ); // < black pixel - DALI_TEST_EQUALS( outputImage[2], 0xffffffff, TEST_LOCATION ); // < white pixel - DALI_TEST_EQUALS( outputImage[3], 0xff000000, TEST_LOCATION ); // < black pixel - DALI_TEST_EQUALS( outputImage[4], 0xffffffff, TEST_LOCATION ); // < white pixel - DALI_TEST_EQUALS( outputImage[5], 0xff000000, TEST_LOCATION ); // < black pixel - DALI_TEST_EQUALS( outputImage[6], 0xffffffff, TEST_LOCATION ); // < white pixel + DALI_TEST_EQUALS( outputImage[1], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel + DALI_TEST_EQUALS( outputImage[2], (uint32_t)0xffffffff, TEST_LOCATION ); // < white pixel + DALI_TEST_EQUALS( outputImage[3], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel + DALI_TEST_EQUALS( outputImage[4], (uint32_t)0xffffffff, TEST_LOCATION ); // < white pixel + DALI_TEST_EQUALS( outputImage[5], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel + DALI_TEST_EQUALS( outputImage[6], (uint32_t)0xffffffff, TEST_LOCATION ); // < white pixel // Second scanline: - DALI_TEST_EQUALS( outputImage[8+0], 0xff000000, TEST_LOCATION ); // < black pixel - DALI_TEST_EQUALS( outputImage[8+1], 0xffffffff, TEST_LOCATION ); // < white pixel - DALI_TEST_EQUALS( outputImage[8+2], 0xff000000, TEST_LOCATION ); // < black pixel - DALI_TEST_EQUALS( outputImage[8+3], 0xffffffff, TEST_LOCATION ); // < white pixel - DALI_TEST_EQUALS( outputImage[8+4], 0xff000000, TEST_LOCATION ); // < black pixel - DALI_TEST_EQUALS( outputImage[8+5], 0xffffffff, TEST_LOCATION ); // < white pixel - DALI_TEST_EQUALS( outputImage[8+6], 0xff000000, TEST_LOCATION ); // < black pixel - DALI_TEST_EQUALS( outputImage[8+7], 0xffffffff, TEST_LOCATION ); // < white pixel + DALI_TEST_EQUALS( outputImage[8+0], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel + DALI_TEST_EQUALS( outputImage[8+1], (uint32_t)0xffffffff, TEST_LOCATION ); // < white pixel + DALI_TEST_EQUALS( outputImage[8+2], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel + DALI_TEST_EQUALS( outputImage[8+3], (uint32_t)0xffffffff, TEST_LOCATION ); // < white pixel + DALI_TEST_EQUALS( outputImage[8+4], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel + DALI_TEST_EQUALS( outputImage[8+5], (uint32_t)0xffffffff, TEST_LOCATION ); // < white pixel + DALI_TEST_EQUALS( outputImage[8+6], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel + DALI_TEST_EQUALS( outputImage[8+7], (uint32_t)0xffffffff, TEST_LOCATION ); // < white pixel // Third scanline: - DALI_TEST_EQUALS( outputImage[16+0], 0xffffffff, TEST_LOCATION ); // < white pixel - DALI_TEST_EQUALS( outputImage[16+1], 0xff000000, TEST_LOCATION ); // < black pixel - DALI_TEST_EQUALS( outputImage[16+2], 0xffffffff, TEST_LOCATION ); // < white pixel - DALI_TEST_EQUALS( outputImage[16+3], 0xff000000, TEST_LOCATION ); // < black pixel - DALI_TEST_EQUALS( outputImage[16+4], 0xffffffff, TEST_LOCATION ); // < white pixel - DALI_TEST_EQUALS( outputImage[16+5], 0xff000000, TEST_LOCATION ); // < black pixel - DALI_TEST_EQUALS( outputImage[16+6], 0xffffffff, TEST_LOCATION ); // < white pixel - DALI_TEST_EQUALS( outputImage[16+7], 0xff000000, TEST_LOCATION ); // < black pixel + DALI_TEST_EQUALS( outputImage[16+0], (uint32_t)0xffffffff, TEST_LOCATION ); // < white pixel + DALI_TEST_EQUALS( outputImage[16+1], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel + DALI_TEST_EQUALS( outputImage[16+2], (uint32_t)0xffffffff, TEST_LOCATION ); // < white pixel + DALI_TEST_EQUALS( outputImage[16+3], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel + DALI_TEST_EQUALS( outputImage[16+4], (uint32_t)0xffffffff, TEST_LOCATION ); // < white pixel + DALI_TEST_EQUALS( outputImage[16+5], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel + DALI_TEST_EQUALS( outputImage[16+6], (uint32_t)0xffffffff, TEST_LOCATION ); // < white pixel + DALI_TEST_EQUALS( outputImage[16+7], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel // ... could do more scanlines (there are 8) // Sample a few more pixels: // Diagonals: - DALI_TEST_EQUALS( outputImage[24+3], 0xffffffff, TEST_LOCATION ); // < white pixel - DALI_TEST_EQUALS( outputImage[32+4], 0xffffffff, TEST_LOCATION ); // < white pixel - DALI_TEST_EQUALS( outputImage[40+5], 0xffffffff, TEST_LOCATION ); // < white pixel - DALI_TEST_EQUALS( outputImage[48+6], 0xffffffff, TEST_LOCATION ); // < white pixel - DALI_TEST_EQUALS( outputImage[24+4], 0xff000000, TEST_LOCATION ); // < black pixel - DALI_TEST_EQUALS( outputImage[32+3], 0xff000000, TEST_LOCATION ); // < black pixel - DALI_TEST_EQUALS( outputImage[40+2], 0xff000000, TEST_LOCATION ); // < black pixel - DALI_TEST_EQUALS( outputImage[48+1], 0xff000000, TEST_LOCATION ); // < black pixel - DALI_TEST_EQUALS( outputImage[56+0], 0xff000000, TEST_LOCATION ); // < black pixel + DALI_TEST_EQUALS( outputImage[24+3], (uint32_t)0xffffffff, TEST_LOCATION ); // < white pixel + DALI_TEST_EQUALS( outputImage[32+4], (uint32_t)0xffffffff, TEST_LOCATION ); // < white pixel + DALI_TEST_EQUALS( outputImage[40+5], (uint32_t)0xffffffff, TEST_LOCATION ); // < white pixel + DALI_TEST_EQUALS( outputImage[48+6], (uint32_t)0xffffffff, TEST_LOCATION ); // < white pixel + DALI_TEST_EQUALS( outputImage[24+4], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel + DALI_TEST_EQUALS( outputImage[32+3], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel + DALI_TEST_EQUALS( outputImage[40+2], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel + DALI_TEST_EQUALS( outputImage[48+1], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel + DALI_TEST_EQUALS( outputImage[56+0], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel END_TEST; } @@ -1365,7 +1365,7 @@ int UtcDaliImageOperationsPointSampleRGBA888ScaleToSinglePixel(void) // 0 x 0 input image (make sure output not written to): outputImage = 0xDEADBEEF; Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, 0, 0, (unsigned char*) &outputImage, desiredWidth, desiredHeight ); - DALI_TEST_EQUALS( outputImage, 0xDEADBEEF, TEST_LOCATION ); + DALI_TEST_EQUALS( outputImage, (uint32_t)0xDEADBEEF, TEST_LOCATION ); outputImage = 0; END_TEST; @@ -1451,24 +1451,24 @@ int UtcDaliImageOperationsUint16Pair(void) { Uint16Pair vec1( 2, 3 ); - DALI_TEST_EQUALS( vec1.GetWidth(), 2, TEST_LOCATION ); - DALI_TEST_EQUALS( vec1.GetX(), 2, TEST_LOCATION ); + DALI_TEST_EQUALS( vec1.GetWidth(), (uint16_t)2, TEST_LOCATION ); + DALI_TEST_EQUALS( vec1.GetX(), (uint16_t)2, TEST_LOCATION ); - DALI_TEST_EQUALS( vec1.GetHeight(), 3, TEST_LOCATION ); - DALI_TEST_EQUALS( vec1.GetY(), 3, TEST_LOCATION ); + DALI_TEST_EQUALS( vec1.GetHeight(), (uint16_t)3, TEST_LOCATION ); + DALI_TEST_EQUALS( vec1.GetY(), (uint16_t)3, TEST_LOCATION ); Uint16Pair vec1Copy = vec1; - DALI_TEST_EQUALS( vec1Copy.GetWidth(), 2, TEST_LOCATION ); - DALI_TEST_EQUALS( vec1Copy.GetX(), 2, TEST_LOCATION ); + DALI_TEST_EQUALS( vec1Copy.GetWidth(), (uint16_t)2, TEST_LOCATION ); + DALI_TEST_EQUALS( vec1Copy.GetX(), (uint16_t)2, TEST_LOCATION ); - DALI_TEST_EQUALS( vec1Copy.GetHeight(), 3, TEST_LOCATION ); - DALI_TEST_EQUALS( vec1Copy.GetY(), 3, TEST_LOCATION ); + DALI_TEST_EQUALS( vec1Copy.GetHeight(), (uint16_t)3, TEST_LOCATION ); + DALI_TEST_EQUALS( vec1Copy.GetY(), (uint16_t)3, TEST_LOCATION ); Uint16Pair vec2( 65535u, 65535u ); - DALI_TEST_EQUALS( vec2.GetX(), 65535u, TEST_LOCATION ); - DALI_TEST_EQUALS( vec2.GetY(), 65535u, TEST_LOCATION ); + DALI_TEST_EQUALS( vec2.GetX(), (uint16_t)65535u, TEST_LOCATION ); + DALI_TEST_EQUALS( vec2.GetY(), (uint16_t)65535u, TEST_LOCATION ); END_TEST; } diff --git a/automated-tests/src/dali-adaptor/CMakeLists.txt b/automated-tests/src/dali-adaptor/CMakeLists.txt index 80d5c7e0c..e7fa4af0d 100644 --- a/automated-tests/src/dali-adaptor/CMakeLists.txt +++ b/automated-tests/src/dali-adaptor/CMakeLists.txt @@ -35,7 +35,7 @@ PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED ecore ) -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb --coverage -Wall -Werror=return-type") +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb --coverage -Wall -Werror") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${${CAPI_LIB}_CFLAGS_OTHER}") ADD_DEFINITIONS(-DTEST_RESOURCE_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/../../resources\" ) diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/dali-test-suite-utils.cpp b/automated-tests/src/dali-adaptor/dali-test-suite-utils/dali-test-suite-utils.cpp index f2cf56458..fc14c4b68 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/dali-test-suite-utils.cpp +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/dali-test-suite-utils.cpp @@ -19,8 +19,7 @@ #include "dali-test-suite-utils.h" // EXTERNAL INCLUDES -#include -#include +#include // INTERNAL INCLUDES #include @@ -55,22 +54,6 @@ void tet_printf(const char *format, ...) va_end(arg); } -/** - * DALI_TEST_CHECK is a wrapper for tet_result. - * If the condition evaluates to false, then the function & line number is printed. - * @param[in] The boolean expression to check - */ -#define DALI_TEST_CHECK(condition) \ -if ( (condition) ) \ -{ \ - tet_result(TET_PASS); \ -} \ -else \ -{ \ - fprintf(stderr, "%s Failed in %s at line %d\n", __PRETTY_FUNCTION__, __FILE__, __LINE__); \ - tet_result(TET_FAIL); \ -} - bool operator==(TimePeriod a, TimePeriod b) { return Equals(a.durationSeconds, b.durationSeconds) && Equals(a.delaySeconds, b.delaySeconds) ; @@ -93,6 +76,21 @@ std::ostream& operator<<( std::ostream& ostream, Degree angle ) return ostream; } +void DALI_TEST_EQUALS( const BaseHandle& baseHandle1, const BaseHandle& baseHandle2, const char* location ) +{ + DALI_TEST_EQUALS< const BaseHandle& >( baseHandle1, baseHandle2, location ); +} + +void DALI_TEST_EQUALS( const size_t value1, const unsigned int value2, const char* location ) +{ + DALI_TEST_EQUALS< unsigned int>( ( unsigned int )( value1 ), value2, location ); +} + +void DALI_TEST_EQUALS( const unsigned int value1, const size_t value2, const char* location ) +{ + DALI_TEST_EQUALS< unsigned int >( value1, ( unsigned int )( value2 ), location ); +} + void DALI_TEST_EQUALS( const Matrix3& matrix1, const Matrix3& matrix2, const char* location) { const float* m1 = matrix1.AsFloat(); @@ -101,10 +99,13 @@ void DALI_TEST_EQUALS( const Matrix3& matrix1, const Matrix3& matrix2, const cha for (int i=0;i<9;++i) { - equivalent &= (fabsf(m1[i] - m2[i])< GetRangedEpsilon(m1[i], m2[i])); + if( ! (fabsf(m1[i] - m2[i])< GetRangedEpsilon(m1[i], m2[i])) ) + { + equivalent = false; + } } - if (!equivalent) + if( !equivalent ) { fprintf(stderr, "%s, checking\n" "(%f, %f, %f) (%f, %f, %f)\n" @@ -172,10 +173,10 @@ void DALI_TEST_EQUALS( const Matrix& matrix1, const Matrix& matrix2, const char* if (!identical) { fprintf(stderr, "%s, checking\n" + "(%f, %f, %f, %f) (%f, %f, %f, %f)\n" "(%f, %f, %f, %f) == (%f, %f, %f, %f)\n" - "(%f, %f, %f, %f) == (%f, %f, %f, %f)\n" - "(%f, %f, %f, %f) == (%f, %f, %f, %f)\n" - "(%f, %f, %f, %f) == (%f, %f, %f, %f)\n", location, + "(%f, %f, %f, %f) (%f, %f, %f, %f)\n" + "(%f, %f, %f, %f) (%f, %f, %f, %f)\n", location, m1[0], m1[1], m1[2], m1[3], m2[0], m2[1], m2[2], m2[3], m1[4], m1[5], m1[6], m1[7], m2[4], m2[5], m2[6], m2[7], m1[8], m1[9], m1[10], m1[11], m2[8], m2[9], m2[10], m2[11], @@ -203,10 +204,10 @@ void DALI_TEST_EQUALS( const Matrix& matrix1, const Matrix& matrix2, float epsil if (!equivalent) { fprintf(stderr, "%s, checking\n" + "(%f, %f, %f, %f) (%f, %f, %f, %f)\n" "(%f, %f, %f, %f) == (%f, %f, %f, %f)\n" - "(%f, %f, %f, %f) == (%f, %f, %f, %f)\n" - "(%f, %f, %f, %f) == (%f, %f, %f, %f)\n" - "(%f, %f, %f, %f) == (%f, %f, %f, %f)\n", location, + "(%f, %f, %f, %f) (%f, %f, %f, %f)\n" + "(%f, %f, %f, %f) (%f, %f, %f, %f)\n", location, m1[0], m1[1], m1[2], m1[3], m2[0], m2[1], m2[2], m2[3], m1[4], m1[5], m1[6], m1[7], m2[4], m2[5], m2[6], m2[7], m1[8], m1[9], m1[10], m1[11], m2[8], m2[9], m2[10], m2[11], diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/dali-test-suite-utils.h b/automated-tests/src/dali-adaptor/dali-test-suite-utils/dali-test-suite-utils.h index 8163028fc..8f53384a1 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/dali-test-suite-utils.h +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/dali-test-suite-utils.h @@ -57,7 +57,7 @@ void tet_printf(const char *format, ...); /** * DALI_TEST_CHECK is a wrapper for tet_result. - * If the condition evaluates to false, then the function & line number is printed. + * If the condition evaluates to false, the test is stopped. * @param[in] The boolean expression to check */ #define DALI_TEST_CHECK(condition) \ @@ -69,6 +69,7 @@ else { \ fprintf(stderr, "%s Failed in %s at line %d\n", __PRETTY_FUNCTION__, __FILE__, __LINE__); \ tet_result(TET_FAIL); \ + throw("TET_FAIL"); \ } template @@ -162,8 +163,8 @@ std::ostream& operator<<( std::ostream& ostream, Degree angle ); * @param[in] value2 The second value * @param[in] location The TEST_LOCATION macro should be used here */ -template -inline void DALI_TEST_EQUALS(TypeA value1, TypeB value2, const char* location) +template +inline void DALI_TEST_EQUALS(Type value1, Type value2, const char* location) { if (!(value1 == value2)) { @@ -220,6 +221,30 @@ inline void DALI_TEST_EQUALS( TimePeriod value1, TimePeriod value2, } } +/** + * Test whether two base handles are equal. + * @param[in] baseHandle1 The first value + * @param[in] baseHandle2 The second value + * @param[in] location The TEST_LOCATION macro should be used here + */ +void DALI_TEST_EQUALS( const BaseHandle& baseHandle1, const BaseHandle& baseHandle2, const char* location ); + +/** + * Test whether a size_t value and an unsigned int are equal. + * @param[in] value1 The first value + * @param[in] value2 The second value + * @param[in] location The TEST_LOCATION macro should be used here + */ +void DALI_TEST_EQUALS( const size_t value1, const unsigned int value2, const char* location ); + +/** + * Test whether an unsigned int and a size_t value and are equal. + * @param[in] value1 The first value + * @param[in] value2 The second value + * @param[in] location The TEST_LOCATION macro should be used here + */ +void DALI_TEST_EQUALS( const unsigned int value1, const size_t value2, const char* location ); + /** * Test whether two Matrix3 objects are equal. * @param[in] matrix1 The first object @@ -308,7 +333,7 @@ void DALI_TEST_EQUALS( const char* str1, const std::string &str2, const char* lo * @param[in] location The TEST_LOCATION macro should be used here */ template< typename T > -void DALI_TEST_GREATER(unsigned int value1, unsigned int value2, const char* location) +void DALI_TEST_GREATER( T value1, T value2, const char* location) { if (!(value1 > value2)) { @@ -368,7 +393,7 @@ struct DefaultFunctionCoverage }; -// Helper to Create bitmap image +// Helper to Create buffer image BufferImage CreateBufferImage(); #endif // __DALI_TEST_SUITE_UTILS_H__ diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-gl-abstraction.h b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-gl-abstraction.h index fa5141281..dea1c9078 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-gl-abstraction.h +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-gl-abstraction.h @@ -23,13 +23,13 @@ #include #include #include -#include // strcpy +#include // for strcmp + +// INTERNAL INCLUDES #include #include #include #include - -// INTERNAL INCLUDES #include "test-trace-call-stack.h" namespace Dali @@ -409,7 +409,7 @@ public: { std::stringstream out; out << cap; - mCullFaceTrace.PushCall("Disable", out.str()); + mEnableDisableTrace.PushCall("Disable", out.str()); } inline void DisableVertexAttribArray(GLuint index) @@ -435,7 +435,7 @@ public: { std::stringstream out; out << cap; - mCullFaceTrace.PushCall("Enable", out.str()); + mEnableDisableTrace.PushCall("Enable", out.str()); } inline void EnableVertexAttribArray(GLuint index) @@ -1583,6 +1583,11 @@ public: // TEST FUNCTIONS inline void ResetCullFaceCallStack() { mCullFaceTrace.Reset(); } inline TraceCallStack& GetCullFaceTrace() { return mCullFaceTrace; } + //Methods for Enable/Disable call verification + inline void EnableEnableDisableCallTrace(bool enable) { mEnableDisableTrace.Enable(enable); } + inline void ResetEnableDisableCallStack() { mEnableDisableTrace.Reset(); } + inline TraceCallStack& GetEnableDisableTrace() { return mEnableDisableTrace; } + //Methods for Shader verification inline void EnableShaderCallTrace(bool enable) { mShaderTrace.Enable(enable); } inline void ResetShaderCallStack() { mShaderTrace.Reset(); } @@ -1705,8 +1710,6 @@ public: // TEST FUNCTIONS return false; } - - inline GLuint GetLastShaderCompiled() const { return mLastShaderCompiled; @@ -1815,6 +1818,7 @@ private: ActiveTextureType mActiveTextures[ MIN_TEXTURE_UNIT_LIMIT ]; TraceCallStack mCullFaceTrace; + TraceCallStack mEnableDisableTrace; TraceCallStack mShaderTrace; TraceCallStack mTextureTrace; TraceCallStack mTexParamaterTrace; diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-native-image.cpp b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-native-image.cpp index b15dfbcee..d143d35ae 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-native-image.cpp +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-native-image.cpp @@ -29,7 +29,7 @@ TestNativeImagePointer TestNativeImage::New(int width, int height) } TestNativeImage::TestNativeImage(int width, int height) -: mWidth(width), mHeight(height) +: mWidth(width), mHeight(height), mExtensionCreateCalls(0), mExtensionDestroyCalls(0), mTargetTextureCalls(0) { } diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-native-image.h b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-native-image.h index 720b429bf..4a39cb1b6 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-native-image.h +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-native-image.h @@ -31,9 +31,9 @@ class DALI_IMPORT_API TestNativeImage : public Dali::NativeImageInterface public: static TestNativeImagePointer New(int width, int height); - inline virtual bool GlExtensionCreate() {return true;}; - inline virtual void GlExtensionDestroy() {}; - inline virtual GLenum TargetTexture() {return 1;}; + inline virtual bool GlExtensionCreate() { ++mExtensionCreateCalls; return true;}; + inline virtual void GlExtensionDestroy() { ++mExtensionDestroyCalls; }; + inline virtual GLenum TargetTexture() { ++mTargetTextureCalls; return 1;}; inline virtual void PrepareTexture() {}; inline virtual unsigned int GetWidth() const {return mWidth;}; inline virtual unsigned int GetHeight() const {return mHeight;}; @@ -45,6 +45,10 @@ private: int mWidth; int mHeight; +public: + int mExtensionCreateCalls; + int mExtensionDestroyCalls; + int mTargetTextureCalls; }; } // Dali diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-touch-utils.h b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-touch-utils.h index 68d50f2e5..ebae313b1 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-touch-utils.h +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-touch-utils.h @@ -40,7 +40,7 @@ struct TouchEventData receivedTouch.points.clear(); receivedTouch.time = 0; - touchActor = NULL; + touchActor.Reset(); } bool functorCalled; diff --git a/automated-tests/src/dali-platform-abstraction/CMakeLists.txt b/automated-tests/src/dali-platform-abstraction/CMakeLists.txt index df6910e8a..b5a8c33ba 100644 --- a/automated-tests/src/dali-platform-abstraction/CMakeLists.txt +++ b/automated-tests/src/dali-platform-abstraction/CMakeLists.txt @@ -24,7 +24,7 @@ PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED dali ) -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb --coverage -Wall -Werror=return-type" ) +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb --coverage -Wall -Werror" ) # Shouldn't have to do this! # But CMake's new auto-escape quote policy doesn't work right. -- 2.34.1