X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-adaptor-internal%2Fimage-loaders.cpp;h=c3f7abee9701472d37999dd2a7aeb2f2611cd57d;hb=efbfe41145cb178ee71f073f74f1e98e2485fffc;hp=c8ced4ad8ec933771d84c45709e261d981203e3f;hpb=f4b05fe51ddba1d7d2035103ef3cfcd1d4741d3c;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/automated-tests/src/dali-adaptor-internal/image-loaders.cpp b/automated-tests/src/dali-adaptor-internal/image-loaders.cpp index c8ced4a..c3f7abe 100644 --- a/automated-tests/src/dali-adaptor-internal/image-loaders.cpp +++ b/automated-tests/src/dali-adaptor-internal/image-loaders.cpp @@ -17,7 +17,7 @@ #include "image-loaders.h" #include -#include + AutoCloseFile::AutoCloseFile( FILE *fp ) : filePtr( fp ) @@ -107,15 +107,17 @@ void TestImageLoading( const ImageDetails& image, const LoadFunctions& functions // Loading the header moves the pointer within the file so reset to start of file. fseek( fp, 0, 0 ); - Dali::Devel::PixelBuffer bitmap; + // Create a bitmap object and store a pointer to that object so it is destroyed at the end. + Dali::Integration::Bitmap * bitmap = Dali::Integration::Bitmap::New( bitmapProfile, ResourcePolicy::OWNED_RETAIN ); + Dali::Integration::BitmapPtr bitmapPtr( bitmap ); // Load Bitmap and check its return values. - DALI_TEST_CHECK( functions.loader( input, bitmap ) ); - DALI_TEST_EQUALS( image.width, bitmap.GetWidth(), TEST_LOCATION ); - DALI_TEST_EQUALS( image.height, bitmap.GetHeight(), TEST_LOCATION ); + DALI_TEST_CHECK( functions.loader( input, *bitmap ) ); + DALI_TEST_EQUALS( image.width, bitmap->GetImageWidth(), TEST_LOCATION ); + DALI_TEST_EQUALS( image.height, bitmap->GetImageHeight(), TEST_LOCATION ); // Compare buffer generated with reference buffer. - Dali::PixelBuffer* bufferPtr( bitmap.GetBuffer() ); + Dali::PixelBuffer* bufferPtr( bitmapPtr->GetBuffer() ); Dali::PixelBuffer* refBufferPtr( image.refBuffer ); for ( unsigned int i = 0; i < image.refBufferSize; ++i, ++bufferPtr, ++refBufferPtr ) { @@ -145,19 +147,21 @@ void CompareLoadedImageData( const ImageDetails& image, const LoadFunctions& fun // Loading the header moves the pointer within the file so reset to start of file. fseek( filePointer, 0, SEEK_SET ); - Dali::Devel::PixelBuffer bitmap; + // Create a bitmap object and store a pointer to that object so it is destroyed at the end. + Dali::Integration::Bitmap * bitmap = Dali::Integration::Bitmap::New( Dali::Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN ); + Dali::Integration::BitmapPtr bitmapPointer( bitmap ); // Load Bitmap and check its return values. - DALI_TEST_CHECK( functions.loader( input, bitmap ) ); - DALI_TEST_EQUALS( image.width, bitmap.GetWidth(), TEST_LOCATION ); - DALI_TEST_EQUALS( image.height, bitmap.GetHeight(), TEST_LOCATION ); + DALI_TEST_CHECK( functions.loader( input, *bitmap ) ); + DALI_TEST_EQUALS( image.width, bitmap->GetImageWidth(), TEST_LOCATION ); + DALI_TEST_EQUALS( image.height, bitmap->GetImageHeight(), TEST_LOCATION ); // Check the bytes per pixel. - const Pixel::Format pixelFormat = bitmap.GetPixelFormat(); + const Pixel::Format pixelFormat = bitmap->GetPixelFormat(); const unsigned int bytesPerPixel = Pixel::GetBytesPerPixel( pixelFormat ); // Compare buffer generated with reference buffer. - Dali::PixelBuffer* pBitmapData( bitmap.GetBuffer() ); + Dali::PixelBuffer* pBitmapData( bitmapPointer->GetBuffer() ); const uint32_t* pMaster( master ); // Loop through each pixel in the bitmap. @@ -180,15 +184,15 @@ void DumpImageBufferToTempFile( std::string filename, std::string targetFilename FILE* fp = fopen( filename.c_str() , "rb" ); AutoCloseFile autoClose( fp ); - Dali::Devel::PixelBuffer bitmap; + Dali::Integration::Bitmap* bitmap = Dali::Integration::Bitmap::New( Dali::Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN ); + Dali::Integration::BitmapPtr bitmapPtr( bitmap ); const Dali::TizenPlatform::ImageLoader::Input input( fp ); - DALI_TEST_CHECK( functions.loader( input, bitmap ) ); + DALI_TEST_CHECK( functions.loader( input, *bitmap ) ); - Dali::PixelBuffer* bufferPtr( bitmap.GetBuffer() ); + Dali::PixelBuffer* bufferPtr( bitmapPtr->GetBuffer() ); FILE* writeFp = fopen( targetFilename.c_str(), "wb" ); AutoCloseFile autoCloseWrite( writeFp ); - auto& impl = GetImplementation(bitmap); - fwrite( bufferPtr, 1, impl.GetBufferSize(), writeFp ); + fwrite( bufferPtr, 1, bitmap->GetBufferSize(), writeFp ); }