[UTC][thumbnail-util][Non-ACR] test code cleanup 33/262733/4
authorMinje Ahn <minje.ahn@samsung.com>
Thu, 19 Aug 2021 01:19:06 +0000 (10:19 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Thu, 19 Aug 2021 06:25:01 +0000 (15:25 +0900)
Change-Id: I202e4bb2516d6b882eb17aa38a6a0c3403243a0b
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
src/utc/thumbnail-util/CMakeLists.txt
src/utc/thumbnail-util/utc-thumbnail-util.c

index 91d1fc8b9a3906e9992eabdc0fc59e3c8f494f4a..e22c10037cce698977dde2b1ee2e5fb0b80342f8 100644 (file)
@@ -10,12 +10,10 @@ SET(TC_SOURCES
 
 PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED
     ${CAPI_LIB}
-       capi-appfw-application
-       capi-system-info
-    bundle
+    capi-appfw-application
+    capi-system-info
     glib-2.0
-    storage
-       dlog 
+    dlog
 )
 
 INCLUDE_DIRECTORIES(
index 1bee5dd2444c239d0132b76df83d61fa9fdb3fd3..263b025b95c39f353dc06d7a1036c9dd9f29fd9a 100755 (executable)
  * limitations under the License.
  */
 
-#include "assert.h"
-#include <stdio.h>
-#include <stdlib.h>
+#include "tct_common.h"
 #include <glib.h>
-#include <string.h>
 #include <thumbnail_util.h>
-#include <storage.h>
-#include "tct_common.h"
-
-#define MEDIA_IMAGE_WIDTH              512
-#define MEDIA_IMAGE_HEIGHT             288
 
-#define API_NAMESPACE                  "[THUMBNAIL-UTIL]"
+#define THUMB_WIDTH 320
+#define THUMB_HEIGHT 240
+#define PATH_MAX 4096
 
-#define SAFE_FREE(src)   { if(src) {free(src); src = NULL;}}
+#define API_NAMESPACE  "[THUMBNAIL-UTIL]"
 
-static thumbnail_h g_thumb_h = NULL;
-static int _startup_error = 0;
 static int _retv = 0;
-static char *image_path = "sample.jpg";
-static char *video_path = "sample.mp4";
-static char *unsupported_image = "sample.tif";
-static char *thumb_path = "thumbnail.jpg";
-static char *unsupported_thumb = "thumbnail.png";
-
-static char *g_image_path = NULL;
-static char *g_video_path = NULL;
-static char *g_unsupported_image_path = NULL;
-static char *g_thumb_path = NULL;
-static char *g_unsupported_thumb_path = NULL;
+static const char *image = "res/sample.jpg";
+static const char *video = "res/sample.mp4";
+static const char *unsupported_image = "res/sample.tif";
+static const char *thumb = "res/thumbnail.jpg";
+static const char *unsupported_thumb = "res/thumbnail.png";
+
+static char g_image_path[PATH_MAX + 1] = { 0, };
+static char g_video_path[PATH_MAX + 1] = { 0, };
+static char g_unsupported_image_path[PATH_MAX + 1] = { 0, };
+static char g_thumb_path[PATH_MAX + 1] = { 0, };
+static char g_unsupported_thumb_path[PATH_MAX + 1] = { 0, };
+
 GSource *source = NULL;
 GMainContext *context = NULL;
 GMainLoop *g_loop = NULL;
@@ -56,28 +49,18 @@ GMainLoop *g_loop = NULL;
  */
 void utc_thumbnail_util_startup(void)
 {
-       char pszValue[CONFIG_VALUE_LEN_MAX] = {0,};
-       if ( true == GetValueForTCTSetting("DEVICE_SUITE_TARGET_30", pszValue, API_NAMESPACE ))
-       {
-               PRINT_UTC_LOG("[Line : %d][%s] 'DEVICE_SUITE_TARGET_30' Values Received = %s\\n", __LINE__, API_NAMESPACE,  pszValue);
-               g_image_path=(char*)malloc(strlen(pszValue)+strlen(image_path)+6);
-               snprintf(g_image_path, strlen(pszValue)+strlen(image_path)+6, "%s/res/%s", pszValue, image_path);
-               g_video_path=(char*)malloc(strlen(pszValue)+strlen(video_path)+6);
-               snprintf(g_video_path, strlen(pszValue)+strlen(video_path)+6, "%s/res/%s", pszValue, video_path);
-               g_unsupported_image_path=(char*)malloc(strlen(pszValue)+strlen(unsupported_image)+6);
-               snprintf(g_unsupported_image_path, strlen(pszValue)+strlen(unsupported_image)+6, "%s/res/%s", pszValue, unsupported_image);
-               g_thumb_path=(char*)malloc(strlen(pszValue)+strlen(thumb_path)+6);
-               snprintf(g_thumb_path, strlen(pszValue)+strlen(thumb_path)+6, "%s/res/%s", pszValue, thumb_path);
-               g_unsupported_thumb_path=(char*)malloc(strlen(pszValue)+strlen(unsupported_thumb)+6);
-               snprintf(g_unsupported_thumb_path, strlen(pszValue)+strlen(unsupported_thumb)+6, "%s/res/%s", pszValue, unsupported_thumb);
-       }
-       else
-       {
-               PRINT_UTC_LOG("[Line : %d][%s] GetValueForTCTSetting returned error for 'DEVICE_SUITE_TARGET_30'\\n", __LINE__, API_NAMESPACE);
-       }
+       char pszValue[CONFIG_VALUE_LEN_MAX] = { 0, };
+
+       if (true == GetValueForTCTSetting("DEVICE_SUITE_TARGET_30", pszValue, API_NAMESPACE)) {
+               PRINT_UTC_LOG("[Line : %d][%s] 'DEVICE_SUITE_TARGET_30' Values Received = %s\\n", __LINE__, API_NAMESPACE, pszValue);
 
-       if (THUMBNAIL_UTIL_ERROR_NONE != thumbnail_util_create(&g_thumb_h)) {
-               _startup_error = 1;
+               snprintf(g_image_path, PATH_MAX, "%s/%s", pszValue, image);
+               snprintf(g_video_path, PATH_MAX, "%s/%s", pszValue, video);
+               snprintf(g_unsupported_image_path, PATH_MAX, "%s/%s", pszValue, unsupported_image);
+               snprintf(g_thumb_path, PATH_MAX, "%s/%s", pszValue, thumb);
+               snprintf(g_unsupported_thumb_path, PATH_MAX, "%s/%s", pszValue, unsupported_thumb);
+       } else {
+               PRINT_UTC_LOG("[Line : %d][%s] GetValueForTCTSetting returned error for 'DEVICE_SUITE_TARGET_30'\\n", __LINE__, API_NAMESPACE);
        }
 }
 
@@ -89,17 +72,11 @@ void utc_thumbnail_util_startup(void)
  */
 void utc_thumbnail_util_cleanup(void)
 {
-       if (g_thumb_h) {
-               if (THUMBNAIL_UTIL_ERROR_NONE != thumbnail_util_destroy(g_thumb_h)) {
-                       fprintf(stderr, "Cleanup function error - can affect other tests.");
-               }
-       }
-
-       if (g_image_path) free(g_image_path);
-       if (g_video_path) free(g_video_path);
-       if (g_unsupported_image_path) free(g_unsupported_image_path);
-       if (g_thumb_path) free(g_thumb_path);
-       if (g_unsupported_thumb_path) free(g_unsupported_thumb_path);
+       memset(&g_image_path, 0, PATH_MAX + 1);
+       memset(&g_video_path, 0, PATH_MAX + 1);
+       memset(&g_unsupported_image_path, 0, PATH_MAX + 1);
+       memset(&g_thumb_path, 0, PATH_MAX + 1);
+       memset(&g_unsupported_thumb_path, 0, PATH_MAX + 1);
 }
 
 /**
@@ -109,8 +86,9 @@ void utc_thumbnail_util_cleanup(void)
  */
 int utc_thumbnail_util_create_n(void)
 {
-       int ret = thumbnail_util_create(NULL);
+       int ret = THUMBNAIL_UTIL_ERROR_NONE;
 
+       ret = thumbnail_util_create(NULL);
        assert_eq(ret, THUMBNAIL_UTIL_ERROR_INVALID_PARAMETER);
 
        return 0;
@@ -123,19 +101,22 @@ int utc_thumbnail_util_create_n(void)
  */
 int utc_thumbnail_util_create_p(void)
 {
-       assert_eq(_startup_error, 0);
+       int ret = THUMBNAIL_UTIL_ERROR_NONE;
+       thumbnail_h thumb = NULL;
+
+       ret = thumbnail_util_create(&thumb);
+       assert_eq(ret, THUMBNAIL_UTIL_ERROR_NONE);
 
-       int ret = thumbnail_util_destroy(g_thumb_h);
-       ret = thumbnail_util_create(&g_thumb_h);
+       ret = thumbnail_util_destroy(thumb);
        assert_eq(ret, THUMBNAIL_UTIL_ERROR_NONE);
 
        return 0;
 }
 
-void thumbnail_completed_cb(thumbnail_util_error_e error, int request_id, const char *path, int raw_width, int raw_height, unsigned char *raw_data, int raw_size, void *user_data)
+void thumbnail_completed_cb(thumbnail_util_error_e e, const char *id, int width, int height, unsigned char *data, int size, void *user_data)
 {
-       _retv = error;
-       PRINT_UTC_LOG("[Line : %d][%s] thumbnail_completed_cb returned %d(%0x) error\\n", __LINE__, API_NAMESPACE, error, error);
+       _retv = e;
+       PRINT_UTC_LOG("[Line : %d][%s] thumbnail_completed_cb returned %d(%0x) error\\n", __LINE__, API_NAMESPACE, e, e);
        g_main_loop_quit(g_loop);
 }
 
@@ -143,57 +124,34 @@ gboolean extract_thumbnail_start(gpointer data)
 {
        int ret = THUMBNAIL_UTIL_ERROR_NONE;
        char *request_id = NULL;
+       thumbnail_h test_info = NULL;
 
-       thumbnail_h test_info;
-       thumbnail_util_create(&test_info);
-       thumbnail_util_set_path(test_info, g_image_path);
-       thumbnail_util_set_size(test_info, MEDIA_IMAGE_WIDTH, MEDIA_IMAGE_HEIGHT);
-       ret = thumbnail_util_extract(test_info, thumbnail_completed_cb, NULL, &request_id);
+       ret = thumbnail_util_create(&test_info);
+       if (ret != THUMBNAIL_UTIL_ERROR_NONE)
+               goto FINALIZE;
 
-       if (ret != THUMBNAIL_UTIL_ERROR_NONE) {
-               g_main_loop_quit(g_loop);
-               _retv = ret;
-       }
-
-       if (!request_id)
-       {
-               _retv = THUMBNAIL_UTIL_ERROR_INVALID_PARAMETER;
-       }
+       ret = thumbnail_util_set_path(test_info, (const char *)data);
+       if (ret != THUMBNAIL_UTIL_ERROR_NONE)
+               goto FINALIZE;
 
-       thumbnail_util_destroy(test_info);
-       SAFE_FREE(request_id);
+       ret = thumbnail_util_set_size(test_info, THUMB_WIDTH, THUMB_HEIGHT);
+       if (ret != THUMBNAIL_UTIL_ERROR_NONE)
+               goto FINALIZE;
 
-       return false;
-}
-
-gboolean extract_thumbnail_start_n(gpointer data)
-{
-       int ret = THUMBNAIL_UTIL_ERROR_NONE;
-       char *request_id = NULL;
-
-       thumbnail_h test_info;
-       thumbnail_util_create(&test_info);
-       thumbnail_util_set_path(test_info, g_unsupported_image_path);
-       thumbnail_util_set_size(test_info, MEDIA_IMAGE_WIDTH, MEDIA_IMAGE_HEIGHT);
        ret = thumbnail_util_extract(test_info, thumbnail_completed_cb, NULL, &request_id);
+       FREE_MEMORY(request_id);
 
-       if (ret != THUMBNAIL_UTIL_ERROR_NONE) {
-               g_main_loop_quit(g_loop);
-               _retv = ret;
-       }
-
-       if (!request_id)
-       {
-               _retv = THUMBNAIL_UTIL_ERROR_INVALID_PARAMETER;
-       }
+ FINALIZE:
+       if (test_info)
+               thumbnail_util_destroy(test_info);
 
-       thumbnail_util_destroy(test_info);
-       SAFE_FREE(request_id);
+       _retv = ret;
+       if (_retv != THUMBNAIL_UTIL_ERROR_NONE)
+               g_main_loop_quit(g_loop);
 
-       return false;
+       return FALSE;
 }
 
-
 /**
  * @testcase           utc_thumbnail_util_extract_n1
  * @since_tizen                2.4
@@ -201,12 +159,20 @@ gboolean extract_thumbnail_start_n(gpointer data)
  */
 int utc_thumbnail_util_extract_n1(void)
 {
-       assert_eq(_startup_error, 0);
+       int ret = THUMBNAIL_UTIL_ERROR_NONE;
        char *request_id = NULL;
-       int ret = thumbnail_util_extract(g_thumb_h, thumbnail_completed_cb, NULL, &request_id);
+       thumbnail_h test_info = NULL;
 
+       ret = thumbnail_util_create(&test_info);
+       assert_eq(ret, THUMBNAIL_UTIL_ERROR_NONE);
+
+       ret = thumbnail_util_extract(test_info, thumbnail_completed_cb, NULL, &request_id);
        assert_eq(ret, THUMBNAIL_UTIL_ERROR_INVALID_PARAMETER);
-       SAFE_FREE(request_id);
+       FREE_MEMORY(request_id);
+
+       ret = thumbnail_util_destroy(test_info);
+       assert_eq(ret, THUMBNAIL_UTIL_ERROR_NONE);
+
        return 0;
 }
 
@@ -217,12 +183,11 @@ int utc_thumbnail_util_extract_n1(void)
  */
 int utc_thumbnail_util_extract_n2(void)
 {
-       assert_eq(_startup_error, 0);
        g_loop = g_main_loop_new(NULL, false);
        context = g_main_loop_get_context(g_loop);
        source = g_idle_source_new();
-       g_source_set_callback (source, extract_thumbnail_start_n, NULL, NULL);
-       g_source_attach (source, context);
+       g_source_set_callback(source, extract_thumbnail_start, (gpointer) g_unsupported_image_path, NULL);
+       g_source_attach(source, context);
 
        g_main_loop_run(g_loop);
        g_main_loop_unref(g_loop);
@@ -241,13 +206,11 @@ int utc_thumbnail_util_extract_n2(void)
  */
 int utc_thumbnail_util_extract_p(void)
 {
-       assert_eq(_startup_error, 0);
-
        g_loop = g_main_loop_new(NULL, false);
        context = g_main_loop_get_context(g_loop);
        source = g_idle_source_new();
-       g_source_set_callback (source, extract_thumbnail_start, NULL, NULL);
-       g_source_attach (source, context);
+       g_source_set_callback(source, extract_thumbnail_start, (gpointer) g_image_path, NULL);
+       g_source_attach(source, context);
 
        g_main_loop_run(g_loop);
        g_main_loop_unref(g_loop);
@@ -266,12 +229,18 @@ int utc_thumbnail_util_extract_p(void)
  */
 int utc_thumbnail_util_set_path_n(void)
 {
-       assert_eq(_startup_error, 0);
+       int ret = THUMBNAIL_UTIL_ERROR_NONE;
+       thumbnail_h thumb = NULL;
 
-       int ret = thumbnail_util_set_path(g_thumb_h, NULL);
+       ret = thumbnail_util_create(&thumb);
+       assert_eq(ret, THUMBNAIL_UTIL_ERROR_NONE);
 
+       ret = thumbnail_util_set_path(thumb, NULL);
        assert_eq(ret, THUMBNAIL_UTIL_ERROR_INVALID_PARAMETER);
 
+       ret = thumbnail_util_destroy(thumb);
+       assert_eq(ret, THUMBNAIL_UTIL_ERROR_NONE);
+
        return 0;
 }
 
@@ -282,10 +251,16 @@ int utc_thumbnail_util_set_path_n(void)
  */
 int utc_thumbnail_util_set_path_p(void)
 {
-       assert_eq(_startup_error, 0);
+       int ret = THUMBNAIL_UTIL_ERROR_NONE;
+       thumbnail_h thumb = NULL;
+
+       ret = thumbnail_util_create(&thumb);
+       assert_eq(ret, THUMBNAIL_UTIL_ERROR_NONE);
 
-       int ret = thumbnail_util_set_path(g_thumb_h, g_image_path);
+       ret = thumbnail_util_set_path(thumb, g_image_path);
+       assert_eq(ret, THUMBNAIL_UTIL_ERROR_NONE);
 
+       ret = thumbnail_util_destroy(thumb);
        assert_eq(ret, THUMBNAIL_UTIL_ERROR_NONE);
 
        return 0;
@@ -298,10 +273,9 @@ int utc_thumbnail_util_set_path_p(void)
  */
 int utc_thumbnail_util_set_size_n(void)
 {
-       assert_eq(_startup_error, 0);
-
-       int ret = thumbnail_util_set_size(NULL, MEDIA_IMAGE_WIDTH, MEDIA_IMAGE_HEIGHT);
+       int ret = THUMBNAIL_UTIL_ERROR_NONE;
 
+       ret = thumbnail_util_set_size(NULL, THUMB_WIDTH, THUMB_HEIGHT);
        assert_eq(ret, THUMBNAIL_UTIL_ERROR_INVALID_PARAMETER);
 
        return 0;
@@ -314,14 +288,19 @@ int utc_thumbnail_util_set_size_n(void)
  */
 int utc_thumbnail_util_set_size_p(void)
 {
-       assert_eq(_startup_error, 0);
+       int ret = THUMBNAIL_UTIL_ERROR_NONE;
+       thumbnail_h thumb = NULL;
 
-       int ret = thumbnail_util_set_size(g_thumb_h, MEDIA_IMAGE_WIDTH, MEDIA_IMAGE_HEIGHT);
+       ret = thumbnail_util_create(&thumb);
+       assert_eq(ret, THUMBNAIL_UTIL_ERROR_NONE);
 
+       ret = thumbnail_util_set_size(thumb, THUMB_WIDTH, THUMB_HEIGHT);
        assert_eq(ret, THUMBNAIL_UTIL_ERROR_NONE);
 
-       return 0;
+       ret = thumbnail_util_destroy(thumb);
+       assert_eq(ret, THUMBNAIL_UTIL_ERROR_NONE);
 
+       return 0;
 }
 
 /**
@@ -331,18 +310,23 @@ int utc_thumbnail_util_set_size_p(void)
  */
 int utc_thumbnail_util_cancel_n(void)
 {
-       assert_eq(_startup_error, 0);
+       int ret = THUMBNAIL_UTIL_ERROR_NONE;
+       thumbnail_h thumb = NULL;
 
-       int ret = thumbnail_util_cancel(g_thumb_h, NULL);
+       ret = thumbnail_util_create(&thumb);
+       assert_eq(ret, THUMBNAIL_UTIL_ERROR_NONE);
 
+       ret = thumbnail_util_cancel(thumb, NULL);
        assert_eq(ret, THUMBNAIL_UTIL_ERROR_INVALID_PARAMETER);
 
+       ret = thumbnail_util_destroy(thumb);
+       assert_eq(ret, THUMBNAIL_UTIL_ERROR_NONE);
+
        return 0;
 }
 
-void thumbnail_cancel_cb(thumbnail_util_error_e error, int request_id, const char *path, int raw_width, int raw_height, unsigned char *raw_data, int raw_size, void *user_data)
+void thumbnail_cancel_cb(thumbnail_util_error_e e, const char *id, int width, int height, unsigned char *data, int size, void *user_data)
 {
-        return;
 }
 
 /**
@@ -352,29 +336,23 @@ void thumbnail_cancel_cb(thumbnail_util_error_e error, int request_id, const cha
  */
 int utc_thumbnail_util_cancel_p(void)
 {
-       assert_eq(_startup_error, 0);
        int ret = THUMBNAIL_UTIL_ERROR_NONE;
        char *request_id = NULL;
+       thumbnail_h test_info = NULL;
 
-       thumbnail_h test_info;
        thumbnail_util_create(&test_info);
        thumbnail_util_set_path(test_info, g_image_path);
-       thumbnail_util_set_size(test_info, MEDIA_IMAGE_WIDTH, MEDIA_IMAGE_HEIGHT);
-       ret = thumbnail_util_extract(test_info, thumbnail_cancel_cb, NULL, &request_id);
-       if(request_id) {
-               free(request_id);
-       request_id = NULL;
-       }
-       ret = thumbnail_util_extract(test_info, thumbnail_cancel_cb, NULL, &request_id);
+       thumbnail_util_set_size(test_info, THUMB_WIDTH, THUMB_HEIGHT);
 
-       ret = thumbnail_util_cancel(g_thumb_h, request_id);
+       ret = thumbnail_util_extract(test_info, thumbnail_cancel_cb, NULL, &request_id);
+       FREE_MEMORY(request_id);
 
+       ret = thumbnail_util_extract(test_info, thumbnail_cancel_cb, NULL, &request_id);
        assert_eq(ret, THUMBNAIL_UTIL_ERROR_NONE);
 
-       if(request_id) {
-               free(request_id);
-       request_id = NULL;
-       }
+       ret = thumbnail_util_cancel(test_info, request_id);
+       assert_eq(ret, THUMBNAIL_UTIL_ERROR_NONE);
+       FREE_MEMORY(request_id);
 
        return 0;
 
@@ -387,8 +365,9 @@ int utc_thumbnail_util_cancel_p(void)
  */
 int utc_thumbnail_util_destroy_n(void)
 {
-       int ret = thumbnail_util_destroy(NULL);
+       int ret = THUMBNAIL_UTIL_ERROR_NONE;
 
+       ret = thumbnail_util_destroy(NULL);
        assert_eq(ret, THUMBNAIL_UTIL_ERROR_INVALID_PARAMETER);
 
        return 0;
@@ -401,11 +380,13 @@ int utc_thumbnail_util_destroy_n(void)
  */
 int utc_thumbnail_util_destroy_p(void)
 {
-       assert_eq(_startup_error, 0);
+       int ret = THUMBNAIL_UTIL_ERROR_NONE;
+       thumbnail_h thumb = NULL;
 
-       int ret = thumbnail_util_destroy(g_thumb_h);
-       g_thumb_h = NULL;
+       ret = thumbnail_util_create(&thumb);
+       assert_eq(ret, THUMBNAIL_UTIL_ERROR_NONE);
 
+       ret = thumbnail_util_destroy(thumb);
        assert_eq(ret, THUMBNAIL_UTIL_ERROR_NONE);
 
        return 0;
@@ -418,9 +399,9 @@ int utc_thumbnail_util_destroy_p(void)
  */
 int utc_thumbnail_util_extract_to_file_n1(void)
 {
-       assert_eq(_startup_error, 0);
+       int ret = THUMBNAIL_UTIL_ERROR_NONE;
 
-       int ret = thumbnail_util_extract_to_file(NULL, 320, 240, g_thumb_path);
+       ret = thumbnail_util_extract_to_file(NULL, THUMB_WIDTH, THUMB_HEIGHT, g_thumb_path);
        assert_eq(ret, THUMBNAIL_UTIL_ERROR_INVALID_PARAMETER);
 
        return 0;
@@ -433,9 +414,9 @@ int utc_thumbnail_util_extract_to_file_n1(void)
  */
 int utc_thumbnail_util_extract_to_file_n2(void)
 {
-       assert_eq(_startup_error, 0);
+       int ret = THUMBNAIL_UTIL_ERROR_NONE;
 
-       int ret = thumbnail_util_extract_to_file(g_unsupported_image_path, 320, 240, g_thumb_path);
+       ret = thumbnail_util_extract_to_file(g_unsupported_image_path, THUMB_WIDTH, THUMB_HEIGHT, g_thumb_path);
        assert_eq(ret, THUMBNAIL_UTIL_ERROR_UNSUPPORTED_CONTENT);
 
        return 0;
@@ -448,9 +429,9 @@ int utc_thumbnail_util_extract_to_file_n2(void)
  */
 int utc_thumbnail_util_extract_to_file_n3(void)
 {
-       assert_eq(_startup_error, 0);
+       int ret = THUMBNAIL_UTIL_ERROR_NONE;
 
-       int ret = thumbnail_util_extract_to_file(g_video_path, 320, 240, g_unsupported_thumb_path);
+       ret = thumbnail_util_extract_to_file(g_video_path, THUMB_WIDTH, THUMB_HEIGHT, g_unsupported_thumb_path);
        assert_eq(ret, THUMBNAIL_UTIL_ERROR_INVALID_PARAMETER);
 
        return 0;
@@ -463,9 +444,9 @@ int utc_thumbnail_util_extract_to_file_n3(void)
  */
 int utc_thumbnail_util_extract_to_file_p1(void)
 {
-       assert_eq(_startup_error, 0);
+       int ret = THUMBNAIL_UTIL_ERROR_NONE;
 
-       int ret = thumbnail_util_extract_to_file(g_image_path, 320, 240, g_thumb_path);
+       ret = thumbnail_util_extract_to_file(g_image_path, THUMB_WIDTH, THUMB_HEIGHT, g_thumb_path);
        if (g_file_test(g_thumb_path, G_FILE_TEST_IS_REGULAR)) {
                unlink(g_thumb_path);
        } else {
@@ -484,9 +465,9 @@ int utc_thumbnail_util_extract_to_file_p1(void)
  */
 int utc_thumbnail_util_extract_to_file_p2(void)
 {
-       assert_eq(_startup_error, 0);
+       int ret = THUMBNAIL_UTIL_ERROR_NONE;
 
-       int ret = thumbnail_util_extract_to_file(g_video_path, 320, 240, g_thumb_path);
+       ret = thumbnail_util_extract_to_file(g_video_path, THUMB_WIDTH, THUMB_HEIGHT, g_thumb_path);
        if (g_file_test(g_thumb_path, G_FILE_TEST_IS_REGULAR)) {
                unlink(g_thumb_path);
        } else {
@@ -505,13 +486,13 @@ int utc_thumbnail_util_extract_to_file_p2(void)
  */
 int utc_thumbnail_util_extract_to_buffer_n1(void)
 {
-       assert_eq(_startup_error, 0);
+       int ret = THUMBNAIL_UTIL_ERROR_NONE;
        unsigned char *buf = NULL;
        unsigned int width = 0;
        unsigned int height = 0;
        size_t size = 0;
 
-       int ret = thumbnail_util_extract_to_buffer(NULL, 320, 240, &buf, &size, &width, &height);
+       ret = thumbnail_util_extract_to_buffer(NULL, THUMB_WIDTH, THUMB_HEIGHT, &buf, &size, &width, &height);
        assert_eq(ret, THUMBNAIL_UTIL_ERROR_INVALID_PARAMETER);
 
        return 0;
@@ -524,13 +505,13 @@ int utc_thumbnail_util_extract_to_buffer_n1(void)
  */
 int utc_thumbnail_util_extract_to_buffer_n2(void)
 {
-       assert_eq(_startup_error, 0);
+       int ret = THUMBNAIL_UTIL_ERROR_NONE;
        unsigned char *buf = NULL;
        unsigned int width = 0;
        unsigned int height = 0;
        size_t size = 0;
 
-       int ret = thumbnail_util_extract_to_buffer(g_unsupported_image_path, 320, 240, &buf, &size, &width, &height);
+       ret = thumbnail_util_extract_to_buffer(g_unsupported_image_path, THUMB_WIDTH, THUMB_HEIGHT, &buf, &size, &width, &height);
        assert_eq(ret, THUMBNAIL_UTIL_ERROR_UNSUPPORTED_CONTENT);
 
        return 0;
@@ -543,20 +524,14 @@ int utc_thumbnail_util_extract_to_buffer_n2(void)
  */
 int utc_thumbnail_util_extract_to_buffer_p1(void)
 {
-       assert_eq(_startup_error, 0);
+       int ret = THUMBNAIL_UTIL_ERROR_NONE;
        unsigned char *buf = NULL;
        unsigned int width = 0;
        unsigned int height = 0;
        size_t size = 0;
 
-       int ret = thumbnail_util_extract_to_buffer(g_image_path, 320, 240, &buf, &size, &width, &height);
-       if (buf != NULL && size > 0) {
-               free(buf);
-               buf = NULL;
-       } else {
-               ret = THUMBNAIL_UTIL_ERROR_INVALID_OPERATION;
-       }
-
+       ret = thumbnail_util_extract_to_buffer(g_image_path, THUMB_WIDTH, THUMB_HEIGHT, &buf, &size, &width, &height);
+       FREE_MEMORY(buf);
        assert_eq(ret, THUMBNAIL_UTIL_ERROR_NONE);
 
        return 0;
@@ -569,20 +544,14 @@ int utc_thumbnail_util_extract_to_buffer_p1(void)
  */
 int utc_thumbnail_util_extract_to_buffer_p2(void)
 {
-       assert_eq(_startup_error, 0);
+       int ret = THUMBNAIL_UTIL_ERROR_NONE;
        unsigned char *buf = NULL;
        unsigned int width = 0;
        unsigned int height = 0;
        size_t size = 0;
 
-       int ret = thumbnail_util_extract_to_buffer(g_video_path, 320, 240, &buf, &size, &width, &height);
-       if (buf != NULL && size > 0) {
-               free(buf);
-               buf = NULL;
-       } else {
-               ret = THUMBNAIL_UTIL_ERROR_INVALID_OPERATION;
-       }
-
+       ret = thumbnail_util_extract_to_buffer(g_video_path, THUMB_WIDTH, THUMB_HEIGHT, &buf, &size, &width, &height);
+       FREE_MEMORY(buf);
        assert_eq(ret, THUMBNAIL_UTIL_ERROR_NONE);
 
        return 0;