#include <dali-test-suite-utils.h>
#include "platform-abstractions/portable/image-operations.h"
-#include <dali/public-api/common/ref-counted-dali-vector.h>
+#include <dali/devel-api/common/ref-counted-dali-vector.h>
#include <sys/mman.h>
+#include <unistd.h>
using namespace Dali::Internal::Platform;
uint32_t expectedDimension,
const char * const location )
{
- ImageAttributes attributes;
- attributes.SetScalingMode( ImageAttributes::ShrinkToFit );
- attributes.SetFilterMode( ImageAttributes::Box );
- attributes.SetSize( targetDimension, targetDimension );
-
- Integration::BitmapPtr sourceBitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD );
- sourceBitmap->GetPackedPixelsProfile()->ReserveBuffer( format, sourceDimension, sourceDimension, sourceDimension, sourceDimension );
-
- Integration::BitmapPtr downScaled = DownscaleBitmap( *sourceBitmap, ImageDimensions( targetDimension, targetDimension ), attributes.GetScalingMode(), attributes.GetFilterMode() );
- DALI_TEST_EQUALS( downScaled->GetImageWidth(), expectedDimension, location );
- DALI_TEST_EQUALS( downScaled->GetImageHeight(), expectedDimension, location );
- DALI_TEST_EQUALS( downScaled->GetPixelFormat(), format, location );
+ ImageDimensions desired( targetDimension, targetDimension );
+ FittingMode::Type fittingMode( FittingMode::SHRINK_TO_FIT );
+ SamplingMode::Type samplingMode( SamplingMode::BOX );
+
+ Dali::Devel::PixelBuffer sourceBitmap = Dali::Devel::PixelBuffer::New( sourceDimension, sourceDimension, format );
+
+ Dali::Devel::PixelBuffer downScaled = DownscaleBitmap( sourceBitmap, desired, fittingMode, samplingMode );
+
+ DALI_TEST_EQUALS( downScaled.GetWidth(), expectedDimension, location );
+ DALI_TEST_EQUALS( downScaled.GetHeight(), expectedDimension, location );
+ DALI_TEST_EQUALS( downScaled.GetPixelFormat(), format, location );
}
/**
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;
}
}
}
-/**
- * @brief Allocate an image buffer with protected pages to top and tail it and
- * SEGV if an operation strays into them.
- */
-void MakeGuardedOutputImageRGBA8888( unsigned int desiredWidth, unsigned int desiredHeight, uint32_t *& outputBuffer, uint32_t *& outputImage )
-{
- const size_t outputBufferSize = getpagesize() + sizeof(uint32_t) * desiredWidth * desiredHeight + getpagesize();
- outputBuffer = (uint32_t *) valloc( outputBufferSize );
- mprotect( outputBuffer, getpagesize(), PROT_READ );
- mprotect( ((char*) outputBuffer) + outputBufferSize - getpagesize(), getpagesize(), PROT_READ );
- outputImage = outputBuffer + getpagesize() / sizeof(outputBuffer[0]);
-}
-
-/**
- * @brief Allocate a buffer of pages that are read-only, that is big enough for the number of pixels passed-in.
- */
-uint32_t* AllocateReadOnlyPagesRGBA( unsigned int numPixels )
-{
- const unsigned int numWholePages = (numPixels * sizeof(uint32_t)) / getpagesize();
- bool needExtraPage = (numPixels * sizeof(uint32_t)) % getpagesize() != 0;
- const size_t outputBufferSize = (numWholePages + (needExtraPage ? 1 : 0)) * getpagesize();
- uint32_t * outputBuffer = (uint32_t *) valloc( outputBufferSize );
- mprotect( outputBuffer, outputBufferSize, PROT_READ );
-
- return outputBuffer;
-}
-
-/**
- * @brief Free a buffer of pages that are read-only.
- */
-void FreeReadOnlyPagesRGBA( uint32_t * pages, unsigned int numPixels )
-{
- const size_t bufferSize = numPixels * 4;
- mprotect( pages, bufferSize, PROT_READ | PROT_WRITE );
- free( pages );
-}
-
/*
* @brief Make an image with a checkerboard pattern.
* @note This is an easy pattern to scan for correctness after a downscaling test.
}
/**
- * @brief Test that a scaling doesn't stray outside the bounds of the destination image.
- *
- * The test allocates a destination buffer that is an exact multiple of the page size
- * with guard pages at either end.
- */
-int UtcDaliImageOperationsPointSampleRGBA888InBounds(void)
-{
- const unsigned int inputWidth = 163;
- const unsigned int inputHeight = 691;
- const unsigned int destinationBufferSize = 4096 * 4;
- const unsigned int desiredWidth = 64;
- const unsigned int desiredHeight = destinationBufferSize / desiredWidth; // (256)
-
- uint32_t inputImage[ inputWidth * inputHeight ];
-
- // Allocate an output image buffer with read-only guard pages at either end:
- // The test will segfault if it strays into the guard pages.
- uint32_t *outputBuffer, *outputImage;
- MakeGuardedOutputImageRGBA8888( desiredWidth, desiredHeight, outputBuffer, outputImage );
-
- Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, inputWidth, inputHeight, (unsigned char*) outputImage, desiredWidth, desiredHeight );
-
- FreeReadOnlyPagesRGBA( outputBuffer, desiredWidth * desiredHeight );
-
- //! The only real test is whether the above code SEGVs, but do a fake test so we pass if that hasn't happened:
- DALI_TEST_EQUALS( true, true, TEST_LOCATION );
-
- END_TEST;
-}
-
-/**
* @brief Test the right pixels are generated when downsampling a checkerboard into a small image.
*/
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;
}
uint32_t inputImage[ inputWidth * inputHeight ];
MakeSingleColorImageRGBA8888( inputWidth, inputHeight, inputImage );
- uint32_t *outputBuffer, *outputImage;
- MakeGuardedOutputImageRGBA8888( desiredWidth, desiredHeight, outputBuffer, outputImage );
+ const size_t outputBufferSize = desiredWidth * desiredHeight;
+ std::vector< uint32_t > buffer;
+ buffer.resize( outputBufferSize );
+ uint32_t* outputImage = &buffer[0];
Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, inputWidth, inputHeight, (unsigned char*) outputImage, desiredWidth, desiredHeight );
}
}
- FreeReadOnlyPagesRGBA( outputBuffer, desiredWidth * desiredHeight );
-
DALI_TEST_EQUALS( 0U, differentColorCount, TEST_LOCATION );
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;
* @brief Test that downsampling to 0 - area images is a NOP and does not modify the destination.
* (edge-case)
*/
-int UtcDaliImageOperationsPointSampleRGBA888ScaleToZeroDims(void)
+int UtcDaliImageOperationsPointSampleRGBA888N(void)
{
- uint32_t inputImage[ 1024 * 1024 ];
- MakeSingleColorImageRGBA8888( 1024, 1024, inputImage );
- uint32_t* outputImage = AllocateReadOnlyPagesRGBA(1);
+ uint32_t inputImage[ 128 * 128 ];
+ MakeSingleColorImageRGBA8888( 128, 128, inputImage );
+ uint32_t outputImage[ 128 * 128 ];
+ memset( outputImage, 0xaa, 128 * 128 * sizeof(uint32_t) );
// Try several different starting image sizes:
// 1x1 -> 1x1:
- Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, 1, 1, (unsigned char*) outputImage, 0, 0 );
+ Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, 1, 1, (unsigned char*) outputImage, 0, 0 );
+ DALI_TEST_EQUALS( 0xaaaaaaaa, outputImage[0], TEST_LOCATION );
// Single-pixel wide tall stripe:
- Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, 1, 1024, (unsigned char*) outputImage, 0, 33 );
+ Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, 1, 102, (unsigned char*) outputImage, 0, 33 );
+ DALI_TEST_EQUALS( 0xaaaaaaaa, outputImage[0], TEST_LOCATION );
// Single-pixel tall, wide strip:
- Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, 1024, 1, (unsigned char*) outputImage, 0, 67 );
+ Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, 102, 1, (unsigned char*) outputImage, 0, 67 );
+ DALI_TEST_EQUALS( 0xaaaaaaaa, outputImage[0], TEST_LOCATION );
// Square mid-size image:
- Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, 103, 103, (unsigned char*) outputImage, 21, 0 );
+ Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, 103, 103, (unsigned char*) outputImage, 21, 0 );
+ DALI_TEST_EQUALS( 0xaaaaaaaa, outputImage[0], TEST_LOCATION );
- // Wide mid-size image:
- Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, 313, 79, (unsigned char*) outputImage, 99, 0 );
+ // Wide mid-size image to 0 height
+ Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, 313, 79, (unsigned char*) outputImage, 99, 0 );
+ DALI_TEST_EQUALS( 0xaaaaaaaa, outputImage[0], TEST_LOCATION );
- // Tall mid-size image:
- Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, 53, 467, (unsigned char*) outputImage, 9999, 0 );
+ // Tall mid-size image to 0 height, over width
+ Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, 53, 46, (unsigned char*) outputImage, 9999, 0 );
+ DALI_TEST_EQUALS( 0xaaaaaaaa, outputImage[0], TEST_LOCATION );
// 0 x 0 input image:
- Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, 0, 0, (unsigned char*) outputImage, 200, 99 );
-
- FreeReadOnlyPagesRGBA( outputImage, getpagesize() / 4 );
-
- //! The only real test is whether the above code SEGVs, but do a fake test so we pass if that hasn't happened:
- DALI_TEST_EQUALS( true, true, TEST_LOCATION );
-
- END_TEST;
-}
-
-/**
- * @brief Test that a scaling doesn't stray outside the bounds of the destination image.
- *
- * The test allocates a destination buffer that is an exact multiple of the page size
- * with guard pages at either end.
- */
-int UtcDaliImageOperationsPointSampleRGB88InBounds(void)
-{
- const unsigned int inputWidth = 163;
- const unsigned int inputHeight = 691;
- const unsigned int desiredWidth = 32;
- const unsigned int desiredHeight = 128;
- const unsigned int outputBuffersizeInWords = desiredWidth * (desiredHeight / 4) * 3;
-
- uint8_t inputImage[ inputWidth * inputHeight ][3];
-
- // Allocate an output image buffer with read-only guard pages at either end:
- // The test will segfault if it strays into the guard pages.
- uint32_t *outputBuffer, *outputImage;
-
- MakeGuardedOutputImageRGBA8888( desiredWidth * (desiredHeight / 4), 3, outputBuffer, outputImage );
-
- Dali::Internal::Platform::PointSample3BPP( &inputImage[0][0], inputWidth, inputHeight, (uint8_t*) outputImage, desiredWidth, desiredHeight );
-
- FreeReadOnlyPagesRGBA( outputBuffer, outputBuffersizeInWords );
-
- //! The only real test is whether the above code SEGVs, but do a fake test so we pass if that hasn't happened:
- DALI_TEST_EQUALS( true, true, TEST_LOCATION );
+ Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, 0, 0, (unsigned char*) outputImage, 200, 99 );
+ DALI_TEST_EQUALS( 0xaaaaaaaa, outputImage[0], TEST_LOCATION );
END_TEST;
}
/**
* @brief Test the small int (x,y) tuple.
*/
-int UtcDaliImageOperationsVector2Uint16(void)
+int UtcDaliImageOperationsUint16Pair(void)
{
- Vector2Uint16 vec1( 2, 3 );
+ 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 );
- Vector2Uint16 vec1Copy = vec1;
+ 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 );
- Vector2Uint16 vec2( 65535u, 65535u );
+ 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;
}