Modify parameters in encoding APIs have been changed from mm_image_info_s to mm_util_...
[platform/core/multimedia/libmm-utility.git] / png / unittest / libmm_png_unittest.cpp
index e67e7ba..11e6551 100644 (file)
@@ -106,7 +106,7 @@ TEST(libmm_png_Test, mm_util_encode_to_png_file_p)
        EXPECT_EQ(ret, MM_UTIL_ERROR_NONE);
        EXPECT_TRUE(mm_image_is_valid_image(decode_image));
 
-       ret = mm_util_encode_to_png_file((mm_image_info_s *)decode_image, MM_UTIL_COMPRESSION_6, ENCODE_FILE_PATH);
+       ret = mm_util_encode_to_png_file(decode_image, MM_UTIL_COMPRESSION_6, ENCODE_FILE_PATH);
        EXPECT_EQ(ret, MM_UTIL_ERROR_NONE);
 
        mm_image_destroy_image(decode_image);
@@ -115,13 +115,19 @@ TEST(libmm_png_Test, mm_util_encode_to_png_file_p)
 TEST(libmm_png_Test, mm_util_encode_to_png_file_n)
 {
        int ret = MM_UTIL_ERROR_NONE;
-       mm_image_info_s decode_image;
+       mm_util_image_h decode_image = NULL;
+
+       ret = mm_util_decode_from_png_file(DECODE_FILE_PATH, &decode_image);
+       EXPECT_EQ(ret, MM_UTIL_ERROR_NONE);
+       EXPECT_TRUE(mm_image_is_valid_image(decode_image));
 
        ret = mm_util_encode_to_png_file(NULL, MM_UTIL_COMPRESSION_6, ENCODE_FILE_PATH);
        EXPECT_EQ(ret, MM_UTIL_ERROR_INVALID_PARAMETER);
 
-       ret = mm_util_encode_to_png_file(&decode_image, MM_UTIL_COMPRESSION_6, NULL);
+       ret = mm_util_encode_to_png_file(decode_image, MM_UTIL_COMPRESSION_6, NULL);
        EXPECT_EQ(ret, MM_UTIL_ERROR_INVALID_PARAMETER);
+
+       mm_image_destroy_image(decode_image);
 }
 
 TEST(libmm_png_Test, mm_util_encode_to_png_memory_p)
@@ -135,7 +141,7 @@ TEST(libmm_png_Test, mm_util_encode_to_png_memory_p)
        EXPECT_EQ(ret, MM_UTIL_ERROR_NONE);
        EXPECT_TRUE(mm_image_is_valid_image(decode_image));
 
-       ret = mm_util_encode_to_png_memory((mm_image_info_s *)decode_image, MM_UTIL_COMPRESSION_6, &buffer, &size);
+       ret = mm_util_encode_to_png_memory(decode_image, MM_UTIL_COMPRESSION_6, &buffer, &size);
        EXPECT_EQ(ret, MM_UTIL_ERROR_NONE);
        EXPECT_TRUE(buffer != NULL);
        EXPECT_NE(size, 0);
@@ -149,18 +155,24 @@ TEST(libmm_png_Test, mm_util_encode_to_png_memory_p)
 TEST(libmm_png_Test, mm_util_encode_to_png_memory_n)
 {
        int ret = MM_UTIL_ERROR_NONE;
-       mm_image_info_s decode_image;
+       mm_util_image_h decode_image = NULL;
        void *buffer = NULL;
        size_t size = 0;
 
+       ret = mm_util_decode_from_png_file(DECODE_FILE_PATH, &decode_image);
+       EXPECT_EQ(ret, MM_UTIL_ERROR_NONE);
+       EXPECT_TRUE(mm_image_is_valid_image(decode_image));
+
        ret = mm_util_encode_to_png_memory(NULL, MM_UTIL_COMPRESSION_6, &buffer, &size);
        EXPECT_EQ(ret, MM_UTIL_ERROR_INVALID_PARAMETER);
 
-       ret = mm_util_encode_to_png_memory(&decode_image, MM_UTIL_COMPRESSION_6, NULL, &size);
+       ret = mm_util_encode_to_png_memory(decode_image, MM_UTIL_COMPRESSION_6, NULL, &size);
        EXPECT_EQ(ret, MM_UTIL_ERROR_INVALID_PARAMETER);
 
-       ret = mm_util_encode_to_png_memory(&decode_image, MM_UTIL_COMPRESSION_6, &buffer, NULL);
+       ret = mm_util_encode_to_png_memory(decode_image, MM_UTIL_COMPRESSION_6, &buffer, NULL);
        EXPECT_EQ(ret, MM_UTIL_ERROR_INVALID_PARAMETER);
+
+       mm_image_destroy_image(decode_image);
 }
 
 int main(int argc, char **argv)