#include <media_content.h>
#include <tct_common.h>
#include <storage.h>
+#include <limits.h>
//& set: MediaFace
static media_face_h g_face_dst = NULL;
static char *g_media_id = NULL;
static char *g_face_id = NULL;
+static char g_image_path[PATH_MAX + 1] = { 0, };
+static int startup_ret = MEDIA_CONTENT_ERROR_NONE;
-static char *img_path = NULL;
-static const char *img_file = "image.jpg";
-
-static media_content_error_e startup_ret = MEDIA_CONTENT_ERROR_NONE;
-
-static bool __storage_device_supported_cb(int storage_id, storage_type_e type, storage_state_e state, const char *path, void *user_data)
+static bool __face_cb(media_face_h face, void *user_data)
{
- if (type == STORAGE_TYPE_INTERNAL) {
- img_path = (char *)malloc(strlen(path) + strlen(img_file) + 6);
- memset(img_path, 0x00, strlen(path) + strlen(img_file) + 6);
- snprintf(img_path, strlen(path) + strlen(img_file) + 6, "%s/res/%s", path, img_file);
+ if (media_face_clone(&g_face, face) != MEDIA_CONTENT_ERROR_NONE) {
+ FPRINTF("[Line : %d] media_face_clone failed.\\n", __LINE__);
return false;
}
- return true;
-}
-static bool face_cb(media_face_h face, void *user_data)
-{
- media_content_error_e ret = MEDIA_CONTENT_ERROR_NONE;
-
- ret = media_face_clone(&g_face, face);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- startup_ret = ret;
- return false;
- }
-
- ret = media_face_get_face_id(g_face, &g_face_id);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- startup_ret = ret;
+ if (media_face_get_face_id(g_face, &g_face_id) != MEDIA_CONTENT_ERROR_NONE) {
+ FPRINTF("[Line : %d] media_face_get_face_id failed.\\n", __LINE__);
return false;
}
return false;
}
-static bool sub_face_cb(media_face_h face, void *user_data)
+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;
-
- ret = media_info_get_media_id(media, &g_media_id);
- if ((ret != MEDIA_CONTENT_ERROR_NONE) || (g_media_id == NULL)) {
- return false;
- }
-
return false;
}
*/
void utc_media_face_startup(void)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- filter_h filter = NULL;
- char condition[50] = { 0, };
+ char *root_path = NULL;
+ media_info_h media = NULL;
- g_face = NULL;
- g_face_dst = NULL;
- g_media_id = NULL;
- g_face_id = NULL;
-
- if (storage_foreach_device_supported(__storage_device_supported_cb, NULL) != STORAGE_ERROR_NONE) {
- fprintf(stderr, "Startup error at %s:%d\n", __FILE__, __LINE__);
- fprintf(stderr, " media_content_connect failed (code: %d)\n", ret);
- startup_ret = ret;
- return;
+ if (storage_get_root_directory(0, &root_path) == STORAGE_ERROR_NONE) {
+ snprintf(g_image_path, PATH_MAX, "%s/res/image.jpg", root_path);
+ FREE_MEMORY(root_path);
}
- ret = media_content_connect();
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- fprintf(stderr, "Startup error at %s:%d\n", __FILE__, __LINE__);
- fprintf(stderr, "media_content_connect failed (code: %d)\n", ret);
- startup_ret = ret;
+ startup_ret = media_content_connect();
+ if (startup_ret != MEDIA_CONTENT_ERROR_NONE) {
+ FPRINTF("[Line : %d] media_content_connect failed.\\n", __LINE__);
return;
}
- ret = media_content_scan_file(img_path);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- startup_ret = ret;
- return;
+ startup_ret = media_info_get_media_from_db_by_path(g_image_path, &media);
+ if (startup_ret != MEDIA_CONTENT_ERROR_NONE) {
+ startup_ret = media_info_insert_to_db(g_image_path, &media);
+ if (startup_ret != MEDIA_CONTENT_ERROR_NONE) {
+ FPRINTF("[Line : %d] media_content_connect failed.\\n", __LINE__);
+ return;
+ }
}
- snprintf(condition, sizeof(condition), "MEDIA_DISPLAY_NAME='%s'", img_file);
-
- media_filter_create(&filter);
- media_filter_set_condition(filter, condition, MEDIA_CONTENT_COLLATE_DEFAULT);
- media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_DISPLAY_NAME, MEDIA_CONTENT_COLLATE_DEFAULT);
- if (filter == NULL) {
- fprintf(stderr, "Startup error at %s:%d\n", __FILE__, __LINE__);
- fprintf(stderr, " media_filter_create failed (code: %d)\n", ret);
- startup_ret = ret;
- return;
- }
-
- ret = media_info_foreach_media_from_db(filter, media_item_cb, NULL);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- fprintf(stderr, "Startup error at %s:%d\n", __FILE__, __LINE__);
- fprintf(stderr, " media_info_foreach_media_from_db failed (code: %d)\n", ret);
- startup_ret = ret;
+ startup_ret = media_info_get_media_id(media, &g_media_id);
+ media_info_destroy(media);
+ if (startup_ret != MEDIA_CONTENT_ERROR_NONE) {
+ FPRINTF("[Line : %d] media_info_get_media_id failed.\\n", __LINE__);
return;
}
- media_filter_destroy(filter);
- filter = NULL;
-
- ret = media_face_create(g_media_id, &g_face);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- fprintf(stderr, "Startup error at %s:%d\n", __FILE__, __LINE__);
- fprintf(stderr, " media_face_create failed (code: %d)\n", ret);
- startup_ret = ret;
+ startup_ret = media_face_create(g_media_id, &g_face);
+ if (startup_ret != MEDIA_CONTENT_ERROR_NONE) {
+ FPRINTF("[Line : %d] media_face_create failed.\\n", __LINE__);
return;
}
- ret = media_face_set_face_rect(g_face, 10, 10, 10, 10);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- fprintf(stderr, "Startup error at %s:%d\n", __FILE__, __LINE__);
- fprintf(stderr, " media_face_set_face_rect failed (code: %d)\n", ret);
- startup_ret = ret;
+ startup_ret = media_face_set_face_rect(g_face, 10, 10, 10, 10);
+ if (startup_ret != MEDIA_CONTENT_ERROR_NONE) {
+ FPRINTF("[Line : %d] media_face_set_face_rect failed.\\n", __LINE__);
return;
}
- ret = media_face_set_tag(g_face, "Test");
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- fprintf(stderr, "Startup error at %s:%d\n", __FILE__, __LINE__);
- fprintf(stderr, " media_face_set_tag failed (code: %d)\n", ret);
- startup_ret = ret;
+ startup_ret = media_face_set_tag(g_face, "Test");
+ if (startup_ret != MEDIA_CONTENT_ERROR_NONE) {
+ FPRINTF("[Line : %d] media_face_set_tag failed.\\n", __LINE__);
return;
}
- ret = media_face_insert_to_db(g_face);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- fprintf(stderr, "Startup error at %s:%d\n", __FILE__, __LINE__);
- fprintf(stderr, " media_face_insert_to_db failed (code: %d)\n", ret);
- startup_ret = ret;
+ startup_ret = media_face_insert_to_db(g_face);
+ if (startup_ret != MEDIA_CONTENT_ERROR_NONE) {
+ FPRINTF("[Line : %d] media_face_insert_to_db failed.\\n", __LINE__);
return;
}
- ret = media_face_destroy(g_face);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- fprintf(stderr, "Startup error at %s:%d\n", __FILE__, __LINE__);
- fprintf(stderr, " media_face_destroy failed (code: %d)\n", ret);
- startup_ret = ret;
+ startup_ret = media_face_destroy(g_face);
+ if (startup_ret != MEDIA_CONTENT_ERROR_NONE) {
+ FPRINTF("[Line : %d] media_face_destroy failed.\\n", __LINE__);
return;
}
- ret = media_info_foreach_face_from_db(g_media_id, NULL, face_cb, NULL);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- fprintf(stderr, "Startup error at %s:%d\n", __FILE__, __LINE__);
- fprintf(stderr, " media_info_foreach_face_from_db failed (code: %d)\n", ret);
- startup_ret = ret;
+ startup_ret = media_info_foreach_face_from_db(g_media_id, NULL, __face_cb, NULL);
+ if (startup_ret != MEDIA_CONTENT_ERROR_NONE) {
+ FPRINTF("[Line : %d] media_info_foreach_face_from_db failed.\\n", __LINE__);
return;
}
}
*/
void utc_media_face_cleanup(void)
{
- if (g_media_id) {
- free(g_media_id);
- g_media_id = NULL;
- }
+ FREE_MEMORY(g_media_id);
if (g_face_id) {
media_face_delete_from_db(g_face_id);
- free(g_face_id);
- g_face_id = NULL;
+ FREE_MEMORY(g_face_id);
}
if (g_face) {
g_face_dst = NULL;
}
- if (img_path) {
- free(img_path);
- img_path = NULL;
- }
+ memset(&g_image_path, 0, PATH_MAX + 1);
+
media_content_disconnect();
}
{
assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
- int ret = MEDIA_CONTENT_ERROR_NONE;
- char *face_id = NULL;
-
- ret = media_face_clone(&g_face_dst, g_face);
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
- media_face_get_face_id(g_face_dst, &face_id);
- if (strncmp(g_face_id, face_id, strlen(face_id)) == 0) {
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- ret = MEDIA_CONTENT_ERROR_INVALID_OPERATION;
- }
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
-
- if (face_id) {
- free(face_id);
- face_id = NULL;
- }
+ assert_eq(media_face_clone(&g_face_dst, g_face), MEDIA_CONTENT_ERROR_NONE);
return 0;
}
{
assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
- int ret = MEDIA_CONTENT_ERROR_NONE;
+ assert_eq(media_face_clone(&g_face_dst, NULL), MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = media_face_clone(&g_face_dst, NULL);
- assert_eq(ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ assert_eq(media_face_clone(NULL, g_face), MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
return 0;
}
{
assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- ret = media_face_clone(&g_face_dst, g_face);
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
+ assert_eq(media_face_clone(&g_face_dst, g_face), MEDIA_CONTENT_ERROR_NONE);
return 0;
}
{
assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- ret = media_face_destroy(NULL);
- assert_eq(ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ assert_eq(media_face_destroy(NULL), MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
return 0;
}
{
assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
- int ret = MEDIA_CONTENT_ERROR_NONE;
char *face_id = NULL;
- ret = media_face_get_face_id(g_face, &face_id);
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
-
- if (face_id) {
- free(face_id);
- face_id = NULL;
- }
+ assert_eq(media_face_get_face_id(g_face, &face_id), MEDIA_CONTENT_ERROR_NONE);
+ FREE_MEMORY(face_id);
return 0;
}
{
assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
- int ret = MEDIA_CONTENT_ERROR_NONE;
char *face_id = NULL;
- ret = media_face_get_face_id(NULL, &face_id);
- assert_eq(ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ assert_eq(media_face_get_face_id(NULL, &face_id), MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+
+ assert_eq(media_face_get_face_id(g_face, NULL), MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
return 0;
}
{
assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
- int ret = MEDIA_CONTENT_ERROR_NONE;
char *media_id = NULL;
- ret = media_face_get_media_id(g_face, &media_id);
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
-
- if (media_id) {
- free(media_id);
- media_id = NULL;
- }
+ assert_eq(media_face_get_media_id(g_face, &media_id), MEDIA_CONTENT_ERROR_NONE);
+ FREE_MEMORY(media_id);
return 0;
}
{
assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
- int ret = MEDIA_CONTENT_ERROR_NONE;
char *media_id = NULL;
- ret = media_face_get_media_id(NULL, &media_id);
- assert_eq(ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ assert_eq(media_face_get_media_id(NULL, &media_id), MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+
+ assert_eq(media_face_get_media_id(g_face, NULL), MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
return 0;
}
{
assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
- int ret = MEDIA_CONTENT_ERROR_NONE;
- unsigned int rect_x = -1;
- unsigned int rect_y = -1;
- unsigned int rect_w = -1;
- unsigned int rect_h = -1;
+ unsigned int rect_x = 0;
+ unsigned int rect_y = 0;
+ unsigned int rect_w = 0;
+ unsigned int rect_h = 0;
- ret = media_face_get_face_rect(g_face, &rect_x, &rect_y, &rect_w, &rect_h);
- if (rect_x <= 0 || rect_y <= 0 || rect_w <= 0 || rect_h <= 0)
- ret = MEDIA_CONTENT_ERROR_INVALID_OPERATION;
-
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
+ assert_eq(media_face_get_face_rect(g_face, &rect_x, &rect_y, &rect_w, &rect_h), MEDIA_CONTENT_ERROR_NONE);
+ assert_eq(rect_x, 10);
+ assert_eq(rect_y, 10);
+ assert_eq(rect_w, 10);
+ assert_eq(rect_h, 10);
return 0;
}
{
assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
- int ret = MEDIA_CONTENT_ERROR_NONE;
- unsigned int rect_x = -1;
- unsigned int rect_y = -1;
- unsigned int rect_w = -1;
- unsigned int rect_h = -1;
+ unsigned int rect_x = 0;
+ unsigned int rect_y = 0;
+ unsigned int rect_w = 0;
+ unsigned int rect_h = 0;
+
+ assert_eq(media_face_get_face_rect(NULL, &rect_x, &rect_y, &rect_w, &rect_h), MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+
+ assert_eq(media_face_get_face_rect(g_face, NULL, &rect_y, &rect_w, &rect_h), MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = media_face_get_face_rect(NULL, &rect_x, &rect_y, &rect_w, &rect_h);
- assert_eq(ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ assert_eq(media_face_get_face_rect(g_face, &rect_x, NULL, &rect_w, &rect_h), MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+
+ assert_eq(media_face_get_face_rect(g_face, &rect_x, &rect_y, NULL, &rect_h), MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+
+ assert_eq(media_face_get_face_rect(g_face, &rect_x, &rect_y, &rect_w, NULL), MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
return 0;
}
{
assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
- int ret = MEDIA_CONTENT_ERROR_NONE;
- media_content_orientation_e orient;
+ media_content_orientation_e orient = MEDIA_CONTENT_ORIENTATION_NOT_AVAILABLE;
- ret = media_face_get_orientation(g_face, &orient);
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
+ assert_eq(media_face_get_orientation(g_face, &orient), MEDIA_CONTENT_ERROR_NONE);
return 0;
}
{
assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
- int ret = MEDIA_CONTENT_ERROR_NONE;
- media_content_orientation_e orient;
+ media_content_orientation_e orient = MEDIA_CONTENT_ORIENTATION_NOT_AVAILABLE;
+
+ assert_eq(media_face_get_orientation(NULL, &orient), MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = media_face_get_orientation(NULL, &orient);
- assert_eq(ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ assert_eq(media_face_get_orientation(g_face, NULL), MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
return 0;
}
{
assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
- int ret = MEDIA_CONTENT_ERROR_NONE;
char *tag = NULL;
- ret = media_face_get_tag(g_face, &tag);
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
-
- if (tag) {
- free(tag);
- tag = NULL;
- }
+ assert_eq(media_face_get_tag(g_face, &tag), MEDIA_CONTENT_ERROR_NONE);
+ FREE_MEMORY(tag);
return 0;
}
{
assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
- int ret = MEDIA_CONTENT_ERROR_NONE;
char *tag = NULL;
- ret = media_face_get_tag(NULL, &tag);
- assert_eq(ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ assert_eq(media_face_get_tag(NULL, &tag), MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+
+ assert_eq(media_face_get_tag(g_face, NULL), MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
return 0;
}
{
assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- ret = media_face_create(g_media_id, &g_face_dst);
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
+ assert_eq(media_face_create(g_media_id, &g_face_dst), MEDIA_CONTENT_ERROR_NONE);
return 0;
}
{
assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
- int ret = MEDIA_CONTENT_ERROR_NONE;
+ assert_eq(media_face_create(NULL, &g_face_dst), MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = media_face_destroy(NULL);
- assert_eq(ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ assert_eq(media_face_create(g_face, NULL), MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
return 0;
}
-static bool _set_face_rect_cb(media_face_h face, void *user_data)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- unsigned int rect_x = -1;
- unsigned int rect_y = -1;
- unsigned int rect_w = -1;
- unsigned int rect_h = -1;
-
- ret = media_face_get_face_rect(g_face, &rect_x, &rect_y, &rect_w, &rect_h);
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
-
- if (rect_x != 20 || rect_y != 20 || rect_w != 20 || rect_h != 20) {
- ret = MEDIA_CONTENT_ERROR_INVALID_OPERATION;
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
- }
-
- return false;
-}
-
/**
* @testcase utc_media_face_set_face_rect_p
* @since_tizen 3.0
{
assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
- int ret = MEDIA_CONTENT_ERROR_NONE;
- ret = media_face_set_face_rect(g_face, 20, 20, 20, 20);
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
+ assert_eq(media_face_set_face_rect(g_face, 20, 20, 20, 20), MEDIA_CONTENT_ERROR_NONE);
- ret = media_face_update_to_db(g_face);
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
-
- ret = media_info_foreach_face_from_db(g_media_id, NULL, _set_face_rect_cb, NULL);
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
+ assert_eq(media_face_update_to_db(g_face), MEDIA_CONTENT_ERROR_NONE);
return 0;
}
{
assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- ret = media_face_set_face_rect(NULL, 20, 20, 20, 20);
- assert_eq(ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ assert_eq(media_face_set_face_rect(NULL, 20, 20, 20, 20), MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
return 0;
}
-static bool _set_orientation_cb(media_face_h face, void *user_data)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- media_content_orientation_e orient;
-
- ret = media_face_get_orientation(g_face, &orient);
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
-
- if (orient != MEDIA_CONTENT_ORIENTATION_NORMAL) {
- ret = MEDIA_CONTENT_ERROR_INVALID_OPERATION;
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
- }
-
- return false;
-}
-
/**
* @testcase utc_media_face_set_orientation_p
* @since_tizen 3.0
{
assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
- int ret = MEDIA_CONTENT_ERROR_NONE;
- ret = media_face_set_orientation(g_face, MEDIA_CONTENT_ORIENTATION_NORMAL);
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
-
- ret = media_face_update_to_db(g_face);
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
+ assert_eq(media_face_set_orientation(g_face, MEDIA_CONTENT_ORIENTATION_NORMAL), MEDIA_CONTENT_ERROR_NONE);
- ret = media_info_foreach_face_from_db(g_media_id, NULL, _set_orientation_cb, NULL);
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
+ assert_eq(media_face_update_to_db(g_face), MEDIA_CONTENT_ERROR_NONE);
return 0;
}
{
assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- ret = media_face_set_orientation(NULL, MEDIA_CONTENT_ORIENTATION_NORMAL);
- assert_eq(ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ assert_eq(media_face_set_orientation(NULL, MEDIA_CONTENT_ORIENTATION_NORMAL), MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
return 0;
}
-static bool _set_tag_cb(media_face_h face, void *user_data)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- char *tag = NULL;
-
- ret = media_face_get_tag(g_face, &tag);
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
-
- if (strncmp(tag, "new_tag", strlen("new_tag")) != 0) {
- ret = MEDIA_CONTENT_ERROR_INVALID_OPERATION;
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
- }
-
- return false;
-}
-
/**
* @testcase utc_media_face_set_tag_p
* @since_tizen 3.0
{
assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
- int ret = MEDIA_CONTENT_ERROR_NONE;
- ret = media_face_set_tag(g_face, "new_tag");
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
+ assert_eq(media_face_set_tag(g_face, "new_tag"), MEDIA_CONTENT_ERROR_NONE);
- ret = media_face_update_to_db(g_face);
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
-
- ret = media_info_foreach_face_from_db(g_media_id, NULL, _set_tag_cb, NULL);
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
+ assert_eq(media_face_update_to_db(g_face), MEDIA_CONTENT_ERROR_NONE);
return 0;
}
{
assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- ret = media_face_set_tag(NULL, "new_tag");
- assert_eq(ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ assert_eq(media_face_set_tag(NULL, "new_tag"), MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
return 0;
}
assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
char *face_id = NULL;
- int ret = MEDIA_CONTENT_ERROR_NONE;
- ret = media_face_clone(&g_face_dst, g_face);
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
-
- ret = media_face_set_face_rect(g_face_dst, 15, 15, 15, 15);
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
+ assert_eq(media_face_clone(&g_face_dst, g_face), MEDIA_CONTENT_ERROR_NONE);
- ret = media_face_insert_to_db(g_face_dst);
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
+ assert_eq(media_face_set_face_rect(g_face_dst, 15, 15, 15, 15), MEDIA_CONTENT_ERROR_NONE);
- ret = media_face_get_face_id(g_face_dst, &face_id);
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
+ assert_eq(media_face_insert_to_db(g_face_dst), MEDIA_CONTENT_ERROR_NONE);
- ret = media_face_delete_from_db(face_id);
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
+ assert_eq(media_face_get_face_id(g_face_dst, &face_id), MEDIA_CONTENT_ERROR_NONE);
- if (face_id) {
- free(face_id);
- face_id = NULL;
- }
+ assert_eq(media_face_delete_from_db(face_id), MEDIA_CONTENT_ERROR_NONE);
+ FREE_MEMORY(face_id);
return 0;
}
{
assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- ret = media_face_insert_to_db(NULL);
- assert_eq(ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ assert_eq(media_face_insert_to_db(NULL), MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
return 0;
}
{
assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
- int ret = MEDIA_CONTENT_ERROR_NONE;
- ret = media_face_update_to_db(g_face);
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
+ assert_eq(media_face_update_to_db(g_face), MEDIA_CONTENT_ERROR_NONE);
return 0;
}
{
assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- ret = media_face_update_to_db(NULL);
- assert_eq(ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ assert_eq(media_face_update_to_db(NULL), MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
return 0;
}
assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
char *face_id = NULL;
- int ret = MEDIA_CONTENT_ERROR_NONE;
- ret = media_face_clone(&g_face_dst, g_face);
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
+ assert_eq(media_face_clone(&g_face_dst, g_face), MEDIA_CONTENT_ERROR_NONE);
- ret = media_face_set_face_rect(g_face_dst, 15, 15, 15, 15);
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
+ assert_eq(media_face_set_face_rect(g_face_dst, 15, 15, 15, 15), MEDIA_CONTENT_ERROR_NONE);
- ret = media_face_insert_to_db(g_face_dst);
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
+ assert_eq(media_face_insert_to_db(g_face_dst), MEDIA_CONTENT_ERROR_NONE);
- ret = media_face_get_face_id(g_face_dst, &face_id);
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
+ assert_eq(media_face_get_face_id(g_face_dst, &face_id), MEDIA_CONTENT_ERROR_NONE);
- ret = media_face_delete_from_db(face_id);
- assert_eq(ret, MEDIA_CONTENT_ERROR_NONE);
-
- if (face_id) {
- free(face_id);
- face_id = NULL;
- }
+ assert_eq(media_face_delete_from_db(face_id), MEDIA_CONTENT_ERROR_NONE);
+ FREE_MEMORY(face_id);
return 0;
}
{
assert_eq(startup_ret, MEDIA_CONTENT_ERROR_NONE);
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- ret = media_face_delete_from_db(NULL);
- assert_eq(ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ assert_eq(media_face_delete_from_db(NULL), MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
return 0;
}
{
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);
+ assert_eq(media_face_get_face_count_from_db(NULL, &face_cnt), MEDIA_CONTENT_ERROR_NONE);
return 0;
}
{
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);
+ assert_eq(media_face_get_face_count_from_db(NULL, NULL), MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
return 0;
}
{
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);
+ assert_eq(media_face_foreach_face_from_db(NULL, __sub_face_cb, NULL), MEDIA_CONTENT_ERROR_NONE);
return 0;
}
{
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);
+ assert_eq(media_face_foreach_face_from_db(NULL, NULL, NULL), MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
return 0;
}