Remove deprecated filter keyword from test code
[platform/core/api/media-content.git] / test / media-content_test.c
index 0470978..695017f 100755 (executable)
@@ -917,7 +917,6 @@ int test_filter_create(void)
 
        /* Filter for media */
        const char *condition = "MEDIA_TYPE=3"; /*MEDIA_TYPE 0-image, 1-video, 2-sound, 3-music, 4-other*/
-       /*const char *condition = "MEDIA_TYPE IS NOT 0 AND MEDIA_DESCRIPTION IS NOT NULL"; */   /*MEDIA_TYPE 0-image, 1-video, 2-sound, 3-music, 4-other*/
 
        ret = media_filter_create(&g_filter);
 
@@ -2445,28 +2444,55 @@ int test_ebook_text_finder(const char *keyword)
        gettimeofday(&end_time, NULL);
 
        for (i = 0; i < book_path_len; i++) {
-               content_debug("=========================== [%d]", i);
-               content_debug("%s", book_path_list[i]);
+               ret = media_info_get_media_from_db_by_path(book_path_list[i], &media);
+               if (ret != MEDIA_CONTENT_ERROR_NONE)
+                       continue;
+
+               content_debug("===============================");
+               content_debug("[%d] %s", i, book_path_list[i]);
                content_debug("===============================");
-               media_info_get_media_from_db_by_path(book_path_list[i], &media);
                media_info_get_title(media, &s_value);
                content_debug("Title  : %s", s_value);
                g_free(s_value);
-               media_info_get_book(media, &book);
-               book_meta_get_author(book, &s_value);
-               content_debug("Author : %s", s_value);
-               g_free(s_value);
-               book_meta_get_date(book, &s_value);
-               content_debug("Date   : %s", s_value);
-               g_free(s_value);
-               book_meta_destroy(book);
-               media_info_destroy(media);
+               s_value = NULL;
+
+               ret = media_info_get_book(media, &book);
+               if (ret != MEDIA_CONTENT_ERROR_NONE) {
+                       media_info_destroy(media);
+                       continue;
+               }
+
+               ret = book_meta_get_author(book, &s_value);
+               if (ret == MEDIA_CONTENT_ERROR_NONE && s_value) {
+                       content_debug("Author : %s", s_value);
+                       g_free(s_value);
+                       s_value = NULL;
+               }
+
+               ret = book_meta_get_date(book, &s_value);
+               if (ret == MEDIA_CONTENT_ERROR_NONE && s_value) {
+                       content_debug("Date   : %s", s_value);
+                       g_free(s_value);
+                       s_value = NULL;
+               }
+
                content_debug("===============================");
+               ret = book_meta_destroy(book);
+               if (ret != MEDIA_CONTENT_ERROR_NONE)
+                       content_error("book_meta_destroy failed");
+
+               ret = media_info_destroy(media);
+               if (ret != MEDIA_CONTENT_ERROR_NONE)
+                       content_error("media_info_destroy failed");
+
+               g_free(book_path_list[i]);
        }
 
        ms_time = (end_time.tv_sec * 1000LL + end_time.tv_usec / 1000) - (start_time.tv_sec * 1000LL + start_time.tv_usec/ 1000);
-
        content_debug("Search Time [%lld]", ms_time);
+
+       g_free(book_path_list);
+
        return ret;
 }
 int test_disconnect_database(void)
@@ -3078,7 +3104,7 @@ int test_tv_filter_create(void)
 
        ret = media_filter_set_storage(g_tv_filter, "0a22a163-e634-4a2e-ba14-0469a969eea0");
 
-       ret = media_filter_set_order(g_tv_filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_STORAGE_ID, MEDIA_CONTENT_COLLATE_DEFAULT);
+       ret = media_filter_set_order(g_tv_filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_TITLE, MEDIA_CONTENT_COLLATE_DEFAULT);
 
        return ret;
 }