From: InHong Han Date: Mon, 9 Sep 2019 05:52:16 +0000 (+0900) Subject: [UTC][capi-ui-sticker][ACR-1423][Add new testcases] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F96%2F213896%2F7;p=test%2Ftct%2Fnative%2Fapi.git [UTC][capi-ui-sticker][ACR-1423][Add new testcases] Change-Id: I41af9a9051ef66216b5c55bedd1804859e62c199 Signed-off-by: InHong Han --- diff --git a/packaging/TCT.spec b/packaging/TCT.spec index 3c3216dee..b97ba5341 100755 --- a/packaging/TCT.spec +++ b/packaging/TCT.spec @@ -136,6 +136,8 @@ BuildRequires: pkgconfig(capi-network-softap) BuildRequires: pkgconfig(multi-assistant) BuildRequires: pkgconfig(capi-ui-autofill) BuildRequires: pkgconfig(capi-system-battery-monitor) +BuildRequires: pkgconfig(capi-ui-sticker-consumer) +BuildRequires: pkgconfig(capi-ui-sticker-provider) Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig @@ -1032,6 +1034,13 @@ Group: Development/Tools %description -n core-multi-assistant-tests Native API Unit TC for multi-assistant +%package -n core-capi-ui-sticker-tests +Summary: Native API Unit TC for sticker +Group: Development/Tools + +%description -n core-capi-ui-sticker-tests +Native API Unit TC for sticker + %package -n native-audio-io-ctc Summary: Native API Compatibility TC for audio-io @@ -1962,6 +1971,12 @@ cp packaging/utc/core-multi-assistant-tests.xml %{buildroot}/opt/share/packages/ mkdir -p %{buildroot}/opt/usr/apps/core-multi-assistant-tests/bin #cp templates/external_wrapper.sh %{buildroot}/opt/usr/apps/core-multi-assistant-tests/bin +#core-capi-ui-sticker-tests +cp LICENSE %{buildroot}/opt/usr/share/license/core-capi-ui-sticker-tests +cp packaging/utc/core-capi-ui-sticker-tests.xml %{buildroot}/opt/share/packages/ +mkdir -p %{buildroot}/opt/usr/apps/core-capi-ui-sticker-tests/bin +#cp templates/external_wrapper.sh %{buildroot}/opt/usr/apps/core-capi-ui-sticker-tests/bin + # End Adding for UTC****************************************************************************************************************************** #native-audio-io-ctc @@ -2847,6 +2862,11 @@ pkgcmd -un org.tizen.testapp & /opt/share/packages/core-multi-assistant-tests.xml /opt/usr/share/license/core-multi-assistant-tests +%files -n core-capi-ui-sticker-tests +/opt/usr/apps/core-capi-ui-sticker-tests/* +/opt/share/packages/core-capi-ui-sticker-tests.xml +/opt/usr/share/license/core-capi-ui-sticker-tests + # End Adding for UTC****************************************************************************************************************************** %files -n native-audio-io-ctc diff --git a/packaging/utc/core-capi-ui-sticker-tests.spec b/packaging/utc/core-capi-ui-sticker-tests.spec new file mode 100644 index 000000000..773b59b45 --- /dev/null +++ b/packaging/utc/core-capi-ui-sticker-tests.spec @@ -0,0 +1,81 @@ +%define MODULE_NAME capi-ui-sticker +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, Samsung Properietary +Source0: %{name}-%{version}.tar.gz +BuildRequires: pkgconfig(bundle) +BuildRequires: cmake +BuildRequires: pkgconfig(capi-appfw-application) +BuildRequires: pkgconfig(dlog) +BuildRequires: pkgconfig(capi-system-info) +BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(elementary) +BuildRequires: pkgconfig(capi-ui-sticker-consumer) +BuildRequires: pkgconfig(capi-ui-sticker-provider) +%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} -DTZ_SYS_RO_SHARE=%TZ_SYS_RO_SHARE + %endif + %if %{?DEVICE_BUILD_TYPE_WEARABLE:1}0 + cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="wearable" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix} -DTZ_SYS_RO_SHARE=%TZ_SYS_RO_SHARE + %endif + %if %{?DEVICE_BUILD_TYPE_TV:1}0 + cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="tv" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix} -DTZ_SYS_RO_SHARE=%TZ_SYS_RO_SHARE + %endif + %if %{?DEVICE_BUILD_TYPE_TIZENIOT:1}0 + cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="tizeniot" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix} -DTZ_SYS_RO_SHARE=%TZ_SYS_RO_SHARE + %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} -DTZ_SYS_RO_SHARE=%TZ_SYS_RO_SHARE + %endif + %if %{?DEVICE_BUILD_TYPE_WEARABLE:1}0 + cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="wearable" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix} -DTZ_SYS_RO_SHARE=%TZ_SYS_RO_SHARE + %endif + %if %{?DEVICE_BUILD_TYPE_TV:1}0 + cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="tv" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix} -DTZ_SYS_RO_SHARE=%TZ_SYS_RO_SHARE + %endif + %if %{?DEVICE_BUILD_TYPE_TIZENIOT:1}0 + cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="tizeniot" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix} -DTZ_SYS_RO_SHARE=%TZ_SYS_RO_SHARE + %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}/tmp/ +mkdir -p %{buildroot}/usr/share/packages/ +cp packaging/utc/%{name}.xml %{buildroot}/usr/share/packages/ +mkdir -p %{buildroot}/usr/apps/%{name}/bin +#cp templates/external_wrapper.sh %{buildroot}/usr/apps/%{name}/bin +mkdir -p /usr/apps/%{name}/res +cp src/utc/%{MODULE_NAME}/res/test.png /usr/apps/%{name}/res +cp src/utc/%{MODULE_NAME}/res/test.json /usr/apps/%{name}/res +%post + +%postun + + +%files +/usr/apps/%{name}/* +/usr/share/packages/%{name}.xml +/usr/share/license/%{name} diff --git a/packaging/utc/core-capi-ui-sticker-tests.xml b/packaging/utc/core-capi-ui-sticker-tests.xml new file mode 100644 index 000000000..04126865f --- /dev/null +++ b/packaging/utc/core-capi-ui-sticker-tests.xml @@ -0,0 +1,17 @@ + + + + test + Core API test Application + + + + + + + + + + http://tizen.org/privilege/mediastorage + + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8f650158a..329f8fb40 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -195,6 +195,8 @@ ELSE( DEFINED MODULE ) ADD_SUBDIRECTORY(utc/streamrecorder) MESSAGE(STATUS "Building: ${CMAKE_CURRENT_SOURCE_DIR}/utc/multi-assistant") ADD_SUBDIRECTORY(utc/multi-assistant) + MESSAGE(STATUS "Building: ${CMAKE_CURRENT_SOURCE_DIR}/utc/capi-ui-sticker") + ADD_SUBDIRECTORY(utc/capi-ui-sticker) MESSAGE(STATUS "Building: ${CMAKE_CURRENT_SOURCE_DIR}/itc/accounts-svc") ADD_SUBDIRECTORY(itc/accounts-svc) MESSAGE(STATUS "Building: ${CMAKE_CURRENT_SOURCE_DIR}/itc/appcore-agent") diff --git a/src/utc/capi-ui-sticker/CMakeLists.txt b/src/utc/capi-ui-sticker/CMakeLists.txt new file mode 100644 index 000000000..b042e6515 --- /dev/null +++ b/src/utc/capi-ui-sticker/CMakeLists.txt @@ -0,0 +1,44 @@ +SET(PKG_NAME "capi-ui-sticker") + +SET(EXEC_NAME "tct-${PKG_NAME}-core") +SET(RPM_NAME "core-${PKG_NAME}-tests") + +SET(CAPI_LIB "capi-ui-sticker") +SET(TC_SOURCES + utc-capi-ui-sticker_data.c + utc-capi-ui-sticker_provider.c + utc-capi-ui-sticker_consumer.c +) + +PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED + capi-appfw-application + capi-system-info + glib-2.0 + bundle + dlog + elementary + capi-ui-sticker-consumer + capi-ui-sticker-provider +) + +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/capi-ui-sticker/res/test.json b/src/utc/capi-ui-sticker/res/test.json new file mode 100644 index 000000000..9fe4b986c --- /dev/null +++ b/src/utc/capi-ui-sticker/res/test.json @@ -0,0 +1,13 @@ +{ + "sticker": + [ + { + "type" : 2, + "uri" : "https://www.samsung.com/sticker/sample.png", + "keyword" : ["smile", "high five"], + "group" : "face", + "thumbnail" : "", + "description" : "Smiley emoji with high five." + } + ] +} \ No newline at end of file diff --git a/src/utc/capi-ui-sticker/res/test.png b/src/utc/capi-ui-sticker/res/test.png new file mode 100644 index 000000000..9765b1bda Binary files /dev/null and b/src/utc/capi-ui-sticker/res/test.png differ diff --git a/src/utc/capi-ui-sticker/tct-capi-ui-sticker-core.c b/src/utc/capi-ui-sticker/tct-capi-ui-sticker-core.c new file mode 100644 index 000000000..ce2ab3020 --- /dev/null +++ b/src/utc/capi-ui-sticker/tct-capi-ui-sticker-core.c @@ -0,0 +1,140 @@ +// +// 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 "tct_common.h" + +#ifdef MOBILE //Starts MOBILE +#include "tct-capi-ui-sticker-core_mobile.h" +#endif //MOBILE //End MOBILE + +#ifdef WEARABLE //Starts WEARABLE +#include "tct-capi-ui-sticker-core_wearable.h" +#endif //WEARABLE //End WEARABLE + +#ifdef TV //Starts TV +#include "tct-capi-ui-sticker-core_tv.h" +#endif //TV //End TV + +#ifdef TIZENIOT //Starts TIZENIOT +#include "tct-capi-ui-sticker-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/capi-ui-sticker/tct-capi-ui-sticker-core_mobile.h b/src/utc/capi-ui-sticker/tct-capi-ui-sticker-core_mobile.h new file mode 100644 index 000000000..fe0abc7e2 --- /dev/null +++ b/src/utc/capi-ui-sticker/tct-capi-ui-sticker-core_mobile.h @@ -0,0 +1,208 @@ +// +// 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_CAPI_UI_STICKER_NATIVE_H__ +#define __TCT_CAPI_UI_STICKER_NATIVE_H__ + +#include "testcase.h" +#include "tct_common.h" + +// Data +extern void utc_capi_ui_sticker_data_startup(void); +extern void utc_capi_ui_sticker_data_cleanup(void); + +extern int utc_sticker_data_create_p(void); +extern int utc_sticker_data_create_n(void); + +extern int utc_sticker_data_destroy_p(void); +extern int utc_sticker_data_destroy_n(void); + +extern int utc_sticker_data_clone_p(void); +extern int utc_sticker_data_clone_n(void); + +extern int utc_sticker_data_get_app_id_p(void); +extern int utc_sticker_data_get_app_id_n(void); + +extern int utc_sticker_data_set_uri_p(void); +extern int utc_sticker_data_set_uri_n(void); +extern int utc_sticker_data_set_uri_n2(void); + +extern int utc_sticker_data_get_uri_p(void); +extern int utc_sticker_data_get_uri_n(void); + +extern int utc_sticker_data_foreach_keyword_p(void); +extern int utc_sticker_data_foreach_keyword_n(void); + +extern int utc_sticker_data_add_keyword_p(void); +extern int utc_sticker_data_add_keyword_n(void); +extern int utc_sticker_data_add_keyword_n2(void); + +extern int utc_sticker_data_remove_keyword_p(void); +extern int utc_sticker_data_remove_keyword_n(void); +extern int utc_sticker_data_remove_keyword_n2(void); + +extern int utc_sticker_data_set_group_name_p(void); +extern int utc_sticker_data_set_group_name_n(void); + +extern int utc_sticker_data_get_group_name_p(void); +extern int utc_sticker_data_get_group_name_n(void); + +extern int utc_sticker_data_set_thumbnail_p(void); +extern int utc_sticker_data_set_thumbnail_n(void); +extern int utc_sticker_data_set_thumbnail_n2(void); + +extern int utc_sticker_data_get_thumbnail_p(void); +extern int utc_sticker_data_get_thumbnail_n(void); + +extern int utc_sticker_data_set_description_p(void); +extern int utc_sticker_data_set_description_n(void); + +extern int utc_sticker_data_get_description_p(void); +extern int utc_sticker_data_get_description_n(void); + +extern int utc_sticker_data_get_date_p(void); +extern int utc_sticker_data_get_date_n(void); + +// Provider +extern void utc_capi_ui_sticker_provider_startup(void); +extern void utc_capi_ui_sticker_provider_cleanup(void); + +extern int utc_sticker_provider_create_p(void); +extern int utc_sticker_provider_create_n(void); + +extern int utc_sticker_provider_destroy_p(void); +extern int utc_sticker_provider_destroy_n(void); + +extern int utc_sticker_provider_insert_data_p(void); +extern int utc_sticker_provider_insert_data_n(void); + +extern int utc_sticker_provider_insert_data_by_json_file_p(void); +extern int utc_sticker_provider_insert_data_by_json_file_n(void); +extern int utc_sticker_provider_insert_data_by_json_file_n2(void); + +extern int utc_sticker_provider_update_data_p(void); +extern int utc_sticker_provider_update_data_n(void); + +extern int utc_sticker_provider_delete_data_p(void); +extern int utc_sticker_provider_delete_data_n(void); + +extern int utc_sticker_provider_get_sticker_count_p(void); +extern int utc_sticker_provider_get_sticker_count_n(void); + +extern int utc_sticker_provider_data_foreach_all_p(void); +extern int utc_sticker_provider_data_foreach_all_n(void); + +// Consumer +extern void utc_capi_ui_sticker_consumer_startup(void); +extern void utc_capi_ui_sticker_consumer_cleanup(void); + +extern int utc_sticker_consumer_create_p(void); +extern int utc_sticker_consumer_create_n(void); + +extern int utc_sticker_consumer_destroy_p(void); +extern int utc_sticker_consumer_destroy_n(void); + +extern int utc_sticker_consumer_data_foreach_all_p(void); +extern int utc_sticker_consumer_data_foreach_all_n(void); + +extern int utc_sticker_consumer_data_foreach_by_keyword_p(void); +extern int utc_sticker_consumer_data_foreach_by_keyword_n(void); + +extern int utc_sticker_consumer_data_foreach_by_group_p(void); +extern int utc_sticker_consumer_data_foreach_by_group_n(void); + +extern int utc_sticker_consumer_data_foreach_by_type_p(void); +extern int utc_sticker_consumer_data_foreach_by_type_n(void); + +extern int utc_sticker_consumer_group_list_foreach_all_p(void); +extern int utc_sticker_consumer_group_list_foreach_all_n(void); + +extern int utc_sticker_consumer_keyword_list_foreach_all_p(void); +extern int utc_sticker_consumer_keyword_list_foreach_all_n(void); + +testcase tc_array[] = { + {"utc_sticker_data_create_p", utc_sticker_data_create_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_create_n", utc_sticker_data_create_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_destroy_p", utc_sticker_data_destroy_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_destroy_n", utc_sticker_data_destroy_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_clone_p", utc_sticker_data_clone_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_clone_n", utc_sticker_data_clone_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_get_app_id_p", utc_sticker_data_get_app_id_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_get_app_id_n", utc_sticker_data_get_app_id_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_set_uri_p", utc_sticker_data_set_uri_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_set_uri_n", utc_sticker_data_set_uri_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_set_uri_n2", utc_sticker_data_set_uri_n2, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_get_uri_p", utc_sticker_data_get_uri_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_get_uri_n", utc_sticker_data_get_uri_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_foreach_keyword_p", utc_sticker_data_foreach_keyword_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_foreach_keyword_n", utc_sticker_data_foreach_keyword_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_add_keyword_p", utc_sticker_data_add_keyword_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_add_keyword_n", utc_sticker_data_add_keyword_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_add_keyword_n2", utc_sticker_data_add_keyword_n2, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_remove_keyword_p", utc_sticker_data_remove_keyword_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_remove_keyword_n", utc_sticker_data_remove_keyword_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_remove_keyword_n2", utc_sticker_data_remove_keyword_n2, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_set_group_name_p", utc_sticker_data_set_group_name_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_set_group_name_n", utc_sticker_data_set_group_name_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_get_group_name_p", utc_sticker_data_get_group_name_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_get_group_name_n", utc_sticker_data_get_group_name_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_set_thumbnail_p", utc_sticker_data_set_thumbnail_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_set_thumbnail_n", utc_sticker_data_set_thumbnail_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_set_thumbnail_n2", utc_sticker_data_set_thumbnail_n2, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_get_thumbnail_p", utc_sticker_data_get_thumbnail_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_get_thumbnail_n", utc_sticker_data_get_thumbnail_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_set_description_p", utc_sticker_data_set_description_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_set_description_n", utc_sticker_data_set_description_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_get_description_p", utc_sticker_data_get_description_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_get_description_n", utc_sticker_data_get_description_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_get_date_p", utc_sticker_data_get_date_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_get_date_n", utc_sticker_data_get_date_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_provider_create_p", utc_sticker_provider_create_p, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_create_n", utc_sticker_provider_create_n, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_destroy_p", utc_sticker_provider_destroy_p, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_destroy_n", utc_sticker_provider_destroy_n, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_insert_data_p", utc_sticker_provider_insert_data_p, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_insert_data_n", utc_sticker_provider_insert_data_n, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_insert_data_by_json_file_p", utc_sticker_provider_insert_data_by_json_file_p, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_insert_data_by_json_file_n", utc_sticker_provider_insert_data_by_json_file_n, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_insert_data_by_json_file_n2", utc_sticker_provider_insert_data_by_json_file_n2, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_update_data_p", utc_sticker_provider_update_data_p, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_update_data_n", utc_sticker_provider_update_data_n, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_delete_data_p", utc_sticker_provider_delete_data_p, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_delete_data_n", utc_sticker_provider_delete_data_n, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_get_sticker_count_p", utc_sticker_provider_get_sticker_count_p, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_get_sticker_count_n", utc_sticker_provider_get_sticker_count_n, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_data_foreach_all_p", utc_sticker_provider_data_foreach_all_p, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_data_foreach_all_n", utc_sticker_provider_data_foreach_all_n, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_consumer_create_p", utc_sticker_consumer_create_p, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {"utc_sticker_consumer_create_n", utc_sticker_consumer_create_n, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {"utc_sticker_consumer_destroy_p", utc_sticker_consumer_destroy_p, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {"utc_sticker_consumer_destroy_n", utc_sticker_consumer_destroy_n, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {"utc_sticker_consumer_data_foreach_all_p", utc_sticker_consumer_data_foreach_all_p, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {"utc_sticker_consumer_data_foreach_all_n", utc_sticker_consumer_data_foreach_all_n, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {"utc_sticker_consumer_data_foreach_by_keyword_p", utc_sticker_consumer_data_foreach_by_keyword_p, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {"utc_sticker_consumer_data_foreach_by_keyword_n", utc_sticker_consumer_data_foreach_by_keyword_n, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {"utc_sticker_consumer_data_foreach_by_group_p", utc_sticker_consumer_data_foreach_by_group_p, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {"utc_sticker_consumer_data_foreach_by_group_n", utc_sticker_consumer_data_foreach_by_group_n, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {"utc_sticker_consumer_data_foreach_by_type_p", utc_sticker_consumer_data_foreach_by_type_p, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {"utc_sticker_consumer_data_foreach_by_type_n", utc_sticker_consumer_data_foreach_by_type_n, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {"utc_sticker_consumer_group_list_foreach_all_p", utc_sticker_consumer_group_list_foreach_all_p, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {"utc_sticker_consumer_group_list_foreach_all_n", utc_sticker_consumer_group_list_foreach_all_n, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {"utc_sticker_consumer_keyword_list_foreach_all_p", utc_sticker_consumer_keyword_list_foreach_all_p, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {"utc_sticker_consumer_keyword_list_foreach_all_n", utc_sticker_consumer_keyword_list_foreach_all_n, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {NULL, NULL} +}; + +#endif // __TCT_CAPI_UI_STICKER_NATIVE_H__ diff --git a/src/utc/capi-ui-sticker/tct-capi-ui-sticker-core_wearable.h b/src/utc/capi-ui-sticker/tct-capi-ui-sticker-core_wearable.h new file mode 100644 index 000000000..fe0abc7e2 --- /dev/null +++ b/src/utc/capi-ui-sticker/tct-capi-ui-sticker-core_wearable.h @@ -0,0 +1,208 @@ +// +// 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_CAPI_UI_STICKER_NATIVE_H__ +#define __TCT_CAPI_UI_STICKER_NATIVE_H__ + +#include "testcase.h" +#include "tct_common.h" + +// Data +extern void utc_capi_ui_sticker_data_startup(void); +extern void utc_capi_ui_sticker_data_cleanup(void); + +extern int utc_sticker_data_create_p(void); +extern int utc_sticker_data_create_n(void); + +extern int utc_sticker_data_destroy_p(void); +extern int utc_sticker_data_destroy_n(void); + +extern int utc_sticker_data_clone_p(void); +extern int utc_sticker_data_clone_n(void); + +extern int utc_sticker_data_get_app_id_p(void); +extern int utc_sticker_data_get_app_id_n(void); + +extern int utc_sticker_data_set_uri_p(void); +extern int utc_sticker_data_set_uri_n(void); +extern int utc_sticker_data_set_uri_n2(void); + +extern int utc_sticker_data_get_uri_p(void); +extern int utc_sticker_data_get_uri_n(void); + +extern int utc_sticker_data_foreach_keyword_p(void); +extern int utc_sticker_data_foreach_keyword_n(void); + +extern int utc_sticker_data_add_keyword_p(void); +extern int utc_sticker_data_add_keyword_n(void); +extern int utc_sticker_data_add_keyword_n2(void); + +extern int utc_sticker_data_remove_keyword_p(void); +extern int utc_sticker_data_remove_keyword_n(void); +extern int utc_sticker_data_remove_keyword_n2(void); + +extern int utc_sticker_data_set_group_name_p(void); +extern int utc_sticker_data_set_group_name_n(void); + +extern int utc_sticker_data_get_group_name_p(void); +extern int utc_sticker_data_get_group_name_n(void); + +extern int utc_sticker_data_set_thumbnail_p(void); +extern int utc_sticker_data_set_thumbnail_n(void); +extern int utc_sticker_data_set_thumbnail_n2(void); + +extern int utc_sticker_data_get_thumbnail_p(void); +extern int utc_sticker_data_get_thumbnail_n(void); + +extern int utc_sticker_data_set_description_p(void); +extern int utc_sticker_data_set_description_n(void); + +extern int utc_sticker_data_get_description_p(void); +extern int utc_sticker_data_get_description_n(void); + +extern int utc_sticker_data_get_date_p(void); +extern int utc_sticker_data_get_date_n(void); + +// Provider +extern void utc_capi_ui_sticker_provider_startup(void); +extern void utc_capi_ui_sticker_provider_cleanup(void); + +extern int utc_sticker_provider_create_p(void); +extern int utc_sticker_provider_create_n(void); + +extern int utc_sticker_provider_destroy_p(void); +extern int utc_sticker_provider_destroy_n(void); + +extern int utc_sticker_provider_insert_data_p(void); +extern int utc_sticker_provider_insert_data_n(void); + +extern int utc_sticker_provider_insert_data_by_json_file_p(void); +extern int utc_sticker_provider_insert_data_by_json_file_n(void); +extern int utc_sticker_provider_insert_data_by_json_file_n2(void); + +extern int utc_sticker_provider_update_data_p(void); +extern int utc_sticker_provider_update_data_n(void); + +extern int utc_sticker_provider_delete_data_p(void); +extern int utc_sticker_provider_delete_data_n(void); + +extern int utc_sticker_provider_get_sticker_count_p(void); +extern int utc_sticker_provider_get_sticker_count_n(void); + +extern int utc_sticker_provider_data_foreach_all_p(void); +extern int utc_sticker_provider_data_foreach_all_n(void); + +// Consumer +extern void utc_capi_ui_sticker_consumer_startup(void); +extern void utc_capi_ui_sticker_consumer_cleanup(void); + +extern int utc_sticker_consumer_create_p(void); +extern int utc_sticker_consumer_create_n(void); + +extern int utc_sticker_consumer_destroy_p(void); +extern int utc_sticker_consumer_destroy_n(void); + +extern int utc_sticker_consumer_data_foreach_all_p(void); +extern int utc_sticker_consumer_data_foreach_all_n(void); + +extern int utc_sticker_consumer_data_foreach_by_keyword_p(void); +extern int utc_sticker_consumer_data_foreach_by_keyword_n(void); + +extern int utc_sticker_consumer_data_foreach_by_group_p(void); +extern int utc_sticker_consumer_data_foreach_by_group_n(void); + +extern int utc_sticker_consumer_data_foreach_by_type_p(void); +extern int utc_sticker_consumer_data_foreach_by_type_n(void); + +extern int utc_sticker_consumer_group_list_foreach_all_p(void); +extern int utc_sticker_consumer_group_list_foreach_all_n(void); + +extern int utc_sticker_consumer_keyword_list_foreach_all_p(void); +extern int utc_sticker_consumer_keyword_list_foreach_all_n(void); + +testcase tc_array[] = { + {"utc_sticker_data_create_p", utc_sticker_data_create_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_create_n", utc_sticker_data_create_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_destroy_p", utc_sticker_data_destroy_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_destroy_n", utc_sticker_data_destroy_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_clone_p", utc_sticker_data_clone_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_clone_n", utc_sticker_data_clone_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_get_app_id_p", utc_sticker_data_get_app_id_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_get_app_id_n", utc_sticker_data_get_app_id_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_set_uri_p", utc_sticker_data_set_uri_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_set_uri_n", utc_sticker_data_set_uri_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_set_uri_n2", utc_sticker_data_set_uri_n2, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_get_uri_p", utc_sticker_data_get_uri_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_get_uri_n", utc_sticker_data_get_uri_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_foreach_keyword_p", utc_sticker_data_foreach_keyword_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_foreach_keyword_n", utc_sticker_data_foreach_keyword_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_add_keyword_p", utc_sticker_data_add_keyword_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_add_keyword_n", utc_sticker_data_add_keyword_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_add_keyword_n2", utc_sticker_data_add_keyword_n2, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_remove_keyword_p", utc_sticker_data_remove_keyword_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_remove_keyword_n", utc_sticker_data_remove_keyword_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_remove_keyword_n2", utc_sticker_data_remove_keyword_n2, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_set_group_name_p", utc_sticker_data_set_group_name_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_set_group_name_n", utc_sticker_data_set_group_name_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_get_group_name_p", utc_sticker_data_get_group_name_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_get_group_name_n", utc_sticker_data_get_group_name_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_set_thumbnail_p", utc_sticker_data_set_thumbnail_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_set_thumbnail_n", utc_sticker_data_set_thumbnail_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_set_thumbnail_n2", utc_sticker_data_set_thumbnail_n2, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_get_thumbnail_p", utc_sticker_data_get_thumbnail_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_get_thumbnail_n", utc_sticker_data_get_thumbnail_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_set_description_p", utc_sticker_data_set_description_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_set_description_n", utc_sticker_data_set_description_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_get_description_p", utc_sticker_data_get_description_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_get_description_n", utc_sticker_data_get_description_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_get_date_p", utc_sticker_data_get_date_p, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_data_get_date_n", utc_sticker_data_get_date_n, utc_capi_ui_sticker_data_startup, utc_capi_ui_sticker_data_cleanup}, + {"utc_sticker_provider_create_p", utc_sticker_provider_create_p, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_create_n", utc_sticker_provider_create_n, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_destroy_p", utc_sticker_provider_destroy_p, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_destroy_n", utc_sticker_provider_destroy_n, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_insert_data_p", utc_sticker_provider_insert_data_p, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_insert_data_n", utc_sticker_provider_insert_data_n, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_insert_data_by_json_file_p", utc_sticker_provider_insert_data_by_json_file_p, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_insert_data_by_json_file_n", utc_sticker_provider_insert_data_by_json_file_n, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_insert_data_by_json_file_n2", utc_sticker_provider_insert_data_by_json_file_n2, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_update_data_p", utc_sticker_provider_update_data_p, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_update_data_n", utc_sticker_provider_update_data_n, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_delete_data_p", utc_sticker_provider_delete_data_p, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_delete_data_n", utc_sticker_provider_delete_data_n, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_get_sticker_count_p", utc_sticker_provider_get_sticker_count_p, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_get_sticker_count_n", utc_sticker_provider_get_sticker_count_n, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_data_foreach_all_p", utc_sticker_provider_data_foreach_all_p, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_provider_data_foreach_all_n", utc_sticker_provider_data_foreach_all_n, utc_capi_ui_sticker_provider_startup, utc_capi_ui_sticker_provider_cleanup}, + {"utc_sticker_consumer_create_p", utc_sticker_consumer_create_p, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {"utc_sticker_consumer_create_n", utc_sticker_consumer_create_n, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {"utc_sticker_consumer_destroy_p", utc_sticker_consumer_destroy_p, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {"utc_sticker_consumer_destroy_n", utc_sticker_consumer_destroy_n, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {"utc_sticker_consumer_data_foreach_all_p", utc_sticker_consumer_data_foreach_all_p, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {"utc_sticker_consumer_data_foreach_all_n", utc_sticker_consumer_data_foreach_all_n, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {"utc_sticker_consumer_data_foreach_by_keyword_p", utc_sticker_consumer_data_foreach_by_keyword_p, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {"utc_sticker_consumer_data_foreach_by_keyword_n", utc_sticker_consumer_data_foreach_by_keyword_n, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {"utc_sticker_consumer_data_foreach_by_group_p", utc_sticker_consumer_data_foreach_by_group_p, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {"utc_sticker_consumer_data_foreach_by_group_n", utc_sticker_consumer_data_foreach_by_group_n, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {"utc_sticker_consumer_data_foreach_by_type_p", utc_sticker_consumer_data_foreach_by_type_p, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {"utc_sticker_consumer_data_foreach_by_type_n", utc_sticker_consumer_data_foreach_by_type_n, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {"utc_sticker_consumer_group_list_foreach_all_p", utc_sticker_consumer_group_list_foreach_all_p, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {"utc_sticker_consumer_group_list_foreach_all_n", utc_sticker_consumer_group_list_foreach_all_n, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {"utc_sticker_consumer_keyword_list_foreach_all_p", utc_sticker_consumer_keyword_list_foreach_all_p, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {"utc_sticker_consumer_keyword_list_foreach_all_n", utc_sticker_consumer_keyword_list_foreach_all_n, utc_capi_ui_sticker_consumer_startup, utc_capi_ui_sticker_consumer_cleanup}, + {NULL, NULL} +}; + +#endif // __TCT_CAPI_UI_STICKER_NATIVE_H__ diff --git a/src/utc/capi-ui-sticker/utc-capi-ui-sticker_consumer.c b/src/utc/capi-ui-sticker/utc-capi-ui-sticker_consumer.c new file mode 100644 index 000000000..450b37a69 --- /dev/null +++ b/src/utc/capi-ui-sticker/utc-capi-ui-sticker_consumer.c @@ -0,0 +1,399 @@ +// +// 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 +#include +#include + +#define STICKER_FEATURE "tizen.org/feature/ui_service.sticker" + +static bool sticker_supported = false; +static bool callback_result = false; +static sticker_data_h g_dh = NULL; +static sticker_provider_h g_ph = NULL; +static sticker_consumer_h g_ch = NULL; + +static void sticker_data_foreach_cb(sticker_data_h data_handle, void *user_data) +{ + callback_result = true; +} + +static void group_list_foreach_cb(const char *group, void *user_data) +{ + callback_result = true; +} + +static void keyword_list_foreach_cb(const char *keyword, void *user_data) +{ + callback_result = true; +} + +static void foreach_to_check_del(sticker_data_h data_handle, void *user_data) +{ + sticker_provider_delete_data(g_ph, data_handle); +} + +/** + * @function utc_capi_ui_sticker_consumer_startup + * @description Called before each test + * @parameter NA + * @return NA + */ +void utc_capi_ui_sticker_consumer_startup(void) +{ + if (!system_info_get_platform_bool(STICKER_FEATURE, &sticker_supported)) { + if (sticker_supported != true) + fprintf(stderr, "This device is not support Sticker API.\n"); + } + + if (sticker_supported == true) { + sticker_consumer_create(&g_ch); + sticker_provider_create(&g_ph); + sticker_data_create(&g_dh); + sticker_data_set_uri(g_dh, STICKER_DATA_URI_WEB_RESOURCE, "www.samsung.com"); + sticker_data_add_keyword(g_dh, "smile"); + sticker_data_add_keyword(g_dh, "face"); + sticker_data_add_keyword(g_dh, "cute"); + sticker_data_set_group_name(g_dh, "tizen"); + sticker_data_set_thumbnail(g_dh, "/res/test.png"); + sticker_data_set_description(g_dh, "TCT Test"); + sticker_provider_insert_data(g_ph, g_dh); + } +} + +/** + * @function utc_capi_ui_sticker_consumer_cleanup + * @description Called after each test + * @parameter NA + * @return NA + */ +void utc_capi_ui_sticker_consumer_cleanup(void) +{ + if (sticker_supported == true) { + int result; + sticker_provider_data_foreach_all(g_ph, 0, 1000, &result, foreach_to_check_del, NULL); + sticker_provider_destroy(g_ph); + sticker_data_destroy(g_dh); + sticker_consumer_destroy(g_ch); + g_ph = NULL; + g_dh = NULL; + g_ch = NULL; + } +} + + +/** + * @testcase utc_sticker_consumer_create_p + * @since_tizen 5.5 + * @description Positive UTC of the function that creates sticker consumer handle. + */ +int utc_sticker_consumer_create_p(void) +{ + sticker_consumer_h consumer_handle = NULL; + int ret = sticker_consumer_create(&consumer_handle); + if (sticker_supported == true) { + assert_eq(ret, STICKER_ERROR_NONE); + sticker_consumer_destroy(consumer_handle); + consumer_handle = NULL; + } else { + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_sticker_consumer_create_n + * @since_tizen 5.5 + * @description Negative UTC of the function that creates sticker consumer handle. + */ +int utc_sticker_consumer_create_n(void) +{ + int ret = sticker_consumer_create(NULL); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_consumer_destroy_p + * @since_tizen 5.5 + * @description Positive UTC of the function that destroys sticker consumer handle. + */ +int utc_sticker_consumer_destroy_p(void) +{ + sticker_consumer_h consumer_handle = NULL; + int ret = sticker_consumer_create(&consumer_handle); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_NONE); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + ret = sticker_consumer_destroy(consumer_handle); + consumer_handle = NULL; + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_NONE); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_consumer_destroy_n + * @since_tizen 5.5 + * @description Negative UTC of the function that destroys sticker consumer handle. + */ +int utc_sticker_consumer_destroy_n(void) +{ + int ret = sticker_consumer_destroy(NULL); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_consumer_data_foreach_all_p + * @since_tizen 5.5 + * @description Positive UTC of the function that retrieves all sticker data. + */ +int utc_sticker_consumer_data_foreach_all_p(void) +{ + int result = 0; + callback_result = false; + int ret = sticker_consumer_data_foreach_all(g_ch, 0, 1000, &result, sticker_data_foreach_cb, NULL); + if (sticker_supported == true) { + assert_eq(callback_result, true); + assert_eq(ret, STICKER_ERROR_NONE); + } + else { + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_sticker_consumer_data_foreach_all_n + * @since_tizen 5.5 + * @description Negative UTC of the function that retrieves all sticker data. + */ +int utc_sticker_consumer_data_foreach_all_n(void) +{ + int result = 0; + int ret = sticker_consumer_data_foreach_all(g_ch, -1, 0, &result, sticker_data_foreach_cb, NULL); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_consumer_data_foreach_by_keyword_p + * @since_tizen 5.5 + * @description Positive UTC of the function that retrieves all sticker data using keyword. + */ +int utc_sticker_consumer_data_foreach_by_keyword_p(void) +{ + int result = 0; + callback_result = false; + int ret = sticker_consumer_data_foreach_by_keyword(g_ch, 0, 1000, &result, "cute", sticker_data_foreach_cb, NULL); + if (sticker_supported == true) { + assert_eq(callback_result, true); + assert_eq(ret, STICKER_ERROR_NONE); + } + else { + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_sticker_consumer_data_foreach_by_keyword_n + * @since_tizen 5.5 + * @description Negative UTC of the function that retrieves all sticker data using keyword. + */ +int utc_sticker_consumer_data_foreach_by_keyword_n(void) +{ + int result = 0; + int ret = sticker_consumer_data_foreach_by_keyword(g_ch, -1, 0, &result, "cute", sticker_data_foreach_cb, NULL); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_consumer_data_foreach_by_group_p + * @since_tizen 5.5 + * @description Positive UTC of the function that retrieves all sticker data using group. + */ +int utc_sticker_consumer_data_foreach_by_group_p(void) +{ + int result = 0; + callback_result = false; + int ret = sticker_consumer_data_foreach_by_group(g_ch, 0, 1000, &result, "tizen", sticker_data_foreach_cb, NULL); + if (sticker_supported == true) { + assert_eq(callback_result, true); + assert_eq(ret, STICKER_ERROR_NONE); + } + else { + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_sticker_consumer_data_foreach_by_group_n + * @since_tizen 5.5 + * @description Negative UTC of the function that retrieves all sticker data using group. + */ +int utc_sticker_consumer_data_foreach_by_group_n(void) +{ + int result = 0; + int ret = sticker_consumer_data_foreach_by_group(g_ch, -1, 0, &result, "tizen", sticker_data_foreach_cb, NULL); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_consumer_data_foreach_by_type_p + * @since_tizen 5.5 + * @description Positive UTC of the function that retrieves all sticker data using type. + */ +int utc_sticker_consumer_data_foreach_by_type_p(void) +{ + int result = 0; + callback_result = false; + int ret = sticker_consumer_data_foreach_by_type(g_ch, 0, 1000, &result, STICKER_DATA_URI_WEB_RESOURCE, sticker_data_foreach_cb, NULL); + if (sticker_supported == true) { + assert_eq(callback_result, true); + assert_eq(ret, STICKER_ERROR_NONE); + } + else { + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_sticker_consumer_data_foreach_by_type_n + * @since_tizen 5.5 + * @description Negative UTC of the function that retrieves all sticker data using type. + */ +int utc_sticker_consumer_data_foreach_by_type_n(void) +{ + int result = 0; + int ret = sticker_consumer_data_foreach_by_type(g_ch, -1, 0, &result, STICKER_DATA_URI_WEB_RESOURCE, sticker_data_foreach_cb, NULL); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_consumer_group_list_foreach_all_p + * @since_tizen 5.5 + * @description Positive UTC of the function that retrieves all group name. + */ +int utc_sticker_consumer_group_list_foreach_all_p(void) +{ + callback_result = false; + int ret = sticker_consumer_group_list_foreach_all(g_ch, group_list_foreach_cb, NULL); + if (sticker_supported == true) { + assert_eq(callback_result, true); + assert_eq(ret, STICKER_ERROR_NONE); + } + else { + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_sticker_consumer_group_list_foreach_all_n + * @since_tizen 5.5 + * @description Negative UTC of the function that retrieves all group name. + */ +int utc_sticker_consumer_group_list_foreach_all_n(void) +{ + int ret = sticker_consumer_group_list_foreach_all(g_ch, NULL, NULL); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_consumer_keyword_list_foreach_all_p + * @since_tizen 5.5 + * @description Positive UTC of the function that retrieves all keyword. + */ +int utc_sticker_consumer_keyword_list_foreach_all_p(void) +{ + callback_result = false; + int ret = sticker_consumer_keyword_list_foreach_all(g_ch, keyword_list_foreach_cb, NULL); + if (sticker_supported == true) { + assert_eq(callback_result, true); + assert_eq(ret, STICKER_ERROR_NONE); + } + else { + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_sticker_consumer_keyword_list_foreach_all_n + * @since_tizen 5.5 + * @description Negative UTC of the function that retrieves all keyword. + */ +int utc_sticker_consumer_keyword_list_foreach_all_n(void) +{ + int ret = sticker_consumer_keyword_list_foreach_all(g_ch, NULL, NULL); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} \ No newline at end of file diff --git a/src/utc/capi-ui-sticker/utc-capi-ui-sticker_data.c b/src/utc/capi-ui-sticker/utc-capi-ui-sticker_data.c new file mode 100644 index 000000000..8bb54cfb5 --- /dev/null +++ b/src/utc/capi-ui-sticker/utc-capi-ui-sticker_data.c @@ -0,0 +1,704 @@ +// +// 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 + +#define STICKER_FEATURE "tizen.org/feature/ui_service.sticker" + +static bool sticker_supported = false; +static bool callback_result = false; +static sticker_data_h g_dh = NULL; + +static void foreach_keyword_cb(const char *keyword, void *user_data) +{ + callback_result = true; +} + +/** + * @function utc_capi_ui_sticker_data_startup + * @description Called before each test + * @parameter NA + * @return NA + */ +void utc_capi_ui_sticker_data_startup(void) +{ + if (!system_info_get_platform_bool(STICKER_FEATURE, &sticker_supported)) { + if (sticker_supported != true) + fprintf(stderr, "This device is not support Sticker API.\n"); + } + + if (sticker_supported == true) { + sticker_data_create(&g_dh); + sticker_data_set_uri(g_dh, STICKER_DATA_URI_WEB_RESOURCE, "www.samsung.com"); + sticker_data_add_keyword(g_dh, "smile"); + sticker_data_add_keyword(g_dh, "face"); + sticker_data_add_keyword(g_dh, "cute"); + sticker_data_set_group_name(g_dh, "tizen"); + sticker_data_set_thumbnail(g_dh, "/res/test.png"); + sticker_data_set_description(g_dh, "TCT Test"); + } +} + +/** + * @function utc_capi_ui_sticker_data_cleanup + * @description Called after each test + * @parameter NA + * @return NA + */ +void utc_capi_ui_sticker_data_cleanup(void) +{ + if (sticker_supported == true) { + sticker_data_destroy(g_dh); + g_dh = NULL; + } +} + + +/** + * @testcase utc_sticker_data_create_p + * @since_tizen 5.5 + * @description Positive UTC of the function that creates sticker data handle. + */ +int utc_sticker_data_create_p(void) +{ + sticker_data_h data_handle = NULL; + int ret = sticker_data_create(&data_handle); + if (sticker_supported == true) { + assert_eq(ret, STICKER_ERROR_NONE); + sticker_data_destroy(data_handle); + data_handle = NULL; + } else { + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_sticker_data_create_n + * @since_tizen 5.5 + * @description Negative UTC of the function that creates sticker data handle. + */ +int utc_sticker_data_create_n(void) +{ + int ret = sticker_data_create(NULL); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_data_destroy_p + * @since_tizen 5.5 + * @description Positive UTC of the function that destroys sticker data handle. + */ +int utc_sticker_data_destroy_p(void) +{ + sticker_data_h data_handle = NULL; + int ret = sticker_data_create(&data_handle); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_NONE); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + ret = sticker_data_destroy(data_handle); + data_handle = NULL; + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_NONE); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_data_destroy_n + * @since_tizen 5.5 + * @description Negative UTC of the function that destroys sticker data handle. + */ +int utc_sticker_data_destroy_n(void) +{ + int ret = sticker_data_destroy(NULL); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_data_clone_p + * @since_tizen 5.5 + * @description Positive UTC of the function that clones sticker data. + */ +int utc_sticker_data_clone_p(void) +{ + sticker_data_h clone = NULL; + int ret = sticker_data_clone(g_dh, &clone); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_NONE); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + ret = sticker_data_destroy(clone); + clone = NULL; + + return 0; +} + +/** + * @testcase utc_sticker_data_clone_n + * @since_tizen 5.5 + * @description Negative UTC of the function that clones sticker data. + */ +int utc_sticker_data_clone_n(void) +{ + int ret = sticker_data_clone(NULL, NULL); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_data_get_app_id_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets application id of sticker data. + */ +int utc_sticker_data_get_app_id_p(void) +{ + char *app_id = NULL; + int ret = sticker_data_get_app_id(g_dh, &app_id); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_NONE); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + if (app_id) { + free(app_id); + app_id = NULL; + } + + return 0; +} + +/** + * @testcase utc_sticker_data_get_app_id_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets application id of sticker data. + */ +int utc_sticker_data_get_app_id_n(void) +{ + char *app_id = NULL; + int ret = sticker_data_get_app_id(NULL, &app_id); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_data_set_uri_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets uri of sticker data. + */ +int utc_sticker_data_set_uri_p(void) +{ + int ret = sticker_data_set_uri(g_dh, STICKER_DATA_URI_WEB_RESOURCE, "www.tizen.org"); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_NONE); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_data_set_uri_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets uri of sticker data. + */ +int utc_sticker_data_set_uri_n(void) +{ + int ret = sticker_data_set_uri(NULL, STICKER_DATA_URI_WEB_RESOURCE, "www.tizen.org"); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_data_set_uri_n2 + * @since_tizen 5.5 + * @description Negative UTC of the function that sets uri of sticker data. + */ +int utc_sticker_data_set_uri_n2(void) +{ + int ret = sticker_data_set_uri(g_dh, STICKER_DATA_URI_LOCAL_PATH, "/aaa/bbb/ccc.png"); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_data_get_uri_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets uri of sticker data. + */ +int utc_sticker_data_get_uri_p(void) +{ + sticker_data_uri_type_e type; + char *uri = NULL; + + int ret = sticker_data_get_uri(g_dh, &type, &uri); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_NONE); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + if (uri) { + free(uri); + uri = NULL; + } + + return 0; +} + +/** + * @testcase utc_sticker_data_get_uri_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets uri of sticker data. + */ +int utc_sticker_data_get_uri_n(void) +{ + int ret = sticker_data_get_uri(g_dh, NULL, NULL); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_data_foreach_keyword_p + * @since_tizen 5.5 + * @description Positive UTC of the function that retrieves all keywords of sticker data. + */ +int utc_sticker_data_foreach_keyword_p(void) +{ + callback_result = false; + int ret = sticker_data_foreach_keyword(g_dh, foreach_keyword_cb, NULL); + if (sticker_supported == true) { + assert_eq(callback_result, true); + assert_eq(ret, STICKER_ERROR_NONE); + } else { + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_sticker_data_foreach_keyword_n + * @since_tizen 5.5 + * @description Negative UTC of the function that retrieves all keywords of sticker data. + */ +int utc_sticker_data_foreach_keyword_n(void) +{ + int ret = sticker_data_foreach_keyword(g_dh, NULL, NULL); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_data_add_keyword_p + * @since_tizen 5.5 + * @description Positive UTC of the function that adds keyword of sticker data. + */ +int utc_sticker_data_add_keyword_p(void) +{ + int ret = sticker_data_add_keyword(g_dh, "test"); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_NONE); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_data_add_keyword_n + * @since_tizen 5.5 + * @description Negative UTC of the function that adds keyword of sticker data. + */ +int utc_sticker_data_add_keyword_n(void) +{ + int ret = sticker_data_add_keyword(g_dh, NULL); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_data_add_keyword_n2 + * @since_tizen 5.5 + * @description Negative UTC of the function that adds keyword of sticker data. + */ +int utc_sticker_data_add_keyword_n2(void) +{ + int ret = sticker_data_add_keyword(g_dh, "smile"); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_data_remove_keyword_p + * @since_tizen 5.5 + * @description Positive UTC of the function that removes keyword of sticker data. + */ +int utc_sticker_data_remove_keyword_p(void) +{ + int ret = sticker_data_remove_keyword(g_dh, "face"); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_NONE); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_data_remove_keyword_n + * @since_tizen 5.5 + * @description Negative UTC of the function that removes keyword of sticker data. + */ +int utc_sticker_data_remove_keyword_n(void) +{ + int ret = sticker_data_remove_keyword(g_dh, NULL); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_data_remove_keyword_n2 + * @since_tizen 5.5 + * @description Negative UTC of the function that removes keyword of sticker data. + */ +int utc_sticker_data_remove_keyword_n2(void) +{ + int ret = sticker_data_remove_keyword(g_dh, "test"); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_data_set_group_name_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets group name of sticker data. + */ +int utc_sticker_data_set_group_name_p(void) +{ + int ret = sticker_data_set_group_name(g_dh, "samsung"); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_NONE); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_data_set_group_name_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets group name of sticker data. + */ +int utc_sticker_data_set_group_name_n(void) +{ + int ret = sticker_data_set_group_name(g_dh, NULL); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_data_get_group_name_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets group name of sticker data. + */ +int utc_sticker_data_get_group_name_p(void) +{ + char *group = NULL; + int ret = sticker_data_get_group_name(g_dh, &group); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_NONE); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + if (group) { + free(group); + group = NULL; + } + + return 0; +} + +/** + * @testcase utc_sticker_data_get_group_name_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets group name of sticker data. + */ +int utc_sticker_data_get_group_name_n(void) +{ + int ret = sticker_data_get_group_name(g_dh, NULL); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_data_set_thumbnail_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets thumbnail of sticker data. + */ +int utc_sticker_data_set_thumbnail_p(void) +{ + int ret = sticker_data_set_thumbnail(g_dh, "/res/test.png"); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_NONE); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_data_set_thumbnail_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets thumbnail of sticker data. + */ +int utc_sticker_data_set_thumbnail_n(void) +{ + int ret = sticker_data_set_thumbnail(g_dh, NULL); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_data_set_thumbnail_n2 + * @since_tizen 5.5 + * @description Negative UTC of the function that sets thumbnail of sticker data. + */ +int utc_sticker_data_set_thumbnail_n2(void) +{ + int ret = sticker_data_set_thumbnail(g_dh, "/aaa/bbb/ccc.png"); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_data_get_thumbnail_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets thumbnail of sticker data. + */ +int utc_sticker_data_get_thumbnail_p(void) +{ + char *thumbnail = NULL; + int ret = sticker_data_get_thumbnail(g_dh, &thumbnail); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_NONE); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + if (thumbnail) { + free(thumbnail); + thumbnail = NULL; + } + + return 0; +} + +/** + * @testcase utc_sticker_data_get_thumbnail_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets thumbnail of sticker data. + */ +int utc_sticker_data_get_thumbnail_n(void) +{ + int ret = sticker_data_get_thumbnail(g_dh, NULL); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_data_set_description_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets description of sticker data. + */ +int utc_sticker_data_set_description_p(void) +{ + int ret = sticker_data_set_description(g_dh, "capi-ui-sticker TCT Test"); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_NONE); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_data_set_description_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets description of sticker data. + */ +int utc_sticker_data_set_description_n(void) +{ + int ret = sticker_data_set_description(g_dh, NULL); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_data_get_description_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets description of sticker data. + */ +int utc_sticker_data_get_description_p(void) +{ + char *description = NULL; + int ret = sticker_data_get_description(g_dh, &description); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_NONE); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + if (description) { + free(description); + description = NULL; + } + + return 0; +} + +/** + * @testcase utc_sticker_data_get_description_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets description of sticker data. + */ +int utc_sticker_data_get_description_n(void) +{ + int ret = sticker_data_get_description(g_dh, NULL); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_data_get_date_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets last updated date. + */ +int utc_sticker_data_get_date_p(void) +{ + char *date = NULL; + int ret = sticker_data_get_date(g_dh, &date); + if (sticker_supported == true) + assert_neq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + if (date) { + free(date); + date = NULL; + } + + return 0; +} + +/** + * @testcase utc_sticker_data_get_date_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets last updated date. + */ +int utc_sticker_data_get_date_n(void) +{ + int ret = sticker_data_get_date(g_dh, NULL); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} \ No newline at end of file diff --git a/src/utc/capi-ui-sticker/utc-capi-ui-sticker_provider.c b/src/utc/capi-ui-sticker/utc-capi-ui-sticker_provider.c new file mode 100644 index 000000000..e90f05433 --- /dev/null +++ b/src/utc/capi-ui-sticker/utc-capi-ui-sticker_provider.c @@ -0,0 +1,433 @@ +// +// 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 +#include + +#define STICKER_FEATURE "tizen.org/feature/ui_service.sticker" +#define TIMEOUT_CB 15000 + +GMainLoop *g_MainLoop; +int g_nTimeoutId; +static bool sticker_supported = false; +static bool callback_result = false; +static sticker_data_h g_dh = NULL; +static sticker_provider_h g_ph = NULL; + +gboolean TimeoutFunction(gpointer data) +{ + GMainLoop *pMainLoop = NULL; + pMainLoop = (GMainLoop *)data; + if (pMainLoop != NULL) + g_main_loop_quit(pMainLoop); + + return false; +} + +#define RUN_POLLING_LOOP { \ + if (callback_result == false) { \ + g_MainLoop = g_main_loop_new(NULL, false); \ + g_nTimeoutId = g_timeout_add(TIMEOUT_CB, TimeoutFunction, g_MainLoop); \ + g_main_loop_run(g_MainLoop); \ + g_source_remove(g_nTimeoutId); \ + g_MainLoop = NULL; \ + g_nTimeoutId = 0; \ + } \ +} + +#define QUIT_GMAIN_LOOP { \ + if (g_MainLoop) { \ + g_main_loop_quit(g_MainLoop); \ + g_MainLoop = NULL; \ + } \ +} + +static void insert_finished_cb(sticker_error_e error, void *user_data) +{ + callback_result = true; + QUIT_GMAIN_LOOP; +} + +static void negative_insert_finished_cb(sticker_error_e error, void *user_data) +{ +} + +static void sticker_data_foreach_cb(sticker_data_h data_handle, void *user_data) +{ + callback_result = true; +} + +static void foreach_to_check_del(sticker_data_h data_handle, void *user_data) +{ + sticker_provider_delete_data(g_ph, data_handle); +} + +/** + * @function utc_capi_ui_sticker_provider_startup + * @description Called before each test + * @parameter NA + * @return NA + */ +void utc_capi_ui_sticker_provider_startup(void) +{ + if (!system_info_get_platform_bool(STICKER_FEATURE, &sticker_supported)) { + if (sticker_supported != true) + fprintf(stderr, "This device is not support Sticker API.\n"); + } + + if (sticker_supported == true) { + sticker_provider_create(&g_ph); + sticker_data_create(&g_dh); + sticker_data_set_uri(g_dh, STICKER_DATA_URI_WEB_RESOURCE, "www.samsung.com"); + sticker_data_add_keyword(g_dh, "smile"); + sticker_data_add_keyword(g_dh, "face"); + sticker_data_add_keyword(g_dh, "cute"); + sticker_data_set_group_name(g_dh, "tizen"); + sticker_data_set_thumbnail(g_dh, "/res/test.png"); + sticker_data_set_description(g_dh, "TCT Test"); + } +} + +/** + * @function utc_capi_ui_sticker_provider_cleanup + * @description Called after each test + * @parameter NA + * @return NA + */ +void utc_capi_ui_sticker_provider_cleanup(void) +{ + if (sticker_supported == true) { + int result; + sticker_provider_data_foreach_all(g_ph, 0, 1000, &result, foreach_to_check_del, NULL); + sticker_provider_destroy(g_ph); + sticker_data_destroy(g_dh); + g_ph = NULL; + g_dh = NULL; + } +} + + +/** + * @testcase utc_sticker_provider_create_p + * @since_tizen 5.5 + * @description Positive UTC of the function that creates sticker provider handle. + */ +int utc_sticker_provider_create_p(void) +{ + sticker_provider_h provider_handle = NULL; + int ret = sticker_provider_create(&provider_handle); + if (sticker_supported == true) { + assert_eq(ret, STICKER_ERROR_NONE); + sticker_provider_destroy(provider_handle); + provider_handle = NULL; + } else { + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_sticker_provider_create_n + * @since_tizen 5.5 + * @description Negative UTC of the function that creates sticker provider handle. + */ +int utc_sticker_provider_create_n(void) +{ + int ret = sticker_provider_create(NULL); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_provider_destroy_p + * @since_tizen 5.5 + * @description Positive UTC of the function that destroys sticker provider handle. + */ +int utc_sticker_provider_destroy_p(void) +{ + sticker_provider_h provider_handle = NULL; + int ret = sticker_provider_create(&provider_handle); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_NONE); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + ret = sticker_provider_destroy(provider_handle); + provider_handle = NULL; + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_NONE); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_provider_destroy_n + * @since_tizen 5.5 + * @description Negative UTC of the function that destroys sticker provider handle. + */ +int utc_sticker_provider_destroy_n(void) +{ + int ret = sticker_provider_destroy(NULL); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_provider_insert_data_p + * @since_tizen 5.5 + * @description Positive UTC of the function that inserts sticker data to database. + */ +int utc_sticker_provider_insert_data_p(void) +{ + int ret = sticker_provider_insert_data(g_ph, g_dh); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_NONE); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_provider_insert_data_n + * @since_tizen 5.5 + * @description Negative UTC of the function that inserts sticker data to database. + */ +int utc_sticker_provider_insert_data_n(void) +{ + int ret = sticker_provider_insert_data(g_ph, NULL); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_provider_insert_data_by_json_file_p + * @since_tizen 5.5 + * @description Positive UTC of the function that inserts sticker data by json file. + */ +int utc_sticker_provider_insert_data_by_json_file_p(void) +{ + char *json_path = "/res/test.json"; + callback_result = false; + int ret = sticker_provider_insert_data_by_json_file(g_ph, json_path, insert_finished_cb, NULL); + if (sticker_supported == true) { + assert_eq(ret, STICKER_ERROR_NONE); + RUN_POLLING_LOOP; + assert_eq(callback_result, true); + } else { + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_sticker_provider_insert_data_by_json_file_n + * @since_tizen 5.5 + * @description Negative UTC of the function that inserts sticker data by json file. + */ +int utc_sticker_provider_insert_data_by_json_file_n(void) +{ + int ret = sticker_provider_insert_data_by_json_file(g_ph, NULL, NULL, NULL); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_provider_insert_data_by_json_file_n2 + * @since_tizen 5.5 + * @description Negative UTC of the function that inserts sticker data by json file. + */ +int utc_sticker_provider_insert_data_by_json_file_n2(void) +{ + char *json_path = "/res/negative_test.json"; + int ret = sticker_provider_insert_data_by_json_file(g_ph, json_path, negative_insert_finished_cb, NULL); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_provider_update_data_p + * @since_tizen 5.5 + * @description Positive UTC of the function that updates sticker data. + */ +int utc_sticker_provider_update_data_p(void) +{ + sticker_provider_insert_data(g_ph, g_dh); + sticker_data_set_group_name(g_dh, "Samsung"); + int ret = sticker_provider_update_data(g_ph, g_dh); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_NONE); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_provider_update_data_n + * @since_tizen 5.5 + * @description Negative UTC of the function that updates sticker data. + */ +int utc_sticker_provider_update_data_n(void) +{ + sticker_data_h temp_handle = NULL; + sticker_data_create(&temp_handle); + int ret = sticker_provider_update_data(g_ph, temp_handle); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + sticker_data_destroy(temp_handle); + + return 0; +} + +/** + * @testcase utc_sticker_provider_delete_data_p + * @since_tizen 5.5 + * @description Positive UTC of the function that deletes sticker data. + */ +int utc_sticker_provider_delete_data_p(void) +{ + sticker_provider_insert_data(g_ph, g_dh); + int ret = sticker_provider_delete_data(g_ph, g_dh); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_NONE); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_provider_delete_data_n + * @since_tizen 5.5 + * @description Negative UTC of the function that deletes sticker data. + */ +int utc_sticker_provider_delete_data_n(void) +{ + sticker_data_h temp_handle = NULL; + sticker_data_create(&temp_handle); + int ret = sticker_provider_delete_data(g_ph, temp_handle); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + sticker_data_destroy(temp_handle); + + return 0; +} + +/** + * @testcase utc_sticker_provider_get_sticker_count_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets the count of stickers stored by tct application. + */ +int utc_sticker_provider_get_sticker_count_p(void) +{ + int count = -1; + int ret = sticker_provider_get_sticker_count(g_ph, &count); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_NONE); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_provider_get_sticker_count_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets the count of stickers stored by tct application. + */ +int utc_sticker_provider_get_sticker_count_n(void) +{ + int ret = sticker_provider_get_sticker_count(g_ph, NULL); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} + +/** + * @testcase utc_sticker_provider_data_foreach_all_p + * @since_tizen 5.5 + * @description Positive UTC of the function that retrieves all sticker data stored by tct application. + */ +int utc_sticker_provider_data_foreach_all_p(void) +{ + int result = 0; + callback_result = false; + sticker_provider_insert_data(g_ph, g_dh); + int ret = sticker_provider_data_foreach_all(g_ph, 0, 1000, &result, sticker_data_foreach_cb, NULL); + if (sticker_supported == true) { + assert_eq(callback_result, true); + assert_eq(ret, STICKER_ERROR_NONE); + } + else { + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_sticker_provider_data_foreach_all_n + * @since_tizen 5.5 + * @description Negative UTC of the function that retrieves all sticker data stored by tct application. + */ +int utc_sticker_provider_data_foreach_all_n(void) +{ + int result = 0; + int ret = sticker_provider_data_foreach_all(g_ph, -1, 0, &result, sticker_data_foreach_cb, NULL); + if (sticker_supported == true) + assert_eq(ret, STICKER_ERROR_INVALID_PARAMETER); + else + assert_eq(ret, STICKER_ERROR_NOT_SUPPORTED); + + return 0; +} \ No newline at end of file