From: Hwankyu Jhun Date: Wed, 13 Mar 2024 09:23:12 +0000 (+0900) Subject: [UTC][tizen-core][ACR-1828] Add new test cases for tizen-core library X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1ad1ed3957f0cfce08bd3c7156dc28c3fe5f7891;p=test%2Ftct%2Fnative%2Fapi.git [UTC][tizen-core][ACR-1828] Add new test cases for tizen-core library Change-Id: Icc84bc38c1f6fce8ef029efab3d870bf2937159a Signed-off-by: Hwankyu Jhun --- diff --git a/packaging/utc/core-tizen-core-tests.xml b/packaging/utc/core-tizen-core-tests.xml new file mode 100644 index 000000000..ed5b81465 --- /dev/null +++ b/packaging/utc/core-tizen-core-tests.xml @@ -0,0 +1,14 @@ + + + + test + Core API test Application + + + + + + + + + diff --git a/src/utc/tizen-core/CMakeLists.txt b/src/utc/tizen-core/CMakeLists.txt new file mode 100644 index 000000000..e34105e2d --- /dev/null +++ b/src/utc/tizen-core/CMakeLists.txt @@ -0,0 +1,44 @@ +SET(PKG_NAME "tizen-core") + +SET(EXEC_NAME "tct-${PKG_NAME}-core") +SET(RPM_NAME "core-${PKG_NAME}-tests") + +SET(CAPI_LIB "tizen-core") +SET(TC_SOURCES + utc-tizen-core.c + utc-tizen-core-channel.c + utc-tizen-core-event.c +) + +PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED + ${CAPI_LIB} + capi-appfw-application + capi-system-info + glib-2.0 + bundle + dlog + elementary + tizen-core +) + +INCLUDE_DIRECTORIES( + ${${CAPI_LIB}_INCLUDE_DIRS} +) + +ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.c ${TC_SOURCES} ${COMMON_FILE}) +TARGET_LINK_LIBRARIES(${EXEC_NAME} + ${${CAPI_LIB}_LIBRARIES} + bundle +) + +INSTALL(PROGRAMS ${EXEC_NAME} + DESTINATION ${BIN_DIR}/${RPM_NAME}/bin +) + +IF( DEFINED ASAN ) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wall -pie -g -fsanitize=address -fsanitize-recover=address -U_FORTIFY_SOURCE -fno-omit-frame-pointer") + SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib -Wl,-fsanitize=address") +ELSE() + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g -fPIE -Wall") + SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib -pie") +ENDIF() diff --git a/src/utc/tizen-core/tct-tizen-core-core.c b/src/utc/tizen-core/tct-tizen-core-core.c new file mode 100644 index 000000000..874011e0d --- /dev/null +++ b/src/utc/tizen-core/tct-tizen-core-core.c @@ -0,0 +1,140 @@ +// +// Copyright (c) 2022 Samsung Electronics Co., Ltd. +// +// 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 "tct_common.h" + +#ifdef MOBILE //Starts MOBILE +#include "tct-tizen-core-core_mobile.h" +#endif //MOBILE //End MOBILE + +#ifdef WEARABLE //Starts WEARABLE +#include "tct-tizen-core-core_wearable.h" +#endif //WEARABLE //End WEARABLE + +#ifdef TV //Starts TV +#include "tct-tizen-core-core_tv.h" +#endif //TV //End TV + +#ifdef TIZENIOT //Starts TIZENIOT +#include "tct-tizen-core-core_tizeniot.h" +#endif //TIZENIOT //End TIZENIOT + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +typedef struct appdata { + Evas_Object *win; + Evas_Object *conform; + Evas_Object *label; +} appdata_s; + +static bool app_create(void *data) +{ + return true; +} + +static void app_control(app_control_h app_control, void *data) +{ + char* pszGetTCName = NULL; + int i=0, result=0, nRet=0; + nRet = app_control_get_extra_data(app_control, "testcase_name", &pszGetTCName); + if(nRet != APP_CONTROL_ERROR_NONE) + { + dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] app_control_get_extra_data returns error = %d", __FUNCTION__, __LINE__, nRet); + PRINT_UTC_LOG("\\n[%s][Line : %d]Unable to fetch test case name: app_control_get_extra_data API call fails\\n", __FILE__, __LINE__); + PRINT_TC_RESULT("%d",1); + FREE_MEMORY_TC(pszGetTCName); + return; + } + + dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Executing TC Name = %s", __FUNCTION__, __LINE__, pszGetTCName); + for ( i = 0; tc_array[i].name; i++ ) + { + if ( 0 == strncmp(pszGetTCName, tc_array[i].name, strlen(pszGetTCName)) ) + { + DUMP_UTC_ERRLOG(); + if ( tc_array[i].startup ) + { + dlog_print(DLOG_INFO, "NativeTCT", "%s : Start up", pszGetTCName); + tc_array[i].startup(); + } + + dlog_print(DLOG_INFO, "NativeTCT", "%s : Body", pszGetTCName); + result = tc_array[i].function(); + dlog_print(DLOG_INFO, "NativeTCT", "%s returns value = %d", pszGetTCName, result); + + if ( tc_array[i].cleanup ) + { + dlog_print(DLOG_INFO, "NativeTCT", "%s : Clean up", pszGetTCName); + tc_array[i].cleanup(); + } + + CLOSE_UTC_ERRLOG(); + PRINT_TC_RESULT("%d",result); + FREE_MEMORY_TC(pszGetTCName); + return; + } + } + + dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] Unable to execute %s : Unknown Test Case Name", __FUNCTION__, __LINE__, pszGetTCName); + PRINT_UTC_LOG("\\n[%s][Line : %d]Unable to execute %s : Unknown Test Case Name\\n", __FILE__, __LINE__, pszGetTCName); + PRINT_TC_RESULT("%d",1); + FREE_MEMORY_TC(pszGetTCName); + return; +} + +static void app_terminate(void *data) +{ + dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Package is now Terminating", __FUNCTION__, __LINE__); +} + +int main(int argc, char *argv[]) +{ + int ret = 0; + appdata_s ad = {0,}; + + ui_app_lifecycle_callback_s event_callback = {0,}; + event_callback.create = app_create; + event_callback.terminate = app_terminate; + event_callback.app_control = app_control; + + //setting gcda file location for coverage + setenv("GCOV_PREFIX","/tmp",1); + dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Coverage *.gcda File location set to /tmp/home/abuild/rpmbuild/BUILD/ ", __FUNCTION__, __LINE__); + + dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Main Function is Invoked", __FUNCTION__, __LINE__); + ret = ui_app_main(argc, argv, &event_callback, &ad); + if (ret != APP_ERROR_NONE) + { + dlog_print(DLOG_ERROR, "NativeTCT", "Application ui_app_main call gets failed. err = %d", ret); + PRINT_UTC_LOG("\\n[%s][Line : %d]Application ui_app_main call gets failed. err = %d\\n", __FILE__, __LINE__, ret); + PRINT_TC_RESULT("%d",1); + return ret; + } + + dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Package is Terminated", __FUNCTION__, __LINE__); + return ret; +} diff --git a/src/utc/tizen-core/tct-tizen-core-core_mobile.h b/src/utc/tizen-core/tct-tizen-core-core_mobile.h new file mode 100644 index 000000000..e280a4c8d --- /dev/null +++ b/src/utc/tizen-core/tct-tizen-core-core_mobile.h @@ -0,0 +1,436 @@ +// +// Copyright (c) 2024 Samsung Electronics Co., Ltd. +// +// 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. +// +#ifndef __TCT_TIZEN_CORE_NATIVE_H__ +#define __TCT_TIZEN_CORE_NATIVE_H__ + +#include "testcase.h" +#include "tct_common.h" + +// utc-tizen-core.c +extern void utc_tizen_core_startup(void); +extern void utc_tizen_core_cleanup(void); +extern int utc_tizen_core_init_p(void); +extern int utc_tizen_core_shutdown_p(void); +extern int utc_tizen_core_ready_p(void); +extern int utc_tizen_core_ready_n(void); +extern int utc_tizen_core_task_create_p(void); +extern int utc_tizen_core_task_create_n(void); +extern int utc_tizen_core_task_destroy_p(void); +extern int utc_tizen_core_task_destroy_n(void); +extern int utc_tizen_core_task_run_p(void); +extern int utc_tizen_core_task_run_n(void); +extern int utc_tizen_core_task_is_running_p(void); +extern int utc_tizen_core_task_is_running_n(void); +extern int utc_tizen_core_task_quit_p(void); +extern int utc_tizen_core_task_quit_n(void); +extern int utc_tizen_core_task_get_tizen_core_p(void); +extern int utc_tizen_core_task_get_tizen_core_n(void); +extern int utc_tizen_core_find_p(void); +extern int utc_tizen_core_find_n(void); +extern int utc_tizen_core_find_from_this_thread_p(void); +extern int utc_tizen_core_find_from_this_thread_n(void); +extern int utc_tizen_core_add_idle_job_p(void); +extern int utc_tizen_core_add_idle_job_n(void); +extern int utc_tizen_core_add_timer_p(void); +extern int utc_tizen_core_add_timer_n(void); +extern int utc_tizen_core_add_channel_p(void); +extern int utc_tizen_core_add_channel_n(void); +extern int utc_tizen_core_add_event_p(void); +extern int utc_tizen_core_add_event_n(void); +extern int utc_tizen_core_emit_event_p(void); +extern int utc_tizen_core_emit_event_n(void); +extern int utc_tizen_core_add_source_p(void); +extern int utc_tizen_core_add_source_n(void); +extern int utc_tizen_core_remove_source_p(void); +extern int utc_tizen_core_remove_source_n(void); +extern int utc_tizen_core_source_create_p(void); +extern int utc_tizen_core_source_create_n(void); +extern int utc_tizen_core_source_destroy_p(void); +extern int utc_tizen_core_source_destroy_n(void); +extern int utc_tizen_core_source_add_poll_p(void); +extern int utc_tizen_core_source_add_poll_n(void); +extern int utc_tizen_core_source_remove_poll_p(void); +extern int utc_tizen_core_source_remove_poll_n(void); +extern int utc_tizen_core_source_set_prepare_cb_p(void); +extern int utc_tizen_core_source_set_prepare_cb_n(void); +extern int utc_tizen_core_source_set_check_cb_p(void); +extern int utc_tizen_core_source_set_check_cb_n(void); +extern int utc_tizen_core_source_set_dispatch_cb_p(void); +extern int utc_tizen_core_source_set_dispatch_cb_n(void); +extern int utc_tizen_core_source_set_finalize_cb_p(void); +extern int utc_tizen_core_source_set_finalize_cb_n(void); +extern int utc_tizen_core_source_set_priority_p(void); +extern int utc_tizen_core_source_set_priority_n(void); +extern int utc_tizen_core_poll_fd_create_p(void); +extern int utc_tizen_core_poll_fd_create_n(void); +extern int utc_tizen_core_poll_fd_destroy_p(void); +extern int utc_tizen_core_poll_fd_destroy_n(void); +extern int utc_tizen_core_poll_fd_set_fd_p(void); +extern int utc_tizen_core_poll_fd_set_fd_n(void); +extern int utc_tizen_core_poll_fd_get_fd_p(void); +extern int utc_tizen_core_poll_fd_get_fd_n(void); +extern int utc_tizen_core_poll_fd_set_events_p(void); +extern int utc_tizen_core_poll_fd_set_events_n(void); +extern int utc_tizen_core_poll_fd_get_events_p(void); +extern int utc_tizen_core_poll_fd_get_events_n(void); +extern int utc_tizen_core_poll_fd_set_returned_events_p(void); +extern int utc_tizen_core_poll_fd_set_returned_events_n(void); +extern int utc_tizen_core_poll_fd_get_returned_events_p(void); +extern int utc_tizen_core_poll_fd_get_returned_events_n(void); + +// utc-tizen-core-channel.c +extern void utc_tizen_core_channel_startup(void); +extern void utc_tizen_core_channel_cleanup(void); +extern int utc_tizen_core_channel_make_pair_p(void); +extern int utc_tizen_core_channel_make_pair_n(void); +extern int utc_tizen_core_channel_sender_send_p(void); +extern int utc_tizen_core_channel_sender_send_n(void); +extern int utc_tizen_core_channel_sender_destroy_p(void); +extern int utc_tizen_core_channel_sender_destroy_n(void); +extern int utc_tizen_core_channel_sender_clone_p(void); +extern int utc_tizen_core_channel_sender_clone_n(void); +extern int utc_tizen_core_channel_receiver_receive_p(void); +extern int utc_tizen_core_channel_receiver_receive_n(void); +extern int utc_tizen_core_channel_receiver_destroy_p(void); +extern int utc_tizen_core_channel_receiver_destroy_n(void); +extern int utc_tizen_core_channel_object_create_p(void); +extern int utc_tizen_core_channel_object_create_n(void); +extern int utc_tizen_core_channel_object_destroy_p(void); +extern int utc_tizen_core_channel_object_destroy_n(void); +extern int utc_tizen_core_channel_object_set_id_p(void); +extern int utc_tizen_core_channel_object_set_id_n(void); +extern int utc_tizen_core_channel_object_get_id_p(void); +extern int utc_tizen_core_channel_object_get_id_n(void); +extern int utc_tizen_core_channel_object_set_data_p(void); +extern int utc_tizen_core_channel_object_set_data_n(void); +extern int utc_tizen_core_channel_object_get_data_p(void); +extern int utc_tizen_core_channel_object_get_data_n(void); +extern int utc_tizen_core_channel_object_get_sender_task_name_p(void); +extern int utc_tizen_core_channel_object_get_sender_task_name_n(void); + +// utc-tizen-core-event.c +extern void utc_tizen_core_event_startup(void); +extern void utc_tizen_core_event_cleanup(void); +extern int utc_tizen_core_event_create_p(void); +extern int utc_tizen_core_event_create_n(void); +extern int utc_tizen_core_event_destroy_p(void); +extern int utc_tizen_core_event_destroy_n(void); +extern int utc_tizen_core_event_add_handler_p(void); +extern int utc_tizen_core_event_add_handler_n(void); +extern int utc_tizen_core_event_remove_handler_p(void); +extern int utc_tizen_core_event_remove_handler_n(void); +extern int utc_tizen_core_event_emit_p(void); +extern int utc_tizen_core_event_emit_n(void); +extern int utc_tizen_core_event_object_create_p(void); +extern int utc_tizen_core_event_object_create_n(void); +extern int utc_tizen_core_event_object_destroy_p(void); +extern int utc_tizen_core_event_object_destroy_n(void); +extern int utc_tizen_core_event_object_set_destroy_cb_p(void); +extern int utc_tizen_core_event_object_set_destroy_cb_n(void); +extern int utc_tizen_core_event_object_get_id_p(void); +extern int utc_tizen_core_event_object_get_id_n(void); +extern int utc_tizen_core_event_object_get_data_p(void); +extern int utc_tizen_core_event_object_get_data_n(void); + +testcase tc_array[] = { + // utc-tizen-core.c + {"utc_tizen_core_init_p", utc_tizen_core_init_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_shutdown_p", utc_tizen_core_shutdown_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_ready_p", utc_tizen_core_ready_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_ready_n", utc_tizen_core_ready_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_task_create_p", utc_tizen_core_task_create_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_create_n", utc_tizen_core_task_create_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_destroy_p", utc_tizen_core_task_destroy_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_destroy_n", utc_tizen_core_task_destroy_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_run_p", utc_tizen_core_task_run_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_run_n", utc_tizen_core_task_run_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_is_running_p", utc_tizen_core_task_is_running_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_is_running_n", utc_tizen_core_task_is_running_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_quit_p", utc_tizen_core_task_quit_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_quit_n", utc_tizen_core_task_quit_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_get_tizen_core_p", + utc_tizen_core_task_get_tizen_core_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_task_get_tizen_core_n", + utc_tizen_core_task_get_tizen_core_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_find_p", utc_tizen_core_find_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_find_n", utc_tizen_core_find_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_find_from_this_thread_p", + utc_tizen_core_find_from_this_thread_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_find_from_this_thread_n", + utc_tizen_core_find_from_this_thread_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_add_idle_job_p", utc_tizen_core_add_idle_job_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_idle_job_n", utc_tizen_core_add_idle_job_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_timer_p", utc_tizen_core_add_timer_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_timer_n", utc_tizen_core_add_timer_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_channel_p", utc_tizen_core_add_channel_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_channel_n", utc_tizen_core_add_channel_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_event_p", utc_tizen_core_add_event_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_event_n", utc_tizen_core_add_event_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_emit_event_p", utc_tizen_core_emit_event_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_emit_event_n", utc_tizen_core_emit_event_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_source_p", utc_tizen_core_add_source_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_source_n", utc_tizen_core_add_source_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_remove_source_p", utc_tizen_core_remove_source_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_remove_source_n", utc_tizen_core_remove_source_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_create_p", utc_tizen_core_source_create_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_create_n", utc_tizen_core_source_create_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_destroy_p", utc_tizen_core_source_destroy_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_destroy_n", utc_tizen_core_source_destroy_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_add_poll_p", utc_tizen_core_source_add_poll_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_add_poll_n", utc_tizen_core_source_add_poll_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_remove_poll_p", utc_tizen_core_source_remove_poll_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_remove_poll_n", utc_tizen_core_source_remove_poll_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_prepare_cb_p", + utc_tizen_core_source_set_prepare_cb_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_prepare_cb_n", + utc_tizen_core_source_set_prepare_cb_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_check_cb_p", + utc_tizen_core_source_set_check_cb_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_check_cb_n", + utc_tizen_core_source_set_check_cb_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_dispatch_cb_p", + utc_tizen_core_source_set_dispatch_cb_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_dispatch_cb_n", + utc_tizen_core_source_set_dispatch_cb_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_finalize_cb_p", + utc_tizen_core_source_set_finalize_cb_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_finalize_cb_n", + utc_tizen_core_source_set_finalize_cb_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_priority_p", + utc_tizen_core_source_set_priority_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_priority_n", + utc_tizen_core_source_set_priority_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_create_p", utc_tizen_core_poll_fd_create_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_create_n", utc_tizen_core_poll_fd_create_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_destroy_p", utc_tizen_core_poll_fd_destroy_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_destroy_n", utc_tizen_core_poll_fd_destroy_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_set_fd_p", utc_tizen_core_poll_fd_set_fd_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_set_fd_n", utc_tizen_core_poll_fd_set_fd_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_get_fd_p", utc_tizen_core_poll_fd_get_fd_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_get_fd_n", utc_tizen_core_poll_fd_get_fd_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_set_events_p", utc_tizen_core_poll_fd_set_events_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_set_events_n", utc_tizen_core_poll_fd_set_events_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_get_events_p", utc_tizen_core_poll_fd_get_events_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_get_events_n", utc_tizen_core_poll_fd_get_events_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_set_returned_events_p", + utc_tizen_core_poll_fd_set_returned_events_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_set_returned_events_n", + utc_tizen_core_poll_fd_set_returned_events_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_get_returned_events_p", + utc_tizen_core_poll_fd_get_returned_events_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_get_returned_events_n", + utc_tizen_core_poll_fd_get_returned_events_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + // utc-tizen-core-channel.c + {"utc_tizen_core_channel_make_pair_p", utc_tizen_core_channel_make_pair_p, + utc_tizen_core_channel_startup, utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_make_pair_n", utc_tizen_core_channel_make_pair_n, + utc_tizen_core_channel_startup, utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_sender_send_p", + utc_tizen_core_channel_sender_send_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_sender_send_n", + utc_tizen_core_channel_sender_send_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_sender_destroy_p", + utc_tizen_core_channel_sender_destroy_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_sender_destroy_n", + utc_tizen_core_channel_sender_destroy_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_sender_clone_p", + utc_tizen_core_channel_sender_clone_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_sender_clone_n", + utc_tizen_core_channel_sender_clone_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_receiver_receive_p", + utc_tizen_core_channel_receiver_receive_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_receiver_receive_n", + utc_tizen_core_channel_receiver_receive_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_receiver_destroy_p", + utc_tizen_core_channel_receiver_destroy_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_receiver_destroy_n", + utc_tizen_core_channel_receiver_destroy_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_create_p", + utc_tizen_core_channel_object_create_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_create_n", + utc_tizen_core_channel_object_create_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_destroy_p", + utc_tizen_core_channel_object_destroy_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_destroy_n", + utc_tizen_core_channel_object_destroy_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_set_id_p", + utc_tizen_core_channel_object_set_id_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_set_id_n", + utc_tizen_core_channel_object_set_id_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_get_id_p", + utc_tizen_core_channel_object_get_id_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_get_id_n", + utc_tizen_core_channel_object_get_id_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_set_data_p", + utc_tizen_core_channel_object_set_data_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_set_data_n", + utc_tizen_core_channel_object_set_data_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_get_data_p", + utc_tizen_core_channel_object_get_data_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_get_data_n", + utc_tizen_core_channel_object_get_data_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_get_sender_task_name_p", + utc_tizen_core_channel_object_get_sender_task_name_p, + utc_tizen_core_channel_startup, utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_get_sender_task_name_n", + utc_tizen_core_channel_object_get_sender_task_name_n, + utc_tizen_core_channel_startup, utc_tizen_core_channel_cleanup}, + // utc-tizen-core-event.c + {"utc_tizen_core_event_create_p", utc_tizen_core_event_create_p, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_create_n", utc_tizen_core_event_create_n, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_destroy_p", utc_tizen_core_event_destroy_p, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_destroy_n", utc_tizen_core_event_destroy_n, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_add_handler_p", utc_tizen_core_event_add_handler_p, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_add_handler_n", utc_tizen_core_event_add_handler_n, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_remove_handler_p", + utc_tizen_core_event_remove_handler_p, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_remove_handler_n", + utc_tizen_core_event_remove_handler_n, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_emit_p", utc_tizen_core_event_emit_p, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_emit_n", utc_tizen_core_event_emit_n, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_create_p", + utc_tizen_core_event_object_create_p, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_create_n", + utc_tizen_core_event_object_create_n, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_destroy_p", + utc_tizen_core_event_object_destroy_p, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_destroy_n", + utc_tizen_core_event_object_destroy_n, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_set_destroy_cb_p", + utc_tizen_core_event_object_set_destroy_cb_p, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_set_destroy_cb_n", + utc_tizen_core_event_object_set_destroy_cb_n, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_get_id_p", + utc_tizen_core_event_object_get_id_p, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_get_id_n", + utc_tizen_core_event_object_get_id_n, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_get_data_p", + utc_tizen_core_event_object_get_data_p, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_get_data_n", + utc_tizen_core_event_object_get_data_n, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {NULL, NULL}}; + +#endif // __TCT_TIZEN_CORE_NATIVE_H__ diff --git a/src/utc/tizen-core/tct-tizen-core-core_tizeniot.h b/src/utc/tizen-core/tct-tizen-core-core_tizeniot.h new file mode 100644 index 000000000..e280a4c8d --- /dev/null +++ b/src/utc/tizen-core/tct-tizen-core-core_tizeniot.h @@ -0,0 +1,436 @@ +// +// Copyright (c) 2024 Samsung Electronics Co., Ltd. +// +// 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. +// +#ifndef __TCT_TIZEN_CORE_NATIVE_H__ +#define __TCT_TIZEN_CORE_NATIVE_H__ + +#include "testcase.h" +#include "tct_common.h" + +// utc-tizen-core.c +extern void utc_tizen_core_startup(void); +extern void utc_tizen_core_cleanup(void); +extern int utc_tizen_core_init_p(void); +extern int utc_tizen_core_shutdown_p(void); +extern int utc_tizen_core_ready_p(void); +extern int utc_tizen_core_ready_n(void); +extern int utc_tizen_core_task_create_p(void); +extern int utc_tizen_core_task_create_n(void); +extern int utc_tizen_core_task_destroy_p(void); +extern int utc_tizen_core_task_destroy_n(void); +extern int utc_tizen_core_task_run_p(void); +extern int utc_tizen_core_task_run_n(void); +extern int utc_tizen_core_task_is_running_p(void); +extern int utc_tizen_core_task_is_running_n(void); +extern int utc_tizen_core_task_quit_p(void); +extern int utc_tizen_core_task_quit_n(void); +extern int utc_tizen_core_task_get_tizen_core_p(void); +extern int utc_tizen_core_task_get_tizen_core_n(void); +extern int utc_tizen_core_find_p(void); +extern int utc_tizen_core_find_n(void); +extern int utc_tizen_core_find_from_this_thread_p(void); +extern int utc_tizen_core_find_from_this_thread_n(void); +extern int utc_tizen_core_add_idle_job_p(void); +extern int utc_tizen_core_add_idle_job_n(void); +extern int utc_tizen_core_add_timer_p(void); +extern int utc_tizen_core_add_timer_n(void); +extern int utc_tizen_core_add_channel_p(void); +extern int utc_tizen_core_add_channel_n(void); +extern int utc_tizen_core_add_event_p(void); +extern int utc_tizen_core_add_event_n(void); +extern int utc_tizen_core_emit_event_p(void); +extern int utc_tizen_core_emit_event_n(void); +extern int utc_tizen_core_add_source_p(void); +extern int utc_tizen_core_add_source_n(void); +extern int utc_tizen_core_remove_source_p(void); +extern int utc_tizen_core_remove_source_n(void); +extern int utc_tizen_core_source_create_p(void); +extern int utc_tizen_core_source_create_n(void); +extern int utc_tizen_core_source_destroy_p(void); +extern int utc_tizen_core_source_destroy_n(void); +extern int utc_tizen_core_source_add_poll_p(void); +extern int utc_tizen_core_source_add_poll_n(void); +extern int utc_tizen_core_source_remove_poll_p(void); +extern int utc_tizen_core_source_remove_poll_n(void); +extern int utc_tizen_core_source_set_prepare_cb_p(void); +extern int utc_tizen_core_source_set_prepare_cb_n(void); +extern int utc_tizen_core_source_set_check_cb_p(void); +extern int utc_tizen_core_source_set_check_cb_n(void); +extern int utc_tizen_core_source_set_dispatch_cb_p(void); +extern int utc_tizen_core_source_set_dispatch_cb_n(void); +extern int utc_tizen_core_source_set_finalize_cb_p(void); +extern int utc_tizen_core_source_set_finalize_cb_n(void); +extern int utc_tizen_core_source_set_priority_p(void); +extern int utc_tizen_core_source_set_priority_n(void); +extern int utc_tizen_core_poll_fd_create_p(void); +extern int utc_tizen_core_poll_fd_create_n(void); +extern int utc_tizen_core_poll_fd_destroy_p(void); +extern int utc_tizen_core_poll_fd_destroy_n(void); +extern int utc_tizen_core_poll_fd_set_fd_p(void); +extern int utc_tizen_core_poll_fd_set_fd_n(void); +extern int utc_tizen_core_poll_fd_get_fd_p(void); +extern int utc_tizen_core_poll_fd_get_fd_n(void); +extern int utc_tizen_core_poll_fd_set_events_p(void); +extern int utc_tizen_core_poll_fd_set_events_n(void); +extern int utc_tizen_core_poll_fd_get_events_p(void); +extern int utc_tizen_core_poll_fd_get_events_n(void); +extern int utc_tizen_core_poll_fd_set_returned_events_p(void); +extern int utc_tizen_core_poll_fd_set_returned_events_n(void); +extern int utc_tizen_core_poll_fd_get_returned_events_p(void); +extern int utc_tizen_core_poll_fd_get_returned_events_n(void); + +// utc-tizen-core-channel.c +extern void utc_tizen_core_channel_startup(void); +extern void utc_tizen_core_channel_cleanup(void); +extern int utc_tizen_core_channel_make_pair_p(void); +extern int utc_tizen_core_channel_make_pair_n(void); +extern int utc_tizen_core_channel_sender_send_p(void); +extern int utc_tizen_core_channel_sender_send_n(void); +extern int utc_tizen_core_channel_sender_destroy_p(void); +extern int utc_tizen_core_channel_sender_destroy_n(void); +extern int utc_tizen_core_channel_sender_clone_p(void); +extern int utc_tizen_core_channel_sender_clone_n(void); +extern int utc_tizen_core_channel_receiver_receive_p(void); +extern int utc_tizen_core_channel_receiver_receive_n(void); +extern int utc_tizen_core_channel_receiver_destroy_p(void); +extern int utc_tizen_core_channel_receiver_destroy_n(void); +extern int utc_tizen_core_channel_object_create_p(void); +extern int utc_tizen_core_channel_object_create_n(void); +extern int utc_tizen_core_channel_object_destroy_p(void); +extern int utc_tizen_core_channel_object_destroy_n(void); +extern int utc_tizen_core_channel_object_set_id_p(void); +extern int utc_tizen_core_channel_object_set_id_n(void); +extern int utc_tizen_core_channel_object_get_id_p(void); +extern int utc_tizen_core_channel_object_get_id_n(void); +extern int utc_tizen_core_channel_object_set_data_p(void); +extern int utc_tizen_core_channel_object_set_data_n(void); +extern int utc_tizen_core_channel_object_get_data_p(void); +extern int utc_tizen_core_channel_object_get_data_n(void); +extern int utc_tizen_core_channel_object_get_sender_task_name_p(void); +extern int utc_tizen_core_channel_object_get_sender_task_name_n(void); + +// utc-tizen-core-event.c +extern void utc_tizen_core_event_startup(void); +extern void utc_tizen_core_event_cleanup(void); +extern int utc_tizen_core_event_create_p(void); +extern int utc_tizen_core_event_create_n(void); +extern int utc_tizen_core_event_destroy_p(void); +extern int utc_tizen_core_event_destroy_n(void); +extern int utc_tizen_core_event_add_handler_p(void); +extern int utc_tizen_core_event_add_handler_n(void); +extern int utc_tizen_core_event_remove_handler_p(void); +extern int utc_tizen_core_event_remove_handler_n(void); +extern int utc_tizen_core_event_emit_p(void); +extern int utc_tizen_core_event_emit_n(void); +extern int utc_tizen_core_event_object_create_p(void); +extern int utc_tizen_core_event_object_create_n(void); +extern int utc_tizen_core_event_object_destroy_p(void); +extern int utc_tizen_core_event_object_destroy_n(void); +extern int utc_tizen_core_event_object_set_destroy_cb_p(void); +extern int utc_tizen_core_event_object_set_destroy_cb_n(void); +extern int utc_tizen_core_event_object_get_id_p(void); +extern int utc_tizen_core_event_object_get_id_n(void); +extern int utc_tizen_core_event_object_get_data_p(void); +extern int utc_tizen_core_event_object_get_data_n(void); + +testcase tc_array[] = { + // utc-tizen-core.c + {"utc_tizen_core_init_p", utc_tizen_core_init_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_shutdown_p", utc_tizen_core_shutdown_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_ready_p", utc_tizen_core_ready_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_ready_n", utc_tizen_core_ready_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_task_create_p", utc_tizen_core_task_create_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_create_n", utc_tizen_core_task_create_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_destroy_p", utc_tizen_core_task_destroy_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_destroy_n", utc_tizen_core_task_destroy_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_run_p", utc_tizen_core_task_run_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_run_n", utc_tizen_core_task_run_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_is_running_p", utc_tizen_core_task_is_running_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_is_running_n", utc_tizen_core_task_is_running_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_quit_p", utc_tizen_core_task_quit_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_quit_n", utc_tizen_core_task_quit_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_get_tizen_core_p", + utc_tizen_core_task_get_tizen_core_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_task_get_tizen_core_n", + utc_tizen_core_task_get_tizen_core_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_find_p", utc_tizen_core_find_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_find_n", utc_tizen_core_find_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_find_from_this_thread_p", + utc_tizen_core_find_from_this_thread_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_find_from_this_thread_n", + utc_tizen_core_find_from_this_thread_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_add_idle_job_p", utc_tizen_core_add_idle_job_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_idle_job_n", utc_tizen_core_add_idle_job_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_timer_p", utc_tizen_core_add_timer_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_timer_n", utc_tizen_core_add_timer_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_channel_p", utc_tizen_core_add_channel_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_channel_n", utc_tizen_core_add_channel_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_event_p", utc_tizen_core_add_event_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_event_n", utc_tizen_core_add_event_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_emit_event_p", utc_tizen_core_emit_event_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_emit_event_n", utc_tizen_core_emit_event_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_source_p", utc_tizen_core_add_source_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_source_n", utc_tizen_core_add_source_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_remove_source_p", utc_tizen_core_remove_source_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_remove_source_n", utc_tizen_core_remove_source_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_create_p", utc_tizen_core_source_create_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_create_n", utc_tizen_core_source_create_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_destroy_p", utc_tizen_core_source_destroy_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_destroy_n", utc_tizen_core_source_destroy_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_add_poll_p", utc_tizen_core_source_add_poll_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_add_poll_n", utc_tizen_core_source_add_poll_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_remove_poll_p", utc_tizen_core_source_remove_poll_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_remove_poll_n", utc_tizen_core_source_remove_poll_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_prepare_cb_p", + utc_tizen_core_source_set_prepare_cb_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_prepare_cb_n", + utc_tizen_core_source_set_prepare_cb_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_check_cb_p", + utc_tizen_core_source_set_check_cb_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_check_cb_n", + utc_tizen_core_source_set_check_cb_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_dispatch_cb_p", + utc_tizen_core_source_set_dispatch_cb_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_dispatch_cb_n", + utc_tizen_core_source_set_dispatch_cb_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_finalize_cb_p", + utc_tizen_core_source_set_finalize_cb_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_finalize_cb_n", + utc_tizen_core_source_set_finalize_cb_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_priority_p", + utc_tizen_core_source_set_priority_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_priority_n", + utc_tizen_core_source_set_priority_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_create_p", utc_tizen_core_poll_fd_create_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_create_n", utc_tizen_core_poll_fd_create_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_destroy_p", utc_tizen_core_poll_fd_destroy_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_destroy_n", utc_tizen_core_poll_fd_destroy_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_set_fd_p", utc_tizen_core_poll_fd_set_fd_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_set_fd_n", utc_tizen_core_poll_fd_set_fd_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_get_fd_p", utc_tizen_core_poll_fd_get_fd_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_get_fd_n", utc_tizen_core_poll_fd_get_fd_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_set_events_p", utc_tizen_core_poll_fd_set_events_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_set_events_n", utc_tizen_core_poll_fd_set_events_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_get_events_p", utc_tizen_core_poll_fd_get_events_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_get_events_n", utc_tizen_core_poll_fd_get_events_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_set_returned_events_p", + utc_tizen_core_poll_fd_set_returned_events_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_set_returned_events_n", + utc_tizen_core_poll_fd_set_returned_events_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_get_returned_events_p", + utc_tizen_core_poll_fd_get_returned_events_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_get_returned_events_n", + utc_tizen_core_poll_fd_get_returned_events_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + // utc-tizen-core-channel.c + {"utc_tizen_core_channel_make_pair_p", utc_tizen_core_channel_make_pair_p, + utc_tizen_core_channel_startup, utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_make_pair_n", utc_tizen_core_channel_make_pair_n, + utc_tizen_core_channel_startup, utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_sender_send_p", + utc_tizen_core_channel_sender_send_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_sender_send_n", + utc_tizen_core_channel_sender_send_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_sender_destroy_p", + utc_tizen_core_channel_sender_destroy_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_sender_destroy_n", + utc_tizen_core_channel_sender_destroy_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_sender_clone_p", + utc_tizen_core_channel_sender_clone_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_sender_clone_n", + utc_tizen_core_channel_sender_clone_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_receiver_receive_p", + utc_tizen_core_channel_receiver_receive_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_receiver_receive_n", + utc_tizen_core_channel_receiver_receive_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_receiver_destroy_p", + utc_tizen_core_channel_receiver_destroy_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_receiver_destroy_n", + utc_tizen_core_channel_receiver_destroy_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_create_p", + utc_tizen_core_channel_object_create_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_create_n", + utc_tizen_core_channel_object_create_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_destroy_p", + utc_tizen_core_channel_object_destroy_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_destroy_n", + utc_tizen_core_channel_object_destroy_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_set_id_p", + utc_tizen_core_channel_object_set_id_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_set_id_n", + utc_tizen_core_channel_object_set_id_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_get_id_p", + utc_tizen_core_channel_object_get_id_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_get_id_n", + utc_tizen_core_channel_object_get_id_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_set_data_p", + utc_tizen_core_channel_object_set_data_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_set_data_n", + utc_tizen_core_channel_object_set_data_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_get_data_p", + utc_tizen_core_channel_object_get_data_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_get_data_n", + utc_tizen_core_channel_object_get_data_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_get_sender_task_name_p", + utc_tizen_core_channel_object_get_sender_task_name_p, + utc_tizen_core_channel_startup, utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_get_sender_task_name_n", + utc_tizen_core_channel_object_get_sender_task_name_n, + utc_tizen_core_channel_startup, utc_tizen_core_channel_cleanup}, + // utc-tizen-core-event.c + {"utc_tizen_core_event_create_p", utc_tizen_core_event_create_p, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_create_n", utc_tizen_core_event_create_n, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_destroy_p", utc_tizen_core_event_destroy_p, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_destroy_n", utc_tizen_core_event_destroy_n, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_add_handler_p", utc_tizen_core_event_add_handler_p, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_add_handler_n", utc_tizen_core_event_add_handler_n, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_remove_handler_p", + utc_tizen_core_event_remove_handler_p, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_remove_handler_n", + utc_tizen_core_event_remove_handler_n, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_emit_p", utc_tizen_core_event_emit_p, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_emit_n", utc_tizen_core_event_emit_n, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_create_p", + utc_tizen_core_event_object_create_p, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_create_n", + utc_tizen_core_event_object_create_n, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_destroy_p", + utc_tizen_core_event_object_destroy_p, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_destroy_n", + utc_tizen_core_event_object_destroy_n, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_set_destroy_cb_p", + utc_tizen_core_event_object_set_destroy_cb_p, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_set_destroy_cb_n", + utc_tizen_core_event_object_set_destroy_cb_n, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_get_id_p", + utc_tizen_core_event_object_get_id_p, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_get_id_n", + utc_tizen_core_event_object_get_id_n, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_get_data_p", + utc_tizen_core_event_object_get_data_p, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_get_data_n", + utc_tizen_core_event_object_get_data_n, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {NULL, NULL}}; + +#endif // __TCT_TIZEN_CORE_NATIVE_H__ diff --git a/src/utc/tizen-core/tct-tizen-core-core_tv.h b/src/utc/tizen-core/tct-tizen-core-core_tv.h new file mode 100644 index 000000000..e280a4c8d --- /dev/null +++ b/src/utc/tizen-core/tct-tizen-core-core_tv.h @@ -0,0 +1,436 @@ +// +// Copyright (c) 2024 Samsung Electronics Co., Ltd. +// +// 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. +// +#ifndef __TCT_TIZEN_CORE_NATIVE_H__ +#define __TCT_TIZEN_CORE_NATIVE_H__ + +#include "testcase.h" +#include "tct_common.h" + +// utc-tizen-core.c +extern void utc_tizen_core_startup(void); +extern void utc_tizen_core_cleanup(void); +extern int utc_tizen_core_init_p(void); +extern int utc_tizen_core_shutdown_p(void); +extern int utc_tizen_core_ready_p(void); +extern int utc_tizen_core_ready_n(void); +extern int utc_tizen_core_task_create_p(void); +extern int utc_tizen_core_task_create_n(void); +extern int utc_tizen_core_task_destroy_p(void); +extern int utc_tizen_core_task_destroy_n(void); +extern int utc_tizen_core_task_run_p(void); +extern int utc_tizen_core_task_run_n(void); +extern int utc_tizen_core_task_is_running_p(void); +extern int utc_tizen_core_task_is_running_n(void); +extern int utc_tizen_core_task_quit_p(void); +extern int utc_tizen_core_task_quit_n(void); +extern int utc_tizen_core_task_get_tizen_core_p(void); +extern int utc_tizen_core_task_get_tizen_core_n(void); +extern int utc_tizen_core_find_p(void); +extern int utc_tizen_core_find_n(void); +extern int utc_tizen_core_find_from_this_thread_p(void); +extern int utc_tizen_core_find_from_this_thread_n(void); +extern int utc_tizen_core_add_idle_job_p(void); +extern int utc_tizen_core_add_idle_job_n(void); +extern int utc_tizen_core_add_timer_p(void); +extern int utc_tizen_core_add_timer_n(void); +extern int utc_tizen_core_add_channel_p(void); +extern int utc_tizen_core_add_channel_n(void); +extern int utc_tizen_core_add_event_p(void); +extern int utc_tizen_core_add_event_n(void); +extern int utc_tizen_core_emit_event_p(void); +extern int utc_tizen_core_emit_event_n(void); +extern int utc_tizen_core_add_source_p(void); +extern int utc_tizen_core_add_source_n(void); +extern int utc_tizen_core_remove_source_p(void); +extern int utc_tizen_core_remove_source_n(void); +extern int utc_tizen_core_source_create_p(void); +extern int utc_tizen_core_source_create_n(void); +extern int utc_tizen_core_source_destroy_p(void); +extern int utc_tizen_core_source_destroy_n(void); +extern int utc_tizen_core_source_add_poll_p(void); +extern int utc_tizen_core_source_add_poll_n(void); +extern int utc_tizen_core_source_remove_poll_p(void); +extern int utc_tizen_core_source_remove_poll_n(void); +extern int utc_tizen_core_source_set_prepare_cb_p(void); +extern int utc_tizen_core_source_set_prepare_cb_n(void); +extern int utc_tizen_core_source_set_check_cb_p(void); +extern int utc_tizen_core_source_set_check_cb_n(void); +extern int utc_tizen_core_source_set_dispatch_cb_p(void); +extern int utc_tizen_core_source_set_dispatch_cb_n(void); +extern int utc_tizen_core_source_set_finalize_cb_p(void); +extern int utc_tizen_core_source_set_finalize_cb_n(void); +extern int utc_tizen_core_source_set_priority_p(void); +extern int utc_tizen_core_source_set_priority_n(void); +extern int utc_tizen_core_poll_fd_create_p(void); +extern int utc_tizen_core_poll_fd_create_n(void); +extern int utc_tizen_core_poll_fd_destroy_p(void); +extern int utc_tizen_core_poll_fd_destroy_n(void); +extern int utc_tizen_core_poll_fd_set_fd_p(void); +extern int utc_tizen_core_poll_fd_set_fd_n(void); +extern int utc_tizen_core_poll_fd_get_fd_p(void); +extern int utc_tizen_core_poll_fd_get_fd_n(void); +extern int utc_tizen_core_poll_fd_set_events_p(void); +extern int utc_tizen_core_poll_fd_set_events_n(void); +extern int utc_tizen_core_poll_fd_get_events_p(void); +extern int utc_tizen_core_poll_fd_get_events_n(void); +extern int utc_tizen_core_poll_fd_set_returned_events_p(void); +extern int utc_tizen_core_poll_fd_set_returned_events_n(void); +extern int utc_tizen_core_poll_fd_get_returned_events_p(void); +extern int utc_tizen_core_poll_fd_get_returned_events_n(void); + +// utc-tizen-core-channel.c +extern void utc_tizen_core_channel_startup(void); +extern void utc_tizen_core_channel_cleanup(void); +extern int utc_tizen_core_channel_make_pair_p(void); +extern int utc_tizen_core_channel_make_pair_n(void); +extern int utc_tizen_core_channel_sender_send_p(void); +extern int utc_tizen_core_channel_sender_send_n(void); +extern int utc_tizen_core_channel_sender_destroy_p(void); +extern int utc_tizen_core_channel_sender_destroy_n(void); +extern int utc_tizen_core_channel_sender_clone_p(void); +extern int utc_tizen_core_channel_sender_clone_n(void); +extern int utc_tizen_core_channel_receiver_receive_p(void); +extern int utc_tizen_core_channel_receiver_receive_n(void); +extern int utc_tizen_core_channel_receiver_destroy_p(void); +extern int utc_tizen_core_channel_receiver_destroy_n(void); +extern int utc_tizen_core_channel_object_create_p(void); +extern int utc_tizen_core_channel_object_create_n(void); +extern int utc_tizen_core_channel_object_destroy_p(void); +extern int utc_tizen_core_channel_object_destroy_n(void); +extern int utc_tizen_core_channel_object_set_id_p(void); +extern int utc_tizen_core_channel_object_set_id_n(void); +extern int utc_tizen_core_channel_object_get_id_p(void); +extern int utc_tizen_core_channel_object_get_id_n(void); +extern int utc_tizen_core_channel_object_set_data_p(void); +extern int utc_tizen_core_channel_object_set_data_n(void); +extern int utc_tizen_core_channel_object_get_data_p(void); +extern int utc_tizen_core_channel_object_get_data_n(void); +extern int utc_tizen_core_channel_object_get_sender_task_name_p(void); +extern int utc_tizen_core_channel_object_get_sender_task_name_n(void); + +// utc-tizen-core-event.c +extern void utc_tizen_core_event_startup(void); +extern void utc_tizen_core_event_cleanup(void); +extern int utc_tizen_core_event_create_p(void); +extern int utc_tizen_core_event_create_n(void); +extern int utc_tizen_core_event_destroy_p(void); +extern int utc_tizen_core_event_destroy_n(void); +extern int utc_tizen_core_event_add_handler_p(void); +extern int utc_tizen_core_event_add_handler_n(void); +extern int utc_tizen_core_event_remove_handler_p(void); +extern int utc_tizen_core_event_remove_handler_n(void); +extern int utc_tizen_core_event_emit_p(void); +extern int utc_tizen_core_event_emit_n(void); +extern int utc_tizen_core_event_object_create_p(void); +extern int utc_tizen_core_event_object_create_n(void); +extern int utc_tizen_core_event_object_destroy_p(void); +extern int utc_tizen_core_event_object_destroy_n(void); +extern int utc_tizen_core_event_object_set_destroy_cb_p(void); +extern int utc_tizen_core_event_object_set_destroy_cb_n(void); +extern int utc_tizen_core_event_object_get_id_p(void); +extern int utc_tizen_core_event_object_get_id_n(void); +extern int utc_tizen_core_event_object_get_data_p(void); +extern int utc_tizen_core_event_object_get_data_n(void); + +testcase tc_array[] = { + // utc-tizen-core.c + {"utc_tizen_core_init_p", utc_tizen_core_init_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_shutdown_p", utc_tizen_core_shutdown_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_ready_p", utc_tizen_core_ready_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_ready_n", utc_tizen_core_ready_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_task_create_p", utc_tizen_core_task_create_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_create_n", utc_tizen_core_task_create_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_destroy_p", utc_tizen_core_task_destroy_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_destroy_n", utc_tizen_core_task_destroy_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_run_p", utc_tizen_core_task_run_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_run_n", utc_tizen_core_task_run_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_is_running_p", utc_tizen_core_task_is_running_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_is_running_n", utc_tizen_core_task_is_running_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_quit_p", utc_tizen_core_task_quit_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_quit_n", utc_tizen_core_task_quit_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_get_tizen_core_p", + utc_tizen_core_task_get_tizen_core_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_task_get_tizen_core_n", + utc_tizen_core_task_get_tizen_core_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_find_p", utc_tizen_core_find_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_find_n", utc_tizen_core_find_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_find_from_this_thread_p", + utc_tizen_core_find_from_this_thread_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_find_from_this_thread_n", + utc_tizen_core_find_from_this_thread_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_add_idle_job_p", utc_tizen_core_add_idle_job_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_idle_job_n", utc_tizen_core_add_idle_job_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_timer_p", utc_tizen_core_add_timer_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_timer_n", utc_tizen_core_add_timer_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_channel_p", utc_tizen_core_add_channel_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_channel_n", utc_tizen_core_add_channel_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_event_p", utc_tizen_core_add_event_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_event_n", utc_tizen_core_add_event_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_emit_event_p", utc_tizen_core_emit_event_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_emit_event_n", utc_tizen_core_emit_event_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_source_p", utc_tizen_core_add_source_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_source_n", utc_tizen_core_add_source_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_remove_source_p", utc_tizen_core_remove_source_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_remove_source_n", utc_tizen_core_remove_source_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_create_p", utc_tizen_core_source_create_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_create_n", utc_tizen_core_source_create_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_destroy_p", utc_tizen_core_source_destroy_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_destroy_n", utc_tizen_core_source_destroy_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_add_poll_p", utc_tizen_core_source_add_poll_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_add_poll_n", utc_tizen_core_source_add_poll_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_remove_poll_p", utc_tizen_core_source_remove_poll_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_remove_poll_n", utc_tizen_core_source_remove_poll_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_prepare_cb_p", + utc_tizen_core_source_set_prepare_cb_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_prepare_cb_n", + utc_tizen_core_source_set_prepare_cb_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_check_cb_p", + utc_tizen_core_source_set_check_cb_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_check_cb_n", + utc_tizen_core_source_set_check_cb_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_dispatch_cb_p", + utc_tizen_core_source_set_dispatch_cb_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_dispatch_cb_n", + utc_tizen_core_source_set_dispatch_cb_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_finalize_cb_p", + utc_tizen_core_source_set_finalize_cb_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_finalize_cb_n", + utc_tizen_core_source_set_finalize_cb_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_priority_p", + utc_tizen_core_source_set_priority_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_priority_n", + utc_tizen_core_source_set_priority_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_create_p", utc_tizen_core_poll_fd_create_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_create_n", utc_tizen_core_poll_fd_create_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_destroy_p", utc_tizen_core_poll_fd_destroy_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_destroy_n", utc_tizen_core_poll_fd_destroy_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_set_fd_p", utc_tizen_core_poll_fd_set_fd_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_set_fd_n", utc_tizen_core_poll_fd_set_fd_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_get_fd_p", utc_tizen_core_poll_fd_get_fd_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_get_fd_n", utc_tizen_core_poll_fd_get_fd_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_set_events_p", utc_tizen_core_poll_fd_set_events_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_set_events_n", utc_tizen_core_poll_fd_set_events_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_get_events_p", utc_tizen_core_poll_fd_get_events_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_get_events_n", utc_tizen_core_poll_fd_get_events_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_set_returned_events_p", + utc_tizen_core_poll_fd_set_returned_events_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_set_returned_events_n", + utc_tizen_core_poll_fd_set_returned_events_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_get_returned_events_p", + utc_tizen_core_poll_fd_get_returned_events_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_get_returned_events_n", + utc_tizen_core_poll_fd_get_returned_events_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + // utc-tizen-core-channel.c + {"utc_tizen_core_channel_make_pair_p", utc_tizen_core_channel_make_pair_p, + utc_tizen_core_channel_startup, utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_make_pair_n", utc_tizen_core_channel_make_pair_n, + utc_tizen_core_channel_startup, utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_sender_send_p", + utc_tizen_core_channel_sender_send_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_sender_send_n", + utc_tizen_core_channel_sender_send_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_sender_destroy_p", + utc_tizen_core_channel_sender_destroy_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_sender_destroy_n", + utc_tizen_core_channel_sender_destroy_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_sender_clone_p", + utc_tizen_core_channel_sender_clone_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_sender_clone_n", + utc_tizen_core_channel_sender_clone_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_receiver_receive_p", + utc_tizen_core_channel_receiver_receive_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_receiver_receive_n", + utc_tizen_core_channel_receiver_receive_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_receiver_destroy_p", + utc_tizen_core_channel_receiver_destroy_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_receiver_destroy_n", + utc_tizen_core_channel_receiver_destroy_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_create_p", + utc_tizen_core_channel_object_create_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_create_n", + utc_tizen_core_channel_object_create_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_destroy_p", + utc_tizen_core_channel_object_destroy_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_destroy_n", + utc_tizen_core_channel_object_destroy_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_set_id_p", + utc_tizen_core_channel_object_set_id_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_set_id_n", + utc_tizen_core_channel_object_set_id_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_get_id_p", + utc_tizen_core_channel_object_get_id_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_get_id_n", + utc_tizen_core_channel_object_get_id_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_set_data_p", + utc_tizen_core_channel_object_set_data_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_set_data_n", + utc_tizen_core_channel_object_set_data_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_get_data_p", + utc_tizen_core_channel_object_get_data_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_get_data_n", + utc_tizen_core_channel_object_get_data_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_get_sender_task_name_p", + utc_tizen_core_channel_object_get_sender_task_name_p, + utc_tizen_core_channel_startup, utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_get_sender_task_name_n", + utc_tizen_core_channel_object_get_sender_task_name_n, + utc_tizen_core_channel_startup, utc_tizen_core_channel_cleanup}, + // utc-tizen-core-event.c + {"utc_tizen_core_event_create_p", utc_tizen_core_event_create_p, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_create_n", utc_tizen_core_event_create_n, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_destroy_p", utc_tizen_core_event_destroy_p, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_destroy_n", utc_tizen_core_event_destroy_n, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_add_handler_p", utc_tizen_core_event_add_handler_p, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_add_handler_n", utc_tizen_core_event_add_handler_n, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_remove_handler_p", + utc_tizen_core_event_remove_handler_p, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_remove_handler_n", + utc_tizen_core_event_remove_handler_n, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_emit_p", utc_tizen_core_event_emit_p, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_emit_n", utc_tizen_core_event_emit_n, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_create_p", + utc_tizen_core_event_object_create_p, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_create_n", + utc_tizen_core_event_object_create_n, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_destroy_p", + utc_tizen_core_event_object_destroy_p, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_destroy_n", + utc_tizen_core_event_object_destroy_n, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_set_destroy_cb_p", + utc_tizen_core_event_object_set_destroy_cb_p, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_set_destroy_cb_n", + utc_tizen_core_event_object_set_destroy_cb_n, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_get_id_p", + utc_tizen_core_event_object_get_id_p, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_get_id_n", + utc_tizen_core_event_object_get_id_n, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_get_data_p", + utc_tizen_core_event_object_get_data_p, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_get_data_n", + utc_tizen_core_event_object_get_data_n, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {NULL, NULL}}; + +#endif // __TCT_TIZEN_CORE_NATIVE_H__ diff --git a/src/utc/tizen-core/tct-tizen-core-core_wearable.h b/src/utc/tizen-core/tct-tizen-core-core_wearable.h new file mode 100644 index 000000000..e280a4c8d --- /dev/null +++ b/src/utc/tizen-core/tct-tizen-core-core_wearable.h @@ -0,0 +1,436 @@ +// +// Copyright (c) 2024 Samsung Electronics Co., Ltd. +// +// 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. +// +#ifndef __TCT_TIZEN_CORE_NATIVE_H__ +#define __TCT_TIZEN_CORE_NATIVE_H__ + +#include "testcase.h" +#include "tct_common.h" + +// utc-tizen-core.c +extern void utc_tizen_core_startup(void); +extern void utc_tizen_core_cleanup(void); +extern int utc_tizen_core_init_p(void); +extern int utc_tizen_core_shutdown_p(void); +extern int utc_tizen_core_ready_p(void); +extern int utc_tizen_core_ready_n(void); +extern int utc_tizen_core_task_create_p(void); +extern int utc_tizen_core_task_create_n(void); +extern int utc_tizen_core_task_destroy_p(void); +extern int utc_tizen_core_task_destroy_n(void); +extern int utc_tizen_core_task_run_p(void); +extern int utc_tizen_core_task_run_n(void); +extern int utc_tizen_core_task_is_running_p(void); +extern int utc_tizen_core_task_is_running_n(void); +extern int utc_tizen_core_task_quit_p(void); +extern int utc_tizen_core_task_quit_n(void); +extern int utc_tizen_core_task_get_tizen_core_p(void); +extern int utc_tizen_core_task_get_tizen_core_n(void); +extern int utc_tizen_core_find_p(void); +extern int utc_tizen_core_find_n(void); +extern int utc_tizen_core_find_from_this_thread_p(void); +extern int utc_tizen_core_find_from_this_thread_n(void); +extern int utc_tizen_core_add_idle_job_p(void); +extern int utc_tizen_core_add_idle_job_n(void); +extern int utc_tizen_core_add_timer_p(void); +extern int utc_tizen_core_add_timer_n(void); +extern int utc_tizen_core_add_channel_p(void); +extern int utc_tizen_core_add_channel_n(void); +extern int utc_tizen_core_add_event_p(void); +extern int utc_tizen_core_add_event_n(void); +extern int utc_tizen_core_emit_event_p(void); +extern int utc_tizen_core_emit_event_n(void); +extern int utc_tizen_core_add_source_p(void); +extern int utc_tizen_core_add_source_n(void); +extern int utc_tizen_core_remove_source_p(void); +extern int utc_tizen_core_remove_source_n(void); +extern int utc_tizen_core_source_create_p(void); +extern int utc_tizen_core_source_create_n(void); +extern int utc_tizen_core_source_destroy_p(void); +extern int utc_tizen_core_source_destroy_n(void); +extern int utc_tizen_core_source_add_poll_p(void); +extern int utc_tizen_core_source_add_poll_n(void); +extern int utc_tizen_core_source_remove_poll_p(void); +extern int utc_tizen_core_source_remove_poll_n(void); +extern int utc_tizen_core_source_set_prepare_cb_p(void); +extern int utc_tizen_core_source_set_prepare_cb_n(void); +extern int utc_tizen_core_source_set_check_cb_p(void); +extern int utc_tizen_core_source_set_check_cb_n(void); +extern int utc_tizen_core_source_set_dispatch_cb_p(void); +extern int utc_tizen_core_source_set_dispatch_cb_n(void); +extern int utc_tizen_core_source_set_finalize_cb_p(void); +extern int utc_tizen_core_source_set_finalize_cb_n(void); +extern int utc_tizen_core_source_set_priority_p(void); +extern int utc_tizen_core_source_set_priority_n(void); +extern int utc_tizen_core_poll_fd_create_p(void); +extern int utc_tizen_core_poll_fd_create_n(void); +extern int utc_tizen_core_poll_fd_destroy_p(void); +extern int utc_tizen_core_poll_fd_destroy_n(void); +extern int utc_tizen_core_poll_fd_set_fd_p(void); +extern int utc_tizen_core_poll_fd_set_fd_n(void); +extern int utc_tizen_core_poll_fd_get_fd_p(void); +extern int utc_tizen_core_poll_fd_get_fd_n(void); +extern int utc_tizen_core_poll_fd_set_events_p(void); +extern int utc_tizen_core_poll_fd_set_events_n(void); +extern int utc_tizen_core_poll_fd_get_events_p(void); +extern int utc_tizen_core_poll_fd_get_events_n(void); +extern int utc_tizen_core_poll_fd_set_returned_events_p(void); +extern int utc_tizen_core_poll_fd_set_returned_events_n(void); +extern int utc_tizen_core_poll_fd_get_returned_events_p(void); +extern int utc_tizen_core_poll_fd_get_returned_events_n(void); + +// utc-tizen-core-channel.c +extern void utc_tizen_core_channel_startup(void); +extern void utc_tizen_core_channel_cleanup(void); +extern int utc_tizen_core_channel_make_pair_p(void); +extern int utc_tizen_core_channel_make_pair_n(void); +extern int utc_tizen_core_channel_sender_send_p(void); +extern int utc_tizen_core_channel_sender_send_n(void); +extern int utc_tizen_core_channel_sender_destroy_p(void); +extern int utc_tizen_core_channel_sender_destroy_n(void); +extern int utc_tizen_core_channel_sender_clone_p(void); +extern int utc_tizen_core_channel_sender_clone_n(void); +extern int utc_tizen_core_channel_receiver_receive_p(void); +extern int utc_tizen_core_channel_receiver_receive_n(void); +extern int utc_tizen_core_channel_receiver_destroy_p(void); +extern int utc_tizen_core_channel_receiver_destroy_n(void); +extern int utc_tizen_core_channel_object_create_p(void); +extern int utc_tizen_core_channel_object_create_n(void); +extern int utc_tizen_core_channel_object_destroy_p(void); +extern int utc_tizen_core_channel_object_destroy_n(void); +extern int utc_tizen_core_channel_object_set_id_p(void); +extern int utc_tizen_core_channel_object_set_id_n(void); +extern int utc_tizen_core_channel_object_get_id_p(void); +extern int utc_tizen_core_channel_object_get_id_n(void); +extern int utc_tizen_core_channel_object_set_data_p(void); +extern int utc_tizen_core_channel_object_set_data_n(void); +extern int utc_tizen_core_channel_object_get_data_p(void); +extern int utc_tizen_core_channel_object_get_data_n(void); +extern int utc_tizen_core_channel_object_get_sender_task_name_p(void); +extern int utc_tizen_core_channel_object_get_sender_task_name_n(void); + +// utc-tizen-core-event.c +extern void utc_tizen_core_event_startup(void); +extern void utc_tizen_core_event_cleanup(void); +extern int utc_tizen_core_event_create_p(void); +extern int utc_tizen_core_event_create_n(void); +extern int utc_tizen_core_event_destroy_p(void); +extern int utc_tizen_core_event_destroy_n(void); +extern int utc_tizen_core_event_add_handler_p(void); +extern int utc_tizen_core_event_add_handler_n(void); +extern int utc_tizen_core_event_remove_handler_p(void); +extern int utc_tizen_core_event_remove_handler_n(void); +extern int utc_tizen_core_event_emit_p(void); +extern int utc_tizen_core_event_emit_n(void); +extern int utc_tizen_core_event_object_create_p(void); +extern int utc_tizen_core_event_object_create_n(void); +extern int utc_tizen_core_event_object_destroy_p(void); +extern int utc_tizen_core_event_object_destroy_n(void); +extern int utc_tizen_core_event_object_set_destroy_cb_p(void); +extern int utc_tizen_core_event_object_set_destroy_cb_n(void); +extern int utc_tizen_core_event_object_get_id_p(void); +extern int utc_tizen_core_event_object_get_id_n(void); +extern int utc_tizen_core_event_object_get_data_p(void); +extern int utc_tizen_core_event_object_get_data_n(void); + +testcase tc_array[] = { + // utc-tizen-core.c + {"utc_tizen_core_init_p", utc_tizen_core_init_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_shutdown_p", utc_tizen_core_shutdown_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_ready_p", utc_tizen_core_ready_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_ready_n", utc_tizen_core_ready_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_task_create_p", utc_tizen_core_task_create_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_create_n", utc_tizen_core_task_create_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_destroy_p", utc_tizen_core_task_destroy_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_destroy_n", utc_tizen_core_task_destroy_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_run_p", utc_tizen_core_task_run_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_run_n", utc_tizen_core_task_run_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_is_running_p", utc_tizen_core_task_is_running_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_is_running_n", utc_tizen_core_task_is_running_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_quit_p", utc_tizen_core_task_quit_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_quit_n", utc_tizen_core_task_quit_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_task_get_tizen_core_p", + utc_tizen_core_task_get_tizen_core_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_task_get_tizen_core_n", + utc_tizen_core_task_get_tizen_core_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_find_p", utc_tizen_core_find_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_find_n", utc_tizen_core_find_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_find_from_this_thread_p", + utc_tizen_core_find_from_this_thread_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_find_from_this_thread_n", + utc_tizen_core_find_from_this_thread_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_add_idle_job_p", utc_tizen_core_add_idle_job_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_idle_job_n", utc_tizen_core_add_idle_job_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_timer_p", utc_tizen_core_add_timer_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_timer_n", utc_tizen_core_add_timer_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_channel_p", utc_tizen_core_add_channel_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_channel_n", utc_tizen_core_add_channel_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_event_p", utc_tizen_core_add_event_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_event_n", utc_tizen_core_add_event_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_emit_event_p", utc_tizen_core_emit_event_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_emit_event_n", utc_tizen_core_emit_event_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_source_p", utc_tizen_core_add_source_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_add_source_n", utc_tizen_core_add_source_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_remove_source_p", utc_tizen_core_remove_source_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_remove_source_n", utc_tizen_core_remove_source_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_create_p", utc_tizen_core_source_create_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_create_n", utc_tizen_core_source_create_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_destroy_p", utc_tizen_core_source_destroy_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_destroy_n", utc_tizen_core_source_destroy_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_add_poll_p", utc_tizen_core_source_add_poll_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_add_poll_n", utc_tizen_core_source_add_poll_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_remove_poll_p", utc_tizen_core_source_remove_poll_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_remove_poll_n", utc_tizen_core_source_remove_poll_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_prepare_cb_p", + utc_tizen_core_source_set_prepare_cb_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_prepare_cb_n", + utc_tizen_core_source_set_prepare_cb_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_check_cb_p", + utc_tizen_core_source_set_check_cb_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_check_cb_n", + utc_tizen_core_source_set_check_cb_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_dispatch_cb_p", + utc_tizen_core_source_set_dispatch_cb_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_dispatch_cb_n", + utc_tizen_core_source_set_dispatch_cb_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_finalize_cb_p", + utc_tizen_core_source_set_finalize_cb_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_finalize_cb_n", + utc_tizen_core_source_set_finalize_cb_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_priority_p", + utc_tizen_core_source_set_priority_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_source_set_priority_n", + utc_tizen_core_source_set_priority_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_create_p", utc_tizen_core_poll_fd_create_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_create_n", utc_tizen_core_poll_fd_create_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_destroy_p", utc_tizen_core_poll_fd_destroy_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_destroy_n", utc_tizen_core_poll_fd_destroy_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_set_fd_p", utc_tizen_core_poll_fd_set_fd_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_set_fd_n", utc_tizen_core_poll_fd_set_fd_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_get_fd_p", utc_tizen_core_poll_fd_get_fd_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_get_fd_n", utc_tizen_core_poll_fd_get_fd_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_set_events_p", utc_tizen_core_poll_fd_set_events_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_set_events_n", utc_tizen_core_poll_fd_set_events_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_get_events_p", utc_tizen_core_poll_fd_get_events_p, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_get_events_n", utc_tizen_core_poll_fd_get_events_n, + utc_tizen_core_startup, utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_set_returned_events_p", + utc_tizen_core_poll_fd_set_returned_events_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_set_returned_events_n", + utc_tizen_core_poll_fd_set_returned_events_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_get_returned_events_p", + utc_tizen_core_poll_fd_get_returned_events_p, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + {"utc_tizen_core_poll_fd_get_returned_events_n", + utc_tizen_core_poll_fd_get_returned_events_n, utc_tizen_core_startup, + utc_tizen_core_cleanup}, + // utc-tizen-core-channel.c + {"utc_tizen_core_channel_make_pair_p", utc_tizen_core_channel_make_pair_p, + utc_tizen_core_channel_startup, utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_make_pair_n", utc_tizen_core_channel_make_pair_n, + utc_tizen_core_channel_startup, utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_sender_send_p", + utc_tizen_core_channel_sender_send_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_sender_send_n", + utc_tizen_core_channel_sender_send_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_sender_destroy_p", + utc_tizen_core_channel_sender_destroy_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_sender_destroy_n", + utc_tizen_core_channel_sender_destroy_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_sender_clone_p", + utc_tizen_core_channel_sender_clone_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_sender_clone_n", + utc_tizen_core_channel_sender_clone_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_receiver_receive_p", + utc_tizen_core_channel_receiver_receive_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_receiver_receive_n", + utc_tizen_core_channel_receiver_receive_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_receiver_destroy_p", + utc_tizen_core_channel_receiver_destroy_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_receiver_destroy_n", + utc_tizen_core_channel_receiver_destroy_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_create_p", + utc_tizen_core_channel_object_create_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_create_n", + utc_tizen_core_channel_object_create_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_destroy_p", + utc_tizen_core_channel_object_destroy_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_destroy_n", + utc_tizen_core_channel_object_destroy_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_set_id_p", + utc_tizen_core_channel_object_set_id_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_set_id_n", + utc_tizen_core_channel_object_set_id_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_get_id_p", + utc_tizen_core_channel_object_get_id_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_get_id_n", + utc_tizen_core_channel_object_get_id_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_set_data_p", + utc_tizen_core_channel_object_set_data_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_set_data_n", + utc_tizen_core_channel_object_set_data_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_get_data_p", + utc_tizen_core_channel_object_get_data_p, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_get_data_n", + utc_tizen_core_channel_object_get_data_n, utc_tizen_core_channel_startup, + utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_get_sender_task_name_p", + utc_tizen_core_channel_object_get_sender_task_name_p, + utc_tizen_core_channel_startup, utc_tizen_core_channel_cleanup}, + {"utc_tizen_core_channel_object_get_sender_task_name_n", + utc_tizen_core_channel_object_get_sender_task_name_n, + utc_tizen_core_channel_startup, utc_tizen_core_channel_cleanup}, + // utc-tizen-core-event.c + {"utc_tizen_core_event_create_p", utc_tizen_core_event_create_p, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_create_n", utc_tizen_core_event_create_n, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_destroy_p", utc_tizen_core_event_destroy_p, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_destroy_n", utc_tizen_core_event_destroy_n, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_add_handler_p", utc_tizen_core_event_add_handler_p, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_add_handler_n", utc_tizen_core_event_add_handler_n, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_remove_handler_p", + utc_tizen_core_event_remove_handler_p, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_remove_handler_n", + utc_tizen_core_event_remove_handler_n, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_emit_p", utc_tizen_core_event_emit_p, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_emit_n", utc_tizen_core_event_emit_n, + utc_tizen_core_event_startup, utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_create_p", + utc_tizen_core_event_object_create_p, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_create_n", + utc_tizen_core_event_object_create_n, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_destroy_p", + utc_tizen_core_event_object_destroy_p, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_destroy_n", + utc_tizen_core_event_object_destroy_n, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_set_destroy_cb_p", + utc_tizen_core_event_object_set_destroy_cb_p, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_set_destroy_cb_n", + utc_tizen_core_event_object_set_destroy_cb_n, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_get_id_p", + utc_tizen_core_event_object_get_id_p, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_get_id_n", + utc_tizen_core_event_object_get_id_n, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_get_data_p", + utc_tizen_core_event_object_get_data_p, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {"utc_tizen_core_event_object_get_data_n", + utc_tizen_core_event_object_get_data_n, utc_tizen_core_event_startup, + utc_tizen_core_event_cleanup}, + {NULL, NULL}}; + +#endif // __TCT_TIZEN_CORE_NATIVE_H__ diff --git a/src/utc/tizen-core/utc-tizen-core-channel.c b/src/utc/tizen-core/utc-tizen-core-channel.c new file mode 100644 index 000000000..da1991ace --- /dev/null +++ b/src/utc/tizen-core/utc-tizen-core-channel.c @@ -0,0 +1,619 @@ +// +// Copyright (c) 2024 Samsung Electronics Co., Ltd. +// +// 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 +#include +#include + +#include "assert.h" + +#undef LOG_TAG +#define LOG_TAG "NativeTCT" + +static tizen_core_channel_sender_h __sender; +static tizen_core_channel_receiver_h __receiver; +static tizen_core_channel_object_h __object; +static tizen_core_task_h __sender_task; + +void utc_tizen_core_channel_startup(void) +{ + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + tizen_core_init(); + tizen_core_channel_make_pair(&__sender, &__receiver); + tizen_core_channel_object_create(&__object); + tizen_core_channel_object_set_id(__object, 99); + tizen_core_channel_object_set_data(__object, "test"); + tizen_core_task_create("sender", true, &__sender_task); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); +} + +void utc_tizen_core_channel_cleanup(void) +{ + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + if (__sender_task) { + tizen_core_task_destroy(__sender_task); + __sender_task = NULL; + } + + if (__object) { + tizen_core_channel_object_destroy(__object); + __object = NULL; + } + + if (__sender) { + tizen_core_channel_sender_destroy(__sender); + __sender = NULL; + } + + if (__receiver) { + tizen_core_channel_receiver_destroy(__receiver); + __receiver = NULL; + } + tizen_core_shutdown(); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); +} + +/** + * @testcase utc_tizen_core_channel_make_pair_p + * @since_tizen 9.0 + * @type Positive + * @description Makes a pair of channel sender and receiver. + * @scenario Calls the tizen_core_channel_make_pair(). + */ +int utc_tizen_core_channel_make_pair_p(void) +{ + tizen_core_channel_sender_h sender = NULL; + tizen_core_channel_receiver_h receiver = NULL; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_channel_make_pair(&sender, &receiver); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(sender, NULL); + assert_neq(receiver, NULL); + tizen_core_channel_sender_destroy(sender); + tizen_core_channel_receiver_destroy(receiver); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_channel_make_pair_n + * @since_tizen 9.0 + * @type Negative + * @description Makes a pair of channel sender and receiver. + * @scenario Calls the tizen_core_channel_make_pair() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_channel_make_pair_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_channel_make_pair(NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_channel_sender_send_p + * @since_tizen 9.0 + * @type Positive + * @description Sends the channel object to the receiver. + * @scenario Calls the tizen_core_channel_sender_send(). + */ +int utc_tizen_core_channel_sender_send_p(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_channel_sender_send(__sender, __object); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_channel_sender_send_n + * @since_tizen 9.0 + * @type Negative + * @description Sends the channel object to the receiver. + * @scenario Calls the tizen_core_channel_sender_send() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_channel_sender_send_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_channel_sender_send(NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_channel_sender_destroy_p + * @since_tizen 9.0 + * @type Positive + * @description Destroys the channel sender handle. + * @scenario Calls the tizen_core_channel_sender_destroy(). + */ +int utc_tizen_core_channel_sender_destroy_p(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_channel_sender_destroy(__sender); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + __sender = NULL; + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_channel_sender_destroy_n + * @since_tizen 9.0 + * @type Negative + * @description Destroys the channel sender handle. + * @scenario Calls the tizen_core_channel_sender_destroy() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_channel_sender_destroy_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_channel_sender_destroy(NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_channel_sender_clone_p + * @since_tizen 9.0 + * @type Positive + * @description Creates and returns a copy of the given the sender handle. + * @scenario Calls the tizen_core_channel_sender_clone(). + */ +int utc_tizen_core_channel_sender_clone_p(void) +{ + tizen_core_channel_sender_h cloned_sender = NULL; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_channel_sender_clone(__sender, &cloned_sender); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(cloned_sender, NULL); + tizen_core_channel_sender_destroy(cloned_sender); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_channel_sender_clone_n + * @since_tizen 9.0 + * @type Negative + * @description Creates and returns a copy of the given the sender handle. + * @scenario Calls the tizen_core_channel_sender_clone() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_channel_sender_clone_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_channel_sender_clone(NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_channel_receiver_receive_p + * @since_tizen 9.0 + * @type Positive + * @description Receives the channel object from the sender. + * @scenario Calls the tizen_core_channel_sender_send(). + * And, calls the tizen_core_channel_receiver_receive(). + */ +int utc_tizen_core_channel_receiver_receive_p(void) +{ + tizen_core_channel_object_h object = NULL; + int id = -1; + char *data = NULL; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_channel_sender_send(__sender, __object); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + + ret = tizen_core_channel_receiver_receive(__receiver, &object); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(object, NULL); + + ret = tizen_core_channel_object_get_id(object, &id); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_eq(id, 99); + + ret = tizen_core_channel_object_get_data(object, (void **)&data); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(data, NULL); + + tizen_core_channel_object_destroy(object); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_channel_receiver_receive_n + * @since_tizen 9.0 + * @type Negative + * @description Receives the channel object from the sender. + * @scenario Calls the tizen_core_channel_receiver_receive() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_channel_receiver_receive_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_channel_receiver_receive(NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_channel_receiver_destroy_p + * @since_tizen 9.0 + * @type Positive + * @description Destroys the tizen core channel receiver handle. + * @scenario Calls the tizen_core_channel_receiver_destroy(). + */ +int utc_tizen_core_channel_receiver_destroy_p(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_channel_receiver_destroy(__receiver); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + __receiver = NULL; + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_channel_receiver_destroy_n + * @since_tizen 9.0 + * @type Negative + * @description Destroys the tizen core channel receiver handle. + * @scenario Calls the tizen_core_channel_receiver_destroy() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_channel_receiver_destroy_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_channel_receiver_destroy(NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_channel_object_create_p + * @since_tizen 9.0 + * @type Positive + * @description Creates the tizen core channel object handle. + * @scenario Calls the tizen_core_channel_object_create(). + */ +int utc_tizen_core_channel_object_create_p(void) +{ + tizen_core_channel_object_h object = NULL; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_channel_object_create(&object); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(object, NULL); + tizen_core_channel_object_destroy(object); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_channel_object_create_n + * @since_tizen 9.0 + * @type Negative + * @description Creates the tizen core channel object handle. + * @scenario Calls the tizen_core_channel_object_create() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_channel_object_create_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_channel_object_create(NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_channel_object_destroy_p + * @since_tizen 9.0 + * @type Positive + * @description Destroys the tizen core channel object handle. + * @scenario Calls the tizen_core_channel_object_destroy(). + */ +int utc_tizen_core_channel_object_destroy_p(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_channel_object_destroy(__object); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + __object = NULL; + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_channel_object_destroy_n + * @since_tizen 9.0 + * @type Negative + * @description Destroys the tizen core channel object handle. + * @scenario Calls the tizen_core_channel_object_destroy() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_channel_object_destroy_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_channel_object_destroy(NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_channel_object_set_id_p + * @since_tizen 9.0 + * @type Positive + * @description Sets the ID to the tizen core channel object handle. + * @scenario Calls the tizen_core_channel_object_set_id(). + */ +int utc_tizen_core_channel_object_set_id_p(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_channel_object_set_id(__object, 22); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_channel_object_set_id_n + * @since_tizen 9.0 + * @type Negative + * @description Sets the ID to the tizen core channel object handle. + * @scenario Calls the tizen_core_channel_object_set_id() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_channel_object_set_id_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_channel_object_set_id(NULL, -1); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_channel_object_get_id_p + * @since_tizen 9.0 + * @type Positive + * @description Gets the ID from the tizen core channel object handle. + * @scenario Calls the tizen_core_channel_object_get_id(). + */ +int utc_tizen_core_channel_object_get_id_p(void) +{ + int id = -1; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_channel_object_get_id(__object, &id); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_eq(id, 99); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_channel_object_get_id_n + * @since_tizen 9.0 + * @type Negative + * @description Gets the ID from the tizen core channel object handle. + * @scenario Calls the tizen_core_channel_object_get_id() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_channel_object_get_id_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_channel_object_get_id(NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_channel_object_set_data_p + * @since_tizen 9.0 + * @type Positive + * @description Sets the data to the tizen core channel object handle. + * @scenario Calls the tizen_core_channel_object_set_data(). + */ +int utc_tizen_core_channel_object_set_data_p(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_channel_object_set_data(__object, "test2"); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_channel_object_set_data_n + * @since_tizen 9.0 + * @type Negative + * @description Sets the data to the tizen core channel object handle. + * @scenario Calls the tizen_core_channel_object_set_data() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_channel_object_set_data_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_channel_object_set_data(NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_channel_object_get_data_p + * @since_tizen 9.0 + * @type Positive + * @description Gets the data from the tizen core channel object handle. + * @scenario Calls the tizen_core_channel_object_get_data(). + */ +int utc_tizen_core_channel_object_get_data_p(void) +{ + char *data = NULL; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_channel_object_get_data(__object, (void **)&data); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(data, NULL); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_channel_object_get_data_n + * @since_tizen 9.0 + * @type Negative + * @description Gets the data from the tizen core channel object handle. + * @scenario Calls the tizen_core_channel_object_get_data() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_channel_object_get_data_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_channel_object_get_data(NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +static bool sender_idle_job_cb(void *user_data) +{ + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + tizen_core_channel_sender_send(__sender, __object); + tizen_core_task_quit(__sender_task); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return false; +} + +/** + * @testcase utc_tizen_core_channel_object_get_sender_task_name_p + * @since_tizen 9.0 + * @type Positive + * @description Gets the sender task name from the tizen core channel object handle. + * @scenario Adds an idle job and runs the sender task. + * Calls the tizen_core_channel_receiver_receive(). + * Calls the tizen_core_channel_object_get_sender_task_name(). + * And then, checks the sender task name. + */ +int utc_tizen_core_channel_object_get_sender_task_name_p(void) +{ + tizen_core_h core = NULL; + tizen_core_source_h source = NULL; + tizen_core_channel_object_h object = NULL; + const char *task_name = NULL; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_task_get_tizen_core(__sender_task, &core); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(core, NULL); + + ret = tizen_core_add_idle_job(core, sender_idle_job_cb, NULL, &source); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(source, NULL); + + ret = tizen_core_task_run(__sender_task); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + + ret = tizen_core_channel_receiver_receive(__receiver, &object); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(object, NULL); + + ret = tizen_core_channel_object_get_sender_task_name(object, + &task_name); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_eq(strcmp(task_name, "sender"), 0); + tizen_core_channel_object_destroy(object); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_channel_object_get_sender_task_name_n + * @since_tizen 9.0 + * @type Negative + * @description Gets the sender task name from the tizen core channel object handle. + * @scenario Calls the tizen_core_channel_object_get_sender_task_name() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_channel_object_get_sender_task_name_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_channel_object_get_sender_task_name(NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} diff --git a/src/utc/tizen-core/utc-tizen-core-event.c b/src/utc/tizen-core/utc-tizen-core-event.c new file mode 100644 index 000000000..3d9af6c49 --- /dev/null +++ b/src/utc/tizen-core/utc-tizen-core-event.c @@ -0,0 +1,541 @@ +// +// Copyright (c) 2024 Samsung Electronics Co., Ltd. +// +// 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 +#include +#include + +#include "assert.h" + +#undef LOG_TAG +#define LOG_TAG "NativeTCT" + +static tizen_core_event_h __event; +static tizen_core_event_h __event_handler; +static tizen_core_event_object_h __object; +static bool __touched; + +static bool event_handler_cb(tizen_core_event_object_h object, void *user_data) +{ + return true; +} + +void utc_tizen_core_event_startup(void) +{ + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + tizen_core_init(); + tizen_core_event_create(&__event); + tizen_core_event_add_handler(__event, event_handler_cb, NULL, + &__event_handler); + tizen_core_event_object_create(&__object, 99, "test"); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); +} + +void utc_tizen_core_event_cleanup(void) +{ + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + if (__object) { + tizen_core_event_object_destroy(__object); + __object = NULL; + } + + if (__event_handler) { + if (__event) { + tizen_core_event_remove_handler(__event, + __event_handler); + } + + __event_handler = NULL; + } + + if (__event) { + tizen_core_event_destroy(__event); + __event = NULL; + } + tizen_core_shutdown(); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); +} + +/** + * @testcase utc_tizen_core_event_create_p + * @since_tizen 9.0 + * @type Positive + * @description Creates the tizen core event handle. + * @scenario Calls the tizen_core_event_create(). + */ +int utc_tizen_core_event_create_p(void) +{ + tizen_core_event_h event = NULL; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_event_create(&event); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(event, NULL); + tizen_core_event_destroy(event); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_event_create_n + * @since_tizen 9.0 + * @type Negative + * @description Creates the tizen core event handle. + * @scenario Calls the tizen_core_event_create() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_event_create_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_event_create(NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_event_destroy_p + * @since_tizen 9.0 + * @type Positive + * @description Destroys the tizen core event handle. + * @scenario Calls the tizen_core_event_destroy(). + */ +int utc_tizen_core_event_destroy_p(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_event_destroy(__event); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + __event = NULL; + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_event_destroy_n + * @since_tizen 9.0 + * @type Negative + * @description Destroys the tizen core event handle. + * @scenario Calls the tizen_core_event_destroy() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_event_destroy_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_event_destroy(NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +static bool add_handler_cb(tizen_core_event_object_h object, void *user_data) +{ + return true; +} + +/** + * @testcase utc_tizen_core_event_add_handler_p + * @since_tizen 9.0 + * @type Positive + * @description Adds the event handler to the tizen core event. + * @scenario Calls the tizen_core_event_add_handler(). + */ +int utc_tizen_core_event_add_handler_p(void) +{ + tizen_core_event_handler_h event_handler = NULL; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_event_add_handler(__event, add_handler_cb, NULL, + &event_handler); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(event_handler, NULL); + tizen_core_event_remove_handler(__event, event_handler); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_event_add_handler_n + * @since_tizen 9.0 + * @type Negative + * @description Adds the event handler to the tizen core event. + * @scenario Calls the tizen_core_event_add_handler() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_event_add_handler_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_event_add_handler(NULL, NULL, NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +static bool prepend_handler_cb(tizen_core_event_object_h object, + void *user_data) +{ + return true; +} + +/** + * @testcase utc_tizen_core_event_prepend_handler_p + * @since_tizen 9.0 + * @type Positive + * @description Prepends the event handler to the tizen core event. + * @scenario Calls the tizen_core_event_prepend_handler(). + */ +int utc_tizen_core_event_prepend_handler_p(void) +{ + tizen_core_event_handler_h event_handler = NULL; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_event_prepend_handler(__event, prepend_handler_cb, + NULL, &event_handler); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(event_handler, NULL); + tizen_core_event_remove_handler(__event, event_handler); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_event_prepend_handler_n + * @since_tizen 9.0 + * @type Negative + * @description Prepends the event handler to the tizen core event. + * @scenario Calls the tizen_core_event_prepend_handler() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_event_prepend_handler_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_event_prepend_handler(NULL, NULL, NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_event_remove_handler_p + * @since_tizen 9.0 + * @type Positive + * @description Removes the event handler from the tizen core event. + * @scenario Calls the tizen_core_event_remove_handler(). + */ +int utc_tizen_core_event_remove_handler_p(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_event_remove_handler(__event, __event_handler); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + __event_handler = NULL; + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_event_remove_handler_n + * @since_tizen 9.0 + * @type Negative + * @description Removes the event handler from the tizen core event. + * @scenario Calls the tizen_core_event_remove_handler() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_event_remove_handler_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_event_remove_handler(NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_event_emit_p + * @since_tizen 9.0 + * @type Positive + * @description Emits the event to the tizen core event. + * @scenario Calls the tizen_core_event_emit(). + * The event object will be emitted to the event. + * The event is passed to the event handler when + * tizen_core_emit_event() is called. + */ +int utc_tizen_core_event_emit_p(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_event_emit(__event, __object); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + __object = NULL; + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_event_emit_n + * @since_tizen 9.0 + * @type Negative + * @description Emits the event to the tizen core event. + * @scenario Calls the tizen_core_event_emit() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_event_emit_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_event_emit(NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_event_object_create_p + * @since_tizen 9.0 + * @type Positive + * @description Creates the tizen core event object handle. + * @scenario Calls the tizen_core_event_object_create(). + */ +int utc_tizen_core_event_object_create_p(void) +{ + tizen_core_event_object_h object = NULL; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_event_object_create(&object, 22, "test2"); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(object, NULL); + + tizen_core_event_object_destroy(object); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_event_object_create_n + * @since_tizen 9.0 + * @type Negative + * @description Creates the tizen core event object handle. + * @scenario Calls the tizen_core_event_object_create() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_event_object_create_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_event_object_create(NULL, 0, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_event_object_destroy_p + * @since_tizen 9.0 + * @type Positive + * @description Destroys the tizen core event object handle. + * @scenario Calls the tizen_core_event_object_destroy(). + */ +int utc_tizen_core_event_object_destroy_p(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_event_object_destroy(__object); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + __object = NULL; + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_event_object_destroy_n + * @since_tizen 9.0 + * @type Negative + * @description Destroys the tizen core event object handle. + * @scenario Calls the tizen_core_event_object_destroy() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_event_object_destroy_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_event_object_destroy(NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +static void event_object_destroy_cb(void *event_data, void *user_data) +{ + char *str = (char *)event_data; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + __touched = true; + if (str) + free(str); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); +} + +/** + * @testcase utc_tizen_core_event_object_set_destroy_cb_p + * @since_tizen 9.0 + * @type Positive + * @description Sets the destroy callback function to invoke when the event object is destroyed. + * @scenario Calls the tizen_core_event_object_create() and calls + * the tizen_core_event_object_set_destroy_cb(). + * Calls the tizen_core_event_object_destroy(). + * And then, checks whether the __touched flag is set or not. + */ +int utc_tizen_core_event_object_set_destroy_cb_p(void) +{ + tizen_core_event_object_h object = NULL; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_event_object_create(&object, 11, strdup("test_string")); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(object, NULL); + + ret = tizen_core_event_object_set_destroy_cb(object, + event_object_destroy_cb, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + + ret = tizen_core_event_object_destroy(object); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_eq(__touched, true); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_event_object_set_destroy_cb_n + * @since_tizen 9.0 + * @type Negative + * @description Sets the destroy callback function to invoke when the event object is destroyed. + * @scenario Calls the tizen_core_event_object_destroy() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_event_object_set_destroy_cb_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_event_object_set_destroy_cb(NULL, NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_event_object_get_id_p + * @since_tizen 9.0 + * @type Positive + * @description Gets the event ID from the tizen core event object handle. + * @scenario Calls the tizen_core_event_object_get_id(). + * And then, checks whether the id is equal to 99 or not. + */ +int utc_tizen_core_event_object_get_id_p(void) +{ + int id = -1; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_event_object_get_id(__object, &id); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_eq(id, 99); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_event_object_get_id_n + * @since_tizen 9.0 + * @type Negative + * @description Gets the event ID from the tizen core event object handle. + * @scenario Calls the tizen_core_event_object_get_id() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_event_object_get_id_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_event_object_get_id(NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_event_object_get_data_p + * @since_tizen 9.0 + * @type Positive + * @description Gets the event data from the tizen core event object handle. + * @scenario Calls the tizen_core_event_object_get_data(). + * And then, checks whether the data is equal to "test" or not. + */ +int utc_tizen_core_event_object_get_data_p(void) +{ + char *data = NULL; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_event_object_get_data(__object, (void **)&data); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(data, NULL); + assert_eq(strcmp(data, "test"), 0); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_event_object_get_data_n + * @since_tizen 9.0 + * @type Negative + * @description Gets the event data from the tizen core event object handle. + * @scenario Calls the tizen_core_event_object_get_data() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_event_object_get_data_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_event_object_get_data(NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} diff --git a/src/utc/tizen-core/utc-tizen-core.c b/src/utc/tizen-core/utc-tizen-core.c new file mode 100644 index 000000000..c2106f8e8 --- /dev/null +++ b/src/utc/tizen-core/utc-tizen-core.c @@ -0,0 +1,1789 @@ +// +// Copyright (c) 2024 Samsung Electronics Co., Ltd. +// +// 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 +#include +#include + +#include "assert.h" + +#undef LOG_TAG +#define LOG_TAG "NativeTCT" + +static tizen_core_task_h __main_task; +static tizen_core_task_h __task; +static tizen_core_source_h __source; +static bool __touched; + +static tizen_core_channel_sender_h __sender; +static tizen_core_channel_receiver_h __receiver; +static tizen_core_channel_object_h __channel_object; + +static tizen_core_event_h __event; +static tizen_core_event_object_h __event_object; +static int __event_id = 22; + +static tizen_core_poll_fd_h __poll_fd; + +static void tcore_setup(void) +{ + tizen_core_init(); + tizen_core_task_create("test_task", true, &__task); + tizen_core_task_create("main", false, &__main_task); + tizen_core_source_create(&__source); +} + +static void tcore_teardown(void) +{ + if (__source) { + tizen_core_source_destroy(__source); + __source = NULL; + } + + if (__main_task) { + tizen_core_task_destroy(__main_task); + __main_task = NULL; + } + + if (__task) { + tizen_core_task_destroy(__task); + __task = NULL; + } + + __touched = false; + tizen_core_shutdown(); +} + +static void tcore_channel_setup(void) +{ + tizen_core_channel_make_pair(&__sender, &__receiver); + tizen_core_channel_object_create(&__channel_object); + tizen_core_channel_object_set_id(__channel_object, 99); + tizen_core_channel_object_set_data(__channel_object, "test"); +} + +static void tcore_channel_teardown(void) +{ + if (__channel_object) { + tizen_core_channel_object_destroy(__channel_object); + __channel_object = NULL; + } + + if (__sender) { + tizen_core_channel_sender_destroy(__sender); + __sender = NULL; + } + + if (__receiver) { + tizen_core_channel_receiver_destroy(__receiver); + __receiver = NULL; + } +} + +static void tcore_event_setup(void) +{ + tizen_core_event_create(&__event); + tizen_core_event_object_create(&__event_object, __event_id, "test"); +} + +static void tcore_event_teardown(void) +{ + if (__event_object) { + tizen_core_event_object_destroy(__event_object); + __event_object = NULL; + } + + if (__event) { + tizen_core_event_destroy(__event); + __event = NULL; + } +} + +static void tcore_poll_fd_setup(void) +{ + tizen_core_poll_fd_create(&__poll_fd); + tizen_core_poll_fd_set_fd(__poll_fd, 0); + tizen_core_poll_fd_set_events(__poll_fd, + TIZEN_CORE_POLL_EVENT_IN | TIZEN_CORE_POLL_EVENT_OUT); + tizen_core_poll_fd_set_returned_events(__poll_fd, TIZEN_CORE_POLL_EVENT_IN); +} + +static void tcore_poll_fd_teardown(void) +{ + if (__poll_fd) { + tizen_core_poll_fd_destroy(__poll_fd); + __poll_fd = NULL; + } +} + +void utc_tizen_core_startup(void) +{ + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + tcore_setup(); + tcore_channel_setup(); + tcore_event_setup(); + tcore_poll_fd_setup(); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); +} + +void utc_tizen_core_cleanup(void) +{ + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + tcore_poll_fd_teardown(); + tcore_event_teardown(); + tcore_channel_teardown(); + tcore_teardown(); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); +} + +/** + * @testcase utc_tizen_core_init_p + * @since_tizen 9.0 + * @type Positive + * @description Initializes the tizen core. + * @scenario Calls the tizen_core_init() to initialize the tizen core. + */ +int utc_tizen_core_init_p(void) +{ + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + tizen_core_init(); + tizen_core_shutdown(); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_shutdown_p + * @since_tizen 9.0 + * @type Positive + * @description Shutdowns the tizen core. + * @scenario Calls the tizen_core_shutdown() to shutdown the tizen core. + */ +int utc_tizen_core_shutdown_p(void) +{ + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + tizen_core_shutdown(); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_ready_p + * @since_tizen 9.0 + * @type Positive + * @description Checks whether the tizen core is ready or not. + * @scenario The function returns 'true'. + */ +int utc_tizen_core_ready_p(void) +{ + bool ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_ready(); + assert_eq(ret, true); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_ready_n + * @since_tizen 9.0 + * @type Negative + * @description Checks whether the tizen core is ready or not. + * @scenario Calls the tizen_core_shutdown() to shutdown the tizen core. + * And then, calls the tizen_core_ready(). + * The function returns 'false'. + */ +int utc_tizen_core_ready_n(void) +{ + bool ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + tizen_core_shutdown(); + ret = tizen_core_ready(); + assert_eq(ret, false); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_task_create_p + * @since_tizen 9.0 + * @type Positive + * @description Creates the tizen core task handle. + * @scenario Calls the tizen_core_task_create() to create the task handle. + * The function returns TIZEN_CORE_ERROR_NONE. + */ +int utc_tizen_core_task_create_p(void) +{ + tizen_core_task_h task = NULL; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_task_create("task", true, &task); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(task, NULL); + + tizen_core_task_destroy(task); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_task_create_n + * @since_tizen 9.0 + * @type Negative + * @description Creates the tizen core task handle. + * @scenario Calls the tizen_core_task_create() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_task_create_n(void) +{ + tizen_core_task_h task = NULL; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_task_create(NULL, false, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + + ret = tizen_core_task_create("main", true, &task); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_task_destroy_p + * @since_tizen 9.0 + * @type Positive + * @description Destroys the tizen core task handle. + * @scenario Calls the tizen_core_task_destroy() to destroy the task handle. + * The function returns TIZEN_CORE_ERROR_NONE. + */ +int utc_tizen_core_task_destroy_p(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_task_destroy(__task); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + __task = NULL; + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_task_destroy_n + * @since_tizen 9.0 + * @type Negative + * @description Destroys the tizen core task handle. + * @scenario Calls the tizen_core_task_destroy() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_task_destroy_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_task_destroy(NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +static bool task_run_idle_job_cb(void *user_data) +{ + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + __touched = true; + tizen_core_task_quit(__main_task); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return false; +} + +/** + * @testcase utc_tizen_core_task_run_p + * @since_tizen 9.0 + * @type Positive + * @description Run the main loop of tizen core task. + * @scenario Calls the tizen_core_task_run() to run the main loop of the task. + * Before runs the task, the idle job is added to check + * whether the main is running or not. + */ +int utc_tizen_core_task_run_p(void) +{ + tizen_core_h core = NULL; + tizen_core_source_h source = NULL; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_task_get_tizen_core(__main_task, &core); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(core, NULL); + + ret = tizen_core_add_idle_job(core, task_run_idle_job_cb, NULL, &source); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(source, NULL); + + ret = tizen_core_task_run(__main_task); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_eq(__touched, true); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_task_run_n + * @since_tizen 9.0 + * @type Negative + * @description Runs the main loop of the tizen core task. + * @scenario Calls the tizen_core_task_run() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_task_run_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_task_run(NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +static bool task_is_running_idle_cb(void *user_data) +{ + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + tizen_core_task_is_running(__main_task, &__touched); + tizen_core_task_quit(__main_task); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return false; +} + +/** + * @testcase utc_tizen_core_task_is_running_p + * @since_tizen 9.0 + * @type Positive + * @description Checks whether the task is running or not. + * @scenario Calls the tizen_core_task_is_running() in the idle callback + * to check whether the task is running or not. + * The function returns TIZEN_CORE_ERROR_NONE and 'true'. + */ +int utc_tizen_core_task_is_running_p(void) +{ + tizen_core_h core = NULL; + tizen_core_source_h source = NULL; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_task_get_tizen_core(__main_task, &core); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(core, NULL); + + ret = tizen_core_add_idle_job(core, task_is_running_idle_cb, NULL, &source); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(source, NULL); + + ret = tizen_core_task_run(__main_task); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_eq(__touched, true); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_task_is_running_n + * @since_tizen 9.0 + * @type Negative + * @description Checks whether the task is running or not. + * @scenario Calls the tizen_core_task_is_running() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_task_is_running_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_task_is_running(NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +static bool task_quit_thread_idle_cb(void *user_data) +{ + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + tizen_core_task_quit(__task); + __touched = true; + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return false; +} + +static bool task_quit_main_timer_cb(void *user_data) +{ + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + if (__touched) { + tizen_core_task_quit(__main_task); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return false; + } + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return true; +} + +/** + * @testcase utc_tizen_core_task_quit_p + * @since_tizen 9.0 + * @type Positive + * @description Exits the main loop of the tizen core task. + * @scenario Runs the main loop of the thread task. + * And, calls the tizen_core_task_quit() to exit + * the main loop of the thread task in the idle callback. + * Runs the main loop of the main task. + * And, calls the tizen_core_task_quit() to exit + * the main loop of the main task in the timer callback. + */ +int utc_tizen_core_task_quit_p(void) +{ + tizen_core_h core = NULL; + tizen_core_source_h source = NULL; + tizen_core_source_h timer_source = NULL; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_task_get_tizen_core(__task, &core); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(core, NULL); + + ret = tizen_core_add_idle_job(core, task_quit_thread_idle_cb, NULL, &source); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(source, NULL); + + ret = tizen_core_task_run(__task); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + + core = NULL; + tizen_core_task_get_tizen_core(__main_task, &core); + ret = tizen_core_add_timer(core, 100, task_quit_main_timer_cb, NULL, + &timer_source); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(timer_source, NULL); + + ret = tizen_core_task_run(__main_task); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_eq(__touched, true); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_task_quit_n + * @since_tizen 9.0 + * @type Negative + * @description Exits the main loop of the tizen core task. + * @scenario Calls the tizen_core_task_quit() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_task_quit_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_task_quit(NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_task_get_tizen_core_p + * @since_tizen 9.0 + * @type Positive + * @description Gets the tizen core from the tizen core task handle. + * @scenario Calls the tizen_core_task_get_tizen_core() to get the tizen core handle. + */ +int utc_tizen_core_task_get_tizen_core_p(void) +{ + tizen_core_h core = NULL; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_task_get_tizen_core(__task, &core); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_task_get_tizen_core_n + * @since_tizen 9.0 + * @type Negative + * @description Gets the tizen core from the tizen core task handle. + * @scenario Calls the tizen_core_task_get_tizen_core() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_task_get_tizen_core_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_task_get_tizen_core(NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_find_p + * @since_tizen 9.0 + * @type Positive + * @description Finds the tizen core from the name. + * @scenario Calls the tizen_core_find() with the task name. + */ +int utc_tizen_core_find_p(void) +{ + tizen_core_h task_core = NULL; + tizen_core_h main_task_core = NULL; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_find("test_task", &task_core); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(task_core, NULL); + + ret = tizen_core_find("main", &main_task_core); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(main_task_core, NULL); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_find_n + * @since_tizen 9.0 + * @type Negative + * @description Finds the tizen core from the name. + * @scenario Calls the tizen_core_find() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_find_n(void) +{ + int ret; + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + + ret = tizen_core_find(NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +static bool find_from_this_thread_idle_cb(void *user_data) +{ + tizen_core_h task_core = NULL; + tizen_core_h current_core = NULL; + bool running = false; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + tizen_core_task_is_running(__main_task, &running); + if (!running) { + usleep(10); + return true; + } + + tizen_core_task_get_tizen_core(__task, &task_core); + tizen_core_find_from_this_thread(¤t_core); + if (task_core && current_core && task_core == current_core) + __touched = true; + + tizen_core_task_quit(__task); + tizen_core_task_quit(__main_task); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return false; +} + +/** + * @testcase utc_tizen_core_find_from_this_thread_p + * @since_tizen 9.0 + * @type Positive + * @description Finds the tizen core from this thread. + * @scenario Calls the tizen_core_find_from_this_thread() in the main thread. + * Adds an idle job to the thread task and runs the thread task. + * And, calls the tizen_core_find_from_this_thread() in the idle callback. + */ +int utc_tizen_core_find_from_this_thread_p(void) +{ + tizen_core_h core = NULL; + tizen_core_h main_task_core = NULL; + tizen_core_source_h source = NULL; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_find_from_this_thread(&core); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(core, NULL); + + ret = tizen_core_task_get_tizen_core(__main_task, &main_task_core); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(main_task_core, NULL); + assert_eq(core, main_task_core); + + core = NULL; + ret = tizen_core_task_get_tizen_core(__task, &core); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(core, NULL); + + ret = tizen_core_add_idle_job(core, find_from_this_thread_idle_cb, NULL, + &source); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(source, NULL); + + ret = tizen_core_task_run(__task); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + + ret = tizen_core_task_run(__main_task); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_eq(__touched, true); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_find_from_this_thread_n + * @since_tizen 9.0 + * @type Negative + * @description Finds the tizen core from this thread. + * @scenario Calls the tizen_core_find_from_this_thread() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_find_from_this_thread_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_find_from_this_thread(NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +static bool add_idle_job_cb(void *user_data) +{ + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + __touched = true; + tizen_core_task_quit(__main_task); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return false; +} + +/** + * @testcase utc_tizen_core_add_idle_job_p + * @since_tizen 9.0 + * @type Positive + * @description Adds an idle job to the tizen core. + * @scenario Adds an idle job and runs the task. + * And, checks whether the __touched flag is set or not. + */ +int utc_tizen_core_add_idle_job_p(void) +{ + tizen_core_h core = NULL; + tizen_core_source_h source = NULL; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_task_get_tizen_core(__main_task, &core); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(core, NULL); + + ret = tizen_core_add_idle_job(core, add_idle_job_cb, NULL, &source); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(source, NULL); + + ret = tizen_core_task_run(__main_task); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_eq(__touched, true); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_add_idle_job_n + * @since_tizen 9.0 + * @type Negative + * @description Adds an idle job to the tizen core. + * @scenario Calls the tizen_core_add_idle_job() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_add_idle_job_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_add_idle_job(NULL, NULL, NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +static bool add_timer_cb(void *user_data) +{ + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + __touched = true; + tizen_core_task_quit(__main_task); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return false; +} + +/** + * @testcase utc_tizen_core_add_timer_p + * @since_tizen 9.0 + * @type Positive + * @description Adds a timer to the tizen core. + * @scenario Calls the tizen_core_add_timer() and runs the task. + * And, checks whether the __touched flag is set or not. + */ +int utc_tizen_core_add_timer_p(void) +{ + tizen_core_h core = NULL; + tizen_core_source_h source = NULL; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_task_get_tizen_core(__main_task, &core); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(core, NULL); + + ret = tizen_core_add_timer(core, 100, add_timer_cb, NULL, &source); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(source, NULL); + + ret = tizen_core_task_run(__main_task); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_eq(__touched, true); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_add_timer_n + * @since_tizen 9.0 + * @type Negative + * @description Adds a timer to the tizen core. + * @scenario Calls the tizen_core_add_timer() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_add_timer_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_add_timer(NULL, 0, NULL, NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +static void channel_receive_cb(tizen_core_channel_object_h object, + void *user_data) +{ + int id = 0; + char* data = NULL; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + tizen_core_channel_object_get_id(object, &id); + tizen_core_channel_object_get_data(object, (void **)&data); + if (id == 99 && data && !strcmp(data, "test")) + __touched = true; + tizen_core_task_quit(__main_task); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); +} + +static bool add_channel_idle_cb(void *user_data) +{ + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + tizen_core_channel_sender_send(__sender, __channel_object); + tizen_core_task_quit(__task); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return false; +} + +/** + * @testcase utc_tizen_core_add_channel_p + * @since_tizen 9.0 + * @type Positive + * @description Adds a channel receiver to the tizen core. + * @scenario Adds a channel receiver using tizen_core_add_channel() to the main core. + * Adds an idler job to the thread core. + * Runs the main and thread tasks. + * And, checks whether the __touched flag is set or not. + */ +int utc_tizen_core_add_channel_p(void) +{ + tizen_core_h main_core = NULL; + tizen_core_h core = NULL; + tizen_core_source_h source = NULL; + tizen_core_source_h idle_source = NULL; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_task_get_tizen_core(__main_task, &main_core); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(main_core, NULL); + + ret = tizen_core_add_channel(main_core, __receiver, channel_receive_cb, NULL, + &source); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(source, NULL); + + ret = tizen_core_task_get_tizen_core(__task, &core); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(core, NULL); + + ret = tizen_core_add_idle_job(core, add_channel_idle_cb, NULL, &idle_source); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(idle_source, NULL); + + ret = tizen_core_task_run(__task); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + + ret = tizen_core_task_run(__main_task); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_eq(__touched, true); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_add_channel_n + * @since_tizen 9.0 + * @type Negative + * @description Adds a channel receiver to the tizen core. + * @scenario Calls the tizen_core_add_channel() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_add_channel_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_add_channel(NULL, NULL, NULL, NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_add_event_p + * @since_tizen 9.0 + * @type Positive + * @description Adds an event to the tizen core. + * @scenario Adds an event using tizen_core_add_event() to the main core. + * The function returns TIZEN_CORE_ERROR_NONE. + */ +int utc_tizen_core_add_event_p(void) +{ + tizen_core_h core = NULL; + tizen_core_source_h source = NULL; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_task_get_tizen_core(__main_task, &core); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(core, NULL); + + ret = tizen_core_add_event(core, __event, &source); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(source, NULL); + __event = NULL; + + tizen_core_remove_source(core, source); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_add_event_n + * @since_tizen 9.0 + * @type Negative + * @description Adds an event to the tizen core. + * @scenario Calls the tizen_core_add_event() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_add_event_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_add_event(NULL, NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +static bool event_handler_cb(tizen_core_event_object_h object, void *user_data) +{ + int id = 0; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + tizen_core_event_object_get_id(object, &id); + if (id == 22) { + __touched = true; + tizen_core_task_quit(__main_task); + } + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return true; +} + +static bool emit_event_timer_cb(void *user_data) +{ + tizen_core_h main_core = NULL; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + tizen_core_task_get_tizen_core(__main_task, &main_core); + tizen_core_emit_event(main_core, __event_object); + __event_object = NULL; + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return false; +} + +/** + * @testcase utc_tizen_core_emit_event_p + * @since_tizen 9.0 + * @type Positive + * @description Emits the event to the tizen core. + * @scenario Adds an event handler to the event and adds a timer to the main core. + * Runs the main task and checks whether the __touched flag is set or not. + */ +int utc_tizen_core_emit_event_p(void) +{ + tizen_core_event_handler_h event_handler = NULL; + tizen_core_h core = NULL; + tizen_core_source_h source = NULL; + tizen_core_source_h timer_source = NULL; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_event_add_handler(__event, event_handler_cb, NULL, + &event_handler); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(event_handler, NULL); + + ret = tizen_core_task_get_tizen_core(__main_task, &core); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(core, NULL); + + ret = tizen_core_add_event(core, __event, &source); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(source, NULL); + + ret = tizen_core_add_timer(core, 100, emit_event_timer_cb, NULL, + &timer_source); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(timer_source, NULL); + + ret = tizen_core_task_run(__main_task); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + + tizen_core_event_remove_handler(__event, event_handler); + tizen_core_remove_source(core, source); + assert_eq(__touched, true); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_emit_event_n + * @since_tizen 9.0 + * @type Negative + * @description Emits the event to the tizen core. + * @scenario Calls the tizen_core_emit_event() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_emit_event_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_emit_event(NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_add_source_p + * @since_tizen 9.0 + * @type Positive + * @description Add a source to the tizen core. + * @scenario Calls the tizen_core_add_source() with the created source handle. + */ +int utc_tizen_core_add_source_p(void) +{ + tizen_core_h core = NULL; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_task_get_tizen_core(__main_task, &core); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(core, NULL); + + ret = tizen_core_add_source(core, __source); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + + tizen_core_remove_source(core, __source); + __source = NULL; + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_add_source_n + * @since_tizen 9.0 + * @type Negative + * @description Add a source to the tizen core. + * @scenario Calls the tizen_core_add_source() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_add_source_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_add_source(NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_remove_source_p + * @since_tizen 9.0 + * @type Positive + * @description Removes the source from the tizen core. + * @scenario Calls the tizen_core_remove_source() with the added source handle. + */ +int utc_tizen_core_remove_source_p(void) +{ + tizen_core_h core = NULL; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_task_get_tizen_core(__main_task, &core); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(core, NULL); + + ret = tizen_core_add_source(core, __source); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + + ret = tizen_core_remove_source(core, __source); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + __source = NULL; + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_remove_source_n + * @since_tizen 9.0 + * @type Negative + * @description Removes the source from the tizen core. + * @scenario Calls the tizen_core_remove_source() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_remove_source_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_remove_source(NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_source_create_p + * @since_tizen 9.0 + * @type Positive + * @description Creates the tizen core source. + * @scenario Calls the tizen_core_source_create(). + * The function returns TIZEN_CORE_ERROR_NONE. + */ +int utc_tizen_core_source_create_p(void) +{ + tizen_core_source_h source = NULL; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_source_create(&source); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(source, NULL); + + tizen_core_source_destroy(source); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_source_create_n + * @since_tizen 9.0 + * @type Negative + * @description Creates the tizen core source. + * @scenario Calls the tizen_core_source_create() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_source_create_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_source_create(NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_source_destroy_p + * @since_tizen 9.0 + * @type Positive + * @description Destroys the tizen core source. + * @scenario Calls the tizen_core_source_destroy() with the created source handle. + */ +int utc_tizen_core_source_destroy_p(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_source_destroy(__source); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + __source = NULL; + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_source_destroy_n + * @since_tizen 9.0 + * @type Negative + * @description Creates the tizen core source. + * @scenario Calls the tizen_core_source_destroy() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_source_destroy_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_source_destroy(NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_source_add_poll_p + * @since_tizen 9.0 + * @type Positive + * @description Adds the poll fd to the tizen core source. + * @scenario Calls the tizen_core_source_add_poll() with + * the created source and the created poll fd. + */ +int utc_tizen_core_source_add_poll_p(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_source_add_poll(__source, __poll_fd); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + + tizen_core_source_remove_poll(__source, __poll_fd); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_source_add_poll_n + * @since_tizen 9.0 + * @type Negative + * @description Waits for some events on the file descriptor. + * @scenario Calls the tizen_core_source_add_poll() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_source_add_poll_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_source_add_poll(NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_source_remove_poll_p + * @since_tizen 9.0 + * @type Positive + * @description Removes to wait for some events on the file descriptor. + * @scenario Calls the tizen_core_source_add_poll() and + * calls the tizen_core_source_remove_poll(). + */ +int utc_tizen_core_source_remove_poll_p(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_source_add_poll(__source, __poll_fd); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + + ret = tizen_core_source_remove_poll(__source, __poll_fd); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_source_remove_poll_n + * @since_tizen 9.0 + * @type Negative + * @description Removes to wait for some events on the file descriptor. + * @scenario Calls the tizen_core_source_remove_poll() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_source_remove_poll_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_source_remove_poll(NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +static bool set_prepare_cb(tizen_core_source_h source, int *timeout, + void *user_data) +{ + return false; +} + +/** + * @testcase utc_tizen_core_source_set_prepare_cb_p + * @since_tizen 9.0 + * @type Positive + * @description Sets the prepare callback function to the tizen core source. + * @scenario Calls the tizen_core_source_set_prepare_cb(). + */ +int utc_tizen_core_source_set_prepare_cb_p(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_source_set_prepare_cb(__source, set_prepare_cb, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_source_set_prepare_cb_n + * @since_tizen 9.0 + * @type Negative + * @description Sets the prepare callback function to the tizen core source. + * @scenario Calls the tizen_core_source_set_prepare_cb() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_source_set_prepare_cb_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_source_set_prepare_cb(NULL, NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +static bool set_check_cb(tizen_core_source_h source, void *user_data) +{ + return true; +} + +/** + * @testcase utc_tizen_core_source_set_check_cb_p + * @since_tizen 9.0 + * @type Positive + * @description Sets the check callback function to the tizen core source. + * @scenario Calls the tizen_core_source_set_check_cb(). + */ +int utc_tizen_core_source_set_check_cb_p(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_source_set_check_cb(__source, set_check_cb, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_source_set_check_cb_n + * @since_tizen 9.0 + * @type Negative + * @description Sets the check callback function to the tizen core source. + * @scenario Calls the tizen_core_source_set_check_cb() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_source_set_check_cb_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_source_set_check_cb(NULL, NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +static bool set_dispatch_cb(tizen_core_source_h source, void *user_data) +{ + return true; +} + +/** + * @testcase utc_tizen_core_source_set_dispatch_cb_p + * @since_tizen 9.0 + * @type Positive + * @description Sets the dispatch callback function to the tizen core source. + * @scenario Calls the tizen_core_source_set_dispatch_cb(). + */ +int utc_tizen_core_source_set_dispatch_cb_p(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_source_set_dispatch_cb(__source, set_dispatch_cb, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_source_set_dispatch_cb_n + * @since_tizen 9.0 + * @type Negative + * @description Sets the dispatch callback function to the tizen core source. + * @scenario Calls the tizen_core_source_set_dispatch_cb() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_source_set_dispatch_cb_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_source_set_dispatch_cb(NULL, NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +static void set_finalize_cb(tizen_core_source_h source, void *user_data) +{ +} + +/** + * @testcase utc_tizen_core_source_set_finalize_cb_p + * @since_tizen 9.0 + * @type Positive + * @description Sets the finalize callback function to the tizen core source. + * @scenario Calls the tizen_core_source_set_finalize_cb(). + */ +int utc_tizen_core_source_set_finalize_cb_p(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_source_set_finalize_cb(__source, set_finalize_cb, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_source_set_finalize_cb_n + * @since_tizen 9.0 + * @type Negative + * @description Sets the finalize callback function to the tizen core source. + * @scenario Calls the tizen_core_source_set_finalize_cb() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_source_set_finalize_cb_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_source_set_finalize_cb(NULL, NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_source_set_priority_p + * @since_tizen 9.0 + * @type Positive + * @description Sets the priority to the tizen core source. + * @scenario Calls the tizen_core_source_set_priority(). + */ +int utc_tizen_core_source_set_priority_p(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_source_set_priority(__source, TIZEN_CORE_PRIORITY_HIGH); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_source_set_priority_n + * @since_tizen 9.0 + * @type Negative + * @description Sets the priority to the tizen core source. + * @scenario Calls the tizen_core_source_set_priority() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_source_set_priority_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_source_set_priority(NULL, -1000); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_poll_fd_create_p + * @since_tizen 9.0 + * @type Positive + * @description Creates a tizen core poll fd handle. + * @scenario Calls the tizen_core_poll_fd_create(). + */ +int utc_tizen_core_poll_fd_create_p(void) +{ + tizen_core_poll_fd_h poll_fd = NULL; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_poll_fd_create(&poll_fd); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + + tizen_core_poll_fd_destroy(poll_fd); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_poll_fd_create_n + * @since_tizen 9.0 + * @type Negative + * @description Creates a tizen core poll fd handle. + * @scenario Calls the tizen_core_poll_fd_create() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_poll_fd_create_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_poll_fd_create(NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_poll_fd_destroy_p + * @since_tizen 9.0 + * @type Positive + * @description Destroys the tizen core poll fd handle. + * @scenario Calls the tizen_core_poll_fd_destroy(). + */ +int utc_tizen_core_poll_fd_destroy_p(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_poll_fd_destroy(__poll_fd); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + __poll_fd = NULL; + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_poll_fd_destroy_n + * @since_tizen 9.0 + * @type Negative + * @description Destroys the tizen core poll fd handle. + * @scenario Calls the tizen_core_poll_fd_destroy() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_poll_fd_destroy_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_poll_fd_destroy(NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_poll_fd_set_fd_p + * @since_tizen 9.0 + * @type Positive + * @description Sets the file descriptor to the poll fd handle. + * @scenario Calls the tizen_core_poll_fd_set_fd(). + */ +int utc_tizen_core_poll_fd_set_fd_p(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_poll_fd_set_fd(__poll_fd, 1); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_poll_fd_set_fd_n + * @since_tizen 9.0 + * @type Negative + * @description Sets the file descriptor to the poll fd handle. + * @scenario Calls the tizen_core_poll_fd_set_fd() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_poll_fd_set_fd_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_poll_fd_set_fd(NULL, -1); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_poll_fd_get_fd_p + * @since_tizen 9.0 + * @type Positive + * @description Gets the file descriptor from the poll fd handle. + * @scenario Calls the tizen_core_poll_fd_get_fd(). + * And, checks whether the fd is valid or not. + */ +int utc_tizen_core_poll_fd_get_fd_p(void) +{ + int fd = -1; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_poll_fd_get_fd(__poll_fd, &fd); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_neq(fd, -1); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_poll_fd_get_fd_n + * @since_tizen 9.0 + * @type Negative + * @description Gets the file descriptor from the poll fd handle. + * @scenario Calls the tizen_core_poll_fd_get_fd() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_poll_fd_get_fd_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_poll_fd_get_fd(NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_poll_fd_set_events_p + * @since_tizen 9.0 + * @type Positive + * @description Sets the requested events to the poll fd handle. + * @scenario Calls the tizen_core_poll_fd_set_events(). + */ +int utc_tizen_core_poll_fd_set_events_p(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_poll_fd_set_events(__poll_fd, + TIZEN_CORE_POLL_EVENT_IN | TIZEN_CORE_POLL_EVENT_ERR); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_poll_fd_set_events_n + * @since_tizen 9.0 + * @type Negative + * @description Sets the requested events to the poll fd handle. + * @scenario Calls the tizen_core_poll_fd_set_events() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_poll_fd_set_events_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_poll_fd_set_events(NULL, -1); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_poll_fd_get_events_p + * @since_tizen 9.0 + * @type Positive + * @description Gets the requested events from the poll fd handle. + * @scenario Calls the tizen_core_poll_fd_get_events(). + */ +int utc_tizen_core_poll_fd_get_events_p(void) +{ + uint16_t events = 0; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_poll_fd_get_events(__poll_fd, &events); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_eq(events, (TIZEN_CORE_POLL_EVENT_IN | TIZEN_CORE_POLL_EVENT_OUT)); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_poll_fd_get_events_n + * @since_tizen 9.0 + * @type Negative + * @description Gets the requested events from the poll fd handle. + * @scenario Calls the tizen_core_poll_fd_get_events() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_poll_fd_get_events_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_poll_fd_get_events(NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_poll_fd_set_returned_events_p + * @since_tizen 9.0 + * @type Positive + * @description Sets the returned events to the poll fd handle. + * @scenario Calls the tizen_core_poll_fd_set_returned_events(). + */ +int utc_tizen_core_poll_fd_set_returned_events_p(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_poll_fd_set_returned_events(__poll_fd, + TIZEN_CORE_POLL_EVENT_IN | TIZEN_CORE_POLL_EVENT_OUT); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_poll_fd_set_returned_events_n + * @since_tizen 9.0 + * @type Negative + * @description Sets the returned events to the poll fd handle. + * @scenario Calls the tizen_core_poll_fd_set_returned_events() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_poll_fd_set_returned_events_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_poll_fd_set_returned_events(NULL, -1); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_poll_fd_get_returned_events_p + * @since_tizen 9.0 + * @type Positive + * @description Gets the returned events from the poll fd handle. + * @scenario Calls the tizen_core_poll_fd_get_returned_events(). + */ +int utc_tizen_core_poll_fd_get_returned_events_p(void) +{ + uint16_t returned_events = 0; + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_poll_fd_get_returned_events(__poll_fd, &returned_events); + assert_eq(ret, TIZEN_CORE_ERROR_NONE); + assert_eq(returned_events, TIZEN_CORE_POLL_EVENT_IN); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +} + +/** + * @testcase utc_tizen_core_poll_fd_get_returned_events_n + * @since_tizen 9.0 + * @type Negative + * @description Gets the returned events from the poll fd handle. + * @scenario Calls the tizen_core_poll_fd_get_returned_events() with nullptr. + * The function returns TIZEN_CORE_ERROR_INVALID_PARAMETER. + */ +int utc_tizen_core_poll_fd_get_returned_events_n(void) +{ + int ret; + + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) BEGIN", __FUNCTION__, __LINE__); + ret = tizen_core_poll_fd_get_returned_events(NULL, NULL); + assert_eq(ret, TIZEN_CORE_ERROR_INVALID_PARAMETER); + dlog_print(DLOG_WARN, LOG_TAG, "%s(%d) END", __FUNCTION__, __LINE__); + return 0; +}