/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
static const unsigned int sEncodedBufferImageDataPNGLength = sizeof( sEncodedBufferImageDataPNG );
+void PrepareDecodeBuffer( TestApplication& application, unsigned int width, unsigned int height, Pixel::Format pixelFormat )
+{
+ TestPlatformAbstraction& platform = application.GetPlatform();
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
+ bitmap->GetPackedPixelsProfile()->ReserveBuffer( pixelFormat, width, height, width, height );
+ Integration::BitmapPtr bitmapPtr(bitmap);
+ platform.SetDecodedBitmap( bitmapPtr );
+}
+
} // anonymous namespace
EncodedBufferImage image1;
DALI_TEST_CHECK( !image1 );
- image1 = EncodedBufferImage::New( sEncodedBufferImageDataPNG, sEncodedBufferImageDataPNGLength, ImageDimensions(), FittingMode::DEFAULT, SamplingMode::DEFAULT, Image::NEVER );
+ image1 = EncodedBufferImage::New( sEncodedBufferImageDataPNG, sEncodedBufferImageDataPNGLength, ImageDimensions(), FittingMode::DEFAULT, SamplingMode::DEFAULT );
EncodedBufferImage image2( image1 );
DALI_TEST_EQUALS( image1, image2, TEST_LOCATION );
EncodedBufferImage image1;
DALI_TEST_CHECK( !image1 );
- image1 = EncodedBufferImage::New( sEncodedBufferImageDataPNG, sEncodedBufferImageDataPNGLength, ImageDimensions(), FittingMode::DEFAULT, SamplingMode::DEFAULT, Image::NEVER );
+ image1 = EncodedBufferImage::New( sEncodedBufferImageDataPNG, sEncodedBufferImageDataPNGLength, ImageDimensions(), FittingMode::DEFAULT, SamplingMode::DEFAULT );
EncodedBufferImage image2;
image2 = image1;
{
TestApplication application;
- Image image1 = EncodedBufferImage::New( sEncodedBufferImageDataPNG, sEncodedBufferImageDataPNGLength, ImageDimensions(), FittingMode::DEFAULT, SamplingMode::DEFAULT, Image::NEVER );
+ Image image1 = EncodedBufferImage::New( sEncodedBufferImageDataPNG, sEncodedBufferImageDataPNGLength, ImageDimensions(), FittingMode::DEFAULT, SamplingMode::DEFAULT );
EncodedBufferImage image2 = DownCast< EncodedBufferImage >(image1);
DALI_TEST_EQUALS( image1, image2, TEST_LOCATION );
}
// Positive test case for constructors:
-int UtcDaliEncodedBufferImageNew01(void)
+int UtcDaliEncodedBufferImageNewP1(void)
{
TestApplication application;
DALI_TEST_CHECK( !image );
// Trigger image decode to initialise the handle
- image = EncodedBufferImage::New( sEncodedBufferImageDataPNG, sEncodedBufferImageDataPNGLength, ImageDimensions(), FittingMode::DEFAULT, SamplingMode::DEFAULT, Image::NEVER );
+ image = EncodedBufferImage::New( sEncodedBufferImageDataPNG, sEncodedBufferImageDataPNGLength, ImageDimensions(), FittingMode::DEFAULT, SamplingMode::DEFAULT );
DALI_TEST_CHECK( image );
- // Change the release policy to Unused:
- Image image2;
+ END_TEST;
+}
- DALI_TEST_CHECK( !image2 );
+// Positive test case for constructors:
+int UtcDaliEncodedBufferImageNewP2(void)
+{
+ TestApplication application;
+
+ tet_infoline( "UtcDaliEncodedBufferImageNew01() - EncodedBufferImage::New( const uint8_t * const encodedImage, const std::size_t encodedImageByteCount, ImageDimensions size, FittingMode::Type scalingMode, SamplingMode::Type samplingMode, ReleasePolicy releasePol, bool orientationCorrection )" );
+ // Invoke default handle constructor for the Image base class:
+ Image image;
+
+ DALI_TEST_CHECK( !image );
+
+ // Trigger image decode to initialise the handle
+ PrepareDecodeBuffer( application, 720u, 1280u, Pixel::RGBA8888 );
+ image = EncodedBufferImage::New( sEncodedBufferImageDataPNG, sEncodedBufferImageDataPNGLength, ImageDimensions(), FittingMode::DEFAULT, SamplingMode::DEFAULT );
+
+ DALI_TEST_CHECK( image );
+
+ Image image2;
+ DALI_TEST_CHECK( !image2 );
// Trigger image decode to initialise the handle
- image2 = EncodedBufferImage::New( sEncodedBufferImageDataPNG, sEncodedBufferImageDataPNGLength, ImageDimensions(), FittingMode::DEFAULT, SamplingMode::DEFAULT, Image::UNUSED );
+ image2 = EncodedBufferImage::New( sEncodedBufferImageDataPNG, sEncodedBufferImageDataPNGLength);
DALI_TEST_CHECK( image2 );
END_TEST;
}
+
// Negative test case for constructor - null pointer:
-int UtcDaliEncodedBufferImageNew02(void)
+int UtcDaliEncodedBufferImageNewN1(void)
{
TestApplication application;
}
// Negative test case for constructor - zero-length input buffer:
-int UtcDaliEncodedBufferImageNew03(void)
+int UtcDaliEncodedBufferImageNewN2(void)
{
TestApplication application;