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] = {
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)
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:
// 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;
// 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;
}
// 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;
}
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;
}
// 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;
{
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;
}
#include "dali-test-suite-utils.h"
// EXTERNAL INCLUDES
-#include <cstdio>
-#include <cstdarg>
+#include <ostream>
// INTERNAL INCLUDES
#include <dali/public-api/dali-core.h>
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) ;
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();
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"
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],
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],