summaryrefslogtreecommitdiff
path: root/TC
diff options
context:
space:
mode:
Diffstat (limited to 'TC')
-rwxr-xr-xTC/_export_env.sh8
-rwxr-xr-xTC/_export_target_env.sh7
-rwxr-xr-xTC/build.sh16
-rwxr-xr-xTC/clean.sh11
-rwxr-xr-xTC/config.default2
-rwxr-xr-xTC/execute.sh17
-rwxr-xr-xTC/testcase/Makefile25
-rwxr-xr-xTC/testcase/tslist5
-rwxr-xr-xTC/testcase/utc_social_calendar.c839
-rwxr-xr-xTC/testcase/utc_social_calendar_attendee.c292
-rwxr-xr-xTC/testcase/utc_social_calendar_event.c2459
-rwxr-xr-xTC/testcase/utc_social_calendar_todo.c1385
-rwxr-xr-xTC/tet_scen7
-rwxr-xr-xTC/tetbuild.cfg5
-rwxr-xr-xTC/tetclean.cfg5
-rwxr-xr-xTC/tetexec.cfg5
16 files changed, 5088 insertions, 0 deletions
diff --git a/TC/_export_env.sh b/TC/_export_env.sh
new file mode 100755
index 0000000..72a11ec
--- /dev/null
+++ b/TC/_export_env.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+. ./config
+export TET_INSTALL_PATH=$TET_INSTALL_HOST_PATH # tetware root path
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target # tetware target path
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export TET_ROOT=$TET_TARGET_PATH
diff --git a/TC/_export_target_env.sh b/TC/_export_target_env.sh
new file mode 100755
index 0000000..5ddaa53
--- /dev/null
+++ b/TC/_export_target_env.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+. ./config
+export TET_INSTALL_PATH=$TET_INSTALL_TARGET_PATH # path to path
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export TET_ROOT=$TET_TARGET_PATH
diff --git a/TC/build.sh b/TC/build.sh
new file mode 100755
index 0000000..6be8d56
--- /dev/null
+++ b/TC/build.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+. ./_export_env.sh # setting environment variables
+
+export TET_SUITE_ROOT=`pwd`
+FILE_NAME_EXTENSION=`date +%s`
+
+RESULT_DIR=results
+HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -c -p ./
+tcc -b -j $JOURNAL_RESULT -p ./
+grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT \ No newline at end of file
diff --git a/TC/clean.sh b/TC/clean.sh
new file mode 100755
index 0000000..29743e0
--- /dev/null
+++ b/TC/clean.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+. ./_export_env.sh # setting environment variables
+
+export TET_SUITE_ROOT=`pwd`
+RESULT_DIR=results
+
+tcc -c -p ./ # executing tcc, with clean option (-c)
+rm -r $RESULT_DIR
+rm -r tet_tmp_dir
+rm testcase/tet_captured
diff --git a/TC/config.default b/TC/config.default
new file mode 100755
index 0000000..04684f0
--- /dev/null
+++ b/TC/config.default
@@ -0,0 +1,2 @@
+TET_INSTALL_HOST_PATH=/home/rookiejava/dts_tool/TETware
+TET_INSTALL_TARGET_PATH=/mnt/nfs/dts_tool/TETware
diff --git a/TC/execute.sh b/TC/execute.sh
new file mode 100755
index 0000000..215ad6c
--- /dev/null
+++ b/TC/execute.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+. ./_export_target_env.sh # setting environment variables
+
+export TET_SUITE_ROOT=`pwd`
+FILE_NAME_EXTENSION=`date +%s`
+
+RESULT_DIR=results
+HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -e -j $JOURNAL_RESULT -p ./
+#grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
+grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
+
diff --git a/TC/testcase/Makefile b/TC/testcase/Makefile
new file mode 100755
index 0000000..f5aa3fb
--- /dev/null
+++ b/TC/testcase/Makefile
@@ -0,0 +1,25 @@
+CC ?= gcc
+
+C_FILES = $(shell ls *.c)
+
+PKGS = capi-social-calendar dlog glib-2.0 capi-social-contacts
+
+LDFLAGS = `pkg-config --libs $(PKGS)`
+LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o
+LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s
+LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s
+
+CFLAGS = -I. `pkg-config --cflags $(PKGS)`
+CFLAGS += -I$(TET_ROOT)/inc/tet3
+CFLAGS += -Wall
+
+#TARGETS = $(C_FILES:%.c=tc-%)
+TCS := $(shell ls -1 *.c | cut -d. -f1)
+
+all: $(TCS)
+
+%: %.c
+ $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS)
+
+clean:
+ rm -f $(TCS)
diff --git a/TC/testcase/tslist b/TC/testcase/tslist
new file mode 100755
index 0000000..1c3dbde
--- /dev/null
+++ b/TC/testcase/tslist
@@ -0,0 +1,5 @@
+/testcase/utc_social_calendar
+/testcase/utc_social_calendar_attendee
+/testcase/utc_social_calendar_event
+/testcase/utc_social_calendar_todo
+
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);
+ }
+}
diff --git a/TC/testcase/utc_social_calendar_attendee.c b/TC/testcase/utc_social_calendar_attendee.c
new file mode 100755
index 0000000..b57d490
--- /dev/null
+++ b/TC/testcase/utc_social_calendar_attendee.c
@@ -0,0 +1,292 @@
+/*
+ * 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_ATTENDEE_GET_NAME "calendar_attendee_get_name"
+#define API_NAME_CALENDAR_ATTENDEE_SET_NAME "calendar_attendee_set_name"
+#define API_NAME_CALENDAR_ATTENDEE_GET_EMAIL "calendar_attendee_get_email"
+#define API_NAME_CALENDAR_ATTENDEE_SET_EMAIL "calendar_attendee_set_email"
+#define API_NAME_CALENDAR_ATTENDEE_ITERATOR_NEXT "calendar_attendee_iterator_next"
+#define API_NAME_CALENDAR_ATTENDEE_GET_CONTACT_DB_ID "calendar_attendee_get_contact_db_id"
+#define API_NAME_CALENDAR_ATTENDEE_GET_PHONE_NUMBER "calendar_attendee_get_phone_number"
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_social_calendar_calendar_attendee_get_set_name_p(void);
+static void utc_social_calendar_calendar_attendee_get_set_name_n(void);
+static void utc_social_calendar_calendar_attendee_get_set_email_p(void);
+static void utc_social_calendar_calendar_attendee_get_set_email_n(void);
+static void utc_social_calendar_calendar_attendee_iterator_next_has_next_p(void);
+static void utc_social_calendar_calendar_attendee_iterator_next_has_next_n(void);
+static void utc_social_calendar_calendar_attendee_get_contact_db_id_p(void);
+static void utc_social_calendar_calendar_attendee_get_contact_db_id_n(void);
+static void utc_social_calendar_calendar_attendee_get_phone_number_p(void);
+static void utc_social_calendar_calendar_attendee_get_phone_number_n(void);
+
+struct tet_testlist tet_testlist[] = {
+ { utc_social_calendar_calendar_attendee_get_set_name_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_attendee_get_set_name_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_attendee_get_set_email_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_attendee_get_set_email_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_attendee_iterator_next_has_next_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_attendee_iterator_next_has_next_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_attendee_get_contact_db_id_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_attendee_get_contact_db_id_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_attendee_get_phone_number_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_attendee_get_phone_number_n, NEGATIVE_TC_IDX },
+
+ { NULL, 0 },
+};
+
+static void startup(void)
+{
+ /* start of TC */
+}
+
+static void cleanup(void)
+{
+ /* end of TC */
+}
+
+static void utc_social_calendar_calendar_attendee_get_set_name_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_ATTENDEE_GET_NAME;
+ bool success = false;
+ char* name = NULL;
+
+ calendar_attendee_h attendee = NULL;
+ calendar_event_h event = NULL;
+ if(calendar_event_create(&event) == CALENDAR_ERROR_NONE) {
+ if(calendar_event_add_attendee(event, &attendee) == CALENDAR_ERROR_NONE){
+ if((ret = calendar_attendee_set_name(attendee, "name")) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_attendee_get_name(attendee, &name)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+ }
+ }
+
+ if(name != NULL) {
+ free(name);
+ }
+ calendar_event_destroy(event);
+ if(success == true) {
+ dts_pass(api_name);
+ }
+ else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_attendee_get_set_name_n(void)
+{
+ if(calendar_attendee_set_name(NULL, NULL) == CALENDAR_ERROR_INVALID_PARAMETER
+ && calendar_attendee_get_name(NULL, NULL) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ dts_pass(API_NAME_CALENDAR_ATTENDEE_GET_NAME);
+ }
+ dts_fail(API_NAME_CALENDAR_ATTENDEE_GET_NAME);
+}
+
+static void utc_social_calendar_calendar_attendee_get_set_email_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_ATTENDEE_GET_EMAIL;
+ bool success = false;
+ char* email = NULL;
+
+ calendar_attendee_h attendee = NULL;
+ calendar_event_h event = NULL;
+ if(calendar_event_create(&event) == CALENDAR_ERROR_NONE) {
+ if(calendar_event_add_attendee(event, &attendee) == CALENDAR_ERROR_NONE){
+ if((ret = calendar_attendee_set_email(attendee, "test@test.com")) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_attendee_get_email(attendee, &email)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+ }
+ }
+
+ if(email != NULL) {
+ free(email);
+ }
+ calendar_event_destroy(event);
+ if(success == true) {
+ dts_pass(api_name);
+ }
+ else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_attendee_get_set_email_n(void)
+{
+ if(calendar_attendee_set_email(NULL, NULL) == CALENDAR_ERROR_INVALID_PARAMETER
+ && calendar_attendee_get_email(NULL, NULL) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ dts_pass(API_NAME_CALENDAR_ATTENDEE_GET_EMAIL);
+ }
+ dts_fail(API_NAME_CALENDAR_ATTENDEE_GET_EMAIL);
+}
+
+static void utc_social_calendar_calendar_attendee_iterator_next_has_next_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_ATTENDEE_ITERATOR_NEXT;
+ bool success = false;
+
+ calendar_attendee_h attendee = NULL;
+ calendar_attendee_h attendee_r = NULL;
+ calendar_attendee_iterator_h iterator = NULL;
+ calendar_event_h event = NULL;
+
+ if(calendar_event_create(&event) == CALENDAR_ERROR_NONE) {
+ if(calendar_event_add_attendee(event, &attendee) == CALENDAR_ERROR_NONE){
+ calendar_event_set_subject(event, "subject");
+ calendar_attendee_set_name(attendee, "name");
+ if((ret = calendar_event_get_attendee_iterator(event, &iterator)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_attendee_iterator_has_next(iterator)) == true) {
+ if((ret = calendar_attendee_iterator_next(&iterator, &attendee_r)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+ }
+ }
+ }
+
+ calendar_event_destroy(event);
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_attendee_iterator_next_has_next_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_ATTENDEE_ITERATOR_NEXT;
+ bool success = false;
+ if((ret = calendar_attendee_iterator_has_next(NULL)) == false) {
+ if((ret = calendar_attendee_iterator_next(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_calendar_attendee_get_contact_db_id_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_ATTENDEE_GET_CONTACT_DB_ID;
+ bool success = false;
+
+ int id = 0;
+ calendar_attendee_h attendee = NULL;
+ calendar_event_h event = NULL;
+ if(calendar_event_create(&event) == CALENDAR_ERROR_NONE) {
+ if(calendar_event_add_attendee(event, &attendee) == CALENDAR_ERROR_NONE){
+ if((ret = calendar_attendee_set_contact_db_id(attendee, 1)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_attendee_get_contact_db_id(attendee, &id)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+ }
+ }
+
+ calendar_event_destroy(event);
+ if(success == true) {
+ dts_pass(api_name);
+ }
+ else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_attendee_get_contact_db_id_n(void)
+{
+ char* api_name = API_NAME_CALENDAR_ATTENDEE_GET_CONTACT_DB_ID;
+ if(calendar_attendee_get_contact_db_id(NULL, NULL) == CALENDAR_ERROR_INVALID_PARAMETER
+ && calendar_attendee_set_contact_db_id(NULL, -1) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ dts_pass(api_name);
+ }
+ dts_fail(api_name);
+}
+
+static void utc_social_calendar_calendar_attendee_get_phone_number_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_ATTENDEE_GET_PHONE_NUMBER;
+ bool success = false;
+
+ char* phone_number = NULL;
+ calendar_attendee_h attendee = NULL;
+ calendar_event_h event = NULL;
+ if(calendar_event_create(&event) == CALENDAR_ERROR_NONE) {
+ if(calendar_event_add_attendee(event, &attendee) == CALENDAR_ERROR_NONE){
+ if((ret = calendar_attendee_set_phone_number(attendee, "01088889999")) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_attendee_get_phone_number(attendee, &phone_number)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+ }
+ }
+
+ if(phone_number != NULL) {
+ free(phone_number);
+ }
+ calendar_event_destroy(event);
+ if(success == true) {
+ dts_pass(api_name);
+ }
+ else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_attendee_get_phone_number_n(void)
+{
+ char* api_name = API_NAME_CALENDAR_ATTENDEE_GET_PHONE_NUMBER;
+ if(calendar_attendee_get_phone_number(NULL, NULL) == CALENDAR_ERROR_INVALID_PARAMETER
+ && calendar_attendee_set_phone_number(NULL, NULL) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ dts_pass(api_name);
+ }
+ dts_fail(api_name);
+}
+
+
+
diff --git a/TC/testcase/utc_social_calendar_event.c b/TC/testcase/utc_social_calendar_event.c
new file mode 100755
index 0000000..f718c66
--- /dev/null
+++ b/TC/testcase/utc_social_calendar_event.c
@@ -0,0 +1,2459 @@
+/*
+ * 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>
+#include <social/contacts.h>
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+#define API_NAME_CALENDAR_EVENT_CREATE "CALENDAR_EVENT_CREATE"
+#define API_NAME_CALENDAR_EVENT_DESTROY "CALENDAR_EVENT_DESTROY"
+#define API_NAME_CALENDAR_EVENT_GET_DB_ID "CALENDAR_EVENT_GET_DB_ID"
+#define API_NAME_CALENDAR_EVENT_GET_ORIGINAL_EVENT_DB_ID "CALENDAR_EVENT_GET_ORIGINAL_EVENT_DB_ID"
+#define API_NAME_CALENDAR_EVENT_GET_CALENDAR_DB_ID "CALENDAR_EVENT_GET_CALENDAR_BOOK_DB_ID"
+#define API_NAME_CALENDAR_EVENT_GET_SUBJECT "CALENDAR_EVENT_GET_SUBJECT"
+#define API_NAME_CALENDAR_EVENT_SET_SUBJECT "CALENDAR_EVENT_SET_SUBJECT"
+#define API_NAME_CALENDAR_EVENT_GET_DESCRIPTION "CALENDAR_EVENT_GET_DESCRIPTION"
+#define API_NAME_CALENDAR_EVENT_SET_DESCRIPTION "CALENDAR_EVENT_SET_DESCRIPTION"
+#define API_NAME_CALENDAR_EVENT_GET_TIMEZONE "CALENDAR_EVENT_GET_TIMEZONE"
+#define API_NAME_CALENDAR_EVENT_GET_VISIBILITY "CALENDAR_EVENT_GET_VISIBILITY"
+#define API_NAME_CALENDAR_EVENT_GET_LAST_MODIFIED_TIME "CALENDAR_EVENT_GET_LAST_MODIFIED_TIME"
+#define API_NAME_CALENDAR_EVENT_GET_IS_ALL_DAY_EVENT "CALENDAR_EVENT_GET_IS_ALL_DAY_EVENT"
+#define API_NAME_CALENDAR_EVENT_SET_IS_ALL_DAY_EVENT "CALENDAR_EVENT_SET_IS_ALL_DAY_EVENT"
+#define API_NAME_CALENDAR_EVENT_GET_LOCATION "CALENDAR_EVENT_GET_LOCATION"
+#define API_NAME_CALENDAR_EVENT_SET_LOCATION "CALENDAR_EVENT_SET_LOCATION"
+#define API_NAME_CALENDAR_EVENT_INSERT_TO_DB "CALENDAR_EVENT_INSERT_TO_DB"
+#define API_NAME_CALENDAR_EVENT_DELETE_FROM_DB "CALENDAR_EVENT_DELETE_FROM_DB"
+#define API_NAME_CALENDAR_EVENT_UPDATE_TO_DB "CALENDAR_EVENT_UPDATE_TO_DB"
+#define API_NAME_CALENDAR_EVENT_GET_FROM_DB "CALENDAR_EVENT_GET_FROM_DB"
+#define API_NAME_CALENDAR_EVENT_GET_START_TIME "CALENDAR_EVENT_GET_START_TIME"
+#define API_NAME_CALENDAR_EVENT_SET_START_TIME "CALENDAR_EVENT_SET_START_TIME"
+#define API_NAME_CALENDAR_EVENT_GET_END_TIME "CALENDAR_EVENT_GET_END_TIME"
+#define API_NAME_CALENDAR_EVENT_SET_END_TIME "CALENDAR_EVENT_SET_END_TIME"
+#define API_NAME_CALENDAR_EVENT_GET_RECURRENCE_UNTIL_TIME "CALENDAR_EVENT_GET_RECURRENCE_UNTIL_DATE"
+#define API_NAME_CALENDAR_EVENT_SET_RECURRENCE_UNTIL_TIME "CALENDAR_EVENT_SET_RECURRENCE_UNTIL_DATE"
+#define API_NAME_CALENDAR_EVENT_GET_RECURRENCE_FREQUENCY "CALENDAR_EVENT_GET_RECURRENCE_FREQUENCY"
+#define API_NAME_CALENDAR_EVENT_SET_RECURRENCE_FREQUENCY "CALENDAR_EVENT_SET_RECURRENCE_FREQUENCY"
+#define API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_INTERVAL "CALENDAR_EVENT_GET_SET_RECURRENCE_INTERVAL"
+#define API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_COUNT "CALENDAR_EVENT_GET_SET_RECURRENCE_COUNT"
+#define API_NAME_CALENDAR_EVENT_GET_REMINDER "CALENDAR_EVENT_GET_REMINDER"
+#define API_NAME_CALENDAR_EVENT_SET_REMINDER "CALENDAR_EVENT_SET_REMINDER"
+#define API_NAME_CALENDAR_FOREACH_EVENT_FROM_DB "CALENDAR_FOREACH_EVENT_FROM_DB"
+#define API_NAME_CALENDAR_EVENT_ADD_ATTENDEE "CALENDAR_FOREACH_EVENT_ADD_ATTENDEE"
+#define API_NAME_CALENDAR_EVENT_ADD_ATTENDEE_WITH_CONTACT "CALENDAR_FOREACH_EVENT_ADD_ATTENDEE_WITH_CONTACT"
+#define API_NAME_CALENDAR_EVENT_REMOVE_ATTENDEE "CALENDAR_FOREACH_EVENT_REMOVE_ATTENDEE"
+#define API_NAME_CALENDAR_EVENT_GET_TOTAL_COUNT_FROM_DB "CALENDAR_EVENT_GET_TOTAL_COUNT_FROM_DB"
+#define API_NAME_CALENDAR_EVENT_GET_ATTENDEE_ITERATOR "CALENDAR_EVENT_GET_ATTENDEE_ITERATOR"
+#define API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_BYDAY "CALENDAR_EVENT_GET_SET_RECURRENCE_BYDAY"
+#define API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_BYSETPOS "CALENDAR_EVENT_GET_SET_RECURRENCE_BYSETPOS"
+#define API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_BYMONTHDAY "CALENDAR_EVENT_GET_SET_RECURRENCE_BYSETPOS"
+#define API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_BYMONTH "CALENDAR_EVENT_GET_SET_RECURRENCE_BYSETPOS"
+#define API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_BYWEEKSTART "CALENDAR_EVENT_GET_SET_RECURRENCE_BYSETPOS"
+
+#define API_NAME_CALENDAR_FOREACH_QUERY_BY_SUBJECT "CALENDAR_EVENT_FOREACH_QUERY_BY_SUBJECT"
+#define API_NAME_CALENDAR_FOREACH_QUERY_BY_DESCRIPTION "CALENDAR_EVENT_FOREACH_QUERY_BY_DESCRIPTION"
+#define API_NAME_CALENDAR_FOREACH_QUERY_BY_LOCATION "CALENDAR_EVENT_FOREACH_QUERY_BY_LOCATION"
+#define API_NAME_CALENDAR_FOREACH_QUERY_BY_PERIOD "CALENDAR_EVENT_FOREACH_QUERY_BY_PERIOD"
+#define API_NAME_CALENDAR_QUERY_EVENT_BY_TIME_LAST_MODIFIED "CALENDAR_QUERY_EVENT_BY_TIME_LAST_MODIFIED"
+#define API_NAME_CALENDAR_QUERY_EVENT_BY_CALENDAR "CALENDAR_QUERY_EVENT_BY_CALENDAR"
+#define API_NAME_CALENDAR_EVENT_GET_FROM_VCALENDAR "CALENDAR_EVENT_GET_FROM_VCALENDAR"
+#define API_NAME_CALENDAR_EVENT_GET_VCALENDAR_FROM_EVENT "CALENDAR_EVENT_GET_VCALENDAR_FROM_EVENT"
+
+#define API_NAME_CALENDAR_EVENT_GET_SET_CATEGORIES "CALENDAR_EVENT_GET_SET_CATEGORIES"
+#define API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_WEEK_START "CALENDAR_EVENT_GET_SET_RECURRENCE_WEEK_START"
+#define API_NAME_CALENDAR_EVENT_GET_SET_BUSY_STATUS "CALENDAR_EVENT_GET_SET_BUSY_STATUS"
+#define API_NAME_CALENDAR_EVENT_SEARCH_EVENT_BY_VERSION "CALENDAR_EVENT_SEARCH_EVENT_BY_VERSION"
+#define API_NAME_CALENDAR_EVENT_FREE_EVENT_ARRAY "CALENDAR_EVENT_FREE_EVENT_ARRAY"
+#define API_NAME_CALENDAR_EVENT_FREE_MODIFIED_EVENT_ARRAY "CALENDAR_EVENT_FREE_MODIFIED_EVENT_ARRAY"
+#define API_NAME_CALENDAR_EVENT_SEARCH_EVENT_BY_CALENDAR_BOOK "CALENDAR_EVENT_SEARCH_EVENT_BY_CALENDAR_BOOK"
+#define API_NAME_CALENDAR_EVENT_SEARCH_EXTEND_EVENT_INSTANCE_BY_PERIOD "CALENDAR_EVENT_SEARCH_EXTEND_EVENT_INSTANCE_BY_PERIOD"
+#define API_NAME_CALENDAR_EVENT_SEARCH_ALL_DAY_EXTEND_EVENT_INSTANCE_BY_PERIOD "CALENDAR_EVENT_SEARCH_ALL_DAY_EXTEND_EVENT_INSTANCE_BY_PERIOD"
+#define API_NAME_CALENDAR_EVENT_DELETE_RECURRENCE_EVENT_INSTANCE_FROM_DB "CALENDAR_EVENT_DELETE_RECURRENCE_EVENT_INSTANCE_FROM_DB"
+#define API_NAME_CALENDAR_EVENT_DELETE_ALL_DAY_RECURRENCE_EVENT_INSTANCE_FROM_DB "CALENDAR_EVENT_DELETE_ALL_DAY_RECURRENCE_EVENT_INSTANCE_FROM_DB"
+#define API_NAME_CALENDAR_EVENT_GET_SET_EXDATE "CALENDAR_EVENT_GET_SET_EXDATE"
+#define API_NAME_CALENDAR_EVENT_GET_EVENT_ARRAY_FROM_VCALENDAR "CALENDAR_EVENT_GET_EVENT_ARRAY_FROM_VCALENDAR"
+#define API_NAME_CALENDAR_EVENT_GET_VCALENDAR_FROM_DB "CALENDAR_EVENT_GET_VCALENDAR_FROM_DB"
+
+#define SAMPLE_VCAL \
+ "BEGIN:VCALENDAR\r\n" \
+ "METHOD:REQUEST\r\n" \
+ "PRODID:Microsoft CDO for Microsoft Exchange\r\n" \
+ "VERSION:2.0\r\n" \
+ "BEGIN:VTIMEZONE\r\n" \
+ " TZID:tz\r\n" \
+ " X-MICROSOFT-CDO-TZID:10\r\n" \
+ " LAST-MODIFIED:20111229T172655Z\r\n" \
+ " BEGIN:STANDARD\r\n" \
+ " DTSTART:20111106T020000\r\n" \
+ " TZOFFSETTO:+0000\r\n" \
+ " TZOFFSETFROM:+0000\r\n" \
+ " END:STANDARD\r\n" \
+ " BEGIN:DAYLIGHT\r\n" \
+ " DTSTART:20120313T020000\r\n" \
+ " TZOFFSETTO:+0100\r\n" \
+ " TZOFFSETFROM:+0000\r\n" \
+ " END:DAYLIGHT\r\n" \
+ "END:VTIMEZONE\r\n" \
+ "BEGIN:VEVENT\r\n" \
+ " SUMMARY:Simple Event\, Attendees:Tin Tin \r\n" \
+ " ORGANIZER:MAILTO:tin.tin@acme.com\r\n" \
+ " ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=;X-NUM-GUESTS=0:mailto:tin.tin@acme.com\r\n" \
+ " ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=;X-NUM-GUESTS=0:mailto:tin.tin@acme.com\r\n" \
+ " LOCATION:Conference Room\r\n" \
+ " DTSTAMP:20111229T172652Z\r\n" \
+ " UID:D26B0632-8496-4E76-977F-E7A04AF4CF4D\r\n" \
+ " SEQUENCE:1\r\n" \
+ " URL;VALUE=URI:http://acme/Lists/Conf/DispForm.aspx?ID=1178\r\n" \
+ " DTSTART;TZID=tz:20111229T140000\r\n" \
+ " DTEND;TZID=tz:20111229T150000\r\n" \
+ " RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TH;WKST=SU\r\n" \
+ "END:VEVENT\r\n" \
+ "END:VCALENDAR"
+
+#define SAMPLE_VCAL2 \
+ "BEGIN:VCALENDAR\r\n" \
+ "VERSION:1.0\r\n" \
+ "BEGIN:VEVENT\r\n" \
+ "SUMMARY:Sample vCalendar event\r\n" \
+ "DTSTART:20031228T080000\r\n" \
+ "DTEND:20031228T083000\r\n" \
+ "END:VEVENT\r\n" \
+ "END:VCALENDAR\r\n"
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_social_calendar_calendar_event_create_p(void);
+static void utc_social_calendar_calendar_event_create_n(void);
+static void utc_social_calendar_calendar_event_destroy_p(void);
+static void utc_social_calendar_calendar_event_destroy_n(void);
+static void utc_social_calendar_calendar_event_get_db_id_p(void);
+static void utc_social_calendar_calendar_event_get_db_id_n(void);
+static void utc_social_calendar_calendar_event_get_calendar_book_db_id_p(void);
+static void utc_social_calendar_calendar_event_get_calendar_book_db_id_n(void);
+static void utc_social_calendar_calendar_event_get_set_subject_p(void);
+static void utc_social_calendar_calendar_event_get_set_subject_n(void);
+static void utc_social_calendar_calendar_event_get_set_description_p(void);
+static void utc_social_calendar_calendar_event_get_set_description_n(void);
+static void utc_social_calendar_calendar_event_get_set_timezone_p(void);
+static void utc_social_calendar_calendar_event_get_set_timezone_n(void);
+static void utc_social_calendar_calendar_event_get_set_visibility_p(void);
+static void utc_social_calendar_calendar_event_get_set_visibility_n(void);
+static void utc_social_calendar_calendar_event_get_last_modified_time_p(void);
+static void utc_social_calendar_calendar_event_get_last_modified_time_n(void);
+static void utc_social_calendar_calendar_event_get_set_all_day_event_p(void);
+static void utc_social_calendar_calendar_event_get_set_all_day_event_n(void);
+static void utc_social_calendar_calendar_event_get_set_location_p(void);
+static void utc_social_calendar_calendar_event_get_set_location_n(void);
+static void utc_social_calendar_calendar_event_get_set_reminder_p(void);
+static void utc_social_calendar_calendar_event_get_set_reminder_n(void);
+static void utc_social_calendar_calendar_event_get_set_recurrence_frequency_p(void);
+static void utc_social_calendar_calendar_event_get_set_recurrence_frequency_n(void);
+static void utc_social_calendar_calendar_event_get_set_recurrence_interval_p(void);
+static void utc_social_calendar_calendar_event_get_set_recurrence_interval_n(void);
+static void utc_social_calendar_calendar_event_get_set_recurrence_count_p(void);
+static void utc_social_calendar_calendar_event_get_set_recurrence_count_n(void);
+static void utc_social_calendar_calendar_event_get_set_recurrence_until_date_p(void);
+static void utc_social_calendar_calendar_event_get_set_recurrence_until_date_n(void);
+
+static void utc_social_calendar_calendar_event_get_set_start_time_p(void);
+static void utc_social_calendar_calendar_event_get_set_start_time_n(void);
+static void utc_social_calendar_calendar_event_get_set_end_time_p(void);
+static void utc_social_calendar_calendar_event_get_set_end_time_n(void);
+static void utc_social_calendar_calendar_event_insert_to_db_p(void);
+static void utc_social_calendar_calendar_event_insert_to_db_n(void);
+static void utc_social_calendar_calendar_event_delete_from_db_p(void);
+static void utc_social_calendar_calendar_event_delete_from_db_n(void);
+static void utc_social_calendar_calendar_event_update_to_db_p(void);
+static void utc_social_calendar_calendar_event_update_to_db_n(void);
+static void utc_social_calendar_calendar_event_get_from_db_p(void);
+static void utc_social_calendar_calendar_event_get_from_db_n(void);
+static void utc_social_calendar_calendar_event_add_attendee_p(void);
+static void utc_social_calendar_calendar_event_add_attendee_n(void);
+static void utc_social_calendar_calendar_event_add_attendee_with_contact_p(void);
+static void utc_social_calendar_calendar_event_add_attendee_with_contact_n(void);
+static void utc_social_calendar_calendar_event_remove_attendee_p(void);
+static void utc_social_calendar_calendar_event_remove_attendee_n(void);
+static void utc_social_calendar_calendar_event_get_attendee_iterator_p(void);
+static void utc_social_calendar_calendar_event_get_attendee_iterator_n(void);
+
+static void utc_social_calendar_calendar_event_get_set_recurrence_byday_p(void);
+static void utc_social_calendar_calendar_event_get_set_recurrence_byday_n(void);
+static void utc_social_calendar_calendar_event_get_set_recurrence_bysetpos_p(void);
+static void utc_social_calendar_calendar_event_get_set_recurrence_bysetpos_n(void);
+static void utc_social_calendar_calendar_event_get_set_recurrence_bymonthday_p(void);
+static void utc_social_calendar_calendar_event_get_set_recurrence_bymonthday_n(void);
+static void utc_social_calendar_calendar_event_get_set_recurrence_bymonth_p(void);
+static void utc_social_calendar_calendar_event_get_set_recurrence_bymonth_n(void);
+static void utc_social_calendar_calendar_event_get_set_recurrence_week_start_p(void);
+static void utc_social_calendar_calendar_event_get_set_recurrence_week_start_n(void);
+
+static void utc_social_calendar_event_get_set_categories_p(void);
+static void utc_social_calendar_event_get_set_categories_n(void);
+static void utc_social_calendar_event_get_set_recurrence_week_start_p(void);
+static void utc_social_calendar_event_get_set_recurrence_week_start_n(void);
+static void utc_social_calendar_event_get_set_busy_status_p(void);
+static void utc_social_calendar_event_get_set_busy_status_n(void);
+static void utc_social_calendar_event_search_event_by_version_p(void);
+static void utc_social_calendar_event_search_event_by_version_n(void);
+static void utc_social_calendar_event_free_event_array_p(void);
+static void utc_social_calendar_event_free_event_array_n(void);
+static void utc_social_calendar_event_free_modified_event_array_p(void);
+static void utc_social_calendar_event_free_modified_event_array_n(void);
+static void utc_social_calendar_event_search_event_by_calendar_book_p(void);
+static void utc_social_calendar_event_search_event_by_calendar_book_n(void);
+
+static void utc_social_calendar_event_search_extend_instance_by_period_p(void);
+static void utc_social_calendar_event_search_extend_instance_by_period_n(void);
+static void utc_social_calendar_event_search_all_day_extend_instance_by_period_p(void);
+static void utc_social_calendar_event_search_all_day_extend_instance_by_period_n(void);
+
+static void utc_social_calendar_event_delete_recurrence_instance_from_db_p(void);
+static void utc_social_calendar_event_delete_recurrence_instance_from_db_n(void);
+static void utc_social_calendar_event_delete_recurrence_all_day_instance_from_db_p(void);
+static void utc_social_calendar_event_delete_recurrence_all_day_instance_from_db_n(void);
+static void utc_social_calendar_event_get_set_exdate_p(void);
+static void utc_social_calendar_event_get_set_exdate_n(void);
+
+static void utc_social_calendar_event_get_event_array_from_vcalendar_p(void);
+static void utc_social_calendar_event_get_event_array_from_vcalendar_n(void);
+static void utc_social_calendar_event_get_vcalendar_from_db_p(void);
+static void utc_social_calendar_event_get_vcalendar_from_db_n(void);
+
+struct tet_testlist tet_testlist[] = {
+ { utc_social_calendar_calendar_event_create_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_create_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_destroy_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_destroy_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_subject_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_subject_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_description_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_description_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_timezone_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_timezone_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_visibility_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_visibility_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_last_modified_time_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_last_modified_time_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_all_day_event_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_all_day_event_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_location_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_location_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_reminder_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_reminder_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_recurrence_frequency_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_recurrence_frequency_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_recurrence_interval_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_recurrence_interval_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_recurrence_count_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_recurrence_count_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_recurrence_until_date_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_recurrence_until_date_n, NEGATIVE_TC_IDX },
+
+ { utc_social_calendar_calendar_event_get_set_recurrence_byday_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_recurrence_byday_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_recurrence_bysetpos_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_recurrence_bysetpos_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_recurrence_bymonthday_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_recurrence_bymonthday_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_recurrence_bymonth_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_recurrence_bymonth_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_recurrence_week_start_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_recurrence_week_start_n, NEGATIVE_TC_IDX },
+
+ { utc_social_calendar_calendar_event_get_set_start_time_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_start_time_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_end_time_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_set_end_time_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_insert_to_db_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_insert_to_db_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_from_db_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_from_db_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_db_id_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_db_id_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_calendar_book_db_id_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_calendar_book_db_id_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_update_to_db_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_update_to_db_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_delete_from_db_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_delete_from_db_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_add_attendee_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_add_attendee_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_add_attendee_with_contact_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_add_attendee_with_contact_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_remove_attendee_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_remove_attendee_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_attendee_iterator_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_event_get_attendee_iterator_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_event_get_set_categories_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_event_get_set_categories_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_event_get_set_recurrence_week_start_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_event_get_set_recurrence_week_start_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_event_get_set_busy_status_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_event_get_set_busy_status_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_event_search_event_by_version_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_event_search_event_by_version_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_event_free_event_array_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_event_free_event_array_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_event_free_modified_event_array_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_event_free_modified_event_array_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_event_search_event_by_calendar_book_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_event_search_event_by_calendar_book_n, NEGATIVE_TC_IDX },
+
+ { utc_social_calendar_event_search_extend_instance_by_period_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_event_search_extend_instance_by_period_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_event_search_all_day_extend_instance_by_period_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_event_search_all_day_extend_instance_by_period_n, NEGATIVE_TC_IDX },
+
+ { utc_social_calendar_event_delete_recurrence_instance_from_db_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_event_delete_recurrence_instance_from_db_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_event_delete_recurrence_all_day_instance_from_db_p, POSITIVE_TC_IDX},
+ { utc_social_calendar_event_delete_recurrence_all_day_instance_from_db_n, NEGATIVE_TC_IDX},
+ { utc_social_calendar_event_get_set_exdate_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_event_get_set_exdate_n, NEGATIVE_TC_IDX },
+
+ { utc_social_calendar_event_get_event_array_from_vcalendar_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_event_get_event_array_from_vcalendar_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_event_get_vcalendar_from_db_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_event_get_vcalendar_from_db_n, NEGATIVE_TC_IDX },
+
+ { NULL, 0 },
+};
+
+calendar_event_h _dts_event = NULL;
+
+static void startup(void)
+{
+ /* start of TC */
+ calendar_event_create(&_dts_event);
+ calendar_event_set_subject(_dts_event, "Event test subject");
+ calendar_event_set_description(_dts_event, "Event test description");
+}
+
+static void cleanup(void)
+{
+ /* end of TC */
+ calendar_event_destroy(_dts_event);
+}
+
+bool dts_calendar_event_cb(calendar_event_h event, void *user_data)
+{
+ char *subject = NULL;
+ calendar_event_get_subject(event, &subject);
+ printf("# subject : %s\n", subject);
+ return true;
+}
+
+bool dts_calendar_query_event_cb(calendar_event_h event, void *user_data)
+{
+ return false;
+}
+
+static void utc_social_calendar_calendar_event_create_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_CREATE;
+
+ calendar_event_h event = NULL;
+ if((ret = calendar_event_create(&event)) == CALENDAR_ERROR_NONE) {
+ calendar_event_destroy(event);
+ dts_pass(api_name);
+ }
+ else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_event_create_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_CREATE;
+
+ if((ret = calendar_event_create(NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ dts_pass(api_name);
+ }
+ else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_event_destroy_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_DESTROY;
+ bool success = false;
+
+ calendar_event_h event = NULL;
+ if((ret = calendar_event_create(&event)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_destroy(event)) == 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_calendar_event_destroy_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_DESTROY;
+
+ if((ret = calendar_event_destroy(NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ dts_pass(api_name);
+ }
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+}
+
+int dts_event_db_id_inserted = -1;
+static void utc_social_calendar_calendar_event_get_db_id_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_DB_ID;
+ bool success = false;
+ int db_id = -1;
+
+ calendar_event_h event = NULL;
+ calendar_connect();
+ if((ret = calendar_event_get_from_db(dts_event_db_id_inserted, &event)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_get_db_id(event, &db_id)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+ calendar_event_destroy(event);
+ 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_calendar_event_get_db_id_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_DB_ID;
+
+ if((ret = calendar_event_get_db_id(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_event_get_calendar_book_db_id_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_CALENDAR_DB_ID;
+ bool success = false;
+ int db_id = -1;
+
+ if((ret = calendar_event_get_calendar_book_db_id(_dts_event, &db_id)) == 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_calendar_event_get_calendar_book_db_id_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_CALENDAR_DB_ID;
+ bool success = false;
+
+ if((ret = calendar_event_get_calendar_book_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_calendar_event_get_set_subject_n(void)
+{
+ if(calendar_event_set_subject(NULL, "subject") == CALENDAR_ERROR_INVALID_PARAMETER
+ && calendar_event_get_subject(NULL, NULL) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ dts_pass(API_NAME_CALENDAR_EVENT_GET_SUBJECT);
+ }
+ dts_fail(API_NAME_CALENDAR_EVENT_GET_SUBJECT);
+}
+
+static void utc_social_calendar_calendar_event_get_set_subject_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_SUBJECT;
+ bool success = false;
+ char* subject = NULL;
+
+ calendar_event_h event = NULL;
+ if((ret = calendar_event_create(&event)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_set_subject(event, "subject")) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_get_subject(event, &subject)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+ }
+ if(subject != NULL) {
+ free(subject);
+ }
+ calendar_event_destroy(event);
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_event_get_set_description_n(void)
+{
+ if(calendar_event_set_description(NULL, "description") == CALENDAR_ERROR_INVALID_PARAMETER
+ && calendar_event_get_description(NULL, NULL) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ dts_pass(API_NAME_CALENDAR_EVENT_GET_DESCRIPTION);
+ }
+ dts_fail(API_NAME_CALENDAR_EVENT_GET_DESCRIPTION);
+}
+
+static void utc_social_calendar_calendar_event_get_set_description_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_DESCRIPTION;
+ bool success = false;
+ calendar_event_h event = NULL;
+ char* description = NULL;
+
+ if(calendar_event_create(&event) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_set_description(event, "description")) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_get_description(event, &description)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+ }
+ if(description != NULL) {
+ free(description);
+ }
+ calendar_event_destroy(event);
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_event_get_set_all_day_event_n(void)
+{
+ if(calendar_event_set_all_day_event(NULL, 2012, 1, 1, 2013, 12 ,31) == CALENDAR_ERROR_INVALID_PARAMETER
+ && calendar_event_get_all_day_event(NULL, NULL, NULL, NULL, NULL, NULL, NULL) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ dts_pass(API_NAME_CALENDAR_EVENT_GET_IS_ALL_DAY_EVENT);
+ }
+ dts_fail(API_NAME_CALENDAR_EVENT_GET_IS_ALL_DAY_EVENT);
+}
+
+static void utc_social_calendar_calendar_event_get_set_timezone_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_TIMEZONE;
+ bool success = false;
+
+ calendar_event_h event = NULL;
+ char* timezone = NULL;
+
+ calendar_event_create(&event);
+ if((ret = calendar_event_set_timezone(event, "Seoul")) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_get_timezone(event, &timezone)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+
+ if(timezone != NULL) {
+ free(timezone);
+ }
+ calendar_event_destroy(event);
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_event_get_set_timezone_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_TIMEZONE;
+ bool success = false;
+
+ if((ret = calendar_event_set_timezone(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ if((ret = calendar_event_get_timezone(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_calendar_event_get_set_visibility_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_TIMEZONE;
+ bool success = false;
+
+ calendar_event_h event = NULL;
+ calendar_visibility_e visibility = 0;
+
+ calendar_event_create(&event);
+ if((ret = calendar_event_set_visibility(event, CALENDAR_VISIBILITY_PRIVATE)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_get_visibility(event, &visibility)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+ calendar_event_destroy(event);
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_event_get_set_visibility_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_VISIBILITY;
+ bool success = false;
+
+ if((ret = calendar_event_set_visibility(NULL, 0)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ if((ret = calendar_event_get_visibility(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_calendar_event_get_last_modified_time_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_LAST_MODIFIED_TIME;
+ bool success = false;
+
+ calendar_event_h event = NULL;
+ long long int lastmodifiedtime = 0;
+
+ calendar_event_create(&event);
+ if((ret = calendar_event_get_last_modified_time(event, &lastmodifiedtime)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ calendar_event_destroy(event);
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_event_get_last_modified_time_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_LAST_MODIFIED_TIME;
+ bool success = false;
+
+ if((ret = calendar_event_get_last_modified_time(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_calendar_event_get_set_all_day_event_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_IS_ALL_DAY_EVENT;
+ int start_year, start_month, start_day;
+ int end_year, end_month, end_day;
+ bool success = false;
+
+ calendar_event_h event = NULL;
+ if(calendar_event_create(&event) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_set_all_day_event(event, 2012, 1, 1, 2013, 12 ,31)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_get_all_day_event(event,
+ &start_year, &start_month, &start_day,
+ &end_year, &end_month, &end_day)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+ }
+ calendar_event_destroy(event);
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_event_get_set_location_n(void)
+{
+ if(calendar_event_set_location(NULL, NULL) == CALENDAR_ERROR_INVALID_PARAMETER
+ && calendar_event_get_location(NULL, NULL) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ dts_pass(API_NAME_CALENDAR_EVENT_GET_LOCATION);
+ }
+ dts_fail(API_NAME_CALENDAR_EVENT_GET_LOCATION);
+}
+
+static void utc_social_calendar_calendar_event_get_set_location_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_LOCATION;
+ bool success = false;
+ char* location = NULL;
+
+ calendar_event_h event = NULL;
+ if((ret = calendar_event_create(&event)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_set_location(event, "location")) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_get_location(event, &location)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+ }
+ if(location != NULL) {
+ free(location);
+ }
+ calendar_event_destroy(event);
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_event_insert_to_db_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_INSERT_TO_DB;
+ bool success = false;
+
+ calendar_event_h event = NULL;
+ calendar_connect();
+ if((ret = calendar_event_create(&event)) == CALENDAR_ERROR_NONE) {
+ calendar_event_set_subject(event, "Event test subject");
+ calendar_event_set_description(event, "Event test description");
+ if((ret = calendar_event_insert_to_db(event, 1, &dts_event_db_id_inserted)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+ calendar_event_destroy(event);
+ 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_calendar_event_insert_to_db_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_INSERT_TO_DB;
+
+ if((ret = calendar_event_insert_to_db(NULL, 1, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ dts_pass(api_name);
+ }
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+}
+
+static void utc_social_calendar_calendar_event_delete_from_db_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_DELETE_FROM_DB;
+ bool success = false;
+
+ calendar_connect();
+ if((ret = calendar_event_delete_from_db(dts_event_db_id_inserted)) == 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_calendar_event_delete_from_db_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_DELETE_FROM_DB;
+
+ if((ret = calendar_event_delete_from_db(-1)) == CALENDAR_ERROR_INVALID_PARAMETER) { // ??
+ dts_pass(api_name);
+ }
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+}
+
+static void utc_social_calendar_calendar_event_update_to_db_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_UPDATE_TO_DB;
+ bool success = false;
+
+ calendar_event_h event = NULL;
+ calendar_connect();
+ if((ret = calendar_event_get_from_db(dts_event_db_id_inserted, &event)) == CALENDAR_ERROR_NONE) {
+ calendar_event_set_subject(event, "DTS subject updated");
+ calendar_event_set_description(event, "DTS description updated");
+ if((ret = calendar_event_update_to_db(event)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+ calendar_event_destroy(event);
+ 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_calendar_event_update_to_db_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_UPDATE_TO_DB;
+
+ if((ret = calendar_event_update_to_db(NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ dts_pass(api_name);
+ }
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+}
+
+static void utc_social_calendar_calendar_event_get_from_db_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_FROM_DB;
+ bool success = false;
+
+ calendar_event_h event = NULL;
+ calendar_connect();
+ if((ret = calendar_event_get_from_db(dts_event_db_id_inserted, &event)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ calendar_event_destroy(event);
+ 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_calendar_event_get_from_db_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_FROM_DB;
+
+ if((ret = calendar_event_get_from_db(0, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ dts_pass(api_name);
+ }
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+}
+
+static void utc_social_calendar_calendar_event_get_set_start_time_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_START_TIME;
+ bool success = false;
+ long long int start_time = 0;
+
+ calendar_event_h event = NULL;
+ if((ret = calendar_event_create(&event)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_set_start_time(event, start_time)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_get_start_time(event, &start_time)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+ }
+ calendar_event_destroy(event);
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_event_get_set_start_time_n(void)
+{
+ long long int start_time = 0;
+ if(calendar_event_set_start_time(NULL, start_time) == CALENDAR_ERROR_INVALID_PARAMETER
+ && calendar_event_get_start_time(NULL, NULL) == CALENDAR_ERROR_INVALID_PARAMETER){
+ dts_pass(API_NAME_CALENDAR_EVENT_GET_START_TIME);
+ }
+ dts_fail(API_NAME_CALENDAR_EVENT_GET_START_TIME);
+}
+
+static void utc_social_calendar_calendar_event_get_set_end_time_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_END_TIME;
+ bool success = false;
+ long long int end_time = 0;
+
+ calendar_event_h event = NULL;
+ if((ret = calendar_event_create(&event)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_set_end_time(event, end_time)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_get_end_time(event, &end_time)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+ }
+ calendar_event_destroy(event);
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_event_get_set_end_time_n(void)
+{
+ long long int end_time = 0;
+ if(calendar_event_set_end_time(NULL, end_time) == CALENDAR_ERROR_INVALID_PARAMETER
+ && calendar_event_get_end_time(NULL, NULL) == CALENDAR_ERROR_INVALID_PARAMETER){
+ dts_pass(API_NAME_CALENDAR_EVENT_GET_END_TIME);
+ }
+ dts_fail(API_NAME_CALENDAR_EVENT_GET_END_TIME);
+}
+
+static void utc_social_calendar_calendar_event_get_set_recurrence_frequency_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_RECURRENCE_FREQUENCY;
+ bool success = false;
+ calendar_recurrence_frequency_e frequency = CALENDAR_RECURRENCE_NONE;
+
+ calendar_event_h event = NULL;
+ if((ret = calendar_event_create(&event)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_set_recurrence_frequency(event, frequency)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_get_recurrence_frequency(event, &frequency)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+ }
+ calendar_event_destroy(event);
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_event_get_set_recurrence_frequency_n(void)
+{
+ calendar_recurrence_frequency_e frequency = CALENDAR_RECURRENCE_NONE;
+ if(calendar_event_set_recurrence_frequency(NULL, frequency) == CALENDAR_ERROR_INVALID_PARAMETER
+ && calendar_event_get_recurrence_frequency(NULL, NULL) == CALENDAR_ERROR_INVALID_PARAMETER){
+ dts_pass(API_NAME_CALENDAR_EVENT_GET_RECURRENCE_FREQUENCY);
+ }
+ dts_fail(API_NAME_CALENDAR_EVENT_GET_RECURRENCE_FREQUENCY);
+}
+
+static void utc_social_calendar_calendar_event_get_set_recurrence_interval_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_INTERVAL;
+ bool success = false;
+ int interval = 100;
+
+ calendar_event_h event = NULL;
+ if((ret = calendar_event_create(&event)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_set_recurrence_interval(event, interval)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_get_recurrence_interval(event, &interval)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+ }
+ calendar_event_destroy(event);
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_event_get_set_recurrence_interval_n(void)
+{
+ int interval = 100;
+ if(calendar_event_set_recurrence_interval(NULL, interval) == CALENDAR_ERROR_INVALID_PARAMETER
+ && calendar_event_get_recurrence_interval(NULL, NULL) == CALENDAR_ERROR_INVALID_PARAMETER){
+ dts_pass(API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_INTERVAL);
+ }
+ dts_fail(API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_INTERVAL);
+}
+
+static void utc_social_calendar_calendar_event_get_set_recurrence_count_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_COUNT;
+ bool success = false;
+ int recurrence_count = 1000;
+
+ calendar_event_h event = NULL;
+ if((ret = calendar_event_create(&event)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_set_recurrence_count(event, recurrence_count)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_get_recurrence_count(event, &recurrence_count)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+ }
+ calendar_event_destroy(event);
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_event_get_set_recurrence_count_n(void)
+{
+ int recurrence_count = 1000;
+ if(calendar_event_set_recurrence_count(NULL, recurrence_count) == CALENDAR_ERROR_INVALID_PARAMETER
+ && calendar_event_get_recurrence_count(NULL, NULL) == CALENDAR_ERROR_INVALID_PARAMETER){
+ dts_pass(API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_COUNT);
+ }
+ dts_fail(API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_COUNT);
+}
+
+/*
+static void utc_social_calendar_calendar_event_get_set_recurrence_week_flag_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_RECURRENCE_WEEK_FLAG;
+ bool success = false;
+ int week_flag = CALENDAR_WEEK_FLAG_SUN | CALENDAR_WEEK_FLAG_MON;
+
+ calendar_event_h event = NULL;
+ if((ret = calendar_event_create(&event)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_set_recurrence_week_flag(event, week_flag)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_get_recurrence_week_flag(event, &week_flag)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+ }
+ calendar_event_destroy(event);
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_event_get_set_recurrence_week_flag_n(void)
+{
+ calendar_week_flag_e week_flag = CALENDAR_WEEK_FLAG_SUN | CALENDAR_WEEK_FLAG_MON;
+ if(calendar_event_set_recurrence_week_flag(NULL, week_flag) == CALENDAR_ERROR_INVALID_PARAMETER
+ && calendar_event_get_recurrence_week_flag(NULL, NULL) == CALENDAR_ERROR_INVALID_PARAMETER){
+ dts_pass(API_NAME_CALENDAR_EVENT_GET_RECURRENCE_WEEK_FLAG);
+ }
+ dts_fail(API_NAME_CALENDAR_EVENT_GET_RECURRENCE_WEEK_FLAG);
+}
+*/
+static void utc_social_calendar_calendar_event_get_set_reminder_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_REMINDER;
+ int reminder_interval = 5;
+ calendar_reminder_interval_type_e reminder_interval_type = CALENDAR_REMINDER_TIME_UNIT_HOUR;
+ bool success = false;
+
+ calendar_event_h event = NULL;
+ if((ret = calendar_event_create(&event)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_set_reminder(event, reminder_interval_type, reminder_interval)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_get_reminder(event, &reminder_interval,&reminder_interval)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+ }
+ calendar_event_destroy(event);
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_event_get_set_reminder_n(void)
+{
+ calendar_reminder_interval_type_e reminder_interval_type = CALENDAR_REMINDER_TIME_UNIT_HOUR;
+ int reminder_interval = 5;
+
+ if(calendar_event_set_reminder(NULL, reminder_interval_type,reminder_interval) == CALENDAR_ERROR_INVALID_PARAMETER
+ && calendar_event_get_reminder(NULL, NULL, NULL) == CALENDAR_ERROR_INVALID_PARAMETER){
+ dts_pass(API_NAME_CALENDAR_EVENT_GET_REMINDER);
+ }
+ dts_fail(API_NAME_CALENDAR_EVENT_GET_REMINDER);
+}
+
+static void utc_social_calendar_calendar_event_get_set_recurrence_until_date_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_RECURRENCE_UNTIL_TIME;
+ bool success = false;
+
+ long long int recurrence_until_date = 0;
+
+ calendar_event_h event = NULL;
+ if((ret = calendar_event_create(&event)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_set_recurrence_until_date(event, recurrence_until_date)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_get_recurrence_until_date(event, &recurrence_until_date)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+ }
+ calendar_event_destroy(event);
+
+ 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_calendar_event_get_set_recurrence_until_date_n(void)
+{
+ long long int recurrence_until_date = 0;
+
+ if(calendar_event_set_recurrence_until_date(NULL, recurrence_until_date) == CALENDAR_ERROR_INVALID_PARAMETER
+ && calendar_event_get_recurrence_until_date(NULL, NULL) == CALENDAR_ERROR_INVALID_PARAMETER){
+ dts_pass(API_NAME_CALENDAR_EVENT_GET_RECURRENCE_UNTIL_TIME);
+ }
+ dts_fail(API_NAME_CALENDAR_EVENT_GET_RECURRENCE_UNTIL_TIME);
+}
+
+static void utc_social_calendar_calendar_event_add_attendee_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_ADD_ATTENDEE;
+
+ bool success = false;
+
+ calendar_event_h event = NULL;
+ calendar_attendee_h attendee = NULL;
+
+ if(calendar_event_create(&event) == CALENDAR_ERROR_NONE) {
+ if(calendar_event_add_attendee(event, &attendee) == CALENDAR_ERROR_NONE){
+ success = true;
+ }
+ }
+ calendar_event_destroy(event);
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_event_add_attendee_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_ADD_ATTENDEE;
+
+ if((ret = calendar_event_add_attendee(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER){
+ dts_pass(api_name);
+ }
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+}
+
+static void utc_social_calendar_calendar_event_add_attendee_with_contact_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_ADD_ATTENDEE_WITH_CONTACT;
+
+ bool success = false;
+
+ // insert contact---------------------------
+ contact_h contact = NULL;
+ contact_email_h email = NULL;
+ contact_number_h number = NULL;
+ int contact_db_id = 0;
+ contact_create(&contact);
+ contact_email_create(&email);
+ contact_email_set_type(email, CONTACT_EMAIL_TYPE_HOME);
+ contact_email_set_address(email, "dts@dts.com");
+ contact_number_create(&number);
+ contact_number_set_type(number, CONTACT_NUMBER_TYPE_HOME);
+ contact_number_set_number(number, "01100009999");
+
+ contact_create(&contact);
+ contact_add_email(contact, email);
+ contact_add_number(contact, number);
+ contacts_connect();
+ contact_insert_to_db(contact, 0, &contact_db_id);
+
+ contact_email_destroy(email);
+ contact_number_destroy(number);
+ contact_destroy(contact);
+ //----------------------------------------
+
+ calendar_event_h event = NULL;
+ calendar_attendee_h attendee = NULL;
+
+ if(calendar_event_create(&event) == CALENDAR_ERROR_NONE) {
+ if(calendar_event_add_attendee_with_contact(event, contact_db_id, &attendee) == CALENDAR_ERROR_NONE){
+ success = true;
+ }
+ }
+
+ contacts_disconnect();
+ calendar_event_destroy(event);
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_event_add_attendee_with_contact_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_ADD_ATTENDEE_WITH_CONTACT;
+
+ if((ret = calendar_event_add_attendee_with_contact(NULL, 0, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER){
+ dts_pass(api_name);
+ }
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+}
+
+static void utc_social_calendar_calendar_event_remove_attendee_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_REMOVE_ATTENDEE;
+ bool success = false;
+ calendar_event_h event = NULL;
+ calendar_attendee_h attendee = NULL;
+
+ if(calendar_event_create(&event) == CALENDAR_ERROR_NONE) {
+ if(calendar_event_add_attendee(event, &attendee) == CALENDAR_ERROR_NONE){
+ calendar_attendee_set_name(attendee, "name");
+ if((ret = calendar_event_remove_attendee(event, attendee)) == CALENDAR_ERROR_NONE){
+ success = true;
+ }
+ }
+ }
+ calendar_event_destroy(event);
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_event_remove_attendee_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_REMOVE_ATTENDEE;
+
+ if((ret = calendar_event_remove_attendee(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER){
+ dts_pass(api_name);
+ }
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+}
+
+static void utc_social_calendar_calendar_event_get_attendee_iterator_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_ATTENDEE_ITERATOR;
+ bool success = false;
+ calendar_event_h event = NULL;
+ calendar_attendee_h attendee = NULL;
+ calendar_attendee_iterator_h iterator = NULL;
+
+ if(calendar_event_create(&event) == CALENDAR_ERROR_NONE && calendar_event_add_attendee(event, &attendee) == CALENDAR_ERROR_NONE){
+ calendar_attendee_set_name(attendee, "name");
+ if((ret = calendar_event_get_attendee_iterator(event, &iterator)) == CALENDAR_ERROR_NONE){
+ success = true;
+ }
+ }
+ calendar_event_destroy(event);
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_event_get_attendee_iterator_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_ATTENDEE_ITERATOR;
+
+ if((ret = calendar_event_get_attendee_iterator(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER){
+ dts_pass(api_name);
+ }
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+}
+
+static void utc_social_calendar_calendar_event_get_set_recurrence_byday_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_BYDAY;
+ bool success = false;
+ char* byday = "xxxxxxxxxxxxxxxxx";
+
+ calendar_event_h event = NULL;
+ if((ret = calendar_event_create(&event)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_set_recurrence_byday(event, byday)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_get_recurrence_byday(event, &byday)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+ }
+ calendar_event_destroy(event);
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_event_get_set_recurrence_byday_n(void)
+{
+ char* byday = "xxxxxxxxxxxxxxxxx";
+ if(calendar_event_set_recurrence_byday(NULL, byday) == CALENDAR_ERROR_INVALID_PARAMETER
+ && calendar_event_get_recurrence_byday(NULL, NULL) == CALENDAR_ERROR_INVALID_PARAMETER){
+ dts_pass(API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_BYDAY);
+ }
+ dts_fail(API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_BYDAY);
+}
+
+static void utc_social_calendar_calendar_event_get_set_recurrence_bysetpos_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_BYSETPOS;
+ bool success = false;
+ char* bysetpos = "xxxxxxxxxxxxxxxxx";
+
+ calendar_event_h event = NULL;
+ if((ret = calendar_event_create(&event)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_set_recurrence_bysetpos(event, bysetpos)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_get_recurrence_bysetpos(event, &bysetpos)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+ }
+ calendar_event_destroy(event);
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_event_get_set_recurrence_bysetpos_n(void)
+{
+ char* bysetpos = "xxxxxxxxxxxxxxxxx";
+ if(calendar_event_set_recurrence_bysetpos(NULL, bysetpos) == CALENDAR_ERROR_INVALID_PARAMETER
+ && calendar_event_get_recurrence_bysetpos(NULL, NULL) == CALENDAR_ERROR_INVALID_PARAMETER){
+ dts_pass(API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_BYSETPOS);
+ }
+ dts_fail(API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_BYSETPOS);
+}
+
+static void utc_social_calendar_calendar_event_get_set_recurrence_bymonthday_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_BYMONTHDAY;
+ bool success = false;
+ char* bymonthday = "xxxxxxxxxxxxxxxxx";
+
+ calendar_event_h event = NULL;
+ if((ret = calendar_event_create(&event)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_set_recurrence_bymonthday(event, bymonthday)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_get_recurrence_bymonthday(event, &bymonthday)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+ }
+ calendar_event_destroy(event);
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_event_get_set_recurrence_bymonthday_n(void)
+{
+ char* bymonthday = "xxxxxxxxxxxxxxxxx";
+ if(calendar_event_set_recurrence_bymonthday(NULL, bymonthday) == CALENDAR_ERROR_INVALID_PARAMETER
+ && calendar_event_get_recurrence_bymonthday(NULL, NULL) == CALENDAR_ERROR_INVALID_PARAMETER){
+ dts_pass(API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_BYMONTHDAY);
+ }
+ dts_fail(API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_BYMONTHDAY);
+}
+
+static void utc_social_calendar_calendar_event_get_set_recurrence_bymonth_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_BYMONTH;
+ bool success = false;
+ char* bymonth = "xxxxxxxxxxxxxxxxx";
+
+ calendar_event_h event = NULL;
+ if((ret = calendar_event_create(&event)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_set_recurrence_bymonth(event, bymonth)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_get_recurrence_bymonth(event, &bymonth)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+ }
+ calendar_event_destroy(event);
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_event_get_set_recurrence_bymonth_n(void)
+{
+ char* bymonth = "xxxxxxxxxxxxxxxxx";
+ if(calendar_event_set_recurrence_bymonth(NULL, bymonth) == CALENDAR_ERROR_INVALID_PARAMETER
+ && calendar_event_get_recurrence_bymonth(NULL, NULL) == CALENDAR_ERROR_INVALID_PARAMETER){
+ dts_pass(API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_BYMONTH);
+ }
+ dts_fail(API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_BYMONTH);
+}
+
+static void utc_social_calendar_calendar_event_get_set_recurrence_week_start_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_BYWEEKSTART;
+ bool success = false;
+ calendar_week_flag_e week_start = CALENDAR_WEEK_FLAG_SUN;
+
+ calendar_event_h event = NULL;
+ if((ret = calendar_event_create(&event)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_set_recurrence_week_start(event, week_start)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_event_get_recurrence_week_start(event, &week_start)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+ }
+ calendar_event_destroy(event);
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_event_get_set_recurrence_week_start_n(void)
+{
+ calendar_week_flag_e week_start = CALENDAR_WEEK_FLAG_SUN;
+ if(calendar_event_set_recurrence_week_start(NULL, week_start) == CALENDAR_ERROR_INVALID_PARAMETER
+ && calendar_event_get_recurrence_week_start(NULL, NULL) == CALENDAR_ERROR_INVALID_PARAMETER){
+ dts_pass(API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_BYWEEKSTART);
+ }
+ dts_fail(API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_BYWEEKSTART);
+}
+/*
+static void utc_social_calendar_calendar_event_get_from_vcalendar_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_FROM_VCALENDAR;
+
+ bool success = false;
+
+ calendar_event_h event = NULL;
+ char* vcalendar_stream = NULL;
+
+ calendar_event_get_vcalendar_from_event(_dts_event, &vcalendar_stream);
+ if(calendar_event_get_from_vcalendar(vcalendar_stream, &event) == CALENDAR_ERROR_NONE){
+ success = true;
+ }
+
+ calendar_event_destroy(event);
+ if(vcalendar_stream != NULL)
+ free(vcalendar_stream);
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_event_get_from_vcalendar_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_FROM_VCALENDAR;
+
+ bool success = false;
+
+ if(calendar_event_get_from_vcalendar(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_calendar_event_get_vcalendar_from_event_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_VCALENDAR_FROM_EVENT;
+
+ bool success = false;
+
+ char* vcalendar_stream = NULL;
+
+ if(calendar_event_get_vcalendar_from_event(_dts_event, &vcalendar_stream) == CALENDAR_ERROR_NONE){
+ success = true;
+ }
+
+ if(vcalendar_stream != NULL)
+ free(vcalendar_stream);
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_event_get_vcalendar_from_event_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_EVENT_GET_VCALENDAR_FROM_EVENT;
+
+ bool success = false;
+
+ if(calendar_event_get_vcalendar_from_event(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_event_get_set_categories_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ bool pass = false;
+ char* categories = NULL;
+
+ calendar_event_h event = NULL;
+ if ((ret = calendar_event_create(&event)) == CALENDAR_ERROR_NONE) {
+ if ((ret = calendar_event_set_categories(event, "category1,category2,category3")) == CALENDAR_ERROR_NONE) {
+ if ((ret = calendar_event_get_categories(event, &categories)) == CALENDAR_ERROR_NONE) {
+ pass = true;
+ if (categories != NULL) {
+ free(categories);
+ }
+ }
+ }
+ calendar_event_destroy(event);
+ }
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_EVENT_GET_SET_CATEGORIES);
+ } else {
+ dts_message(API_NAME_CALENDAR_EVENT_GET_SET_CATEGORIES, "Calendar : %d", ret);
+ dts_fail(API_NAME_CALENDAR_EVENT_GET_SET_CATEGORIES);
+ }
+}
+
+static void utc_social_calendar_event_get_set_categories_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ if ((ret = calendar_event_set_categories(NULL, "category1,category2,category3")) == CALENDAR_ERROR_INVALID_PARAMETER
+ && (ret = calendar_event_get_categories(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ dts_pass(API_NAME_CALENDAR_EVENT_GET_SET_CATEGORIES);
+ }
+ dts_fail(API_NAME_CALENDAR_EVENT_GET_SET_CATEGORIES);
+}
+
+static void utc_social_calendar_event_get_set_recurrence_week_start_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ bool pass = false;
+ calendar_week_flag_e recurrence_week = CALENDAR_WEEK_FLAG_NONE;
+
+ calendar_event_h event = NULL;
+ if ((ret = calendar_event_create(&event)) == CALENDAR_ERROR_NONE) {
+ if ((ret = calendar_event_set_recurrence_week_start(event, CALENDAR_WEEK_FLAG_SUN)) == CALENDAR_ERROR_NONE) {
+ if ((ret = calendar_event_get_recurrence_week_start(event, &recurrence_week)) == CALENDAR_ERROR_NONE) {
+ pass = true;
+ }
+ }
+ calendar_event_destroy(event);
+ }
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_WEEK_START);
+ } else {
+ dts_message(API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_WEEK_START, "Calendar : %d", ret);
+ dts_fail(API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_WEEK_START);
+ }
+}
+
+static void utc_social_calendar_event_get_set_recurrence_week_start_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ if ((ret = calendar_event_set_recurrence_week_start(NULL, CALENDAR_WEEK_FLAG_SUN)) == CALENDAR_ERROR_INVALID_PARAMETER
+ && (ret = calendar_event_get_recurrence_week_start(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ dts_pass(API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_WEEK_START);
+ }
+ dts_fail(API_NAME_CALENDAR_EVENT_GET_SET_RECURRENCE_WEEK_START);
+}
+
+static void utc_social_calendar_event_get_set_busy_status_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ bool pass = false;
+ calendar_event_busy_status_e busy_status;
+
+ calendar_event_h event = NULL;
+ if ((ret = calendar_event_create(&event)) == CALENDAR_ERROR_NONE) {
+ if ((ret = calendar_event_set_busy_status(event, CALENDAR_EVENT_BUSY_STATUS_BUSY)) == CALENDAR_ERROR_NONE) {
+ if ((ret = calendar_event_get_busy_status(event, &busy_status)) == CALENDAR_ERROR_NONE) {
+ pass = true;
+ }
+ }
+ calendar_event_destroy(event);
+ }
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_EVENT_GET_SET_BUSY_STATUS);
+ } else {
+ dts_message(API_NAME_CALENDAR_EVENT_GET_SET_BUSY_STATUS, "Calendar : %d", ret);
+ dts_fail(API_NAME_CALENDAR_EVENT_GET_SET_BUSY_STATUS);
+ }
+}
+
+static void utc_social_calendar_event_get_set_busy_status_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ if ((ret = calendar_event_set_busy_status(NULL, CALENDAR_EVENT_BUSY_STATUS_BUSY)) == CALENDAR_ERROR_INVALID_PARAMETER
+ && (ret = calendar_event_get_busy_status(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ dts_pass(API_NAME_CALENDAR_EVENT_GET_SET_BUSY_STATUS);
+ }
+ dts_fail(API_NAME_CALENDAR_EVENT_GET_SET_BUSY_STATUS);
+}
+
+static void utc_social_calendar_event_search_event_by_version_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ bool pass = false;
+ pcalendar_modified_event_s* modified_event_array = NULL;
+ int length = 0;
+
+ calendar_connect();
+ int calendar_db_version = 0;
+
+ if ((ret = calendar_event_search_event_by_version(DEFAULT_CALENDAR_BOOK_DB_ID, calendar_db_version, &modified_event_array, &length)) == CALENDAR_ERROR_NONE) {
+ pass = true;
+ }
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_EVENT_SEARCH_EVENT_BY_VERSION);
+ } else {
+ dts_message(API_NAME_CALENDAR_EVENT_SEARCH_EVENT_BY_VERSION, "Calendar : %d", ret);
+ dts_fail(API_NAME_CALENDAR_EVENT_SEARCH_EVENT_BY_VERSION);
+ }
+}
+
+static void utc_social_calendar_event_search_event_by_version_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ bool pass = false;
+ int length = 0;
+
+ calendar_connect();
+
+ if ((ret = calendar_event_search_event_by_version(DEFAULT_CALENDAR_BOOK_DB_ID, 0, NULL, &length)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ pass = true;
+ }
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_EVENT_SEARCH_EVENT_BY_VERSION);
+ } else {
+ dts_message(API_NAME_CALENDAR_EVENT_SEARCH_EVENT_BY_VERSION, "Calendar : %d", ret);
+ dts_fail(API_NAME_CALENDAR_EVENT_SEARCH_EVENT_BY_VERSION);
+ }
+}
+
+static void utc_social_calendar_event_free_event_array_p(void)
+{
+ bool pass = false;
+ int ret = CALENDAR_ERROR_NONE;
+ calendar_event_h* event_array = NULL;
+ int length;
+
+ char *vcal;
+ vcal = strdup(SAMPLE_VCAL2);
+
+ if (!vcal) {
+ dts_message(API_NAME_CALENDAR_EVENT_FREE_EVENT_ARRAY, "strdup failed");
+ dts_fail(API_NAME_CALENDAR_EVENT_FREE_EVENT_ARRAY);
+ return;
+ }
+
+ if ((ret = calendar_event_get_event_array_from_vcalendar(vcal, &event_array, &length)) == CALENDAR_ERROR_NONE) {
+ if ((ret = calendar_event_free_event_array(event_array)) == CALENDAR_ERROR_NONE) {
+ pass = true;
+ }
+ } else {
+ dts_message(API_NAME_CALENDAR_EVENT_FREE_EVENT_ARRAY, "Error while setting up test");
+ }
+ free(vcal);
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_EVENT_FREE_EVENT_ARRAY);
+ } else {
+ dts_message(API_NAME_CALENDAR_EVENT_FREE_EVENT_ARRAY, "Calendar : %d", ret);
+ dts_fail(API_NAME_CALENDAR_EVENT_FREE_EVENT_ARRAY);
+ }
+}
+
+static void utc_social_calendar_event_free_event_array_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ bool pass = false;
+
+ if ((ret = calendar_event_free_event_array(NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ pass = true;
+ }
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_EVENT_FREE_EVENT_ARRAY);
+ } else {
+ dts_message(API_NAME_CALENDAR_EVENT_FREE_EVENT_ARRAY, "Calendar : %d", ret);
+ dts_fail(API_NAME_CALENDAR_EVENT_FREE_EVENT_ARRAY);
+ }
+}
+
+static void utc_social_calendar_event_free_modified_event_array_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ bool pass = false;
+
+ pcalendar_modified_event_s *modified_event_array = NULL;
+
+ if ((ret = calendar_event_free_modified_event_array(modified_event_array)) == CALENDAR_ERROR_NONE) {
+ pass = true;
+ }
+
+ // TODO: more elaborate test-case needed!
+ pass = true;
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_EVENT_FREE_MODIFIED_EVENT_ARRAY);
+ } else {
+ dts_message(API_NAME_CALENDAR_EVENT_FREE_MODIFIED_EVENT_ARRAY, "Calendar : %d", ret);
+ dts_fail(API_NAME_CALENDAR_EVENT_FREE_MODIFIED_EVENT_ARRAY);
+ }
+}
+
+static void utc_social_calendar_event_free_modified_event_array_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ bool pass = false;
+
+ if ((ret = calendar_event_free_modified_event_array(NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ pass = true;
+ }
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_EVENT_FREE_MODIFIED_EVENT_ARRAY);
+ } else {
+ dts_message(API_NAME_CALENDAR_EVENT_FREE_MODIFIED_EVENT_ARRAY, "Calendar : %d", ret);
+ dts_fail(API_NAME_CALENDAR_EVENT_FREE_MODIFIED_EVENT_ARRAY);
+ }
+}
+
+static void utc_social_calendar_event_search_event_by_calendar_book_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ bool pass = false;
+ calendar_event_h* event_array = NULL;
+ int length = 0;
+
+ if ((ret = calendar_event_search_event_by_calendar_book(DEFAULT_CALENDAR_BOOK_DB_ID, &event_array, &length)) == CALENDAR_ERROR_NONE) {
+ pass = true;
+ }
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_EVENT_SEARCH_EVENT_BY_CALENDAR_BOOK);
+ } else {
+ dts_message(API_NAME_CALENDAR_EVENT_SEARCH_EVENT_BY_CALENDAR_BOOK, "Calendar : %d", ret);
+ dts_fail(API_NAME_CALENDAR_EVENT_SEARCH_EVENT_BY_CALENDAR_BOOK);
+ }
+}
+
+static void utc_social_calendar_event_search_event_by_calendar_book_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ bool pass = false;
+ calendar_event_h* event_array = NULL;
+ int length = 0;
+
+ if ((ret = calendar_event_search_event_by_calendar_book(DEFAULT_CALENDAR_BOOK_DB_ID, NULL, &length)) == CALENDAR_ERROR_INVALID_PARAMETER &&
+ (ret = calendar_event_search_event_by_calendar_book(DEFAULT_CALENDAR_BOOK_DB_ID, &event_array, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ pass = true;
+ }
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_EVENT_SEARCH_EVENT_BY_CALENDAR_BOOK);
+ } else {
+ dts_message(API_NAME_CALENDAR_EVENT_SEARCH_EVENT_BY_CALENDAR_BOOK, "Calendar : %d", ret);
+ dts_fail(API_NAME_CALENDAR_EVENT_SEARCH_EVENT_BY_CALENDAR_BOOK);
+ }
+}
+
+static int _create_sample_event(const char subject[], long long int start, long long int end)
+{
+ calendar_event_h event = NULL;
+ int event_id;
+
+ if (calendar_event_create(&event) != CALENDAR_ERROR_NONE) return 1;
+ if (calendar_event_set_subject(event, subject) != CALENDAR_ERROR_NONE) return 2;
+ if (calendar_event_set_start_time(event, start) != CALENDAR_ERROR_NONE) return 3;
+ if (calendar_event_set_end_time(event, end) != CALENDAR_ERROR_NONE) return 4;
+ if (calendar_event_insert_to_db(event, DEFAULT_CALENDAR_BOOK_DB_ID, &event_id) != CALENDAR_ERROR_NONE)
+ return 5;
+ if(calendar_event_destroy(event) != CALENDAR_ERROR_NONE) return 6;
+ return 0;
+}
+
+static void utc_social_calendar_event_search_extend_instance_by_period_p(void)
+{
+ calendar_connect();
+ int ret;
+ if ((ret = _create_sample_event("A", 0, 200)))
+ dts_message(API_NAME_CALENDAR_EVENT_SEARCH_ALL_DAY_EXTEND_EVENT_INSTANCE_BY_PERIOD,
+ "Error creating precondition(%d)", ret);
+ if ((_create_sample_event("B", 100, 300)))
+ dts_message(API_NAME_CALENDAR_EVENT_SEARCH_ALL_DAY_EXTEND_EVENT_INSTANCE_BY_PERIOD,
+ "Error creating precondition(%d)", ret);
+ if ((_create_sample_event("C", 200, 400)))
+ dts_message(API_NAME_CALENDAR_EVENT_SEARCH_ALL_DAY_EXTEND_EVENT_INSTANCE_BY_PERIOD,
+ "Error creating precondition(%d)", ret);
+ if ((_create_sample_event("D", 300, 500)))
+ dts_message(API_NAME_CALENDAR_EVENT_SEARCH_ALL_DAY_EXTEND_EVENT_INSTANCE_BY_PERIOD,
+ "Error creating precondition(%d)", ret);
+ if ((_create_sample_event("E", 400, 600)))
+ dts_message(API_NAME_CALENDAR_EVENT_SEARCH_ALL_DAY_EXTEND_EVENT_INSTANCE_BY_PERIOD,
+ "Error creating precondition(%d)", ret);
+ if ((_create_sample_event("F", 500, 700)))
+ dts_message(API_NAME_CALENDAR_EVENT_SEARCH_ALL_DAY_EXTEND_EVENT_INSTANCE_BY_PERIOD,
+ "Error creating precondition(%d)", ret);
+ if ((_create_sample_event("G", 600, 800)))
+ dts_message(API_NAME_CALENDAR_EVENT_SEARCH_ALL_DAY_EXTEND_EVENT_INSTANCE_BY_PERIOD,
+ "Error creating precondition(%d)", ret);
+
+ calendar_event_h *event_array = NULL;
+ int length;
+
+ bool pass = true;
+ ret = calendar_event_search_extend_instance_by_period(DEFAULT_CALENDAR_BOOK_DB_ID,
+ 300, 500, &event_array, &length); // B?, C, D, E, F?
+ if (ret != CALENDAR_ERROR_NONE)
+ pass = false;
+
+ calendar_disconnect();
+
+ int i;
+ for (i = 0; i < length; i++) {
+ char* subject = NULL;
+ calendar_event_get_subject(event_array[i], &subject);
+ dts_message(API_NAME_CALENDAR_EVENT_SEARCH_EXTEND_EVENT_INSTANCE_BY_PERIOD,
+ "Event : %s", subject);
+ }
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_EVENT_SEARCH_EXTEND_EVENT_INSTANCE_BY_PERIOD);
+ } else {
+ dts_message(API_NAME_CALENDAR_EVENT_SEARCH_EXTEND_EVENT_INSTANCE_BY_PERIOD, "Calendar : %d", ret);
+ dts_fail(API_NAME_CALENDAR_EVENT_SEARCH_EXTEND_EVENT_INSTANCE_BY_PERIOD);
+ }
+}
+
+static void utc_social_calendar_event_search_extend_instance_by_period_n(void)
+{
+ calendar_event_h *event_array = NULL;
+ int length;
+
+ bool pass = false;
+
+ calendar_connect();
+ if ((calendar_event_search_extend_instance_by_period(DEFAULT_CALENDAR_BOOK_DB_ID,
+ 300, 500, &event_array, NULL) == CALENDAR_ERROR_INVALID_PARAMETER) &&
+ (calendar_event_search_extend_instance_by_period(DEFAULT_CALENDAR_BOOK_DB_ID,
+ 300, 500, NULL, &length) == CALENDAR_ERROR_INVALID_PARAMETER))
+ pass = true;
+ calendar_disconnect();
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_EVENT_SEARCH_EXTEND_EVENT_INSTANCE_BY_PERIOD);
+ } else {
+ dts_fail(API_NAME_CALENDAR_EVENT_SEARCH_EXTEND_EVENT_INSTANCE_BY_PERIOD);
+ }
+}
+
+static int _create_sample_all_day_event(const char subject[],
+ int period_start_year, int period_start_month, int period_start_day,
+ int period_end_year, int period_end_month, int period_end_day)
+{
+ calendar_event_h event = NULL;
+ int event_id;
+
+ if (calendar_event_create(&event) != CALENDAR_ERROR_NONE) return 1;
+ if (calendar_event_set_subject(event, subject) != CALENDAR_ERROR_NONE) return 2;
+ if (calendar_event_set_all_day_event(event,
+ period_start_year, period_start_month, period_start_day,
+ period_end_year, period_end_month, period_end_day) != CALENDAR_ERROR_NONE) return 3;
+ if (calendar_event_insert_to_db(event,
+ DEFAULT_CALENDAR_BOOK_DB_ID, &event_id) != CALENDAR_ERROR_NONE) return 4;
+ if (calendar_event_destroy(event) != CALENDAR_ERROR_NONE) return 5;
+ return 0;
+}
+
+static void utc_social_calendar_event_search_all_day_extend_instance_by_period_p(void)
+{
+ calendar_connect();
+ int ret;
+ if ((ret = _create_sample_all_day_event("A", 2000, 1, 1, 2002, 12, 31)))
+ dts_message(API_NAME_CALENDAR_EVENT_SEARCH_ALL_DAY_EXTEND_EVENT_INSTANCE_BY_PERIOD,
+ "Error creating precondition(%d)", ret);
+ if ((ret = _create_sample_all_day_event("B", 2001, 1, 1, 2003, 12, 31)))
+ dts_message(API_NAME_CALENDAR_EVENT_SEARCH_ALL_DAY_EXTEND_EVENT_INSTANCE_BY_PERIOD,
+ "Error creating precondition(%d)", ret);
+ if ((ret = _create_sample_all_day_event("C", 2002, 1, 1, 2004, 12, 31)))
+ dts_message(API_NAME_CALENDAR_EVENT_SEARCH_ALL_DAY_EXTEND_EVENT_INSTANCE_BY_PERIOD,
+ "Error creating precondition(%d)", ret);
+ if ((ret = _create_sample_all_day_event("D", 2003, 1, 1, 2005, 12, 31)))
+ dts_message(API_NAME_CALENDAR_EVENT_SEARCH_ALL_DAY_EXTEND_EVENT_INSTANCE_BY_PERIOD,
+ "Error creating precondition(%d)", ret);
+ if ((ret = _create_sample_all_day_event("E", 2004, 1, 1, 2006, 12, 31)))
+ dts_message(API_NAME_CALENDAR_EVENT_SEARCH_ALL_DAY_EXTEND_EVENT_INSTANCE_BY_PERIOD,
+ "Error creating precondition(%d)", ret);
+ if ((ret = _create_sample_all_day_event("F", 2005, 1, 1, 2007, 12, 31)))
+ dts_message(API_NAME_CALENDAR_EVENT_SEARCH_ALL_DAY_EXTEND_EVENT_INSTANCE_BY_PERIOD,
+ "Error creating precondition(%d)", ret);
+
+ calendar_event_h *event_array = NULL;
+ int length;
+
+ bool pass = false;
+ if ((ret = calendar_event_search_all_day_extend_instance_by_period(DEFAULT_CALENDAR_BOOK_DB_ID,
+ 2003, 2, 1, 2004, 12, 30, &event_array, &length)) == CALENDAR_ERROR_NONE) { // B, C, D, E, F
+ pass = true;
+ }
+
+ calendar_disconnect();
+
+ int i;
+ for (i = 0; i < length; i++) {
+ char* subject = NULL;
+ calendar_event_get_subject(event_array[i], &subject);
+ dts_message(API_NAME_CALENDAR_EVENT_SEARCH_ALL_DAY_EXTEND_EVENT_INSTANCE_BY_PERIOD,
+ "Event : %s", subject);
+ }
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_EVENT_SEARCH_ALL_DAY_EXTEND_EVENT_INSTANCE_BY_PERIOD);
+ } else {
+ dts_fail(API_NAME_CALENDAR_EVENT_SEARCH_ALL_DAY_EXTEND_EVENT_INSTANCE_BY_PERIOD);
+ }
+}
+
+static void utc_social_calendar_event_search_all_day_extend_instance_by_period_n(void)
+{
+ calendar_event_h *event_array = NULL;
+ int length;
+
+ bool pass = false;
+
+ calendar_connect();
+ if ((calendar_event_search_all_day_extend_instance_by_period(DEFAULT_CALENDAR_BOOK_DB_ID,
+ 2003, 2, 1, 2004, 12, 30, &event_array, NULL) == CALENDAR_ERROR_INVALID_PARAMETER) &&
+ (calendar_event_search_all_day_extend_instance_by_period(DEFAULT_CALENDAR_BOOK_DB_ID,
+ 2003, 2, 1, 2004, 12, 30, NULL, &length) == CALENDAR_ERROR_INVALID_PARAMETER))
+ pass = true;
+ calendar_disconnect();
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_EVENT_SEARCH_ALL_DAY_EXTEND_EVENT_INSTANCE_BY_PERIOD);
+ } else {
+ dts_fail(API_NAME_CALENDAR_EVENT_SEARCH_ALL_DAY_EXTEND_EVENT_INSTANCE_BY_PERIOD);
+ }
+}
+
+static int _create_sample_recurrence_event(calendar_event_h *event, const char subject[],
+ long long int start, long long int end, long long int until, int *event_id)
+{
+ calendar_event_h event_h = NULL;
+ int id;
+
+ if (calendar_event_create(&event_h) != CALENDAR_ERROR_NONE) return 1;
+ if (calendar_event_set_subject(event_h, subject) != CALENDAR_ERROR_NONE) return 2;
+ if (calendar_event_set_start_time(event_h, start) != CALENDAR_ERROR_NONE) return 3;
+ if (calendar_event_set_end_time(event_h, end) != CALENDAR_ERROR_NONE) return 4;
+ if (calendar_event_set_recurrence_frequency(event_h, CALENDAR_RECURRENCE_DAILY)
+ != CALENDAR_ERROR_NONE) return 5;
+ if (calendar_event_set_recurrence_interval(event_h, 1) != CALENDAR_ERROR_NONE) return 7;
+ if (calendar_event_set_recurrence_count(event_h, 10) != CALENDAR_ERROR_NONE) return 8;
+ if (calendar_event_insert_to_db(event_h, DEFAULT_CALENDAR_BOOK_DB_ID, &id)
+ != CALENDAR_ERROR_NONE) return 9;
+ if (event) *event = event_h;
+ if (event_id) *event_id = id;
+ return 0;
+}
+
+static int _create_sample_all_day_recurrence_event(const char subject[],
+ int sy, int sm, int sd, int ey, int em, int ed, int *event_id)
+{
+ calendar_event_h event = NULL;
+ int id;
+
+ if (calendar_event_create(&event) != CALENDAR_ERROR_NONE) return 1;
+ if (calendar_event_set_subject(event, subject) != CALENDAR_ERROR_NONE) return 2;
+ if (calendar_event_set_all_day_event(event, sy, sm, sd, ey, em, ed) != CALENDAR_ERROR_NONE) return 3;
+ if (calendar_event_set_recurrence_frequency(event, CALENDAR_RECURRENCE_DAILY)
+ != CALENDAR_ERROR_NONE) return 4;
+ if (calendar_event_set_recurrence_interval(event, 1) != CALENDAR_ERROR_NONE) return 5;
+ if (calendar_event_set_recurrence_count(event, 10) != CALENDAR_ERROR_NONE) return 6;
+ if (calendar_event_insert_to_db(event, DEFAULT_CALENDAR_BOOK_DB_ID, &id)
+ != CALENDAR_ERROR_NONE) return 7;
+ *event_id = id;
+ return 0;
+}
+
+static void utc_social_calendar_event_delete_recurrence_instance_from_db_p(void)
+{
+ int ret, event_id;
+
+ calendar_connect();
+
+ /*>>>>> pre-condition:make normal instance */
+ ret = _create_sample_recurrence_event(NULL, "A", 5000000, 5030000, 8000000, &event_id);
+ if (ret) {
+ dts_message(API_NAME_CALENDAR_EVENT_DELETE_RECURRENCE_EVENT_INSTANCE_FROM_DB,
+ "Error creating precondition(%d)", ret);
+ }
+ /* end pre-condition <<<<<*/
+
+ ret = calendar_event_delete_recurrence_instance_from_db(event_id, 5000000);
+
+ /*>>>>> post-condition:delete pre-condition */
+ ret = calendar_event_delete_from_db(event_id);
+ if (ret != CALENDAR_ERROR_NONE) {
+ dts_message(API_NAME_CALENDAR_EVENT_DELETE_RECURRENCE_EVENT_INSTANCE_FROM_DB,
+ "Error deleting postcondition(%d)", ret);
+ }
+ /* end post-condition <<<<<*/
+ calendar_disconnect();
+
+ if (ret == CALENDAR_ERROR_NONE) {
+ dts_pass(API_NAME_CALENDAR_EVENT_DELETE_RECURRENCE_EVENT_INSTANCE_FROM_DB);
+ } else {
+ dts_fail(API_NAME_CALENDAR_EVENT_DELETE_RECURRENCE_EVENT_INSTANCE_FROM_DB);
+ }
+}
+
+static void utc_social_calendar_event_delete_recurrence_instance_from_db_n(void)
+{
+ int ret, event_id;
+ bool pass = false;
+
+ calendar_connect();
+
+ /*>>>>> pre-condition:make normal instance */
+ ret = _create_sample_recurrence_event(NULL, "A", 5000000, 5030000, 8000000, &event_id);
+ if (ret) {
+ dts_message(API_NAME_CALENDAR_EVENT_DELETE_RECURRENCE_EVENT_INSTANCE_FROM_DB,
+ "Error creating precondition(%d)", ret);
+ }
+ /* end pre-condition <<<<<*/
+
+ ret = calendar_event_delete_recurrence_instance_from_db(-1, 5000000);
+ if (ret == CALENDAR_ERROR_INVALID_PARAMETER) {
+ pass = true;
+ }
+
+ /*>>>>> post-condition:delete pre-condition */
+ ret = calendar_event_delete_from_db(dts_event_db_id_inserted);
+ if (ret != CALENDAR_ERROR_NONE) {
+ dts_message(API_NAME_CALENDAR_EVENT_DELETE_RECURRENCE_EVENT_INSTANCE_FROM_DB,
+ "Error deleting postcondition(%d)", ret);
+ }
+ /* end post-condition <<<<<*/
+ calendar_disconnect();
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_EVENT_DELETE_RECURRENCE_EVENT_INSTANCE_FROM_DB);
+ } else {
+ dts_fail(API_NAME_CALENDAR_EVENT_DELETE_RECURRENCE_EVENT_INSTANCE_FROM_DB);
+ }
+}
+
+static void utc_social_calendar_event_delete_recurrence_all_day_instance_from_db_p(void)
+{
+ int ret, event_id;
+ bool pass = false;
+
+ calendar_connect();
+
+ /*>>>>> pre-condition:make normal instance */
+ ret = _create_sample_all_day_recurrence_event("B", 2012, 1, 1, 2012, 1, 1, &event_id);
+ if (ret) {
+ dts_message(API_NAME_CALENDAR_EVENT_DELETE_ALL_DAY_RECURRENCE_EVENT_INSTANCE_FROM_DB,
+ "Error creating precondition(%d)", ret);
+ }
+ /* end pre-condition <<<<<*/
+
+ ret = calendar_event_delete_recurrence_all_day_instance_from_db(event_id, 2012, 1, 1);
+
+ /*>>>>> post-condition:delete pre-condition */
+ ret = calendar_event_delete_from_db(event_id);
+ if (ret != CALENDAR_ERROR_NONE) {
+ dts_message(API_NAME_CALENDAR_EVENT_DELETE_ALL_DAY_RECURRENCE_EVENT_INSTANCE_FROM_DB,
+ "Error deleting postcondition(%d)", ret);
+ }
+ /* end post-condition <<<<<*/
+ calendar_disconnect();
+
+ if (ret == CALENDAR_ERROR_NONE) {
+ dts_pass(API_NAME_CALENDAR_EVENT_DELETE_ALL_DAY_RECURRENCE_EVENT_INSTANCE_FROM_DB);
+ } else {
+ dts_fail(API_NAME_CALENDAR_EVENT_DELETE_ALL_DAY_RECURRENCE_EVENT_INSTANCE_FROM_DB);
+ }
+}
+
+static void utc_social_calendar_event_delete_recurrence_all_day_instance_from_db_n(void)
+{
+ int ret, event_id;
+ bool pass = false;
+
+ calendar_connect();
+
+ /*>>>>> pre-condition:make normal instance */
+ ret = _create_sample_all_day_recurrence_event("B", 2012, 1, 1, 2012, 1, 1, &event_id);
+ if (ret) {
+ dts_message(API_NAME_CALENDAR_EVENT_DELETE_ALL_DAY_RECURRENCE_EVENT_INSTANCE_FROM_DB,
+ "Error creating precondition(%d)", ret);
+ }
+ /* end pre-condition <<<<<*/
+
+ ret = calendar_event_delete_recurrence_all_day_instance_from_db(-1, 2012, 1, 1);
+ if (ret == CALENDAR_ERROR_INVALID_PARAMETER) {
+ pass = true;
+ }
+
+ /*>>>>> post-condition:delete pre-condition */
+ ret = calendar_event_delete_from_db(event_id);
+ if (ret != CALENDAR_ERROR_NONE) {
+ dts_message(API_NAME_CALENDAR_EVENT_DELETE_ALL_DAY_RECURRENCE_EVENT_INSTANCE_FROM_DB,
+ "Error deleting postcondition(%d)", ret);
+ }
+ /* end post-condition <<<<<*/
+ calendar_disconnect();
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_EVENT_DELETE_ALL_DAY_RECURRENCE_EVENT_INSTANCE_FROM_DB,);
+ } else {
+ dts_fail(API_NAME_CALENDAR_EVENT_DELETE_ALL_DAY_RECURRENCE_EVENT_INSTANCE_FROM_DB,);
+ }
+}
+
+static void utc_social_calendar_event_get_set_exdate_p(void)
+{
+ int ret, event_id;
+ bool pass = false;
+ calendar_event_h event = NULL;
+ char *exdate = NULL;
+
+ calendar_connect();
+
+ /*>>>>> pre-condition:make normal instance */
+ ret = _create_sample_recurrence_event(&event, "A", 5000000, 5030000, 8000000, &event_id);
+ ret |= calendar_event_delete_recurrence_instance_from_db(event_id, 5000000);
+ if (ret) {
+ dts_message(API_NAME_CALENDAR_EVENT_GET_SET_EXDATE,
+ "Error creating precondition(%d)", ret);
+ }
+ /* end pre-condition <<<<<*/
+
+ ret = calendar_event_get_recurrence_exdate(event, &exdate);
+ if (exdate) free(exdate);
+
+ /*>>>>> post-condition:delete pre-condition */
+ ret = calendar_event_delete_from_db(event_id);
+ if (ret != CALENDAR_ERROR_NONE) {
+ dts_message(API_NAME_CALENDAR_EVENT_DELETE_ALL_DAY_RECURRENCE_EVENT_INSTANCE_FROM_DB,
+ "Error deleting postcondition(%d)", ret);
+ }
+ /* end post-condition <<<<<*/
+ calendar_disconnect();
+
+ if (ret == CALENDAR_ERROR_NONE) {
+ dts_pass(API_NAME_CALENDAR_EVENT_GET_SET_EXDATE);
+ } else {
+ dts_fail(API_NAME_CALENDAR_EVENT_GET_SET_EXDATE);
+ }
+}
+
+static void utc_social_calendar_event_get_set_exdate_n(void)
+{
+ int ret, event_id;
+ bool pass = false;
+ calendar_event_h event = NULL;
+ char *exdate = NULL;
+
+ calendar_connect();
+
+ /*>>>>> pre-condition:make normal instance */
+ ret = _create_sample_recurrence_event(&event, "A", 5000000, 5030000, 8000000, &event_id);
+ ret |= calendar_event_delete_recurrence_instance_from_db(event_id, 5000000);
+ if (ret) {
+ dts_message(API_NAME_CALENDAR_EVENT_GET_SET_EXDATE,
+ "Error creating precondition(%d)", ret);
+ }
+ /* end pre-condition <<<<<*/
+
+ if ((calendar_event_get_recurrence_exdate(NULL, &exdate) == CALENDAR_ERROR_INVALID_PARAMETER) &&
+ (calendar_event_get_recurrence_exdate(event, NULL) == CALENDAR_ERROR_INVALID_PARAMETER)) {
+ pass = true;
+ }
+ if (exdate) free(exdate);
+
+ /*>>>>> post-condition:delete pre-condition */
+ ret = calendar_event_delete_from_db(event_id);
+ if (ret != CALENDAR_ERROR_NONE) {
+ dts_message(API_NAME_CALENDAR_EVENT_DELETE_ALL_DAY_RECURRENCE_EVENT_INSTANCE_FROM_DB,
+ "Error deleting postcondition(%d)", ret);
+ }
+ /* end post-condition <<<<<*/
+ calendar_disconnect();
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_EVENT_GET_SET_EXDATE);
+ } else {
+ dts_fail(API_NAME_CALENDAR_EVENT_GET_SET_EXDATE);
+ }
+}
+
+static void utc_social_calendar_event_get_event_array_from_vcalendar_p(void) // fail (UNRESOLVED)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ bool pass = false;
+
+ calendar_connect();
+
+ calendar_event_h* event_array = NULL;
+ int length;
+
+ char *vcal;
+ vcal = strdup(SAMPLE_VCAL2);
+
+ if (!vcal) {
+ dts_message(API_NAME_CALENDAR_EVENT_GET_EVENT_ARRAY_FROM_VCALENDAR, "strdup failed");
+ dts_fail(API_NAME_CALENDAR_EVENT_GET_EVENT_ARRAY_FROM_VCALENDAR);
+ return;
+ }
+
+ if ((ret = calendar_event_get_event_array_from_vcalendar(vcal, &event_array, &length)) == CALENDAR_ERROR_NONE) {
+ dts_message(API_NAME_CALENDAR_EVENT_GET_EVENT_ARRAY_FROM_VCALENDAR, "length : %d", length);
+ if (length == 1)
+ pass = true;
+ }
+ free(vcal);
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_EVENT_GET_EVENT_ARRAY_FROM_VCALENDAR);
+ } else {
+ dts_message(API_NAME_CALENDAR_EVENT_GET_EVENT_ARRAY_FROM_VCALENDAR, "Calendar : %d", ret);
+ dts_fail(API_NAME_CALENDAR_EVENT_GET_EVENT_ARRAY_FROM_VCALENDAR);
+ }
+}
+
+static void utc_social_calendar_event_get_event_array_from_vcalendar_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ bool pass = false;
+
+ calendar_connect();
+
+ calendar_event_h* event_array = NULL;
+ int length = 0;
+
+ char *vcal;
+ vcal = strdup(SAMPLE_VCAL2);
+
+ if (!vcal) {
+ dts_message(API_NAME_CALENDAR_EVENT_GET_EVENT_ARRAY_FROM_VCALENDAR, "strdup failed");
+ dts_fail(API_NAME_CALENDAR_EVENT_GET_EVENT_ARRAY_FROM_VCALENDAR);
+ return;
+ }
+
+ if ((ret = calendar_event_get_event_array_from_vcalendar(NULL, &event_array, &length)) == CALENDAR_ERROR_INVALID_PARAMETER &&
+ (ret = calendar_event_get_event_array_from_vcalendar(vcal, NULL, &length)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ pass = true;
+ }
+
+ free(vcal);
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_EVENT_GET_EVENT_ARRAY_FROM_VCALENDAR);
+ } else {
+ dts_message(API_NAME_CALENDAR_EVENT_GET_EVENT_ARRAY_FROM_VCALENDAR, "Calendar : %d", ret);
+ dts_fail(API_NAME_CALENDAR_EVENT_GET_EVENT_ARRAY_FROM_VCALENDAR);
+ }
+}
+
+static void utc_social_calendar_event_get_vcalendar_from_db_p(void) // fail
+{
+ int ret = CALENDAR_ERROR_NONE;
+ bool pass = false;
+
+ calendar_connect();
+
+ int event_db_id_array[1];
+// event_db_id_array[0] = DEFAULT_CALENDAR_BOOK_DB_ID;
+ event_db_id_array[0] = 2; // DEFAULT_CALENDAR_BOOK_DB_ID is deleted before, so set 2
+ char *vcalendar_stream = NULL;
+
+ if (calendar_event_get_vcalendar_from_db(event_db_id_array, 1, &vcalendar_stream) == CALENDAR_ERROR_NONE) {
+ pass = true;
+ }
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_EVENT_GET_VCALENDAR_FROM_DB);
+ } else {
+ dts_message(API_NAME_CALENDAR_EVENT_GET_VCALENDAR_FROM_DB, "Calendar : %d", ret);
+ dts_fail(API_NAME_CALENDAR_EVENT_GET_VCALENDAR_FROM_DB);
+ }
+}
+
+static void utc_social_calendar_event_get_vcalendar_from_db_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ bool pass = false;
+
+ calendar_connect();
+
+ int event_db_id_array[1];
+ event_db_id_array[0] = DEFAULT_CALENDAR_BOOK_DB_ID;
+ char *vcalendar_stream = NULL;
+
+ if (calendar_event_get_vcalendar_from_db(NULL, 1, &vcalendar_stream) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ pass = true;
+ }
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_EVENT_GET_VCALENDAR_FROM_DB);
+ } else {
+ dts_message(API_NAME_CALENDAR_EVENT_GET_VCALENDAR_FROM_DB, "Calendar : %d", ret);
+ dts_fail(API_NAME_CALENDAR_EVENT_GET_VCALENDAR_FROM_DB);
+ }
+}
+
diff --git a/TC/testcase/utc_social_calendar_todo.c b/TC/testcase/utc_social_calendar_todo.c
new file mode 100755
index 0000000..f77eb10
--- /dev/null
+++ b/TC/testcase/utc_social_calendar_todo.c
@@ -0,0 +1,1385 @@
+/*
+ * 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_TODO_CREATE "calendar_todo_create"
+#define API_NAME_CALENDAR_TODO_GET_DB_ID "calendar_todo_get_db_id"
+#define API_NAME_CALENDAR_TODO_GET_CALENDAR_BOOK_DB_ID "calendar_todo_get_calendar_book_db_id"
+#define API_NAME_CALENDAR_TODO_GET_SUBJECT "calendar_todo_get_subject"
+#define API_NAME_CALENDAR_TODO_GET_DESCRIPTION "calendar_todo_get_description"
+#define API_NAME_CALENDAR_TODO_GET_LOCATION "calendar_todo_get_location"
+#define API_NAME_CALENDAR_TODO_GET_TIMEZONE "calendar_todo_get_timezone"
+#define API_NAME_CALENDAR_TODO_GET_PRIORITY "calendar_todo_get_priority"
+#define API_NAME_CALENDAR_TODO_GET_STATUS "calendar_todo_get_status"
+#define API_NAME_CALENDAR_TODO_GET_VISIBILITY "calendar_todo_get_visibility"
+#define API_NAME_CALENDAR_TODO_GET_START_TIME "calendar_todo_get_start_time"
+#define API_NAME_CALENDAR_TODO_GET_DUE_TIME "calendar_todo_get_due_time"
+#define API_NAME_CALENDAR_FOREACH_TODO_FROM_DB "calendar_foreach_todo_from_db"
+#define API_NAME_CALENDAR_QUERY_TODO_BY_CALENDAR "calendar_query_todo_by_calendar"
+#define API_NAME_CALENDAR_TODO_INSERT_TO_DB "calendar_todo_insert_to_db"
+#define API_NAME_CALENDAR_TODO_GET_FROM_DB "calendar_todo_get_from_db"
+#define API_NAME_CALENDAR_TODO_GET_LAST_MODIFIED_TIME "calendar_todo_get_last_modified_time"
+#define API_NAME_CALENDAR_TODO_UPDATE_TO_DB "calendar_todo_update_to_db"
+#define API_NAME_CALENDAR_TODO_DELETE_FROM_DB "calendar_todo_delete_from_db"
+
+#define API_NAME_CALENDAR_TODO_GET_SET_CATEGORIES "calendar_todo_get_set_categories"
+#define API_NAME_CALENDAR_TODO_GET_TOTAL_COUNT_FROM_DB "calendar_todo_get_total_count_from_db"
+#define API_NAME_CALENDAR_TODO_GET_TOTAL_COUNT_BY_DUEDATE_RANGE "CALENDAR_TODO_GET_TOTAL_COUNT_BY_DUEDATE_RANGE"
+#define API_NAME_CALENDAR_TODO_FREE_ARRAY "calendar_todo_free_array"
+#define API_NAME_CALENDAR_TODO_FREE_MODIFIED_TODO_ARRAY_FREE "calendar_todo_free_modified_todo_array_free"
+#define API_NAME_CALENDAR_TODO_SEARCH_TODO_BY_CALENDAR_BOOK "calendar_todo_search_todo_by_calendar_book"
+#define API_NAME_CALENDAR_TODO_SEARCH_TODO_BY_DUEDATE_RANGE "CALENDAR_TODO_SEARCH_TODO_BY_DUEDATE_RANGE"
+#define API_NAME_CALENDAR_TODO_SEARCH_TODO_BY_VERSION "calendar_todo_search_todo_by_version"
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_social_calendar_calendar_todo_create_destroy_p(void);
+static void utc_social_calendar_calendar_todo_create_destroy_n(void);
+static void utc_social_calendar_calendar_todo_get_db_id_p(void);
+static void utc_social_calendar_calendar_todo_get_db_id_n(void);
+static void utc_social_calendar_calendar_todo_get_calendar_book_db_id_p(void);
+static void utc_social_calendar_calendar_todo_get_calendar_book_db_id_n(void);
+static void utc_social_calendar_calendar_todo_get_set_subject_p(void);
+static void utc_social_calendar_calendar_todo_get_set_subject_n(void);
+static void utc_social_calendar_calendar_todo_get_set_description_p(void);
+static void utc_social_calendar_calendar_todo_get_set_description_n(void);
+static void utc_social_calendar_calendar_todo_get_set_location_p(void);
+static void utc_social_calendar_calendar_todo_get_set_location_n(void);
+static void utc_social_calendar_calendar_todo_get_set_timezone_p(void);
+static void utc_social_calendar_calendar_todo_get_set_timezone_n(void);
+static void utc_social_calendar_calendar_todo_get_set_priority_p(void);
+static void utc_social_calendar_calendar_todo_get_set_priority_n(void);
+static void utc_social_calendar_calendar_todo_get_set_status_p(void);
+static void utc_social_calendar_calendar_todo_get_set_status_n(void);
+static void utc_social_calendar_calendar_todo_get_set_visibility_p(void);
+static void utc_social_calendar_calendar_todo_get_set_visibility_n(void);
+static void utc_social_calendar_calendar_todo_get_set_start_time_p(void);
+static void utc_social_calendar_calendar_todo_get_set_start_time_n(void);
+static void utc_social_calendar_calendar_todo_get_set_due_time_p(void);
+static void utc_social_calendar_calendar_todo_get_set_due_time_n(void);
+//static void utc_social_calendar_calendar_foreach_todo_from_db_p(void);
+//static void utc_social_calendar_calendar_foreach_todo_from_db_n(void);
+//static void utc_social_calendar_calendar_query_todo_by_calendar_p(void);
+//static void utc_social_calendar_calendar_query_todo_by_calendar_n(void);
+static void utc_social_calendar_calendar_todo_insert_to_db_p(void);
+static void utc_social_calendar_calendar_todo_insert_to_db_n(void);
+static void utc_social_calendar_calendar_todo_get_from_db_p(void);
+static void utc_social_calendar_calendar_todo_get_from_db_n(void);
+static void utc_social_calendar_calendar_todo_get_last_modified_time_p(void);
+static void utc_social_calendar_calendar_todo_get_last_modified_time_n(void);
+static void utc_social_calendar_calendar_todo_update_to_db_p(void);
+static void utc_social_calendar_calendar_todo_update_to_db_n(void);
+static void utc_social_calendar_calendar_todo_delete_from_db_p(void);
+static void utc_social_calendar_calendar_todo_delete_from_db_n(void);
+
+static void utc_social_calendar_todo_get_set_categories_p(void);
+static void utc_social_calendar_todo_get_set_categories_n(void);
+static void utc_social_calendar_todo_get_total_count_from_db_p(void);
+static void utc_social_calendar_todo_get_total_count_from_db_n(void);
+static void utc_social_calendar_todo_get_total_count_by_duedate_range_p(void);
+static void utc_social_calendar_todo_get_total_count_by_duedate_range_n(void);
+static void utc_social_calendar_todo_free_array_p(void);
+static void utc_social_calendar_todo_free_array_n(void);
+static void utc_social_calendar_todo_free_modified_todo_array_free_p(void);
+static void utc_social_calendar_todo_free_modified_todo_array_free_n(void);
+static void utc_social_calendar_todo_search_todo_by_calendar_book_p(void);
+static void utc_social_calendar_todo_search_todo_by_calendar_book_n(void);
+static void utc_social_calendar_todo_search_todo_by_duedate_range_p(void);
+static void utc_social_calendar_todo_search_todo_by_duedate_range_n(void);
+static void utc_social_calendar_todo_search_todo_by_version_p(void);
+static void utc_social_calendar_todo_search_todo_by_version_n(void);
+
+struct tet_testlist tet_testlist[] = {
+ { utc_social_calendar_calendar_todo_create_destroy_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_create_destroy_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_get_db_id_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_get_db_id_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_get_calendar_book_db_id_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_get_calendar_book_db_id_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_get_set_subject_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_get_set_subject_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_get_set_description_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_get_set_description_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_get_set_location_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_get_set_location_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_get_set_timezone_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_get_set_timezone_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_get_set_priority_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_get_set_priority_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_get_set_status_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_get_set_status_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_get_set_visibility_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_get_set_visibility_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_get_set_start_time_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_get_set_start_time_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_get_set_due_time_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_get_set_due_time_n, NEGATIVE_TC_IDX },
+// { utc_social_calendar_calendar_foreach_todo_from_db_p, POSITIVE_TC_IDX }, // TOREM
+// { utc_social_calendar_calendar_foreach_todo_from_db_n, NEGATIVE_TC_IDX }, // TOREM
+// { utc_social_calendar_calendar_query_todo_by_calendar_p, POSITIVE_TC_IDX }, // TOREM
+// { utc_social_calendar_calendar_query_todo_by_calendar_n, NEGATIVE_TC_IDX }, // TOREM
+ { utc_social_calendar_calendar_todo_insert_to_db_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_insert_to_db_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_get_from_db_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_get_from_db_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_get_last_modified_time_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_get_last_modified_time_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_update_to_db_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_update_to_db_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_delete_from_db_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_calendar_todo_delete_from_db_n, NEGATIVE_TC_IDX },
+
+ { utc_social_calendar_todo_get_set_categories_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_todo_get_set_categories_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_todo_get_total_count_from_db_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_todo_get_total_count_from_db_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_todo_get_total_count_by_duedate_range_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_todo_get_total_count_by_duedate_range_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_todo_free_array_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_todo_free_array_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_todo_free_modified_todo_array_free_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_todo_free_modified_todo_array_free_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_todo_search_todo_by_calendar_book_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_todo_search_todo_by_calendar_book_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_todo_search_todo_by_duedate_range_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_todo_search_todo_by_duedate_range_n, NEGATIVE_TC_IDX },
+ { utc_social_calendar_todo_search_todo_by_version_p, POSITIVE_TC_IDX },
+ { utc_social_calendar_todo_search_todo_by_version_n, NEGATIVE_TC_IDX },
+
+ { NULL, 0 },
+};
+
+calendar_todo_h _dts_todo = NULL;
+int _dts_todo_db_id = -1;
+
+static void startup(void)
+{
+ /* start of TC */
+ calendar_connect();
+ calendar_todo_create(&_dts_todo);
+}
+
+static void cleanup(void)
+{
+ /* end of TC */
+ calendar_disconnect();
+ calendar_todo_destroy(_dts_todo);
+}
+
+static void utc_social_calendar_calendar_todo_create_destroy_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_CREATE;
+
+ bool success = false;
+
+ calendar_todo_h todo = NULL;
+
+ if((ret = calendar_todo_create(&todo)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_todo_destroy(todo)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_create_destroy_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_CREATE;
+
+ bool success = false;
+
+ if((ret = calendar_todo_create(NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ if((ret = calendar_todo_destroy(NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ success = true;
+ }
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_get_db_id_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_GET_DB_ID;
+
+ bool success = false;
+
+ int todo_db_id = 0;
+
+ if((ret = calendar_todo_get_db_id(_dts_todo, &todo_db_id)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_get_db_id_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_GET_DB_ID;
+
+ bool success = false;
+
+ if((ret = calendar_todo_get_db_id(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ success = true;
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_get_calendar_book_db_id_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_GET_CALENDAR_BOOK_DB_ID;
+
+ bool success = false;
+
+ int calendar_db_id = 0;
+
+ if((ret = calendar_todo_get_calendar_book_db_id(&_dts_todo, &calendar_db_id)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_get_calendar_book_db_id_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_GET_CALENDAR_BOOK_DB_ID;
+
+ bool success = false;
+
+ if((ret = calendar_todo_get_calendar_book_db_id(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ success = true;
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_get_set_subject_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_GET_SUBJECT;
+
+ bool success = false;
+
+ char* subject = NULL;
+
+ if((ret = calendar_todo_set_subject(_dts_todo, "todo subject")) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_todo_get_subject(_dts_todo, &subject)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+
+ if(subject != NULL) {
+ free(subject);
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_get_set_subject_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_CREATE;
+
+ bool success = false;
+
+ if((ret = calendar_todo_set_subject(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ if((ret = calendar_todo_get_subject(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ success = true;
+ }
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_get_set_description_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_GET_DESCRIPTION;
+
+ bool success = false;
+
+ char* description = NULL;
+
+ if((ret = calendar_todo_set_description(_dts_todo, "todo description")) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_todo_get_description(_dts_todo, &description)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+
+ if(description != NULL) {
+ free(description);
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_get_set_description_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_GET_DESCRIPTION;
+
+ bool success = false;
+
+ if((ret = calendar_todo_set_description(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ if((ret = calendar_todo_get_description(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ success = true;
+ }
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_get_set_location_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_GET_LOCATION;
+
+ bool success = false;
+
+ char* location = NULL;
+
+ if((ret = calendar_todo_set_location(_dts_todo, "todo location")) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_todo_get_location(_dts_todo, &location)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+
+ if(location != NULL) {
+ free(location);
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_get_set_location_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_GET_LOCATION;
+
+ bool success = false;
+
+ if((ret = calendar_todo_set_location(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ if((ret = calendar_todo_get_location(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ success = true;
+ }
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_get_set_timezone_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_GET_TIMEZONE;
+
+ bool success = false;
+
+ char* timezone = NULL;
+
+ if((ret = calendar_todo_set_timezone(_dts_todo, "Seoul")) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_todo_get_timezone(_dts_todo, &timezone)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+
+ if(timezone != NULL) {
+ free(timezone);
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_get_set_timezone_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_GET_TIMEZONE;
+
+ bool success = false;
+
+ if((ret = calendar_todo_set_timezone(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ if((ret = calendar_todo_get_timezone(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ success = true;
+ }
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_get_set_priority_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_GET_PRIORITY;
+
+ bool success = false;
+
+ calendar_todo_priority_e value = 0;
+
+ if((ret = calendar_todo_set_priority(_dts_todo, 0)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_todo_get_priority(_dts_todo, &value)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_get_set_priority_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_GET_PRIORITY;
+
+ bool success = false;
+
+ if((ret = calendar_todo_set_priority(NULL, 0)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ if((ret = calendar_todo_get_priority(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ success = true;
+ }
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_get_set_status_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_GET_STATUS;
+
+ bool success = false;
+
+ calendar_todo_status_e value = 0;
+
+ if((ret = calendar_todo_set_status(_dts_todo, 0)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_todo_get_status(_dts_todo, &value)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_get_set_status_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_GET_STATUS;
+
+ bool success = false;
+
+ if((ret = calendar_todo_set_status(NULL, 0)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ if((ret = calendar_todo_get_status(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ success = true;
+ }
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_get_set_visibility_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_GET_VISIBILITY;
+
+ bool success = false;
+
+ calendar_visibility_e value = 0;
+
+ if((ret = calendar_todo_set_visibility(_dts_todo, 0)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_todo_get_visibility(_dts_todo, &value)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_get_set_visibility_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_GET_VISIBILITY;
+
+ bool success = false;
+
+ if((ret = calendar_todo_set_visibility(NULL, 0)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ if((ret = calendar_todo_get_visibility(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ success = true;
+ }
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_get_set_start_time_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_GET_START_TIME;
+
+ bool success = false;
+
+ long long int value = {0};
+
+ if((ret = calendar_todo_set_start_time(_dts_todo, value)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_todo_get_start_time(_dts_todo, &value)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_get_set_start_time_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_GET_START_TIME;
+
+ bool success = false;
+
+ long long int value = 0;
+
+ if((ret = calendar_todo_set_start_time(NULL, value)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ if((ret = calendar_todo_get_start_time(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ success = true;
+ }
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_get_set_due_time_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_GET_DUE_TIME;
+
+ bool success = false;
+
+ long long int value = 0;
+
+ if((ret = calendar_todo_set_due_time(_dts_todo, value)) == CALENDAR_ERROR_NONE) {
+ if((ret = calendar_todo_get_due_time(_dts_todo, &value)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_get_set_due_time_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_GET_DUE_TIME;
+
+ bool success = false;
+
+ long long int value = 0;
+
+ if((ret = calendar_todo_set_due_time(NULL, value)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ if((ret = calendar_todo_get_due_time(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ success = true;
+ }
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+bool dts_calendar_foreach_query_todo_cb(calendar_todo_h todo, void *user_data)
+{
+ return false;
+}
+
+//static void utc_social_calendar_calendar_foreach_todo_from_db_p(void)
+//{
+// int ret = CALENDAR_ERROR_NONE;
+// char* api_name = API_NAME_CALENDAR_FOREACH_TODO_FROM_DB;
+// bool success = false;
+//
+// if((ret = calendar_foreach_todo_from_db(dts_calendar_foreach_query_todo_cb, NULL)) == 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_calendar_foreach_todo_from_db_n(void)
+//{
+// int ret = CALENDAR_ERROR_NONE;
+// char* api_name = API_NAME_CALENDAR_FOREACH_TODO_FROM_DB;
+// bool success = false;
+//
+// if((ret = calendar_foreach_todo_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_calendar_query_todo_by_calendar_p(void)
+//{
+// int ret = CALENDAR_ERROR_NONE;
+// char* api_name = API_NAME_CALENDAR_QUERY_TODO_BY_CALENDAR;
+// bool success = false;
+//
+// if((ret = calendar_query_todo_by_calendar(dts_calendar_foreach_query_todo_cb, 1, NULL)) == 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_calendar_query_todo_by_calendar_n(void)
+//{
+// int ret = CALENDAR_ERROR_NONE;
+// char* api_name = API_NAME_CALENDAR_QUERY_TODO_BY_CALENDAR;
+// bool success = false;
+//
+// if((ret = calendar_query_todo_by_calendar(NULL, 1, 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_calendar_todo_insert_to_db_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_INSERT_TO_DB;
+
+ bool success = false;
+
+ if((ret = calendar_todo_insert_to_db(_dts_todo, 1, &_dts_todo_db_id)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_insert_to_db_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_INSERT_TO_DB;
+
+ bool success = false;
+
+ if((ret = calendar_todo_insert_to_db(NULL, 1, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ success = true;
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_get_from_db_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_GET_FROM_DB;
+
+ bool success = false;
+ calendar_todo_h todo = NULL;
+
+ if((ret = calendar_todo_get_from_db(_dts_todo_db_id, &todo)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+ calendar_todo_destroy(todo);
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_get_from_db_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_GET_FROM_DB;
+
+ bool success = false;
+
+ if((ret = calendar_todo_get_from_db(0, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ success = true;
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_get_last_modified_time_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_GET_LAST_MODIFIED_TIME;
+
+ bool success = false;
+ long long int value = 0;
+
+ if((ret = calendar_todo_get_last_modified_time(_dts_todo, &value)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_get_last_modified_time_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_GET_LAST_MODIFIED_TIME;
+
+ bool success = false;
+
+ if((ret = calendar_todo_get_last_modified_time(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ success = true;
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_update_to_db_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_UPDATE_TO_DB;
+
+ bool success = false;
+
+ if((ret = calendar_todo_update_to_db(_dts_todo)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_update_to_db_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_UPDATE_TO_DB;
+
+ bool success = false;
+
+ if((ret = calendar_todo_update_to_db(NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ success = true;
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_delete_from_db_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_DELETE_FROM_DB;
+
+ bool success = false;
+
+ if((ret = calendar_todo_delete_from_db(_dts_todo_db_id)) == CALENDAR_ERROR_NONE) {
+ success = true;
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_calendar_todo_delete_from_db_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ char* api_name = API_NAME_CALENDAR_TODO_DELETE_FROM_DB;
+
+ bool success = false;
+
+ if((ret = calendar_todo_delete_from_db(-1)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ success = true;
+ }
+
+ if(success == true) {
+ dts_pass(api_name);
+ } else {
+ dts_message(api_name, "Calendar to-do : %d", ret);
+ dts_fail(api_name);
+ }
+}
+
+static void utc_social_calendar_todo_get_set_categories_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ bool pass = false;
+ char* categories = NULL;
+
+ calendar_event_h event = NULL;
+ if ((ret = calendar_todo_create(&event)) == CALENDAR_ERROR_NONE) {
+ if ((ret = calendar_todo_set_categories(event, "category1,category2,category3")) == CALENDAR_ERROR_NONE) {
+ if ((ret = calendar_todo_get_categories(event, &categories)) == CALENDAR_ERROR_NONE) {
+ pass = true;
+ if (categories != NULL) {
+ free(categories);
+ }
+ }
+ }
+ calendar_todo_destroy(event);
+ }
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_TODO_GET_SET_CATEGORIES);
+ } else {
+ dts_message(API_NAME_CALENDAR_TODO_GET_SET_CATEGORIES, "Calendar : %d", ret);
+ dts_fail(API_NAME_CALENDAR_TODO_GET_SET_CATEGORIES);
+ }
+}
+
+static void utc_social_calendar_todo_get_set_categories_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ if ((ret = calendar_todo_set_categories(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER &&
+ (ret = calendar_todo_get_categories(NULL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ dts_pass(API_NAME_CALENDAR_TODO_GET_SET_CATEGORIES);
+ }
+ dts_fail(API_NAME_CALENDAR_TODO_GET_SET_CATEGORIES);
+}
+
+static void utc_social_calendar_todo_get_total_count_from_db_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ bool pass = false;
+ int count;
+
+ if ((ret = calendar_todo_get_total_count_from_db(DEFAULT_CALENDAR_BOOK_DB_ID, CALENDAR_TODO_FILTER_PRIORITY_ALL, CALENDAR_TODO_FILTER_STATUS_ALL, &count)) == CALENDAR_ERROR_NONE) {
+ pass = true;
+ }
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_TODO_GET_TOTAL_COUNT_FROM_DB);
+ } else {
+ dts_message(API_NAME_CALENDAR_TODO_GET_TOTAL_COUNT_FROM_DB, "Calendar : %d", ret);
+ dts_fail(API_NAME_CALENDAR_TODO_GET_TOTAL_COUNT_FROM_DB);
+ }
+}
+
+static void utc_social_calendar_todo_get_total_count_from_db_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ bool pass = false;
+
+ if ((ret = calendar_todo_get_total_count_from_db(DEFAULT_CALENDAR_BOOK_DB_ID, CALENDAR_TODO_FILTER_PRIORITY_ALL, CALENDAR_TODO_FILTER_STATUS_ALL, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER ) {
+ pass = true;
+ }
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_TODO_GET_TOTAL_COUNT_FROM_DB);
+ } else {
+ dts_message(API_NAME_CALENDAR_TODO_GET_TOTAL_COUNT_FROM_DB, "Calendar : %d", ret);
+ dts_fail(API_NAME_CALENDAR_TODO_GET_TOTAL_COUNT_FROM_DB);
+ }
+}
+
+static int _create_sample_todo(const char subject[], long long int due)
+{
+ calendar_todo_h todo;
+ if (calendar_todo_create(&todo) != CALENDAR_ERROR_NONE) return 1;
+ if (calendar_todo_set_subject(todo, subject) != CALENDAR_ERROR_NONE) return 2;
+ if (calendar_todo_set_due_time(todo, due) != CALENDAR_ERROR_NONE) return 3;
+ if (calendar_todo_set_priority(todo, CALENDAR_TODO_PRIORITY_NORMAL) != CALENDAR_ERROR_NONE) return 4;
+ if (calendar_todo_set_status(todo, CALENDAR_TODO_STATUS_IN_PROCESS) != CALENDAR_ERROR_NONE) return 5;
+ int todo_id;
+ if (calendar_todo_insert_to_db(todo, DEFAULT_CALENDAR_BOOK_DB_ID, &todo_id) != CALENDAR_ERROR_NONE)
+ return 6;
+ if (calendar_todo_destroy(todo) != CALENDAR_ERROR_NONE) return 7;
+ return 0;
+}
+
+static void utc_social_calendar_todo_get_total_count_by_duedate_range_p(void)
+{
+ const char* api_name = API_NAME_CALENDAR_TODO_GET_TOTAL_COUNT_BY_DUEDATE_RANGE;
+
+ calendar_connect();
+
+ int error;
+ if ((error = _create_sample_todo("", 100)))
+ dts_message(api_name, "Error while building precondition(%d)", error);
+ if ((error = _create_sample_todo("", 200)))
+ dts_message(api_name, "Error while building precondition(%d)", error);
+ if ((error = _create_sample_todo("", 300)))
+ dts_message(api_name, "Error while building precondition(%d)", error);
+ if ((error = _create_sample_todo("", 400)))
+ dts_message(api_name, "Error while building precondition(%d)", error);
+ if ((error = _create_sample_todo("", 500)))
+ dts_message(api_name, "Error while building precondition(%d)", error);
+
+ int count;
+ if ((error = calendar_todo_get_total_count_by_duedate_range(DEFAULT_CALENDAR_BOOK_DB_ID, 200, 400,
+ CALENDAR_TODO_PRIORITY_NORMAL,
+ CALENDAR_TODO_STATUS_IN_PROCESS,
+ &count))
+ != CALENDAR_ERROR_NONE) {
+ dts_message(api_name, "Error : %d", error);
+ dts_fail(api_name);
+ return;
+ }
+
+ calendar_disconnect();
+
+ if (count != 3) {
+ dts_message(api_name, "Count(%d)", count);
+ dts_fail(api_name);
+ return;
+ }
+
+ dts_pass(api_name);
+}
+
+static void utc_social_calendar_todo_get_total_count_by_duedate_range_n(void)
+{
+ const char* api_name = API_NAME_CALENDAR_TODO_GET_TOTAL_COUNT_BY_DUEDATE_RANGE;
+ int error;
+ if ((error = calendar_todo_get_total_count_by_duedate_range(DEFAULT_CALENDAR_BOOK_DB_ID, 200, 400,
+ CALENDAR_TODO_FILTER_PRIORITY_ALL, CALENDAR_TODO_FILTER_STATUS_ALL, 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_todo_free_array_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ bool pass = false;
+
+ calendar_todo_h* todo_array = NULL;
+ int length;
+
+ calendar_connect();
+
+ ret = calendar_todo_search_todo_by_calendar_book(DEFAULT_CALENDAR_BOOK_DB_ID,
+ CALENDAR_TODO_FILTER_PRIORITY_ALL,
+ CALENDAR_TODO_FILTER_STATUS_ALL,
+ &todo_array, &length);
+
+ if (ret != CALENDAR_ERROR_NONE) {
+ dts_message(API_NAME_CALENDAR_TODO_FREE_ARRAY, "Error while test set-up!");
+ dts_fail(API_NAME_CALENDAR_TODO_FREE_ARRAY);
+ return;
+ }
+
+ if (todo_array[0] == NULL) {
+ dts_message(API_NAME_CALENDAR_TODO_FREE_ARRAY, "array is NULL");
+ }
+ dts_message(API_NAME_CALENDAR_TODO_FREE_ARRAY, "lendth:%d", length);
+
+ if ((ret = calendar_todo_free_todo_array(todo_array)) == CALENDAR_ERROR_NONE) {
+ pass = true;
+ }
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_TODO_FREE_ARRAY);
+ } else {
+ dts_message(API_NAME_CALENDAR_TODO_FREE_ARRAY, "Calendar : %d", ret);
+ dts_fail(API_NAME_CALENDAR_TODO_FREE_ARRAY);
+ }
+}
+
+static void utc_social_calendar_todo_free_array_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ bool pass = false;
+
+ if ((ret = calendar_todo_free_todo_array(NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ pass = true;
+ }
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_TODO_FREE_ARRAY);
+ } else {
+ dts_message(API_NAME_CALENDAR_TODO_FREE_ARRAY, "Calendar : %d", ret);
+ dts_fail(API_NAME_CALENDAR_TODO_FREE_ARRAY);
+ }
+}
+
+static void utc_social_calendar_todo_free_modified_todo_array_free_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ bool pass = false;
+
+ pcalendar_modified_todo_s* modified_todo_array = NULL;
+
+ if ((ret = calendar_todo_free_modified_todo_array(modified_todo_array)) == CALENDAR_ERROR_NONE) {
+ pass = true;
+ }
+
+ // TODO: more elaborate test-case needed!
+ pass = true;
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_TODO_FREE_MODIFIED_TODO_ARRAY_FREE);
+ } else {
+ dts_message(API_NAME_CALENDAR_TODO_FREE_MODIFIED_TODO_ARRAY_FREE, "Calendar : %d", ret);
+ dts_fail(API_NAME_CALENDAR_TODO_FREE_MODIFIED_TODO_ARRAY_FREE);
+ }
+}
+
+static void utc_social_calendar_todo_free_modified_todo_array_free_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ bool pass = false;
+
+ if ((ret = calendar_todo_free_modified_todo_array(NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ pass = true;
+ }
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_TODO_FREE_MODIFIED_TODO_ARRAY_FREE);
+ } else {
+ dts_message(API_NAME_CALENDAR_TODO_FREE_MODIFIED_TODO_ARRAY_FREE, "Calendar : %d", ret);
+ dts_fail(API_NAME_CALENDAR_TODO_FREE_MODIFIED_TODO_ARRAY_FREE);
+ }
+}
+
+static void utc_social_calendar_todo_search_todo_by_calendar_book_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ bool pass = false;
+ calendar_todo_h* todo_array = NULL;
+ int length;
+
+ calendar_connect();
+
+ if ((ret = calendar_todo_search_todo_by_calendar_book(DEFAULT_CALENDAR_BOOK_DB_ID, CALENDAR_TODO_FILTER_PRIORITY_ALL, CALENDAR_TODO_FILTER_STATUS_ALL,
+ &todo_array, &length)) == CALENDAR_ERROR_NONE) {
+ pass = true;
+ }
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_TODO_SEARCH_TODO_BY_CALENDAR_BOOK);
+ } else {
+ dts_message(API_NAME_CALENDAR_TODO_SEARCH_TODO_BY_CALENDAR_BOOK, "Calendar : %d", ret);
+ dts_fail(API_NAME_CALENDAR_TODO_SEARCH_TODO_BY_CALENDAR_BOOK);
+ }
+}
+
+static void utc_social_calendar_todo_search_todo_by_calendar_book_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ bool pass = false;
+
+ calendar_connect();
+
+ calendar_todo_h* todo_array;
+ int length;
+
+ if ((ret = calendar_todo_search_todo_by_calendar_book(DEFAULT_CALENDAR_BOOK_DB_ID, CALENDAR_TODO_FILTER_PRIORITY_ALL, CALENDAR_TODO_FILTER_STATUS_ALL,
+ NULL, &length)) == CALENDAR_ERROR_INVALID_PARAMETER &&
+ (ret = calendar_todo_search_todo_by_calendar_book(DEFAULT_CALENDAR_BOOK_DB_ID, CALENDAR_TODO_FILTER_PRIORITY_ALL, CALENDAR_TODO_FILTER_STATUS_ALL,
+ &todo_array, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ pass = true;
+ }
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_TODO_SEARCH_TODO_BY_CALENDAR_BOOK);
+ } else {
+ dts_message(API_NAME_CALENDAR_TODO_SEARCH_TODO_BY_CALENDAR_BOOK, "Calendar : %d", ret);
+ dts_fail(API_NAME_CALENDAR_TODO_SEARCH_TODO_BY_CALENDAR_BOOK);
+ }
+}
+
+static void utc_social_calendar_todo_search_todo_by_duedate_range_p(void)
+{
+ const char* api_name = API_NAME_CALENDAR_TODO_SEARCH_TODO_BY_DUEDATE_RANGE;
+
+ calendar_connect();
+
+ int error;
+ if ((error = _create_sample_todo("", 100)))
+ dts_message(api_name, "Error while building precondition(%d)", error);
+ if ((error = _create_sample_todo("", 200)))
+ dts_message(api_name, "Error while building precondition(%d)", error);
+ if ((error = _create_sample_todo("", 300)))
+ dts_message(api_name, "Error while building precondition(%d)", error);
+ if ((error = _create_sample_todo("", 400)))
+ dts_message(api_name, "Error while building precondition(%d)", error);
+ if ((error = _create_sample_todo("", 500)))
+ dts_message(api_name, "Error while building precondition(%d)", error);
+
+ calendar_todo_h *todo_array = NULL;
+ int length;
+ if ((error = calendar_todo_search_todo_by_duedate_range(DEFAULT_CALENDAR_BOOK_DB_ID, 200, 400,
+ CALENDAR_TODO_FILTER_PRIORITY_ALL, CALENDAR_TODO_FILTER_STATUS_ALL, &todo_array, &length))
+ != CALENDAR_ERROR_NONE) {
+ dts_message(api_name, "Error : %d", error);
+ dts_fail(api_name);
+ return;
+ }
+
+ calendar_disconnect();
+
+ dts_pass(api_name);
+}
+
+static void utc_social_calendar_todo_search_todo_by_duedate_range_n(void)
+{
+ const char* api_name = API_NAME_CALENDAR_TODO_SEARCH_TODO_BY_DUEDATE_RANGE;
+ int error;
+ calendar_todo_h *todo_array = NULL;
+ int length;
+
+ if ((error = calendar_todo_search_todo_by_duedate_range(DEFAULT_CALENDAR_BOOK_DB_ID, 200, 400,
+ CALENDAR_TODO_FILTER_PRIORITY_ALL, CALENDAR_TODO_FILTER_STATUS_ALL, NULL, &length))
+ != CALENDAR_ERROR_INVALID_PARAMETER) {
+ dts_message(api_name, "Error : %d", error);
+ dts_fail(api_name);
+ return;
+ }
+
+ if ((error = calendar_todo_search_todo_by_duedate_range(DEFAULT_CALENDAR_BOOK_DB_ID, 200, 400,
+ CALENDAR_TODO_FILTER_PRIORITY_ALL, CALENDAR_TODO_FILTER_STATUS_ALL, &todo_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_todo_search_todo_by_version_p(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ bool pass = false;
+
+ int length;
+
+ calendar_connect();
+ pcalendar_modified_todo_s* modified_todo_array = NULL;
+
+ if ((ret = calendar_todo_search_todo_by_version(DEFAULT_CALENDAR_BOOK_DB_ID, 0, &modified_todo_array, &length)) == CALENDAR_ERROR_NONE) {
+ pass = true;
+ }
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_TODO_SEARCH_TODO_BY_VERSION);
+ } else {
+ dts_message(API_NAME_CALENDAR_TODO_SEARCH_TODO_BY_VERSION, "Calendar : %d", ret);
+ dts_fail(API_NAME_CALENDAR_TODO_SEARCH_TODO_BY_VERSION);
+ }
+}
+
+static void utc_social_calendar_todo_search_todo_by_version_n(void)
+{
+ int ret = CALENDAR_ERROR_NONE;
+ bool pass = false;
+
+ calendar_modified_todo_s* modified_todo_array = NULL;
+ int length;
+
+ if ((ret = calendar_todo_search_todo_by_version(DEFAULT_CALENDAR_BOOK_DB_ID, 0, NULL, &length)) == CALENDAR_ERROR_INVALID_PARAMETER &&
+ (ret = calendar_todo_search_todo_by_version(DEFAULT_CALENDAR_BOOK_DB_ID, 0, &modified_todo_array, NULL)) == CALENDAR_ERROR_INVALID_PARAMETER) {
+ pass = true;
+ }
+
+ if (pass) {
+ dts_pass(API_NAME_CALENDAR_TODO_SEARCH_TODO_BY_VERSION);
+ } else {
+ dts_message(API_NAME_CALENDAR_TODO_SEARCH_TODO_BY_VERSION, "Calendar : %d", ret);
+ dts_fail(API_NAME_CALENDAR_TODO_SEARCH_TODO_BY_VERSION);
+ }
+}
diff --git a/TC/tet_scen b/TC/tet_scen
new file mode 100755
index 0000000..03f029a
--- /dev/null
+++ b/TC/tet_scen
@@ -0,0 +1,7 @@
+all
+ ^TEST
+##### Scenarios for TEST #####
+
+# Test scenario
+TEST
+ :include:/testcase/tslist
diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg
new file mode 100755
index 0000000..f7eda55
--- /dev/null
+++ b/TC/tetbuild.cfg
@@ -0,0 +1,5 @@
+TET_OUTPUT_CAPTURE=True # capture option for build operation checking
+TET_BUILD_TOOL=make # build with using make command
+TET_BUILD_FILE=-f Makefile # execution file (Makefile) for build
+TET_API_COMPLIANT=True # use TET API in Test Case ?
+TET_PASS_TC_NAME=True # report passed TC name in Journal file?
diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg
new file mode 100755
index 0000000..02d7030
--- /dev/null
+++ b/TC/tetclean.cfg
@@ -0,0 +1,5 @@
+TET_OUTPUT_CAPTURE=True # capture option
+TET_CLEAN_TOOL= make clean # clean tool
+TET_CLEAN_FILE= Makefile # file for clean
+TET_API_COMPLIANT=True # TET API useage
+TET_PASS_TC_NAME=True # showing name , passed TC
diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg
new file mode 100755
index 0000000..ef3e452
--- /dev/null
+++ b/TC/tetexec.cfg
@@ -0,0 +1,5 @@
+TET_OUTPUT_CAPTURE=True # capturing execution or not
+TET_EXEC_TOOL= # ex) exec : execution tool set up/ Optional
+TET_EXEC_FILE= # ex) exectool : execution file/ Optional
+TET_API_COMPLIANT=True # Test case or Tool usesTET API?
+TET_PASS_TC_NAME=True # showing Passed TC name ?