X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-adaptor%2Futc-Dali-ImageLoading.cpp;h=12af8b00d2c4d065bc9e89f5ba9bfaf1ba3027a5;hb=90d36078741b9c21c7a4c7cf7e0813f3d8ca5a10;hp=1019707918bc66751cdc864f1835340cbf80ed39;hpb=106009d83bf6ac0f12226ca93143232eced3fdc1;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/automated-tests/src/dali-adaptor/utc-Dali-ImageLoading.cpp b/automated-tests/src/dali-adaptor/utc-Dali-ImageLoading.cpp index 1019707..12af8b0 100644 --- a/automated-tests/src/dali-adaptor/utc-Dali-ImageLoading.cpp +++ b/automated-tests/src/dali-adaptor/utc-Dali-ImageLoading.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 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. @@ -34,6 +34,9 @@ const char* IMAGE_128_RGB = TEST_RESOURCE_DIR "/gallery-small-1.jpg"; // resolution: 2000*2560, pixel format: RGB888 const char* IMAGE_LARGE_EXIF3_RGB = TEST_RESOURCE_DIR "/f-large-exif-3.jpg"; +// resolution: 2048*2048, pixel format: RGB888, YUV420 +const char* IMAGE_LARGE_2048_YUV_420 = TEST_RESOURCE_DIR "/lake_front.jpg"; + // resolution: 55*64, pixel format: RGB888 const char* IMAGE_WIDTH_ODD_EXIF1_RGB = TEST_RESOURCE_DIR "/f-odd-exif-1.jpg"; // resolution: 55*64, pixel format: RGB888 @@ -74,7 +77,7 @@ const char* IMAGENONEXIST = "non-exist.jpg"; Dali::Vector FileToMemory(const char* filename) { Dali::Vector buffer; - FILE *fp; + FILE* fp; fp = fopen(filename, "rb"); if(fp != NULL) { @@ -418,3 +421,46 @@ int UtcDaliDownloadImageN(void) END_TEST; } + +int UtcDaliLoadImagePlanesFromFileP(void) +{ + std::vector pixelBuffers; + + Dali::LoadImagePlanesFromFile(IMAGE_LARGE_2048_YUV_420, pixelBuffers); + DALI_TEST_EQUALS(pixelBuffers.size(), 3, TEST_LOCATION); + DALI_TEST_EQUALS(pixelBuffers[0].GetWidth(), 2048u, TEST_LOCATION); + DALI_TEST_EQUALS(pixelBuffers[0].GetHeight(), 2048u, TEST_LOCATION); + DALI_TEST_EQUALS(pixelBuffers[0].GetPixelFormat(), Pixel::L8, TEST_LOCATION); + DALI_TEST_EQUALS(pixelBuffers[1].GetPixelFormat(), Pixel::CHROMINANCE_U, TEST_LOCATION); + DALI_TEST_EQUALS(pixelBuffers[2].GetPixelFormat(), Pixel::CHROMINANCE_V, TEST_LOCATION); + + pixelBuffers.clear(); + + // Test not supported image format: png + Dali::LoadImagePlanesFromFile(IMAGE_34_RGBA, pixelBuffers); + DALI_TEST_EQUALS(pixelBuffers.size(), 1, TEST_LOCATION); + DALI_TEST_EQUALS(pixelBuffers[0].GetWidth(), 34u, TEST_LOCATION); + DALI_TEST_EQUALS(pixelBuffers[0].GetHeight(), 34u, TEST_LOCATION); + DALI_TEST_EQUALS(pixelBuffers[0].GetPixelFormat(), Pixel::RGBA8888, TEST_LOCATION); + + pixelBuffers.clear(); + + // Test notsupported chrominace subsampling case + Dali::LoadImagePlanesFromFile(IMAGE_128_RGB, pixelBuffers); + DALI_TEST_EQUALS(pixelBuffers.size(), 1, TEST_LOCATION); + DALI_TEST_EQUALS(pixelBuffers[0].GetWidth(), 128u, TEST_LOCATION); + DALI_TEST_EQUALS(pixelBuffers[0].GetHeight(), 128u, TEST_LOCATION); + DALI_TEST_EQUALS(pixelBuffers[0].GetPixelFormat(), Pixel::RGB888, TEST_LOCATION); + + END_TEST; +} + +int UtcDaliLoadImagePlanesFromFileN(void) +{ + std::vector pixelBuffers; + + Dali::LoadImagePlanesFromFile(IMAGENONEXIST, pixelBuffers); + DALI_TEST_CHECK(pixelBuffers.empty()); + + END_TEST; +}