[UTC][media-content][ACR-990] Add new TCs
authorHaejeong Kim <backto.kim@samsung.com>
Tue, 22 Aug 2017 05:25:29 +0000 (14:25 +0900)
committerJihun Park <jihun87.park@samsung.com>
Mon, 11 Sep 2017 02:57:30 +0000 (02:57 +0000)
3 new APIs was added.
media_bookmark_foreach_bookmark_from_db
media_face_get_face_count_from_db
media_face_foreach_face_from_db

Change-Id: Iaa64ce44599816379040a0e8fbcd24845c5761dd

src/utc/media-content/public.list
src/utc/media-content/tct-media-content-core_mobile.h
src/utc/media-content/tct-media-content-core_wearable.h
src/utc/media-content/utc-media-bookmark.c
src/utc/media-content/utc-media-face.c

index 0c80c971f8485d9d9cd02ab905ad02b698fc6303..7232111aaf8288ab2613956528d81c2084a02faa 100755 (executable)
@@ -51,6 +51,7 @@ media_album_get_name
 media_bookmark_clone
 media_bookmark_destroy
 media_bookmark_get_bookmark_count_from_db
+media_bookmark_foreach_bookmark_from_db
 media_bookmark_get_bookmark_id
 media_bookmark_get_marked_time
 media_bookmark_get_thumbnail_path
@@ -82,6 +83,8 @@ media_face_set_tag
 media_face_insert_to_db
 media_face_update_to_db
 media_face_delete_from_db
+media_face_get_face_count_from_db
+media_face_foreach_face_from_db
 media_filter_create
 media_filter_destroy
 media_filter_get_condition
index b1f4ad5a781deea66795f1a20322ef18a397a3e4..c4427a6932ad292ca830396194c0699244168c3b 100755 (executable)
@@ -107,6 +107,8 @@ extern int utc_media_bookmark_insert_to_db_n(void);
 extern int utc_media_bookmark_insert_to_db_p(void);
 extern int utc_media_bookmark_get_bookmark_count_from_db_n(void);
 extern int utc_media_bookmark_get_bookmark_count_from_db_p(void);
+extern int utc_media_bookmark_foreach_bookmark_from_db_n(void);
+extern int utc_media_bookmark_foreach_bookmark_from_db_p(void);
 extern int utc_media_bookmark_clone_n(void);
 extern int utc_media_bookmark_clone_p(void);
 extern int utc_media_bookmark_destroy_n(void);
@@ -169,6 +171,10 @@ extern int utc_media_face_update_to_db_p(void);
 extern int utc_media_face_update_to_db_n(void);
 extern int utc_media_face_delete_from_db_p(void);
 extern int utc_media_face_delete_from_db_n(void);
+extern int utc_media_face_get_face_count_from_db_p(void);
+extern int utc_media_face_get_face_count_from_db_n(void);
+extern int utc_media_face_foreach_face_from_db_p(void);
+extern int utc_media_face_foreach_face_from_db_n(void);
 extern int utc_media_filter_create_n(void);
 extern int utc_media_filter_create_p(void);
 extern int utc_media_filter_destroy_n(void);
@@ -649,6 +655,8 @@ testcase tc_array[] = {
        {"utc_media_bookmark_insert_to_db_p",utc_media_bookmark_insert_to_db_p,utc_media_bookmark_insert_startup,utc_media_bookmark_insert_cleanup},
        {"utc_media_bookmark_get_bookmark_count_from_db_n",utc_media_bookmark_get_bookmark_count_from_db_n,utc_media_bookmark_startup,utc_media_bookmark_cleanup},
        {"utc_media_bookmark_get_bookmark_count_from_db_p",utc_media_bookmark_get_bookmark_count_from_db_p,utc_media_bookmark_startup,utc_media_bookmark_cleanup},
+       {"utc_media_bookmark_foreach_bookmark_from_db_n",utc_media_bookmark_foreach_bookmark_from_db_n,utc_media_bookmark_startup,utc_media_bookmark_cleanup},
+       {"utc_media_bookmark_foreach_bookmark_from_db_p",utc_media_bookmark_foreach_bookmark_from_db_p,utc_media_bookmark_startup,utc_media_bookmark_cleanup},
        {"utc_media_bookmark_clone_n",utc_media_bookmark_clone_n,utc_media_bookmark_startup,utc_media_bookmark_cleanup},
        {"utc_media_bookmark_clone_p",utc_media_bookmark_clone_p,utc_media_bookmark_startup,utc_media_bookmark_cleanup},
        {"utc_media_bookmark_destroy_n",utc_media_bookmark_destroy_n,utc_media_bookmark_startup,utc_media_bookmark_cleanup},
@@ -711,6 +719,10 @@ testcase tc_array[] = {
        {"utc_media_face_update_to_db_n",utc_media_face_update_to_db_n,utc_media_face_startup,utc_media_face_cleanup},
        {"utc_media_face_delete_from_db_p",utc_media_face_delete_from_db_p,utc_media_face_startup,utc_media_face_cleanup},
        {"utc_media_face_delete_from_db_n",utc_media_face_delete_from_db_n,utc_media_face_startup,utc_media_face_cleanup},
+       {"utc_media_face_get_face_count_from_db_p",utc_media_face_get_face_count_from_db_p,utc_media_face_startup,utc_media_face_cleanup},
+       {"utc_media_face_get_face_count_from_db_n",utc_media_face_get_face_count_from_db_n,utc_media_face_startup,utc_media_face_cleanup},
+       {"utc_media_face_foreach_face_from_db_p",utc_media_face_foreach_face_from_db_p,utc_media_face_startup,utc_media_face_cleanup},
+       {"utc_media_face_foreach_face_from_db_n",utc_media_face_foreach_face_from_db_n,utc_media_face_startup,utc_media_face_cleanup},
        {"utc_media_filter_create_n",utc_media_filter_create_n,NULL,utc_media_filter_create_cleanup},
        {"utc_media_filter_create_p",utc_media_filter_create_p,NULL,utc_media_filter_create_cleanup},
        {"utc_media_filter_destroy_n",utc_media_filter_destroy_n,utc_media_filter_destroy_startup,utc_media_filter_destroy_cleanup},
index 5c2d611236e366fcc8813de8cbde3e45980c20dd..e24c0601fda79dadc008c4f107e56f10999d9e60 100755 (executable)
@@ -107,6 +107,8 @@ extern int utc_media_bookmark_insert_to_db_n(void);
 extern int utc_media_bookmark_insert_to_db_p(void);
 extern int utc_media_bookmark_get_bookmark_count_from_db_n(void);
 extern int utc_media_bookmark_get_bookmark_count_from_db_p(void);
+extern int utc_media_bookmark_foreach_bookmark_from_db_n(void);
+extern int utc_media_bookmark_foreach_bookmark_from_db_p(void);
 extern int utc_media_bookmark_clone_n(void);
 extern int utc_media_bookmark_clone_p(void);
 extern int utc_media_bookmark_destroy_n(void);
@@ -169,6 +171,10 @@ extern int utc_media_face_update_to_db_p(void);
 extern int utc_media_face_update_to_db_n(void);
 extern int utc_media_face_delete_from_db_p(void);
 extern int utc_media_face_delete_from_db_n(void);
+extern int utc_media_face_get_face_count_from_db_p(void);
+extern int utc_media_face_get_face_count_from_db_n(void);
+extern int utc_media_face_foreach_face_from_db_p(void);
+extern int utc_media_face_foreach_face_from_db_n(void);
 extern int utc_media_filter_create_n(void);
 extern int utc_media_filter_create_p(void);
 extern int utc_media_filter_destroy_n(void);
@@ -637,6 +643,8 @@ testcase tc_array[] = {
        {"utc_media_bookmark_insert_to_db_p",utc_media_bookmark_insert_to_db_p,utc_media_bookmark_insert_startup,utc_media_bookmark_insert_cleanup},
        {"utc_media_bookmark_get_bookmark_count_from_db_n",utc_media_bookmark_get_bookmark_count_from_db_n,utc_media_bookmark_startup,utc_media_bookmark_cleanup},
        {"utc_media_bookmark_get_bookmark_count_from_db_p",utc_media_bookmark_get_bookmark_count_from_db_p,utc_media_bookmark_startup,utc_media_bookmark_cleanup},
+       {"utc_media_bookmark_foreach_bookmark_from_db_n",utc_media_bookmark_foreach_bookmark_from_db_n,utc_media_bookmark_startup,utc_media_bookmark_cleanup},
+       {"utc_media_bookmark_foreach_bookmark_from_db_p",utc_media_bookmark_foreach_bookmark_from_db_p,utc_media_bookmark_startup,utc_media_bookmark_cleanup},
        {"utc_media_bookmark_clone_n",utc_media_bookmark_clone_n,utc_media_bookmark_startup,utc_media_bookmark_cleanup},
        {"utc_media_bookmark_clone_p",utc_media_bookmark_clone_p,utc_media_bookmark_startup,utc_media_bookmark_cleanup},
        {"utc_media_bookmark_destroy_n",utc_media_bookmark_destroy_n,utc_media_bookmark_startup,utc_media_bookmark_cleanup},
@@ -699,6 +707,10 @@ testcase tc_array[] = {
        {"utc_media_face_update_to_db_n",utc_media_face_update_to_db_n,utc_media_face_startup,utc_media_face_cleanup},
        {"utc_media_face_delete_from_db_p",utc_media_face_delete_from_db_p,utc_media_face_startup,utc_media_face_cleanup},
        {"utc_media_face_delete_from_db_n",utc_media_face_delete_from_db_n,utc_media_face_startup,utc_media_face_cleanup},
+       {"utc_media_face_get_face_count_from_db_p",utc_media_face_get_face_count_from_db_p,utc_media_face_startup,utc_media_face_cleanup},
+       {"utc_media_face_get_face_count_from_db_n",utc_media_face_get_face_count_from_db_n,utc_media_face_startup,utc_media_face_cleanup},
+       {"utc_media_face_foreach_face_from_db_p",utc_media_face_foreach_face_from_db_p,utc_media_face_startup,utc_media_face_cleanup},
+       {"utc_media_face_foreach_face_from_db_n",utc_media_face_foreach_face_from_db_n,utc_media_face_startup,utc_media_face_cleanup},
        {"utc_media_filter_create_n",utc_media_filter_create_n,NULL,utc_media_filter_create_cleanup},
        {"utc_media_filter_create_p",utc_media_filter_create_p,NULL,utc_media_filter_create_cleanup},
        {"utc_media_filter_destroy_n",utc_media_filter_destroy_n,utc_media_filter_destroy_startup,utc_media_filter_destroy_cleanup},
index fa9a8af052d5929c8ec438239db0ed06cf2f339d..4ea16d1fc2c5dfbd5e1c4fc9ade40495269735ba 100755 (executable)
@@ -88,6 +88,17 @@ static bool media_item_cb(media_info_h media, void *user_data)
 }
 
 
+static bool sub_bookmark_cb(media_bookmark_h bookmark, void *user_data)
+{
+       int bm_id = 0;
+
+       if (bookmark)
+               media_bookmark_get_bookmark_id(bookmark, &bm_id);
+
+       return false;
+}
+
+
 /**
  * @function           utc_media_bookmark_startup
  * @description                Called before each test
@@ -226,6 +237,43 @@ int utc_media_bookmark_get_bookmark_count_from_db_p(void)
 }
 
 
+/**
+ * @testcase           utc_media_bookmark_foreach_bookmark_from_db_n
+ * @since_tizen                4.0
+ * @description                Negative test case of media_bookmark_foreach_bookmark_from_db()
+ */
+int utc_media_bookmark_foreach_bookmark_from_db_n(void)
+{
+       assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
+
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+
+       ret = media_bookmark_foreach_bookmark_from_db(NULL, NULL, NULL);
+       assert_eq(ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_media_bookmark_foreach_bookmark_from_db_p
+ * @since_tizen                4.0
+ * @description                Positive test case of media_bookmark_foreach_bookmark_from_db()
+ */
+int utc_media_bookmark_foreach_bookmark_from_db_p(void)
+{
+       assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
+
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       int bookmark_count = 0;
+
+       ret = media_bookmark_foreach_bookmark_from_db(g_filter, sub_bookmark_cb, NULL);
+       assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
+
+       return 0;
+}
+
+
 /**
  * @testcase           utc_media_bookmark_clone_n
  * @since_tizen                2.3
index 96ec9d6a63752bfe483dcf5a1358671c66fca1f4..76b8ecf7e81b1ab0831d22ef8190b68473d32b93 100755 (executable)
@@ -64,6 +64,22 @@ static bool face_cb(media_face_h face, void *user_data)
        return false;
 }
 
+static bool sub_face_cb(media_face_h face, void *user_data)
+{
+       char *face_id = NULL;
+
+       if (face) {
+               media_face_get_face_id(face, &face_id);
+       }
+
+       if (face_id) {
+               free(face_id);
+               face_id = NULL;
+       }
+
+       return false;
+}
+
 static bool media_item_cb(media_info_h media, void *user_data)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
@@ -845,4 +861,74 @@ int utc_media_face_delete_from_db_n(void)
 
        return 0;
 }
+
+/**
+ * @testcase           utc_media_face_get_face_count_from_db_p
+ * @since_tizen                4.0
+ * @description                Positive test case of media_face_get_face_count_from_db()
+ */
+int utc_media_face_get_face_count_from_db_p(void)
+{
+       assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
+
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       int face_cnt = 0;
+
+       ret = media_face_get_face_count_from_db(NULL, &face_cnt);
+       assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
+
+       return 0;
+}
+
+/**
+ * @testcase           utc_media_face_get_face_count_from_db_n
+ * @since_tizen                4.0
+ * @description                Negative test case of media_face_get_face_count_from_db()
+ */
+int utc_media_face_get_face_count_from_db_n(void)
+{
+       assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
+
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+
+       ret = media_face_get_face_count_from_db(NULL, NULL);
+       assert_eq(ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+
+       return 0;
+}
+
+/**
+ * @testcase           utc_media_face_foreach_face_from_db_p
+ * @since_tizen                4.0
+ * @description                Positive test case of media_face_foreach_face_from_db()
+ */
+int utc_media_face_foreach_face_from_db_p(void)
+{
+       assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
+
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+
+       ret = media_face_foreach_face_from_db(NULL, sub_face_cb, NULL);
+       assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
+
+       return 0;
+}
+
+/**
+ * @testcase           utc_media_face_foreach_face_from_db_n
+ * @since_tizen                4.0
+ * @description                Negative test case of media_face_foreach_face_from_db()
+ */
+int utc_media_face_foreach_face_from_db_n(void)
+{
+       assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
+
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+
+       ret = media_face_foreach_face_from_db(NULL, NULL, NULL);
+       assert_eq(ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+
+       return 0;
+}
+
 #endif //COMMON_IOT