From: SukhyungKang Date: Tue, 30 Apr 2024 07:39:40 +0000 (+0900) Subject: [UTC][ACR-1842] Deprecate shortcut api X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ff50a9af67a83bc37c94a78746748daaeaf1994f;p=test%2Ftct%2Fnative%2Fapi.git [UTC][ACR-1842] Deprecate shortcut api Change-Id: Ieedf3a72e0fdea2d0304a7df6dcb9a99e978aa9d Signed-off-by: SukhyungKang --- diff --git a/packaging/utc/core-shortcut-tests.spec b/packaging/utc/core-shortcut-tests.spec deleted file mode 100755 index a939951bc..000000000 --- a/packaging/utc/core-shortcut-tests.spec +++ /dev/null @@ -1,75 +0,0 @@ -%define MODULE_NAME shortcut -%define MODULE_LIBNAME shortcut -Name: core-%{MODULE_NAME}-tests -Summary: Core API unit TC (%{name}) -Version: 0.1 -Release: 0 -Group: Development/Tools -License: Apache License, Version 2.0 -Source0: %{name}-%{version}.tar.gz -BuildRequires: pkgconfig(%{MODULE_LIBNAME}) -BuildRequires: pkgconfig(glib-2.0) -BuildRequires: cmake -BuildRequires: pkgconfig(capi-appfw-application) -BuildRequires: pkgconfig(dlog) -BuildRequires: pkgconfig(elementary) -BuildRequires: pkgconfig(capi-system-info) -%description -Core API unit TC (%{name}) - -%prep -%setup -q - -%build - -%define PREFIX "%{_libdir}/%{name}" - -export LDFLAGS+="-Wl,--rpath=%{PREFIX} -Wl,--as-needed" - -%if %{?ASAN_BUILD:1}0 - %if %{?DEVICE_BUILD_TYPE_MOBILE:1}0 - cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="mobile" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix} - %endif - %if %{?DEVICE_BUILD_TYPE_WEARABLE:1}0 - cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="wearable" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix} - %endif - %if %{?DEVICE_BUILD_TYPE_TV:1}0 - cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="tv" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix} - %endif - %if %{?DEVICE_BUILD_TYPE_TIZENIOT:1}0 - cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="tizeniot" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix} - %endif -%else - %if %{?DEVICE_BUILD_TYPE_MOBILE:1}0 - cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="mobile" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix} - %endif - %if %{?DEVICE_BUILD_TYPE_WEARABLE:1}0 - cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="wearable" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix} - %endif - %if %{?DEVICE_BUILD_TYPE_TV:1}0 - cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="tv" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix} - %endif - %if %{?DEVICE_BUILD_TYPE_TIZENIOT:1}0 - cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="tizeniot" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix} - %endif -%endif - -make %{?jobs:-j%jobs} - -%install -rm -rf %{buildroot} -%make_install -mkdir -p %{buildroot}/usr/share/license -cp LICENSE %{buildroot}/usr/share/license/%{name} -mkdir -p %{buildroot}/usr/share/packages/ -cp packaging/utc/%{name}.xml %{buildroot}/usr/share/packages/ -%post - -%postun - - -%files -/usr/apps/%{name}/* -/usr/share/packages/%{name}.xml -/usr/share/license/%{name} - diff --git a/packaging/utc/core-shortcut-tests.xml b/packaging/utc/core-shortcut-tests.xml deleted file mode 100755 index ad4d40c06..000000000 --- a/packaging/utc/core-shortcut-tests.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - test - Core API test Application - - - - - - - - - - http://tizen.org/privilege/shortcut - - diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fa812771e..ad188d100 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -157,8 +157,6 @@ ELSE( DEFINED MODULE ) ADD_SUBDIRECTORY(utc/runtime-info) MESSAGE(STATUS "Building: ${CMAKE_CURRENT_SOURCE_DIR}/utc/sensor") ADD_SUBDIRECTORY(utc/sensor) - MESSAGE(STATUS "Building: ${CMAKE_CURRENT_SOURCE_DIR}/utc/shortcut") - ADD_SUBDIRECTORY(utc/shortcut) MESSAGE(STATUS "Building: ${CMAKE_CURRENT_SOURCE_DIR}/utc/sound-manager") ADD_SUBDIRECTORY(utc/sound-manager) MESSAGE(STATUS "Building: ${CMAKE_CURRENT_SOURCE_DIR}/utc/stt") diff --git a/src/utc/shortcut/CMakeLists.txt b/src/utc/shortcut/CMakeLists.txt deleted file mode 100644 index 928806cf1..000000000 --- a/src/utc/shortcut/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -SET(PKG_NAME "shortcut") - -SET(EXEC_NAME "tct-${PKG_NAME}-core") -SET(RPM_NAME "core-${PKG_NAME}-tests") - -SET(CAPI_LIB "shortcut") -SET(TC_SOURCES - utc-shortcut.c -) - -PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED - ${CAPI_LIB} - capi-appfw-application - capi-system-info - glib-2.0 - dlog -) - -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} -) - -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/shortcut/platform.list b/src/utc/shortcut/platform.list deleted file mode 100755 index 7780bc4be..000000000 --- a/src/utc/shortcut/platform.list +++ /dev/null @@ -1 +0,0 @@ -shortcut_get_list diff --git a/src/utc/shortcut/prod_platform.list b/src/utc/shortcut/prod_platform.list deleted file mode 100755 index f2c0f409e..000000000 --- a/src/utc/shortcut/prod_platform.list +++ /dev/null @@ -1,8 +0,0 @@ -shortcut_icon_request_create -shortcut_icon_request_data -shortcut_icon_request_destroy -shortcut_icon_request_send -shortcut_icon_request_set_data -shortcut_icon_request_set_info -shortcut_icon_service_fini -shortcut_icon_service_init \ No newline at end of file diff --git a/src/utc/shortcut/public.list b/src/utc/shortcut/public.list deleted file mode 100755 index 0d028255b..000000000 --- a/src/utc/shortcut/public.list +++ /dev/null @@ -1,2 +0,0 @@ -shortcut_add_to_home -shortcut_remove_from_home diff --git a/src/utc/shortcut/tct-shortcut-core.c b/src/utc/shortcut/tct-shortcut-core.c deleted file mode 100644 index 97ede20bc..000000000 --- a/src/utc/shortcut/tct-shortcut-core.c +++ /dev/null @@ -1,139 +0,0 @@ -// -// Copyright (c) 2014 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 -#include -#include -#include -#include -#include -#include "tct_common.h" -#include -#include - - - -#ifdef MOBILE -#include "tct-shortcut-core_mobile.h" -#endif -#ifdef TV -#include "tct-shortcut-core_tv.h" -#endif // TV -#ifdef WEARABLE -#include "tct-shortcut-core_wearable.h" -#endif //WEARABLE -#ifdef TIZENIOT -#include "tct-shortcut-core_tizeniot.h" -#endif //TIZENIOT - - - - - - - - -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(); - dlog_print(DLOG_INFO, "NativeTCT", "%s : Startup begin", pszGetTCName); - if ( tc_array[i].startup ) - { - tc_array[i].startup(); - } - dlog_print(DLOG_INFO, "NativeTCT", "%s : Startup end", pszGetTCName); - - dlog_print(DLOG_INFO, "NativeTCT", "%s : Body begin", pszGetTCName); - result = tc_array[i].function(); - dlog_print(DLOG_INFO, "NativeTCT", "%s returns value = %d", pszGetTCName, result); - dlog_print(DLOG_INFO, "NativeTCT", "%s : Body end", pszGetTCName); - - dlog_print(DLOG_INFO, "NativeTCT", "%s : Cleanup begin", pszGetTCName); - if ( tc_array[i].cleanup ) - { - tc_array[i].cleanup(); - } - dlog_print(DLOG_INFO, "NativeTCT", "%s : Cleanup end", pszGetTCName); - 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; - - - 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, NULL); - 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/shortcut/tct-shortcut-core_mobile.h b/src/utc/shortcut/tct-shortcut-core_mobile.h deleted file mode 100755 index 93b1ba5ea..000000000 --- a/src/utc/shortcut/tct-shortcut-core_mobile.h +++ /dev/null @@ -1,61 +0,0 @@ -// -// Copyright (c) 2014 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_SHORTCUT-NATIVE_H__ -#define __TCT_SHORTCUT-NATIVE_H__ - -#include "testcase.h" -#include "tct_common.h" - -extern void utc_shortcut_startup(void); - -extern int utc_shortcut_add_to_home_n(void); -extern int utc_shortcut_add_to_home_p(void); -extern int utc_shortcut_add_to_home_widget_n(void); -extern int utc_shortcut_add_to_home_widget_p(void); -extern int utc_shortcut_remove_from_home_n(void); -extern int utc_shortcut_remove_from_home_p(void); -extern int utc_shortcut_set_request_cb_n(void); -extern int utc_shortcut_set_request_cb_p(void); -extern int utc_shortcut_set_remove_cb_n(void); -extern int utc_shortcut_set_remove_cb_p(void); -extern int utc_shortcut_unset_request_cb_n(void); -extern int utc_shortcut_unset_request_cb_p(void); -extern int utc_shortcut_unset_remove_cb_n(void); -extern int utc_shortcut_unset_remove_cb_p(void); -extern int utc_shortcut_get_list_n(void); -extern int utc_shortcut_get_list_p(void); - -testcase tc_array[] = { - {"utc_shortcut_add_to_home_n",utc_shortcut_add_to_home_n,utc_shortcut_startup,NULL}, - {"utc_shortcut_add_to_home_p",utc_shortcut_add_to_home_p,utc_shortcut_startup,NULL}, - {"utc_shortcut_add_to_home_widget_n",utc_shortcut_add_to_home_widget_n,utc_shortcut_startup,NULL}, - {"utc_shortcut_add_to_home_widget_p",utc_shortcut_add_to_home_widget_p,utc_shortcut_startup,NULL}, - {"utc_shortcut_remove_from_home_n",utc_shortcut_remove_from_home_n,utc_shortcut_startup,NULL}, - {"utc_shortcut_remove_from_home_p",utc_shortcut_remove_from_home_p,utc_shortcut_startup,NULL}, - {"utc_shortcut_set_request_cb_n",utc_shortcut_set_request_cb_n,utc_shortcut_startup,NULL}, - {"utc_shortcut_set_request_cb_p",utc_shortcut_set_request_cb_p,utc_shortcut_startup,NULL}, - {"utc_shortcut_set_remove_cb_n",utc_shortcut_set_remove_cb_n,utc_shortcut_startup,NULL}, - {"utc_shortcut_set_remove_cb_p",utc_shortcut_set_remove_cb_p,utc_shortcut_startup,NULL}, - {"utc_shortcut_unset_request_cb_n",utc_shortcut_unset_request_cb_n,utc_shortcut_startup,NULL}, - {"utc_shortcut_unset_request_cb_p",utc_shortcut_unset_request_cb_p,utc_shortcut_startup,NULL}, - {"utc_shortcut_unset_remove_cb_n",utc_shortcut_unset_remove_cb_n,utc_shortcut_startup,NULL}, - {"utc_shortcut_unset_remove_cb_p",utc_shortcut_unset_remove_cb_p,utc_shortcut_startup,NULL}, - {"utc_shortcut_get_list_n",utc_shortcut_get_list_n,utc_shortcut_startup,NULL}, - {"utc_shortcut_get_list_p",utc_shortcut_get_list_p,utc_shortcut_startup,NULL}, - {NULL, NULL} -}; - -#endif // __TCT_SHORTCUT-NATIVE_H__ diff --git a/src/utc/shortcut/tct-shortcut-core_tizeniot.h b/src/utc/shortcut/tct-shortcut-core_tizeniot.h deleted file mode 100755 index 93b1ba5ea..000000000 --- a/src/utc/shortcut/tct-shortcut-core_tizeniot.h +++ /dev/null @@ -1,61 +0,0 @@ -// -// Copyright (c) 2014 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_SHORTCUT-NATIVE_H__ -#define __TCT_SHORTCUT-NATIVE_H__ - -#include "testcase.h" -#include "tct_common.h" - -extern void utc_shortcut_startup(void); - -extern int utc_shortcut_add_to_home_n(void); -extern int utc_shortcut_add_to_home_p(void); -extern int utc_shortcut_add_to_home_widget_n(void); -extern int utc_shortcut_add_to_home_widget_p(void); -extern int utc_shortcut_remove_from_home_n(void); -extern int utc_shortcut_remove_from_home_p(void); -extern int utc_shortcut_set_request_cb_n(void); -extern int utc_shortcut_set_request_cb_p(void); -extern int utc_shortcut_set_remove_cb_n(void); -extern int utc_shortcut_set_remove_cb_p(void); -extern int utc_shortcut_unset_request_cb_n(void); -extern int utc_shortcut_unset_request_cb_p(void); -extern int utc_shortcut_unset_remove_cb_n(void); -extern int utc_shortcut_unset_remove_cb_p(void); -extern int utc_shortcut_get_list_n(void); -extern int utc_shortcut_get_list_p(void); - -testcase tc_array[] = { - {"utc_shortcut_add_to_home_n",utc_shortcut_add_to_home_n,utc_shortcut_startup,NULL}, - {"utc_shortcut_add_to_home_p",utc_shortcut_add_to_home_p,utc_shortcut_startup,NULL}, - {"utc_shortcut_add_to_home_widget_n",utc_shortcut_add_to_home_widget_n,utc_shortcut_startup,NULL}, - {"utc_shortcut_add_to_home_widget_p",utc_shortcut_add_to_home_widget_p,utc_shortcut_startup,NULL}, - {"utc_shortcut_remove_from_home_n",utc_shortcut_remove_from_home_n,utc_shortcut_startup,NULL}, - {"utc_shortcut_remove_from_home_p",utc_shortcut_remove_from_home_p,utc_shortcut_startup,NULL}, - {"utc_shortcut_set_request_cb_n",utc_shortcut_set_request_cb_n,utc_shortcut_startup,NULL}, - {"utc_shortcut_set_request_cb_p",utc_shortcut_set_request_cb_p,utc_shortcut_startup,NULL}, - {"utc_shortcut_set_remove_cb_n",utc_shortcut_set_remove_cb_n,utc_shortcut_startup,NULL}, - {"utc_shortcut_set_remove_cb_p",utc_shortcut_set_remove_cb_p,utc_shortcut_startup,NULL}, - {"utc_shortcut_unset_request_cb_n",utc_shortcut_unset_request_cb_n,utc_shortcut_startup,NULL}, - {"utc_shortcut_unset_request_cb_p",utc_shortcut_unset_request_cb_p,utc_shortcut_startup,NULL}, - {"utc_shortcut_unset_remove_cb_n",utc_shortcut_unset_remove_cb_n,utc_shortcut_startup,NULL}, - {"utc_shortcut_unset_remove_cb_p",utc_shortcut_unset_remove_cb_p,utc_shortcut_startup,NULL}, - {"utc_shortcut_get_list_n",utc_shortcut_get_list_n,utc_shortcut_startup,NULL}, - {"utc_shortcut_get_list_p",utc_shortcut_get_list_p,utc_shortcut_startup,NULL}, - {NULL, NULL} -}; - -#endif // __TCT_SHORTCUT-NATIVE_H__ diff --git a/src/utc/shortcut/tct-shortcut-core_wearable.h b/src/utc/shortcut/tct-shortcut-core_wearable.h deleted file mode 100755 index acc86d5c0..000000000 --- a/src/utc/shortcut/tct-shortcut-core_wearable.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// Copyright (c) 2014 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_SHORTCUT-NATIVE_H__ -#define __TCT_SHORTCUT-NATIVE_H__ - -#include "testcase.h" -#include "tct_common.h" - - - -testcase tc_array[] = { - {NULL, NULL} -}; - -#endif // __TCT_SHORTCUT-NATIVE_H__ diff --git a/src/utc/shortcut/utc-shortcut.c b/src/utc/shortcut/utc-shortcut.c deleted file mode 100755 index 9d75faea0..000000000 --- a/src/utc/shortcut/utc-shortcut.c +++ /dev/null @@ -1,366 +0,0 @@ -// -// Copyright (c) 2014 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 "assert.h" -#include -#include - -#include - -#include - -//& set: Shortcut - -#define SHORTCUT_FEATURE "http://tizen.org/feature/shortcut" -static bool is_supported = false; - -void utc_shortcut_startup(void) -{ - is_supported = false; - system_info_get_platform_bool(SHORTCUT_FEATURE, &is_supported); -} - -static int response_cb(int ret, void *data) -{ - return 0; -} - -/** - * @testcase utc_shortcut_add_to_home_n - * @since_tizen 2.3 - * @description Negative test case of shortcut_add_to_home() - */ -int utc_shortcut_add_to_home_n(void) -{ - int ret; - - ret = shortcut_add_to_home(NULL, -1, NULL, NULL, 1, NULL, NULL); - if (!is_supported) - assert_eq(ret, SHORTCUT_ERROR_NOT_SUPPORTED); - else - assert_eq(ret, SHORTCUT_ERROR_INVALID_PARAMETER); - - return 0; -} - -/** - * @testcase utc_shortcut_add_to_home_p - * @since_tizen 2.3 - * @description Positive test case of shortcut_add_to_home() - */ -int utc_shortcut_add_to_home_p(void) -{ - int ret; - - ret = shortcut_add_to_home(NULL, LAUNCH_BY_APP, NULL, NULL, 0, response_cb, NULL); - if (!is_supported) - assert_eq(ret, SHORTCUT_ERROR_NOT_SUPPORTED); - else - assert_eq(ret, SHORTCUT_ERROR_NONE); - - return 0; -} - -/** - * @testcase utc_shortcut_add_to_home_widget_n - * @since_tizen 2.3 - * @description Negative test case of shortcut_add_to_home_widget() - */ -int utc_shortcut_add_to_home_widget_n(void) -{ - int ret; - - ret = shortcut_add_to_home_widget(NULL, -1, NULL, NULL, -1.0f, 0, response_cb, NULL); - if (!is_supported) - assert_eq(ret, SHORTCUT_ERROR_NOT_SUPPORTED); - else - assert_eq(ret, SHORTCUT_ERROR_INVALID_PARAMETER); - - return 0; -} - -/** - * @testcase utc_shortcut_add_to_home_widget_p - * @since_tizen 2.4 - * @description Positive test case of shortcut_add_to_home_widget() - */ -int utc_shortcut_add_to_home_widget_p(void) -{ - int ret; - - ret = shortcut_add_to_home_widget("org.tizen.message", WIDGET_SIZE_1x1, NULL, NULL, -1.0f, 0, response_cb, NULL); - if (!is_supported) - assert_eq(ret, SHORTCUT_ERROR_NOT_SUPPORTED); - else - assert_eq(ret, SHORTCUT_ERROR_NONE); - - return 0; -} - -/** - * @testcase utc_shortcut_remove_from_home_n - * @since_tizen 3.0 - * @description Negative test case of shortcut_remove_from_home() - */ -int utc_shortcut_remove_from_home_n(void) -{ - int ret; - - ret = shortcut_remove_from_home(NULL, response_cb, NULL); - if (!is_supported) - assert_eq(ret, SHORTCUT_ERROR_NOT_SUPPORTED); - else - assert_eq(ret, SHORTCUT_ERROR_INVALID_PARAMETER); - - return 0; -} - -/** - * @testcase utc_shortcut_remove_from_home_p - * @since_tizen 3.0 - * @description Positive test case of shortcut_remove_from_home() - */ -int utc_shortcut_remove_from_home_p(void) -{ - int ret; - - ret = shortcut_remove_from_home("", response_cb, NULL); - if (!is_supported) - assert_eq(ret, SHORTCUT_ERROR_NOT_SUPPORTED); - else - assert_eq(ret, SHORTCUT_ERROR_NONE); - - return 0; -} - -int _request_cb(const char *package_name, const char *name, int type, const char *content_info, const char *icon, int pid, double period, int allow_duplicate, void *data) -{ - fprintf(stderr, "_request_cb"); - return SHORTCUT_ERROR_NONE; -} - -int _remove_cb(const char *package_name, const char *name, int sender_pid, void *user_data) -{ - fprintf(stderr, "_remove_cb"); - return SHORTCUT_ERROR_NONE; -} - -/** - * @testcase utc_shortcut_set_request_cb_n - * @since_tizen 2.3 - * @description Negative test case of shortcut_set_request_cb() - */ -int utc_shortcut_set_request_cb_n(void) -{ - int ret; - - ret = shortcut_set_request_cb(NULL, "temp"); - if (!is_supported) - assert_eq(ret, SHORTCUT_ERROR_NOT_SUPPORTED); - else - assert_eq(ret, SHORTCUT_ERROR_INVALID_PARAMETER); - - return 0; -} - -/** - * @testcase utc_shortcut_set_request_cb_p - * @since_tizen 2.3 - * @description Positive test case of shortcut_set_request_cb() - */ -int utc_shortcut_set_request_cb_p(void) -{ - int ret; - - ret = shortcut_set_request_cb(_request_cb, "temp"); - if (!is_supported) - assert_eq(ret, SHORTCUT_ERROR_NOT_SUPPORTED); - else - assert_eq(ret, SHORTCUT_ERROR_NONE); - - return 0; -} - -/** - * @testcase utc_shortcut_set_remove_cb_n - * @since_tizen 3.0 - * @description Negative test case of shortcut_set_remove_cb() - */ -int utc_shortcut_set_remove_cb_n(void) -{ - int ret; - - ret = shortcut_set_remove_cb(NULL, "temp"); - if (!is_supported) - assert_eq(ret, SHORTCUT_ERROR_NOT_SUPPORTED); - else - assert_eq(ret, SHORTCUT_ERROR_INVALID_PARAMETER); - - return 0; -} - -/** - * @testcase utc_shortcut_set_remove_cb_p - * @since_tizen 3.0 - * @description Positive test case of shortcut_set_remove_cb() - */ -int utc_shortcut_set_remove_cb_p(void) -{ - int ret; - - ret = shortcut_set_remove_cb(_remove_cb, "temp"); - if (!is_supported) - assert_eq(ret, SHORTCUT_ERROR_NOT_SUPPORTED); - else - assert_eq(ret, SHORTCUT_ERROR_NONE); - - return 0; -} - -/** - * @testcase utc_shortcut_unset_request_cb_n - * @since_tizen 3.0 - * @description Negative test case of shortcut_unset_request_cb() - */ -int utc_shortcut_unset_request_cb_n(void) -{ - int ret; - - ret = shortcut_set_request_cb(NULL, "temp"); - if (!is_supported) - assert_eq(ret, SHORTCUT_ERROR_NOT_SUPPORTED); - else - assert_eq(ret, SHORTCUT_ERROR_INVALID_PARAMETER); - - shortcut_unset_request_cb(); - if (!is_supported) - assert_eq(get_last_result(), SHORTCUT_ERROR_NOT_SUPPORTED); - else - assert_eq(get_last_result(), SHORTCUT_ERROR_NONE); - - return 0; -} - -/** - * @testcase utc_shortcut_unset_request_cb_p - * @since_tizen 3.0 - * @description Positive test case of shortcut_unset_request_cb() - */ -int utc_shortcut_unset_request_cb_p(void) -{ - int ret; - - ret = shortcut_set_request_cb(_request_cb, "temp"); - if (!is_supported) - assert_eq(ret, SHORTCUT_ERROR_NOT_SUPPORTED); - else - assert_eq(ret, SHORTCUT_ERROR_NONE); - - shortcut_unset_request_cb(); - if (!is_supported) - assert_eq(get_last_result(), SHORTCUT_ERROR_NOT_SUPPORTED); - else - assert_eq(get_last_result(), SHORTCUT_ERROR_NONE); - - return 0; -} - -/** - * @testcase utc_shortcut_unset_remove_cb_n - * @since_tizen 3.0 - * @description Negative test case of shortcut_unset_remove_cb() - */ -int utc_shortcut_unset_remove_cb_n(void) -{ - int ret; - - ret = shortcut_set_remove_cb(NULL, "temp"); - if (!is_supported) - assert_eq(ret, SHORTCUT_ERROR_NOT_SUPPORTED); - else - assert_eq(ret, SHORTCUT_ERROR_INVALID_PARAMETER); - - shortcut_unset_remove_cb(); - if (!is_supported) - assert_eq(get_last_result(), SHORTCUT_ERROR_NOT_SUPPORTED); - else - assert_eq(get_last_result(), SHORTCUT_ERROR_NONE); - - return 0; -} - -/** - * @testcase utc_shortcut_unset_remove_cb_p - * @since_tizen 3.0 - * @description Positive test case of shortcut_unset_remove_cb() - */ -int utc_shortcut_unset_remove_cb_p(void) -{ - int ret; - - ret = shortcut_set_remove_cb(_remove_cb, "temp"); - if (!is_supported) - assert_eq(ret, SHORTCUT_ERROR_NOT_SUPPORTED); - else - assert_eq(ret, SHORTCUT_ERROR_NONE); - - shortcut_unset_remove_cb(); - if (!is_supported) - assert_eq(get_last_result(), SHORTCUT_ERROR_NOT_SUPPORTED); - else - assert_eq(get_last_result(), SHORTCUT_ERROR_NONE); - return 0; -} - -int list_cb(const char *package_name, const char *icon, const char *name, const char *extra_key, const char *extra_data, void *user_data) -{ - return SHORTCUT_ERROR_NONE; -} - -/** - * @testcase utc_shortcut_get_list_n - * @since_tizen 2.3 - * @description Negative test case of shortcut_get_list() - */ -int utc_shortcut_get_list_n(void) -{ - int ret; - - ret = shortcut_get_list(NULL, NULL, NULL); - if (!is_supported) - assert_eq(ret, SHORTCUT_ERROR_NOT_SUPPORTED); - else - assert_eq(ret, SHORTCUT_ERROR_INVALID_PARAMETER); - - return 0; -} - -/** - * @testcase utc_shortcut_get_list_p - * @since_tizen 2.3 - * @description Positive test case of shortcut_get_list() - */ -int utc_shortcut_get_list_p(void) -{ - int ret; - - ret = shortcut_get_list("org.tizen.message", list_cb, NULL); - if (!is_supported) - assert_eq(ret, SHORTCUT_ERROR_NOT_SUPPORTED); - else - assert_eq(ret, SHORTCUT_ERROR_NONE); - - return 0; -}