Add bulk test codes 28/246828/10 accepted/tizen/unified/20201111.124726 submit/tizen/20201110.072449
authorhj kim <backto.kim@samsung.com>
Wed, 4 Nov 2020 09:58:15 +0000 (18:58 +0900)
committerhj kim <backto.kim@samsung.com>
Fri, 6 Nov 2020 05:14:16 +0000 (14:14 +0900)
Change-Id: I9204150e7603f84793911be42296e8be34d833ae

packaging/libmm-fileinfo.spec
tests/mm_file_test.c

index 8be2edc..d32f69e 100644 (file)
@@ -1,6 +1,6 @@
 Name:      libmm-fileinfo
 Summary:    Media Fileinfo
-Version:    0.6.93
+Version:    0.6.94
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0
index 94fdfd8..5113a87 100755 (executable)
@@ -250,12 +250,48 @@ static bool __is_file_exist(const char *filename)
        return true;
 }
 
+static int __bulk_test(int argc, char **argv)
+{
+       GDir *dir = NULL;
+       GError *error = NULL;
+       char *path = NULL;
+       const char *name;
+
+       dir = g_dir_open(argv[1], 0, &error);
+       if (error != NULL) {
+               printf("Failed to open directory[%s]\n", argv[1]);
+               printf("ex) mm_file_test /opt/usr/home/owner/media/Music/ >> result.txt \n");
+               g_error_free(error);
+               return 0;
+       }
+
+       while ((name = g_dir_read_name(dir))) {
+               if (name[0] == '.')
+                       continue;
+
+               path = g_build_path(G_DIR_SEPARATOR_S, argv[1], name, NULL);
+
+               if (argv[2] == NULL)
+                       mmfile_get_file_infomation((void *)path, NULL, true);
+               else
+                       mmfile_get_video_frame((void *)path, argv[2], true);
+
+               g_free(path);
+       }
+
+       g_dir_close(dir);
+
+       return 0;
+}
 
 int main(int argc, char **argv)
 {
        struct stat statbuf;
        bool file_test = true;          /*if you want to test mm_file_create_content_XXX_from_memory() set file_test to false */
 
+       if (g_file_test(argv[1], G_FILE_TEST_IS_DIR))
+               return __bulk_test(argc, argv);
+
        if (__is_file_exist(argv[1])) {
                int ret = lstat(argv[1], &statbuf);
                if (ret < 0) {
@@ -378,7 +414,8 @@ static int mmfile_get_file_infomation(void *data, void *user_data, bool file_tes
                                printf("# video fps: %d\n", ccontent.video_fps);
                                printf("# video track id: %d\n", ccontent.video_track_id);
                                printf("# video width/height: %d x %d\n", ccontent.video_w, ccontent.video_h);
-                               printf("# video thumbnail: %p\n", ccontent.thumbnail.value.p_val);
+                               //printf("# video thumbnail: %p\n", ccontent.thumbnail.value.p_val);
+                               printf("# video thumbnail size: %d\n", ccontent.thumbnail.len);
                        }
                }
 
@@ -490,7 +527,7 @@ static int mmfile_get_file_infomation(void *data, void *user_data, bool file_tes
                printf("# part of a set: [%s]\n", ctag.part_of_set.value.s_val);
                printf("# description: [%s]\n", ctag.description.value.s_val);
                printf("# comment: [%s]\n", ctag.comment.value.s_val);
-               printf("# artwork: [%p]\n", ctag.artwork.value.p_val);
+               //printf("# artwork: [%p]\n", ctag.artwork.value.p_val);
                printf("# artwork_size: [%d]\n", ctag.artwork_size.value.i_val);
                printf("# artwork_mime: [%s]\n", ctag.artwork_mime.value.s_val);
                printf("# track number: [%s]\n", ctag.track_num.value.s_val);