[UTC][capi-media-image-util][Non-ACR][Add invalid 'image_type' for negative test] 27/240127/3
authorjiyong.min <jiyong.min@samsung.com>
Mon, 3 Aug 2020 23:07:17 +0000 (08:07 +0900)
committerjiyong.min <jiyong.min@samsung.com>
Tue, 4 Aug 2020 00:01:04 +0000 (09:01 +0900)
  - When new 'image_type' is added, it is failed.
    So I add the invalid 'image_type' value to prevent TC failure.

Change-Id: I275f586d154cc7cf8fbe2a18d1cb87219e1e235c

src/utc/image-util/utc-image-util-decode-encode.c

index 0fe6330f4cb3d6ad48ddb3c41aa2986cb6e97ed9..a175abaa74825e7ef606e4bd663a7779e0a7e86d 100755 (executable)
@@ -25,6 +25,8 @@
 
 #define WRONG_PATH ""
 
+#define INVALID_IMAGE_TYPE             sizeof(image_util_type_e) + 1   /* +1 margin due to new type */
+
 static image_util_decode_h jpeg_decode_h = NULL;
 static image_util_encode_h jpeg_encode_h = NULL;
 static image_util_decode_h jpeg_decoded_h = NULL;
@@ -475,8 +477,12 @@ int utc_image_util_foreach_supported_colorspace_n1(void)
  */
 int utc_image_util_foreach_supported_colorspace_n2(void)
 {
-       int ret = image_util_foreach_supported_colorspace(sizeof(image_util_type_e), _image_util_supported_colorspace_cb, NULL);
+       int ret = image_util_foreach_supported_colorspace(-1, _image_util_supported_colorspace_cb, NULL);
+       assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER);
+
+       ret = image_util_foreach_supported_colorspace(INVALID_IMAGE_TYPE, _image_util_supported_colorspace_cb, NULL);
        assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER);
+
        return 0;
 }
 
@@ -1792,9 +1798,13 @@ int utc_image_util_encode_create_n2(void)
        ret = image_util_encode_destroy(png_encode_h);
        assert_eq(ret, IMAGE_UTIL_ERROR_NONE);
        png_encode_h = NULL;
+
        ret = image_util_encode_create(-1, &png_encode_h);
        assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER);
 
+       ret = image_util_encode_create(INVALID_IMAGE_TYPE, &png_encode_h);
+       assert_eq(ret, IMAGE_UTIL_ERROR_INVALID_PARAMETER);
+
        return 0;
 }