From: jiyong.min Date: Wed, 5 Aug 2020 07:55:39 +0000 (+0900) Subject: [UTC][capi-media-image-util][ACR-1584][Add test cases for supporting WEBP image format] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a50a28cbda34b08a15260e06fbf8ef1c74cfc8cf;p=test%2Ftct%2Fnative%2Fapi.git [UTC][capi-media-image-util][ACR-1584][Add test cases for supporting WEBP image format] - Adds new WEBP image samples - Adds new WEBP image test cases for encoding and decoding - Adds new WEBP API(image_util_encode_set_webp_lossless) test cases Change-Id: I1cf377deb2f260aad6cbd4cc1053503c521609aa --- diff --git a/src/utc/image-util/res/mobile/sample.webp b/src/utc/image-util/res/mobile/sample.webp new file mode 100644 index 000000000..f2272c39a Binary files /dev/null and b/src/utc/image-util/res/mobile/sample.webp differ diff --git a/src/utc/image-util/res/tizeniot/sample.webp b/src/utc/image-util/res/tizeniot/sample.webp new file mode 100644 index 000000000..f2272c39a Binary files /dev/null and b/src/utc/image-util/res/tizeniot/sample.webp differ diff --git a/src/utc/image-util/res/tv/sample.webp b/src/utc/image-util/res/tv/sample.webp new file mode 100644 index 000000000..f2272c39a Binary files /dev/null and b/src/utc/image-util/res/tv/sample.webp differ diff --git a/src/utc/image-util/res/wearable/sample.webp b/src/utc/image-util/res/wearable/sample.webp new file mode 100644 index 000000000..f2272c39a Binary files /dev/null and b/src/utc/image-util/res/wearable/sample.webp differ diff --git a/src/utc/image-util/tct-image-util-core_mobile.h b/src/utc/image-util/tct-image-util-core_mobile.h index 6c3e1d552..cae6cf325 100644 --- a/src/utc/image-util/tct-image-util-core_mobile.h +++ b/src/utc/image-util/tct-image-util-core_mobile.h @@ -114,6 +114,9 @@ extern int utc_image_util_encode_set_gif_frame_delay_time_n1(void); extern int utc_image_util_encode_set_gif_frame_delay_time_n2(void); extern int utc_image_util_encode_set_gif_frame_delay_time_n3(void); extern int utc_image_util_encode_set_gif_frame_delay_time_p(void); +extern int utc_image_util_encode_set_webp_lossless_n1(void); +extern int utc_image_util_encode_set_webp_lossless_n2(void); +extern int utc_image_util_encode_set_webp_lossless_p(void); extern int utc_image_util_encode_set_input_buffer_n1(void); extern int utc_image_util_encode_set_input_buffer_n2(void); extern int utc_image_util_encode_set_input_buffer_n3(void); @@ -320,6 +323,9 @@ testcase tc_array[] = { {"utc_image_util_encode_set_gif_frame_delay_time_n2",utc_image_util_encode_set_gif_frame_delay_time_n2,utc_image_util_encode_startup,utc_image_util_encode_cleanup}, {"utc_image_util_encode_set_gif_frame_delay_time_n3",utc_image_util_encode_set_gif_frame_delay_time_n3,utc_image_util_encode_startup,utc_image_util_encode_cleanup}, {"utc_image_util_encode_set_gif_frame_delay_time_p",utc_image_util_encode_set_gif_frame_delay_time_p,utc_image_util_encode_startup,utc_image_util_encode_cleanup}, + {"utc_image_util_encode_set_webp_lossless_n1",utc_image_util_encode_set_webp_lossless_n1,utc_image_util_encode_startup,utc_image_util_encode_cleanup}, + {"utc_image_util_encode_set_webp_lossless_n2",utc_image_util_encode_set_webp_lossless_n2,utc_image_util_encode_startup,utc_image_util_encode_cleanup}, + {"utc_image_util_encode_set_webp_lossless_p",utc_image_util_encode_set_webp_lossless_p,utc_image_util_encode_startup,utc_image_util_encode_cleanup}, {"utc_image_util_encode_set_input_buffer_n1",utc_image_util_encode_set_input_buffer_n1,utc_image_util_encode_startup,utc_image_util_encode_cleanup}, {"utc_image_util_encode_set_input_buffer_n2",utc_image_util_encode_set_input_buffer_n2,utc_image_util_encode_startup,utc_image_util_encode_cleanup}, {"utc_image_util_encode_set_input_buffer_n3",utc_image_util_encode_set_input_buffer_n3,utc_image_util_encode_startup,utc_image_util_encode_cleanup}, diff --git a/src/utc/image-util/tct-image-util-core_tizeniot.h b/src/utc/image-util/tct-image-util-core_tizeniot.h index 6c3e1d552..cae6cf325 100644 --- a/src/utc/image-util/tct-image-util-core_tizeniot.h +++ b/src/utc/image-util/tct-image-util-core_tizeniot.h @@ -114,6 +114,9 @@ extern int utc_image_util_encode_set_gif_frame_delay_time_n1(void); extern int utc_image_util_encode_set_gif_frame_delay_time_n2(void); extern int utc_image_util_encode_set_gif_frame_delay_time_n3(void); extern int utc_image_util_encode_set_gif_frame_delay_time_p(void); +extern int utc_image_util_encode_set_webp_lossless_n1(void); +extern int utc_image_util_encode_set_webp_lossless_n2(void); +extern int utc_image_util_encode_set_webp_lossless_p(void); extern int utc_image_util_encode_set_input_buffer_n1(void); extern int utc_image_util_encode_set_input_buffer_n2(void); extern int utc_image_util_encode_set_input_buffer_n3(void); @@ -320,6 +323,9 @@ testcase tc_array[] = { {"utc_image_util_encode_set_gif_frame_delay_time_n2",utc_image_util_encode_set_gif_frame_delay_time_n2,utc_image_util_encode_startup,utc_image_util_encode_cleanup}, {"utc_image_util_encode_set_gif_frame_delay_time_n3",utc_image_util_encode_set_gif_frame_delay_time_n3,utc_image_util_encode_startup,utc_image_util_encode_cleanup}, {"utc_image_util_encode_set_gif_frame_delay_time_p",utc_image_util_encode_set_gif_frame_delay_time_p,utc_image_util_encode_startup,utc_image_util_encode_cleanup}, + {"utc_image_util_encode_set_webp_lossless_n1",utc_image_util_encode_set_webp_lossless_n1,utc_image_util_encode_startup,utc_image_util_encode_cleanup}, + {"utc_image_util_encode_set_webp_lossless_n2",utc_image_util_encode_set_webp_lossless_n2,utc_image_util_encode_startup,utc_image_util_encode_cleanup}, + {"utc_image_util_encode_set_webp_lossless_p",utc_image_util_encode_set_webp_lossless_p,utc_image_util_encode_startup,utc_image_util_encode_cleanup}, {"utc_image_util_encode_set_input_buffer_n1",utc_image_util_encode_set_input_buffer_n1,utc_image_util_encode_startup,utc_image_util_encode_cleanup}, {"utc_image_util_encode_set_input_buffer_n2",utc_image_util_encode_set_input_buffer_n2,utc_image_util_encode_startup,utc_image_util_encode_cleanup}, {"utc_image_util_encode_set_input_buffer_n3",utc_image_util_encode_set_input_buffer_n3,utc_image_util_encode_startup,utc_image_util_encode_cleanup}, diff --git a/src/utc/image-util/tct-image-util-core_wearable.h b/src/utc/image-util/tct-image-util-core_wearable.h index 6c3e1d552..cae6cf325 100644 --- a/src/utc/image-util/tct-image-util-core_wearable.h +++ b/src/utc/image-util/tct-image-util-core_wearable.h @@ -114,6 +114,9 @@ extern int utc_image_util_encode_set_gif_frame_delay_time_n1(void); extern int utc_image_util_encode_set_gif_frame_delay_time_n2(void); extern int utc_image_util_encode_set_gif_frame_delay_time_n3(void); extern int utc_image_util_encode_set_gif_frame_delay_time_p(void); +extern int utc_image_util_encode_set_webp_lossless_n1(void); +extern int utc_image_util_encode_set_webp_lossless_n2(void); +extern int utc_image_util_encode_set_webp_lossless_p(void); extern int utc_image_util_encode_set_input_buffer_n1(void); extern int utc_image_util_encode_set_input_buffer_n2(void); extern int utc_image_util_encode_set_input_buffer_n3(void); @@ -320,6 +323,9 @@ testcase tc_array[] = { {"utc_image_util_encode_set_gif_frame_delay_time_n2",utc_image_util_encode_set_gif_frame_delay_time_n2,utc_image_util_encode_startup,utc_image_util_encode_cleanup}, {"utc_image_util_encode_set_gif_frame_delay_time_n3",utc_image_util_encode_set_gif_frame_delay_time_n3,utc_image_util_encode_startup,utc_image_util_encode_cleanup}, {"utc_image_util_encode_set_gif_frame_delay_time_p",utc_image_util_encode_set_gif_frame_delay_time_p,utc_image_util_encode_startup,utc_image_util_encode_cleanup}, + {"utc_image_util_encode_set_webp_lossless_n1",utc_image_util_encode_set_webp_lossless_n1,utc_image_util_encode_startup,utc_image_util_encode_cleanup}, + {"utc_image_util_encode_set_webp_lossless_n2",utc_image_util_encode_set_webp_lossless_n2,utc_image_util_encode_startup,utc_image_util_encode_cleanup}, + {"utc_image_util_encode_set_webp_lossless_p",utc_image_util_encode_set_webp_lossless_p,utc_image_util_encode_startup,utc_image_util_encode_cleanup}, {"utc_image_util_encode_set_input_buffer_n1",utc_image_util_encode_set_input_buffer_n1,utc_image_util_encode_startup,utc_image_util_encode_cleanup}, {"utc_image_util_encode_set_input_buffer_n2",utc_image_util_encode_set_input_buffer_n2,utc_image_util_encode_startup,utc_image_util_encode_cleanup}, {"utc_image_util_encode_set_input_buffer_n3",utc_image_util_encode_set_input_buffer_n3,utc_image_util_encode_startup,utc_image_util_encode_cleanup}, diff --git a/src/utc/image-util/utc-image-util-decode-encode.c b/src/utc/image-util/utc-image-util-decode-encode.c index c4e740825..c26198c85 100755 --- a/src/utc/image-util/utc-image-util-decode-encode.c +++ b/src/utc/image-util/utc-image-util-decode-encode.c @@ -26,7 +26,7 @@ #define WRONG_PATH "" #define INVALID_IMAGE_TYPE sizeof(image_util_type_e) + 1 /* +1 margin due to new type */ -#define LAST_IMAGE_TYPE IMAGE_UTIL_BMP +#define LAST_IMAGE_TYPE IMAGE_UTIL_WEBP typedef struct { unsigned char *buffer; @@ -46,6 +46,7 @@ static const char *g_source_filename[] = { [IMAGE_UTIL_PNG] = "sample.png", [IMAGE_UTIL_GIF] = "sample.gif", [IMAGE_UTIL_BMP] = "sample.bmp", + [IMAGE_UTIL_WEBP] = "sample.webp", }; static const char *g_output_filename[] = { @@ -53,6 +54,7 @@ static const char *g_output_filename[] = { [IMAGE_UTIL_PNG] = "test_output.png", [IMAGE_UTIL_GIF] = "test_output.gif", [IMAGE_UTIL_BMP] = "test_output.bmp", + [IMAGE_UTIL_WEBP] = "test_output.webp", }; static char *g_source_path[] = { @@ -60,6 +62,7 @@ static char *g_source_path[] = { [IMAGE_UTIL_PNG] = NULL, [IMAGE_UTIL_GIF] = NULL, [IMAGE_UTIL_BMP] = NULL, + [IMAGE_UTIL_WEBP] = NULL, }; static char *g_output_path[] = { @@ -67,6 +70,7 @@ static char *g_output_path[] = { [IMAGE_UTIL_PNG] = NULL, [IMAGE_UTIL_GIF] = NULL, [IMAGE_UTIL_BMP] = NULL, + [IMAGE_UTIL_WEBP] = NULL, }; static image_util_decode_h g_decoder[] = { @@ -74,6 +78,7 @@ static image_util_decode_h g_decoder[] = { [IMAGE_UTIL_PNG] = NULL, [IMAGE_UTIL_GIF] = NULL, [IMAGE_UTIL_BMP] = NULL, + [IMAGE_UTIL_WEBP] = NULL, }; static image_util_encode_h g_encoder[] = { @@ -81,6 +86,7 @@ static image_util_encode_h g_encoder[] = { [IMAGE_UTIL_PNG] = NULL, [IMAGE_UTIL_GIF] = NULL, [IMAGE_UTIL_BMP] = NULL, + [IMAGE_UTIL_WEBP] = NULL, }; static decode_result_t g_decode_result[] = { @@ -88,6 +94,7 @@ static decode_result_t g_decode_result[] = { [IMAGE_UTIL_PNG] = { NULL, 0, 0, 0 }, [IMAGE_UTIL_GIF] = { NULL, 0, 0, 0 }, [IMAGE_UTIL_BMP] = { NULL, 0, 0, 0 }, + [IMAGE_UTIL_WEBP] = { NULL, 0, 0, 0 }, }; static encode_result_t g_encode_result[] = { @@ -95,6 +102,7 @@ static encode_result_t g_encode_result[] = { [IMAGE_UTIL_PNG] = { NULL, 0, 0 }, [IMAGE_UTIL_GIF] = { NULL, 0, 0 }, [IMAGE_UTIL_BMP] = { NULL, 0, 0 }, + [IMAGE_UTIL_WEBP] = { NULL, 0, 0 }, }; static image_util_image_h g_decoded_image[] = { @@ -102,6 +110,7 @@ static image_util_image_h g_decoded_image[] = { [IMAGE_UTIL_PNG] = NULL, [IMAGE_UTIL_GIF] = NULL, [IMAGE_UTIL_BMP] = NULL, + [IMAGE_UTIL_WEBP] = NULL, }; static int callback_error = IMAGE_UTIL_ERROR_NONE; @@ -236,7 +245,7 @@ void utc_image_util_decode_startup(void) for (type = 0; type <= LAST_IMAGE_TYPE; type++) { g_source_path[type] = _utc_get_test_path(pszValue, g_source_filename[type]); g_output_path[type] = _utc_get_test_path(pszValue, g_output_filename[type]); - FPRINTF("[%d:%s] PATH [Type: %d] [Decode: %s], [Encode: %s] \\n", __LINE__, __FUNCTION__, type, + FPRINTF("[%d:%s] PATH [Type: %d] [Decode: %s], [Encode: %s] \\n", __LINE__, __FUNCTION__, type, g_source_path[type], g_output_path[type]); if (!g_source_path[type] || !g_output_path[type]) @@ -1641,7 +1650,7 @@ void utc_image_util_encode_cleanup(void) { /* end of TC */ image_util_type_e type = 0; - + for (type = 0; type <= LAST_IMAGE_TYPE; type++) { IMAGEUTIL_SAFE_FREE(g_decode_result[type].buffer); IMAGEUTIL_SAFE_FREE(g_encode_result[type].buffer); @@ -1947,9 +1956,7 @@ int utc_image_util_encode_set_quality_n3(void) for (type = 0; type <= LAST_IMAGE_TYPE; type++) { ret = image_util_encode_set_quality(g_encoder[type], 1); - if (type == IMAGE_UTIL_JPEG) - assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - else + if (type != IMAGE_UTIL_JPEG) assert_eq(ret, IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT); } @@ -2031,9 +2038,7 @@ int utc_image_util_encode_set_png_compression_n3(void) for (type = 0; type <= LAST_IMAGE_TYPE; type++) { ret = image_util_encode_set_png_compression(g_encoder[type], IMAGE_UTIL_PNG_COMPRESSION_0); - if (type == IMAGE_UTIL_PNG) - assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - else + if (type != IMAGE_UTIL_PNG) assert_eq(ret, IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT); } @@ -2115,9 +2120,7 @@ int utc_image_util_encode_set_gif_frame_delay_time_n3(void) for (type = 0; type <= LAST_IMAGE_TYPE; type++) { ret = image_util_encode_set_gif_frame_delay_time(g_encoder[type], 100); - if (type == IMAGE_UTIL_GIF) - assert_eq(ret, IMAGE_UTIL_ERROR_NONE); - else + if (type != IMAGE_UTIL_GIF) assert_eq(ret, IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT); } @@ -2139,6 +2142,59 @@ int utc_image_util_encode_set_gif_frame_delay_time_p(void) return 0; } +/** + * @testcase utc_image_util_encode_set_webp_lossless_n1 + * @since_tizen 6.0 + * @description Negative test case for image_util_encode_set_webp_lossless + */ +int utc_image_util_encode_set_webp_lossless_n1(void) +{ + int ret = IMAGE_UTIL_ERROR_NONE; + image_util_type_e type = 0; + + ret = image_util_encode_set_webp_lossless(NULL, true); + assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER); + + return 0; +} + +/** + * @testcase utc_image_util_encode_set_webp_lossless_n2 + * @since_tizen 6.0 + * @description Negative test case for image_util_encode_set_webp_lossless + */ +int utc_image_util_encode_set_webp_lossless_n2(void) +{ + int ret = IMAGE_UTIL_ERROR_NONE; + image_util_type_e type = 0; + + for (type = 0; type <= LAST_IMAGE_TYPE; type++) { + ret = image_util_encode_set_webp_lossless(g_encoder[type], true); + if (type != IMAGE_UTIL_WEBP) + assert_eq(ret, IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT); + } + + return 0; +} + +/** + * @testcase utc_image_util_encode_set_webp_lossless_p + * @since_tizen 6.0 + * @description Positive test case for image_util_encode_set_webp_lossless + */ +int utc_image_util_encode_set_webp_lossless_p(void) +{ + int ret = IMAGE_UTIL_ERROR_NONE; + + ret = image_util_encode_set_webp_lossless(g_encoder[IMAGE_UTIL_WEBP], true); + assert_eq(ret, IMAGE_UTIL_ERROR_NONE); + + ret = image_util_encode_set_webp_lossless(g_encoder[IMAGE_UTIL_WEBP], false); + assert_eq(ret, IMAGE_UTIL_ERROR_NONE); + + return 0; +} + /** * @testcase utc_image_util_encode_set_input_buffer_n1 * @since_tizen 3.0