diff options
Diffstat (limited to 'TC/testcase/utc_social_calendar.c')
-rwxr-xr-x | TC/testcase/utc_social_calendar.c | 839 |
1 files changed, 839 insertions, 0 deletions
diff --git a/TC/testcase/utc_social_calendar.c b/TC/testcase/utc_social_calendar.c new file mode 100755 index 0000000..1adb42e --- /dev/null +++ b/TC/testcase/utc_social_calendar.c @@ -0,0 +1,839 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include <tet_api.h> +#include <social/calendar.h> + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +#define API_NAME_CALENDAR_CONNECT "calendar_connect" +#define API_NAME_CALENDAR_DISCONNECT "calendar_disconnect" +#define API_NAME_CALENDAR_ADD_DB_CHANGED_CB "calendar_add_db_changed_cb" +#define API_NAME_CALENDAR_FOREACH_TIMEZONE "calendar_foreach_timezone" +#define API_NAME_CALENDAR_FOREACH_CALENDAR_FROM_DB "calendar_foreach_calendar_book_from_db" +#define API_NAME_CALENDAR_BOOK_CREATE "calendar_book_create" +#define API_NAME_CALENDAR_BOOK_DESTROY "calendar_book_destroy" +#define API_NAME_CALENDAR_BOOK_INSERT_TO_DB "calendar_book_insert_to_db" +#define API_NAME_CALENDAR_BOOK_UPDATE_TO_DB "calendar_book_update_to_db" +#define API_NAME_CALENDAR_BOOK_DELETE_FROM_DB "calendar_book_delete_from_db" +#define API_NAME_CALENDAR_BOOK_GET_FROM_DB "calendar_book_get_from_db" +#define API_NAME_CALENDAR_BOOK_DELETE_ALL_BY_ACCOUNT "calendar_book_delete_all_by_account" +#define API_NAME_CALENDAR_BOOK_GET_DB_ID "calendar_book_get_db_id" +#define API_NAME_CALENDAR_BOOK_GET_IS_DEFAULT "calendar_book_get_is_default" +#define API_NAME_CALENDAR_BOOK_SET_NAME "calendar_book_set_name" +#define API_NAME_CALENDAR_BOOK_GET_NAME "calendar_book_get_name" +#define API_NAME_CALENDAR_BOOK_SET_IS_VISIBLE "calendar_book_set_is_visibile" +#define API_NAME_CALENDAR_BOOK_GET_IS_VISIBLE "calendar_book_get_is_visibile" +#define API_NAME_CALENDAR_BOOK_SET_COLOR "calendar_book_set_color" +#define API_NAME_CALENDAR_BOOK_GET_COLOR "calendar_book_get_color" +#define API_NAME_CALENDAR_BOOK_SET_ACCOUNT_DB_ID "calendar_book_set_account_db_id" +#define API_NAME_CALENDAR_BOOK_GET_ACCOUNT_DB_ID "calendar_book_get_account_db_id" +#define API_NAME_CALENDAR_BOOK_FREE_CALENDAR_BOOK_ARRAY "calendar_book_free_calendar_book_array" +#define API_NAME_CALENDAR_BOOK_GET_ALL_CALENDAR_BOOK "calendar_book_get_all_calendar_book" +#define API_NAME_CALENDAR_BOOK_SEARCH_CALENDAR_BOOK_BY_ACCOUNT "calendar_book_search_calendar_book_by_account" + +#define API_NAME_CALENDAR_ADD_DB_CHANGED_CB "calendar_add_db_changed_cb" +#define API_NAME_CALENDAR_REMOVE_DB_CHANGED_CB "calendar_remove_db_changed_cb" +#define API_NAME_CALENDAR_GET_DB_VERSION "calendar_get_db_version" + +#define API_NAME_CALENDAR_BOOK_UNSET_COLOR "calendar_book_unset_color" + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_social_calendar_calendar_connect_disconnect_p(void); +static void utc_social_calendar_calendar_set_unset_db_changed_cb_p(void); +static void utc_social_calendar_calendar_set_unset_db_changed_cb_n(void); +//static void utc_social_calendar_foreach_timezone_p(void); +//static void utc_social_calendar_foreach_timezone_n(void); +//static void utc_social_calendar_foreach_calendar_book_from_db_p(void); +//static void utc_social_calendar_foreach_calendar_book_from_db_n(void); +static void utc_social_calendar_book_create_p(void); +static void utc_social_calendar_book_create_n(void); +static void utc_social_calendar_book_destroy_p(void); +static void utc_social_calendar_book_destroy_n(void); +static void utc_social_calendar_book_insert_to_db_p(void); +static void utc_social_calendar_book_get_is_default_n(void); +static void utc_social_calendar_book_get_name_n(void); +static void utc_social_calendar_book_get_is_visible_n(void); +static void utc_social_calendar_book_get_color_n(void); +static void utc_social_calendar_book_get_account_db_id_n(void); +static void utc_social_calendar_book_get_all_calendar_book_n(void); +static void utc_social_calendar_book_search_calendar_book_by_account_n(void); +static void utc_social_calendar_book_free_calendar_book_array_n(void); + +static void utc_social_calendar_add_db_changed_cb_p(void); +static void utc_social_calendar_add_db_changed_cb_n(void); +static void utc_social_calendar_remove_db_changed_cb_p(void); +static void utc_social_calendar_remove_db_changed_cb_n(void); +static void utc_social_calendar_get_db_version_p(void); +static void utc_social_calendar_get_db_version_n(void); + +static void utc_social_calendar_book_unset_color_p(void); +static void utc_social_calendar_book_unset_color_n(void); + +struct tet_testlist tet_testlist[] = { + { utc_social_calendar_calendar_connect_disconnect_p, POSITIVE_TC_IDX }, + { utc_social_calendar_calendar_set_unset_db_changed_cb_p, POSITIVE_TC_IDX }, + { utc_social_calendar_calendar_set_unset_db_changed_cb_n, NEGATIVE_TC_IDX }, +// { utc_social_calendar_foreach_timezone_p, POSITIVE_TC_IDX }, // TOREM +// { utc_social_calendar_foreach_timezone_n, NEGATIVE_TC_IDX }, // TOREM +// { utc_social_calendar_foreach_calendar_book_from_db_p, POSITIVE_TC_IDX }, +// { utc_social_calendar_foreach_calendar_book_from_db_n, NEGATIVE_TC_IDX }, + { utc_social_calendar_book_create_p, POSITIVE_TC_IDX }, + { utc_social_calendar_book_create_n, NEGATIVE_TC_IDX }, + { utc_social_calendar_book_destroy_p, POSITIVE_TC_IDX }, + { utc_social_calendar_book_destroy_n, NEGATIVE_TC_IDX }, + { utc_social_calendar_book_insert_to_db_p, POSITIVE_TC_IDX }, + { utc_social_calendar_book_get_is_default_n, NEGATIVE_TC_IDX }, + { utc_social_calendar_book_get_name_n, NEGATIVE_TC_IDX }, + { utc_social_calendar_book_get_is_visible_n, NEGATIVE_TC_IDX }, + { utc_social_calendar_book_get_color_n, NEGATIVE_TC_IDX }, + { utc_social_calendar_book_get_account_db_id_n, NEGATIVE_TC_IDX }, + { utc_social_calendar_book_get_all_calendar_book_n, NEGATIVE_TC_IDX }, + { utc_social_calendar_book_search_calendar_book_by_account_n, NEGATIVE_TC_IDX }, + { utc_social_calendar_book_free_calendar_book_array_n, NEGATIVE_TC_IDX }, + + { utc_social_calendar_add_db_changed_cb_p, POSITIVE_TC_IDX }, + { utc_social_calendar_add_db_changed_cb_n, NEGATIVE_TC_IDX }, + { utc_social_calendar_remove_db_changed_cb_p, POSITIVE_TC_IDX }, + { utc_social_calendar_remove_db_changed_cb_n, NEGATIVE_TC_IDX }, + { utc_social_calendar_get_db_version_p, POSITIVE_TC_IDX }, + { utc_social_calendar_get_db_version_n, NEGATIVE_TC_IDX }, + + { utc_social_calendar_book_unset_color_p, POSITIVE_TC_IDX }, + { utc_social_calendar_book_unset_color_n, NEGATIVE_TC_IDX }, + + { NULL, 0 }, +}; + +static void startup(void) +{ + int ret; + ret = calendar_connect(); + if (ret < 0) + dts_message(__func__, "calendar_connect failed(%d)", ret); +} + +static void cleanup(void) +{ + int ret; + ret = calendar_disconnect(); + if (ret < 0) + dts_message(__func__, "calendar_disconnect failed(%d)", ret); +} + +void _calendar_db_changed_cb(void* user_date) +{ + +} + +static void utc_social_calendar_calendar_connect_disconnect_p(void) +{ + int ret = CALENDAR_ERROR_NONE; + if((ret = calendar_connect()) == CALENDAR_ERROR_NONE) { + if((ret = calendar_disconnect()) == CALENDAR_ERROR_NONE) { + dts_pass(API_NAME_CALENDAR_CONNECT); + } + else { + dts_message(API_NAME_CALENDAR_DISCONNECT, "Calendar : %d", ret); + dts_fail(API_NAME_CALENDAR_DISCONNECT); + } + } + else { + dts_message(API_NAME_CALENDAR_CONNECT, "Calendar : %d", ret); + dts_fail(API_NAME_CALENDAR_CONNECT); + } +} + +void changed_db_cb(void *user_data) +{ +} + +static void utc_social_calendar_calendar_set_unset_db_changed_cb_p(void) +{ + int ret = CALENDAR_ERROR_NONE; + char* api_name = API_NAME_CALENDAR_ADD_DB_CHANGED_CB; + calendar_connect(); + if((ret = calendar_add_db_changed_cb(changed_db_cb, CALENDAR_DB_CHANGED_CB_TYPE_CALENDAR_BOOK, NULL)) == CALENDAR_ERROR_NONE) { + if((ret = calendar_remove_db_changed_cb(changed_db_cb, CALENDAR_DB_CHANGED_CB_TYPE_CALENDAR_BOOK)) == CALENDAR_ERROR_NONE) { + calendar_disconnect(); + dts_pass(api_name); + } + } + else { + calendar_disconnect(); + dts_message(api_name, "Calendar : %d", ret); + dts_fail(api_name); + } +} + +static void utc_social_calendar_calendar_set_unset_db_changed_cb_n(void) +{ + int ret = CALENDAR_ERROR_NONE; + char* api_name = API_NAME_CALENDAR_ADD_DB_CHANGED_CB; + + if((ret = calendar_add_db_changed_cb(NULL, CALENDAR_DB_CHANGED_CB_TYPE_CALENDAR_BOOK, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) { + if((ret = calendar_remove_db_changed_cb(NULL, CALENDAR_DB_CHANGED_CB_TYPE_CALENDAR_BOOK)) == CALENDAR_ERROR_INVALID_PARAMETER) { + dts_pass(api_name); + } + } + else { + dts_message(api_name, "Calendar : %d", ret); + dts_fail(api_name); + } +} + +//bool dts_calendar_foreach_timezone_cb(calendar_foreach_timezone_s *timezone, void *user_data) +//{ +// return false; +//} +// +//static void utc_social_calendar_foreach_timezone_p(void) +//{ +// int ret = CALENDAR_ERROR_NONE; +// char* api_name = API_NAME_CALENDAR_FOREACH_TIMEZONE; +// if((ret = calendar_foreach_timezone(dts_calendar_foreach_timezone_cb, NULL)) == CALENDAR_ERROR_NONE) { +// dts_pass(api_name); +// } +// else { +// dts_message(api_name, "Calendar : %d", ret); +// dts_fail(api_name); +// } +//} +// +//static void utc_social_calendar_foreach_timezone_n(void) +//{ +// int ret = CALENDAR_ERROR_NONE; +// char* api_name = API_NAME_CALENDAR_FOREACH_TIMEZONE; +// if((ret = calendar_foreach_timezone(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) { +// dts_pass(api_name); +// } +// else { +// dts_message(api_name, "Calendar : %d", ret); +// dts_fail(api_name); +// } +//} + +bool dts_calendar_foreach_calendar_cb(calendar_query_calendar_book_s *calendar, void *user_data) +{ + return false; +} + +//static void utc_social_calendar_foreach_calendar_book_from_db_p(void) +//{ +// int ret = CALENDAR_ERROR_NONE; +// char* api_name = API_NAME_CALENDAR_FOREACH_CALENDAR_FROM_DB; +// +// bool success = false; +// +// calendar_connect(); +// if((ret = calendar_foreach_calendar_book_from_db(dts_calendar_foreach_calendar_cb, NULL)) == CALENDAR_ERROR_NONE) { +// success = true; +// } +// calendar_disconnect(); +// +// if(success == true) { +// dts_pass(api_name); +// } else { +// dts_message(api_name, "Calendar : %d", ret); +// dts_fail(api_name); +// } +//} +// +//static void utc_social_calendar_foreach_calendar_book_from_db_n(void) +//{ +// int ret = CALENDAR_ERROR_NONE; +// char* api_name = API_NAME_CALENDAR_FOREACH_CALENDAR_FROM_DB; +// +// bool success = false; +// +// if((ret = calendar_foreach_calendar_book_from_db(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) { +// +// success = true; +// } +// +// if(success == true) { +// dts_pass(api_name); +// } else { +// dts_message(api_name, "Calendar : %d", ret); +// dts_fail(api_name); +// } +//} + +static void utc_social_calendar_book_create_p(void) +{ + int ret = CALENDAR_ERROR_NONE; + char* api_name = API_NAME_CALENDAR_BOOK_CREATE; + + bool success = false; + + calendar_book_h calendar_book_h = NULL; + + if ((ret = calendar_book_create(&calendar_book_h)) == CALENDAR_ERROR_NONE) { + success = true; + } + + calendar_book_destroy(calendar_book_h); + + if(success == true) { + dts_pass(api_name); + } else { + dts_message(api_name, "Calendar : %d", ret); + dts_fail(api_name); + } +} + +static void utc_social_calendar_book_create_n(void) +{ + int ret = CALENDAR_ERROR_NONE; + char* api_name = API_NAME_CALENDAR_BOOK_CREATE; + + bool success = false; + + if((ret = calendar_event_create(NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) { + success = true; + } + + if(success == true) { + dts_pass(api_name); + } else { + dts_message(api_name, "Calendar : %d", ret); + dts_fail(api_name); + } +} + +static void utc_social_calendar_book_destroy_p(void) +{ + int ret = CALENDAR_ERROR_NONE; + char* api_name = API_NAME_CALENDAR_BOOK_DESTROY; + + bool success = false; + + calendar_book_h calendar_book_h = NULL; + + calendar_book_create(&calendar_book_h); + + if((ret = calendar_book_destroy(calendar_book_h)) == CALENDAR_ERROR_NONE) { + success = true; + } + + if(success == true) { + dts_pass(api_name); + } else { + dts_message(api_name, "Calendar : %d", ret); + dts_fail(api_name); + } +} + +static void utc_social_calendar_book_destroy_n(void) +{ + int ret = CALENDAR_ERROR_NONE; + char* api_name = API_NAME_CALENDAR_BOOK_DESTROY; + + bool success = false; + + if((ret = calendar_book_destroy(NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) { + success = true; + } + + if(success == true) { + dts_pass(api_name); + } else { + dts_message(api_name, "Calendar : %d", ret); + dts_fail(api_name); + } +} + +static void utc_social_calendar_book_insert_to_db_p(void) +{ + int ret = CALENDAR_ERROR_NONE; + char *api = API_NAME_CALENDAR_BOOK_INSERT_TO_DB; + calendar_book_h calbook; + + int calbook_id; + int acc_id = 3; + unsigned char red = 5; + unsigned char green = 5; + unsigned char blue = 5; + bool is_default; + bool is_visible = true; + char *name = "Test Name"; + + ret = calendar_book_create(&calbook); + if (ret < 0) { + dts_message(api, "calendar_book_create failed(%d)", ret); + dts_fail(api); + return; + } + + ret = calendar_book_set_name(calbook, name); + if (ret < 0) { + dts_message(api, "calendar_book_set_name failed(%d)", ret); + calendar_book_destroy(calbook); + dts_fail(api); + return; + } + + ret = calendar_book_set_is_visible(calbook, is_visible); + if (ret < 0) { + dts_message(api, "calendar_book_set_is_visible failed(%d)", ret); + calendar_book_destroy(calbook); + dts_fail(api); + return; + } + + ret = calendar_book_set_color(calbook, red, blue, green); + if (ret < 0) { + dts_message(api, "calendar_book_set_color failed(%d)", ret); + calendar_book_destroy(calbook); + dts_fail(api); + return; + } + + ret = calendar_book_set_account_db_id(calbook, acc_id); + if (ret < 0) { + dts_message(api, "calendar_book_set_account_db_id failed(%d)", ret); + calendar_book_destroy(calbook); + dts_fail(api); + return; + } + + ret = calendar_book_insert_to_db(calbook, &calbook_id); + if (ret < 0) { + dts_message(api, "calendar_book_set_account_db_id failed(%d)", ret); + calendar_book_destroy(calbook); + dts_fail(api); + return; + } + + ret = calendar_book_destroy(calbook); + if (ret < 0) { + dts_message(api, "calendar_book_set_account_db_id failed(%d)", ret); + dts_fail(api); + return; + } + + ret = calendar_book_create(&calbook); + if (ret < 0) { + dts_message(api, "calendar_book_create failed(%d)", ret); + dts_fail(api); + return; + } + + ret = calendar_book_get_from_db(calbook_id, &calbook); + if (ret < 0) { + dts_message(api, "calendar_book_get_from_db failed(%d)", ret); + calendar_book_destroy(calbook); + dts_fail(api); + return; + } + + ret = calendar_book_get_db_id(calbook, &calbook_id); + if (ret < 0) { + dts_message(api, "calendar_book_get_db_id failed(%d)", ret); + calendar_book_destroy(calbook); + dts_fail(api); + return; + } + + ret = calendar_book_get_is_default(calbook, &is_default); + if (ret < 0) { + dts_message(api, "calendar_book_get_is_default failed(%d)", ret); + calendar_book_destroy(calbook); + dts_fail(api); + return; + } + + ret = calendar_book_get_color(calbook, &red, &green, &blue); + if (ret < 0) { + dts_message(api, "calendar_book_get_is_color failed(%d)", ret); + calendar_book_destroy(calbook); + dts_fail(api); + return; + } + + ret = calendar_book_get_is_visible(calbook, &is_visible); + if (ret < 0) { + dts_message(api, "calendar_book_get_is_visible failed(%d)", ret); + calendar_book_destroy(calbook); + dts_fail(api); + return; + } + + ret = calendar_book_get_account_db_id(calbook, &acc_id); + if (ret < 0) { + dts_message(api, "calendar_book_get_account_db_id failed(%d)", ret); + calendar_book_destroy(calbook); + dts_fail(api); + return; + } + + ret = calendar_book_get_is_default(calbook, &is_default); + if (ret < 0) { + dts_message(api, "calendar_book_get_is_default failed(%d)", ret); + calendar_book_destroy(calbook); + dts_fail(api); + return; + } + + ret = calendar_book_get_name(calbook, &name); + if (ret < 0) { + dts_message(api, "calendar_book_get_name failed(%d)", ret); + calendar_book_destroy(calbook); + dts_fail(api); + return; + } + + ret = calendar_book_destroy(calbook); + if (ret < 0) { + dts_message(api, "calendar_book_destroy failed(%d)", ret); + free(name); + dts_fail(api); + return; + } + + int len; + calendar_book_h *calbook_array; + + ret = calendar_book_get_all_calendar_book(&calbook_array, &len); + if (ret < 0) { + dts_message(api, "calendar_book_get_all_calendar_book failed(%d)", ret); + dts_fail(api); + } + + ret = calendar_book_free_calendar_book_array(calbook_array); + if (ret < 0) { + dts_message(api, "calendar_book_free_calendar_book_array failed(%d)", ret); + dts_fail(api); + } + + ret = calendar_book_delete_from_db(calbook_id); + if (ret < 0) { + dts_message(api, "calendar_book_delete_from_db failed(%d)", ret); + dts_fail(api); + } + + dts_pass(api); +} + +static void utc_social_calendar_book_get_is_default_n(void) +{ + int ret = CALENDAR_ERROR_NONE; + char* api_name = API_NAME_CALENDAR_BOOK_GET_IS_DEFAULT; + + bool success = false; + + if((ret = calendar_book_get_is_default(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) { + success = true; + } + + if(success == true) { + dts_pass(api_name); + } else { + dts_message(api_name, "Calendar : %d", ret); + dts_fail(api_name); + } +} + +static void utc_social_calendar_book_get_name_n(void) +{ + int ret = CALENDAR_ERROR_NONE; + char* api_name = API_NAME_CALENDAR_BOOK_GET_NAME; + + bool success = false; + + if((ret = calendar_book_get_name(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) { + success = true; + } + if(success == true) { + dts_pass(api_name); + } else { + dts_message(api_name, "Calendar : %d", ret); + dts_fail(api_name); + } +} + +static void utc_social_calendar_book_get_is_visible_n(void) +{ + int ret = CALENDAR_ERROR_NONE; + char* api_name = API_NAME_CALENDAR_BOOK_GET_IS_VISIBLE; + + bool success = false; + + if((ret = calendar_book_get_is_visible(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) { + success = true; + } + + if(success == true) { + dts_pass(api_name); + } else { + dts_message(api_name, "Calendar : %d", ret); + dts_fail(api_name); + } +} + +static void utc_social_calendar_book_get_color_n(void) +{ + int ret = CALENDAR_ERROR_NONE; + char* api_name = API_NAME_CALENDAR_BOOK_GET_COLOR; + + bool success = false; + + if((ret = calendar_book_get_color(NULL, NULL, NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) { + success = true; + } + + if(success == true) { + dts_pass(api_name); + } else { + dts_message(api_name, "Calendar : %d", ret); + dts_fail(api_name); + } +} + +static void utc_social_calendar_book_get_account_db_id_n(void) +{ + int ret = CALENDAR_ERROR_NONE; + char* api_name = API_NAME_CALENDAR_BOOK_GET_ACCOUNT_DB_ID; + + bool success = false; + + if((ret = calendar_book_get_account_db_id(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) { + success = true; + } + + if(success == true) { + dts_pass(api_name); + } else { + dts_message(api_name, "Calendar : %d", ret); + dts_fail(api_name); + } +} + +static void utc_social_calendar_book_free_calendar_book_array_n(void) +{ + char* api_name = API_NAME_CALENDAR_BOOK_FREE_CALENDAR_BOOK_ARRAY; + int error; + + if ((error = calendar_book_free_calendar_book_array(NULL)) + != CALENDAR_ERROR_INVALID_PARAMETER) { + dts_message(api_name, "Error: %d", error); + dts_fail(api_name); + return; + } + + dts_pass(api_name); +} + +static void utc_social_calendar_book_get_all_calendar_book_n(void) +{ + char* api_name = API_NAME_CALENDAR_BOOK_GET_ALL_CALENDAR_BOOK; + + int error; + calendar_book_h *calendar_book_array = NULL; + int length; + if ((error = calendar_book_get_all_calendar_book(NULL, &length)) + != CALENDAR_ERROR_INVALID_PARAMETER) { + dts_message(api_name, "Error : %d", error); + dts_fail(api_name); + return; + } + + if ((error = calendar_book_get_all_calendar_book(&calendar_book_array, NULL)) + != CALENDAR_ERROR_INVALID_PARAMETER) { + dts_message(api_name, "Error : %d", error); + dts_fail(api_name); + return; + } + + dts_pass(api_name); +} + +static void utc_social_calendar_book_search_calendar_book_by_account_n(void) +{ + char* api_name = API_NAME_CALENDAR_BOOK_SEARCH_CALENDAR_BOOK_BY_ACCOUNT; + + int error; + calendar_book_h *calendar_book_array = NULL; + int length; + if ((error = calendar_book_get_all_calendar_book(NULL, &length)) + != CALENDAR_ERROR_INVALID_PARAMETER) { + dts_message(api_name, "Error : %d", error); + dts_fail(api_name); + return; + } + + if ((error = calendar_book_search_calendar_book_by_account(-1, &calendar_book_array, NULL)) + != CALENDAR_ERROR_INVALID_PARAMETER) { + dts_message(api_name, "Error : %d", error); + dts_fail(api_name); + return; + } + + dts_pass(api_name); +} + +static void utc_social_calendar_add_db_changed_cb_p(void) +{ + int ret = CALENDAR_ERROR_NONE; + bool pass = false; + + if ((ret = calendar_add_db_changed_cb(_calendar_db_changed_cb, + CALENDAR_DB_CHANGED_CB_TYPE_CALENDAR_BOOK, (void*)123)) + == CALENDAR_ERROR_NONE) { + pass = true; + } + + if (pass) { + dts_pass(API_NAME_CALENDAR_ADD_DB_CHANGED_CB); + } else { + dts_message(API_NAME_CALENDAR_ADD_DB_CHANGED_CB, "Calendar : %d", ret); + dts_fail(API_NAME_CALENDAR_ADD_DB_CHANGED_CB); + } +} + +static void utc_social_calendar_add_db_changed_cb_n(void) +{ + int ret = CALENDAR_ERROR_NONE; + bool pass = false; + + if ((ret = calendar_add_db_changed_cb(NULL, + CALENDAR_DB_CHANGED_CB_TYPE_CALENDAR_BOOK, (void*)123)) + == CALENDAR_ERROR_INVALID_PARAMETER) { + pass = true; + } + + if (pass) { + dts_pass(API_NAME_CALENDAR_ADD_DB_CHANGED_CB); + } else { + dts_message(API_NAME_CALENDAR_ADD_DB_CHANGED_CB, "Calendar : %d", ret); + dts_fail(API_NAME_CALENDAR_ADD_DB_CHANGED_CB); + } +} + +static void utc_social_calendar_remove_db_changed_cb_p(void) +{ + int ret = CALENDAR_ERROR_NONE; + bool pass = false; + + if ((ret = calendar_remove_db_changed_cb(_calendar_db_changed_cb, CALENDAR_DB_CHANGED_CB_TYPE_CALENDAR_BOOK)) == CALENDAR_ERROR_NONE) { + pass = true; + } + + if (pass) { + dts_pass(API_NAME_CALENDAR_REMOVE_DB_CHANGED_CB); + } else { + dts_message(API_NAME_CALENDAR_REMOVE_DB_CHANGED_CB, "Calendar : %d", ret); + dts_fail(API_NAME_CALENDAR_REMOVE_DB_CHANGED_CB); + } +} + +static void utc_social_calendar_remove_db_changed_cb_n(void) +{ + int ret = CALENDAR_ERROR_NONE; + bool pass = false; + + if ((ret = calendar_remove_db_changed_cb(NULL, CALENDAR_DB_CHANGED_CB_TYPE_CALENDAR_BOOK)) == CALENDAR_ERROR_INVALID_PARAMETER) { + pass = true; + } + + if (pass) { + dts_pass(API_NAME_CALENDAR_REMOVE_DB_CHANGED_CB); + } else { + dts_message(API_NAME_CALENDAR_REMOVE_DB_CHANGED_CB, "Calendar : %d", ret); + dts_fail(API_NAME_CALENDAR_REMOVE_DB_CHANGED_CB); + } +} + +static void utc_social_calendar_get_db_version_p(void) +{ + int ret = CALENDAR_ERROR_NONE; + bool pass = false; + int db_version; + + if ((ret = calendar_get_db_version(&db_version)) == CALENDAR_ERROR_NONE) { + pass = true; + } + + if (pass) { + dts_pass(API_NAME_CALENDAR_GET_DB_VERSION); + } else { + dts_message(API_NAME_CALENDAR_GET_DB_VERSION, "Calendar : %d", ret); + dts_fail(API_NAME_CALENDAR_GET_DB_VERSION); + } +} + +static void utc_social_calendar_get_db_version_n(void) +{ + int ret = CALENDAR_ERROR_NONE; + bool pass = false; + + if ((ret = calendar_get_db_version(NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) { + pass = true; + } + + if (pass) { + dts_pass(API_NAME_CALENDAR_GET_DB_VERSION); + } else { + dts_message(API_NAME_CALENDAR_GET_DB_VERSION, "Calendar : %d", ret); + dts_fail(API_NAME_CALENDAR_GET_DB_VERSION); + } +} + +static void utc_social_calendar_book_unset_color_p(void) +{ + int ret = CALENDAR_ERROR_NONE; + bool pass = false; + + calendar_book_h calendar_book = NULL; + calendar_book_create(&calendar_book); + + if ((ret = calendar_book_unset_color(calendar_book)) == CALENDAR_ERROR_NONE) { + pass = true; + } + + if (pass) { + dts_pass(API_NAME_CALENDAR_BOOK_UNSET_COLOR); + } else { + dts_message(API_NAME_CALENDAR_BOOK_UNSET_COLOR, "Calendar : %d", ret); + dts_fail(API_NAME_CALENDAR_BOOK_UNSET_COLOR); + } +} + +static void utc_social_calendar_book_unset_color_n(void) +{ + int ret = CALENDAR_ERROR_NONE; + bool pass = false; + + if ((ret = calendar_book_unset_color(NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) { + pass = true; + } + + if (pass) { + dts_pass(API_NAME_CALENDAR_BOOK_UNSET_COLOR); + } else { + dts_message(API_NAME_CALENDAR_BOOK_UNSET_COLOR, "Calendar : %d", ret); + dts_fail(API_NAME_CALENDAR_BOOK_UNSET_COLOR); + } +} |